Line data Source code
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_UI_INC_VIEW_HXX
20 : #define INCLUDED_SW_SOURCE_UI_INC_VIEW_HXX
21 :
22 : #include <vcl/timer.hxx>
23 : #include <vcl/field.hxx>
24 : #include <vcl/floatwin.hxx>
25 : #include <svtools/htmlcfg.hxx>
26 : #include <sfx2/viewfac.hxx>
27 : #include <sfx2/viewsh.hxx>
28 : #include <sfx2/objsh.hxx>
29 : #include <editeng/svxenum.hxx>
30 : #include <sfx2/zoomitem.hxx>
31 : #include <svx/svxids.hrc>
32 : #include <editeng/editstat.hxx>
33 : #include "swdllapi.h"
34 : #include <swtypes.hxx>
35 : #include <shellid.hxx>
36 : #include <IMark.hxx>
37 :
38 : class Button;
39 : class ImageButton;
40 : class SwTxtFmtColl;
41 : class SwPageDesc;
42 : class SwFrmFmt;
43 : class SwCharFmt;
44 : class SwNumRule;
45 : class SwGlossaryHdl;
46 : class SwDrawBase;
47 : class SvxRuler;
48 : class SvxLRSpaceItem;
49 : class SwDocShell;
50 : class SwScrollbar;
51 : class SvBorder;
52 : class Ruler;
53 : class SvxSearchItem;
54 : class SearchAttrItemList;
55 : class SvxSearchDialog;
56 : class SdrView;
57 : class Dialog;
58 : class SdrObject;
59 : class SdrPageView;
60 : class SwHlpImageButton;
61 : class SwView;
62 : class SwEditWin;
63 : class SwWrtShell;
64 : class SwView_Impl;
65 : struct SwSearchOptions;
66 : class FmFormShell;
67 : class CommandEvent;
68 : class InsCaptionOpt;
69 : class SvGlobalName;
70 : class SvtAccessibilityOptions;
71 : class SwTransferable;
72 : class SwMailMergeConfigItem;
73 : class SwTxtNode; // #i23726#
74 : class SwFormatClipboard;
75 : struct SwConversionArgs;
76 : class Graphic;
77 : class GraphicFilter;
78 : class SwPostItMgr;
79 :
80 : namespace com{ namespace sun { namespace star {
81 : namespace view{ class XSelectionSupplier; }
82 : }}}
83 : namespace sfx2 { class FileDialogHelper; }
84 :
85 : const long nLeftOfst = -370;
86 : const long nScrollX = 30;
87 : const long nScrollY = 30;
88 :
89 : #define MINZOOM 20
90 : #define MAXZOOM 600
91 :
92 : #define MAX_MARKS 5
93 :
94 : #define CHILDWIN_LABEL 1
95 : #define CHILDWIN_MAILMERGE 2
96 :
97 : enum ShellModes
98 : {
99 : SHELL_MODE_TEXT,
100 : SHELL_MODE_FRAME,
101 : SHELL_MODE_GRAPHIC,
102 : SHELL_MODE_OBJECT,
103 : SHELL_MODE_DRAW,
104 : SHELL_MODE_DRAW_CTRL,
105 : SHELL_MODE_DRAW_FORM,
106 : SHELL_MODE_DRAWTEXT,
107 : SHELL_MODE_BEZIER,
108 : SHELL_MODE_LIST_TEXT,
109 : SHELL_MODE_TABLE_TEXT,
110 : SHELL_MODE_TABLE_LIST_TEXT,
111 : SHELL_MODE_MEDIA,
112 : SHELL_MODE_EXTRUDED_CUSTOMSHAPE,
113 : SHELL_MODE_FONTWORK,
114 : SHELL_MODE_POSTIT,
115 : SHELL_MODE_NAVIGATION
116 : };
117 :
118 : /*--------------------------------------------------------------------
119 : Description: apply a template
120 : --------------------------------------------------------------------*/
121 : struct SwApplyTemplate
122 : {
123 : union
124 : {
125 : SwTxtFmtColl* pTxtColl;
126 : SwPageDesc* pPageDesc;
127 : SwFrmFmt* pFrmFmt;
128 : SwCharFmt* pCharFmt;
129 : SwNumRule* pNumRule;
130 : } aColl;
131 :
132 : int eType;
133 : sal_uInt16 nColor;
134 : SwFormatClipboard* m_pFormatClipboard;
135 : bool bUndo;
136 :
137 0 : SwApplyTemplate() :
138 : eType(0),
139 : nColor(0),
140 : m_pFormatClipboard(0),
141 0 : bUndo(false)
142 : {
143 0 : aColl.pTxtColl = 0;
144 0 : }
145 : };
146 :
147 : /*--------------------------------------------------------------------
148 : Description: view of a document
149 : --------------------------------------------------------------------*/
150 : class SW_DLLPUBLIC SwView: public SfxViewShell
151 : {
152 : friend class SwHHCWrapper;
153 : friend class SwHyphWrapper;
154 : friend class SwView_Impl;
155 : friend class SwClipboardChangeListener;
156 :
157 : // search & replace
158 : static SvxSearchDialog *m_pSrchDlg;
159 : static SvxSearchItem *m_pSrchItem;
160 :
161 : static sal_uInt16 m_nInsertCtrlState;
162 : static sal_uInt16 m_nWebInsertCtrlState;
163 : static sal_uInt16 m_nInsertObjectCtrlState;
164 : static sal_uInt16 m_nInsertFieldCtrlState;
165 : static sal_uInt16 m_nMoveType; // for buttons below the scrollbar (viewmdi)
166 : static sal_Int32 m_nActMark; // current jump mark for unknown mark
167 :
168 : static bool m_bExtra;
169 : static sal_Bool m_bFound;
170 : static bool m_bJustOpened;
171 :
172 : static SearchAttrItemList* m_pSrchList;
173 : static SearchAttrItemList* m_pReplList;
174 :
175 : SvxHtmlOptions m_aHTMLOpt;
176 : Timer m_aTimer; // for delayed ChgLnks during an action
177 : OUString m_aPageStr; // status view, current page
178 : OUString m_sSwViewData,
179 : //and the new cursor position if the user double click in the PagePreview
180 : m_sNewCrsrPos;
181 : // to support keyboard the number of the page to go to can be set too
182 : sal_uInt16 m_nNewPage;
183 :
184 : sal_uInt16 m_nOldPageNum;
185 : OUString m_sOldSectionName;
186 :
187 : Point m_aTabColFromDocPos; // moving table colmns out of the document
188 : SwTxtNode * m_pNumRuleNodeFromDoc; // Moving indent of numrule #i23726#
189 :
190 : Size m_aDocSz; // current document size
191 : Rectangle m_aVisArea; // visible region
192 :
193 : SwEditWin *m_pEditWin;
194 : SwWrtShell *m_pWrtShell;
195 :
196 : SfxShell *m_pShell; // current SubShell at the dispatcher
197 : FmFormShell *m_pFormShell; // DB-FormShell
198 :
199 : SwView_Impl *m_pViewImpl; // Impl-data for UNO + Basic
200 :
201 : SwScrollbar *m_pHScrollbar, // MDI control elements
202 : *m_pVScrollbar;
203 :
204 : bool m_bHScrollbarEnabled;
205 : bool m_bVScrollbarEnabled;
206 :
207 : Window *m_pScrollFill; // dummy window for filling the lower right edge
208 : // when both scrollbars are active
209 :
210 : SvxRuler *m_pHRuler,
211 : *m_pVRuler;
212 : ImageButton *m_pTogglePageBtn;
213 :
214 : SwHlpImageButton *m_pPageUpBtn,
215 : *m_pPageDownBtn;
216 :
217 : SwGlossaryHdl *m_pGlosHdl; // handle text block
218 : SwDrawBase *m_pDrawActual;
219 :
220 : const SwFrmFmt *m_pLastTableFormat;
221 :
222 : SwFormatClipboard *m_pFormatClipboard; //holds data for format paintbrush
223 :
224 : SwPostItMgr *m_pPostItMgr;
225 :
226 : int m_nSelectionType;
227 : FloatingWindow *m_pFieldPopup;
228 :
229 : static const int m_nMASTERENUMCOMMANDS = 6;
230 :
231 : OUString m_aCurrShapeEnumCommand[ m_nMASTERENUMCOMMANDS ];
232 :
233 : sal_uInt16 m_nPageCnt;
234 :
235 : // current draw mode
236 : sal_uInt16 m_nDrawSfxId;
237 : OUString m_sDrawCustom; //some drawing types are marked with strings!
238 : sal_uInt16 m_nFormSfxId;
239 : sal_uInt16 m_nLastPasteDestination;
240 :
241 : // save the border distance status from SwView::StateTabWin to re-use it in SwView::ExecTabWin()
242 : sal_uInt16 m_nLeftBorderDistance;
243 : sal_uInt16 m_nRightBorderDistance;
244 :
245 : bool m_bWheelScrollInProgress;
246 :
247 : sal_Bool m_bCenterCrsr : 1,
248 : m_bTopCrsr : 1,
249 : m_bAlwaysShowSel : 1,
250 : m_bTabColFromDoc : 1,
251 : m_bNumIndentFromDoc : 1, // #i23726#
252 : m_bTabRowFromDoc : 1,
253 : m_bSetTabColFromDoc : 1 ,
254 : m_bSetTabRowFromDoc : 1,
255 : m_bAttrChgNotified : 1,
256 : m_bAttrChgNotifiedWithRegistrations : 1,
257 : m_bVerbsActive : 1,
258 : m_bDrawRotate : 1,
259 : m_bDrawSelMode : 1,
260 : m_bShowAtResize : 1,
261 : m_bInOuterResizePixel : 1,
262 : m_bInInnerResizePixel : 1,
263 : m_bPasteState : 1,
264 : m_bPasteSpecialState : 1,
265 : m_bInMailMerge : 1,
266 : m_bInDtor : 1, //detect destructor to prevent creating of sub shells while closing
267 : m_bOldShellWasPagePreview : 1,
268 : m_bIsPreviewDoubleClick : 1, // #i114045#
269 : m_bMakeSelectionVisible : 1, // transport the bookmark selection
270 : m_bAnnotationMode; ///< The real cursor position is inside an annotation.
271 :
272 : // methods for searching
273 : // set search context
274 : SAL_DLLPRIVATE sal_Bool SearchAndWrap(sal_Bool bApi = sal_False);
275 : SAL_DLLPRIVATE sal_Bool SearchAll(sal_uInt16* pFound = 0);
276 : SAL_DLLPRIVATE sal_uLong FUNC_Search( const SwSearchOptions& rOptions );
277 : SAL_DLLPRIVATE void Replace();
278 :
279 : bool IsDocumentBorder();
280 :
281 : SAL_DLLPRIVATE bool IsTextTool() const;
282 :
283 : // create control elements
284 : SAL_DLLPRIVATE void CreateBtns();
285 : SAL_DLLPRIVATE DECL_LINK( BtnPage, Button * );
286 :
287 : SAL_DLLPRIVATE DECL_LINK( TimeoutHdl, void* );
288 : SAL_DLLPRIVATE DECL_LINK( UpdatePercentHdl, GraphicFilter* );
289 :
290 : SAL_DLLPRIVATE DECL_LINK( FieldPopupModeEndHdl, void* );
291 :
292 : inline long GetXScroll() const;
293 : inline long GetYScroll() const;
294 : SAL_DLLPRIVATE Point AlignToPixel(const Point& rPt) const;
295 : SAL_DLLPRIVATE void CalcPt( Point* pPt,const Rectangle& rRect,
296 : sal_uInt16 nRangeX = USHRT_MAX,
297 : sal_uInt16 nRangeY = USHRT_MAX);
298 :
299 : SAL_DLLPRIVATE sal_Bool GetPageScrollUpOffset(SwTwips& rOff) const;
300 : SAL_DLLPRIVATE sal_Bool GetPageScrollDownOffset(SwTwips& rOff) const;
301 :
302 : // scrollbar movements
303 : SAL_DLLPRIVATE long PageUp();
304 : SAL_DLLPRIVATE long PageDown();
305 : SAL_DLLPRIVATE long PageUpCrsr(sal_Bool bSelect);
306 : SAL_DLLPRIVATE long PageDownCrsr(sal_Bool bSelect);
307 : SAL_DLLPRIVATE long PhyPageUp();
308 : SAL_DLLPRIVATE long PhyPageDown();
309 :
310 : SAL_DLLPRIVATE int _CreateScrollbar( sal_Bool bHori );
311 : SAL_DLLPRIVATE DECL_LINK( ScrollHdl, SwScrollbar * );
312 : SAL_DLLPRIVATE DECL_LINK( EndScrollHdl, SwScrollbar * );
313 : SAL_DLLPRIVATE sal_Bool UpdateScrollbars();
314 : SAL_DLLPRIVATE DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
315 : SAL_DLLPRIVATE void CalcVisArea( const Size &rPixelSz );
316 :
317 : SAL_DLLPRIVATE void CreatePageButtons(sal_Bool bShow);
318 :
319 : // linguistics functions
320 : SAL_DLLPRIVATE void HyphenateDocument();
321 : SAL_DLLPRIVATE sal_Bool IsDrawTextHyphenate();
322 : SAL_DLLPRIVATE void HyphenateDrawText();
323 : SAL_DLLPRIVATE void StartThesaurus();
324 :
325 : // text conversion
326 : SAL_DLLPRIVATE void StartTextConversion( LanguageType nSourceLang, LanguageType nTargetLang, const Font *pTargetFont, sal_Int32 nOptions, sal_Bool bIsInteractive );
327 :
328 : // used for spell checking and text conversion
329 : SAL_DLLPRIVATE void SpellStart( SvxSpellArea eSpell, bool bStartDone,
330 : bool bEndDone, SwConversionArgs *pConvArgs = 0 );
331 : SAL_DLLPRIVATE void SpellEnd( SwConversionArgs *pConvArgs = 0 );
332 :
333 : SAL_DLLPRIVATE void HyphStart( SvxSpellArea eSpell );
334 : SAL_DLLPRIVATE sal_Bool CheckSpecialCntnt();
335 0 : SAL_DLLPRIVATE void SpellKontext(sal_Bool bOn = sal_True)
336 0 : { m_bCenterCrsr = bOn; m_bAlwaysShowSel = bOn; }
337 :
338 : // methods for printing
339 : SAL_DLLPRIVATE virtual SfxPrinter* GetPrinter( bool bCreate = false ) SAL_OVERRIDE;
340 : SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const SAL_OVERRIDE;
341 : SAL_DLLPRIVATE virtual SfxTabPage* CreatePrintOptionsPage( Window* pParent,
342 : const SfxItemSet& rSet) SAL_OVERRIDE;
343 : // for readonly switching
344 : SAL_DLLPRIVATE virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
345 : SAL_DLLPRIVATE void _CheckReadonlyState();
346 : SAL_DLLPRIVATE void _CheckReadonlySelection();
347 :
348 : // method for rotating PageDesc
349 : SAL_DLLPRIVATE void SwapPageMargin(const SwPageDesc&, SvxLRSpaceItem& rLR);
350 :
351 : SAL_DLLPRIVATE void _SetZoom( const Size &rEditSz,
352 : SvxZoomType eZoomType,
353 : short nFactor = 100,
354 : sal_Bool bViewOnly = sal_False);
355 : SAL_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill, sal_Bool bInner );
356 :
357 : SAL_DLLPRIVATE void ShowAtResize();
358 :
359 : SAL_DLLPRIVATE virtual void Move() SAL_OVERRIDE;
360 :
361 : SAL_DLLPRIVATE void DocumentStatsChanged();
362 :
363 : public: // #i123922# Needs to be called from a 2nd place now as a helper method
364 : SAL_DLLPRIVATE sal_Bool InsertGraphicDlg( SfxRequest& );
365 :
366 : protected:
367 :
368 0 : SwView_Impl* GetViewImpl() {return m_pViewImpl;}
369 :
370 : void ImpSetVerb( int nSelType );
371 :
372 0 : int GetSelectionType() const { return m_nSelectionType; }
373 0 : void SetSelectionType(int nSet) { m_nSelectionType = nSet;}
374 :
375 : // for SwWebView
376 0 : void SetShell( SfxShell* pS ) { m_pShell = pS; }
377 0 : void SetFormShell( FmFormShell* pSh ) { m_pFormShell = pSh; }
378 :
379 : virtual void SelectShell();
380 :
381 : virtual void Activate(bool) SAL_OVERRIDE;
382 : virtual void Deactivate(bool) SAL_OVERRIDE;
383 : virtual void InnerResizePixel( const Point &rOfs, const Size &rSize ) SAL_OVERRIDE;
384 : virtual void OuterResizePixel( const Point &rOfs, const Size &rSize ) SAL_OVERRIDE;
385 :
386 : void SetImageButtonColor(Color& rColor);
387 :
388 0 : const SwFrmFmt* GetLastTblFrmFmt() const {return m_pLastTableFormat;}
389 0 : void SetLastTblFrmFmt(const SwFrmFmt* pSet) {m_pLastTableFormat = pSet;}
390 :
391 : // form letter execution
392 : void GenerateFormLetter(sal_Bool bUseCurrentDocument);
393 :
394 : using SfxShell::GetDispatcher;
395 :
396 : public:
397 :
398 0 : SFX_DECL_VIEWFACTORY(SwView);
399 0 : SFX_DECL_INTERFACE(SW_VIEWSHELL)
400 : TYPEINFO_OVERRIDE();
401 :
402 : SfxDispatcher &GetDispatcher();
403 :
404 : void GotFocus() const;
405 : virtual SdrView* GetDrawView() const SAL_OVERRIDE;
406 : virtual bool HasUIFeature( sal_uInt32 nFeature ) SAL_OVERRIDE;
407 : virtual void ShowCursor( bool bOn = true ) SAL_OVERRIDE;
408 : virtual ErrCode DoVerb( long nVerb ) SAL_OVERRIDE;
409 :
410 : virtual sal_uInt16 SetPrinter( SfxPrinter* pNew,
411 : sal_uInt16 nDiff = SFX_PRINTER_ALL, bool bIsAPI=false) SAL_OVERRIDE;
412 : ShellModes GetShellMode();
413 :
414 : com::sun::star::view::XSelectionSupplier* GetUNOObject();
415 :
416 : OUString GetSelectionTextParam( bool bCompleteWords,
417 : bool bEraseTrail );
418 : virtual bool HasSelection( bool bText ) const SAL_OVERRIDE;
419 : virtual OUString GetSelectionText( bool bCompleteWords = false ) SAL_OVERRIDE;
420 : virtual bool PrepareClose( bool bUI = true ) SAL_OVERRIDE;
421 : virtual void MarginChanged() SAL_OVERRIDE;
422 :
423 : // replace word/selection with text from the thesaurus
424 : // (this code has special handling for "in word" character)
425 : void InsertThesaurusSynonym( const OUString &rSynonmText, const OUString &rLookUpText, bool bValidSelection );
426 : bool IsValidSelectionForThesaurus() const;
427 : OUString GetThesaurusLookUpText( bool bSelection ) const;
428 :
429 : // immediately switch shell -> for GetSelectionObject
430 : void StopShellTimer();
431 :
432 0 : inline SwWrtShell& GetWrtShell () const { return *m_pWrtShell; }
433 0 : inline SwWrtShell* GetWrtShellPtr() const { return m_pWrtShell; }
434 :
435 0 : inline SwEditWin &GetEditWin() { return *m_pEditWin; }
436 0 : inline const SwEditWin &GetEditWin () const { return *m_pEditWin; }
437 :
438 : #if defined WNT || defined UNX
439 : void ScannerEventHdl( const ::com::sun::star::lang::EventObject& rEventObject );
440 : #endif
441 :
442 : // hand the handler for text blocks to the shell; create if applicable
443 : SwGlossaryHdl* GetGlosHdl();
444 :
445 0 : inline const Rectangle& GetVisArea() const { return m_aVisArea; }
446 :
447 : sal_Bool IsScroll(const Rectangle& rRect) const;
448 : void Scroll( const Rectangle& rRect,
449 : sal_uInt16 nRangeX = USHRT_MAX,
450 : sal_uInt16 nRangeY = USHRT_MAX);
451 :
452 : long SetVScrollMax(long lMax);
453 : long SetHScrollMax(long lMax);
454 :
455 : void SpellError(LanguageType eLang);
456 : sal_Bool ExecSpellPopup( const Point& rPt );
457 : void ExecFieldPopup( const Point& rPt, sw::mark::IFieldmark *fieldBM );
458 : sal_Bool ExecSmartTagPopup( const Point& rPt );
459 :
460 : DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*);
461 : sal_Bool ExecDrwTxtSpellPopup(const Point& rPt);
462 :
463 0 : void SetTabColFromDocPos( const Point &rPt ) { m_aTabColFromDocPos = rPt; }
464 0 : void SetTabColFromDoc( sal_Bool b ) { m_bTabColFromDoc = b; }
465 0 : sal_Bool IsTabColFromDoc() const { return m_bTabColFromDoc; }
466 0 : void SetTabRowFromDoc( sal_Bool b ) { m_bTabRowFromDoc = b; }
467 0 : sal_Bool IsTabRowFromDoc() const { return m_bTabRowFromDoc; }
468 :
469 : // -> #i23726#
470 0 : void SetNumRuleNodeFromDoc( SwTxtNode * pNumRuleNode )
471 0 : { m_pNumRuleNodeFromDoc = pNumRuleNode; }
472 : void SetNumIndentFromDoc(sal_Bool b) { m_bNumIndentFromDoc = b; }
473 : sal_Bool IsNumIndentFromDoc() const { return NULL != m_pNumRuleNodeFromDoc; }
474 : // <- #i23726#
475 :
476 : void DocSzChgd( const Size& rNewSize );
477 0 : const Size& GetDocSz() const { return m_aDocSz; }
478 : virtual void SetVisArea( const Rectangle&, sal_Bool bUpdateScrollbar = sal_True);
479 : void SetVisArea( const Point&, sal_Bool bUpdateScrollbar = sal_True);
480 : void CheckVisArea();
481 :
482 : void RecheckBrowseMode();
483 : static SvxSearchDialog* GetSearchDialog();
484 :
485 : static sal_uInt16 GetMoveType();
486 : static void SetMoveType(sal_uInt16 nSet);
487 : DECL_STATIC_LINK( SwView, MoveNavigationHdl, bool* ); // #i75416#
488 : static void SetActMark(sal_Int32 nSet);
489 :
490 : sal_Bool HandleWheelCommands( const CommandEvent& );
491 :
492 : // insert frames
493 : void InsFrmMode(sal_uInt16 nCols);
494 :
495 : void SetZoom( SvxZoomType eZoomType, short nFactor = 100, sal_Bool bViewOnly = sal_False);
496 : virtual void SetZoomFactor( const Fraction &rX, const Fraction & ) SAL_OVERRIDE;
497 :
498 : void SetViewLayout( sal_uInt16 nColumns, bool bBookMode, sal_Bool bViewOnly = sal_False );
499 :
500 : void ShowHScrollbar(sal_Bool bShow);
501 : sal_Bool IsHScrollbarVisible()const;
502 :
503 : void ShowVScrollbar(sal_Bool bShow);
504 : sal_Bool IsVScrollbarVisible()const;
505 :
506 : void EnableHScrollbar(bool bEnable);
507 : void EnableVScrollbar(bool bEnable);
508 :
509 : int CreateVRuler();
510 : int KillVRuler();
511 : int CreateTab();
512 : int KillTab();
513 :
514 0 : bool StatVRuler() const { return ((Window*)m_pVRuler)->IsVisible(); }
515 : void ChangeVRulerMetric(FieldUnit eUnit);
516 : void GetVRulerMetric(FieldUnit& rToFill) const;
517 :
518 : bool StatTab() const { return ((Window*)m_pHRuler)->IsVisible(); }
519 0 : SvxRuler& GetHRuler() { return *m_pHRuler; }
520 0 : SvxRuler& GetVRuler() { return *m_pVRuler; }
521 : void InvalidateRulerPos();
522 : void ChangeTabMetric(FieldUnit eUnit);
523 : void GetHRulerMetric(FieldUnit& rToFill) const;
524 :
525 : // Handler
526 : void Execute(SfxRequest&);
527 : void ExecPageMove(SfxRequest&);
528 : void ExecStyle(SfxRequest&);
529 : void ExecLingu(SfxRequest&);
530 : void ExecDataBase(SfxRequest&);
531 : void ExecDlg(SfxRequest&);
532 : void ExecDlgExt(SfxRequest&);
533 : void ExecDBDlg(SfxRequest &);
534 : void ExecColl(SfxRequest&);
535 : void ExecutePrint(SfxRequest&);
536 : void ExecDraw(SfxRequest&);
537 : void ExecTabWin(SfxRequest&);
538 : void ExecuteStatusLine(SfxRequest&);
539 : DECL_LINK( ExecRulerClick, Ruler * );
540 : void ExecSearch(SfxRequest&, sal_Bool bNoMessage = sal_False);
541 : void ExecViewOptions(SfxRequest &);
542 :
543 : void StateViewOptions(SfxItemSet &);
544 : void StateSearch(SfxItemSet &);
545 : void GetState(SfxItemSet&);
546 : void StateStatusLine(SfxItemSet&);
547 :
548 : // functions for drawing
549 : void SetDrawFuncPtr(SwDrawBase* pFuncPtr);
550 0 : inline SwDrawBase* GetDrawFuncPtr(/*sal_Bool bBuf = sal_False*/) const { return m_pDrawActual; }
551 : void GetDrawState(SfxItemSet &rSet);
552 : void ExitDraw();
553 0 : inline sal_Bool IsDrawRotate() { return m_bDrawRotate; }
554 0 : inline void FlipDrawRotate() { m_bDrawRotate = !m_bDrawRotate; }
555 0 : inline sal_Bool IsDrawSelMode() { return m_bDrawSelMode; }
556 : void SetSelDrawSlot();
557 0 : inline void FlipDrawSelMode() { m_bDrawSelMode = !m_bDrawSelMode; }
558 : void NoRotate(); // turn off rotate mode
559 : sal_Bool EnterDrawTextMode(const Point& aDocPos);
560 0 : void LeaveDrawCreate() { m_nDrawSfxId = m_nFormSfxId = USHRT_MAX; m_sDrawCustom = "";}
561 0 : sal_Bool IsDrawMode() { return (m_nDrawSfxId != USHRT_MAX || m_nFormSfxId != USHRT_MAX); }
562 : bool IsFormMode() const;
563 : bool IsBezierEditMode();
564 : bool AreOnlyFormsSelected() const;
565 : sal_Bool HasDrwObj(SdrObject *pSdrObj) const;
566 : sal_Bool HasOnlyObj(SdrObject *pSdrObj, sal_uInt32 eObjInventor) const;
567 : sal_Bool BeginTextEdit( SdrObject* pObj, SdrPageView* pPV=NULL,
568 : Window* pWin=NULL, bool bIsNewObj=false, bool bSetSelectionToStart=false );
569 :
570 : void StateTabWin(SfxItemSet&);
571 :
572 : // attributes have changed
573 : DECL_LINK( AttrChangedNotify, void* );
574 :
575 : // form control has been activated
576 : DECL_LINK( FormControlActivated, void* );
577 :
578 : // edit links
579 : void EditLinkDlg();
580 : void AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId = 0);
581 : void InsertCaption(const InsCaptionOpt *pOpt);
582 :
583 : // Async call by Core
584 : void UpdatePageNums(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr);
585 :
586 : OUString GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr);
587 :
588 : // hand over Shell
589 0 : SfxShell *GetCurShell() { return m_pShell; }
590 : SwDocShell *GetDocShell();
591 : inline const SwDocShell *GetDocShell() const;
592 0 : inline FmFormShell *GetFormShell() { return m_pFormShell; }
593 0 : inline const FmFormShell *GetFormShell() const { return m_pFormShell; }
594 :
595 : // so that in the SubShells' DTors m_pShell can be reset if applicable
596 0 : void ResetSubShell() { m_pShell = 0; }
597 :
598 : virtual void WriteUserData(OUString &, bool bBrowse = false) SAL_OVERRIDE;
599 : virtual void ReadUserData(const OUString &, bool bBrowse = false) SAL_OVERRIDE;
600 : virtual void ReadUserDataSequence ( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >&, bool bBrowse ) SAL_OVERRIDE;
601 : virtual void WriteUserDataSequence ( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >&, bool bBrowse ) SAL_OVERRIDE;
602 :
603 0 : void SetCrsrAtTop( sal_Bool bFlag, sal_Bool bCenter = sal_False )
604 0 : { m_bTopCrsr = bFlag, m_bCenterCrsr = bCenter; }
605 0 : sal_Bool IsCrsrAtTop() const { return m_bTopCrsr; }
606 0 : sal_Bool IsCrsrAtCenter() const { return m_bCenterCrsr; }
607 :
608 : bool JumpToSwMark( const OUString& rMark );
609 :
610 : long InsertDoc( sal_uInt16 nSlotId, const OUString& rFileName,
611 : const OUString& rFilterName, sal_Int16 nVersion = 0 );
612 :
613 : void ExecuteInsertDoc( SfxRequest& rRequest, const SfxPoolItem* pItem );
614 : long InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVersion );
615 : DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper * );
616 :
617 : // status methods for clipboard.
618 : // Status changes now notified from the clipboard.
619 : sal_Bool IsPasteAllowed();
620 : sal_Bool IsPasteSpecialAllowed();
621 :
622 : // Enable mail merge - mail merge field dialog enabled
623 : void EnableMailMerge(sal_Bool bEnable = sal_True);
624 : //apply Accessiblity options
625 : void ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions);
626 :
627 : SwView(SfxViewFrame* pFrame, SfxViewShell*);
628 : virtual ~SwView();
629 :
630 : void NotifyDBChanged();
631 :
632 : SfxObjectShellLock CreateTmpSelectionDoc();
633 :
634 : void AddTransferable(SwTransferable& rTransferable);
635 :
636 : // store MailMerge data while "Back to Mail Merge Wizard" FloatingWindow is active
637 : // or to support printing
638 : void SetMailMergeConfigItem(SwMailMergeConfigItem* pConfigItem, sal_uInt16 nRestart, sal_Bool bIsSource);
639 : SwMailMergeConfigItem* GetMailMergeConfigItem();
640 : sal_uInt16 GetMailMergeRestartPage() const;
641 : sal_Bool IsMailMergeSourceView() const;
642 :
643 : void ExecFormatPaintbrush(SfxRequest &);
644 : void StateFormatPaintbrush(SfxItemSet &);
645 :
646 : //public fuer D&D
647 : int InsertGraphic( const OUString &rPath, const OUString &rFilter,
648 : sal_Bool bLink = sal_True, GraphicFilter *pFlt = 0,
649 : Graphic* pPreviewGrf = 0,
650 : sal_Bool bRule = sal_False );
651 :
652 : void ExecuteScan( SfxRequest& rReq );
653 :
654 0 : SwPostItMgr* GetPostItMgr() { return m_pPostItMgr;}
655 : const SwPostItMgr* GetPostItMgr() const { return m_pPostItMgr;}
656 :
657 : // exhibition hack (MA,MBA)
658 : void SelectShellForDrop();
659 :
660 : void UpdateDocStats();
661 : /// Where is the real cursor: in the annotation or in the main document?
662 : void SetAnnotationMode(bool bMode);
663 : };
664 :
665 : // ----------------- inline Methoden ----------------------
666 0 : inline long SwView::GetXScroll() const
667 : {
668 0 : return m_aVisArea.GetWidth() * nScrollX / 100L;
669 : }
670 :
671 0 : inline long SwView::GetYScroll() const
672 : {
673 0 : return m_aVisArea.GetHeight() * nScrollY / 100L;
674 : }
675 :
676 0 : inline const SwDocShell *SwView::GetDocShell() const
677 : {
678 0 : return ((SwView*)this)->GetDocShell();
679 : }
680 :
681 : SfxTabPage* CreatePrintOptionsPage( Window *pParent,
682 : const SfxItemSet &rOptions,
683 : sal_Bool bPreview);
684 :
685 : #endif
686 :
687 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|