Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef SW_VIEWIMP_HXX
29 : : #define SW_VIEWIMP_HXX
30 : :
31 : : #include <vector>
32 : :
33 : : #include <vcl/timer.hxx>
34 : : #include <tools/color.hxx>
35 : :
36 : : #include <svx/svdtypes.hxx>
37 : :
38 : : #include <tools/string.hxx>
39 : :
40 : : #include <swtypes.hxx>
41 : : #include <swrect.hxx>
42 : :
43 : : class ViewShell;
44 : : class SwFlyFrm;
45 : : class SwViewOption;
46 : : class SwRegionRects;
47 : : class SwFrm;
48 : : class SwLayAction;
49 : : class SwLayIdle;
50 : : class SwDrawView;
51 : : class SdrPageView;
52 : : class SwPageFrm;
53 : : class SwRegionRects;
54 : : class SwAccessibleMap;
55 : : class SdrObject;
56 : : class Fraction;
57 : : class SwPrintData;
58 : : class SwPagePreviewLayout;
59 : : struct PrevwPage;
60 : : class SwTxtFrm;
61 : : // --> OD #i76669#
62 : : namespace sdr { namespace contact {
63 : : class ViewObjectContactRedirector;
64 : : } }
65 : : // <--
66 : :
67 : : class SwViewImp
68 : : {
69 : : friend class ViewShell;
70 : :
71 : : friend class SwLayAction; //Lay- und IdleAction tragen sich ein und aus.
72 : : friend class SwLayIdle;
73 : :
74 : : // for paint of page preview
75 : : friend class SwPagePreviewLayout;
76 : :
77 : : ViewShell *pSh; //Falls jemand einen Imp durchreicht und doch
78 : : //mal eine ViewShell braucht hier die
79 : : //Rueckwaertsverkettung.
80 : :
81 : : SwDrawView *pDrawView; //Unsere DrawView
82 : : SdrPageView *pSdrPageView; //Genau eine Seite fuer unsere DrawView
83 : :
84 : : SwPageFrm *pFirstVisPage;//Zeigt immer auf die erste sichtbare Seite.
85 : : SwRegionRects *pRegion; //Sammler fuer Paintrects aus der LayAction.
86 : :
87 : : SwLayAction *pLayAct; //Ist gesetzt wenn ein Action-Objekt existiert
88 : : //Wird vom SwLayAction-CTor ein- und vom DTor
89 : : //ausgetragen.
90 : : SwLayIdle *pIdleAct; //Analog zur SwLayAction fuer SwLayIdle.
91 : :
92 : : SwAccessibleMap *pAccMap; // Accessible Wrappers
93 : :
94 : : mutable const SdrObject * pSdrObjCached;
95 : : mutable String sSdrObjCachedComment;
96 : :
97 : : sal_Bool bFirstPageInvalid :1; //Pointer auf erste Seite ungueltig?
98 : :
99 : : sal_Bool bResetHdlHiddenPaint:1;// -- "" --
100 : :
101 : : sal_Bool bSmoothUpdate :1; //Meber fuer SmoothScroll
102 : : sal_Bool bStopSmooth :1;
103 : : sal_Bool bStopPrt :1; // Stop Printing
104 : :
105 : : sal_uInt16 nRestoreActions ; //Die Anzahl der zu restaurierenden Actions (UNO)
106 : : SwRect aSmoothRect;
107 : :
108 : : SwPagePreviewLayout* mpPgPrevwLayout;
109 : :
110 : : /**
111 : : Returns if printer shall be stopped.
112 : :
113 : : @retval sal_True The printer shall be stopped.
114 : : @retval sal_False else
115 : : */
116 : 0 : sal_Bool IsStopPrt() { return bStopPrt; }
117 : :
118 : : /**
119 : : Resets signal for stopping printing.
120 : :
121 : : */
122 : : void ResetStopPrt() { bStopPrt = sal_False; }
123 : :
124 : : void SetFirstVisPage(); //Neue Ermittlung der ersten sichtbaren Seite
125 : :
126 : : void StartAction(); //Henkel Anzeigen und verstecken.
127 : : void EndAction(); //gerufen von ViewShell::ImplXXXAction
128 : : void LockPaint(); //dito, gerufen von ViewShell::ImplLockPaint
129 : : void UnlockPaint();
130 : :
131 : : private:
132 : :
133 : : SwAccessibleMap *CreateAccessibleMap();
134 : :
135 : : /** invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
136 : :
137 : : #i27138#
138 : : implementation for wrapper method
139 : : <ViewShell::InvalidateAccessibleParaFlowRelation(..)>
140 : :
141 : : @param _pFromTxtFrm
142 : : input parameter - paragraph frame, for which the relation CONTENT_FLOWS_FROM
143 : : has to be invalidated.
144 : : If NULL, no CONTENT_FLOWS_FROM relation has to be invalidated
145 : :
146 : : @param _pToTxtFrm
147 : : input parameter - paragraph frame, for which the relation CONTENT_FLOWS_TO
148 : : has to be invalidated.
149 : : If NULL, no CONTENT_FLOWS_TO relation has to be invalidated
150 : : */
151 : : void _InvalidateAccessibleParaFlowRelation( const SwTxtFrm* _pFromTxtFrm,
152 : : const SwTxtFrm* _pToTxtFrm );
153 : :
154 : : /** invalidate text selection for paragraphs
155 : :
156 : : #i27301#
157 : : implementation for wrapper method
158 : : <ViewShell::InvalidateAccessibleParaTextSelection(..)>
159 : : */
160 : : void _InvalidateAccessibleParaTextSelection();
161 : :
162 : : /** invalidate attributes for paragraphs and paragraph's characters
163 : :
164 : : #i88069#
165 : : implementation for wrapper method
166 : : <ViewShell::InvalidateAccessibleParaAttrs(..)>
167 : : */
168 : : void _InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm );
169 : :
170 : : public:
171 : : SwViewImp( ViewShell * );
172 : : ~SwViewImp();
173 : : void Init( const SwViewOption * ); //nur fuer ViewShell::Init()
174 : :
175 : 86704 : const ViewShell *GetShell() const { return pSh; }
176 : 273488 : ViewShell *GetShell() { return pSh; }
177 : :
178 : : Color GetRetoucheColor() const;
179 : :
180 : : //Verwaltung zur ersten sichtbaren Seite
181 : : inline const SwPageFrm *GetFirstVisPage() const;
182 : : inline SwPageFrm *GetFirstVisPage();
183 : 5665 : void SetFirstVisPageInvalid() { bFirstPageInvalid = sal_True; }
184 : :
185 : : sal_Bool AddPaintRect( const SwRect &rRect );
186 : 86948 : SwRegionRects *GetRegion() { return pRegion; }
187 : : void DelRegion();
188 : :
189 : : // neues Interface fuer StarView Drawing
190 : 483711 : inline sal_Bool HasDrawView() const { return 0 != pDrawView; }
191 : 346745 : SwDrawView* GetDrawView() { return pDrawView; }
192 : 350103 : const SwDrawView* GetDrawView() const { return pDrawView; }
193 : 34841 : SdrPageView*GetPageView() { return pSdrPageView; }
194 : 24756 : const SdrPageView*GetPageView() const { return pSdrPageView; }
195 : : void MakeDrawView();
196 : :
197 : : // add 3rd parameter <const Color* pPageBackgrdColor> for setting this
198 : : // color as the background color at the outliner of the draw view
199 : : // for painting layers <hell> and <heaven>
200 : :
201 : : // add 4th parameter for the horizontal text
202 : : // direction of the page in order to set the default horizontal text
203 : : // direction at the outliner of the draw view for painting layers <hell>
204 : : // and <heaven>.
205 : :
206 : : // #i76669# - added parameter <pRedirector>
207 : : void PaintLayer( const SdrLayerID _nLayerID,
208 : : SwPrintData const*const pPrintData,
209 : : const SwRect& _rRect,
210 : : const Color* _pPageBackgrdColor = 0,
211 : : const bool _bIsPageRightToLeft = false,
212 : : sdr::contact::ViewObjectContactRedirector* pRedirector = 0 ) const;
213 : :
214 : : //wird als Link an die DrawEngine uebergeben, entscheidet was wie
215 : : //gepaintet wird oder nicht.
216 : :
217 : : // Interface Drawing
218 : : sal_Bool IsDragPossible( const Point &rPoint );
219 : : void NotifySizeChg( const Size &rNewSz );
220 : :
221 : : //SS Fuer die Lay- bzw. IdleAction und verwandtes
222 : 3670 : sal_Bool IsAction() const { return pLayAct != 0; }
223 : 69405 : sal_Bool IsIdleAction() const { return pIdleAct != 0; }
224 : 1089 : SwLayAction &GetLayAction() { return *pLayAct; }
225 : 172 : const SwLayAction &GetLayAction() const { return *pLayAct; }
226 : : SwLayIdle &GetIdleAction() { return *pIdleAct;}
227 : : const SwLayIdle &GetIdleAction() const { return *pIdleAct;}
228 : :
229 : : //Wenn eine Aktion laueft wird diese gebeten zu pruefen ob es
230 : : //an der zeit ist den WaitCrsr einzuschalten.
231 : : void CheckWaitCrsr();
232 : : sal_Bool IsCalcLayoutProgress() const; //Fragt die LayAction wenn vorhanden.
233 : : //sal_True wenn eine LayAction laeuft, dort wird dann auch das Flag fuer
234 : : //ExpressionFields gesetzt.
235 : : sal_Bool IsUpdateExpFlds();
236 : :
237 : 618 : void SetRestoreActions(sal_uInt16 nSet){nRestoreActions = nSet;}
238 : 309 : sal_uInt16 GetRestoreActions() const{return nRestoreActions;}
239 : :
240 : : void InitPagePreviewLayout();
241 : :
242 : 0 : inline SwPagePreviewLayout* PagePreviewLayout()
243 : : {
244 : 0 : return mpPgPrevwLayout;
245 : : }
246 : :
247 : : // Is this view accessible?
248 : 81306 : sal_Bool IsAccessible() const { return pAccMap != 0; }
249 : :
250 : : inline SwAccessibleMap& GetAccessibleMap();
251 : :
252 : : // Update (this) accessible view
253 : : void UpdateAccessible();
254 : :
255 : : // Remove a frame from the accessible view
256 : : void DisposeAccessible( const SwFrm *pFrm, const SdrObject *pObj,
257 : : sal_Bool bRecursive );
258 : : inline void DisposeAccessibleFrm( const SwFrm *pFrm,
259 : : sal_Bool bRecursive=sal_False );
260 : : inline void DisposeAccessibleObj( const SdrObject *pObj );
261 : :
262 : : // Move a frame's position in the accessible view
263 : : void MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj,
264 : : const SwRect& rOldFrm );
265 : : inline void MoveAccessibleFrm( const SwFrm *pFrm, const SwRect& rOldFrm );
266 : :
267 : : // Add a frame in the accessible view
268 : : inline void AddAccessibleFrm( const SwFrm *pFrm );
269 : :
270 : : inline void AddAccessibleObj( const SdrObject *pObj );
271 : :
272 : : // Invalidate accessible frame's frame's content
273 : : void InvalidateAccessibleFrmContent( const SwFrm *pFrm );
274 : :
275 : : // Invalidate accessible frame's cursor position
276 : : void InvalidateAccessibleCursorPosition( const SwFrm *pFrm );
277 : :
278 : : // Invalidate editable state for all accessible frames
279 : : void InvalidateAccessibleEditableState( sal_Bool bAllShells=sal_True,
280 : : const SwFrm *pFrm=0 );
281 : :
282 : : // Invalidate frame's relation set (for chained frames)
283 : : void InvalidateAccessibleRelationSet( const SwFlyFrm *pMaster,
284 : : const SwFlyFrm *pFollow );
285 : :
286 : : // update data for accessible preview
287 : : // change method signature due to new page preview functionality
288 : : void UpdateAccessiblePreview( const std::vector<PrevwPage*>& _rPrevwPages,
289 : : const Fraction& _rScale,
290 : : const SwPageFrm* _pSelectedPageFrm,
291 : : const Size& _rPrevwWinSize );
292 : :
293 : : void InvalidateAccessiblePreViewSelection( sal_uInt16 nSelPage );
294 : :
295 : : // Fire all accessible events that have been collected so far
296 : : void FireAccessibleEvents();
297 : : };
298 : :
299 : 71146 : inline SwPageFrm *SwViewImp::GetFirstVisPage()
300 : : {
301 [ + + ]: 71146 : if ( bFirstPageInvalid )
302 : 4126 : SetFirstVisPage();
303 : 71146 : return pFirstVisPage;
304 : : }
305 : :
306 : 0 : inline const SwPageFrm *SwViewImp::GetFirstVisPage() const
307 : : {
308 [ # # ]: 0 : if ( bFirstPageInvalid )
309 : 0 : ((SwViewImp*)this)->SetFirstVisPage();
310 : 0 : return pFirstVisPage;
311 : : }
312 : :
313 : 651 : inline SwAccessibleMap& SwViewImp::GetAccessibleMap()
314 : : {
315 [ + + ]: 651 : if( !pAccMap )
316 : 24 : CreateAccessibleMap();
317 : :
318 : 651 : return *pAccMap;
319 : : }
320 : :
321 : 0 : inline void SwViewImp::DisposeAccessibleFrm( const SwFrm *pFrm,
322 : : sal_Bool bRecursive )
323 : : {
324 : 0 : DisposeAccessible( pFrm, 0, bRecursive );
325 : 0 : }
326 : :
327 : 0 : inline void SwViewImp::DisposeAccessibleObj( const SdrObject *pObj )
328 : : {
329 : 0 : DisposeAccessible( 0, pObj, sal_False );
330 : 0 : }
331 : :
332 : 117 : inline void SwViewImp::MoveAccessibleFrm( const SwFrm *pFrm,
333 : : const SwRect& rOldFrm )
334 : : {
335 : 117 : MoveAccessible( pFrm, 0, rOldFrm );
336 : 117 : }
337 : :
338 : 0 : inline void SwViewImp::AddAccessibleFrm( const SwFrm *pFrm )
339 : : {
340 : 0 : SwRect aEmptyRect;
341 [ # # ]: 0 : MoveAccessible( pFrm, 0, aEmptyRect );
342 : 0 : }
343 : :
344 : 0 : inline void SwViewImp::AddAccessibleObj( const SdrObject *pObj )
345 : : {
346 : 0 : SwRect aEmptyRect;
347 [ # # ]: 0 : MoveAccessible( 0, pObj, aEmptyRect );
348 : 0 : }
349 : : #endif // SW_VIEWIMP_HXX
350 : :
351 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|