1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
|
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _SWPVIEW_HXX
#define _SWPVIEW_HXX
#include <tools/link.hxx>
#include <vcl/window.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/viewfac.hxx>
#include <sfx2/viewsh.hxx>
#include <svx/zoomitem.hxx>
#include "swdllapi.h"
#include "shellid.hxx"
class SwViewOption;
class SwDocShell;
class SwScrollbar;
class ViewShell;
class SwPagePreView;
class ImageButton;
class Button;
class SwRect;
class DataChangedEvent;
class CommandEvent;
class SvtAccessibilityOptions;
// OD 12.12.2002 #103492#
class SwPagePreviewLayout;
// OD 24.03.2003 #108282# - delete member <mnVirtPage> and its accessor.
class SwPagePreViewWin : public Window
{
ViewShell* mpViewShell;
USHORT mnSttPage;
BYTE mnRow, mnCol;
Size maPxWinSize;
Fraction maScale;
SwPagePreView& mrView;
// OD 02.12.2002 #103492#
bool mbCalcScaleForPreviewLayout;
Rectangle maPaintedPreviewDocRect;
// OD 12.12.2002 #103492#
SwPagePreviewLayout* mpPgPrevwLayout;
void SetPagePreview( BYTE nRow, BYTE nCol );
using Window::Scroll;
public:
SwPagePreViewWin( Window* pParent, SwPagePreView& rView );
~SwPagePreViewWin();
//Ruft ViewShell::Paint
virtual void Paint( const Rectangle& rRect );
virtual void KeyInput( const KeyEvent & );
virtual void Command( const CommandEvent& rCEvt );
virtual void MouseButtonDown(const MouseEvent& rMEvt);
virtual void DataChanged( const DataChangedEvent& );
void SetViewShell( ViewShell* pShell );
ViewShell* GetViewShell() const { return mpViewShell; }
BYTE GetRow() const { return mnRow; }
void SetRow( BYTE n ) { if( n ) mnRow = n; }
BYTE GetCol() const { return mnCol; }
void SetCol( BYTE n ) { if( n ) mnCol = n; }
USHORT GetSttPage() const { return mnSttPage; }
void SetSttPage( USHORT n ) { mnSttPage = n; }
/** get selected page number of document preview
OD 13.12.2002 #103492#
@author OD
@return selected page number
*/
sal_uInt16 SelectedPage() const;
/** set selected page number in document preview
OD 13.12.2002 #103492#
@author OD
@param _nSelectedPageNum
input parameter - physical page number of page that will be the selected one.
*/
void SetSelectedPage( sal_uInt16 _nSelectedPageNum );
//JP 19.08.98: bei Einspaltigkeit gibt es keine 0. Seite!
USHORT GetDefSttPage() const { return 1 == mnCol ? 1 : 0; }
void CalcWish( BYTE nNewRow, BYTE nNewCol );
const Size& GetWinSize() const { return maPxWinSize; }
void SetWinSize( const Size& rNewSize );
// OD 18.12.2002 #103492# - add <MV_SELPAGE>, <MV_SCROLL>
enum MoveMode{ MV_CALC, MV_PAGE_UP, MV_PAGE_DOWN, MV_DOC_STT, MV_DOC_END,
MV_SELPAGE, MV_SCROLL, MV_NEWWINSIZE };
int MovePage( int eMoveMode );
// erzeuge den String fuer die StatusLeiste
void GetStatusStr( String& rStr, USHORT nPageCount ) const;
void RepaintCoreRect( const SwRect& rRect );
/** method to adjust preview to a new zoom factor
OD 02.12.2002 #103492#
paint of preview is prepared for a new zoom factor
OD 24.09.2003 #i19975# - zoom type has also been considered.
Thus, add new parameter <_eZoomType>
@author OD
*/
void AdjustPreviewToNewZoom( const sal_uInt16 _nZoomFactor,
const SvxZoomType _eZoomType );
const Rectangle& GetPaintedPreviewDocRect() const
{
return maPaintedPreviewDocRect;
}
void Scroll(long nXMove, long nYMove, USHORT nFlags = 0);
/** method to enable/disable book preview
OD 2004-03-05 #i18143#
@author OD
@param _bBookPreview
input parameter - boolean indicating, if book preview mode has to
switch on <TRUE> or of <FALSE>
@return boolean indicating, if book preview mode has changed.
*/
bool SetBookPreviewMode( const bool _bBookPreview );
virtual ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible>
CreateAccessible();
};
/*--------------------------------------------------------------------
Beschreibung: Sicht auf ein Dokument
--------------------------------------------------------------------*/
class SW_DLLPUBLIC SwPagePreView: public SfxViewShell
{
// ViewWindow und Henkel zur Core
// aktuelle Dispatcher-Shell
SwPagePreViewWin aViewWin;
//viewdata of the previous SwView and the new crsrposition
String sSwViewData,
//and the new cursor position if the user double click in the PagePreView
sNewCrsrPos;
// to support keyboard the number of the page to go to can be set too
USHORT nNewPage;
// Sichtbarer Bereich
String sPageStr;
Size aDocSz;
Rectangle aVisArea;
// MDI Bedienelemente
SwScrollbar *pHScrollbar;
SwScrollbar *pVScrollbar;
ImageButton *pPageUpBtn,
*pPageDownBtn;
// Dummy-Window zum F�llen der rechten unteren Ecke, wenn beide Scrollbars
// aktiv sind
Window *pScrollFill;
USHORT mnPageCount;
BOOL bNormalPrint;
// OD 09.01.2003 #106334#
// new members to reset design mode at draw view for form shell on switching
// back from writer page preview to normal view.
sal_Bool mbResetFormDesignMode:1;
sal_Bool mbFormDesignModeToReset:1;
SW_DLLPRIVATE void Init(const SwViewOption* = 0);
SW_DLLPRIVATE Point AlignToPixel(const Point& rPt) const;
SW_DLLPRIVATE int _CreateScrollbar( BOOL bHori );
SW_DLLPRIVATE DECL_LINK( ScrollHdl, SwScrollbar * );
SW_DLLPRIVATE DECL_LINK( EndScrollHdl, SwScrollbar * );
SW_DLLPRIVATE DECL_LINK( BtnPage, Button * );
SW_DLLPRIVATE int ChgPage( int eMvMode, int bUpdateScrollbar = TRUE );
SW_DLLPRIVATE virtual SfxPrinter* GetPrinter( BOOL bCreate = FALSE );
SW_DLLPRIVATE virtual USHORT SetPrinter( SfxPrinter *pNewPrinter, USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false );
SW_DLLPRIVATE virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent,
const SfxItemSet &rOptions );
SW_DLLPRIVATE virtual PrintDialog* CreatePrintDialog( Window *pParent );
SW_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill, BOOL bInner );
/** help method to execute SfxRequest FN_PAGE_UP and FN_PAGE_DOWN
OD 04.03.2003 #107369#
@param _bPgUp
input parameter - boolean that indicates, if FN_PAGE_UP or FN_PAGE_DOWN
has to be executed.
@param _pReq
optional input parameter - pointer to the <SfxRequest> instance, if existing.
@author OD
*/
SW_DLLPRIVATE void _ExecPgUpAndPgDown( const bool _bPgUp,
SfxRequest* _pReq = 0 );
protected:
virtual void InnerResizePixel( const Point &rOfs, const Size &rSize );
virtual void OuterResizePixel( const Point &rOfs, const Size &rSize );
virtual Size GetOptimalSizePixel() const;
void SetZoom(SvxZoomType eSet, USHORT nFactor);
public:
SFX_DECL_VIEWFACTORY(SwPagePreView);
SFX_DECL_INTERFACE(SW_PAGEPREVIEW)
TYPEINFO();
inline Window* GetFrameWindow() const { return &(GetViewFrame())->GetWindow(); }
inline ViewShell* GetViewShell() const { return aViewWin.GetViewShell(); }
inline const Rectangle& GetVisArea() const { return aVisArea; }
inline void GrabFocusViewWin() { aViewWin.GrabFocus(); }
inline void RepaintCoreRect( const SwRect& rRect )
{ aViewWin.RepaintCoreRect( rRect ); }
void DocSzChgd(const Size& rNewSize);
const Size& GetDocSz() const { return aDocSz; }
virtual void SetVisArea( const Rectangle&, BOOL bUpdateScrollbar = TRUE);
inline void AdjustEditWin();
void ScrollViewSzChg();
void ScrollDocSzChg();
void ShowHScrollbar(sal_Bool bShow);
void ShowVScrollbar(sal_Bool bShow);
USHORT GetPageCount() const { return mnPageCount; }
BOOL HandleWheelCommands( const CommandEvent& );
const String& GetPrevSwViewData() const { return sSwViewData; }
void SetNewCrsrPos( const String& rStr ) { sNewCrsrPos = rStr; }
const String& GetNewCrsrPos() const { return sNewCrsrPos; }
USHORT GetNewPage() const {return nNewPage;}
void SetNewPage(USHORT nSet) {nNewPage = nSet;}
// Handler
void Execute(SfxRequest&);
void GetState(SfxItemSet&);
void StateUndo(SfxItemSet&);
SwDocShell* GetDocShell();
//apply Accessiblity options
void ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions);
// OD 09.01.2003 #106334# - inline method to request values of new members
// <mbResetFormDesignMode> and <mbFormDesignModeToReset>
inline sal_Bool ResetFormDesignMode() const
{
return mbResetFormDesignMode;
}
inline sal_Bool FormDesignModeToReset() const
{
return mbFormDesignModeToReset;
}
/** adjust position of vertical scrollbar
OD 19.02.2003 #107369
Currently used, if the complete preview layout rows fit into to the given
window, if a new page is selected and this page is visible.
@author OD
@param _nNewThumbPos
input parameter - new position, which will be assigned to the vertical
scrollbar.
*/
void SetVScrollbarThumbPos( const sal_uInt16 _nNewThumbPos );
SwPagePreView( SfxViewFrame* pFrame, SfxViewShell* );
~SwPagePreView();
};
// ----------------- inline Methoden ----------------------
inline void SwPagePreView::AdjustEditWin()
{
OuterResizePixel( Point(), GetFrameWindow()->GetOutputSizePixel() );
}
#endif
|