LibreOffice Module sd (master) 1
ViewShell.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 <rtl/ref.hxx>
23
24#include <sfx2/viewsh.hxx>
25#include <svl/typedwhich.hxx>
27#include <vcl/prntypes.hxx>
28#include <o3tl/deleter.hxx>
29#include <pres.hxx>
30#include "View.hxx"
31#include "fupoor.hxx"
32#include <sddllapi.h>
33
34#include <memory>
35
36class SdPage;
37class SvxRuler;
38class SdrOle2Obj; // for the ones, who have undefined parts of SVDRAW
39class SdDrawDocument;
41
42namespace weld
43{
44 class Window;
45}
46
47namespace com::sun::star::drawing { class XDrawSubController; }
48
49namespace sd {
50
51class DrawDocShell;
52class FrameView;
53class LayerTabBar;
54class ViewShellBase;
55class Window;
56class WindowUpdater;
57class ZoomList;
58
59#undef OUTPUT_DRAWMODE_COLOR
60#undef OUTPUT_DRAWMODE_CONTRAST
61
62const DrawModeFlags OUTPUT_DRAWMODE_COLOR = DrawModeFlags::Default;
64 = DrawModeFlags::GrayLine | DrawModeFlags::GrayFill
65 | DrawModeFlags::BlackText | DrawModeFlags::GrayBitmap
66 | DrawModeFlags::GrayGradient;
68 = DrawModeFlags::BlackLine | DrawModeFlags::BlackText
69 | DrawModeFlags::WhiteFill | DrawModeFlags::GrayBitmap
70 | DrawModeFlags::WhiteGradient;
72 = DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill
73 | DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient;
74
90class SAL_DLLPUBLIC_RTTI ViewShell
91 : public SfxShell
92{
93public:
94 enum ShellType {
96 ST_DRAW, // The Draw application.
97 ST_IMPRESS, // Main view of the Impress application.
103 ST_SIDEBAR
104 };
105 static const int MAX_HSPLIT_CNT = 1;
106 static const int MAX_VSPLIT_CNT = 1;
107 static const int MIN_SCROLLBAR_SIZE = 50;
108
109
110 ViewShell (
111 vcl::Window* pParentWindow,
112 ViewShellBase& rViewShellBase);
113 virtual ~ViewShell() override;
114
127 virtual void Init (bool bIsMainViewShell);
128
133 void Exit();
134
135 void Cancel();
136
140 vcl::Window* GetParentWindow() const { return mpParentWindow; }
141
142 sd::Window* GetContentWindow() const;
143
144 ::sd::View* GetView() const { return mpView; }
145 inline SdrView* GetDrawView() const;
146 SD_DLLPUBLIC DrawDocShell* GetDocSh() const;
147
148 SdDrawDocument* GetDoc() const;
149
150 SD_DLLPUBLIC SfxViewFrame* GetViewFrame() const;
151
155 ::sd::Window* GetActiveWindow() const { return mpActiveWindow;}
157
162 void SetActiveWindow (::sd::Window* pWindow);
163
171 const ::tools::Rectangle& GetAllWindowRect();
172
173 // Mouse- & Key-Events
174 virtual void PrePaint();
175 virtual void Paint (const ::tools::Rectangle& rRect, ::sd::Window* pWin);
176 virtual bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin);
177 virtual void MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin);
178 virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin);
179 virtual void MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin);
180 virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin);
181 bool RequestHelp( const HelpEvent& rEvt );
182 bool Notify( NotifyEvent const & rNEvt, ::sd::Window* pWin );
183
184 bool HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWin);
185
186 void SetUIUnit(FieldUnit eUnit);
187 void SetDefTabHRuler( sal_uInt16 nDefTab );
188
189 const SvxNumBulletItem* GetNumBulletItem(SfxItemSet& aNewAttr, TypedWhichId<SvxNumBulletItem>& nNumItemId);
190
191 bool HasRuler() const { return mbHasRulers;}
192 void SetRuler(bool bRuler);
193 // Hides horizontal, vertical scrollbar as well as scrollbox
194 void SetScrollBarsVisible(bool bVisible);
195
200 virtual void UpdateScrollBars();
202 void ScrollLines(::tools::Long nX, ::tools::Long nY);
203 virtual void SetZoom(::tools::Long nZoom);
204 ::tools::Long GetZoom() const;
205 virtual void SetZoomRect(const ::tools::Rectangle& rZoomRect);
206 void InitWindows(const Point& rViewOrigin, const Size& rViewSize,
207 const Point& rWinPos, bool bUpdate = false);
208 void InvalidateWindows();
213 virtual void UpdatePreview (SdPage* pPage);
214
215 void DrawMarkRect(const ::tools::Rectangle& rRect) const;
216
217 void ExecReq( SfxRequest &rReq );
218
219 ZoomList* GetZoomList() { return mpZoomList.get();}
220
221 FrameView* GetFrameView() { return mpFrameView; }
227 void SetFrameView (FrameView* pFrameView);
228 virtual void ReadFrameViewData(FrameView* pView);
229 virtual void WriteFrameViewData();
230 void WriteUserData();
231 void ReadUserData();
232
233 virtual bool ActivateObject(SdrOle2Obj* pObj, sal_Int32 nVerb);
234
241 virtual SdPage* GetActualPage() = 0;
242
246 virtual SdPage* getCurrentPage() const = 0;
247
248 const rtl::Reference<FuPoor>& GetOldFunction() const { return mxOldFunction; }
249 bool HasOldFunction() const { return mxOldFunction.is(); }
250 const rtl::Reference<FuPoor>& GetCurrentFunction() const { return mxCurrentFunction; }
251 bool HasCurrentFunction( sal_uInt16 nSID ) { return mxCurrentFunction.is() && (mxCurrentFunction->GetSlotID() == nSID ); }
252 bool HasCurrentFunction() const { return mxCurrentFunction.is(); }
253
254 void SetCurrentFunction(const rtl::Reference<FuPoor>& xFunction);
255 void SetOldFunction(const rtl::Reference<FuPoor>& xFunction);
256 void DeactivateCurrentFunction( bool bPermanent = false );
257
258 void SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize,
259 ::tools::Long nLeft, ::tools::Long nRight, ::tools::Long nUpper, ::tools::Long nLower,
260 bool bScaleAll, Orientation eOrient, sal_uInt16 nPaperBin,
261 bool bBackgroundFullSize );
262
263 void SetStartShowWithDialog( bool bIn ) { mbStartShowWithDialog = bIn; }
264 bool IsStartShowWithDialog() const { return mbStartShowWithDialog; }
265
266 sal_uInt16 GetPrintedHandoutPageNum() const { return mnPrintedHandoutPageNum; }
267 void SetPrintedHandoutPageNum (sal_uInt16 nPageNumber) {mnPrintedHandoutPageNum=nPageNumber; }
268
269 sal_uInt16 GetPrintedHandoutPageCount() const { return mnPrintedHandoutPageCount; }
270 void SetPrintedHandoutPageCount (sal_uInt16 nPageCount) {mnPrintedHandoutPageCount=nPageCount; }
271
272 virtual bool PrepareClose( bool bUI = true );
273
274 void GetMenuState(SfxItemSet& rSet);
275
276 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper,
277 ::sd::Window* pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer );
278 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper,
279 ::sd::Window* pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer );
280
281 virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& );
282 virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& );
283
285 virtual void VisAreaChanged(const ::tools::Rectangle& rRect);
286
295 virtual css::uno::Reference<css::accessibility::XAccessible>
296 CreateAccessibleDocumentView (::sd::Window* pWindow);
297
298 virtual void SwitchViewFireFocus( const css::uno::Reference< css::accessibility::XAccessible >& xAcc );
299 void SwitchActiveViewFireFocus( );
300 // Move these two methods from DrawViewShell to enable slide show view
301 void NotifyAccUpdate();
302 void fireSwitchCurrentPage(sal_Int32 pageIndex);
303 void SetWinViewPos(const Point& rWinPos);
304 Point const & GetWinViewPos() const;
305 Point const & GetViewOrigin() const;
306
312 ::sd::WindowUpdater* GetWindowUpdater() const;
313
317 SvBorder GetBorder();
318
323 virtual void Resize();
324
330 virtual void ArrangeGUIElements();
331
332 // virtual void OuterResizePixel(const Point &rPos, const Size &rSize);
333 // virtual void InnerResizePixel(const Point &rPos, const Size &rSize);
334
335 // Exported for unit test
336 SD_DLLPUBLIC ViewShellBase& GetViewShellBase() const;
337
343 bool IsMainViewShell() const;
344
349 void SetIsMainViewShell (bool bIsMainViewShell);
350
354 virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController() = 0;
355
358 SD_DLLPUBLIC ShellType GetShellType() const; //Export for unit test
359
369 virtual void Shutdown();
370
374 virtual ErrCode DoVerb(sal_Int32 nVerb);
375
376 virtual void UIActivating( SfxInPlaceClient* );
377 virtual void UIDeactivated( SfxInPlaceClient* );
378
382 virtual void ShowUIControls (bool bVisible);
383 bool IsPageFlipMode() const;
384
389 virtual bool RelocateToParentWindow (vcl::Window* pParentWindow);
390
408 virtual SdPage* CreateOrDuplicatePage (
409 SfxRequest& rRequest,
410 PageKind ePageKind,
411 SdPage* pPage,
412 const sal_Int32 nInsertPosition = -1);
413
415 void SetCursorMm100Position(const Point& rPosition, bool bPoint, bool bClearMark);
417 css::uno::Reference<css::datatransfer::XTransferable> GetSelectionTransferable() const;
419 void SetGraphicMm100Position(bool bStart, const Point& rPosition);
420
421 class Implementation;
422
423protected:
426 void DisposeFunctions();
427
428 friend class ViewShellBase;
429
435
446
449
454
457 std::unique_ptr<ZoomList> mpZoomList;
459 double mfAccumulatedZoom = 0;
460
464
465 bool mbStartShowWithDialog; // presentation is started by dialog
466 sal_uInt16 mnPrintedHandoutPageNum; // Page number of the handout page that is to be printed.
467 sal_uInt16 mnPrintedHandoutPageCount; // Page count of the handout pages that are to be printed.
468
469 //af bool bPrintDirectSelected; // Print only selected objects in direct print
470 //afString sPageRange; // pagerange if selected objects in direct print
471
481
484
485 std::unique_ptr<Implementation, o3tl::default_delete<Implementation>> mpImpl;
486
487 // Support methods for centralized UNDO/REDO
488 virtual SfxUndoManager* ImpGetUndoManager() const;
489 void ImpGetUndoStrings(SfxItemSet &rSet) const;
490 void ImpGetRedoStrings(SfxItemSet &rSet) const;
491 void ImpSidUndo(SfxRequest& rReq);
492 void ImpSidRedo(SfxRequest& rReq);
493
496
497 // virtual scroll handler, here, derivative classes can add themselves here
498 virtual void VirtHScrollHdl(ScrollAdaptor* pHScroll);
499 virtual void VirtVScrollHdl(ScrollAdaptor* pVScroll);
500
501 // virtual functions ruler handling
502 virtual VclPtr<SvxRuler> CreateHRuler(::sd::Window* pWin);
503 virtual VclPtr<SvxRuler> CreateVRuler(::sd::Window* pWin);
504 virtual void UpdateHRuler();
505 virtual void UpdateVRuler();
506
507 virtual void Activate(bool IsMDIActivate) override;
508 virtual void Deactivate(bool IsMDIActivate) override;
509
510 virtual void SetZoomFactor( const Fraction &rZoomX,
511 const Fraction &rZoomY );
512
532 void doShow();
533
534private:
540 ::std::unique_ptr< ::sd::WindowUpdater> mpWindowUpdater;
541
545 void construct();
546
549 void SetupRulers();
550};
551
553{
554 return static_cast<SdrView*>(mpView);
555}
556
557} // end of namespace sd
558
559/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DrawModeFlags
View for MDIFrame.
Definition: FrameView.hxx:36
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
This class contains (will contain) the implementation of methods that have not be accessible from the...
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
VclPtr< SvxRuler > mpHorizontalRuler
Horizontal ruler is not shown by default.
Definition: ViewShell.hxx:441
VclPtr< ScrollAdaptor > mpVerticalScrollBar
Vertical scroll bar for whole document is always visible.
Definition: ViewShell.hxx:439
const rtl::Reference< FuPoor > & GetCurrentFunction() const
Definition: ViewShell.hxx:250
virtual SdPage * getCurrentPage() const =0
FrameView * mpFrameView
Definition: ViewShell.hxx:453
std::unique_ptr< Implementation, o3tl::default_delete< Implementation > > mpImpl
Definition: ViewShell.hxx:485
std::unique_ptr< ZoomList > mpZoomList
Definition: ViewShell.hxx:457
bool HasCurrentFunction(sal_uInt16 nSID)
Definition: ViewShell.hxx:251
VclPtr< SvxRuler > mpVerticalRuler
Vertical ruler is not shown by default.
Definition: ViewShell.hxx:443
virtual SdPage * GetActualPage()=0
sal_uInt16 mnPrintedHandoutPageNum
Definition: ViewShell.hxx:466
VclPtr< vcl::Window > mpParentWindow
Definition: ViewShell.hxx:535
sal_uInt16 GetPrintedHandoutPageNum() const
Definition: ViewShell.hxx:266
ShellType meShellType
The type of the shell. Returned by GetShellType().
Definition: ViewShell.hxx:483
rtl::Reference< FuPoor > mxOldFunction
Definition: ViewShell.hxx:456
void SetPrintedHandoutPageNum(sal_uInt16 nPageNumber)
Definition: ViewShell.hxx:267
FrameView * GetFrameView()
Definition: ViewShell.hxx:221
VclPtr< ::sd::Window > mpActiveWindow
The active window.
Definition: ViewShell.hxx:451
::sd::Window * GetActiveWindow() const
The active window is usually the mpContentWindow.
Definition: ViewShell.hxx:155
void SetPrintedHandoutPageCount(sal_uInt16 nPageCount)
Definition: ViewShell.hxx:270
DECL_DLLPRIVATE_LINK(HScrollHdl, weld::Scrollbar &, void)
::sd::View * GetView() const
Definition: ViewShell.hxx:144
::std::unique_ptr< ::sd::WindowUpdater > mpWindowUpdater
This window updater is used to keep all relevant windows up to date with reference to the digit langu...
Definition: ViewShell.hxx:540
bool IsStartShowWithDialog() const
Definition: ViewShell.hxx:264
const rtl::Reference< FuPoor > & GetOldFunction() const
Definition: ViewShell.hxx:248
vcl::Window * GetParentWindow() const
Return the window that is the parent of all controls of this view shell.
Definition: ViewShell.hxx:140
::tools::Rectangle maAllWindowRectangle
Area covered by all windows, i.e.
Definition: ViewShell.hxx:480
sal_uInt16 mnPrintedHandoutPageCount
Definition: ViewShell.hxx:467
VclPtr< LayerTabBar > mpLayerTabBar
Layer tab bar.
Definition: ViewShell.hxx:445
ZoomList * GetZoomList()
Definition: ViewShell.hxx:219
bool HasOldFunction() const
Definition: ViewShell.hxx:249
::sd::View * mpView
Definition: ViewShell.hxx:452
DECL_DLLPRIVATE_LINK(VScrollHdl, weld::Scrollbar &, void)
rtl::Reference< FuPoor > mxCurrentFunction
Definition: ViewShell.hxx:455
void SetStartShowWithDialog(bool bIn)
Definition: ViewShell.hxx:263
bool mbStartShowWithDialog
Definition: ViewShell.hxx:465
double mfLastZoomScale
Definition: ViewShell.hxx:458
sal_uInt16 GetPrintedHandoutPageCount() const
Definition: ViewShell.hxx:269
VclPtr< sd::Window > mpContentWindow
Window inside the rulers and scroll bars that shows a view of the document.
Definition: ViewShell.hxx:434
bool HasCurrentFunction() const
Definition: ViewShell.hxx:252
virtual css::uno::Reference< css::drawing::XDrawSubController > CreateSubController()=0
Return a sub controller that implements the view shell specific part of the DrawController.
bool HasRuler() const
Definition: ViewShell.hxx:191
SdrView * GetDrawView() const
Definition: ViewShell.hxx:552
VclPtr< ScrollAdaptor > mpHorizontalScrollBar
Horizontal scroll bar for the current slide is displayed when needed.
Definition: ViewShell.hxx:437
bool mbHasRulers
This flag controls whether the rulers are visible.
Definition: ViewShell.hxx:448
The purpose of the <type>WindowUpdater</type> is to update output devices to take care of modified gl...
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
void Init()
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
FieldUnit
void Notify(SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld, const SwRect *pOldRect=nullptr)
const DrawModeFlags OUTPUT_DRAWMODE_CONTRAST
Definition: ViewShell.hxx:72
const DrawModeFlags OUTPUT_DRAWMODE_GRAYSCALE
Definition: ViewShell.hxx:64
const DrawModeFlags OUTPUT_DRAWMODE_BLACKWHITE
Definition: ViewShell.hxx:68
const DrawModeFlags OUTPUT_DRAWMODE_COLOR
Definition: ViewShell.hxx:62
long Long
PageKind
Definition: pres.hxx:45
Orientation
@ MouseButtonDown
#define SD_DLLPUBLIC
Definition: sddllapi.h:27
UnoViewSharedPtr mpView
signed char sal_Int8