LibreOffice Module sw (master) 1
pview.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#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_PVIEW_HXX
20#define INCLUDED_SW_SOURCE_UIBASE_INC_PVIEW_HXX
21
22#include <tools/link.hxx>
23#include <tools/fract.hxx>
24#include <vcl/window.hxx>
25#include <sfx2/viewfrm.hxx>
26#include <sfx2/viewfac.hxx>
27#include <sfx2/viewsh.hxx>
28#include <sfx2/zoomitem.hxx>
29#include <swdllapi.h>
30#include <shellid.hxx>
31
32class SwViewOption;
33class SwDocShell;
34class SwScrollbar;
35class SwViewShell;
36class SwPagePreview;
37class ImageButton;
38class Button;
39class SwRect;
41class CommandEvent;
44
46class SAL_DLLPUBLIC_RTTI SwPagePreviewWin final : public vcl::Window
47{
49 sal_uInt16 mnSttPage;
50 sal_Int16 mnRow;
51 sal_Int16 mnCol;
58
59 void SetPagePreview( sal_Int16 nRow, sal_Int16 nCol );
60
61 using Window::Scroll;
62
63public:
64 SwPagePreviewWin( vcl::Window* pParent, SwPagePreview& rView );
65 virtual ~SwPagePreviewWin() override;
66
67 // calls SwViewShell::Paint
68 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
69 virtual void KeyInput( const KeyEvent & ) override;
70 virtual void Command( const CommandEvent& rCEvt ) override;
71 virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
72 virtual void DataChanged( const DataChangedEvent& ) override;
73
74 void SetViewShell( SwViewShell* pShell );
75
77 {
78 return mpViewShell;
79 }
80
81 sal_Int16 GetRow() const
82 {
83 return mnRow;
84 }
85
86 sal_Int16 GetCol() const
87 {
88 return mnCol;
89 }
90
91 sal_uInt16 GetSttPage() const
92 {
93 return mnSttPage;
94 }
95
96 void SetSttPage(sal_uInt16 n)
97 {
98 mnSttPage = n;
99 }
100
105 sal_uInt16 SelectedPage() const;
106
112 void SetSelectedPage( sal_uInt16 _nSelectedPageNum );
113
114 // If we only have one column we do not have a oth page
115 sal_uInt16 GetDefSttPage() const { return 1 == mnCol ? 1 : 0; }
116
117 void CalcWish( sal_Int16 nNewRow, sal_Int16 nNewCol );
118
119 void SetWinSize( const Size& rNewSize );
120
121 // Add <MV_SELPAGE>, <MV_SCROLL>
122 enum MoveMode{ MV_CALC, MV_PAGE_UP, MV_PAGE_DOWN, MV_DOC_STT, MV_DOC_END,
123 MV_SELPAGE, MV_SCROLL, MV_NEWWINSIZE, MV_SPECIFIC_PAGE };
124 bool MovePage( int eMoveMode );
125
126 // Create the status bar's string
127 OUString GetStatusStr( sal_uInt16 nPageCount ) const;
128
129 void RepaintCoreRect( const SwRect& rRect );
130
136 void AdjustPreviewToNewZoom( const sal_uInt16 _nZoomFactor,
137 const SvxZoomType _eZoomType );
138
140 {
141 return maPaintedPreviewDocRect;
142 }
143
144 void Scroll(tools::Long nXMove, tools::Long nYMove, ScrollFlags nFlags = ScrollFlags::NONE) override;
145
153 bool SetBookPreviewMode( const bool _bBookPreview );
154
155 virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
156};
157
162{
163 // ViewWindow and handle to core
164 // current dispatcher shell
166 //viewdata of the previous SwView and the new cursor position
168 //and the new cursor position if the user double click in the PagePreview
170 // to support keyboard the number of the page to go to can be set too
171 sal_uInt16 m_nNewPage;
172 // visible range
173 OUString m_sPageStr;
176
177 // MDI control elements
182
183 sal_uInt16 mnPageCount;
185
186 // New members to reset design mode at draw view for form shell on switching
187 // back from writer page preview to normal view.
190
191 SAL_DLLPRIVATE void Init();
192 SAL_DLLPRIVATE Point AlignToPixel(const Point& rPt) const;
193
194 SAL_DLLPRIVATE void CreateScrollbar( bool bHori);
195 DECL_DLLPRIVATE_LINK(HoriScrollHdl, weld::Scrollbar&, void);
196 DECL_DLLPRIVATE_LINK(VertScrollHdl, weld::Scrollbar&, void);
197 SAL_DLLPRIVATE void ScrollHdl(weld::Scrollbar&, bool bHorizontal);
198 SAL_DLLPRIVATE void EndScrollHdl(weld::Scrollbar&, bool bHorizontal);
199 SAL_DLLPRIVATE bool ChgPage( int eMvMode, bool bUpdateScrollbar = true );
200
201 SAL_DLLPRIVATE virtual SfxPrinter* GetPrinter( bool bCreate = false ) override;
202 SAL_DLLPRIVATE virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL ) override;
203 SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const override;
204 SAL_DLLPRIVATE virtual std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rOptions) override;
205
206 SAL_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill );
207
217 SAL_DLLPRIVATE void ExecPgUpAndPgDown( const bool _bPgUp,
218 SfxRequest* _pReq );
219
220 virtual void InnerResizePixel( const Point &rOfs, const Size &rSize, bool inplaceEditModeChange ) override;
221 virtual void OuterResizePixel( const Point &rOfs, const Size &rSize ) override;
222
223 void Activate(bool bMDI) override;
224
225 void SetZoom(SvxZoomType eSet, sal_uInt16 nFactor);
226
227public:
230
231private:
233 static void InitInterface_Impl();
234
235public:
237 { return m_pViewWin->GetViewShell(); }
238 void RepaintCoreRect( const SwRect& rRect )
239 { m_pViewWin->RepaintCoreRect( rRect ); }
240
241 void DocSzChgd(const Size& rNewSize);
242
243 void SetVisArea( const tools::Rectangle& );
244
245 void ScrollViewSzChg();
246 void ScrollDocSzChg();
247 void ShowHScrollbar(bool bShow);
248 void ShowVScrollbar(bool bShow);
249 void EnableHScrollbar(bool bEnable);
250 void EnableVScrollbar(bool bEnable);
251
252 sal_uInt16 GetPageCount() const { return mnPageCount; }
253 sal_uInt16 GetSelectedPage() const {return m_pViewWin->SelectedPage();}
254
255 bool HandleWheelCommands( const CommandEvent& );
256
257 const OUString& GetPrevSwViewData() const { return m_sSwViewData; }
258 void SetNewCursorPos( const OUString& rStr ) { m_sNewCursorPosition = rStr; }
259 const OUString& GetNewCursorPos() const { return m_sNewCursorPosition; }
260
261 sal_uInt16 GetNewPage() const {return m_nNewPage;}
262
263 // Handler
264 void Execute(SfxRequest&);
265 void GetState(SfxItemSet&);
266 static void StateUndo(SfxItemSet&);
267
268 SwDocShell* GetDocShell();
269
270 // apply Accessibility options
271 void ApplyAccessibilityOptions();
272
273 // Inline method to request values of new members
274 // <mbResetFormDesignMode> and <mbFormDesignModeToReset>
276 {
277 return mbResetFormDesignMode;
278 }
279
281 {
282 return mbFormDesignModeToReset;
283 }
284
294 void SetVScrollbarThumbPos( const sal_uInt16 _nNewThumbPos );
295
297 virtual ~SwPagePreview() override;
298};
299
300
301#endif
302
303/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SfxPrinter * GetPrinter(bool bCreate=false)
virtual void Activate(bool IsMDIActivate) override
virtual void InnerResizePixel(const Point &rOfs, const Size &rSize, bool inplaceEditModeChange)
static void InitInterface_Impl()
virtual void OuterResizePixel(const Point &rOfs, const Size &rSize)
virtual bool HasPrintOptionsPage() const
virtual sal_uInt16 SetPrinter(SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags=SFX_PRINTER_ALL)
virtual std::unique_ptr< SfxTabPage > CreatePrintOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rOptions)
page preview functionality in the writer
Provides the VCL widget that is used for the main area of the File -> Print Preview window.
Definition: pview.hxx:47
Fraction maScale
Definition: pview.hxx:53
sal_uInt16 GetDefSttPage() const
Definition: pview.hxx:115
sal_Int16 mnRow
Definition: pview.hxx:50
sal_uInt16 mnSttPage
Definition: pview.hxx:49
sal_Int16 GetCol() const
Definition: pview.hxx:86
const tools::Rectangle & GetPaintedPreviewDocRect() const
Definition: pview.hxx:139
void SetSttPage(sal_uInt16 n)
Definition: pview.hxx:96
SwViewShell * mpViewShell
Definition: pview.hxx:48
Size maPxWinSize
Definition: pview.hxx:52
bool mbCalcScaleForPreviewLayout
Definition: pview.hxx:55
sal_Int16 mnCol
Definition: pview.hxx:51
sal_uInt16 GetSttPage() const
Definition: pview.hxx:91
SwViewShell * GetViewShell() const
Definition: pview.hxx:76
sal_Int16 GetRow() const
Definition: pview.hxx:81
tools::Rectangle maPaintedPreviewDocRect
Definition: pview.hxx:56
SwPagePreviewLayout * mpPgPreviewLayout
Definition: pview.hxx:57
SwPagePreview & mrView
Definition: pview.hxx:54
View of a document.
Definition: pview.hxx:162
bool mbHScrollbarEnabled
Definition: pview.hxx:180
bool mbVScrollbarEnabled
Definition: pview.hxx:181
OUString m_sSwViewData
Definition: pview.hxx:167
sal_uInt16 GetSelectedPage() const
Definition: pview.hxx:253
void RepaintCoreRect(const SwRect &rRect)
Definition: pview.hxx:238
VclPtr< SwScrollbar > m_pHScrollbar
Definition: pview.hxx:178
tools::Rectangle m_aVisArea
Definition: pview.hxx:175
VclPtr< SwPagePreviewWin > m_pViewWin
Definition: pview.hxx:165
sal_uInt16 GetPageCount() const
Definition: pview.hxx:252
VclPtr< SwScrollbar > m_pVScrollbar
Definition: pview.hxx:179
sal_uInt16 GetNewPage() const
Definition: pview.hxx:261
OUString m_sPageStr
Definition: pview.hxx:173
void SetNewCursorPos(const OUString &rStr)
Definition: pview.hxx:258
bool ResetFormDesignMode() const
Definition: pview.hxx:275
const OUString & GetNewCursorPos() const
Definition: pview.hxx:259
OUString m_sNewCursorPosition
Definition: pview.hxx:169
bool mbResetFormDesignMode
Definition: pview.hxx:188
bool m_bNormalPrint
Definition: pview.hxx:184
DECL_DLLPRIVATE_LINK(VertScrollHdl, weld::Scrollbar &, void)
sal_uInt16 m_nNewPage
Definition: pview.hxx:171
SwViewShell * GetViewShell() const
Definition: pview.hxx:236
bool FormDesignModeToReset() const
Definition: pview.hxx:280
DECL_DLLPRIVATE_LINK(HoriScrollHdl, weld::Scrollbar &, void)
const OUString & GetPrevSwViewData() const
Definition: pview.hxx:257
Size m_aDocSize
Definition: pview.hxx:174
SFX_DECL_VIEWFACTORY(SwPagePreview)
sal_uInt16 mnPageCount
Definition: pview.hxx:183
bool mbFormDesignModeToReset
Definition: pview.hxx:189
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
virtual void Command(const CommandEvent &rCEvt)
virtual void MouseButtonDown(const MouseEvent &rMEvt)
virtual void KeyInput(const KeyEvent &rKEvt)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible()
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
virtual void DataChanged(const DataChangedEvent &rDCEvt)
void Init()
sal_Int32 mnRow
sal_Int32 mnCol
sal_Int64 n
const ::avmedia::MediaItem * Execute(const SdrMarkView *pSdrView, SfxRequest const &rReq)
void GetState(const SdrMarkView *pSdrView, SfxItemSet &rSet)
long Long
#define SFX_DECL_INTERFACE(nId)
#define SW_PAGEPREVIEW
Definition: shellid.hxx:39
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
SfxPrinterChangeFlags
ScrollFlags
SvxZoomType