1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5efeef26fSAndrew Rist * distributed with this work for additional information
6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist * software distributed under the License is distributed on an
15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17efeef26fSAndrew Rist * specific language governing permissions and limitations
18efeef26fSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_sw.hxx"
24cdf0e10cSrcweir
25cdf0e10cSrcweir #define _SVX_PARAITEM_HXX
26cdf0e10cSrcweir #define _SVX_TEXTITEM_HXX
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp>
29cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
30cdf0e10cSrcweir #include <sfx2/progress.hxx>
31cdf0e10cSrcweir #include <svx/srchdlg.hxx>
32cdf0e10cSrcweir #include <svx/svdobj.hxx>
33cdf0e10cSrcweir #include <sfx2/viewsh.hxx>
34cdf0e10cSrcweir #include <swwait.hxx>
35cdf0e10cSrcweir #include <swmodule.hxx>
36cdf0e10cSrcweir #include <fesh.hxx>
37cdf0e10cSrcweir #include <doc.hxx>
38cdf0e10cSrcweir #include <rootfrm.hxx>
39cdf0e10cSrcweir #include <pagefrm.hxx>
40cdf0e10cSrcweir #include <cntfrm.hxx>
41cdf0e10cSrcweir #include <viewimp.hxx>
42cdf0e10cSrcweir #include <frmtool.hxx>
43cdf0e10cSrcweir #include <viewopt.hxx>
44cdf0e10cSrcweir #include <dview.hxx>
45cdf0e10cSrcweir #include <swregion.hxx>
46cdf0e10cSrcweir #include <hints.hxx>
47cdf0e10cSrcweir #include <fmtfsize.hxx>
48cdf0e10cSrcweir #include <docufld.hxx>
49cdf0e10cSrcweir #include <txtfrm.hxx>
50cdf0e10cSrcweir #include <layact.hxx>
51cdf0e10cSrcweir #include <mdiexp.hxx>
52cdf0e10cSrcweir #include <fntcache.hxx>
53cdf0e10cSrcweir #include <ptqueue.hxx>
54cdf0e10cSrcweir #include <tabfrm.hxx>
55cdf0e10cSrcweir #include <docsh.hxx>
56cdf0e10cSrcweir #include <pagedesc.hxx>
57cdf0e10cSrcweir #include <ndole.hxx>
58cdf0e10cSrcweir #include <ndindex.hxx>
59cdf0e10cSrcweir #include <accmap.hxx>
60cdf0e10cSrcweir #include <svtools/colorcfg.hxx>
61cdf0e10cSrcweir #include <svtools/accessibilityoptions.hxx>
62cdf0e10cSrcweir #include <accessibilityoptions.hxx>
63cdf0e10cSrcweir #include <statstr.hrc>
64cdf0e10cSrcweir #include <comcore.hrc>
65cdf0e10cSrcweir #include <pagepreviewlayout.hxx>
66cdf0e10cSrcweir #include <sortedobjs.hxx>
67cdf0e10cSrcweir #include <anchoredobject.hxx>
68cdf0e10cSrcweir #include "../../ui/inc/view.hxx"
69cdf0e10cSrcweir #include <PostItMgr.hxx>
70cdf0e10cSrcweir #include <vcl/virdev.hxx>
71cdf0e10cSrcweir #include <vcl/svapp.hxx>
72cdf0e10cSrcweir #include <svx/sdrpaintwindow.hxx>
7345fd3b9aSArmin Le Grand #include <vcl/dibtools.hxx>
74cdf0e10cSrcweir
75cdf0e10cSrcweir sal_Bool ViewShell::bLstAct = sal_False;
76cdf0e10cSrcweir ShellResource *ViewShell::pShellRes = 0;
77cdf0e10cSrcweir Window *ViewShell::pCareWindow = 0;
78cdf0e10cSrcweir BitmapEx* ViewShell::pErrorBmp = NULL;
79cdf0e10cSrcweir BitmapEx* ViewShell::pReplaceBmp = NULL;
80cdf0e10cSrcweir
81cdf0e10cSrcweir sal_Bool bInSizeNotify = sal_False;
82cdf0e10cSrcweir
83cdf0e10cSrcweir DBG_NAME(LayoutIdle)
84cdf0e10cSrcweir
85cdf0e10cSrcweir TYPEINIT0(ViewShell);
86cdf0e10cSrcweir
87cdf0e10cSrcweir using namespace ::com::sun::star;
88cdf0e10cSrcweir
89cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
90cdf0e10cSrcweir // #i72754# 2nd set of Pre/PostPaints
91cdf0e10cSrcweir // This time it uses the lock counter mnPrePostPaintCount to allow only one activation
92cdf0e10cSrcweir // and deactivation and mpPrePostOutDev to remember the OutDev from the BeginDrawLayers
93cdf0e10cSrcweir // call. That way, all places where paint take place can be handled the same way, even
94cdf0e10cSrcweir // when calling other paint methods. This is the case at the places where SW paints
95cdf0e10cSrcweir // buffered into VDevs to avoid flicker. Tis is in general problematic and should be
96cdf0e10cSrcweir // solved once using the BufferedOutput functionality of the DrawView.
97cdf0e10cSrcweir
PrePaint()98cdf0e10cSrcweir void ViewShell::PrePaint()
99cdf0e10cSrcweir {
100cdf0e10cSrcweir // forward PrePaint event from VCL Window to DrawingLayer
101cdf0e10cSrcweir if(HasDrawView())
102cdf0e10cSrcweir {
103cdf0e10cSrcweir Imp()->GetDrawView()->PrePaint();
104cdf0e10cSrcweir }
105cdf0e10cSrcweir }
106cdf0e10cSrcweir
DLPrePaint2(const Region & rRegion)107cdf0e10cSrcweir void ViewShell::DLPrePaint2(const Region& rRegion)
108cdf0e10cSrcweir {
109cdf0e10cSrcweir if(0L == mnPrePostPaintCount)
110cdf0e10cSrcweir {
111cdf0e10cSrcweir // #i75172# ensure DrawView to use DrawingLayer bufferings
112cdf0e10cSrcweir if ( !HasDrawView() )
113cdf0e10cSrcweir MakeDrawView();
114cdf0e10cSrcweir
115cdf0e10cSrcweir // Prefer window; if tot available, get pOut (e.g. printer)
116cdf0e10cSrcweir mpPrePostOutDev = (GetWin() ? GetWin() : GetOut());
117cdf0e10cSrcweir
118cdf0e10cSrcweir // #i74769# use SdrPaintWindow now direct
119cdf0e10cSrcweir mpTargetPaintWindow = Imp()->GetDrawView()->BeginDrawLayers(mpPrePostOutDev, rRegion);
120cdf0e10cSrcweir OSL_ENSURE(mpTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
121cdf0e10cSrcweir
122cdf0e10cSrcweir // #i74769# if prerender, save OutDev and redirect to PreRenderDevice
123cdf0e10cSrcweir if(mpTargetPaintWindow->GetPreRenderDevice())
124cdf0e10cSrcweir {
125cdf0e10cSrcweir mpBufferedOut = pOut;
126cdf0e10cSrcweir pOut = &(mpTargetPaintWindow->GetTargetOutputDevice());
127cdf0e10cSrcweir }
128cdf0e10cSrcweir
129cdf0e10cSrcweir // remember original paint MapMode for wrapped FlyFrame paints
130cdf0e10cSrcweir maPrePostMapMode = pOut->GetMapMode();
131cdf0e10cSrcweir }
132cdf0e10cSrcweir
133cdf0e10cSrcweir mnPrePostPaintCount++;
134cdf0e10cSrcweir }
135cdf0e10cSrcweir
DLPostPaint2(bool bPaintFormLayer)136cdf0e10cSrcweir void ViewShell::DLPostPaint2(bool bPaintFormLayer)
137cdf0e10cSrcweir {
138cdf0e10cSrcweir OSL_ENSURE(mnPrePostPaintCount > 0L, "ViewShell::DLPostPaint2: Pre/PostPaint encapsulation broken (!)");
139cdf0e10cSrcweir mnPrePostPaintCount--;
140cdf0e10cSrcweir
141cdf0e10cSrcweir if((0L == mnPrePostPaintCount) && (0 != mpTargetPaintWindow))
142cdf0e10cSrcweir {
143cdf0e10cSrcweir // #i74769# restore buffered OutDev
144cdf0e10cSrcweir if(mpTargetPaintWindow->GetPreRenderDevice())
145cdf0e10cSrcweir {
146cdf0e10cSrcweir pOut = mpBufferedOut;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir
149cdf0e10cSrcweir // #i74769# use SdrPaintWindow now direct
150cdf0e10cSrcweir Imp()->GetDrawView()->EndDrawLayers(*mpTargetPaintWindow, bPaintFormLayer);
151cdf0e10cSrcweir mpTargetPaintWindow = 0;
152cdf0e10cSrcweir }
153cdf0e10cSrcweir }
154cdf0e10cSrcweir
155cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
156cdf0e10cSrcweir
157cdf0e10cSrcweir /******************************************************************************
158cdf0e10cSrcweir |*
159cdf0e10cSrcweir |* ViewShell::ImplEndAction()
160cdf0e10cSrcweir |*
161cdf0e10cSrcweir |* Letzte Aenderung MA 04. Sep. 96
162cdf0e10cSrcweir |*
163cdf0e10cSrcweir ******************************************************************************/
164cdf0e10cSrcweir
ImplEndAction(const sal_Bool bIdleEnd)165cdf0e10cSrcweir void ViewShell::ImplEndAction( const sal_Bool bIdleEnd )
166cdf0e10cSrcweir {
167cdf0e10cSrcweir //Fuer den Drucker gibt es hier nichts zu tun.
168cdf0e10cSrcweir if ( !GetWin() || IsPreView() )
169cdf0e10cSrcweir {
170cdf0e10cSrcweir bPaintWorks = sal_True;
171cdf0e10cSrcweir UISizeNotify();
172cdf0e10cSrcweir return;
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
175cdf0e10cSrcweir bInEndAction = sal_True;
176cdf0e10cSrcweir
177cdf0e10cSrcweir //Laeuft hiermit das EndAction der Letzten Shell im Ring?
178cdf0e10cSrcweir ViewShell::bLstAct = sal_True;
179cdf0e10cSrcweir ViewShell *pSh = (ViewShell*)this->GetNext();
180cdf0e10cSrcweir while ( pSh != this )
181cdf0e10cSrcweir { if ( pSh->ActionPend() )
182cdf0e10cSrcweir { ViewShell::bLstAct = sal_False;
183cdf0e10cSrcweir pSh = this;
184cdf0e10cSrcweir }
185cdf0e10cSrcweir else
186cdf0e10cSrcweir pSh = (ViewShell*)pSh->GetNext();
187cdf0e10cSrcweir }
188cdf0e10cSrcweir
189cdf0e10cSrcweir const bool bIsShellForCheckViewLayout = ( this == GetLayout()->GetCurrShell() );
190cdf0e10cSrcweir
191cdf0e10cSrcweir SET_CURR_SHELL( this );
192cdf0e10cSrcweir if ( Imp()->HasDrawView() && !Imp()->GetDrawView()->areMarkHandlesHidden() )
193cdf0e10cSrcweir Imp()->StartAction();
194cdf0e10cSrcweir
195cdf0e10cSrcweir if ( Imp()->GetRegion() && Imp()->GetRegion()->GetOrigin() != VisArea() )
196cdf0e10cSrcweir Imp()->DelRegion();
197cdf0e10cSrcweir
198cdf0e10cSrcweir const sal_Bool bExtraData = ::IsExtraData( GetDoc() );
199cdf0e10cSrcweir
200cdf0e10cSrcweir if ( !bIdleEnd )
201cdf0e10cSrcweir {
202cdf0e10cSrcweir SwLayAction aAction( GetLayout(), Imp() );
203cdf0e10cSrcweir aAction.SetComplete( sal_False );
204cdf0e10cSrcweir if ( nLockPaint )
205cdf0e10cSrcweir aAction.SetPaint( sal_False );
206cdf0e10cSrcweir aAction.SetInputType( INPUT_KEYBOARD );
207cdf0e10cSrcweir aAction.Action();
208cdf0e10cSrcweir }
209cdf0e10cSrcweir
210cdf0e10cSrcweir if ( bIsShellForCheckViewLayout )
211cdf0e10cSrcweir GetLayout()->CheckViewLayout( GetViewOptions(), &aVisArea );
212cdf0e10cSrcweir
213cdf0e10cSrcweir //Wenn wir selbst keine Paints erzeugen, so warten wir auf das Paint
214cdf0e10cSrcweir //vom System. Dann ist das Clipping korrekt gesetzt; Beispiel: verschieben
215cdf0e10cSrcweir //eines DrawObjektes.
216cdf0e10cSrcweir if ( Imp()->GetRegion() ||
217cdf0e10cSrcweir aInvalidRect.HasArea() ||
218cdf0e10cSrcweir bExtraData )
219cdf0e10cSrcweir {
220cdf0e10cSrcweir if ( !nLockPaint )
221cdf0e10cSrcweir {
222cdf0e10cSrcweir sal_Bool bPaintsFromSystem = aInvalidRect.HasArea();
223cdf0e10cSrcweir GetWin()->Update();
224cdf0e10cSrcweir if ( aInvalidRect.HasArea() )
225cdf0e10cSrcweir {
226cdf0e10cSrcweir if ( bPaintsFromSystem )
227cdf0e10cSrcweir Imp()->AddPaintRect( aInvalidRect );
228cdf0e10cSrcweir
229cdf0e10cSrcweir ResetInvalidRect();
230cdf0e10cSrcweir bPaintsFromSystem = sal_True;
231cdf0e10cSrcweir }
232cdf0e10cSrcweir bPaintWorks = sal_True;
233cdf0e10cSrcweir
234cdf0e10cSrcweir SwRegionRects *pRegion = Imp()->GetRegion();
235cdf0e10cSrcweir
236cdf0e10cSrcweir //JP 27.11.97: wer die Selection hided, muss sie aber auch
237cdf0e10cSrcweir // wieder Showen. Sonst gibt es Paintfehler!
238cdf0e10cSrcweir // z.B.: addional Mode, Seite vertikal hab zu sehen, in der
239cdf0e10cSrcweir // Mitte eine Selektion und mit einem anderen Cursor an linken
240cdf0e10cSrcweir // rechten Rand springen. Ohne ShowCrsr verschwindet die
241cdf0e10cSrcweir // Selektion
242cdf0e10cSrcweir sal_Bool bShowCrsr = pRegion && IsA( TYPE(SwCrsrShell) );
243cdf0e10cSrcweir if( bShowCrsr )
244cdf0e10cSrcweir ((SwCrsrShell*)this)->HideCrsrs();
245cdf0e10cSrcweir
246cdf0e10cSrcweir if ( pRegion )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir SwRootFrm* pCurrentLayout = GetLayout();
249cdf0e10cSrcweir
250cdf0e10cSrcweir Imp()->pRegion = NULL;
251cdf0e10cSrcweir
252cdf0e10cSrcweir //Erst Invert dann Compress, niemals andersherum!
253cdf0e10cSrcweir pRegion->Invert();
254cdf0e10cSrcweir
255cdf0e10cSrcweir pRegion->Compress();
256cdf0e10cSrcweir
257cdf0e10cSrcweir VirtualDevice *pVout = 0;
258cdf0e10cSrcweir while ( pRegion->Count() )
259cdf0e10cSrcweir {
260cdf0e10cSrcweir SwRect aRect( (*pRegion)[ pRegion->Count() - 1 ] );
261cdf0e10cSrcweir pRegion->Remove( pRegion->Count() - 1 );
262cdf0e10cSrcweir
263cdf0e10cSrcweir sal_Bool bPaint = sal_True;
264cdf0e10cSrcweir if ( IsEndActionByVirDev() )
265cdf0e10cSrcweir {
266cdf0e10cSrcweir //virtuelles device erzeugen und einstellen.
267cdf0e10cSrcweir if ( !pVout )
268cdf0e10cSrcweir pVout = new VirtualDevice( *GetOut() );
269cdf0e10cSrcweir MapMode aMapMode( GetOut()->GetMapMode() );
270cdf0e10cSrcweir pVout->SetMapMode( aMapMode );
271cdf0e10cSrcweir
272cdf0e10cSrcweir sal_Bool bSizeOK = sal_True;
273cdf0e10cSrcweir
274cdf0e10cSrcweir Rectangle aTmp1( aRect.SVRect() );
275cdf0e10cSrcweir aTmp1 = GetOut()->LogicToPixel( aTmp1 );
276cdf0e10cSrcweir Rectangle aTmp2( GetOut()->PixelToLogic( aTmp1 ) );
277cdf0e10cSrcweir if ( aTmp2.Left() > aRect.Left() )
278cdf0e10cSrcweir aTmp1.Left() = Max( 0L, aTmp1.Left() - 1L );
279cdf0e10cSrcweir if ( aTmp2.Top() > aRect.Top() )
280cdf0e10cSrcweir aTmp1.Top() = Max( 0L, aTmp1.Top() - 1L );
281cdf0e10cSrcweir aTmp1.Right() += 1;
282cdf0e10cSrcweir aTmp1.Bottom() += 1;
283cdf0e10cSrcweir aTmp1 = GetOut()->PixelToLogic( aTmp1 );
284cdf0e10cSrcweir aRect = SwRect( aTmp1 );
285cdf0e10cSrcweir
286cdf0e10cSrcweir const Size aTmp( pVout->GetOutputSize() );
287cdf0e10cSrcweir if ( aTmp.Height() < aRect.Height() ||
288cdf0e10cSrcweir aTmp.Width() < aRect.Width() )
289cdf0e10cSrcweir {
290cdf0e10cSrcweir bSizeOK = pVout->SetOutputSize( aRect.SSize() );
291cdf0e10cSrcweir }
292cdf0e10cSrcweir if ( bSizeOK )
293cdf0e10cSrcweir {
294cdf0e10cSrcweir bPaint = sal_False;
295cdf0e10cSrcweir
296cdf0e10cSrcweir // --> OD 2007-07-26 #i79947#
297cdf0e10cSrcweir // #i72754# start Pre/PostPaint encapsulation before pOut is changed to the buffering VDev
298cdf0e10cSrcweir const Region aRepaintRegion(aRect.SVRect());
299cdf0e10cSrcweir DLPrePaint2(aRepaintRegion);
300cdf0e10cSrcweir // <--
301cdf0e10cSrcweir
302cdf0e10cSrcweir OutputDevice *pOld = GetOut();
303cdf0e10cSrcweir pVout->SetLineColor( pOld->GetLineColor() );
304cdf0e10cSrcweir pVout->SetFillColor( pOld->GetFillColor() );
305cdf0e10cSrcweir Point aOrigin( aRect.Pos() );
306cdf0e10cSrcweir aOrigin.X() = -aOrigin.X(); aOrigin.Y() = -aOrigin.Y();
307cdf0e10cSrcweir aMapMode.SetOrigin( aOrigin );
308cdf0e10cSrcweir pVout->SetMapMode( aMapMode );
309cdf0e10cSrcweir
310cdf0e10cSrcweir pOut = pVout;
311cdf0e10cSrcweir if ( bPaintsFromSystem )
312cdf0e10cSrcweir PaintDesktop( aRect );
313cdf0e10cSrcweir pCurrentLayout->Paint( aRect );
314cdf0e10cSrcweir pOld->DrawOutDev( aRect.Pos(), aRect.SSize(),
315cdf0e10cSrcweir aRect.Pos(), aRect.SSize(), *pVout );
316cdf0e10cSrcweir pOut = pOld;
317cdf0e10cSrcweir
318cdf0e10cSrcweir // #i72754# end Pre/PostPaint encapsulation when pOut is back and content is painted
319cdf0e10cSrcweir DLPostPaint2(true);
320cdf0e10cSrcweir }
321cdf0e10cSrcweir }
322cdf0e10cSrcweir if ( bPaint )
323cdf0e10cSrcweir {
324cdf0e10cSrcweir // #i75172# begin DrawingLayer paint
325cdf0e10cSrcweir // need to do begin/end DrawingLayer preparation for each single rectangle of the
326cdf0e10cSrcweir // repaint region. I already tried to prepare only once for the whole Region. This
327cdf0e10cSrcweir // seems to work (and does technically) but fails with transparent objects. Since the
328cdf0e10cSrcweir // region given to BeginDarwLayers() defines the clip region for DrawingLayer paint,
329cdf0e10cSrcweir // transparent objects in the single rectangles will indeed be painted multiple times.
330cdf0e10cSrcweir DLPrePaint2(Region(aRect.SVRect()));
331cdf0e10cSrcweir
332cdf0e10cSrcweir if ( bPaintsFromSystem )
333cdf0e10cSrcweir PaintDesktop( aRect );
334cdf0e10cSrcweir pCurrentLayout->Paint( aRect );
335cdf0e10cSrcweir
336cdf0e10cSrcweir // #i75172# end DrawingLayer paint
337cdf0e10cSrcweir DLPostPaint2(true);
338cdf0e10cSrcweir }
339cdf0e10cSrcweir
340cdf0e10cSrcweir // --> OD 2009-12-03 #i107365#
341cdf0e10cSrcweir // Direct paint has been performed. Thus, take care of
342cdf0e10cSrcweir // transparent child windows.
343cdf0e10cSrcweir if ( GetWin() )
344cdf0e10cSrcweir {
345cdf0e10cSrcweir Window& rWindow = *(GetWin());
346cdf0e10cSrcweir if(rWindow.IsChildTransparentModeEnabled() && rWindow.GetChildCount())
347cdf0e10cSrcweir {
348cdf0e10cSrcweir const Rectangle aRectanglePixel(rWindow.LogicToPixel(aRect.SVRect()));
349cdf0e10cSrcweir
350cdf0e10cSrcweir for ( sal_uInt16 a(0); a < rWindow.GetChildCount(); a++ )
351cdf0e10cSrcweir {
352cdf0e10cSrcweir Window* pCandidate = rWindow.GetChild(a);
353cdf0e10cSrcweir
354cdf0e10cSrcweir if ( pCandidate && pCandidate->IsPaintTransparent() )
355cdf0e10cSrcweir {
356cdf0e10cSrcweir const Rectangle aCandidatePosSizePixel(
357cdf0e10cSrcweir pCandidate->GetPosPixel(),
358cdf0e10cSrcweir pCandidate->GetSizePixel());
359cdf0e10cSrcweir
360cdf0e10cSrcweir if ( aCandidatePosSizePixel.IsOver(aRectanglePixel) )
361cdf0e10cSrcweir {
362cdf0e10cSrcweir pCandidate->Invalidate( INVALIDATE_NOTRANSPARENT|INVALIDATE_CHILDREN );
363cdf0e10cSrcweir pCandidate->Update();
364cdf0e10cSrcweir }
365cdf0e10cSrcweir }
366cdf0e10cSrcweir }
367cdf0e10cSrcweir }
368cdf0e10cSrcweir }
369cdf0e10cSrcweir // <--
370cdf0e10cSrcweir }
371cdf0e10cSrcweir
372cdf0e10cSrcweir delete pVout;
373cdf0e10cSrcweir delete pRegion;
374cdf0e10cSrcweir Imp()->DelRegion();
375cdf0e10cSrcweir }
376cdf0e10cSrcweir if( bShowCrsr )
377cdf0e10cSrcweir ((SwCrsrShell*)this)->ShowCrsrs( sal_True );
378cdf0e10cSrcweir }
379cdf0e10cSrcweir else
380cdf0e10cSrcweir {
381cdf0e10cSrcweir Imp()->DelRegion();
382cdf0e10cSrcweir bPaintWorks = sal_True;
383cdf0e10cSrcweir }
384cdf0e10cSrcweir }
385cdf0e10cSrcweir else
386cdf0e10cSrcweir bPaintWorks = sal_True;
387cdf0e10cSrcweir
388cdf0e10cSrcweir bInEndAction = sal_False;
389cdf0e10cSrcweir ViewShell::bLstAct = sal_False;
390cdf0e10cSrcweir Imp()->EndAction();
391cdf0e10cSrcweir
392cdf0e10cSrcweir
393cdf0e10cSrcweir //Damit sich die automatischen Scrollbars auch richtig anordnen k?nnen
394cdf0e10cSrcweir //muessen wir die Aktion hier kuenstlich beenden (EndAction loesst ein
395cdf0e10cSrcweir //Notify aus, und das muss Start-/EndAction rufen um die Scrollbars
396cdf0e10cSrcweir //klarzubekommen.
397cdf0e10cSrcweir --nStartAction;
398cdf0e10cSrcweir UISizeNotify();
399cdf0e10cSrcweir ++nStartAction;
400cdf0e10cSrcweir
401cdf0e10cSrcweir if( Imp()->IsAccessible() )
402cdf0e10cSrcweir Imp()->FireAccessibleEvents();
403cdf0e10cSrcweir }
404cdf0e10cSrcweir
405cdf0e10cSrcweir /******************************************************************************
406cdf0e10cSrcweir |*
407cdf0e10cSrcweir |* ViewShell::ImplStartAction()
408cdf0e10cSrcweir |*
409cdf0e10cSrcweir |* Ersterstellung MA 25. Jul. 94
410cdf0e10cSrcweir |* Letzte Aenderung MA 25. Jul. 94
411cdf0e10cSrcweir |*
412cdf0e10cSrcweir ******************************************************************************/
413cdf0e10cSrcweir
ImplStartAction()414cdf0e10cSrcweir void ViewShell::ImplStartAction()
415cdf0e10cSrcweir {
416cdf0e10cSrcweir bPaintWorks = sal_False;
417cdf0e10cSrcweir Imp()->StartAction();
418cdf0e10cSrcweir }
419cdf0e10cSrcweir
420cdf0e10cSrcweir
421cdf0e10cSrcweir /******************************************************************************
422cdf0e10cSrcweir |*
423cdf0e10cSrcweir |* ViewShell::ImplLockPaint(), ImplUnlockPaint()
424cdf0e10cSrcweir |*
425cdf0e10cSrcweir |* Ersterstellung MA 11. Jun. 96
426cdf0e10cSrcweir |* Letzte Aenderung MA 11. Jun. 96
427cdf0e10cSrcweir |*
428cdf0e10cSrcweir ******************************************************************************/
429cdf0e10cSrcweir
ImplLockPaint()430cdf0e10cSrcweir void ViewShell::ImplLockPaint()
431cdf0e10cSrcweir {
432cdf0e10cSrcweir if ( GetWin() && GetWin()->IsVisible() )
433cdf0e10cSrcweir GetWin()->EnablePaint( sal_False ); //Auch die Controls abklemmen.
434cdf0e10cSrcweir Imp()->LockPaint();
435cdf0e10cSrcweir }
436cdf0e10cSrcweir
437cdf0e10cSrcweir
ImplUnlockPaint(sal_Bool bVirDev)438cdf0e10cSrcweir void ViewShell::ImplUnlockPaint( sal_Bool bVirDev )
439cdf0e10cSrcweir {
440cdf0e10cSrcweir SET_CURR_SHELL( this );
441cdf0e10cSrcweir if ( GetWin() && GetWin()->IsVisible() )
442cdf0e10cSrcweir {
443cdf0e10cSrcweir if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() )
444cdf0e10cSrcweir {
445cdf0e10cSrcweir //Refresh mit virtuellem Device um das Flackern zu verhindern.
446cdf0e10cSrcweir VirtualDevice *pVout = new VirtualDevice( *pOut );
447cdf0e10cSrcweir pVout->SetMapMode( pOut->GetMapMode() );
448cdf0e10cSrcweir Size aSize( VisArea().SSize() );
449cdf0e10cSrcweir aSize.Width() += 20;
450cdf0e10cSrcweir aSize.Height()+= 20;
451cdf0e10cSrcweir if( pVout->SetOutputSize( aSize ) )
452cdf0e10cSrcweir {
453cdf0e10cSrcweir GetWin()->EnablePaint( sal_True );
454cdf0e10cSrcweir GetWin()->Validate();
455cdf0e10cSrcweir
456cdf0e10cSrcweir Imp()->UnlockPaint();
457cdf0e10cSrcweir pVout->SetLineColor( pOut->GetLineColor() );
458cdf0e10cSrcweir pVout->SetFillColor( pOut->GetFillColor() );
459cdf0e10cSrcweir
460cdf0e10cSrcweir // #i72754# start Pre/PostPaint encapsulation before pOut is changed to the buffering VDev
461cdf0e10cSrcweir const Region aRepaintRegion(VisArea().SVRect());
462cdf0e10cSrcweir DLPrePaint2(aRepaintRegion);
463cdf0e10cSrcweir
464cdf0e10cSrcweir OutputDevice *pOld = pOut;
465cdf0e10cSrcweir pOut = pVout;
466cdf0e10cSrcweir Paint( VisArea().SVRect() );
467cdf0e10cSrcweir pOut = pOld;
468cdf0e10cSrcweir pOut->DrawOutDev( VisArea().Pos(), aSize,
469cdf0e10cSrcweir VisArea().Pos(), aSize, *pVout );
470cdf0e10cSrcweir
471cdf0e10cSrcweir // #i72754# end Pre/PostPaint encapsulation when pOut is back and content is painted
472cdf0e10cSrcweir DLPostPaint2(true);
473cdf0e10cSrcweir }
474cdf0e10cSrcweir else
475cdf0e10cSrcweir {
476cdf0e10cSrcweir Imp()->UnlockPaint();
477cdf0e10cSrcweir GetWin()->EnablePaint( sal_True );
478cdf0e10cSrcweir GetWin()->Invalidate( INVALIDATE_CHILDREN );
479cdf0e10cSrcweir }
480cdf0e10cSrcweir delete pVout;
481cdf0e10cSrcweir }
482cdf0e10cSrcweir else
483cdf0e10cSrcweir {
484cdf0e10cSrcweir Imp()->UnlockPaint();
485cdf0e10cSrcweir GetWin()->EnablePaint( sal_True );
486cdf0e10cSrcweir GetWin()->Invalidate( INVALIDATE_CHILDREN );
487cdf0e10cSrcweir }
488cdf0e10cSrcweir }
489cdf0e10cSrcweir else
490cdf0e10cSrcweir Imp()->UnlockPaint();
491cdf0e10cSrcweir }
492cdf0e10cSrcweir
493cdf0e10cSrcweir /******************************************************************************
494cdf0e10cSrcweir |*
495cdf0e10cSrcweir |* ViewShell::AddPaintRect()
496cdf0e10cSrcweir |*
497cdf0e10cSrcweir |* Ersterstellung MA ??
498cdf0e10cSrcweir |* Letzte Aenderung MA 09. Feb. 97
499cdf0e10cSrcweir |*
500cdf0e10cSrcweir ******************************************************************************/
501cdf0e10cSrcweir
AddPaintRect(const SwRect & rRect)502cdf0e10cSrcweir sal_Bool ViewShell::AddPaintRect( const SwRect & rRect )
503cdf0e10cSrcweir {
504cdf0e10cSrcweir sal_Bool bRet = sal_False;
505cdf0e10cSrcweir ViewShell *pSh = this;
506cdf0e10cSrcweir do
507cdf0e10cSrcweir {
508cdf0e10cSrcweir if( pSh->Imp() )
509cdf0e10cSrcweir {
510cdf0e10cSrcweir if ( pSh->IsPreView() && pSh->GetWin() )
511cdf0e10cSrcweir ::RepaintPagePreview( pSh, rRect );
512cdf0e10cSrcweir else
513cdf0e10cSrcweir bRet |= pSh->Imp()->AddPaintRect( rRect );//swmod 080111
514cdf0e10cSrcweir }
515cdf0e10cSrcweir pSh = (ViewShell*)pSh->GetNext();
516cdf0e10cSrcweir } while ( pSh != this );
517cdf0e10cSrcweir return bRet;
518cdf0e10cSrcweir }
519cdf0e10cSrcweir
520cdf0e10cSrcweir /******************************************************************************
521cdf0e10cSrcweir |*
522cdf0e10cSrcweir |* ViewShell::InvalidateWindows()
523cdf0e10cSrcweir |*
524cdf0e10cSrcweir |* Ersterstellung MA ??
525cdf0e10cSrcweir |* Letzte Aenderung MA 09. Feb. 97
526cdf0e10cSrcweir |*
527cdf0e10cSrcweir ******************************************************************************/
528cdf0e10cSrcweir
InvalidateWindows(const SwRect & rRect)529cdf0e10cSrcweir void ViewShell::InvalidateWindows( const SwRect &rRect )
530cdf0e10cSrcweir {
531cdf0e10cSrcweir if ( !Imp()->IsCalcLayoutProgress() )
532cdf0e10cSrcweir {
533cdf0e10cSrcweir ViewShell *pSh = this;
534cdf0e10cSrcweir do
535cdf0e10cSrcweir {
536cdf0e10cSrcweir if ( pSh->GetWin() )
537cdf0e10cSrcweir {
538cdf0e10cSrcweir if ( pSh->IsPreView() )
539cdf0e10cSrcweir ::RepaintPagePreview( pSh, rRect );
540cdf0e10cSrcweir else if ( pSh->VisArea().IsOver( rRect ) )
541cdf0e10cSrcweir pSh->GetWin()->Invalidate( rRect.SVRect() );
542cdf0e10cSrcweir }
543cdf0e10cSrcweir pSh = (ViewShell*)pSh->GetNext();
544cdf0e10cSrcweir
545cdf0e10cSrcweir } while ( pSh != this );
546cdf0e10cSrcweir }
547cdf0e10cSrcweir }
548cdf0e10cSrcweir
549cdf0e10cSrcweir /******************************************************************************
550cdf0e10cSrcweir |*
551cdf0e10cSrcweir |* ViewShell::MakeVisible()
552cdf0e10cSrcweir |*
553cdf0e10cSrcweir |* Ersterstellung MA ??
554cdf0e10cSrcweir |* Letzte Aenderung AMA 10. Okt. 95
555cdf0e10cSrcweir |*
556cdf0e10cSrcweir ******************************************************************************/
557cdf0e10cSrcweir
MakeVisible(const SwRect & rRect)558cdf0e10cSrcweir void ViewShell::MakeVisible( const SwRect &rRect )
559cdf0e10cSrcweir {
560cdf0e10cSrcweir if ( !VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareWin(*this) )
561cdf0e10cSrcweir {
562cdf0e10cSrcweir if ( !IsViewLocked() )
563cdf0e10cSrcweir {
564cdf0e10cSrcweir if( pWin )
565cdf0e10cSrcweir {
566cdf0e10cSrcweir const SwFrm* pRoot = GetLayout();
567cdf0e10cSrcweir int nLoopCnt = 3;
568cdf0e10cSrcweir long nOldH;
569cdf0e10cSrcweir do{
570cdf0e10cSrcweir nOldH = pRoot->Frm().Height();
571cdf0e10cSrcweir StartAction();
572cdf0e10cSrcweir ScrollMDI( this, rRect, USHRT_MAX, USHRT_MAX );
573cdf0e10cSrcweir EndAction();
574cdf0e10cSrcweir } while( nOldH != pRoot->Frm().Height() && nLoopCnt-- ); //swmod 071108//swmod 071225
575cdf0e10cSrcweir }
576cdf0e10cSrcweir #ifdef DBG_UTIL
577cdf0e10cSrcweir else
578cdf0e10cSrcweir {
579cdf0e10cSrcweir //MA: 04. Nov. 94, braucht doch keiner oder??
580cdf0e10cSrcweir ASSERT( !this, "MakeVisible fuer Drucker wird doch gebraucht?" );
581cdf0e10cSrcweir }
582cdf0e10cSrcweir
583cdf0e10cSrcweir #endif
584cdf0e10cSrcweir }
585cdf0e10cSrcweir }
586cdf0e10cSrcweir }
587cdf0e10cSrcweir
588cdf0e10cSrcweir /******************************************************************************
589cdf0e10cSrcweir |*
590cdf0e10cSrcweir |* ViewShell::CareChildWindow()
591cdf0e10cSrcweir |*
592cdf0e10cSrcweir |* Ersterstellung AMA 10. Okt. 95
593cdf0e10cSrcweir |* Letzte Aenderung AMA 10. Okt. 95
594cdf0e10cSrcweir |*
595cdf0e10cSrcweir ******************************************************************************/
596cdf0e10cSrcweir
CareChildWin(ViewShell & rVSh)597cdf0e10cSrcweir Window* ViewShell::CareChildWin(ViewShell& rVSh)
598cdf0e10cSrcweir {
599cdf0e10cSrcweir if(rVSh.pSfxViewShell)
600cdf0e10cSrcweir {
601cdf0e10cSrcweir const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId();
602cdf0e10cSrcweir SfxViewFrame* pVFrame = rVSh.pSfxViewShell->GetViewFrame();
603cdf0e10cSrcweir const SfxChildWindow* pChWin = pVFrame->GetChildWindow( nId );
604cdf0e10cSrcweir Window *pWin = pChWin ? pChWin->GetWindow() : NULL;
605cdf0e10cSrcweir if ( pWin && pWin->IsVisible() )
606cdf0e10cSrcweir return pWin;
607cdf0e10cSrcweir }
608cdf0e10cSrcweir return NULL;
609cdf0e10cSrcweir }
610cdf0e10cSrcweir
611cdf0e10cSrcweir /******************************************************************************
612cdf0e10cSrcweir |*
613cdf0e10cSrcweir |* ViewShell::GetPagePos()
614cdf0e10cSrcweir |*
615cdf0e10cSrcweir |* Ersterstellung MA ??
616cdf0e10cSrcweir |* Letzte Aenderung MA 04. Aug. 93
617cdf0e10cSrcweir |*
618cdf0e10cSrcweir ******************************************************************************/
619cdf0e10cSrcweir
GetPagePos(sal_uInt16 nPageNum) const620cdf0e10cSrcweir Point ViewShell::GetPagePos( sal_uInt16 nPageNum ) const
621cdf0e10cSrcweir {
622cdf0e10cSrcweir return GetLayout()->GetPagePos( nPageNum );
623cdf0e10cSrcweir }
624cdf0e10cSrcweir
625cdf0e10cSrcweir /******************************************************************************
626cdf0e10cSrcweir |*
627cdf0e10cSrcweir |* ViewShell::GetNumPages()
628cdf0e10cSrcweir |*
629cdf0e10cSrcweir |* Ersterstellung MA ??
630cdf0e10cSrcweir |* Letzte Aenderung MA 20. Apr. 94
631cdf0e10cSrcweir |*
632cdf0e10cSrcweir ******************************************************************************/
633cdf0e10cSrcweir
GetNumPages()634cdf0e10cSrcweir sal_uInt16 ViewShell::GetNumPages()
635cdf0e10cSrcweir {
636cdf0e10cSrcweir //Es kann sein, das noch kein Layout existiert weil die Methode vom
637cdf0e10cSrcweir //Root-Ctor gerufen wird.
638cdf0e10cSrcweir return GetLayout() ? GetLayout()->GetPageNum() : 0;
639cdf0e10cSrcweir }
640cdf0e10cSrcweir
IsDummyPage(sal_uInt16 nPageNum) const641cdf0e10cSrcweir sal_Bool ViewShell::IsDummyPage( sal_uInt16 nPageNum ) const
642cdf0e10cSrcweir {
643cdf0e10cSrcweir return GetLayout() ? GetLayout()->IsDummyPage( nPageNum ) : 0;
644cdf0e10cSrcweir }
645cdf0e10cSrcweir
646cdf0e10cSrcweir /*************************************************************************
647cdf0e10cSrcweir |*
648cdf0e10cSrcweir |* ViewShell::UpdateFlds()
649cdf0e10cSrcweir |*
650cdf0e10cSrcweir |* Ersterstellung BP 04.05.92
651cdf0e10cSrcweir |* Beschreibung erzwingt ein Update fuer jedes Feld
652cdf0e10cSrcweir |*
653cdf0e10cSrcweir |* UpdateFlds benachrichtigt alle Felder mit pNewHt.
654cdf0e10cSrcweir |* Wenn pNewHt == 0 ist (default), wird der Feldtyp verschickt.
655cdf0e10cSrcweir |*
656cdf0e10cSrcweir *************************************************************************/
657cdf0e10cSrcweir
UpdateFlds(sal_Bool bCloseDB)658cdf0e10cSrcweir void ViewShell::UpdateFlds(sal_Bool bCloseDB)
659cdf0e10cSrcweir {
660cdf0e10cSrcweir SET_CURR_SHELL( this );
661cdf0e10cSrcweir
662cdf0e10cSrcweir sal_Bool bCrsr = ISA(SwCrsrShell);
663cdf0e10cSrcweir if ( bCrsr )
664cdf0e10cSrcweir ((SwCrsrShell*)this)->StartAction();
665cdf0e10cSrcweir else
666cdf0e10cSrcweir StartAction();
667cdf0e10cSrcweir
668cdf0e10cSrcweir GetDoc()->UpdateFlds(0, bCloseDB);
669cdf0e10cSrcweir
670cdf0e10cSrcweir if ( bCrsr )
671cdf0e10cSrcweir ((SwCrsrShell*)this)->EndAction();
672cdf0e10cSrcweir else
673cdf0e10cSrcweir EndAction();
674cdf0e10cSrcweir }
675cdf0e10cSrcweir
676cdf0e10cSrcweir // update all charts, for that exists any table
UpdateAllCharts()677cdf0e10cSrcweir void ViewShell::UpdateAllCharts()
678cdf0e10cSrcweir {
679cdf0e10cSrcweir SET_CURR_SHELL( this );
680cdf0e10cSrcweir // Start-/EndAction handled in the SwDoc-Method!
681cdf0e10cSrcweir GetDoc()->UpdateAllCharts();
682cdf0e10cSrcweir }
683cdf0e10cSrcweir
HasCharts() const684cdf0e10cSrcweir sal_Bool ViewShell::HasCharts() const
685cdf0e10cSrcweir {
686cdf0e10cSrcweir sal_Bool bRet = sal_False;
687cdf0e10cSrcweir const SwStartNode *pStNd;
688cdf0e10cSrcweir SwNodeIndex aIdx( *GetDoc()->GetNodes().GetEndOfAutotext().
689cdf0e10cSrcweir StartOfSectionNode(), 1 );
690cdf0e10cSrcweir while ( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
691cdf0e10cSrcweir {
692cdf0e10cSrcweir aIdx++;
693cdf0e10cSrcweir const SwOLENode *pNd = aIdx.GetNode().GetOLENode();
694cdf0e10cSrcweir if( pNd && pNd->GetChartTblName().Len() )
695cdf0e10cSrcweir {
696cdf0e10cSrcweir bRet = sal_True;
697cdf0e10cSrcweir break;
698cdf0e10cSrcweir }
699cdf0e10cSrcweir }
700cdf0e10cSrcweir return bRet;
701cdf0e10cSrcweir }
702cdf0e10cSrcweir
703cdf0e10cSrcweir /*************************************************************************
704cdf0e10cSrcweir |*
705cdf0e10cSrcweir |* ViewShell::LayoutIdle()
706cdf0e10cSrcweir |*
707cdf0e10cSrcweir |* Ersterstellung MA 26. May. 92
708cdf0e10cSrcweir |* Letzte Aenderung OG 19. Mar. 96
709cdf0e10cSrcweir |*
710cdf0e10cSrcweir *************************************************************************/
711cdf0e10cSrcweir
LayoutIdle()712cdf0e10cSrcweir void ViewShell::LayoutIdle()
713cdf0e10cSrcweir {
714cdf0e10cSrcweir #ifdef TCOVER
715cdf0e10cSrcweir //fuer TCV-Version: Ende der Startphase des Programmes
716cdf0e10cSrcweir TCovCall::Idle();
717cdf0e10cSrcweir #endif
718cdf0e10cSrcweir if( !pOpt->IsIdle() || !GetWin() ||
719cdf0e10cSrcweir ( Imp()->HasDrawView() && Imp()->GetDrawView()->IsDragObj() ) )
720cdf0e10cSrcweir return;
721cdf0e10cSrcweir
722cdf0e10cSrcweir //Kein Idle wenn gerade gedruckt wird.
723cdf0e10cSrcweir ViewShell *pSh = this;
724cdf0e10cSrcweir do
725cdf0e10cSrcweir { if ( !pSh->GetWin() )
726cdf0e10cSrcweir return;
727cdf0e10cSrcweir pSh = (ViewShell*)pSh->GetNext();
728cdf0e10cSrcweir
729cdf0e10cSrcweir } while ( pSh != this );
730cdf0e10cSrcweir
731cdf0e10cSrcweir SET_CURR_SHELL( this );
732cdf0e10cSrcweir
733cdf0e10cSrcweir #ifdef DBG_UTIL
734cdf0e10cSrcweir // Wenn Test5 gedrueckt ist, wird der IdleFormatierer abgeknipst.
735cdf0e10cSrcweir if( pOpt->IsTest5() )
736cdf0e10cSrcweir return;
737cdf0e10cSrcweir #endif
738cdf0e10cSrcweir
739cdf0e10cSrcweir {
740cdf0e10cSrcweir DBG_PROFSTART( LayoutIdle );
741cdf0e10cSrcweir
742cdf0e10cSrcweir //Cache vorbereiten und restaurieren, damit er nicht versaut wird.
743cdf0e10cSrcweir SwSaveSetLRUOfst aSave( *SwTxtFrm::GetTxtCache(),
744cdf0e10cSrcweir SwTxtFrm::GetTxtCache()->GetCurMax() - 50 );
745cdf0e10cSrcweir // #125243# there are lots of stacktraces indicating that Imp() returns NULL
746cdf0e10cSrcweir // this ViewShell seems to be invalid - but it's not clear why
747cdf0e10cSrcweir // this return is only a workaround!
748cdf0e10cSrcweir DBG_ASSERT(Imp(), "ViewShell already deleted?");
749cdf0e10cSrcweir if(!Imp())
750cdf0e10cSrcweir return;
751cdf0e10cSrcweir SwLayIdle aIdle( GetLayout(), Imp() );
752cdf0e10cSrcweir DBG_PROFSTOP( LayoutIdle );
753cdf0e10cSrcweir }
754cdf0e10cSrcweir }
755cdf0e10cSrcweir
756cdf0e10cSrcweir /*************************************************************************
757cdf0e10cSrcweir |*
758cdf0e10cSrcweir |* DOCUMENT COMPATIBILITY FLAGS
759cdf0e10cSrcweir |*
760cdf0e10cSrcweir *************************************************************************/
761cdf0e10cSrcweir
lcl_InvalidateAllCntnt(ViewShell & rSh,sal_uInt8 nInv)762cdf0e10cSrcweir void lcl_InvalidateAllCntnt( ViewShell& rSh, sal_uInt8 nInv )
763cdf0e10cSrcweir {
764cdf0e10cSrcweir sal_Bool bCrsr = rSh.ISA(SwCrsrShell);
765cdf0e10cSrcweir if ( bCrsr )
766cdf0e10cSrcweir ((SwCrsrShell&)rSh).StartAction();
767cdf0e10cSrcweir else
768cdf0e10cSrcweir rSh.StartAction();
769cdf0e10cSrcweir rSh.GetLayout()->InvalidateAllCntnt( nInv );
770cdf0e10cSrcweir if ( bCrsr )
771cdf0e10cSrcweir ((SwCrsrShell&)rSh).EndAction();
772cdf0e10cSrcweir else
773cdf0e10cSrcweir rSh.EndAction();
774cdf0e10cSrcweir
775cdf0e10cSrcweir rSh.GetDoc()->SetModified();
776cdf0e10cSrcweir }
777cdf0e10cSrcweir
778cdf0e10cSrcweir /** local method to invalidate/re-calculate positions of floating screen
779cdf0e10cSrcweir objects (Writer fly frame and drawing objects), which are anchored
780cdf0e10cSrcweir to paragraph or to character.
781cdf0e10cSrcweir
782cdf0e10cSrcweir OD 2004-03-16 #i11860#
783cdf0e10cSrcweir
784cdf0e10cSrcweir @author OD
785cdf0e10cSrcweir */
lcl_InvalidateAllObjPos(ViewShell & _rSh)786cdf0e10cSrcweir void lcl_InvalidateAllObjPos( ViewShell &_rSh )
787cdf0e10cSrcweir {
788cdf0e10cSrcweir const bool bIsCrsrShell = _rSh.ISA(SwCrsrShell);
789cdf0e10cSrcweir if ( bIsCrsrShell )
790cdf0e10cSrcweir static_cast<SwCrsrShell&>(_rSh).StartAction();
791cdf0e10cSrcweir else
792cdf0e10cSrcweir _rSh.StartAction();
793cdf0e10cSrcweir
794cdf0e10cSrcweir _rSh.GetLayout()->InvalidateAllObjPos();
795cdf0e10cSrcweir
796cdf0e10cSrcweir if ( bIsCrsrShell )
797cdf0e10cSrcweir static_cast<SwCrsrShell&>(_rSh).EndAction();
798cdf0e10cSrcweir else
799cdf0e10cSrcweir _rSh.EndAction();
800cdf0e10cSrcweir
801cdf0e10cSrcweir _rSh.GetDoc()->SetModified();
802cdf0e10cSrcweir }
803cdf0e10cSrcweir
SetParaSpaceMax(bool bNew)804cdf0e10cSrcweir void ViewShell::SetParaSpaceMax( bool bNew )
805cdf0e10cSrcweir {
806cdf0e10cSrcweir IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
807cdf0e10cSrcweir if( pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX) != bNew )
808cdf0e10cSrcweir {
809*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetDoc()->GetDocShell(), true );
810cdf0e10cSrcweir pIDSA->set(IDocumentSettingAccess::PARA_SPACE_MAX, bNew );
811cdf0e10cSrcweir const sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_SECTION;
812cdf0e10cSrcweir lcl_InvalidateAllCntnt( *this, nInv );
813cdf0e10cSrcweir }
814cdf0e10cSrcweir }
815cdf0e10cSrcweir
SetParaSpaceMaxAtPages(bool bNew)816cdf0e10cSrcweir void ViewShell::SetParaSpaceMaxAtPages( bool bNew )
817cdf0e10cSrcweir {
818cdf0e10cSrcweir IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
819cdf0e10cSrcweir if( pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES) != bNew )
820cdf0e10cSrcweir {
821*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetDoc()->GetDocShell(), true );
822cdf0e10cSrcweir pIDSA->set(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES, bNew );
823cdf0e10cSrcweir const sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_SECTION;
824cdf0e10cSrcweir lcl_InvalidateAllCntnt( *this, nInv );
825cdf0e10cSrcweir }
826cdf0e10cSrcweir }
827cdf0e10cSrcweir
SetTabCompat(bool bNew)828cdf0e10cSrcweir void ViewShell::SetTabCompat( bool bNew )
829cdf0e10cSrcweir {
830cdf0e10cSrcweir IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
831cdf0e10cSrcweir if( pIDSA->get(IDocumentSettingAccess::TAB_COMPAT) != bNew )
832cdf0e10cSrcweir {
833*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetDoc()->GetDocShell(), true );
834cdf0e10cSrcweir pIDSA->set(IDocumentSettingAccess::TAB_COMPAT, bNew );
835cdf0e10cSrcweir const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
836cdf0e10cSrcweir lcl_InvalidateAllCntnt( *this, nInv );
837cdf0e10cSrcweir }
838cdf0e10cSrcweir }
839cdf0e10cSrcweir
SetAddExtLeading(bool bNew)840cdf0e10cSrcweir void ViewShell::SetAddExtLeading( bool bNew )
841cdf0e10cSrcweir {
842cdf0e10cSrcweir IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
843cdf0e10cSrcweir if ( pIDSA->get(IDocumentSettingAccess::ADD_EXT_LEADING) != bNew )
844cdf0e10cSrcweir {
845*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetDoc()->GetDocShell(), true );
846cdf0e10cSrcweir pIDSA->set(IDocumentSettingAccess::ADD_EXT_LEADING, bNew );
847cdf0e10cSrcweir SdrModel* pTmpDrawModel = getIDocumentDrawModelAccess()->GetDrawModel();
848cdf0e10cSrcweir if ( pTmpDrawModel )
849cdf0e10cSrcweir pTmpDrawModel->SetAddExtLeading( bNew );
850cdf0e10cSrcweir const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
851cdf0e10cSrcweir lcl_InvalidateAllCntnt( *this, nInv );
852cdf0e10cSrcweir }
853cdf0e10cSrcweir }
854cdf0e10cSrcweir
SetUseVirDev(bool bNewVirtual)855cdf0e10cSrcweir void ViewShell::SetUseVirDev( bool bNewVirtual )
856cdf0e10cSrcweir {
857cdf0e10cSrcweir IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
858cdf0e10cSrcweir if ( pIDSA->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) != bNewVirtual )
859cdf0e10cSrcweir {
860*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetDoc()->GetDocShell(), true );
861cdf0e10cSrcweir // this sets the flag at the document and calls PrtDataChanged
862cdf0e10cSrcweir IDocumentDeviceAccess* pIDDA = getIDocumentDeviceAccess();
863cdf0e10cSrcweir pIDDA->setReferenceDeviceType( bNewVirtual, true );
864cdf0e10cSrcweir }
865cdf0e10cSrcweir }
866cdf0e10cSrcweir
867cdf0e10cSrcweir // OD 2004-02-16 #106629# - control, if paragraph and table spacing is added
868cdf0e10cSrcweir // at bottom of table cells
SetAddParaSpacingToTableCells(bool _bAddParaSpacingToTableCells)869cdf0e10cSrcweir void ViewShell::SetAddParaSpacingToTableCells( bool _bAddParaSpacingToTableCells )
870cdf0e10cSrcweir {
871cdf0e10cSrcweir IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
872cdf0e10cSrcweir if ( pIDSA->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells )
873cdf0e10cSrcweir {
874*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetDoc()->GetDocShell(), true );
875cdf0e10cSrcweir pIDSA->set(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells );
876cdf0e10cSrcweir const sal_uInt8 nInv = INV_PRTAREA;
877cdf0e10cSrcweir lcl_InvalidateAllCntnt( *this, nInv );
878cdf0e10cSrcweir }
879cdf0e10cSrcweir }
880cdf0e10cSrcweir
881cdf0e10cSrcweir // OD 06.01.2004 #i11859# - control, if former formatting of text lines with
882cdf0e10cSrcweir // proportional line spacing is used or not.
SetUseFormerLineSpacing(bool _bUseFormerLineSpacing)883cdf0e10cSrcweir void ViewShell::SetUseFormerLineSpacing( bool _bUseFormerLineSpacing )
884cdf0e10cSrcweir {
885cdf0e10cSrcweir IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
886cdf0e10cSrcweir if ( pIDSA->get(IDocumentSettingAccess::OLD_LINE_SPACING) != _bUseFormerLineSpacing )
887cdf0e10cSrcweir {
888*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetDoc()->GetDocShell(), true );
889cdf0e10cSrcweir pIDSA->set(IDocumentSettingAccess::OLD_LINE_SPACING, _bUseFormerLineSpacing );
890cdf0e10cSrcweir const sal_uInt8 nInv = INV_PRTAREA;
891cdf0e10cSrcweir lcl_InvalidateAllCntnt( *this, nInv );
892cdf0e10cSrcweir }
893cdf0e10cSrcweir }
894cdf0e10cSrcweir
895cdf0e10cSrcweir // OD 2004-03-12 #i11860# - control, if former object positioning is used or not.
SetUseFormerObjectPositioning(bool _bUseFormerObjPos)896cdf0e10cSrcweir void ViewShell::SetUseFormerObjectPositioning( bool _bUseFormerObjPos )
897cdf0e10cSrcweir {
898cdf0e10cSrcweir IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
899cdf0e10cSrcweir if ( pIDSA->get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS) != _bUseFormerObjPos )
900cdf0e10cSrcweir {
901*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetDoc()->GetDocShell(), true );
902cdf0e10cSrcweir pIDSA->set(IDocumentSettingAccess::USE_FORMER_OBJECT_POS, _bUseFormerObjPos );
903cdf0e10cSrcweir lcl_InvalidateAllObjPos( *this );
904cdf0e10cSrcweir }
905cdf0e10cSrcweir }
906cdf0e10cSrcweir
907cdf0e10cSrcweir // OD 2004-05-05 #i28701#
SetConsiderWrapOnObjPos(bool _bConsiderWrapOnObjPos)908cdf0e10cSrcweir void ViewShell::SetConsiderWrapOnObjPos( bool _bConsiderWrapOnObjPos )
909cdf0e10cSrcweir {
910cdf0e10cSrcweir IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
911cdf0e10cSrcweir if ( pIDSA->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) != _bConsiderWrapOnObjPos )
912cdf0e10cSrcweir {
913*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetDoc()->GetDocShell(), true );
914cdf0e10cSrcweir pIDSA->set(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION, _bConsiderWrapOnObjPos );
915cdf0e10cSrcweir lcl_InvalidateAllObjPos( *this );
916cdf0e10cSrcweir }
917cdf0e10cSrcweir }
918cdf0e10cSrcweir
919cdf0e10cSrcweir // --> FME #108724#
SetUseFormerTextWrapping(bool _bUseFormerTextWrapping)920cdf0e10cSrcweir void ViewShell::SetUseFormerTextWrapping( bool _bUseFormerTextWrapping )
921cdf0e10cSrcweir {
922cdf0e10cSrcweir IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
923cdf0e10cSrcweir if ( pIDSA->get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING) != _bUseFormerTextWrapping )
924cdf0e10cSrcweir {
925*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetDoc()->GetDocShell(), true );
926cdf0e10cSrcweir pIDSA->set(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING, _bUseFormerTextWrapping );
927cdf0e10cSrcweir const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
928cdf0e10cSrcweir lcl_InvalidateAllCntnt( *this, nInv );
929cdf0e10cSrcweir }
930cdf0e10cSrcweir }
931cdf0e10cSrcweir // <--
932cdf0e10cSrcweir
933cdf0e10cSrcweir // -> PB 2007-06-11 #i45491#
SetDoNotJustifyLinesWithManualBreak(bool _bDoNotJustifyLinesWithManualBreak)934cdf0e10cSrcweir void ViewShell::SetDoNotJustifyLinesWithManualBreak( bool _bDoNotJustifyLinesWithManualBreak )
935cdf0e10cSrcweir {
936cdf0e10cSrcweir IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
937cdf0e10cSrcweir if ( pIDSA->get(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) != _bDoNotJustifyLinesWithManualBreak )
938cdf0e10cSrcweir {
939*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetDoc()->GetDocShell(), true );
940cdf0e10cSrcweir pIDSA->set(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, _bDoNotJustifyLinesWithManualBreak );
941cdf0e10cSrcweir const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
942cdf0e10cSrcweir lcl_InvalidateAllCntnt( *this, nInv );
943cdf0e10cSrcweir }
944cdf0e10cSrcweir }
945cdf0e10cSrcweir // <--
946cdf0e10cSrcweir
947cdf0e10cSrcweir /******************************************************************************
948cdf0e10cSrcweir |*
949cdf0e10cSrcweir |* ViewShell::Reformat
950cdf0e10cSrcweir |*
951cdf0e10cSrcweir |* Ersterstellung BP ???
952cdf0e10cSrcweir |* Letzte Aenderung MA 13. Feb. 98
953cdf0e10cSrcweir |*
954cdf0e10cSrcweir ******************************************************************************/
955cdf0e10cSrcweir
Reformat()956cdf0e10cSrcweir void ViewShell::Reformat()
957cdf0e10cSrcweir {
958*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetDoc()->GetDocShell(), true );
959cdf0e10cSrcweir
960cdf0e10cSrcweir // Wir gehen auf Nummer sicher:
961cdf0e10cSrcweir // Wir muessen die alten Fontinformationen wegschmeissen,
962cdf0e10cSrcweir // wenn die Druckeraufloesung oder der Zoomfaktor sich aendert.
963cdf0e10cSrcweir // Init() und Reformat() sind die sichersten Stellen.
964cdf0e10cSrcweir #ifdef FNTMET
965cdf0e10cSrcweir aFntMetList.Flush();
966cdf0e10cSrcweir #else
967cdf0e10cSrcweir pFntCache->Flush( );
968cdf0e10cSrcweir #endif
969cdf0e10cSrcweir
970cdf0e10cSrcweir if( GetLayout()->IsCallbackActionEnabled() )
971cdf0e10cSrcweir {
972cdf0e10cSrcweir
973cdf0e10cSrcweir StartAction();
974cdf0e10cSrcweir GetLayout()->InvalidateAllCntnt( INV_SIZE | INV_POS | INV_PRTAREA );
975cdf0e10cSrcweir EndAction();
976cdf0e10cSrcweir }
977cdf0e10cSrcweir }
978cdf0e10cSrcweir
ChgNumberDigits()979cdf0e10cSrcweir void ViewShell::ChgNumberDigits()
980cdf0e10cSrcweir {
981cdf0e10cSrcweir SdrModel* pTmpDrawModel = getIDocumentDrawModelAccess()->GetDrawModel();
982cdf0e10cSrcweir if ( pTmpDrawModel )
983cdf0e10cSrcweir pTmpDrawModel->ReformatAllTextObjects();
984cdf0e10cSrcweir Reformat();
985cdf0e10cSrcweir }
986cdf0e10cSrcweir
987cdf0e10cSrcweir /******************************************************************************
988cdf0e10cSrcweir |*
989cdf0e10cSrcweir |* ViewShell::CalcLayout()
990cdf0e10cSrcweir |* Vollstaendige Formatierung von Layout und Inhalt.
991cdf0e10cSrcweir |*
992cdf0e10cSrcweir |* Ersterstellung MA 31. Jan. 94
993cdf0e10cSrcweir |* Letzte Aenderung MA 08. Oct. 96
994cdf0e10cSrcweir |*
995cdf0e10cSrcweir ******************************************************************************/
996cdf0e10cSrcweir
CalcLayout()997cdf0e10cSrcweir void ViewShell::CalcLayout()
998cdf0e10cSrcweir {
999cdf0e10cSrcweir SET_CURR_SHELL( this );
1000*8ef2f12bSOliver-Rainer Wittmann SwWait aWait( *GetDoc()->GetDocShell(), true );
1001cdf0e10cSrcweir
1002cdf0e10cSrcweir //Cache vorbereiten und restaurieren, damit er nicht versaut wird.
1003cdf0e10cSrcweir SwSaveSetLRUOfst aSaveLRU( *SwTxtFrm::GetTxtCache(),
1004cdf0e10cSrcweir SwTxtFrm::GetTxtCache()->GetCurMax() - 50 );
1005cdf0e10cSrcweir
1006cdf0e10cSrcweir //Progress einschalten wenn noch keiner Lauft.
1007cdf0e10cSrcweir const sal_Bool bEndProgress = SfxProgress::GetActiveProgress( GetDoc()->GetDocShell() ) == 0;
1008cdf0e10cSrcweir if ( bEndProgress )
1009cdf0e10cSrcweir {
1010cdf0e10cSrcweir sal_uInt16 nEndPage = GetLayout()->GetPageNum();
1011cdf0e10cSrcweir nEndPage += nEndPage * 10 / 100;
1012cdf0e10cSrcweir ::StartProgress( STR_STATSTR_REFORMAT, 0, nEndPage, GetDoc()->GetDocShell() );
1013cdf0e10cSrcweir }
1014cdf0e10cSrcweir
1015cdf0e10cSrcweir SwLayAction aAction( GetLayout(), Imp() );
1016cdf0e10cSrcweir aAction.SetPaint( sal_False );
1017cdf0e10cSrcweir aAction.SetStatBar( sal_True );
1018cdf0e10cSrcweir aAction.SetCalcLayout( sal_True );
1019cdf0e10cSrcweir aAction.SetReschedule( sal_True );
1020cdf0e10cSrcweir GetDoc()->LockExpFlds();
1021cdf0e10cSrcweir aAction.Action();
1022cdf0e10cSrcweir GetDoc()->UnlockExpFlds();
1023cdf0e10cSrcweir
1024cdf0e10cSrcweir //Das SetNewFldLst() am Doc wurde unterbunden und muss nachgeholt
1025cdf0e10cSrcweir //werden (siehe flowfrm.cxx, txtfld.cxx)
1026cdf0e10cSrcweir if ( aAction.IsExpFlds() )
1027cdf0e10cSrcweir {
1028cdf0e10cSrcweir aAction.Reset();
1029cdf0e10cSrcweir aAction.SetPaint( sal_False );
1030cdf0e10cSrcweir aAction.SetStatBar( sal_True );
1031cdf0e10cSrcweir aAction.SetReschedule( sal_True );
1032cdf0e10cSrcweir
1033cdf0e10cSrcweir SwDocPosUpdate aMsgHnt( 0 );
1034cdf0e10cSrcweir GetDoc()->UpdatePageFlds( &aMsgHnt );
1035cdf0e10cSrcweir GetDoc()->UpdateExpFlds(NULL, true);
1036cdf0e10cSrcweir
1037cdf0e10cSrcweir aAction.Action();
1038cdf0e10cSrcweir }
1039cdf0e10cSrcweir
1040cdf0e10cSrcweir if ( VisArea().HasArea() )
1041cdf0e10cSrcweir InvalidateWindows( VisArea() );
1042cdf0e10cSrcweir if ( bEndProgress )
1043cdf0e10cSrcweir ::EndProgress( GetDoc()->GetDocShell() );
1044cdf0e10cSrcweir }
1045cdf0e10cSrcweir
1046cdf0e10cSrcweir /******************************************************************************
1047cdf0e10cSrcweir |*
1048cdf0e10cSrcweir |* ViewShell::SetFirstVisPageInvalid()
1049cdf0e10cSrcweir |*
1050cdf0e10cSrcweir |* Ersterstellung MA 19. May. 94
1051cdf0e10cSrcweir |* Letzte Aenderung MA 19. May. 94
1052cdf0e10cSrcweir |*
1053cdf0e10cSrcweir ******************************************************************************/
1054cdf0e10cSrcweir
SetFirstVisPageInvalid()1055cdf0e10cSrcweir void ViewShell::SetFirstVisPageInvalid()
1056cdf0e10cSrcweir {
1057cdf0e10cSrcweir ViewShell *pSh = this;
1058cdf0e10cSrcweir do
1059cdf0e10cSrcweir { pSh->Imp()->SetFirstVisPageInvalid();
1060cdf0e10cSrcweir pSh = (ViewShell*)pSh->GetNext();
1061cdf0e10cSrcweir
1062cdf0e10cSrcweir } while ( pSh != this );
1063cdf0e10cSrcweir }
1064cdf0e10cSrcweir
1065cdf0e10cSrcweir /******************************************************************************
1066cdf0e10cSrcweir |*
1067cdf0e10cSrcweir |* ViewShell::SizeChgNotify()
1068cdf0e10cSrcweir |*
1069cdf0e10cSrcweir |* Ersterstellung MA ??
1070cdf0e10cSrcweir |* Letzte Aenderung MA 17. Sep. 96
1071cdf0e10cSrcweir |*
1072cdf0e10cSrcweir ******************************************************************************/
1073cdf0e10cSrcweir
SizeChgNotify()1074cdf0e10cSrcweir void ViewShell::SizeChgNotify()
1075cdf0e10cSrcweir {
1076cdf0e10cSrcweir if ( !pWin )
1077cdf0e10cSrcweir bDocSizeChgd = sal_True;
1078cdf0e10cSrcweir else if( ActionPend() || Imp()->IsCalcLayoutProgress() || bPaintInProgress )
1079cdf0e10cSrcweir {
1080cdf0e10cSrcweir bDocSizeChgd = sal_True;
1081cdf0e10cSrcweir
1082cdf0e10cSrcweir if ( !Imp()->IsCalcLayoutProgress() && ISA( SwCrsrShell ) )
1083cdf0e10cSrcweir {
1084cdf0e10cSrcweir const SwFrm *pCnt = ((SwCrsrShell*)this)->GetCurrFrm( sal_False );
1085cdf0e10cSrcweir const SwPageFrm *pPage;
1086cdf0e10cSrcweir if ( pCnt && 0 != (pPage = pCnt->FindPageFrm()) )
1087cdf0e10cSrcweir {
1088cdf0e10cSrcweir sal_uInt16 nVirtNum = pPage->GetVirtPageNum();
1089cdf0e10cSrcweir const SvxNumberType& rNum = pPage->GetPageDesc()->GetNumType();
1090cdf0e10cSrcweir String sDisplay = rNum.GetNumStr( nVirtNum );
1091cdf0e10cSrcweir PageNumNotify( this, pCnt->GetPhyPageNum(), nVirtNum, sDisplay );
1092cdf0e10cSrcweir }
1093cdf0e10cSrcweir }
1094cdf0e10cSrcweir }
1095cdf0e10cSrcweir else
1096cdf0e10cSrcweir {
1097cdf0e10cSrcweir bDocSizeChgd = sal_False;
1098cdf0e10cSrcweir ::SizeNotify( this, GetDocSize() );
1099cdf0e10cSrcweir }
1100cdf0e10cSrcweir }
1101cdf0e10cSrcweir
1102cdf0e10cSrcweir /******************************************************************************
1103cdf0e10cSrcweir |*
1104cdf0e10cSrcweir |* ViewShell::VisPortChgd()
1105cdf0e10cSrcweir |*
1106cdf0e10cSrcweir |* Ersterstellung MA ??
1107cdf0e10cSrcweir |* Letzte Aenderung MA 22. Jul. 96
1108cdf0e10cSrcweir |*
1109cdf0e10cSrcweir ******************************************************************************/
1110cdf0e10cSrcweir
VisPortChgd(const SwRect & rRect)1111cdf0e10cSrcweir void ViewShell::VisPortChgd( const SwRect &rRect)
1112cdf0e10cSrcweir {
1113cdf0e10cSrcweir ASSERT( GetWin(), "VisPortChgd ohne Window." );
1114cdf0e10cSrcweir
1115cdf0e10cSrcweir if ( rRect == VisArea() )
1116cdf0e10cSrcweir return;
1117cdf0e10cSrcweir
1118cdf0e10cSrcweir #ifdef DBG_UTIL
1119cdf0e10cSrcweir if ( bInEndAction )
1120cdf0e10cSrcweir {
1121cdf0e10cSrcweir //Da Rescheduled doch schon wieder irgendwo einer?
1122cdf0e10cSrcweir ASSERT( !this, "Scroll waehrend einer EndAction." );
1123cdf0e10cSrcweir }
1124cdf0e10cSrcweir #endif
1125cdf0e10cSrcweir
1126cdf0e10cSrcweir //Ersteinmal die alte sichtbare Seite holen, dann braucht nacher nicht
1127cdf0e10cSrcweir //lange gesucht werden.
1128cdf0e10cSrcweir const SwFrm *pOldPage = Imp()->GetFirstVisPage();
1129cdf0e10cSrcweir
1130cdf0e10cSrcweir const SwRect aPrevArea( VisArea() );
1131cdf0e10cSrcweir const sal_Bool bFull = aPrevArea.IsEmpty();
1132cdf0e10cSrcweir aVisArea = rRect;
1133cdf0e10cSrcweir SetFirstVisPageInvalid();
1134cdf0e10cSrcweir
1135cdf0e10cSrcweir //Wenn noch eine PaintRegion herumsteht und sich die VisArea geaendert hat,
1136cdf0e10cSrcweir //so ist die PaintRegion spaetestens jetzt obsolete. Die PaintRegion kann
1137cdf0e10cSrcweir //vom RootFrm::Paint erzeugt worden sein.
1138cdf0e10cSrcweir if ( !bInEndAction &&
1139cdf0e10cSrcweir Imp()->GetRegion() && Imp()->GetRegion()->GetOrigin() != VisArea() )
1140cdf0e10cSrcweir Imp()->DelRegion();
1141cdf0e10cSrcweir
1142cdf0e10cSrcweir SET_CURR_SHELL( this );
1143cdf0e10cSrcweir
1144cdf0e10cSrcweir bool bScrolled = false;
1145cdf0e10cSrcweir
1146cdf0e10cSrcweir SwPostItMgr* pPostItMgr = GetPostItMgr();
1147cdf0e10cSrcweir
1148cdf0e10cSrcweir if ( bFull )
1149cdf0e10cSrcweir GetWin()->Invalidate();
1150cdf0e10cSrcweir else
1151cdf0e10cSrcweir {
1152cdf0e10cSrcweir // Betrag ausrechnen, um den gescrolled werden muss.
1153cdf0e10cSrcweir const long nXDiff = aPrevArea.Left() - VisArea().Left();
1154cdf0e10cSrcweir const long nYDiff = aPrevArea.Top() - VisArea().Top();
1155cdf0e10cSrcweir
1156cdf0e10cSrcweir if( !nXDiff && !GetViewOptions()->getBrowseMode() &&
1157cdf0e10cSrcweir (!Imp()->HasDrawView() || !Imp()->GetDrawView()->IsGridVisible() ) )
1158cdf0e10cSrcweir {
1159cdf0e10cSrcweir //Falls moeglich die Wiese nicht mit Scrollen.
1160cdf0e10cSrcweir //Also linke und rechte Kante des Scrollbereiches auf die
1161cdf0e10cSrcweir //Seiten begrenzen.
1162cdf0e10cSrcweir const SwPageFrm *pPage = (SwPageFrm*)GetLayout()->Lower(); //swmod 071108//swmod 071225
1163cdf0e10cSrcweir if ( pPage->Frm().Top() > pOldPage->Frm().Top() )
1164cdf0e10cSrcweir pPage = (SwPageFrm*)pOldPage;
1165cdf0e10cSrcweir SwRect aBoth( VisArea() );
1166cdf0e10cSrcweir aBoth.Union( aPrevArea );
1167cdf0e10cSrcweir const SwTwips nBottom = aBoth.Bottom();
1168cdf0e10cSrcweir SwTwips nMinLeft = LONG_MAX;
1169cdf0e10cSrcweir SwTwips nMaxRight= 0;
1170cdf0e10cSrcweir
1171cdf0e10cSrcweir const SwTwips nSidebarWidth = pPostItMgr && pPostItMgr->ShowNotes() && pPostItMgr->HasNotes() ?
1172cdf0e10cSrcweir pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() :
1173cdf0e10cSrcweir 0;
1174cdf0e10cSrcweir const bool bBookMode = GetViewOptions()->IsViewLayoutBookMode();
1175cdf0e10cSrcweir
1176cdf0e10cSrcweir while ( pPage && pPage->Frm().Top() <= nBottom )
1177cdf0e10cSrcweir {
1178cdf0e10cSrcweir SwRect aPageRect( pPage->Frm() );
1179cdf0e10cSrcweir if ( bBookMode )
1180cdf0e10cSrcweir {
1181cdf0e10cSrcweir const SwPageFrm& rFormatPage = static_cast<const SwPageFrm*>(pPage)->GetFormatPage();
1182cdf0e10cSrcweir aPageRect.SSize() = rFormatPage.Frm().SSize();
1183cdf0e10cSrcweir }
1184cdf0e10cSrcweir
1185cdf0e10cSrcweir if ( aPageRect.IsOver( aBoth ) )
1186cdf0e10cSrcweir {
1187cdf0e10cSrcweir // OD 12.02.2003 #i9719#, #105645# - consider new border
1188cdf0e10cSrcweir // and shadow width
1189cdf0e10cSrcweir const SwTwips nBorderWidth =
1190cdf0e10cSrcweir GetOut()->PixelToLogic( Size( pPage->BorderPxWidth(), 0 ) ).Width();
1191cdf0e10cSrcweir const SwTwips nShadowWidth =
1192cdf0e10cSrcweir GetOut()->PixelToLogic( Size( pPage->ShadowPxWidth(), 0 ) ).Width();
1193cdf0e10cSrcweir
1194cdf0e10cSrcweir SwTwips nPageLeft = 0;
1195cdf0e10cSrcweir SwTwips nPageRight = 0;
1196cdf0e10cSrcweir switch ( pPage->SidebarPosition() )
1197cdf0e10cSrcweir {
1198cdf0e10cSrcweir case sw::sidebarwindows::SIDEBAR_LEFT:
1199cdf0e10cSrcweir {
1200cdf0e10cSrcweir nPageLeft = aPageRect.Left() - nBorderWidth - nSidebarWidth;
1201cdf0e10cSrcweir nPageRight = aPageRect.Right() + nBorderWidth + nShadowWidth;
1202cdf0e10cSrcweir }
1203cdf0e10cSrcweir break;
1204cdf0e10cSrcweir case sw::sidebarwindows::SIDEBAR_RIGHT:
1205cdf0e10cSrcweir {
1206cdf0e10cSrcweir nPageLeft = aPageRect.Left() - nBorderWidth;
1207cdf0e10cSrcweir nPageRight = aPageRect.Right() + nBorderWidth + nShadowWidth + nSidebarWidth;
1208cdf0e10cSrcweir }
1209cdf0e10cSrcweir break;
1210cdf0e10cSrcweir case sw::sidebarwindows::SIDEBAR_NONE:
1211cdf0e10cSrcweir // nothing to do
1212cdf0e10cSrcweir break;
1213cdf0e10cSrcweir }
1214cdf0e10cSrcweir if( nPageLeft < nMinLeft )
1215cdf0e10cSrcweir nMinLeft = nPageLeft;
1216cdf0e10cSrcweir if( nPageRight > nMaxRight )
1217cdf0e10cSrcweir nMaxRight = nPageRight;
1218cdf0e10cSrcweir //Zus. auf die Zeichenobjekte abgleichen.
1219cdf0e10cSrcweir //Einen Ofst beruecksichtigen, weil die Objekte u.U.
1220cdf0e10cSrcweir //selektiert sind und die Henkel dann hinausstehen.
1221cdf0e10cSrcweir if ( pPage->GetSortedObjs() )
1222cdf0e10cSrcweir {
1223cdf0e10cSrcweir const long nOfst = GetOut()->PixelToLogic(
1224cdf0e10cSrcweir Size(Imp()->GetDrawView()->GetMarkHdlSizePixel()/2,0)).Width();
1225cdf0e10cSrcweir for ( sal_uInt16 i = 0;
1226cdf0e10cSrcweir i < pPage->GetSortedObjs()->Count(); ++i )
1227cdf0e10cSrcweir {
1228cdf0e10cSrcweir SwAnchoredObject* pObj = (*pPage->GetSortedObjs())[i];
1229cdf0e10cSrcweir const Rectangle &rBound = pObj->GetObjRect().SVRect();
1230cdf0e10cSrcweir // OD 03.03.2003 #107927# - use correct datatype
1231cdf0e10cSrcweir const SwTwips nL = Max( 0L, rBound.Left() - nOfst );
1232cdf0e10cSrcweir if ( nL < nMinLeft )
1233cdf0e10cSrcweir nMinLeft = nL;
1234cdf0e10cSrcweir if( rBound.Right() + nOfst > nMaxRight )
1235cdf0e10cSrcweir nMaxRight = rBound.Right() + nOfst;
1236cdf0e10cSrcweir }
1237cdf0e10cSrcweir }
1238cdf0e10cSrcweir }
1239cdf0e10cSrcweir pPage = (SwPageFrm*)pPage->GetNext();
1240cdf0e10cSrcweir }
1241cdf0e10cSrcweir Rectangle aRect( aPrevArea.SVRect() );
1242cdf0e10cSrcweir aRect.Left() = nMinLeft;
1243cdf0e10cSrcweir aRect.Right() = nMaxRight;
1244cdf0e10cSrcweir if( VisArea().IsOver( aPrevArea ) && !nLockPaint )
1245cdf0e10cSrcweir {
1246cdf0e10cSrcweir bScrolled = true;
1247cdf0e10cSrcweir aVisArea.Pos() = aPrevArea.Pos();
1248cdf0e10cSrcweir if ( SmoothScroll( nXDiff, nYDiff, &aRect ) )
1249cdf0e10cSrcweir return;
1250cdf0e10cSrcweir aVisArea.Pos() = rRect.Pos();
1251cdf0e10cSrcweir }
1252cdf0e10cSrcweir else
1253cdf0e10cSrcweir GetWin()->Invalidate( aRect );
1254cdf0e10cSrcweir }
1255cdf0e10cSrcweir else if ( !nLockPaint ) //Wird im UnLock erledigt
1256cdf0e10cSrcweir {
1257cdf0e10cSrcweir if( VisArea().IsOver( aPrevArea ) )
1258cdf0e10cSrcweir {
1259cdf0e10cSrcweir bScrolled = true;
1260cdf0e10cSrcweir aVisArea.Pos() = aPrevArea.Pos();
1261cdf0e10cSrcweir if ( SmoothScroll( nXDiff, nYDiff, 0 ) )
1262cdf0e10cSrcweir return;
1263cdf0e10cSrcweir aVisArea.Pos() = rRect.Pos();
1264cdf0e10cSrcweir }
1265cdf0e10cSrcweir else
1266cdf0e10cSrcweir GetWin()->Invalidate();
1267cdf0e10cSrcweir }
1268cdf0e10cSrcweir }
1269cdf0e10cSrcweir
1270cdf0e10cSrcweir Point aPt( VisArea().Pos() );
1271cdf0e10cSrcweir aPt.X() = -aPt.X(); aPt.Y() = -aPt.Y();
1272cdf0e10cSrcweir MapMode aMapMode( GetWin()->GetMapMode() );
1273cdf0e10cSrcweir aMapMode.SetOrigin( aPt );
1274cdf0e10cSrcweir GetWin()->SetMapMode( aMapMode );
1275cdf0e10cSrcweir if ( HasDrawView() )
1276cdf0e10cSrcweir {
1277cdf0e10cSrcweir Imp()->GetDrawView()->VisAreaChanged( GetWin() );
1278cdf0e10cSrcweir Imp()->GetDrawView()->SetActualWin( GetWin() );
1279cdf0e10cSrcweir }
1280cdf0e10cSrcweir GetWin()->Update();
1281cdf0e10cSrcweir
1282cdf0e10cSrcweir // --> OD 2010-02-11 #i88070#
1283cdf0e10cSrcweir if ( pPostItMgr )
1284cdf0e10cSrcweir {
1285cdf0e10cSrcweir pPostItMgr->Rescale();
1286cdf0e10cSrcweir pPostItMgr->CalcRects();
1287cdf0e10cSrcweir pPostItMgr->LayoutPostIts();
1288cdf0e10cSrcweir }
1289cdf0e10cSrcweir // <--
1290cdf0e10cSrcweir
1291cdf0e10cSrcweir if ( !bScrolled && pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
1292cdf0e10cSrcweir pPostItMgr->CorrectPositions();
1293cdf0e10cSrcweir
1294cdf0e10cSrcweir if( Imp()->IsAccessible() )
1295cdf0e10cSrcweir Imp()->UpdateAccessible();
1296cdf0e10cSrcweir
1297cdf0e10cSrcweir }
1298cdf0e10cSrcweir
1299cdf0e10cSrcweir /******************************************************************************
1300cdf0e10cSrcweir |*
1301cdf0e10cSrcweir |* ViewShell::SmoothScroll()
1302cdf0e10cSrcweir |*
1303cdf0e10cSrcweir |* Ersterstellung MA 04. Jul. 96
1304cdf0e10cSrcweir |* Letzte Aenderung MA 25. Mar. 97
1305cdf0e10cSrcweir |*
1306cdf0e10cSrcweir ******************************************************************************/
1307cdf0e10cSrcweir
SmoothScroll(long lXDiff,long lYDiff,const Rectangle * pRect)1308cdf0e10cSrcweir sal_Bool ViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect )
1309cdf0e10cSrcweir {
1310cdf0e10cSrcweir const sal_uLong nColCnt = pOut->GetColorCount();
1311cdf0e10cSrcweir long lMult = 1, lMax = LONG_MAX;
1312cdf0e10cSrcweir if ( nColCnt == 65536 )
1313cdf0e10cSrcweir {
1314cdf0e10cSrcweir lMax = 7000;
1315cdf0e10cSrcweir lMult = 2;
1316cdf0e10cSrcweir }
1317cdf0e10cSrcweir if ( nColCnt == 16777216 )
1318cdf0e10cSrcweir {
1319cdf0e10cSrcweir lMax = 5000;
1320cdf0e10cSrcweir lMult = 6;
1321cdf0e10cSrcweir }
1322cdf0e10cSrcweir else if ( nColCnt == 1 )
1323cdf0e10cSrcweir {
1324cdf0e10cSrcweir lMax = 3000;
1325cdf0e10cSrcweir lMult = 12;
1326cdf0e10cSrcweir }
1327cdf0e10cSrcweir
1328cdf0e10cSrcweir // #i75172# isolated static conditions
1329cdf0e10cSrcweir const bool bOnlyYScroll(!lXDiff && Abs(lYDiff) != 0 && Abs(lYDiff) < lMax);
1330cdf0e10cSrcweir const bool bAllowedWithChildWindows(GetWin()->GetWindowClipRegionPixel(WINDOW_GETCLIPREGION_NOCHILDREN|WINDOW_GETCLIPREGION_NULL).IsNull());
1331cdf0e10cSrcweir // --> OD 2009-08-12 #i98766# - disable smooth scrolling for Mac port builds
1332cdf0e10cSrcweir #ifdef QUARTZ
1333cdf0e10cSrcweir const bool bSmoothScrollAllowed(false);
1334cdf0e10cSrcweir (void) bOnlyYScroll;
1335cdf0e10cSrcweir (void) bAllowedWithChildWindows;
1336cdf0e10cSrcweir #else
1337cdf0e10cSrcweir const bool bSmoothScrollAllowed(bOnlyYScroll && bEnableSmooth && GetViewOptions()->IsSmoothScroll() && bAllowedWithChildWindows);
1338cdf0e10cSrcweir #endif
1339cdf0e10cSrcweir // <-
1340cdf0e10cSrcweir const bool bIAmCursorShell(ISA(SwCrsrShell));
1341cdf0e10cSrcweir (void) bIAmCursorShell;
1342cdf0e10cSrcweir
1343cdf0e10cSrcweir // #i75172# with selection on overlay, smooth scroll should be allowed with it
1344cdf0e10cSrcweir const bool bAllowedForSelection(true || (bIAmCursorShell && !((SwCrsrShell*)this)->HasSelection()));
1345cdf0e10cSrcweir
1346cdf0e10cSrcweir // #i75172# with cursors on overlay, smooth scroll should be allowed with it
1347cdf0e10cSrcweir const bool bAllowedForMultipleCursors(true || (bIAmCursorShell && ((SwCrsrShell*)this)->GetCrsrCnt() < 2));
1348cdf0e10cSrcweir
1349cdf0e10cSrcweir if(bSmoothScrollAllowed && bAllowedForSelection && bAllowedForMultipleCursors)
1350cdf0e10cSrcweir {
1351cdf0e10cSrcweir Imp()->bStopSmooth = sal_False;
1352cdf0e10cSrcweir
1353cdf0e10cSrcweir const SwRect aOldVis( VisArea() );
1354cdf0e10cSrcweir
1355cdf0e10cSrcweir //Virtuelles Device erzeugen und einstellen.
1356cdf0e10cSrcweir const Size aPixSz = GetWin()->PixelToLogic(Size(1,1));
1357cdf0e10cSrcweir VirtualDevice *pVout = new VirtualDevice( *GetWin() );
1358cdf0e10cSrcweir pVout->SetLineColor( GetWin()->GetLineColor() );
1359cdf0e10cSrcweir pVout->SetFillColor( GetWin()->GetFillColor() );
1360cdf0e10cSrcweir MapMode aMapMode( GetWin()->GetMapMode() );
1361cdf0e10cSrcweir pVout->SetMapMode( aMapMode );
1362cdf0e10cSrcweir Size aSize( aVisArea.Width()+2*aPixSz.Width(), Abs(lYDiff)+(2*aPixSz.Height()) );
1363cdf0e10cSrcweir if ( pRect )
1364cdf0e10cSrcweir aSize.Width() = Min(aSize.Width(), pRect->GetWidth()+2*aPixSz.Width());
1365cdf0e10cSrcweir if ( pVout->SetOutputSize( aSize ) )
1366cdf0e10cSrcweir {
1367cdf0e10cSrcweir nLockPaint++;
1368cdf0e10cSrcweir
1369cdf0e10cSrcweir //Ersteinmal alles neue in das VirDev Painten.
1370cdf0e10cSrcweir SwRect aRect( VisArea() );
1371cdf0e10cSrcweir aRect.Height( aSize.Height() );
1372cdf0e10cSrcweir if ( pRect )
1373cdf0e10cSrcweir {
1374cdf0e10cSrcweir aRect.Pos().X() = Max(aRect.Left(),pRect->Left()-aPixSz.Width());
1375cdf0e10cSrcweir aRect.Right( Min(aRect.Right()+2*aPixSz.Width(), pRect->Right()+aPixSz.Width()));
1376cdf0e10cSrcweir }
1377cdf0e10cSrcweir else
1378cdf0e10cSrcweir aRect.SSize().Width() += 2*aPixSz.Width();
1379cdf0e10cSrcweir aRect.Pos().Y() = lYDiff < 0 ? aOldVis.Bottom() - aPixSz.Height()
1380cdf0e10cSrcweir : aRect.Top() - aSize.Height() + aPixSz.Height();
1381cdf0e10cSrcweir aRect.Pos().X() = Max( 0L, aRect.Left()-aPixSz.Width() );
1382cdf0e10cSrcweir aRect.Pos() = GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.Pos()));
1383cdf0e10cSrcweir aRect.SSize()= GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.SSize()));
1384cdf0e10cSrcweir aVisArea = aRect;
1385cdf0e10cSrcweir const Point aPt( -aRect.Left(), -aRect.Top() );
1386cdf0e10cSrcweir aMapMode.SetOrigin( aPt );
1387cdf0e10cSrcweir pVout->SetMapMode( aMapMode );
1388cdf0e10cSrcweir OutputDevice *pOld = pOut;
1389cdf0e10cSrcweir pOut = pVout;
1390cdf0e10cSrcweir
1391cdf0e10cSrcweir {
1392cdf0e10cSrcweir // #i75172# To get a clean repaint, a new ObjectContact is needed here. Without, the
1393cdf0e10cSrcweir // repaint would not be correct since it would use the wrong DrawPage visible region.
1394cdf0e10cSrcweir // This repaint IS about painting something currently outside the visible part (!).
1395cdf0e10cSrcweir // For that purpose, AddWindowToPaintView is used which creates a new SdrPageViewWindow
1396cdf0e10cSrcweir // and all the necessary stuff. It's not cheap, but necessary here. Alone because repaint
1397cdf0e10cSrcweir // target really is NOT the current window.
1398cdf0e10cSrcweir // Also will automatically NOT use PreRendering and overlay (since target is VirtualDevice)
1399cdf0e10cSrcweir if(!HasDrawView())
1400cdf0e10cSrcweir MakeDrawView();
1401cdf0e10cSrcweir SdrView* pDrawView = GetDrawView();
1402cdf0e10cSrcweir pDrawView->AddWindowToPaintView(pVout);
1403cdf0e10cSrcweir
1404cdf0e10cSrcweir // clear pWin during DLPrePaint2 to get paint preparation for pOut, but set it again
1405cdf0e10cSrcweir // immediately afterwards. There are many decisions in SW which imply that Printing
1406cdf0e10cSrcweir // is used when pWin == 0 (wrong but widely used).
1407cdf0e10cSrcweir Window* pOldWin = pWin;
1408cdf0e10cSrcweir pWin = 0;
1409cdf0e10cSrcweir DLPrePaint2(Region(aRect.SVRect()));
1410cdf0e10cSrcweir pWin = pOldWin;
1411cdf0e10cSrcweir
1412cdf0e10cSrcweir // SW paint stuff
1413cdf0e10cSrcweir PaintDesktop( aRect );
1414cdf0e10cSrcweir ViewShell::bLstAct = sal_True;
1415cdf0e10cSrcweir GetLayout()->Paint( aRect );
1416cdf0e10cSrcweir ViewShell::bLstAct = sal_False;
1417cdf0e10cSrcweir
1418cdf0e10cSrcweir // end paint and destroy ObjectContact again
1419cdf0e10cSrcweir DLPostPaint2(true);
1420cdf0e10cSrcweir pDrawView->DeleteWindowFromPaintView(pVout);
1421cdf0e10cSrcweir
1422cdf0e10cSrcweir // temporary debug paint checking...
1423cdf0e10cSrcweir static bool bDoSaveForVisualControl(false);
1424cdf0e10cSrcweir if(bDoSaveForVisualControl)
1425cdf0e10cSrcweir {
1426cdf0e10cSrcweir const bool bMapModeWasEnabledVDev(pVout->IsMapModeEnabled());
1427cdf0e10cSrcweir pVout->EnableMapMode(false);
1428cdf0e10cSrcweir const Bitmap aBitmap(pVout->GetBitmap(Point(), pVout->GetOutputSizePixel()));
1429cdf0e10cSrcweir const String aTmpString(ByteString( "c:\\test.bmp" ), RTL_TEXTENCODING_UTF8);
1430cdf0e10cSrcweir SvFileStream aNew(aTmpString, STREAM_WRITE|STREAM_TRUNC);
143145fd3b9aSArmin Le Grand WriteDIB(aBitmap, aNew, false, true);
1432cdf0e10cSrcweir pVout->EnableMapMode(bMapModeWasEnabledVDev);
1433cdf0e10cSrcweir }
1434cdf0e10cSrcweir }
1435cdf0e10cSrcweir
1436cdf0e10cSrcweir pOut = pOld;
1437cdf0e10cSrcweir aVisArea = aOldVis;
1438cdf0e10cSrcweir
1439cdf0e10cSrcweir //Jetzt Stueckchenweise schieben und die neuen Pixel aus dem
1440cdf0e10cSrcweir //VirDev kopieren.
1441cdf0e10cSrcweir
1442cdf0e10cSrcweir // ??????????????????????
1443cdf0e10cSrcweir // or is it better to get the scrollfactor from the User
1444cdf0e10cSrcweir // as option?
1445cdf0e10cSrcweir // ??????????????????????
1446cdf0e10cSrcweir long lMaDelta = aPixSz.Height();
1447cdf0e10cSrcweir if ( Abs(lYDiff) > ( aVisArea.Height() / 3 ) )
1448cdf0e10cSrcweir lMaDelta *= 6;
1449cdf0e10cSrcweir else
1450cdf0e10cSrcweir lMaDelta *= 2;
1451cdf0e10cSrcweir
1452cdf0e10cSrcweir lMaDelta *= lMult;
1453cdf0e10cSrcweir
1454cdf0e10cSrcweir if ( lYDiff < 0 )
1455cdf0e10cSrcweir lMaDelta = -lMaDelta;
1456cdf0e10cSrcweir
1457cdf0e10cSrcweir long lDiff = lYDiff;
1458cdf0e10cSrcweir while ( lDiff )
1459cdf0e10cSrcweir {
1460cdf0e10cSrcweir long lScroll;
1461cdf0e10cSrcweir if ( Imp()->bStopSmooth || Abs(lDiff) <= Abs(lMaDelta) )
1462cdf0e10cSrcweir {
1463cdf0e10cSrcweir lScroll = lDiff;
1464cdf0e10cSrcweir lDiff = 0;
1465cdf0e10cSrcweir }
1466cdf0e10cSrcweir else
1467cdf0e10cSrcweir {
1468cdf0e10cSrcweir lScroll = lMaDelta;
1469cdf0e10cSrcweir lDiff -= lMaDelta;
1470cdf0e10cSrcweir }
1471cdf0e10cSrcweir
1472cdf0e10cSrcweir const SwRect aTmpOldVis = VisArea();
1473cdf0e10cSrcweir aVisArea.Pos().Y() -= lScroll;
1474cdf0e10cSrcweir aVisArea.Pos() = GetWin()->PixelToLogic( GetWin()->LogicToPixel( VisArea().Pos()));
1475cdf0e10cSrcweir lScroll = aTmpOldVis.Top() - VisArea().Top();
1476cdf0e10cSrcweir if ( pRect )
1477cdf0e10cSrcweir {
1478cdf0e10cSrcweir Rectangle aTmp( aTmpOldVis.SVRect() );
1479cdf0e10cSrcweir aTmp.Left() = pRect->Left();
1480cdf0e10cSrcweir aTmp.Right()= pRect->Right();
1481cdf0e10cSrcweir GetWin()->Scroll( 0, lScroll, aTmp, SCROLL_CHILDREN);
1482cdf0e10cSrcweir }
1483cdf0e10cSrcweir else
1484cdf0e10cSrcweir GetWin()->Scroll( 0, lScroll, SCROLL_CHILDREN );
1485cdf0e10cSrcweir
1486cdf0e10cSrcweir const Point aTmpPt( -VisArea().Left(), -VisArea().Top() );
1487cdf0e10cSrcweir MapMode aTmpMapMode( GetWin()->GetMapMode() );
1488cdf0e10cSrcweir aTmpMapMode.SetOrigin( aTmpPt );
1489cdf0e10cSrcweir GetWin()->SetMapMode( aTmpMapMode );
1490cdf0e10cSrcweir
1491cdf0e10cSrcweir if ( Imp()->HasDrawView() )
1492cdf0e10cSrcweir Imp()->GetDrawView()->VisAreaChanged( GetWin() );
1493cdf0e10cSrcweir
1494cdf0e10cSrcweir SetFirstVisPageInvalid();
1495cdf0e10cSrcweir if ( !Imp()->bStopSmooth )
1496cdf0e10cSrcweir {
1497cdf0e10cSrcweir const bool bScrollDirectionIsUp(lScroll > 0);
1498cdf0e10cSrcweir Imp()->aSmoothRect = VisArea();
1499cdf0e10cSrcweir
1500cdf0e10cSrcweir if(bScrollDirectionIsUp)
1501cdf0e10cSrcweir {
1502cdf0e10cSrcweir Imp()->aSmoothRect.Bottom( VisArea().Top() + lScroll + aPixSz.Height());
1503cdf0e10cSrcweir }
1504cdf0e10cSrcweir else
1505cdf0e10cSrcweir {
1506cdf0e10cSrcweir Imp()->aSmoothRect.Top( VisArea().Bottom() + lScroll - aPixSz.Height());
1507cdf0e10cSrcweir }
1508cdf0e10cSrcweir
1509cdf0e10cSrcweir Imp()->bSmoothUpdate = sal_True;
1510cdf0e10cSrcweir GetWin()->Update();
1511cdf0e10cSrcweir Imp()->bSmoothUpdate = sal_False;
1512cdf0e10cSrcweir
1513cdf0e10cSrcweir if(!Imp()->bStopSmooth)
1514cdf0e10cSrcweir {
1515cdf0e10cSrcweir static bool bDoItOnPixels(true);
1516cdf0e10cSrcweir if(bDoItOnPixels)
1517cdf0e10cSrcweir {
1518cdf0e10cSrcweir // start paint on logic base
1519cdf0e10cSrcweir const Rectangle aTargetLogic(Imp()->aSmoothRect.SVRect());
1520cdf0e10cSrcweir DLPrePaint2(Region(aTargetLogic));
1521cdf0e10cSrcweir
1522cdf0e10cSrcweir // get target rectangle in discrete pixels
1523cdf0e10cSrcweir OutputDevice& rTargetDevice = mpTargetPaintWindow->GetTargetOutputDevice();
1524cdf0e10cSrcweir const Rectangle aTargetPixel(rTargetDevice.LogicToPixel(aTargetLogic));
1525cdf0e10cSrcweir
1526cdf0e10cSrcweir // get source top-left in discrete pixels
1527cdf0e10cSrcweir const Point aSourceTopLeft(pVout->LogicToPixel(aTargetLogic.TopLeft()));
1528cdf0e10cSrcweir
1529cdf0e10cSrcweir // switch off MapModes
1530cdf0e10cSrcweir const bool bMapModeWasEnabledDest(rTargetDevice.IsMapModeEnabled());
1531cdf0e10cSrcweir const bool bMapModeWasEnabledSource(pVout->IsMapModeEnabled());
1532cdf0e10cSrcweir rTargetDevice.EnableMapMode(false);
1533cdf0e10cSrcweir pVout->EnableMapMode(false);
1534cdf0e10cSrcweir
1535cdf0e10cSrcweir // copy content
1536cdf0e10cSrcweir static bool bTestDirectToWindowPaint(false);
1537cdf0e10cSrcweir if(bTestDirectToWindowPaint)
1538cdf0e10cSrcweir {
1539cdf0e10cSrcweir const bool bMapModeWasEnabledWin(GetWin()->IsMapModeEnabled());
1540cdf0e10cSrcweir GetWin()->EnableMapMode(false);
1541cdf0e10cSrcweir
1542cdf0e10cSrcweir GetWin()->DrawOutDev(
1543cdf0e10cSrcweir aTargetPixel.TopLeft(), aTargetPixel.GetSize(), // dest
1544cdf0e10cSrcweir aSourceTopLeft, aTargetPixel.GetSize(), // source
1545cdf0e10cSrcweir *pVout);
1546cdf0e10cSrcweir
1547cdf0e10cSrcweir GetWin()->EnableMapMode(bMapModeWasEnabledWin);
1548cdf0e10cSrcweir }
1549cdf0e10cSrcweir
1550cdf0e10cSrcweir rTargetDevice.DrawOutDev(
1551cdf0e10cSrcweir aTargetPixel.TopLeft(), aTargetPixel.GetSize(), // dest
1552cdf0e10cSrcweir aSourceTopLeft, aTargetPixel.GetSize(), // source
1553cdf0e10cSrcweir *pVout);
1554cdf0e10cSrcweir
1555cdf0e10cSrcweir // restore MapModes
1556cdf0e10cSrcweir rTargetDevice.EnableMapMode(bMapModeWasEnabledDest);
1557cdf0e10cSrcweir pVout->EnableMapMode(bMapModeWasEnabledSource);
1558cdf0e10cSrcweir
1559cdf0e10cSrcweir // end paint on logoc base
1560cdf0e10cSrcweir DLPostPaint2(true);
1561cdf0e10cSrcweir }
1562cdf0e10cSrcweir else
1563cdf0e10cSrcweir {
1564cdf0e10cSrcweir Rectangle aRectangle(Imp()->aSmoothRect.SVRect());
1565cdf0e10cSrcweir aRectangle.Left() -= aPixSz.Width();
1566cdf0e10cSrcweir aRectangle.Right() += aPixSz.Width();
1567cdf0e10cSrcweir aRectangle.Top() -= aPixSz.Height();
1568cdf0e10cSrcweir aRectangle.Bottom() += aPixSz.Height();
1569cdf0e10cSrcweir const Point aUpdateTopLeft(aRectangle.TopLeft());
1570cdf0e10cSrcweir const Size aUpdateSize(aRectangle.GetSize());
1571cdf0e10cSrcweir
1572cdf0e10cSrcweir // #i75172# the part getting visible needs to be handled like a repaint.
1573cdf0e10cSrcweir // For that, start with DLPrePaint2 and the correct Rectangle
1574cdf0e10cSrcweir DLPrePaint2(Region(aRectangle));
1575cdf0e10cSrcweir
1576cdf0e10cSrcweir static bool bTestDirectToWindowPaint(false);
1577cdf0e10cSrcweir if(bTestDirectToWindowPaint)
1578cdf0e10cSrcweir {
1579cdf0e10cSrcweir GetWin()->DrawOutDev(aUpdateTopLeft, aUpdateSize, aUpdateTopLeft, aUpdateSize, *pVout);
1580cdf0e10cSrcweir }
1581cdf0e10cSrcweir
1582cdf0e10cSrcweir mpTargetPaintWindow->GetTargetOutputDevice().DrawOutDev(aUpdateTopLeft, aUpdateSize, aUpdateTopLeft, aUpdateSize, *pVout);
1583cdf0e10cSrcweir
1584cdf0e10cSrcweir // #i75172# Corret repaint end
1585cdf0e10cSrcweir // Note: This also correcty creates the overlay, thus smooth scroll will
1586cdf0e10cSrcweir // also be allowed now wth selection (see big IF above)
1587cdf0e10cSrcweir DLPostPaint2(true);
1588cdf0e10cSrcweir }
1589cdf0e10cSrcweir }
1590cdf0e10cSrcweir else
1591cdf0e10cSrcweir --nLockPaint;
1592cdf0e10cSrcweir }
1593cdf0e10cSrcweir }
1594cdf0e10cSrcweir delete pVout;
1595cdf0e10cSrcweir GetWin()->Update();
1596cdf0e10cSrcweir if ( !Imp()->bStopSmooth )
1597cdf0e10cSrcweir --nLockPaint;
1598cdf0e10cSrcweir SetFirstVisPageInvalid();
1599cdf0e10cSrcweir return sal_True;
1600cdf0e10cSrcweir }
1601cdf0e10cSrcweir delete pVout;
1602cdf0e10cSrcweir }
1603cdf0e10cSrcweir
1604cdf0e10cSrcweir aVisArea.Pos().X() -= lXDiff;
1605cdf0e10cSrcweir aVisArea.Pos().Y() -= lYDiff;
1606cdf0e10cSrcweir if ( pRect )
1607cdf0e10cSrcweir GetWin()->Scroll( lXDiff, lYDiff, *pRect, SCROLL_CHILDREN);
1608cdf0e10cSrcweir else
1609cdf0e10cSrcweir GetWin()->Scroll( lXDiff, lYDiff, SCROLL_CHILDREN);
1610cdf0e10cSrcweir return sal_False;
1611cdf0e10cSrcweir }
1612cdf0e10cSrcweir
1613cdf0e10cSrcweir /******************************************************************************
1614cdf0e10cSrcweir |*
1615cdf0e10cSrcweir |* ViewShell::PaintDesktop()
1616cdf0e10cSrcweir |*
1617cdf0e10cSrcweir |* Ersterstellung MA 16. Dec. 93
1618cdf0e10cSrcweir |* Letzte Aenderung MA 30. Nov. 95
1619cdf0e10cSrcweir |*
1620cdf0e10cSrcweir ******************************************************************************/
1621cdf0e10cSrcweir
PaintDesktop(const SwRect & rRect)1622cdf0e10cSrcweir void ViewShell::PaintDesktop( const SwRect &rRect )
1623cdf0e10cSrcweir {
1624cdf0e10cSrcweir if ( !GetWin() && !GetOut()->GetConnectMetaFile() )
1625cdf0e10cSrcweir return; //Fuer den Drucker tun wir hier nix
1626cdf0e10cSrcweir
1627cdf0e10cSrcweir //Sonderfaelle abfangen, damit es nicht gar so ueberraschend aussieht.
1628cdf0e10cSrcweir //Kann z.B. waehrend des Idle'ns zwischenzeitlich auftreten.
1629cdf0e10cSrcweir //Die Rechtecke neben den Seiten muessen wir leider auf jedenfall Painten,
1630cdf0e10cSrcweir //den diese werden spaeter beim VisPortChgd ausgespart.
1631cdf0e10cSrcweir sal_Bool bBorderOnly = sal_False;
1632cdf0e10cSrcweir const SwRootFrm *pRoot = GetLayout();//swmod 080305
1633cdf0e10cSrcweir if ( rRect.Top() > pRoot->Frm().Bottom() )
1634cdf0e10cSrcweir {
1635cdf0e10cSrcweir const SwFrm *pPg = pRoot->Lower();
1636cdf0e10cSrcweir while ( pPg && pPg->GetNext() )
1637cdf0e10cSrcweir pPg = pPg->GetNext();
1638cdf0e10cSrcweir if ( !pPg || !pPg->Frm().IsOver( VisArea() ) )
1639cdf0e10cSrcweir bBorderOnly = sal_True;
1640cdf0e10cSrcweir }
1641cdf0e10cSrcweir
1642cdf0e10cSrcweir const bool bBookMode = GetViewOptions()->IsViewLayoutBookMode();
1643cdf0e10cSrcweir
1644cdf0e10cSrcweir SwRegionRects aRegion( rRect );
1645cdf0e10cSrcweir
1646cdf0e10cSrcweir //mod #i6193: remove sidebar area to avoid flickering
1647cdf0e10cSrcweir const SwPostItMgr* pPostItMgr = GetPostItMgr();
1648cdf0e10cSrcweir const SwTwips nSidebarWidth = pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ?
1649cdf0e10cSrcweir pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() :
1650cdf0e10cSrcweir 0;
1651cdf0e10cSrcweir
1652cdf0e10cSrcweir if ( bBorderOnly )
1653cdf0e10cSrcweir {
1654cdf0e10cSrcweir const SwFrm *pPage =pRoot->Lower(); //swmod 071108//swmod 071225
1655cdf0e10cSrcweir SwRect aLeft( rRect ), aRight( rRect );
1656cdf0e10cSrcweir while ( pPage )
1657cdf0e10cSrcweir {
1658cdf0e10cSrcweir long nTmp = pPage->Frm().Left();
1659cdf0e10cSrcweir if ( nTmp < aLeft.Right() )
1660cdf0e10cSrcweir aLeft.Right( nTmp );
1661cdf0e10cSrcweir nTmp = pPage->Frm().Right();
1662cdf0e10cSrcweir if ( nTmp > aRight.Left() )
1663cdf0e10cSrcweir {
1664cdf0e10cSrcweir aRight.Left( nTmp + nSidebarWidth );
1665cdf0e10cSrcweir }
1666cdf0e10cSrcweir pPage = pPage->GetNext();
1667cdf0e10cSrcweir }
1668cdf0e10cSrcweir aRegion.Remove( 0, aRegion.Count() );
1669cdf0e10cSrcweir if ( aLeft.HasArea() )
1670cdf0e10cSrcweir aRegion.Insert( aLeft, 0 );
1671cdf0e10cSrcweir if ( aRight.HasArea() )
1672cdf0e10cSrcweir aRegion.Insert( aRight, 1 );
1673cdf0e10cSrcweir }
1674cdf0e10cSrcweir else
1675cdf0e10cSrcweir {
1676cdf0e10cSrcweir const SwFrm *pPage = Imp()->GetFirstVisPage();
1677cdf0e10cSrcweir const SwTwips nBottom = rRect.Bottom();
1678cdf0e10cSrcweir //const SwTwips nRight = rRect.Right();
1679cdf0e10cSrcweir while ( pPage && aRegion.Count() &&
1680cdf0e10cSrcweir (pPage->Frm().Top() <= nBottom) ) // PAGES01 && (pPage->Frm().Left() <= nRight))
1681cdf0e10cSrcweir {
1682cdf0e10cSrcweir SwRect aPageRect( pPage->Frm() );
1683cdf0e10cSrcweir if ( bBookMode )
1684cdf0e10cSrcweir {
1685cdf0e10cSrcweir const SwPageFrm& rFormatPage = static_cast<const SwPageFrm*>(pPage)->GetFormatPage();
1686cdf0e10cSrcweir aPageRect.SSize() = rFormatPage.Frm().SSize();
1687cdf0e10cSrcweir }
1688cdf0e10cSrcweir
1689cdf0e10cSrcweir const bool bSidebarRight =
1690cdf0e10cSrcweir static_cast<const SwPageFrm*>(pPage)->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT;
1691cdf0e10cSrcweir aPageRect.Pos().X() -= bSidebarRight ? 0 : nSidebarWidth;
1692cdf0e10cSrcweir aPageRect.SSize().Width() += nSidebarWidth;
1693cdf0e10cSrcweir
1694cdf0e10cSrcweir if ( aPageRect.IsOver( rRect ) )
1695cdf0e10cSrcweir aRegion -= aPageRect;
1696cdf0e10cSrcweir
1697cdf0e10cSrcweir pPage = pPage->GetNext();
1698cdf0e10cSrcweir }
1699cdf0e10cSrcweir }
1700cdf0e10cSrcweir if ( aRegion.Count() )
1701cdf0e10cSrcweir _PaintDesktop( aRegion );
1702cdf0e10cSrcweir }
1703cdf0e10cSrcweir
1704cdf0e10cSrcweir
1705cdf0e10cSrcweir // PaintDesktop gesplittet, dieser Teil wird auch von PreViewPage benutzt
_PaintDesktop(const SwRegionRects & rRegion)1706cdf0e10cSrcweir void ViewShell::_PaintDesktop( const SwRegionRects &rRegion )
1707cdf0e10cSrcweir {
1708cdf0e10cSrcweir // OD 2004-04-23 #116347#
1709cdf0e10cSrcweir GetOut()->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
1710cdf0e10cSrcweir GetOut()->SetLineColor();
1711cdf0e10cSrcweir
1712cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < rRegion.Count(); ++i )
1713cdf0e10cSrcweir {
1714cdf0e10cSrcweir const Rectangle aRectangle(rRegion[i].SVRect());
1715cdf0e10cSrcweir
1716cdf0e10cSrcweir // #i93170#
1717cdf0e10cSrcweir // Here we have a real Problem. On the one hand we have the buffering for paint
1718cdf0e10cSrcweir // and overlay which needs an embracing pair of DLPrePaint2/DLPostPaint2 calls,
1719cdf0e10cSrcweir // on the other hand the MapMode is not set correctly when this code is executed.
1720cdf0e10cSrcweir // This is done in the users of this method, for each SWpage before painting it.
1721cdf0e10cSrcweir // Since the MapMode is not correct here, the call to DLPostPaint2 will paint
1722cdf0e10cSrcweir // existing FormControls due to the current MapMode.
1723cdf0e10cSrcweir //
1724cdf0e10cSrcweir // There are basically three solutions for this:
1725cdf0e10cSrcweir //
1726cdf0e10cSrcweir // (1) Set the MapMode correct, move the background painting to the users of
1727cdf0e10cSrcweir // this code
1728cdf0e10cSrcweir //
1729cdf0e10cSrcweir // (2) Do no DLPrePaint2/DLPostPaint2 here; no SdrObjects are allowed to lie in
1730cdf0e10cSrcweir // the desktop region. Disadvantage: the desktop will not be part of the
1731cdf0e10cSrcweir // buffers, e.g. overlay. Thus, as soon as overlay will be used over the
1732cdf0e10cSrcweir // desktop, it will not work.
1733cdf0e10cSrcweir //
1734cdf0e10cSrcweir // (3) expand DLPostPaint2 with a flag to signal if FormControl paints shall
1735cdf0e10cSrcweir // be done or not
1736cdf0e10cSrcweir //
1737cdf0e10cSrcweir // Currently, (3) will be the best possible solution. It will keep overlay and
1738cdf0e10cSrcweir // buffering intact and work without MapMode for single pages. In the medium
1739cdf0e10cSrcweir // to long run, (1) will need to be used and the bool bPaintFormLayer needs
1740cdf0e10cSrcweir // to be removed again
1741cdf0e10cSrcweir
1742cdf0e10cSrcweir // #i68597# inform Drawinglayer about display change
1743cdf0e10cSrcweir DLPrePaint2(Region(aRectangle));
1744cdf0e10cSrcweir
1745cdf0e10cSrcweir // #i75172# needed to move line/Fill color setters into loop since DLPrePaint2
1746cdf0e10cSrcweir // may exchange GetOut(), that's it's purpose. This happens e.g. at print preview.
1747cdf0e10cSrcweir GetOut()->SetFillColor( SwViewOption::GetAppBackgroundColor());
1748cdf0e10cSrcweir GetOut()->SetLineColor();
1749cdf0e10cSrcweir GetOut()->DrawRect(aRectangle);
1750cdf0e10cSrcweir
1751cdf0e10cSrcweir DLPostPaint2(false);
1752cdf0e10cSrcweir }
1753cdf0e10cSrcweir
1754cdf0e10cSrcweir GetOut()->Pop();
1755cdf0e10cSrcweir }
1756cdf0e10cSrcweir
1757cdf0e10cSrcweir /******************************************************************************
1758cdf0e10cSrcweir |*
1759cdf0e10cSrcweir |* ViewShell::CheckInvalidForPaint()
1760cdf0e10cSrcweir |*
1761cdf0e10cSrcweir |* Ersterstellung MA 19. May. 94
1762cdf0e10cSrcweir |* Letzte Aenderung MA 09. Jun. 94
1763cdf0e10cSrcweir |*
1764cdf0e10cSrcweir ******************************************************************************/
1765cdf0e10cSrcweir
CheckInvalidForPaint(const SwRect & rRect)1766cdf0e10cSrcweir sal_Bool ViewShell::CheckInvalidForPaint( const SwRect &rRect )
1767cdf0e10cSrcweir {
1768cdf0e10cSrcweir if ( !GetWin() )
1769cdf0e10cSrcweir return sal_False;
1770cdf0e10cSrcweir
1771cdf0e10cSrcweir const SwPageFrm *pPage = Imp()->GetFirstVisPage();
1772cdf0e10cSrcweir const SwTwips nBottom = VisArea().Bottom();
1773cdf0e10cSrcweir const SwTwips nRight = VisArea().Right();
1774cdf0e10cSrcweir sal_Bool bRet = sal_False;
1775cdf0e10cSrcweir while ( !bRet && pPage && !((pPage->Frm().Top() > nBottom) ||
1776cdf0e10cSrcweir (pPage->Frm().Left() > nRight)))
1777cdf0e10cSrcweir {
1778cdf0e10cSrcweir if ( pPage->IsInvalid() || pPage->IsInvalidFly() )
1779cdf0e10cSrcweir bRet = sal_True;
1780cdf0e10cSrcweir pPage = (SwPageFrm*)pPage->GetNext();
1781cdf0e10cSrcweir }
1782cdf0e10cSrcweir
1783cdf0e10cSrcweir if ( bRet )
1784cdf0e10cSrcweir {
1785cdf0e10cSrcweir //Start/EndAction wuerden hier leider nix helfen, weil das Paint vom
1786cdf0e10cSrcweir //GUI 'reinkam und somit ein Clipping gesetzt ist gegen das wir nicht
1787cdf0e10cSrcweir //nicht ankommen.
1788cdf0e10cSrcweir //Ergo: Alles selbst machen (siehe ImplEndAction())
1789cdf0e10cSrcweir if ( Imp()->GetRegion() && Imp()->GetRegion()->GetOrigin() != VisArea())
1790cdf0e10cSrcweir Imp()->DelRegion();
1791cdf0e10cSrcweir
1792cdf0e10cSrcweir SwLayAction aAction( GetLayout(), Imp() );
1793cdf0e10cSrcweir aAction.SetComplete( sal_False );
1794cdf0e10cSrcweir // We increment the action counter to avoid a recursive call of actions
1795cdf0e10cSrcweir // e.g. from a SwFEShell::RequestObjectResize(..) in bug 95829.
1796cdf0e10cSrcweir // A recursive call of actions is no good idea because the inner action
1797cdf0e10cSrcweir // can't format frames which are locked by the outer action. This may
1798cdf0e10cSrcweir // cause and endless loop.
1799cdf0e10cSrcweir ++nStartAction;
1800cdf0e10cSrcweir aAction.Action();
1801cdf0e10cSrcweir --nStartAction;
1802cdf0e10cSrcweir
1803cdf0e10cSrcweir SwRegionRects *pRegion = Imp()->GetRegion();
1804cdf0e10cSrcweir if ( pRegion && aAction.IsBrowseActionStop() )
1805cdf0e10cSrcweir {
1806cdf0e10cSrcweir //Nur dann interessant, wenn sich im sichtbaren Bereich etwas
1807cdf0e10cSrcweir //veraendert hat.
1808cdf0e10cSrcweir sal_Bool bStop = sal_True;
1809cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < pRegion->Count(); ++i )
1810cdf0e10cSrcweir {
1811cdf0e10cSrcweir const SwRect &rTmp = (*pRegion)[i];
1812cdf0e10cSrcweir if ( sal_False == (bStop = rTmp.IsOver( VisArea() )) )
1813cdf0e10cSrcweir break;
1814cdf0e10cSrcweir }
1815cdf0e10cSrcweir if ( bStop )
1816cdf0e10cSrcweir {
1817cdf0e10cSrcweir Imp()->DelRegion();
1818cdf0e10cSrcweir pRegion = 0;
1819cdf0e10cSrcweir }
1820cdf0e10cSrcweir }
1821cdf0e10cSrcweir
1822cdf0e10cSrcweir if ( pRegion )
1823cdf0e10cSrcweir {
1824cdf0e10cSrcweir //Erst Invert dann Compress, niemals andersherum!
1825cdf0e10cSrcweir pRegion->Invert();
1826cdf0e10cSrcweir pRegion->Compress();
1827cdf0e10cSrcweir bRet = sal_False;
1828cdf0e10cSrcweir if ( pRegion->Count() )
1829cdf0e10cSrcweir {
1830cdf0e10cSrcweir SwRegionRects aRegion( rRect );
1831cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < pRegion->Count(); ++i )
1832cdf0e10cSrcweir { const SwRect &rTmp = (*pRegion)[i];
1833cdf0e10cSrcweir if ( !rRect.IsInside( rTmp ) )
1834cdf0e10cSrcweir {
1835cdf0e10cSrcweir InvalidateWindows( rTmp );
1836cdf0e10cSrcweir if ( rTmp.IsOver( VisArea() ) )
1837cdf0e10cSrcweir { aRegion -= rTmp;
1838cdf0e10cSrcweir bRet = sal_True;
1839cdf0e10cSrcweir }
1840cdf0e10cSrcweir }
1841cdf0e10cSrcweir }
1842cdf0e10cSrcweir if ( bRet )
1843cdf0e10cSrcweir {
1844cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
1845cdf0e10cSrcweir GetWin()->Invalidate( aRegion[i].SVRect() );
1846cdf0e10cSrcweir
1847cdf0e10cSrcweir if ( rRect != VisArea() )
1848cdf0e10cSrcweir {
1849cdf0e10cSrcweir //rRect == VisArea ist der spezialfall fuer neu bzw.
1850cdf0e10cSrcweir //Shift-Ctrl-R, dafuer sollte es nicht notwendig sein
1851cdf0e10cSrcweir //das Rechteck nocheinmal in Dokumentkoordinaten v
1852cdf0e10cSrcweir //vorzuhalten.
1853cdf0e10cSrcweir if ( aInvalidRect.IsEmpty() )
1854cdf0e10cSrcweir aInvalidRect = rRect;
1855cdf0e10cSrcweir else
1856cdf0e10cSrcweir aInvalidRect.Union( rRect );
1857cdf0e10cSrcweir }
1858cdf0e10cSrcweir }
1859cdf0e10cSrcweir }
1860cdf0e10cSrcweir else
1861cdf0e10cSrcweir bRet = sal_False;
1862cdf0e10cSrcweir Imp()->DelRegion();
1863cdf0e10cSrcweir }
1864cdf0e10cSrcweir else
1865cdf0e10cSrcweir bRet = sal_False;
1866cdf0e10cSrcweir }
1867cdf0e10cSrcweir return bRet;
1868cdf0e10cSrcweir }
1869cdf0e10cSrcweir
1870cdf0e10cSrcweir /******************************************************************************
1871cdf0e10cSrcweir |*
1872cdf0e10cSrcweir |* ViewShell::Paint()
1873cdf0e10cSrcweir |*
1874cdf0e10cSrcweir |* Ersterstellung MA ??
1875cdf0e10cSrcweir |* Letzte Aenderung MA 17. Sep. 96
1876cdf0e10cSrcweir |*
1877cdf0e10cSrcweir ******************************************************************************/
1878cdf0e10cSrcweir
Paint(const Rectangle & rRect)1879cdf0e10cSrcweir void ViewShell::Paint(const Rectangle &rRect)
1880cdf0e10cSrcweir {
1881cdf0e10cSrcweir if ( nLockPaint )
1882cdf0e10cSrcweir {
1883cdf0e10cSrcweir if ( Imp()->bSmoothUpdate )
1884cdf0e10cSrcweir {
1885cdf0e10cSrcweir SwRect aTmp( rRect );
1886cdf0e10cSrcweir if ( !Imp()->aSmoothRect.IsInside( aTmp ) )
1887cdf0e10cSrcweir Imp()->bStopSmooth = sal_True;
1888cdf0e10cSrcweir else
1889cdf0e10cSrcweir {
1890cdf0e10cSrcweir Imp()->aSmoothRect = aTmp;
1891cdf0e10cSrcweir return;
1892cdf0e10cSrcweir }
1893cdf0e10cSrcweir }
1894cdf0e10cSrcweir else
1895cdf0e10cSrcweir return;
1896cdf0e10cSrcweir }
1897cdf0e10cSrcweir
1898cdf0e10cSrcweir if ( SwRootFrm::IsInPaint() )
1899cdf0e10cSrcweir {
1900cdf0e10cSrcweir //Waehrend der Ausgabe einer Seite beim Druckvorgang wird das
1901cdf0e10cSrcweir //Paint gepuffert.
1902cdf0e10cSrcweir SwPaintQueue::Add( this, SwRect( rRect ) );
1903cdf0e10cSrcweir return;
1904cdf0e10cSrcweir }
1905cdf0e10cSrcweir
1906cdf0e10cSrcweir //MA 30. Jul. 95: fix(16787): mit !nStartAction versuche ich mal mich gegen
1907cdf0e10cSrcweir //fehlerhaften Code an anderen Stellen zu wehren. Hoffentlich fuehrt das
1908cdf0e10cSrcweir //nicht zu Problemen!?
1909cdf0e10cSrcweir if ( bPaintWorks && !nStartAction )
1910cdf0e10cSrcweir {
1911cdf0e10cSrcweir if( GetWin() && GetWin()->IsVisible() )
1912cdf0e10cSrcweir {
1913cdf0e10cSrcweir SwRect aRect( rRect );
1914cdf0e10cSrcweir if ( bPaintInProgress ) //Schutz gegen doppelte Paints!
1915cdf0e10cSrcweir {
1916cdf0e10cSrcweir GetWin()->Invalidate( rRect );
1917cdf0e10cSrcweir return;
1918cdf0e10cSrcweir }
1919cdf0e10cSrcweir
1920cdf0e10cSrcweir bPaintInProgress = sal_True;
1921cdf0e10cSrcweir SET_CURR_SHELL( this );
1922cdf0e10cSrcweir SwRootFrm::SetNoVirDev( sal_True );
1923cdf0e10cSrcweir
1924cdf0e10cSrcweir //Wir wollen nicht staendig hin und her Clippen, wir verlassen
1925cdf0e10cSrcweir //uns darauf, das sich alle auf das Rechteck beschraeken und
1926cdf0e10cSrcweir //brauchen das Clipping hier nur einmalig einkalkulieren. Das
1927cdf0e10cSrcweir //ClipRect wird hier einmal entfernt und nicht Restauriert, denn
1928cdf0e10cSrcweir //von aussen braucht es sowieso keiner mehr.
1929cdf0e10cSrcweir //Nicht wenn wir ein MetaFile aufzeichnen.
1930cdf0e10cSrcweir if( !GetOut()->GetConnectMetaFile() && GetOut()->IsClipRegion())
1931cdf0e10cSrcweir GetOut()->SetClipRegion();
1932cdf0e10cSrcweir
1933cdf0e10cSrcweir if ( IsPreView() )
1934cdf0e10cSrcweir {
1935cdf0e10cSrcweir //Falls sinnvoll gleich das alte InvalidRect verarbeiten bzw.
1936cdf0e10cSrcweir //vernichten.
1937cdf0e10cSrcweir if ( aRect.IsInside( aInvalidRect ) )
1938cdf0e10cSrcweir ResetInvalidRect();
1939cdf0e10cSrcweir ViewShell::bLstAct = sal_True;
1940cdf0e10cSrcweir GetLayout()->Paint( aRect );
1941cdf0e10cSrcweir ViewShell::bLstAct = sal_False;
1942cdf0e10cSrcweir }
1943cdf0e10cSrcweir else
1944cdf0e10cSrcweir {
1945cdf0e10cSrcweir //SwSaveHdl *pSaveHdl = 0;
1946cdf0e10cSrcweir //if ( Imp()->HasDrawView() )
1947cdf0e10cSrcweir // pSaveHdl = new SwSaveHdl( Imp() );
1948cdf0e10cSrcweir
1949cdf0e10cSrcweir //Wenn eine der sichtbaren Seiten noch irgendetwas zum Repaint
1950cdf0e10cSrcweir //angemeldet hat, so muessen Repaints ausgeloest werden.
1951cdf0e10cSrcweir if ( !CheckInvalidForPaint( aRect ) )
1952cdf0e10cSrcweir {
1953cdf0e10cSrcweir // --> OD 2009-08-12 #i101192#
1954cdf0e10cSrcweir // start Pre/PostPaint encapsulation to avoid screen blinking
1955cdf0e10cSrcweir const Region aRepaintRegion(aRect.SVRect());
1956cdf0e10cSrcweir DLPrePaint2(aRepaintRegion);
1957cdf0e10cSrcweir // <--
1958cdf0e10cSrcweir PaintDesktop( aRect );
1959cdf0e10cSrcweir //Falls sinnvoll gleich das alte InvalidRect verarbeiten bzw.
1960cdf0e10cSrcweir //vernichten.
1961cdf0e10cSrcweir if ( aRect.IsInside( aInvalidRect ) )
1962cdf0e10cSrcweir ResetInvalidRect();
1963cdf0e10cSrcweir ViewShell::bLstAct = sal_True;
1964cdf0e10cSrcweir GetLayout()->Paint( aRect );
1965cdf0e10cSrcweir ViewShell::bLstAct = sal_False;
1966cdf0e10cSrcweir // --> OD 2009-08-12 #i101192#
1967cdf0e10cSrcweir // end Pre/PostPaint encapsulation
1968cdf0e10cSrcweir DLPostPaint2(true);
1969cdf0e10cSrcweir // <--
1970cdf0e10cSrcweir }
1971cdf0e10cSrcweir
1972cdf0e10cSrcweir //delete pSaveHdl;
1973cdf0e10cSrcweir }
1974cdf0e10cSrcweir SwRootFrm::SetNoVirDev( sal_False );
1975cdf0e10cSrcweir bPaintInProgress = sal_False;
1976cdf0e10cSrcweir UISizeNotify();
1977cdf0e10cSrcweir }
1978cdf0e10cSrcweir }
1979cdf0e10cSrcweir else
1980cdf0e10cSrcweir {
1981cdf0e10cSrcweir if ( aInvalidRect.IsEmpty() )
1982cdf0e10cSrcweir aInvalidRect = SwRect( rRect );
1983cdf0e10cSrcweir else
1984cdf0e10cSrcweir aInvalidRect.Union( SwRect( rRect ) );
1985cdf0e10cSrcweir
1986cdf0e10cSrcweir if ( bInEndAction && GetWin() )
1987cdf0e10cSrcweir {
1988e6f63103SArmin Le Grand const Region aRegion(GetWin()->GetPaintRegion());
1989e6f63103SArmin Le Grand RectangleVector aRectangles;
1990e6f63103SArmin Le Grand aRegion.GetRegionRectangles(aRectangles);
1991e6f63103SArmin Le Grand
1992e6f63103SArmin Le Grand for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++)
1993e6f63103SArmin Le Grand {
1994e6f63103SArmin Le Grand Imp()->AddPaintRect(*aRectIter);
1995e6f63103SArmin Le Grand }
1996e6f63103SArmin Le Grand
1997e6f63103SArmin Le Grand //RegionHandle hHdl( aRegion.BeginEnumRects() );
1998e6f63103SArmin Le Grand //Rectangle aRect;
1999e6f63103SArmin Le Grand //while ( aRegion.GetEnumRects( hHdl, aRect ) )
2000e6f63103SArmin Le Grand // Imp()->AddPaintRect( aRect );
2001e6f63103SArmin Le Grand //aRegion.EndEnumRects( hHdl );
2002cdf0e10cSrcweir }
2003cdf0e10cSrcweir else if ( SfxProgress::GetActiveProgress( GetDoc()->GetDocShell() ) &&
2004cdf0e10cSrcweir GetOut() == GetWin() )
2005cdf0e10cSrcweir {
2006cdf0e10cSrcweir // #i68597#
2007cdf0e10cSrcweir const Region aDLRegion(rRect);
2008cdf0e10cSrcweir DLPrePaint2(aDLRegion);
2009cdf0e10cSrcweir
2010cdf0e10cSrcweir // OD 2004-04-23 #116347#
2011cdf0e10cSrcweir pOut->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
2012cdf0e10cSrcweir pOut->SetFillColor( Imp()->GetRetoucheColor() );
2013cdf0e10cSrcweir pOut->SetLineColor();
2014cdf0e10cSrcweir pOut->DrawRect( rRect );
2015cdf0e10cSrcweir pOut->Pop();
2016cdf0e10cSrcweir
2017cdf0e10cSrcweir // #i68597#
2018cdf0e10cSrcweir DLPostPaint2(true);
2019cdf0e10cSrcweir }
2020cdf0e10cSrcweir }
2021cdf0e10cSrcweir }
2022cdf0e10cSrcweir
2023cdf0e10cSrcweir /******************************************************************************
2024cdf0e10cSrcweir |*
2025cdf0e10cSrcweir |* ViewShell::SetBrowseBorder()
2026cdf0e10cSrcweir |*
2027cdf0e10cSrcweir |* Ersterstellung AMA 20. Aug. 96
2028cdf0e10cSrcweir |* Letzte Aenderung AMA 20. Aug. 96
2029cdf0e10cSrcweir |*
2030cdf0e10cSrcweir ******************************************************************************/
2031cdf0e10cSrcweir
SetBrowseBorder(const Size & rNew)2032cdf0e10cSrcweir void ViewShell::SetBrowseBorder( const Size& rNew )
2033cdf0e10cSrcweir {
2034cdf0e10cSrcweir if( rNew != aBrowseBorder )
2035cdf0e10cSrcweir {
2036cdf0e10cSrcweir aBrowseBorder = rNew;
2037cdf0e10cSrcweir if ( aVisArea.HasArea() )
2038cdf0e10cSrcweir CheckBrowseView( sal_False );
2039cdf0e10cSrcweir }
2040cdf0e10cSrcweir }
2041cdf0e10cSrcweir
GetBrowseBorder() const2042cdf0e10cSrcweir const Size& ViewShell::GetBrowseBorder() const
2043cdf0e10cSrcweir {
2044cdf0e10cSrcweir return aBrowseBorder;
2045cdf0e10cSrcweir }
2046cdf0e10cSrcweir
GetBrowseWidth() const2047cdf0e10cSrcweir sal_Int32 ViewShell::GetBrowseWidth() const
2048cdf0e10cSrcweir {
2049cdf0e10cSrcweir const SwPostItMgr* pPostItMgr = GetPostItMgr();
2050cdf0e10cSrcweir if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
2051cdf0e10cSrcweir {
2052cdf0e10cSrcweir Size aBorder( aBrowseBorder );
2053cdf0e10cSrcweir aBorder.Width() += aBrowseBorder.Width();
2054cdf0e10cSrcweir aBorder.Width() += pPostItMgr->GetSidebarWidth(true) + pPostItMgr->GetSidebarBorderWidth(true);
2055cdf0e10cSrcweir return aVisArea.Width() - GetOut()->PixelToLogic(aBorder).Width();
2056cdf0e10cSrcweir }
2057cdf0e10cSrcweir else
2058cdf0e10cSrcweir return aVisArea.Width() - 2 * GetOut()->PixelToLogic(aBrowseBorder).Width();
2059cdf0e10cSrcweir }
2060cdf0e10cSrcweir
2061cdf0e10cSrcweir /******************************************************************************
2062cdf0e10cSrcweir |*
2063cdf0e10cSrcweir |* ViewShell::CheckBrowseView()
2064cdf0e10cSrcweir |*
2065cdf0e10cSrcweir |* Ersterstellung MA 04. Mar. 96
2066cdf0e10cSrcweir |* Letzte Aenderung MA 04. Jul. 96
2067cdf0e10cSrcweir |*
2068cdf0e10cSrcweir ******************************************************************************/
2069cdf0e10cSrcweir
CheckBrowseView(sal_Bool bBrowseChgd)2070cdf0e10cSrcweir void ViewShell::CheckBrowseView( sal_Bool bBrowseChgd )
2071cdf0e10cSrcweir {
2072cdf0e10cSrcweir if ( !bBrowseChgd && !GetViewOptions()->getBrowseMode() )
2073cdf0e10cSrcweir return;
2074cdf0e10cSrcweir
2075cdf0e10cSrcweir SET_CURR_SHELL( this );
2076cdf0e10cSrcweir
2077cdf0e10cSrcweir ASSERT( GetLayout(), "Layout not ready" );
2078cdf0e10cSrcweir
2079cdf0e10cSrcweir // Wenn das Layout noch nicht einmal eine Hoehe hat,
2080cdf0e10cSrcweir // ist sowieso nichts formatiert.
2081cdf0e10cSrcweir // Dann eruebrigt sich die Invalidierung
2082cdf0e10cSrcweir // Falsch, z.B. beim Anlegen einer neuen View wird der Inhalt eingef?gt
2083cdf0e10cSrcweir // und formatiert (trotz einer leeren VisArea). Hier muessen deshalb
2084cdf0e10cSrcweir // die Seiten zur Formatierung angeregt werden.
2085cdf0e10cSrcweir if( !GetLayout()->Frm().Height() )
2086cdf0e10cSrcweir {
2087cdf0e10cSrcweir SwFrm* pPage = GetLayout()->Lower();
2088cdf0e10cSrcweir while( pPage )
2089cdf0e10cSrcweir {
2090cdf0e10cSrcweir pPage->_InvalidateSize();
2091cdf0e10cSrcweir pPage = pPage->GetNext();
2092cdf0e10cSrcweir }
2093cdf0e10cSrcweir return;
2094cdf0e10cSrcweir }
2095cdf0e10cSrcweir
2096cdf0e10cSrcweir LockPaint();
2097cdf0e10cSrcweir StartAction();
2098cdf0e10cSrcweir
2099cdf0e10cSrcweir SwPageFrm *pPg = (SwPageFrm*)GetLayout()->Lower();
2100cdf0e10cSrcweir do
2101cdf0e10cSrcweir { pPg->InvalidateSize();
2102cdf0e10cSrcweir pPg->_InvalidatePrt();
2103cdf0e10cSrcweir pPg->InvaPercentLowers();
2104cdf0e10cSrcweir if ( bBrowseChgd )
2105cdf0e10cSrcweir {
2106cdf0e10cSrcweir pPg->PrepareHeader();
2107cdf0e10cSrcweir pPg->PrepareFooter();
2108cdf0e10cSrcweir }
2109cdf0e10cSrcweir pPg = (SwPageFrm*)pPg->GetNext();
2110cdf0e10cSrcweir } while ( pPg );
2111cdf0e10cSrcweir
2112cdf0e10cSrcweir // Wenn sich die Groessenverhaeltnise im BrowseModus aendern,
2113cdf0e10cSrcweir // muss die Position und PrtArea der Cntnt- und Tab-Frames invalidiert werden.
2114cdf0e10cSrcweir sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_POS;
2115cdf0e10cSrcweir // Beim BrowseModus-Wechsel benoetigen die CntntFrms
2116cdf0e10cSrcweir // wg. der Drucker/Bildschirmformatierung eine Size-Invalidierung
2117cdf0e10cSrcweir if( bBrowseChgd )
2118cdf0e10cSrcweir nInv |= INV_SIZE | INV_DIRECTION;
2119cdf0e10cSrcweir
2120cdf0e10cSrcweir GetLayout()->InvalidateAllCntnt( nInv );
2121cdf0e10cSrcweir
2122cdf0e10cSrcweir SwFrm::CheckPageDescs( (SwPageFrm*)GetLayout()->Lower() );
2123cdf0e10cSrcweir
2124cdf0e10cSrcweir EndAction();
2125cdf0e10cSrcweir UnlockPaint();
2126cdf0e10cSrcweir }
2127cdf0e10cSrcweir
2128cdf0e10cSrcweir /*************************************************************************
2129cdf0e10cSrcweir |*
2130cdf0e10cSrcweir |* ViewShell::GetLayout()
2131cdf0e10cSrcweir |* ViewShell::GetNodes()
2132cdf0e10cSrcweir |*
2133cdf0e10cSrcweir |* Ersterstellung OK 26. May. 92
2134cdf0e10cSrcweir |* Letzte Aenderung MA 16. Sep. 93
2135cdf0e10cSrcweir |*
2136cdf0e10cSrcweir *************************************************************************/
2137cdf0e10cSrcweir
GetLayout() const2138cdf0e10cSrcweir SwRootFrm *ViewShell::GetLayout() const
2139cdf0e10cSrcweir {
2140cdf0e10cSrcweir return pLayout.get(); //swmod 080116
2141cdf0e10cSrcweir }
2142cdf0e10cSrcweir /***********************************************************************/
2143cdf0e10cSrcweir
GetRefDev() const2144cdf0e10cSrcweir OutputDevice& ViewShell::GetRefDev() const
2145cdf0e10cSrcweir {
2146cdf0e10cSrcweir OutputDevice* pTmpOut = 0;
2147cdf0e10cSrcweir if ( GetWin() &&
2148cdf0e10cSrcweir GetViewOptions()->getBrowseMode() &&
2149cdf0e10cSrcweir !GetViewOptions()->IsPrtFormat() )
2150cdf0e10cSrcweir pTmpOut = GetWin();
2151cdf0e10cSrcweir else if ( 0 != mpTmpRef )
2152cdf0e10cSrcweir pTmpOut = mpTmpRef;
2153cdf0e10cSrcweir else
2154cdf0e10cSrcweir pTmpOut = GetDoc()->getReferenceDevice( true );
2155cdf0e10cSrcweir
2156cdf0e10cSrcweir return *pTmpOut;
2157cdf0e10cSrcweir }
2158cdf0e10cSrcweir
GetNodes() const2159cdf0e10cSrcweir const SwNodes& ViewShell::GetNodes() const
2160cdf0e10cSrcweir {
2161cdf0e10cSrcweir return pDoc->GetNodes();
2162cdf0e10cSrcweir }
2163cdf0e10cSrcweir
2164cdf0e10cSrcweir
DrawSelChanged()2165cdf0e10cSrcweir void ViewShell::DrawSelChanged()
2166cdf0e10cSrcweir {
2167cdf0e10cSrcweir }
2168cdf0e10cSrcweir
2169cdf0e10cSrcweir
GetDocSize() const2170cdf0e10cSrcweir Size ViewShell::GetDocSize() const
2171cdf0e10cSrcweir {
2172cdf0e10cSrcweir Size aSz;
2173cdf0e10cSrcweir const SwRootFrm* pRoot = GetLayout();
2174cdf0e10cSrcweir if( pRoot )
2175cdf0e10cSrcweir aSz = pRoot->Frm().SSize();
2176cdf0e10cSrcweir
2177cdf0e10cSrcweir return aSz;
2178cdf0e10cSrcweir }
2179cdf0e10cSrcweir
2180cdf0e10cSrcweir
GetAttrPool()2181cdf0e10cSrcweir SfxItemPool& ViewShell::GetAttrPool()
2182cdf0e10cSrcweir {
2183cdf0e10cSrcweir return GetDoc()->GetAttrPool();
2184cdf0e10cSrcweir }
2185cdf0e10cSrcweir
2186cdf0e10cSrcweir /******************************************************************************
2187cdf0e10cSrcweir |*
2188cdf0e10cSrcweir |* ViewShell::ApplyViewOptions(), ImplApplyViewOptions()
2189cdf0e10cSrcweir |*
2190cdf0e10cSrcweir |* Ersterstellung ??
2191cdf0e10cSrcweir |* Letzte Aenderung MA 03. Mar. 98
2192cdf0e10cSrcweir |*
2193cdf0e10cSrcweir ******************************************************************************/
2194cdf0e10cSrcweir
ApplyViewOptions(const SwViewOption & rOpt)2195cdf0e10cSrcweir void ViewShell::ApplyViewOptions( const SwViewOption &rOpt )
2196cdf0e10cSrcweir {
2197cdf0e10cSrcweir
2198cdf0e10cSrcweir ViewShell *pSh = this;
2199cdf0e10cSrcweir do
2200cdf0e10cSrcweir { pSh->StartAction();
2201cdf0e10cSrcweir pSh = (ViewShell*)pSh->GetNext();
2202cdf0e10cSrcweir } while ( pSh != this );
2203cdf0e10cSrcweir
2204cdf0e10cSrcweir ImplApplyViewOptions( rOpt );
2205cdf0e10cSrcweir
2206cdf0e10cSrcweir // swmod 080115
2207cdf0e10cSrcweir // With one layout per view it is not longer necessary
2208cdf0e10cSrcweir // to sync these "layout related" view options
2209cdf0e10cSrcweir // But as long as we have to disable "multiple layout"
2210cdf0e10cSrcweir pSh = (ViewShell*)this->GetNext();
2211cdf0e10cSrcweir while ( pSh != this )
2212cdf0e10cSrcweir {
2213cdf0e10cSrcweir SwViewOption aOpt( *pSh->GetViewOptions() );
2214cdf0e10cSrcweir aOpt.SetFldName( rOpt.IsFldName() );
2215cdf0e10cSrcweir aOpt.SetShowHiddenField( rOpt.IsShowHiddenField() );
2216cdf0e10cSrcweir aOpt.SetShowHiddenPara( rOpt.IsShowHiddenPara() );
2217cdf0e10cSrcweir aOpt.SetShowHiddenChar( rOpt.IsShowHiddenChar() );
2218cdf0e10cSrcweir aOpt.SetViewLayoutBookMode( rOpt.IsViewLayoutBookMode() );
2219cdf0e10cSrcweir aOpt.SetViewLayoutColumns( rOpt.GetViewLayoutColumns() );
2220cdf0e10cSrcweir aOpt.SetPostIts(rOpt.IsPostIts());
2221cdf0e10cSrcweir if ( !(aOpt == *pSh->GetViewOptions()) )
2222cdf0e10cSrcweir pSh->ImplApplyViewOptions( aOpt );
2223cdf0e10cSrcweir pSh = (ViewShell*)pSh->GetNext();
2224cdf0e10cSrcweir }
2225cdf0e10cSrcweir // End of disabled multiple window
2226cdf0e10cSrcweir
2227cdf0e10cSrcweir pSh = this;
2228cdf0e10cSrcweir do
2229cdf0e10cSrcweir { pSh->EndAction();
2230cdf0e10cSrcweir pSh = (ViewShell*)pSh->GetNext();
2231cdf0e10cSrcweir } while ( pSh != this );
2232cdf0e10cSrcweir
2233cdf0e10cSrcweir }
2234cdf0e10cSrcweir
ImplApplyViewOptions(const SwViewOption & rOpt)2235cdf0e10cSrcweir void ViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
2236cdf0e10cSrcweir {
2237cdf0e10cSrcweir if (*pOpt == rOpt)
2238cdf0e10cSrcweir return;
2239cdf0e10cSrcweir
2240cdf0e10cSrcweir Window *pMyWin = GetWin();
2241cdf0e10cSrcweir if( !pMyWin )
2242cdf0e10cSrcweir {
2243cdf0e10cSrcweir ASSERT( pMyWin, "ViewShell::ApplyViewOptions: no window" );
2244cdf0e10cSrcweir return;
2245cdf0e10cSrcweir }
2246cdf0e10cSrcweir
2247cdf0e10cSrcweir SET_CURR_SHELL( this );
2248cdf0e10cSrcweir
2249cdf0e10cSrcweir sal_Bool bReformat = sal_False;
2250cdf0e10cSrcweir
2251cdf0e10cSrcweir if( pOpt->IsShowHiddenField() != rOpt.IsShowHiddenField() )
2252cdf0e10cSrcweir {
2253cdf0e10cSrcweir ((SwHiddenTxtFieldType*)pDoc->GetSysFldType( RES_HIDDENTXTFLD ))->
2254cdf0e10cSrcweir SetHiddenFlag( !rOpt.IsShowHiddenField() );
2255cdf0e10cSrcweir bReformat = sal_True;
2256cdf0e10cSrcweir }
2257cdf0e10cSrcweir if ( pOpt->IsShowHiddenPara() != rOpt.IsShowHiddenPara() )
2258cdf0e10cSrcweir {
2259cdf0e10cSrcweir SwHiddenParaFieldType* pFldType = (SwHiddenParaFieldType*)GetDoc()->
2260cdf0e10cSrcweir GetSysFldType(RES_HIDDENPARAFLD);
2261cdf0e10cSrcweir if( pFldType && pFldType->GetDepends() )
2262cdf0e10cSrcweir {
2263cdf0e10cSrcweir SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT );
2264cdf0e10cSrcweir pFldType->ModifyNotification( &aHnt, 0);
2265cdf0e10cSrcweir }
2266cdf0e10cSrcweir bReformat = sal_True;
2267cdf0e10cSrcweir }
2268cdf0e10cSrcweir if ( !bReformat && pOpt->IsShowHiddenChar() != rOpt.IsShowHiddenChar() )
2269cdf0e10cSrcweir {
2270cdf0e10cSrcweir bReformat = GetDoc()->ContainsHiddenChars();
2271cdf0e10cSrcweir }
2272cdf0e10cSrcweir
2273cdf0e10cSrcweir // bReformat wird sal_True, wenn ...
2274cdf0e10cSrcweir // - Feldnamen anzeigen oder nicht ...
2275cdf0e10cSrcweir // ( - SwEndPortion muessen _nicht_ mehr generiert werden. )
2276cdf0e10cSrcweir // - Das Window ist natuerlich was ganz anderes als der Drucker...
2277cdf0e10cSrcweir bReformat = bReformat || pOpt->IsFldName() != rOpt.IsFldName();
2278cdf0e10cSrcweir
2279cdf0e10cSrcweir // Der Mapmode wird veraendert, Minima/Maxima werden von der UI beachtet
2280cdf0e10cSrcweir if( pOpt->GetZoom() != rOpt.GetZoom() && !IsPreView() )
2281cdf0e10cSrcweir {
2282cdf0e10cSrcweir MapMode aMode( pMyWin->GetMapMode() );
2283cdf0e10cSrcweir Fraction aNewFactor( rOpt.GetZoom(), 100 );
2284cdf0e10cSrcweir aMode.SetScaleX( aNewFactor );
2285cdf0e10cSrcweir aMode.SetScaleY( aNewFactor );
2286cdf0e10cSrcweir pMyWin->SetMapMode( aMode );
2287cdf0e10cSrcweir // Wenn kein ReferenzDevice (Drucker) zum Formatieren benutzt wird,
2288cdf0e10cSrcweir // sondern der Bildschirm, muss bei Zoomfaktoraenderung neu formatiert
2289cdf0e10cSrcweir // werden.
2290cdf0e10cSrcweir if( pOpt->getBrowseMode() )
2291cdf0e10cSrcweir bReformat = sal_True;
2292cdf0e10cSrcweir }
2293cdf0e10cSrcweir
2294cdf0e10cSrcweir bool bBrowseModeChanged = false;
2295cdf0e10cSrcweir if( pOpt->getBrowseMode() != rOpt.getBrowseMode() )
2296cdf0e10cSrcweir {
2297cdf0e10cSrcweir bBrowseModeChanged = true;
2298cdf0e10cSrcweir bReformat = sal_True;
2299cdf0e10cSrcweir }
2300cdf0e10cSrcweir else if( pOpt->getBrowseMode() && pOpt->IsPrtFormat() != rOpt.IsPrtFormat() )
2301cdf0e10cSrcweir bReformat = sal_True;
2302cdf0e10cSrcweir
2303cdf0e10cSrcweir if ( HasDrawView() || rOpt.IsGridVisible() )
2304cdf0e10cSrcweir {
2305cdf0e10cSrcweir if ( !HasDrawView() )
2306cdf0e10cSrcweir MakeDrawView();
2307cdf0e10cSrcweir
2308cdf0e10cSrcweir SwDrawView *pDView = Imp()->GetDrawView();
2309cdf0e10cSrcweir if ( pDView->IsDragStripes() != rOpt.IsCrossHair() )
2310cdf0e10cSrcweir pDView->SetDragStripes( rOpt.IsCrossHair() );
2311cdf0e10cSrcweir
2312cdf0e10cSrcweir if ( pDView->IsGridSnap() != rOpt.IsSnap() )
2313cdf0e10cSrcweir pDView->SetGridSnap( rOpt.IsSnap() );
2314cdf0e10cSrcweir
2315cdf0e10cSrcweir if ( pDView->IsGridVisible() != rOpt.IsGridVisible() )
2316cdf0e10cSrcweir pDView->SetGridVisible( rOpt.IsGridVisible() );
2317cdf0e10cSrcweir
2318cdf0e10cSrcweir const Size &rSz = rOpt.GetSnapSize();
2319cdf0e10cSrcweir pDView->SetGridCoarse( rSz );
2320cdf0e10cSrcweir
2321cdf0e10cSrcweir const Size aFSize
2322cdf0e10cSrcweir ( rSz.Width() ? rSz.Width() / (rOpt.GetDivisionX()+1) : 0,
2323cdf0e10cSrcweir rSz.Height()? rSz.Height()/ (rOpt.GetDivisionY()+1) : 0);
2324cdf0e10cSrcweir pDView->SetGridFine( aFSize );
2325cdf0e10cSrcweir Fraction aSnGrWdtX(rSz.Width(), rOpt.GetDivisionX() + 1);
2326cdf0e10cSrcweir Fraction aSnGrWdtY(rSz.Height(), rOpt.GetDivisionY() + 1);
2327cdf0e10cSrcweir pDView->SetSnapGridWidth( aSnGrWdtX, aSnGrWdtY );
2328cdf0e10cSrcweir
2329cdf0e10cSrcweir if ( pOpt->IsSolidMarkHdl() != rOpt.IsSolidMarkHdl() )
2330cdf0e10cSrcweir pDView->SetSolidMarkHdl( rOpt.IsSolidMarkHdl() );
2331cdf0e10cSrcweir
2332cdf0e10cSrcweir // it's a JOE interface !
2333cdf0e10cSrcweir if ( pOpt->IsBigMarkHdl() != rOpt.IsBigMarkHdl() )
2334cdf0e10cSrcweir pDView->SetMarkHdlSizePixel(rOpt.IsBigMarkHdl() ? 9 : 7);
2335cdf0e10cSrcweir }
2336cdf0e10cSrcweir
2337cdf0e10cSrcweir sal_Bool bOnlineSpellChgd = pOpt->IsOnlineSpell() != rOpt.IsOnlineSpell();
2338cdf0e10cSrcweir
2339cdf0e10cSrcweir *pOpt = rOpt; // Erst jetzt werden die Options uebernommen.
2340cdf0e10cSrcweir pOpt->SetUIOptions(rOpt);
2341cdf0e10cSrcweir
2342cdf0e10cSrcweir pDoc->set(IDocumentSettingAccess::HTML_MODE, 0 != ::GetHtmlMode(pDoc->GetDocShell()));
2343cdf0e10cSrcweir
2344cdf0e10cSrcweir if( bBrowseModeChanged )
2345cdf0e10cSrcweir {
2346cdf0e10cSrcweir // --> FME 2005-03-16 #i44963# Good occasion to check if page sizes in
2347cdf0e10cSrcweir // page descriptions are still set to (LONG_MAX, LONG_MAX) (html import)
2348cdf0e10cSrcweir pDoc->CheckDefaultPageFmt();
2349cdf0e10cSrcweir // <--
2350cdf0e10cSrcweir CheckBrowseView( sal_True );
2351cdf0e10cSrcweir }
2352cdf0e10cSrcweir
2353cdf0e10cSrcweir pMyWin->Invalidate();
2354cdf0e10cSrcweir if ( bReformat )
2355cdf0e10cSrcweir {
2356cdf0e10cSrcweir // Es hilft alles nichts, wir muessen an alle CntntFrms ein
2357cdf0e10cSrcweir // Prepare verschicken, wir formatieren neu:
2358cdf0e10cSrcweir StartAction();
2359cdf0e10cSrcweir Reformat();
2360cdf0e10cSrcweir EndAction();
2361cdf0e10cSrcweir }
2362cdf0e10cSrcweir
2363cdf0e10cSrcweir if( bOnlineSpellChgd )
2364cdf0e10cSrcweir {
2365cdf0e10cSrcweir ViewShell *pSh = (ViewShell*)this->GetNext();
2366cdf0e10cSrcweir sal_Bool bOnlineSpl = rOpt.IsOnlineSpell();
2367cdf0e10cSrcweir while( pSh != this )
2368cdf0e10cSrcweir { pSh->pOpt->SetOnlineSpell( bOnlineSpl );
2369cdf0e10cSrcweir Window *pTmpWin = pSh->GetWin();
2370cdf0e10cSrcweir if( pTmpWin )
2371cdf0e10cSrcweir pTmpWin->Invalidate();
2372cdf0e10cSrcweir pSh = (ViewShell*)pSh->GetNext();
2373cdf0e10cSrcweir }
2374cdf0e10cSrcweir }
2375cdf0e10cSrcweir
2376cdf0e10cSrcweir }
2377cdf0e10cSrcweir
2378cdf0e10cSrcweir /******************************************************************************
2379cdf0e10cSrcweir |*
2380cdf0e10cSrcweir |* ViewShell::SetUIOptions()
2381cdf0e10cSrcweir |*
2382cdf0e10cSrcweir |* Ersterstellung OS 29.07.96
2383cdf0e10cSrcweir |* Letzte Aenderung OS 29.07.96
2384cdf0e10cSrcweir |*
2385cdf0e10cSrcweir ******************************************************************************/
2386cdf0e10cSrcweir
SetUIOptions(const SwViewOption & rOpt)2387cdf0e10cSrcweir void ViewShell::SetUIOptions( const SwViewOption &rOpt )
2388cdf0e10cSrcweir {
2389cdf0e10cSrcweir pOpt->SetUIOptions(rOpt);
2390cdf0e10cSrcweir //the API-Flag of the view options is set but never reset
2391cdf0e10cSrcweir //it is required to set scroll bars in readonly documents
2392cdf0e10cSrcweir if(rOpt.IsStarOneSetting())
2393cdf0e10cSrcweir pOpt->SetStarOneSetting(sal_True);
2394cdf0e10cSrcweir
2395cdf0e10cSrcweir pOpt->SetSymbolFont(rOpt.GetSymbolFont());
2396cdf0e10cSrcweir }
2397cdf0e10cSrcweir
2398cdf0e10cSrcweir /******************************************************************************
2399cdf0e10cSrcweir |*
2400cdf0e10cSrcweir |* ViewShell::SetReadonly()
2401cdf0e10cSrcweir |*
2402cdf0e10cSrcweir |* Ersterstellung OS 05.09.96
2403cdf0e10cSrcweir |* Letzte Aenderung MA 12. Feb. 97
2404cdf0e10cSrcweir |*
2405cdf0e10cSrcweir ******************************************************************************/
2406cdf0e10cSrcweir
SetReadonlyOption(sal_Bool bSet)2407cdf0e10cSrcweir void ViewShell::SetReadonlyOption(sal_Bool bSet)
2408cdf0e10cSrcweir {
2409cdf0e10cSrcweir //JP 01.02.99: bei ReadOnly Flag richtig abfragen und ggfs. neu
2410cdf0e10cSrcweir // formatieren; Bug 61335
2411cdf0e10cSrcweir
2412cdf0e10cSrcweir // Schalten wir gerade von Readonly auf Bearbeiten um?
2413cdf0e10cSrcweir if( bSet != pOpt->IsReadonly() )
2414cdf0e10cSrcweir {
2415cdf0e10cSrcweir // damit die Flags richtig erfragt werden koennen.
2416cdf0e10cSrcweir pOpt->SetReadonly( sal_False );
2417cdf0e10cSrcweir
2418cdf0e10cSrcweir sal_Bool bReformat = pOpt->IsFldName();
2419cdf0e10cSrcweir
2420cdf0e10cSrcweir pOpt->SetReadonly( bSet );
2421cdf0e10cSrcweir
2422cdf0e10cSrcweir if( bReformat )
2423cdf0e10cSrcweir {
2424cdf0e10cSrcweir StartAction();
2425cdf0e10cSrcweir Reformat();
2426cdf0e10cSrcweir if ( GetWin() )
2427cdf0e10cSrcweir GetWin()->Invalidate();
2428cdf0e10cSrcweir EndAction();
2429cdf0e10cSrcweir }
2430cdf0e10cSrcweir else if ( GetWin() )
2431cdf0e10cSrcweir GetWin()->Invalidate();
2432cdf0e10cSrcweir if( Imp()->IsAccessible() )
2433cdf0e10cSrcweir Imp()->InvalidateAccessibleEditableState( sal_False );
2434cdf0e10cSrcweir }
2435cdf0e10cSrcweir }
2436cdf0e10cSrcweir /* -----------------28.08.2003 15:45-----------------
2437cdf0e10cSrcweir
2438cdf0e10cSrcweir --------------------------------------------------*/
SetPDFExportOption(sal_Bool bSet)2439cdf0e10cSrcweir void ViewShell::SetPDFExportOption(sal_Bool bSet)
2440cdf0e10cSrcweir {
2441cdf0e10cSrcweir if( bSet != pOpt->IsPDFExport() )
2442cdf0e10cSrcweir {
2443cdf0e10cSrcweir if( bSet && pOpt->getBrowseMode() )
2444cdf0e10cSrcweir pOpt->SetPrtFormat( sal_True );
2445cdf0e10cSrcweir pOpt->SetPDFExport(bSet);
2446cdf0e10cSrcweir }
2447cdf0e10cSrcweir }
2448cdf0e10cSrcweir /* -----------------------------2002/07/31 17:06------------------------------
2449cdf0e10cSrcweir
2450cdf0e10cSrcweir ---------------------------------------------------------------------------*/
SetReadonlySelectionOption(sal_Bool bSet)2451cdf0e10cSrcweir void ViewShell::SetReadonlySelectionOption(sal_Bool bSet)
2452cdf0e10cSrcweir {
2453cdf0e10cSrcweir if( bSet != pOpt->IsSelectionInReadonly() )
2454cdf0e10cSrcweir {
2455cdf0e10cSrcweir pOpt->SetSelectionInReadonly(bSet);
2456cdf0e10cSrcweir }
2457cdf0e10cSrcweir }
2458cdf0e10cSrcweir /******************************************************************************
2459cdf0e10cSrcweir |*
2460cdf0e10cSrcweir |* ViewShell::SetPrtFormatOption()
2461cdf0e10cSrcweir |*
2462cdf0e10cSrcweir |* Ersterstellung AMA 10. Sep. 97
2463cdf0e10cSrcweir |* Letzte Aenderung AMA 10. Sep. 97
2464cdf0e10cSrcweir |*
2465cdf0e10cSrcweir ******************************************************************************/
2466cdf0e10cSrcweir
SetPrtFormatOption(sal_Bool bSet)2467cdf0e10cSrcweir void ViewShell::SetPrtFormatOption( sal_Bool bSet )
2468cdf0e10cSrcweir {
2469cdf0e10cSrcweir pOpt->SetPrtFormat( bSet );
2470cdf0e10cSrcweir }
2471cdf0e10cSrcweir
2472cdf0e10cSrcweir /******************************************************************************
2473cdf0e10cSrcweir |*
2474cdf0e10cSrcweir |* ViewShell::UISizeNotify()
2475cdf0e10cSrcweir |*
2476cdf0e10cSrcweir |* Ersterstellung MA 14. Jan. 97
2477cdf0e10cSrcweir |* Letzte Aenderung MA 14. Jan. 97
2478cdf0e10cSrcweir |*
2479cdf0e10cSrcweir ******************************************************************************/
2480cdf0e10cSrcweir
2481cdf0e10cSrcweir
UISizeNotify()2482cdf0e10cSrcweir void ViewShell::UISizeNotify()
2483cdf0e10cSrcweir {
2484cdf0e10cSrcweir if ( bDocSizeChgd )
2485cdf0e10cSrcweir {
2486cdf0e10cSrcweir bDocSizeChgd = sal_False;
2487cdf0e10cSrcweir sal_Bool bOld = bInSizeNotify;
2488cdf0e10cSrcweir bInSizeNotify = sal_True;
2489cdf0e10cSrcweir ::SizeNotify( this, GetDocSize() );
2490cdf0e10cSrcweir bInSizeNotify = bOld;
2491cdf0e10cSrcweir }
2492cdf0e10cSrcweir }
2493cdf0e10cSrcweir
2494cdf0e10cSrcweir
SetRestoreActions(sal_uInt16 nSet)2495cdf0e10cSrcweir void ViewShell::SetRestoreActions(sal_uInt16 nSet)
2496cdf0e10cSrcweir {
2497cdf0e10cSrcweir DBG_ASSERT(!GetRestoreActions()||!nSet, "mehrfaches Restore der Actions ?");
2498cdf0e10cSrcweir Imp()->SetRestoreActions(nSet);
2499cdf0e10cSrcweir }
GetRestoreActions() const2500cdf0e10cSrcweir sal_uInt16 ViewShell::GetRestoreActions() const
2501cdf0e10cSrcweir {
2502cdf0e10cSrcweir return Imp()->GetRestoreActions();
2503cdf0e10cSrcweir }
2504cdf0e10cSrcweir
IsNewLayout() const2505cdf0e10cSrcweir sal_Bool ViewShell::IsNewLayout() const
2506cdf0e10cSrcweir {
2507cdf0e10cSrcweir return GetLayout()->IsNewLayout();
2508cdf0e10cSrcweir }
2509cdf0e10cSrcweir
CreateAccessible()2510cdf0e10cSrcweir uno::Reference< ::com::sun::star::accessibility::XAccessible > ViewShell::CreateAccessible()
2511cdf0e10cSrcweir {
2512cdf0e10cSrcweir uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc;
2513cdf0e10cSrcweir
2514cdf0e10cSrcweir // We require a layout and an XModel to be accessible.
2515cdf0e10cSrcweir ASSERT( pLayout, "no layout, no access" );
2516cdf0e10cSrcweir ASSERT( GetWin(), "no window, no access" );
2517cdf0e10cSrcweir
2518cdf0e10cSrcweir if( pDoc->GetCurrentViewShell() && GetWin() ) //swmod 071108
2519cdf0e10cSrcweir xAcc = Imp()->GetAccessibleMap().GetDocumentView();
2520cdf0e10cSrcweir
2521cdf0e10cSrcweir return xAcc;
2522cdf0e10cSrcweir }
2523cdf0e10cSrcweir
2524cdf0e10cSrcweir uno::Reference< ::com::sun::star::accessibility::XAccessible >
CreateAccessiblePreview()2525cdf0e10cSrcweir ViewShell::CreateAccessiblePreview()
2526cdf0e10cSrcweir {
2527cdf0e10cSrcweir DBG_ASSERT( IsPreView(),
2528cdf0e10cSrcweir "Can't create accessible preview for non-preview ViewShell" );
2529cdf0e10cSrcweir
2530cdf0e10cSrcweir // We require a layout and an XModel to be accessible.
2531cdf0e10cSrcweir ASSERT( pLayout, "no layout, no access" );
2532cdf0e10cSrcweir ASSERT( GetWin(), "no window, no access" );
2533cdf0e10cSrcweir
2534cdf0e10cSrcweir // OD 15.01.2003 #103492# - add condition <IsPreView()>
2535cdf0e10cSrcweir if ( IsPreView() && GetLayout()&& GetWin() )
2536cdf0e10cSrcweir {
2537cdf0e10cSrcweir // OD 14.01.2003 #103492# - adjustment for new method signature
2538cdf0e10cSrcweir return Imp()->GetAccessibleMap().GetDocumentPreview(
2539cdf0e10cSrcweir PagePreviewLayout()->maPrevwPages,
2540cdf0e10cSrcweir GetWin()->GetMapMode().GetScaleX(),
2541cdf0e10cSrcweir GetLayout()->GetPageByPageNum( PagePreviewLayout()->mnSelectedPageNum ),
2542cdf0e10cSrcweir PagePreviewLayout()->maWinSize ); //swmod 080305
2543cdf0e10cSrcweir }
2544cdf0e10cSrcweir return NULL;
2545cdf0e10cSrcweir }
2546cdf0e10cSrcweir
InvalidateAccessibleFocus()2547cdf0e10cSrcweir void ViewShell::InvalidateAccessibleFocus()
2548cdf0e10cSrcweir {
2549cdf0e10cSrcweir if( Imp()->IsAccessible() )
2550cdf0e10cSrcweir Imp()->GetAccessibleMap().InvalidateFocus();
2551cdf0e10cSrcweir }
2552cdf0e10cSrcweir
2553cdf0e10cSrcweir /** invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
2554cdf0e10cSrcweir
2555cdf0e10cSrcweir OD 2005-12-01 #i27138#
2556cdf0e10cSrcweir
2557cdf0e10cSrcweir @author OD
2558cdf0e10cSrcweir */
InvalidateAccessibleParaFlowRelation(const SwTxtFrm * _pFromTxtFrm,const SwTxtFrm * _pToTxtFrm)2559cdf0e10cSrcweir void ViewShell::InvalidateAccessibleParaFlowRelation( const SwTxtFrm* _pFromTxtFrm,
2560cdf0e10cSrcweir const SwTxtFrm* _pToTxtFrm )
2561cdf0e10cSrcweir {
2562cdf0e10cSrcweir if ( GetLayout() && GetLayout()->IsAnyShellAccessible() )
2563cdf0e10cSrcweir {
2564cdf0e10cSrcweir Imp()->_InvalidateAccessibleParaFlowRelation( _pFromTxtFrm, _pToTxtFrm );
2565cdf0e10cSrcweir }
2566cdf0e10cSrcweir }
2567cdf0e10cSrcweir
2568cdf0e10cSrcweir /** invalidate text selection for paragraphs
2569cdf0e10cSrcweir
2570cdf0e10cSrcweir OD 2005-12-12 #i27301#
2571cdf0e10cSrcweir
2572cdf0e10cSrcweir @author OD
2573cdf0e10cSrcweir */
InvalidateAccessibleParaTextSelection()2574cdf0e10cSrcweir void ViewShell::InvalidateAccessibleParaTextSelection()
2575cdf0e10cSrcweir {
2576cdf0e10cSrcweir if ( GetLayout() && GetLayout()->IsAnyShellAccessible() )
2577cdf0e10cSrcweir {
2578cdf0e10cSrcweir Imp()->_InvalidateAccessibleParaTextSelection();
2579cdf0e10cSrcweir }
2580cdf0e10cSrcweir }
2581cdf0e10cSrcweir
2582cdf0e10cSrcweir /** invalidate attributes for paragraphs
2583cdf0e10cSrcweir
2584cdf0e10cSrcweir OD 2009-01-06 #i88069#
2585cdf0e10cSrcweir
2586cdf0e10cSrcweir @author OD
2587cdf0e10cSrcweir */
InvalidateAccessibleParaAttrs(const SwTxtFrm & rTxtFrm)2588cdf0e10cSrcweir void ViewShell::InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm )
2589cdf0e10cSrcweir {
2590cdf0e10cSrcweir if ( GetLayout() && GetLayout()->IsAnyShellAccessible() )
2591cdf0e10cSrcweir {
2592cdf0e10cSrcweir Imp()->_InvalidateAccessibleParaAttrs( rTxtFrm );
2593cdf0e10cSrcweir }
2594cdf0e10cSrcweir }
2595cdf0e10cSrcweir
GetAccessibleMap()2596cdf0e10cSrcweir SwAccessibleMap* ViewShell::GetAccessibleMap()
2597cdf0e10cSrcweir {
2598cdf0e10cSrcweir if ( Imp()->IsAccessible() )
2599cdf0e10cSrcweir {
2600cdf0e10cSrcweir return &(Imp()->GetAccessibleMap());
2601cdf0e10cSrcweir }
2602cdf0e10cSrcweir
2603cdf0e10cSrcweir return 0;
2604cdf0e10cSrcweir }
2605cdf0e10cSrcweir /* -----------------------------06.05.2002 13:23------------------------------
2606cdf0e10cSrcweir
2607cdf0e10cSrcweir ---------------------------------------------------------------------------*/
ApplyAccessiblityOptions(SvtAccessibilityOptions & rAccessibilityOptions)2608cdf0e10cSrcweir void ViewShell::ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions)
2609cdf0e10cSrcweir {
2610cdf0e10cSrcweir if(pOpt->IsPagePreview() && !rAccessibilityOptions.GetIsForPagePreviews())
2611cdf0e10cSrcweir {
2612cdf0e10cSrcweir pAccOptions->SetAlwaysAutoColor(sal_False);
2613cdf0e10cSrcweir pAccOptions->SetStopAnimatedGraphics(sal_False);
2614cdf0e10cSrcweir pAccOptions->SetStopAnimatedText(sal_False);
2615cdf0e10cSrcweir }
2616cdf0e10cSrcweir else
2617cdf0e10cSrcweir {
2618cdf0e10cSrcweir pAccOptions->SetAlwaysAutoColor(rAccessibilityOptions.GetIsAutomaticFontColor());
2619cdf0e10cSrcweir pAccOptions->SetStopAnimatedGraphics(! rAccessibilityOptions.GetIsAllowAnimatedGraphics());
2620cdf0e10cSrcweir pAccOptions->SetStopAnimatedText(! rAccessibilityOptions.GetIsAllowAnimatedText());
2621cdf0e10cSrcweir
2622cdf0e10cSrcweir // --> FME 2004-06-29 #114856# Formular view
2623cdf0e10cSrcweir // Always set this option, not only if document is read-only:
2624cdf0e10cSrcweir pOpt->SetSelectionInReadonly(rAccessibilityOptions.IsSelectionInReadonly());
2625cdf0e10cSrcweir }
2626cdf0e10cSrcweir }
2627cdf0e10cSrcweir
GetShellRes()2628cdf0e10cSrcweir ShellResource* ViewShell::GetShellRes()
2629cdf0e10cSrcweir {
2630cdf0e10cSrcweir return pShellRes;
2631cdf0e10cSrcweir }
2632cdf0e10cSrcweir
SetCareWin(Window * pNew)2633cdf0e10cSrcweir void ViewShell::SetCareWin( Window* pNew )
2634cdf0e10cSrcweir {
2635cdf0e10cSrcweir pCareWindow = pNew;
2636cdf0e10cSrcweir }
2637cdf0e10cSrcweir
GetPageCount() const2638cdf0e10cSrcweir sal_uInt16 ViewShell::GetPageCount() const
2639cdf0e10cSrcweir {
2640cdf0e10cSrcweir return GetLayout() ? GetLayout()->GetPageNum() : 1;
2641cdf0e10cSrcweir }
2642cdf0e10cSrcweir
GetPageSize(sal_uInt16 nPageNum,bool bSkipEmptyPages) const2643cdf0e10cSrcweir const Size ViewShell::GetPageSize( sal_uInt16 nPageNum, bool bSkipEmptyPages ) const
2644cdf0e10cSrcweir {
2645cdf0e10cSrcweir Size aSize;
2646cdf0e10cSrcweir const SwRootFrm* pTmpRoot = GetLayout();
2647cdf0e10cSrcweir if( pTmpRoot && nPageNum )
2648cdf0e10cSrcweir {
2649cdf0e10cSrcweir const SwPageFrm* pPage = static_cast<const SwPageFrm*>
2650cdf0e10cSrcweir (pTmpRoot->Lower());
2651cdf0e10cSrcweir
2652cdf0e10cSrcweir while( --nPageNum && pPage->GetNext() )
2653cdf0e10cSrcweir pPage = static_cast<const SwPageFrm*>( pPage->GetNext() );
2654cdf0e10cSrcweir
2655cdf0e10cSrcweir if( !bSkipEmptyPages && pPage->IsEmptyPage() && pPage->GetNext() )
2656cdf0e10cSrcweir pPage = static_cast<const SwPageFrm*>( pPage->GetNext() );
2657cdf0e10cSrcweir
2658cdf0e10cSrcweir aSize = pPage->Frm().SSize();
2659cdf0e10cSrcweir }
2660cdf0e10cSrcweir return aSize;
2661cdf0e10cSrcweir }
2662cdf0e10cSrcweir
2663cdf0e10cSrcweir // --> FME 2004-06-15 #i12836# enhanced pdf export
GetPageNumAndSetOffsetForPDF(OutputDevice & rOut,const SwRect & rRect) const2664cdf0e10cSrcweir sal_Int32 ViewShell::GetPageNumAndSetOffsetForPDF( OutputDevice& rOut, const SwRect& rRect ) const
2665cdf0e10cSrcweir {
2666cdf0e10cSrcweir ASSERT( GetLayout(), "GetPageNumAndSetOffsetForPDF assumes presence of layout" )
2667cdf0e10cSrcweir
2668cdf0e10cSrcweir sal_Int32 nRet = -1;
2669cdf0e10cSrcweir
2670cdf0e10cSrcweir // --> FME 2005-01-07 #i40059# Position out of bounds:
2671cdf0e10cSrcweir SwRect aRect( rRect );
2672cdf0e10cSrcweir aRect.Pos().X() = Max( aRect.Left(), GetLayout()->Frm().Left() );
2673cdf0e10cSrcweir // <--
2674cdf0e10cSrcweir
2675cdf0e10cSrcweir const SwPageFrm* pPage = GetLayout()->GetPageAtPos( aRect.Center() );
2676cdf0e10cSrcweir if ( pPage )
2677cdf0e10cSrcweir {
2678cdf0e10cSrcweir ASSERT( pPage, "GetPageNumAndSetOffsetForPDF: No page found" )
2679cdf0e10cSrcweir
2680cdf0e10cSrcweir Point aOffset( pPage->Frm().Pos() );
2681cdf0e10cSrcweir aOffset.X() = -aOffset.X();
2682cdf0e10cSrcweir aOffset.Y() = -aOffset.Y();
2683cdf0e10cSrcweir
2684cdf0e10cSrcweir MapMode aMapMode( rOut.GetMapMode() );
2685cdf0e10cSrcweir aMapMode.SetOrigin( aOffset );
2686cdf0e10cSrcweir rOut.SetMapMode( aMapMode );
2687cdf0e10cSrcweir
2688cdf0e10cSrcweir nRet = pPage->GetPhyPageNum() - 1;
2689cdf0e10cSrcweir }
2690cdf0e10cSrcweir
2691cdf0e10cSrcweir return nRet;
2692cdf0e10cSrcweir }
2693cdf0e10cSrcweir // <--
2694cdf0e10cSrcweir
2695cdf0e10cSrcweir // --> PB 2007-05-30 #146850#
GetReplacementBitmap(bool bIsErrorState)2696cdf0e10cSrcweir const BitmapEx& ViewShell::GetReplacementBitmap( bool bIsErrorState )
2697cdf0e10cSrcweir {
2698cdf0e10cSrcweir BitmapEx** ppRet;
2699cdf0e10cSrcweir sal_uInt16 nResId = 0, nHCResId = 0;
2700cdf0e10cSrcweir if( bIsErrorState )
2701cdf0e10cSrcweir {
2702cdf0e10cSrcweir ppRet = &pErrorBmp;
2703cdf0e10cSrcweir nResId = RID_GRAPHIC_ERRORBMP;
2704cdf0e10cSrcweir nHCResId = RID_GRAPHIC_ERRORBMP_HC;
2705cdf0e10cSrcweir }
2706cdf0e10cSrcweir else
2707cdf0e10cSrcweir {
2708cdf0e10cSrcweir ppRet = &pReplaceBmp;
2709cdf0e10cSrcweir nResId = RID_GRAPHIC_REPLACEBMP;
2710cdf0e10cSrcweir nHCResId = RID_GRAPHIC_REPLACEBMP_HC;
2711cdf0e10cSrcweir }
2712cdf0e10cSrcweir
2713cdf0e10cSrcweir if( !*ppRet )
2714cdf0e10cSrcweir {
2715cdf0e10cSrcweir sal_uInt16 nBmpResId =
2716cdf0e10cSrcweir Application::GetSettings().GetStyleSettings().GetHighContrastMode()
2717cdf0e10cSrcweir ? nHCResId : nResId;
2718cdf0e10cSrcweir *ppRet = new BitmapEx( SW_RES( nBmpResId ) );
2719cdf0e10cSrcweir }
2720cdf0e10cSrcweir return **ppRet;
2721cdf0e10cSrcweir }
2722cdf0e10cSrcweir
DeleteReplacementBitmaps()2723cdf0e10cSrcweir void ViewShell::DeleteReplacementBitmaps()
2724cdf0e10cSrcweir {
2725cdf0e10cSrcweir DELETEZ( pErrorBmp );
2726cdf0e10cSrcweir DELETEZ( pReplaceBmp );
2727cdf0e10cSrcweir }
2728cdf0e10cSrcweir // <--
2729cdf0e10cSrcweir
GetPostItMgr()2730cdf0e10cSrcweir SwPostItMgr* ViewShell::GetPostItMgr()
2731cdf0e10cSrcweir {
2732cdf0e10cSrcweir SwView* pView = GetDoc()->GetDocShell() ? GetDoc()->GetDocShell()->GetView() : 0;
2733cdf0e10cSrcweir if ( pView )
2734cdf0e10cSrcweir return pView->GetPostItMgr();
2735cdf0e10cSrcweir
2736cdf0e10cSrcweir return 0;
2737cdf0e10cSrcweir }
2738cdf0e10cSrcweir
2739cdf0e10cSrcweir /*
2740cdf0e10cSrcweir * Document Interface Access
2741cdf0e10cSrcweir */
getIDocumentSettingAccess() const2742cdf0e10cSrcweir const IDocumentSettingAccess* ViewShell::getIDocumentSettingAccess() const { return pDoc; }
getIDocumentSettingAccess()2743cdf0e10cSrcweir IDocumentSettingAccess* ViewShell::getIDocumentSettingAccess() { return pDoc; }
getIDocumentDeviceAccess() const2744cdf0e10cSrcweir const IDocumentDeviceAccess* ViewShell::getIDocumentDeviceAccess() const { return pDoc; }
getIDocumentDeviceAccess()2745cdf0e10cSrcweir IDocumentDeviceAccess* ViewShell::getIDocumentDeviceAccess() { return pDoc; }
getIDocumentMarkAccess() const2746cdf0e10cSrcweir const IDocumentMarkAccess* ViewShell::getIDocumentMarkAccess() const { return pDoc->getIDocumentMarkAccess(); }
getIDocumentMarkAccess()2747cdf0e10cSrcweir IDocumentMarkAccess* ViewShell::getIDocumentMarkAccess() { return pDoc->getIDocumentMarkAccess(); }
getIDocumentDrawModelAccess() const2748cdf0e10cSrcweir const IDocumentDrawModelAccess* ViewShell::getIDocumentDrawModelAccess() const { return pDoc; }
getIDocumentDrawModelAccess()2749cdf0e10cSrcweir IDocumentDrawModelAccess* ViewShell::getIDocumentDrawModelAccess() { return pDoc; }
getIDocumentRedlineAccess() const2750cdf0e10cSrcweir const IDocumentRedlineAccess* ViewShell::getIDocumentRedlineAccess() const { return pDoc; }
getIDocumentRedlineAccess()2751cdf0e10cSrcweir IDocumentRedlineAccess* ViewShell::getIDocumentRedlineAccess() { return pDoc; }
getIDocumentLayoutAccess() const2752cdf0e10cSrcweir const IDocumentLayoutAccess* ViewShell::getIDocumentLayoutAccess() const { return pDoc; }
getIDocumentLayoutAccess()2753cdf0e10cSrcweir IDocumentLayoutAccess* ViewShell::getIDocumentLayoutAccess() { return pDoc; }
getIDocumentFieldsAccess() const2754cdf0e10cSrcweir const IDocumentFieldsAccess* ViewShell::getIDocumentFieldsAccess() const { return pDoc; }
getIDocumentContentOperations()2755cdf0e10cSrcweir IDocumentContentOperations* ViewShell::getIDocumentContentOperations() { return pDoc; }
getIDocumentStylePoolAccess()2756cdf0e10cSrcweir IDocumentStylePoolAccess* ViewShell::getIDocumentStylePoolAccess() { return pDoc; }
getIDocumentStatistics() const2757cdf0e10cSrcweir const IDocumentStatistics* ViewShell::getIDocumentStatistics() const { return pDoc; }
2758cdf0e10cSrcweir
GetIDocumentUndoRedo()2759cdf0e10cSrcweir IDocumentUndoRedo & ViewShell::GetIDocumentUndoRedo()
2760cdf0e10cSrcweir { return pDoc->GetIDocumentUndoRedo(); }
GetIDocumentUndoRedo() const2761cdf0e10cSrcweir IDocumentUndoRedo const& ViewShell::GetIDocumentUndoRedo() const
2762cdf0e10cSrcweir { return pDoc->GetIDocumentUndoRedo(); }
2763cdf0e10cSrcweir
2764cdf0e10cSrcweir // --> OD 2007-11-14 #i83479#
getIDocumentListItemsAccess() const2765cdf0e10cSrcweir const IDocumentListItems* ViewShell::getIDocumentListItemsAccess() const
2766cdf0e10cSrcweir {
2767cdf0e10cSrcweir return pDoc;
2768cdf0e10cSrcweir }
getIDocumentOutlineNodesAccess() const2769cdf0e10cSrcweir const IDocumentOutlineNodes* ViewShell::getIDocumentOutlineNodesAccess() const
2770cdf0e10cSrcweir {
2771cdf0e10cSrcweir return pDoc;
2772cdf0e10cSrcweir }
2773cdf0e10cSrcweir // <--
2774