LibreOffice Module sd (master) 1
DrawViewShell.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <memory>
23#include "ViewShell.hxx"
25#include "TabControl.hxx"
26#include <glob.hxx>
27#include <pres.hxx>
29#include <unotools/options.hxx>
30#include <sddllapi.h>
31#include <viewopt.hxx>
32
33namespace svx::sidebar { class SelectionChangeHandler; }
34namespace com::sun::star::lang { class XEventListener; }
35namespace com::sun::star::scanner { class XScannerManager2; }
36
37class Outliner;
38class SdPage;
39class SdStyleSheet;
41class TabBar;
42class SdrObject;
43class SdrPageView;
47class SdrLayer;
49struct ESelection;
51
52namespace sd {
53
54class DrawView;
55class LayerTabBar;
56class Ruler;
57class AnnotationManager;
58class ViewOverlayManager;
59
60#define CHECK_RANGE(nMin, nValue, nMax) ((nValue >= nMin) && (nValue <= nMax))
61
68class SAL_DLLPUBLIC_RTTI DrawViewShell
69 : public ViewShell,
70 public SfxListener,
72{
73public:
75
76private:
78 static void InitInterface_Impl();
79
80public:
91 ViewShellBase& rViewShellBase,
92 vcl::Window* pParentWindow,
93 PageKind ePageKind,
94 FrameView* pFrameView);
95
96 virtual ~DrawViewShell() override;
97
98 virtual void Init (bool bIsMainViewShell) override;
99
100 virtual void Shutdown() override;
101
102 void PrePaint() override;
103 virtual void Paint(const ::tools::Rectangle& rRect, ::sd::Window* pWin) override;
104
110 virtual void ArrangeGUIElements() override;
111
112 void HidePage();
113
114 virtual bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) override;
115 virtual void MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) override;
116 virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) override;
117 virtual void MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin) override;
118 virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin) override;
119 bool IsMouseButtonDown() const { return mbMouseButtonDown; }
120 bool IsMouseSelecting() const { return mbMouseSelecting; }
121
122 virtual void Resize() override;
123
124 void ShowMousePosInfo(const ::tools::Rectangle& rRect, ::sd::Window const * pWin);
125
126 virtual void ChangeEditMode (EditMode eMode, bool bIsLayerModeActive);
127
128 virtual void SetZoom( ::tools::Long nZoom ) override;
129 virtual void SetZoomRect( const ::tools::Rectangle& rZoomRect ) override;
130
131 void InsertURLField(const OUString& rURL, const OUString& rText, const OUString& rTarget);
132 void InsertURLButton(const OUString& rURL, const OUString& rText, const OUString& rTarget,
133 const Point* pPos);
134
135 void SelectionHasChanged();
136 void ModelHasChanged();
137 virtual void Activate(bool bIsMDIActivate) override;
138 virtual void Deactivate(bool IsMDIActivate) override;
139 virtual void UIActivating( SfxInPlaceClient* ) override;
140 virtual void UIDeactivated( SfxInPlaceClient* ) override;
141 OUString GetSelectionText( bool bCompleteWords );
142 bool HasSelection( bool bText ) const;
143
144 //If we are editing a PresObjKind::Outline return the Outliner and fill rSel
145 //with the current selection
146 ::Outliner* GetOutlinerForMasterPageOutlineTextObj(ESelection &rSel);
147
148 void ExecCtrl(SfxRequest& rReq);
149 void GetCtrlState(SfxItemSet& rSet);
150 void GetDrawAttrState(SfxItemSet& rSet);
151 void GetMenuState(SfxItemSet& rSet);
152 void GetTableMenuState(SfxItemSet& rSet);
158 void GetModeSwitchingMenuState (SfxItemSet &rSet);
159 void GetAttrState(SfxItemSet& rSet);
160 void GetSnapItemState(SfxItemSet& rSet);
161
162 void SetPageProperties (SfxRequest& rReq);
163 void GetPageProperties(SfxItemSet& rSet);
164 void GetMarginProperties(SfxItemSet& rSet);
165
166 void GetState (SfxItemSet& rSet);
167 void Execute (SfxRequest& rReq);
168
169 void ExecStatusBar(SfxRequest& rReq);
170 void GetStatusBarState(SfxItemSet& rSet);
171
172 void ExecOptionsBar(SfxRequest& rReq);
173 void GetOptionsBarState(SfxItemSet& rSet);
174
175 void ExecRuler(SfxRequest& rReq);
176 void GetRulerState(SfxItemSet& rSet);
177
178 void ExecFormText(SfxRequest& rReq);
179 void GetFormTextState(SfxItemSet& rSet);
180
181 void ExecAnimationWin(SfxRequest& rReq);
182 void GetAnimationWinState(SfxItemSet& rSet);
183
184 void ExecNavigatorWin(SfxRequest& rReq);
185 void GetNavigatorWinState(SfxItemSet& rSet);
186
187 void ExecutePropPanelAttr (SfxRequest const & rReq);
188 void GetStatePropPanelAttr(SfxItemSet& rSet);
189
190 void ExecEffectWin(SfxRequest& rReq);
191
192 void Update3DWindow();
193 void AssignFrom3DWindow();
194
195 void ExecGallery(SfxRequest const & rReq);
196
197 void ExecBmpMask( SfxRequest const & rReq );
198 void GetBmpMaskState( SfxItemSet& rSet );
199
200 void ExecIMap( SfxRequest const & rReq );
201 void GetIMapState( SfxItemSet& rSet );
202
203 void FuTemporary(SfxRequest& rReq);
204 void FuPermanent(SfxRequest& rReq);
205 void FuSupport(SfxRequest& rReq);
206 void FuDeleteSelectedObjects();
207 void FuSupportRotate(SfxRequest const & rReq);
208 void FuTable(SfxRequest& rReq);
209
210 void AttrExec (SfxRequest& rReq);
211 void AttrState (SfxItemSet& rSet);
212
213 void ExecGoToNextPage (SfxRequest& rReq);
214 void GetStateGoToNextPage (SfxItemSet& rSet);
215
216 void ExecGoToPreviousPage (SfxRequest& rReq);
217 void GetStateGoToPreviousPage (SfxItemSet& rSet);
218
219 void ExecGoToFirstPage (SfxRequest& rReq);
220 void GetStateGoToFirstPage (SfxItemSet& rSet);
221
222 void ExecGoToLastPage (SfxRequest& rReq);
223 void GetStateGoToLastPage (SfxItemSet& rSet);
224
225 SD_DLLPUBLIC void ExecChar(SfxRequest& rReq);
226
227 void ExecuteAnnotation (SfxRequest const & rRequest);
228 void GetAnnotationState (SfxItemSet& rItemSet);
229
230 void StartRulerDrag (const Ruler& rRuler, const MouseEvent& rMEvt);
231
232 virtual bool PrepareClose( bool bUI = true ) override;
233
234 PageKind GetPageKind() const { return mePageKind; }
235 void SetPageKind( PageKind ePageKind ) { mePageKind = ePageKind; }
236 const Point& GetMousePos() const { return maMousePos; }
237
238 EditMode GetEditMode() const { return meEditMode; }
239 virtual SdPage* GetActualPage() override { return mpActualPage; }
240
242 virtual SdPage* getCurrentPage() const override;
243
244 void ResetActualPage();
245 void ResetActualLayer();
246 bool SwitchPage(sal_uInt16 nPage, bool bAllowChangeFocus = true);
247 bool IsSwitchPageAllowed() const;
248
253 bool SelectPage(sal_uInt16 nPage, sal_uInt16 nSelect);
254 bool IsSelected(sal_uInt16 nPage);
255
256 void GotoBookmark(std::u16string_view rBookmark);
257 //Realize multi-selection of objects, If object is marked, the
258 //corresponding entry is set true, else the corresponding entry is set
259 //false.
260 void FreshNavigatrTree();
261 void MakeVisible(const ::tools::Rectangle& rRect, vcl::Window& rWin);
262
263 virtual void ReadFrameViewData(FrameView* pView) override;
264 virtual void WriteFrameViewData() override;
265
266 virtual ErrCode DoVerb(sal_Int32 nVerb) override;
267 virtual bool ActivateObject(SdrOle2Obj* pObj, sal_Int32 nVerb) override;
268
269 void SetZoomOnPage( bool bZoom ) { mbZoomOnPage = bZoom; }
270 bool IsZoomOnPage() const { return mbZoomOnPage; }
271 static void CheckLineTo (SfxRequest& rReq);
272 void SetChildWindowState( SfxItemSet& rSet );
273
274 void UpdateIMapDlg( SdrObject* pObj );
275
276 void LockInput();
277 void UnlockInput();
278 bool IsInputLocked() const { return mnLockCount > 0; }
279
280 sal_uInt16 GetCurPagePos() const { return maTabControl->GetCurPagePos(); }
281
286 virtual void ShowUIControls (bool bVisible) override;
287
288 void ScannerEvent();
289
290 bool IsLayerModeActive() const { return mbIsLayerModeActive;}
291
292 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper,
293 ::sd::Window* pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer ) override;
294 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper,
295 ::sd::Window* pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer ) override;
296
297 virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& ) override;
298 virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& ) override;
299
300 virtual void VisAreaChanged(const ::tools::Rectangle& rRect) override;
301
309 virtual css::uno::Reference<css::accessibility::XAccessible>
310 CreateAccessibleDocumentView (::sd::Window* pWindow) override;
311
320 int GetTabLayerCount() const;
321
329 int GetActiveTabLayerIndex() const;
330
339 void SetActiveTabLayerIndex (int nId);
340
343 TabControl& GetPageTabControl() { return *maTabControl; }
344
347 SD_DLLPUBLIC LayerTabBar* GetLayerTabControl(); // export for unit test
348
358 bool RenameSlide( sal_uInt16 nPageId, const OUString & rName );
359
361 void ModifyLayer( SdrLayer* pLayer, const OUString& rLayerName, const OUString& rLayerTitle, const OUString& rLayerDesc, bool bIsVisible, bool bIsLocked, bool bIsPrintable );
362
363 virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController() override;
364
365 DrawView* GetDrawView() const { return mpDrawView.get(); }
366
370 virtual bool RelocateToParentWindow (vcl::Window* pParentWindow) override;
371
372 OUString const & GetSidebarContextName() const;
373
374 bool IsInSwitchPage() const { return mbIsInSwitchPage; }
375
376 const SdViewOptions& GetViewOptions() const { return maViewOptions; }
377 //move this method to ViewShell.
378 //void NotifyAccUpdate();
379protected:
380 DECL_DLLPRIVATE_LINK( ClipboardChanged, TransferableDataHelper*, void );
381 DECL_DLLPRIVATE_LINK( TabSplitHdl, TabBar *, void );
384
385 void DeleteActualPage();
386 void DeleteActualLayer();
387
388 virtual VclPtr<SvxRuler> CreateHRuler(::sd::Window* pWin) override;
389 virtual VclPtr<SvxRuler> CreateVRuler(::sd::Window* pWin) override;
390 virtual void UpdateHRuler() override;
391 virtual void UpdateVRuler() override;
392 virtual void SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY) override;
393
394 void SetupPage( Size const &rSize, ::tools::Long nLeft, ::tools::Long nRight, ::tools::Long nUpper, ::tools::Long nLower,
395 bool bSize, bool bMargin, bool bScaleAll );
396
397 void GetMenuStateSel(SfxItemSet& rSet);
398
399private:
400 DrawViewShell(const DrawViewShell&) = delete;
402
403 void Construct (DrawDocShell* pDocSh, PageKind ePageKind);
404
405 void ImplDestroy();
406
411 virtual SdPage* CreateOrDuplicatePage (
412 SfxRequest& rRequest,
413 PageKind ePageKind,
414 SdPage* pPage,
415 const sal_Int32 nInsertPosition = -1) override;
416
417 void DuplicateSelectedSlides (SfxRequest& rRequest);
418
419 virtual void Notify (SfxBroadcaster& rBC, const SfxHint& rHint) override;
420
423 void StopSlideShow();
424
439 void ShowSnapLineContextMenu(weld::Window* pParent, const ::tools::Rectangle& rRect,
440 SdrPageView& rPageView, const sal_uInt16 nSnapLineIndex);
441
442 using ViewShell::Notify;
443
444 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* pCb, ConfigurationHints ) override;
445
446 void ConfigureAppBackgroundColor( svtools::ColorConfig* pColorConfig = nullptr );
447
449 bool ShouldDisableEditHyperlink() const;
452 void EnableEditHyperlink();
453
454private:
455 std::unique_ptr<DrawView> mpDrawView;
462 // tdf#137445 at context menu popup time set if the EditHyperlink entry
463 // should be disabled and use that state if queried about it if
464 // EditHyperlink is dispatched from the menu. So ignoring where the mouse
465 // currently happens to be when the menu was dismissed.
471 static bool mbPipette;
475 bool mbFirstTimeActivation = true;
484 ::std::unique_ptr<SvxClipboardFormatItem> mpCurrentClipboardFormats;
496 css::uno::Reference< css::scanner::XScannerManager2 > mxScannerManager;
497 css::uno::Reference< css::lang::XEventListener > mxScannerListener;
502 ::std::unique_ptr< AnnotationManager > mpAnnotationManager;
503 ::std::unique_ptr< ViewOverlayManager > mpViewOverlayManager;
504 std::vector<std::unique_ptr<SdrExternalToolEdit>> m_ExternalEdits;
506};
507
509 void MergePageBackgroundFilling(SdPage *pPage, SdStyleSheet *pStyleSheet, bool bMasterPage, SfxItemSet& rMergedAttr);
510
511} // end of namespace sd
512
513/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the stacked shells that provide graphical views to Draw and Impress documents and editi...
bool mbIsInSwitchPage
This flag is used to prevent nested calls to SwitchPage().
void SetZoomOnPage(bool bZoom)
bool IsZoomOnPage() const
void SetPageKind(PageKind ePageKind)
TabControl & GetPageTabControl()
Return a pointer to the tab control for pages.
css::uno::Reference< css::scanner::XScannerManager2 > mxScannerManager
EditMode GetEditMode() const
std::unique_ptr< DrawView > mpDrawView
bool IsMouseSelecting() const
bool IsLayerModeActive() const
rtl::Reference< TransferableClipboardListener > mxClipEvtLstnr
css::uno::Reference< css::lang::XEventListener > mxScannerListener
DrawViewShell(const DrawViewShell &)=delete
std::vector< std::unique_ptr< SdrExternalToolEdit > > m_ExternalEdits
sal_uInt16 GetCurPagePos() const
::std::unique_ptr< ViewOverlayManager > mpViewOverlayManager
DECL_DLLPRIVATE_LINK(NameObjectHdl, AbstractSvxObjectNameDialog &, bool)
const SdViewOptions & GetViewOptions() const
VclPtr< TabControl > maTabControl
RotateTransliteration m_aRotateCase
bool mbIsLayerModeActive
This flag controls whether the layer mode is active, i.e.
tools::AsynchronousCall maAsynchronousSwitchPageCall
On some occasions it is necessary to make SwitchPage calls asynchronously.
DECL_DLLPRIVATE_LINK(ClipboardChanged, TransferableDataHelper *, void)
SdViewOptions maViewOptions
bool IsInputLocked() const
::std::unique_ptr< SvxClipboardFormatItem > mpCurrentClipboardFormats
This item contains the clipboard formats of the current clipboard content that are supported both by ...
virtual SdPage * GetActualPage() override
DrawView * GetDrawView() const
DrawViewShell & operator=(const DrawViewShell &)=delete
DECL_DLLPRIVATE_LINK(RenameSlideHdl, AbstractSvxNameDialog &, bool)
::tools::Rectangle maMarkRect
::std::unique_ptr< AnnotationManager > mpAnnotationManager
static bool mbPipette
PageKind GetPageKind() const
const Point & GetMousePos() const
std::optional< bool > moAtContextMenu_DisableEditHyperlink
bool IsMouseButtonDown() const
bool IsInSwitchPage() const
::rtl::Reference< svx::sidebar::SelectionChangeHandler > mpSelectionChangeHandler
Listen for selection changes and broadcast context changes for the sidebar.
DECL_DLLPRIVATE_LINK(TabSplitHdl, TabBar *, void)
Derivative of sd::View; contains also a pointer to the document.
Definition: drawview.hxx:35
View for MDIFrame.
Definition: FrameView.hxx:36
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
bool Notify(NotifyEvent const &rNEvt, ::sd::Window *pWin)
Definition: viewshel.cxx:645
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
Store a function object and execute it asynchronous.
void Init()
void Notify(SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld, const SwRect *pOldRect=nullptr)
#define SD_IF_SDDRAWVIEWSHELL
Definition: glob.hxx:26
void MergePageBackgroundFilling(SdPage *pPage, SdStyleSheet *pStyleSheet, bool bMasterPage, SfxItemSet &rMergedAttr)
Merge the background properties together and deposit the result in rMergeAttr.
Definition: fupage.cxx:164
const ::avmedia::MediaItem * Execute(const SdrMarkView *pSdrView, SfxRequest const &rReq)
void GetState(const SdrMarkView *pSdrView, SfxItemSet &rSet)
long Long
ConfigurationHints
EditMode
Definition: pres.hxx:53
PageKind
Definition: pres.hxx:45
@ MouseButtonDown
#define SD_DLLPUBLIC
Definition: sddllapi.h:27
#define SFX_DECL_INTERFACE(nId)
sal_uIntPtr sal_uLong
View options for the current view.
Definition: viewopt.hxx:25
signed char sal_Int8