Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "hintids.hxx"
31 : : #include <vcl/help.hxx>
32 : : #include <svx/ruler.hxx>
33 : : #include <editeng/paperinf.hxx>
34 : : #include <editeng/lrspitem.hxx>
35 : : #include <sfx2/bindings.hxx>
36 : : #include <view.hxx>
37 : : #include <wrtsh.hxx>
38 : : #include <swmodule.hxx>
39 : : #include <viewopt.hxx>
40 : : #include <frmatr.hxx>
41 : : #include <docsh.hxx>
42 : : #include <cmdid.h>
43 : : #include <edtwin.hxx>
44 : : #include <scroll.hxx>
45 : : #include <wview.hxx>
46 : : #include <usrpref.hxx>
47 : : #include <pagedesc.hxx>
48 : : #include <workctrl.hxx>
49 : : #include <crsskip.hxx>
50 : :
51 : : #include <PostItMgr.hxx>
52 : :
53 : : #include <IDocumentSettingAccess.hxx>
54 : :
55 : : #include <basegfx/tools/zoomtools.hxx>
56 : :
57 : : //Das SetVisArea der DocShell darf nicht vom InnerResizePixel gerufen werden.
58 : : //Unsere Einstellungen muessen aber stattfinden.
59 : : #ifndef WB_RIGHT_ALIGNED
60 : : #define WB_RIGHT_ALIGNED ((WinBits)0x00008000)
61 : : #endif
62 : :
63 : : static sal_Bool bProtectDocShellVisArea = sal_False;
64 : :
65 : : static sal_uInt16 nPgNum = 0;
66 : :
67 : 10502 : sal_Bool SwView::IsDocumentBorder()
68 : : {
69 : 10502 : return GetDocShell()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ||
70 : 10502 : pWrtShell->GetViewOptions()->getBrowseMode() ||
71 [ - + ]: 21004 : SVX_ZOOM_PAGEWIDTH_NOBORDER == (SvxZoomType)pWrtShell->GetViewOptions()->GetZoomType();
[ + - + + ]
72 : : }
73 : :
74 : 3 : inline long GetLeftMargin( SwView &rView )
75 : : {
76 : 3 : SvxZoomType eType = (SvxZoomType)rView.GetWrtShell().GetViewOptions()->GetZoomType();
77 [ + - ]: 3 : long lRet = rView.GetWrtShell().GetAnyCurRect(RECT_PAGE_PRT).Left();
78 : : return eType == SVX_ZOOM_PERCENT ? lRet + DOCUMENTBORDER :
79 : : eType == SVX_ZOOM_PAGEWIDTH || eType == SVX_ZOOM_PAGEWIDTH_NOBORDER ? 0 :
80 [ # # ][ # # ]: 3 : lRet + DOCUMENTBORDER + nLeftOfst;
[ + - ]
81 : : }
82 : :
83 : 0 : void lcl_GetPos(SwView* pView,
84 : : Point& rPos,
85 : : SwScrollbar* pScrollbar,
86 : : sal_Bool bBorder)
87 : : {
88 : 0 : SwWrtShell &rSh = pView->GetWrtShell();
89 [ # # ]: 0 : const Size aDocSz( rSh.GetDocSize() );
90 : :
91 [ # # ]: 0 : const long lBorder = bBorder ? DOCUMENTBORDER : DOCUMENTBORDER * 2;
92 : 0 : sal_Bool bHori = pScrollbar->IsHoriScroll();
93 : :
94 [ # # ]: 0 : const long lPos = pScrollbar->GetThumbPos() + (bBorder ? DOCUMENTBORDER : 0);
95 [ # # ]: 0 : long Point:: *pPt = bHori ? &Point::nA : &Point::nB;
96 [ # # ]: 0 : long Size:: *pSz = bHori ? &Size::nA : &Size::nB;
97 : :
98 : 0 : long lDelta = lPos - rSh.VisArea().Pos().*pPt;
99 : 0 : const long lSize = aDocSz.*pSz + lBorder;
100 : : // sollte rechts oder unten zuviel Wiese sein, dann muss
101 : : // diese von der VisArea herausgerechnet werden!
102 : 0 : long nTmp = pView->GetVisArea().Right()+lDelta;
103 [ # # ][ # # ]: 0 : if ( bHori && nTmp > lSize )
104 : 0 : lDelta -= nTmp - lSize;
105 : 0 : nTmp = pView->GetVisArea().Bottom()+lDelta;
106 [ # # ][ # # ]: 0 : if ( !bHori && nTmp > lSize )
107 : 0 : lDelta -= nTmp - lSize;
108 : :
109 : 0 : rPos.*pPt += lDelta;
110 [ # # ][ # # ]: 0 : if ( bBorder && rPos.*pPt < DOCUMENTBORDER )
111 : 0 : rPos.*pPt = DOCUMENTBORDER;
112 : 0 : }
113 : :
114 : : /*--------------------------------------------------------------------
115 : : Beschreibung: Nullpunkt Lineal setzen
116 : : --------------------------------------------------------------------*/
117 : 5228 : void SwView::InvalidateRulerPos()
118 : : {
119 : : static sal_uInt16 aInval[] =
120 : : {
121 : : SID_ATTR_PARA_LRSPACE, SID_RULER_BORDERS, SID_RULER_PAGE_POS,
122 : : SID_RULER_LR_MIN_MAX, SID_ATTR_LONG_ULSPACE, SID_ATTR_LONG_LRSPACE,
123 : : SID_RULER_BORDER_DISTANCE,
124 : : SID_ATTR_PARA_LRSPACE_VERTICAL, SID_RULER_BORDERS_VERTICAL,
125 : : SID_RULER_TEXT_RIGHT_TO_LEFT,
126 : : SID_RULER_ROWS, SID_RULER_ROWS_VERTICAL, FN_STAT_PAGE,
127 : : 0
128 : : };
129 : :
130 : 5228 : GetViewFrame()->GetBindings().Invalidate(aInval);
131 : :
132 : : OSL_ENSURE(pHRuler, "warum ist das Lineal nicht da?");
133 : 5228 : pHRuler->ForceUpdate();
134 : 5228 : pVRuler->ForceUpdate();
135 : 5228 : }
136 : :
137 : : /*--------------------------------------------------------------------
138 : : Beschreibung: begrenzt das Scrollen soweit, dass jeweils nur einen
139 : : viertel Bildschirm bis vor das Ende des Dokumentes
140 : : gescrollt werden kann.
141 : : --------------------------------------------------------------------*/
142 : 8 : long SwView::SetHScrollMax( long lMax )
143 : : {
144 [ - + ]: 8 : const long lBorder = IsDocumentBorder() ? DOCUMENTBORDER : DOCUMENTBORDER * 2;
145 : 8 : const long lSize = GetDocSz().Width() + lBorder - aVisArea.GetWidth();
146 : :
147 : : // bei negativen Werten ist das Dokument vollstaendig sichtbar;
148 : : // in diesem Fall kein Scrollen
149 : 8 : return Max( Min( lMax, lSize ), 0L );
150 : : }
151 : :
152 : 630 : long SwView::SetVScrollMax( long lMax )
153 : : {
154 [ - + ]: 630 : const long lBorder = IsDocumentBorder() ? DOCUMENTBORDER : DOCUMENTBORDER * 2;
155 : 630 : long lSize = GetDocSz().Height() + lBorder - aVisArea.GetHeight();
156 : 630 : return Max( Min( lMax, lSize), 0L ); // siehe horz.
157 : : }
158 : :
159 : 6906 : Point SwView::AlignToPixel(const Point &rPt) const
160 : : {
161 [ + - ]: 6906 : return GetEditWin().PixelToLogic( GetEditWin().LogicToPixel( rPt ) );
162 : : }
163 : :
164 : : /*--------------------------------------------------------------------
165 : : Beschreibung: Dokumentgroesse hat sich geaendert
166 : : --------------------------------------------------------------------*/
167 : 2770 : void SwView::DocSzChgd(const Size &rSz)
168 : : {
169 : :
170 : : extern int bDocSzUpdated;
171 : :
172 : :
173 : 2770 : aDocSz = rSz;
174 : :
175 [ + - ][ + - ]: 2770 : if( !pWrtShell || aVisArea.IsEmpty() ) // keine Shell -> keine Aenderung
[ + + ][ + + ]
176 : : {
177 : 2259 : bDocSzUpdated = sal_False;
178 : 2770 : return;
179 : : }
180 : :
181 : : //Wenn Text geloescht worden ist, kann es sein, dass die VisArea hinter
182 : : //den sichtbaren Bereich verweist
183 : 511 : Rectangle aNewVisArea( aVisArea );
184 : 511 : bool bModified = false;
185 [ + - ][ + + ]: 511 : SwTwips lGreenOffset = IsDocumentBorder() ? DOCUMENTBORDER : DOCUMENTBORDER * 2;
186 : 511 : SwTwips lTmp = aDocSz.Width() + lGreenOffset;
187 : :
188 [ + + ]: 511 : if ( aNewVisArea.Right() >= lTmp )
189 : : {
190 : 51 : lTmp = aNewVisArea.Right() - lTmp;
191 : 51 : aNewVisArea.Right() -= lTmp;
192 : 51 : aNewVisArea.Left() -= lTmp;
193 : 51 : bModified = true;
194 : : }
195 : :
196 : 511 : lTmp = aDocSz.Height() + lGreenOffset;
197 [ + + ]: 511 : if ( aNewVisArea.Bottom() >= lTmp )
198 : : {
199 : 44 : lTmp = aNewVisArea.Bottom() - lTmp;
200 : 44 : aNewVisArea.Bottom() -= lTmp;
201 : 44 : aNewVisArea.Top() -= lTmp;
202 : 44 : bModified = true;
203 : : }
204 : :
205 [ + + ]: 511 : if ( bModified )
206 [ + - ]: 57 : SetVisArea( aNewVisArea, sal_False );
207 : :
208 [ + - ][ + + ]: 517 : if ( UpdateScrollbars() && !bInOuterResizePixel && !bInInnerResizePixel &&
[ + + ][ + - ]
[ + - ][ + + ]
209 [ + - ][ + - ]: 6 : !GetViewFrame()->GetFrame().IsInPlace())
210 : : OuterResizePixel( Point(),
211 [ + - ][ + - ]: 511 : GetViewFrame()->GetWindow().GetOutputSizePixel() );
212 : : }
213 : :
214 : : /*--------------------------------------------------------------------
215 : : Beschreibung: Visarea neu setzen
216 : : --------------------------------------------------------------------*/
217 : 3426 : void SwView::SetVisArea( const Rectangle &rRect, sal_Bool bUpdateScrollbar )
218 : : {
219 [ + - ]: 3426 : const Size aOldSz( aVisArea.GetSize() );
220 : :
221 [ + - ]: 3426 : const Point aTopLeft( AlignToPixel( rRect.TopLeft() ));
222 [ + - ][ + - ]: 3426 : const Point aBottomRight( AlignToPixel( rRect.BottomRight() ));
223 [ + - ]: 3426 : Rectangle aLR( aTopLeft, aBottomRight );
224 : :
225 [ + - ][ + + ]: 3426 : if( aLR == aVisArea )
226 : : return;
227 : :
228 [ + - ][ + + ]: 2642 : const SwTwips lMin = IsDocumentBorder() ? DOCUMENTBORDER : 0;
229 : :
230 : : // keine negative Position, keine neg. Groesse
231 [ + + ]: 2642 : if( aLR.Top() < lMin )
232 : : {
233 : 50 : aLR.Bottom() += lMin - aLR.Top();
234 : 50 : aLR.Top() = lMin;
235 : : }
236 [ + + ]: 2642 : if( aLR.Left() < lMin )
237 : : {
238 : 71 : aLR.Right() += lMin - aLR.Left();
239 : 71 : aLR.Left() = lMin;
240 : : }
241 [ - + ]: 2642 : if( aLR.Right() < 0 )
242 : 0 : aLR.Right() = 0;
243 [ - + ]: 2642 : if( aLR.Bottom() < 0 )
244 : 0 : aLR.Bottom() = 0;
245 : :
246 [ + - ][ + + ]: 2642 : if( aLR == aVisArea )
247 : : return;
248 : :
249 [ + - ]: 2591 : const Size aSize( aLR.GetSize() );
250 [ + - ][ - + ]: 2591 : if( aSize.Width() < 0 || aSize.Height() < 0 )
[ + - ]
251 : : return;
252 : :
253 : : //Bevor die Daten veraendert werden ggf. ein Update rufen. Dadurch wird
254 : : //sichergestellt, da? anliegende Paints korrekt in Dokumentkoordinaten
255 : : //umgerechnet werden.
256 : : //Vorsichtshalber tun wir das nur wenn an der Shell eine Action laeuft,
257 : : //denn dann wir nicht wirklich gepaintet sondern die Rechtecke werden
258 : : //lediglich (in Dokumentkoordinaten) vorgemerkt.
259 [ + - ][ + + ]: 2591 : if ( pWrtShell && pWrtShell->ActionPend() )
[ + + ]
260 [ + - ]: 2579 : pWrtShell->GetWin()->Update();
261 : :
262 : 2591 : aVisArea = aLR;
263 : :
264 [ + + ][ + - ]: 2591 : const sal_Bool bOuterResize = bUpdateScrollbar && UpdateScrollbars();
[ + + ]
265 : :
266 [ + - ]: 2591 : if ( pWrtShell )
267 : : {
268 [ + - ][ + - ]: 2591 : pWrtShell->VisPortChgd( aVisArea );
269 [ + + + + : 5587 : if ( aOldSz != pWrtShell->VisArea().SSize() &&
+ + ][ + + ]
270 : 2192 : ( Abs(aOldSz.Width() - pWrtShell->VisArea().Width()) > 2 ||
271 : 804 : Abs(aOldSz.Height() - pWrtShell->VisArea().Height()) > 2 ) )
272 [ + - ]: 2138 : pWrtShell->CheckBrowseView( sal_False );
273 : : }
274 : :
275 [ + - ]: 2591 : if ( !bProtectDocShellVisArea )
276 : : {
277 : : //Wenn die Groesse der VisArea unveraendert ist, reichen wir die
278 : : //Groesse der VisArea vom InternalObject weiter. Damit soll der
279 : : //Transport von Fehlern vermieden werden.
280 : 2591 : Rectangle aVis( aVisArea );
281 [ + - ][ + + ]: 2591 : if ( aVis.GetSize() == aOldSz )
282 [ + - ][ + - ]: 399 : aVis.SetSize( GetDocShell()->SfxObjectShell::GetVisArea(ASPECT_CONTENT).GetSize() );
[ + - ][ + - ]
283 : : // TODO/LATER: why casting?!
284 : : //GetDocShell()->SfxInPlaceObject::GetVisArea().GetSize() );
285 : :
286 : : //Bei embedded immer mit Modify...
287 : : // TODO/LATER: why casting?!
288 [ + - ][ + - ]: 2591 : GetDocShell()->SfxObjectShell::SetVisArea( aVis );
289 : : /*
290 : : if ( GetDocShell()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
291 : : GetDocShell()->SfxInPlaceObject::SetVisArea( aVis );
292 : : else
293 : : GetDocShell()->SvEmbeddedObject::SetVisArea( aVis );*/
294 : : }
295 : :
296 [ + - ]: 2591 : SfxViewShell::VisAreaChanged( aVisArea );
297 : :
298 [ + - ]: 2591 : InvalidateRulerPos();
299 : :
300 [ + + ][ + + ]: 2591 : if ( bOuterResize && !bInOuterResizePixel && !bInInnerResizePixel)
[ + - ]
301 : : OuterResizePixel( Point(),
302 [ + - ][ + - ]: 3426 : GetViewFrame()->GetWindow().GetOutputSizePixel() );
303 : : }
304 : :
305 : : /*--------------------------------------------------------------------
306 : : Beschreibung: Pos VisArea setzen
307 : : --------------------------------------------------------------------*/
308 : 663 : void SwView::SetVisArea( const Point &rPt, sal_Bool bUpdateScrollbar )
309 : : {
310 : : //einmal alignen, damit Brushes korrekt angesetzt werden.
311 : : //MA 31. May. 96: Das geht in der BrowseView schief, weil evlt.
312 : : //nicht das ganze Dokument sichtbar wird. Da der Inhalt in Frames
313 : : //passgenau ist, kann nicht aligned werden (bessere Idee?!?!)
314 : : //MA 29. Oct. 96 (fix: Bild.de, 200%) ganz ohne Alignment geht es nicht
315 : : //mal sehen wie weit wir mit der halben BrushSize kommen.
316 : 663 : Point aPt( rPt );
317 : : // const long nTmp = GetWrtShell().IsFrameView() ? BRUSH_SIZE/2 : BRUSH_SIZE;
318 [ - + ]: 663 : const long nTmp = GetWrtShell().IsFrameView() ? 4 : 8;
319 [ + - ]: 663 : aPt = GetEditWin().LogicToPixel( aPt );
320 : 663 : aPt.X() -= aPt.X() % nTmp;
321 : 663 : aPt.Y() -= aPt.Y() % nTmp;
322 [ + - ]: 663 : aPt = GetEditWin().PixelToLogic( aPt );
323 : :
324 [ + + ]: 663 : if ( aPt == aVisArea.TopLeft() )
325 : 663 : return;
326 : :
327 : 401 : const long lXDiff = aVisArea.Left() - aPt.X();
328 : 401 : const long lYDiff = aVisArea.Top() - aPt.Y();
329 : : SetVisArea( Rectangle( aPt,
330 : 401 : Point( aVisArea.Right() - lXDiff, aVisArea.Bottom() - lYDiff ) ),
331 [ + - ][ + - ]: 663 : bUpdateScrollbar);
332 : : }
333 : :
334 : 4 : void SwView::CheckVisArea()
335 : : {
336 : 4 : pHScrollbar->SetAuto( pWrtShell->GetViewOptions()->getBrowseMode() &&
337 [ + - ][ + - ]: 4 : !GetViewFrame()->GetFrame().IsInPlace() );
338 [ + - ]: 4 : if ( IsDocumentBorder() )
339 : : {
340 [ + - - + ]: 8 : if ( aVisArea.Left() != DOCUMENTBORDER ||
[ - + ]
341 : 4 : aVisArea.Top() != DOCUMENTBORDER )
342 : : {
343 : 0 : Rectangle aNewVisArea( aVisArea );
344 : 0 : aNewVisArea.Move( DOCUMENTBORDER - aVisArea.Left(),
345 [ # # ]: 0 : DOCUMENTBORDER - aVisArea.Top() );
346 [ # # ]: 0 : SetVisArea( aNewVisArea, sal_True );
347 : : }
348 : : }
349 : 4 : }
350 : :
351 : : /*--------------------------------------------------------------------
352 : : Beschreibung: Sichtbaren Bereich berechnen
353 : :
354 : : OUT Point *pPt: neue Position des sichtbaren
355 : : Bereiches
356 : : IN Rectangle &rRect: Rechteck, das sich innerhalb des neuen
357 : : sichtbaren Bereiches befinden soll
358 : : sal_uInt16 nRange optional exakte Angabe des Bereiches,
359 : : um den ggfs. gescrollt werden soll
360 : : --------------------------------------------------------------------*/
361 : 649 : void SwView::CalcPt( Point *pPt, const Rectangle &rRect,
362 : : sal_uInt16 nRangeX, sal_uInt16 nRangeY)
363 : : {
364 : :
365 [ - + ]: 649 : const SwTwips lMin = IsDocumentBorder() ? DOCUMENTBORDER : 0;
366 : :
367 : 649 : long nYScroll = GetYScroll();
368 : 649 : long nDesHeight = rRect.GetHeight();
369 : 649 : long nCurHeight = aVisArea.GetHeight();
370 : 649 : nYScroll = Min(nYScroll, nCurHeight - nDesHeight); // wird es knapp, dann nicht zuviel scrollen
371 [ - + ]: 649 : if(nDesHeight > nCurHeight) // die Hoehe reicht nicht aus, dann interessiert nYScroll nicht mehr
372 : : {
373 : 0 : pPt->Y() = rRect.Top();
374 : 0 : pPt->Y() = Max( lMin, pPt->Y() );
375 : : }
376 [ + + ]: 649 : else if ( rRect.Top() < aVisArea.Top() ) //Verschiebung nach oben
377 : : {
378 [ - + ]: 16 : pPt->Y() = rRect.Top() - (nRangeY != USHRT_MAX ? nRangeY : nYScroll);
379 : 16 : pPt->Y() = Max( lMin, pPt->Y() );
380 : : }
381 [ + + ]: 633 : else if( rRect.Bottom() > aVisArea.Bottom() ) //Verschiebung nach unten
382 : : {
383 : 630 : pPt->Y() = rRect.Bottom() -
384 : 630 : (aVisArea.GetHeight()) + ( nRangeY != USHRT_MAX ?
385 [ + + ]: 630 : nRangeY : nYScroll );
386 : 630 : pPt->Y() = SetVScrollMax( pPt->Y() );
387 : : }
388 : 649 : long nXScroll = GetXScroll();
389 [ + + ]: 649 : if ( rRect.Right() > aVisArea.Right() ) //Verschiebung nach rechts
390 : : {
391 : 8 : pPt->X() = rRect.Right() -
392 : 8 : (aVisArea.GetWidth()) +
393 [ + + ]: 8 : (nRangeX != USHRT_MAX ? nRangeX : nXScroll);
394 : 8 : pPt->X() = SetHScrollMax( pPt->X() );
395 : : }
396 [ + + ]: 641 : else if ( rRect.Left() < aVisArea.Left() ) //Verschiebung nach links
397 : : {
398 [ - + ]: 3 : pPt->X() = rRect.Left() - (nRangeX != USHRT_MAX ? nRangeX : nXScroll);
399 : 3 : pPt->X() = Max( ::GetLeftMargin( *this ) + nLeftOfst, pPt->X() );
400 : 3 : pPt->X() = Min( rRect.Left() - nScrollX, pPt->X() );
401 : 3 : pPt->X() = Max( 0L, pPt->X() );
402 : : }
403 : 649 : }
404 : :
405 : : /*--------------------------------------------------------------------
406 : : Beschreibung: Scrolling
407 : : --------------------------------------------------------------------*/
408 : 29277 : sal_Bool SwView::IsScroll( const Rectangle &rRect ) const
409 : : {
410 [ + - ][ + - ]: 29277 : return bCenterCrsr || bTopCrsr || !aVisArea.IsInside(rRect);
[ + + ]
411 : : }
412 : :
413 : 763 : void SwView::Scroll( const Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt16 nRangeY )
414 : : {
415 [ + - ][ + + ]: 763 : if ( aVisArea.IsEmpty() )
416 : : return;
417 : :
418 : 649 : Rectangle aOldVisArea( aVisArea );
419 : 649 : long nDiffY = 0;
420 : :
421 [ + - ]: 649 : Window* pCareWn = ViewShell::GetCareWin(GetWrtShell());
422 [ - + ]: 649 : if ( pCareWn )
423 : : {
424 : 0 : Rectangle aDlgRect( GetEditWin().PixelToLogic(
425 [ # # # # ]: 0 : pCareWn->GetWindowExtentsRelative( &GetEditWin() ) ) );
426 : : // Nur, wenn der Dialog nicht rechts oder links der VisArea liegt:
427 [ # # # # ]: 0 : if ( aDlgRect.Left() < aVisArea.Right() &&
[ # # ]
428 : 0 : aDlgRect.Right() > aVisArea.Left() )
429 : : {
430 : : // Falls wir nicht zentriert werden sollen, in der VisArea liegen
431 : : // und nicht vom Dialog ueberdeckt werden ...
432 [ # # ][ # # ]: 0 : if ( !bCenterCrsr && aOldVisArea.IsInside( rRect )
[ # # # #
# # # # #
# ][ # # ]
433 : 0 : && ( rRect.Left() > aDlgRect.Right()
434 : 0 : || rRect.Right() < aDlgRect.Left()
435 : 0 : || rRect.Top() > aDlgRect.Bottom()
436 : 0 : || rRect.Bottom() < aDlgRect.Top() ) )
437 : : return;
438 : :
439 : : // Ist oberhalb oder unterhalb der Dialogs mehr Platz?
440 : 0 : long nTopDiff = aDlgRect.Top() - aVisArea.Top();
441 : 0 : long nBottomDiff = aVisArea.Bottom() - aDlgRect.Bottom();
442 [ # # ]: 0 : if ( nTopDiff < nBottomDiff )
443 : : {
444 [ # # ]: 0 : if ( nBottomDiff > 0 ) // Ist unterhalb ueberhaupt Platz?
445 : : { // dann verschieben wir die Oberkante und merken uns dies
446 : 0 : nDiffY = aDlgRect.Bottom() - aVisArea.Top();
447 : 0 : aVisArea.Top() += nDiffY;
448 : : }
449 : : }
450 : : else
451 : : {
452 [ # # ]: 0 : if ( nTopDiff > 0 ) // Ist oberhalb ueberhaupt Platz?
453 : 0 : aVisArea.Bottom() = aDlgRect.Top(); // Unterkante aendern
454 : : }
455 : : }
456 : : }
457 : :
458 : : //s.o. !IsScroll()
459 [ + - ][ + - ]: 649 : if( !(bCenterCrsr || bTopCrsr) && aVisArea.IsInside( rRect ) )
[ + - ][ - + ]
[ - + ]
460 : : {
461 : 0 : aVisArea = aOldVisArea;
462 : : return;
463 : : }
464 : : //falls das Rechteck groesser als der sichtbare Bereich -->
465 : : //obere linke Ecke
466 [ + - ]: 649 : Size aSize( rRect.GetSize() );
467 [ + - ]: 649 : const Size aVisSize( aVisArea.GetSize() );
468 [ + - ][ + - : 1947 : if( !aVisArea.IsEmpty() && (
+ - + + ]
[ + + ]
469 [ + - ]: 649 : aSize.Width() + GetXScroll() > aVisSize.Width() ||
470 [ + - ]: 649 : aSize.Height()+ GetYScroll() > aVisSize.Height() ))
471 : : {
472 : 495 : Point aPt( aVisArea.TopLeft() );
473 : 495 : aSize.Width() = Min( aSize.Width(), aVisSize.Width() );
474 : 495 : aSize.Height()= Min( aSize.Height(),aVisSize.Height());
475 : :
476 : : CalcPt( &aPt, Rectangle( rRect.TopLeft(), aSize ),
477 : 495 : static_cast< sal_uInt16 >((aVisSize.Width() - aSize.Width()) / 2),
478 [ + - ][ + - ]: 990 : static_cast< sal_uInt16 >((aVisSize.Height()- aSize.Height())/ 2) );
479 : :
480 [ - + ]: 495 : if( bTopCrsr )
481 : : {
482 [ # # ][ # # ]: 0 : const long nBorder = IsDocumentBorder() ? DOCUMENTBORDER : 0;
483 : 0 : aPt.Y() = Min( Max( nBorder, rRect.Top() ),
484 : 0 : aDocSz.Height() + nBorder -
485 [ # # ]: 0 : aVisArea.GetHeight() );
486 : : }
487 : 495 : aPt.Y() -= nDiffY;
488 : 495 : aVisArea = aOldVisArea;
489 [ + - ]: 495 : SetVisArea( aPt );
490 : : return;
491 : : }
492 [ + - ]: 154 : if( !bCenterCrsr )
493 : : {
494 : 154 : Point aPt( aVisArea.TopLeft() );
495 [ + - ]: 154 : CalcPt( &aPt, rRect, nRangeX, nRangeY );
496 : :
497 [ - + ]: 154 : if( bTopCrsr )
498 : : {
499 [ # # ][ # # ]: 0 : const long nBorder = IsDocumentBorder() ? DOCUMENTBORDER : 0;
500 : 0 : aPt.Y() = Min( Max( nBorder, rRect.Top() ),
501 : 0 : aDocSz.Height() + nBorder -
502 [ # # ]: 0 : aVisArea.GetHeight() );
503 : : }
504 : :
505 : 154 : aPt.Y() -= nDiffY;
506 : 154 : aVisArea = aOldVisArea;
507 [ + - ]: 154 : SetVisArea( aPt );
508 : : return;
509 : : }
510 : :
511 : : //Cursor zentrieren
512 : 0 : Point aPnt( aVisArea.TopLeft() );
513 : : // ... in Y-Richtung auf jeden Fall
514 : 0 : aPnt.Y() += ( rRect.Top() + rRect.Bottom()
515 : 0 : - aVisArea.Top() - aVisArea.Bottom() ) / 2 - nDiffY;
516 : : // ... in X-Richtung nur, wenn das Rechteck rechts oder links aus der
517 : : // VisArea hinausragt.
518 [ # # ][ # # ]: 0 : if ( rRect.Right() > aVisArea.Right() || rRect.Left() < aVisArea.Left() )
[ # # ]
519 : : {
520 : 0 : aPnt.X() += ( rRect.Left() + rRect.Right()
521 : 0 : - aVisArea.Left() - aVisArea.Right() ) / 2;
522 [ # # ]: 0 : aPnt.X() = SetHScrollMax( aPnt.X() );
523 [ # # ][ # # ]: 0 : const SwTwips lMin = IsDocumentBorder() ? DOCUMENTBORDER : 0;
524 [ # # ]: 0 : aPnt.X() = Max( (GetLeftMargin( *this ) - lMin) + nLeftOfst, aPnt.X() );
525 : : }
526 : 0 : aVisArea = aOldVisArea;
527 [ # # ]: 0 : if( pCareWn )
528 : : { // Wenn wir nur einem Dialog ausweichen wollen, wollen wir nicht ueber
529 : : // das Ende des Dokument hinausgehen.
530 [ # # ]: 0 : aPnt.Y() = SetVScrollMax( aPnt.Y() );
531 : : }
532 [ # # ]: 763 : SetVisArea( aPnt );
533 : : }
534 : :
535 : : /*--------------------------------------------------------------------
536 : : Beschreibung: Seitenweises Scrollen
537 : : Liefern den Wert, um den bei PageUp / -Down gescrollt werden soll
538 : : --------------------------------------------------------------------*/
539 : 0 : sal_Bool SwView::GetPageScrollUpOffset( SwTwips &rOff ) const
540 : : {
541 [ # # ][ # # ]: 0 : if ( !aVisArea.Top() || !aVisArea.GetHeight() )
[ # # ]
542 : 0 : return sal_False;
543 : 0 : long nYScrl = GetYScroll() / 2;
544 : 0 : rOff = -(aVisArea.GetHeight() - nYScrl);
545 : : //nicht vor den Dokumentanfang scrollen
546 [ # # ]: 0 : if( aVisArea.Top() - rOff < 0 )
547 : 0 : rOff = rOff - aVisArea.Top();
548 [ # # ]: 0 : else if( GetWrtShell().GetCharRect().Top() < (aVisArea.Top() + nYScrl))
549 : 0 : rOff += nYScrl;
550 : 0 : return sal_True;
551 : : }
552 : :
553 : 0 : sal_Bool SwView::GetPageScrollDownOffset( SwTwips &rOff ) const
554 : : {
555 [ # # # # ]: 0 : if ( !aVisArea.GetHeight() ||
[ # # ]
556 : 0 : (aVisArea.GetHeight() > aDocSz.Height()) )
557 : 0 : return sal_False;
558 : 0 : long nYScrl = GetYScroll() / 2;
559 : 0 : rOff = aVisArea.GetHeight() - nYScrl;
560 : : //nicht hinter das Dokumentende scrollen
561 [ # # ]: 0 : if ( aVisArea.Top() + rOff > aDocSz.Height() )
562 : 0 : rOff = aDocSz.Height() - aVisArea.Bottom();
563 [ # # ]: 0 : else if( GetWrtShell().GetCharRect().Bottom() >
564 : 0 : ( aVisArea.Bottom() - nYScrl ))
565 : 0 : rOff -= nYScrl;
566 : 0 : return rOff > 0;
567 : : }
568 : :
569 : : // Seitenweises Blaettern
570 : 0 : long SwView::PageUp()
571 : : {
572 [ # # ][ # # ]: 0 : if (!aVisArea.GetHeight())
573 : 0 : return 0;
574 : :
575 : 0 : Point aPos(aVisArea.TopLeft());
576 [ # # ][ # # ]: 0 : aPos.Y() -= aVisArea.GetHeight() - (GetYScroll() / 2);
577 : 0 : aPos.Y() = Max(0L, aPos.Y());
578 [ # # ]: 0 : SetVisArea( aPos );
579 : 0 : return 1;
580 : : }
581 : :
582 : 0 : long SwView::PageDown()
583 : : {
584 [ # # ][ # # ]: 0 : if ( !aVisArea.GetHeight() )
585 : 0 : return 0;
586 : 0 : Point aPos( aVisArea.TopLeft() );
587 [ # # ][ # # ]: 0 : aPos.Y() += aVisArea.GetHeight() - (GetYScroll() / 2);
588 [ # # ]: 0 : aPos.Y() = SetVScrollMax( aPos.Y() );
589 [ # # ]: 0 : SetVisArea( aPos );
590 : 0 : return 1;
591 : : }
592 : :
593 : 0 : long SwView::PhyPageUp()
594 : : {
595 : : //aktuell sichtbare Seite erfragen, nicht formatieren
596 : 0 : sal_uInt16 nActPage = pWrtShell->GetNextPrevPageNum( sal_False );
597 : :
598 [ # # ]: 0 : if( USHRT_MAX != nActPage )
599 : : {
600 : 0 : const Point aPt( aVisArea.Left(),
601 [ # # ]: 0 : pWrtShell->GetPagePos( nActPage ).Y() );
602 [ # # ]: 0 : Point aAlPt( AlignToPixel( aPt ) );
603 : : // falls ein Unterschied besteht, wurde abgeschnitten --> dann
604 : : // einen Pixel addieren, damit kein Rest der Vorgaengerseite
605 : : // sichtbar ist
606 [ # # ]: 0 : if( aPt.Y() != aAlPt.Y() )
607 [ # # ]: 0 : aAlPt.Y() += 3 * GetEditWin().PixelToLogic( Size( 0, 1 ) ).Height();
608 [ # # ]: 0 : SetVisArea( aAlPt );
609 : : }
610 : 0 : return 1;
611 : : }
612 : :
613 : 0 : long SwView::PhyPageDown()
614 : : {
615 : : //aktuell sichtbare Seite erfragen, nicht formatieren
616 : 0 : sal_uInt16 nActPage = pWrtShell->GetNextPrevPageNum( sal_True );
617 : : // falls die letzte Dokumentseite sichtbar ist, nichts tun
618 [ # # ]: 0 : if( USHRT_MAX != nActPage )
619 : : {
620 : 0 : const Point aPt( aVisArea.Left(),
621 [ # # ]: 0 : pWrtShell->GetPagePos( nActPage ).Y() );
622 [ # # ]: 0 : Point aAlPt( AlignToPixel( aPt ) );
623 : : // falls ein Unterschied besteht, wurde abgeschnitten --> dann
624 : : // einen Pixel addieren, damit kein Rest der Vorgaengerseite sichtbar ist
625 [ # # ]: 0 : if( aPt.Y() != aAlPt.Y() )
626 [ # # ]: 0 : aAlPt.Y() += 3 * GetEditWin().PixelToLogic( Size( 0, 1 ) ).Height();
627 [ # # ]: 0 : SetVisArea( aAlPt );
628 : : }
629 : 0 : return 1;
630 : : }
631 : :
632 : 0 : long SwView::PageUpCrsr( sal_Bool bSelect )
633 : : {
634 [ # # ]: 0 : if ( !bSelect )
635 : : {
636 [ # # ]: 0 : const sal_uInt16 eType = pWrtShell->GetFrmType(0,sal_True);
637 [ # # ]: 0 : if ( eType & FRMTYPE_FOOTNOTE )
638 : : {
639 [ # # ]: 0 : pWrtShell->MoveCrsr();
640 [ # # ]: 0 : pWrtShell->GotoFtnAnchor();
641 [ # # ]: 0 : pWrtShell->Right(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
642 : 0 : return 1;
643 : : }
644 : : }
645 : :
646 : 0 : SwTwips lOff = 0;
647 [ # # ][ # # ]: 0 : if ( GetPageScrollUpOffset( lOff ) &&
[ # # ][ # # ]
[ # # ][ # # ]
648 [ # # ]: 0 : (pWrtShell->IsCrsrReadonly() ||
649 [ # # ]: 0 : !pWrtShell->PageCrsr( lOff, bSelect )) &&
650 [ # # ]: 0 : PageUp() )
651 : : {
652 [ # # ]: 0 : pWrtShell->ResetCursorStack();
653 : 0 : return sal_True;
654 : : }
655 : 0 : return sal_False;
656 : : }
657 : :
658 : 0 : long SwView::PageDownCrsr(sal_Bool bSelect)
659 : : {
660 : 0 : SwTwips lOff = 0;
661 [ # # ][ # # ]: 0 : if ( GetPageScrollDownOffset( lOff ) &&
[ # # ][ # # ]
[ # # ][ # # ]
662 [ # # ]: 0 : (pWrtShell->IsCrsrReadonly() ||
663 [ # # ]: 0 : !pWrtShell->PageCrsr( lOff, bSelect )) &&
664 [ # # ]: 0 : PageDown() )
665 : : {
666 [ # # ]: 0 : pWrtShell->ResetCursorStack();
667 : 0 : return sal_True;
668 : : }
669 : 0 : return sal_False;
670 : : }
671 : :
672 : : /*------------------------------------------------------------------------
673 : : Beschreibung: Handler der Scrollbars
674 : : ------------------------------------------------------------------------*/
675 : 0 : IMPL_LINK( SwView, ScrollHdl, SwScrollbar *, pScrollbar )
676 : : {
677 [ # # ]: 0 : if ( GetWrtShell().ActionPend() )
678 : 0 : return 0;
679 : :
680 [ # # ]: 0 : if ( pScrollbar->GetType() == SCROLL_DRAG )
681 : 0 : pWrtShell->EnableSmooth( sal_False );
682 : :
683 [ # # # # ]: 0 : if(!pWrtShell->GetViewOptions()->getBrowseMode() &&
[ # # ]
684 : 0 : pScrollbar->GetType() == SCROLL_DRAG)
685 : : {
686 : : //Hier wieder auskommentieren wenn das mitscrollen nicht gewuenscht ist.
687 : : // the end scrollhandler invalidate the FN_STAT_PAGE,
688 : : // so we dont must do it agin.
689 [ # # ]: 0 : EndScrollHdl(pScrollbar);
690 : :
691 : 0 : Point aPos( aVisArea.TopLeft() );
692 [ # # ][ # # ]: 0 : lcl_GetPos(this, aPos, pScrollbar, IsDocumentBorder());
693 : :
694 : 0 : sal_uInt16 nPhNum = 1;
695 : 0 : sal_uInt16 nVirtNum = 1;
696 : :
697 [ # # ]: 0 : String sDisplay;
698 [ # # ][ # # ]: 0 : if(pWrtShell->GetPageNumber( aPos.Y(), sal_False, nPhNum, nVirtNum, sDisplay ))
699 : : {
700 : :
701 : : //QuickHelp:
702 [ # # ][ # # ]: 0 : if( pWrtShell->GetPageCnt() > 1 && Help::IsQuickHelpEnabled() )
[ # # ][ # # ]
[ # # ]
703 : : {
704 [ # # ][ # # ]: 0 : if( !nPgNum || nPgNum != nPhNum )
705 : : {
706 [ # # ]: 0 : Rectangle aRect;
707 : 0 : aRect.Left() = pScrollbar->GetParent()->OutputToScreenPixel(
708 [ # # ][ # # ]: 0 : pScrollbar->GetPosPixel() ).X() -8;
[ # # ]
709 : 0 : aRect.Top() = pScrollbar->OutputToScreenPixel(
710 [ # # ][ # # ]: 0 : pScrollbar->GetPointerPosPixel() ).Y();
711 : 0 : aRect.Right() = aRect.Left();
712 : 0 : aRect.Bottom() = aRect.Top();
713 : :
714 [ # # ]: 0 : String sPageStr( GetPageStr( nPhNum, nVirtNum, sDisplay ));
715 [ # # ]: 0 : SwContentAtPos aCnt( SwContentAtPos::SW_OUTLINE );
716 [ # # ]: 0 : pWrtShell->GetContentAtPos( aPos, aCnt );
717 [ # # ]: 0 : if( aCnt.sStr.Len() )
718 : : {
719 [ # # ]: 0 : sPageStr += rtl::OUString(" - ");
720 [ # # ]: 0 : sPageStr.Insert( aCnt.sStr, 0, 80 );
721 [ # # ]: 0 : sPageStr.SearchAndReplaceAll( '\t', ' ' );
722 [ # # ]: 0 : sPageStr.SearchAndReplaceAll( 0x0a, ' ' );
723 : : }
724 : :
725 : : Help::ShowQuickHelp( pScrollbar, aRect, sPageStr,
726 [ # # ][ # # ]: 0 : QUICKHELP_RIGHT|QUICKHELP_VCENTER);
[ # # ]
727 : : }
728 : 0 : nPgNum = nPhNum;
729 : : }
730 [ # # ]: 0 : }
731 : : }
732 : : else
733 : 0 : EndScrollHdl(pScrollbar);
734 : :
735 [ # # ]: 0 : if ( pScrollbar->GetType() == SCROLL_DRAG )
736 : 0 : pWrtShell->EnableSmooth( sal_True );
737 : :
738 : 0 : return 0;
739 : : }
740 : :
741 : : /*------------------------------------------------------------------------
742 : : Beschreibung: Handler der Scrollbars
743 : : ------------------------------------------------------------------------*/
744 : 0 : IMPL_LINK( SwView, EndScrollHdl, SwScrollbar *, pScrollbar )
745 : : {
746 [ # # ]: 0 : if ( !GetWrtShell().ActionPend() )
747 : : {
748 [ # # ]: 0 : if(nPgNum)
749 : : {
750 : 0 : nPgNum = 0;
751 [ # # ][ # # ]: 0 : Help::ShowQuickHelp(pScrollbar, Rectangle(), aEmptyStr, 0);
752 : : }
753 : 0 : Point aPos( aVisArea.TopLeft() );
754 [ # # ]: 0 : sal_Bool bBorder = IsDocumentBorder();
755 [ # # ]: 0 : lcl_GetPos(this, aPos, pScrollbar, bBorder);
756 [ # # ][ # # ]: 0 : if ( bBorder && aPos == aVisArea.TopLeft() )
[ # # ][ # # ]
757 [ # # ]: 0 : UpdateScrollbars();
758 : : else
759 [ # # ]: 0 : SetVisArea( aPos, sal_False );
760 : :
761 [ # # ]: 0 : GetViewFrame()->GetBindings().Update(FN_STAT_PAGE);
762 : : }
763 : 0 : return 0;
764 : : }
765 : :
766 : : /*--------------------------------------------------------------------
767 : : Beschreibung:
768 : : berechnet die Groesse von aVisArea abhaengig von der Groesse
769 : : des EditWin auf dem Schirm.
770 : : --------------------------------------------------------------------*/
771 : 2968 : void SwView::CalcVisArea( const Size &rOutPixel )
772 : : {
773 : 2968 : Point aTopLeft;
774 [ + - ]: 2968 : Rectangle aRect( aTopLeft, rOutPixel );
775 [ + - ]: 2968 : aTopLeft = GetEditWin().PixelToLogic( aTopLeft );
776 [ + - ][ + - ]: 2968 : Point aBottomRight( GetEditWin().PixelToLogic( aRect.BottomRight() ) );
777 : :
778 : 2968 : aRect.Left() = aTopLeft.X();
779 : 2968 : aRect.Top() = aTopLeft.Y();
780 : 2968 : aRect.Right() = aBottomRight.X();
781 : 2968 : aRect.Bottom() = aBottomRight.Y();
782 : :
783 : : //Die Verschiebungen nach rechts und/oder unten koennen jetzt falsch
784 : : //sein (z.B. Zoom aendern, Viewgroesse aendern.
785 [ + + ][ + - ]: 2968 : const long lBorder = IsDocumentBorder() ? DOCUMENTBORDER : DOCUMENTBORDER*2;
786 [ + + ]: 2968 : if ( aRect.Left() )
787 : : {
788 [ + - ]: 312 : const long lWidth = GetWrtShell().GetDocSize().Width() + lBorder;
789 [ + + ]: 312 : if ( aRect.Right() > lWidth )
790 : : {
791 : 6 : long lDelta = aRect.Right() - lWidth;
792 : 6 : aRect.Left() -= lDelta;
793 : 6 : aRect.Right() -= lDelta;
794 : : }
795 : : }
796 [ + + ]: 2968 : if ( aRect.Top() )
797 : : {
798 [ + - ]: 314 : const long lHeight = GetWrtShell().GetDocSize().Height() + lBorder;
799 [ + + ]: 314 : if ( aRect.Bottom() > lHeight )
800 : : {
801 : 6 : long lDelta = aRect.Bottom() - lHeight;
802 : 6 : aRect.Top() -= lDelta;
803 : 6 : aRect.Bottom() -= lDelta;
804 : : }
805 : : }
806 [ + - ]: 2968 : SetVisArea( aRect );
807 [ + - ]: 2968 : GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
808 [ + - ]: 2968 : GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER ); // for snapping points
809 : 2968 : }
810 : :
811 : : /*--------------------------------------------------------------------
812 : : Beschreibung: Bedienelemente neu anordnen
813 : : --------------------------------------------------------------------*/
814 : 2873 : void SwView::CalcAndSetBorderPixel( SvBorder &rToFill, sal_Bool /*bInner*/ )
815 : : {
816 : 2873 : sal_Bool bRightVRuler = pWrtShell->GetViewOptions()->IsVRulerRight();
817 [ + + ]: 2873 : if ( pVRuler->IsVisible() )
818 : : {
819 : 2605 : long nWidth = pVRuler->GetSizePixel().Width();
820 [ + + ]: 2605 : if(bRightVRuler)
821 : 72 : rToFill.Right() = nWidth;
822 : : else
823 : 2533 : rToFill.Left() = nWidth;
824 : : }
825 : :
826 : : OSL_ENSURE(pHRuler, "warum ist das Lineal nicht da?");
827 [ + + ]: 2873 : if ( pHRuler->IsVisible() )
828 : 2627 : rToFill.Top() = pHRuler->GetSizePixel().Height();
829 : :
830 : 2873 : const StyleSettings &rSet = GetEditWin().GetSettings().GetStyleSettings();
831 : 2873 : const long nTmp = rSet.GetScrollBarSize();
832 [ + + ]: 2873 : if( pVScrollbar->IsVisible(sal_True) )
833 : : {
834 [ + + ]: 2523 : if(bRightVRuler)
835 : 6 : rToFill.Left() = nTmp;
836 : : else
837 : 2517 : rToFill.Right() = nTmp;
838 : : }
839 [ + + ]: 2873 : if ( pHScrollbar->IsVisible(sal_True) )
840 : 2505 : rToFill.Bottom() = nTmp;
841 : :
842 : 2873 : SetBorderPixel( rToFill );
843 : 2873 : }
844 : :
845 : 2873 : void ViewResizePixel( const Window &rRef,
846 : : const Point &rOfst,
847 : : const Size &rSize,
848 : : const Size &rEditSz,
849 : : const sal_Bool /*bInner*/,
850 : : SwScrollbar& rVScrollbar,
851 : : SwScrollbar& rHScrollbar,
852 : : ImageButton* pPageUpBtn,
853 : : ImageButton* pPageDownBtn,
854 : : ImageButton* pNaviBtn,
855 : : Window& rScrollBarBox,
856 : : SvxRuler* pVLineal,
857 : : SvxRuler* pHLineal,
858 : : sal_Bool bWebView,
859 : : sal_Bool bVRulerRight )
860 : : {
861 : : // ViewResizePixel wird auch von der PreView benutzt!!!
862 : :
863 [ + - ][ + - ]: 2873 : const sal_Bool bHLineal = pHLineal && pHLineal->IsVisible();
[ + + ]
864 : : const long nHLinSzHeight = bHLineal ?
865 [ + + ][ + - ]: 2873 : pHLineal->GetSizePixel().Height() : 0;
[ + + ][ # # ]
866 [ + - ][ + - ]: 2873 : const sal_Bool bVLineal = pVLineal && pVLineal->IsVisible();
[ + + ]
867 : : const long nVLinSzWidth = bVLineal ?
868 [ + + ][ + - ]: 2873 : pVLineal->GetSizePixel().Width() : 0;
[ + + ][ # # ]
869 : :
870 : 2873 : long nScrollBarSize = rRef.GetSettings().GetStyleSettings().GetScrollBarSize();
871 [ + + ][ + - ]: 2873 : long nHBSzHeight = rHScrollbar.IsVisible(true) ? nScrollBarSize : 0;
872 [ + - ][ + + ]: 2873 : long nVBSzWidth = rVScrollbar.IsVisible(true) ? nScrollBarSize : 0;
873 : :
874 [ + - ]: 2873 : if(pVLineal)
875 : : {
876 : 2873 : WinBits nStyle = pVLineal->GetStyle()&~WB_RIGHT_ALIGNED;
877 : 2873 : Point aPos( rOfst.X(), rOfst.Y()+nHLinSzHeight );
878 [ + + ]: 2873 : if(bVRulerRight)
879 : : {
880 : 166 : aPos.X() += rSize.Width() - nVLinSzWidth;
881 : 166 : nStyle |= WB_RIGHT_ALIGNED;
882 : : }
883 : 2873 : Size aSize( nVLinSzWidth, rEditSz.Height() );
884 [ + + ]: 2873 : if(!aSize.Width())
885 [ + - ]: 268 : aSize.Width() = pVLineal->GetSizePixel().Width();
886 [ + - ]: 2873 : pVLineal->SetStyle(nStyle);
887 [ + - ]: 2873 : pVLineal->SetPosSizePixel( aPos, aSize );
888 [ + - ][ + + ]: 2873 : if(!pVLineal->IsVisible())
889 [ + - ]: 2873 : pVLineal->Resize();
890 : : }
891 : : // Lineal braucht ein Resize, sonst funktioniert es nicht im unischtbaren Zustand
892 [ + - ]: 2873 : if(pHLineal)
893 : : {
894 : 2873 : Size aSize( rSize.Width(), nHLinSzHeight );
895 [ + + ][ + + ]: 2873 : if ( nVBSzWidth && !bVRulerRight)
896 : 2517 : aSize.Width() -= nVBSzWidth;
897 [ + + ]: 2873 : if(!aSize.Height())
898 [ + - ]: 246 : aSize.Height() = pHLineal->GetSizePixel().Height();
899 [ + - ]: 2873 : pHLineal->SetPosSizePixel( rOfst, aSize );
900 : : // VCL ruft an unsichtbaren Fenstern kein Resize
901 : : // fuer das Lineal ist das aber keine gute Idee
902 [ + - ][ + + ]: 2873 : if(!pHLineal->IsVisible())
903 [ + - ]: 2873 : pHLineal->Resize();
904 : : }
905 : :
906 : : // Scrollbars und SizeBox anordnen
907 : 2873 : Point aScrollFillPos;
908 : : {
909 : : Point aPos( rOfst.X(),
910 : 2873 : rOfst.Y()+rSize.Height()-nHBSzHeight );
911 [ + + ]: 2873 : if(bVRulerRight)
912 : : {
913 : 166 : aPos.X() += nVBSzWidth;
914 : : }
915 : :
916 : 2873 : Size aSize( rSize.Width(), nHBSzHeight );
917 [ + + ]: 2873 : if ( nVBSzWidth )
918 : 2523 : aSize.Width() -= nVBSzWidth;
919 [ + - ]: 2873 : rHScrollbar.SetPosSizePixel( aPos, aSize );
920 : 2873 : aScrollFillPos.Y() = aPos.Y();
921 : : }
922 : : {
923 : 2873 : Point aPos( rOfst.X()+rSize.Width()-nVBSzWidth,
924 : 5746 : rOfst.Y() );
925 : 2873 : Size aSize( nVBSzWidth, rSize.Height() );
926 [ + + ]: 2873 : if(bVRulerRight)
927 : : {
928 : 166 : aPos.X() = rOfst.X();
929 [ + + ]: 166 : if(bHLineal)
930 : : {
931 : 62 : aPos.Y() += nHLinSzHeight;
932 : 62 : aSize.Height() -= nHLinSzHeight;
933 : : }
934 : : }
935 : :
936 : 2873 : Size aImgSz( nVBSzWidth, nVBSzWidth );
937 : :
938 : : // wenn der Platz fuer Scrollbar und Page-Buttons zu klein wird, dann
939 : : // werden die Buttons versteckt
940 [ + - ]: 2873 : sal_uInt16 nCnt = pNaviBtn ? 3 : 2;
941 : 2873 : long nSubSize = (aImgSz.Width() * nCnt );
942 : : //
943 [ + + ]: 2873 : sal_Bool bHidePageButtons = aSize.Height() < ((bWebView ? 3 : 2) * nSubSize);
944 [ + - ]: 2873 : if(!bHidePageButtons)
945 : 2873 : aSize.Height() -= nSubSize;
946 : : else
947 : 0 : aImgSz.Width() = 0; // kein Hide, weil das im Update Scrollbar missverstanden wird
948 : :
949 [ + + ]: 2873 : if ( nHBSzHeight )
950 : 2505 : aSize.Height() -= nHBSzHeight;
951 [ + - ]: 2873 : rVScrollbar.SetPosSizePixel( aPos, aSize );
952 : :
953 : 2873 : aPos.Y() += aSize.Height();
954 [ + - ]: 2873 : pPageUpBtn->SetPosSizePixel( aPos, aImgSz );
955 [ + - ]: 2873 : if(pNaviBtn)
956 : : {
957 : 2873 : aPos.Y() += aImgSz.Height();
958 [ + - ]: 2873 : pNaviBtn->SetPosSizePixel(aPos, aImgSz);
959 : : }
960 : :
961 : 2873 : aPos.Y() += aImgSz.Height();
962 [ + - ]: 2873 : pPageDownBtn->SetPosSizePixel( aPos, aImgSz );
963 : :
964 : 2873 : aScrollFillPos.X() = aPos.X();
965 : : }
966 : :
967 [ + - ]: 2873 : rScrollBarBox.SetPosSizePixel( aScrollFillPos, Size( nHBSzHeight, nVBSzWidth) );
968 : 2873 : }
969 : :
970 : 1292 : void SwView::ShowAtResize()
971 : : {
972 : 1292 : bShowAtResize = sal_False;
973 [ + + ]: 1292 : if ( pWrtShell->GetViewOptions()->IsViewHRuler() )
974 : 1290 : pHRuler->Show();
975 : 1292 : }
976 : :
977 : 0 : void SwView::InnerResizePixel( const Point &rOfst, const Size &rSize )
978 : : {
979 [ # # ][ # # ]: 0 : Size aObjSize = GetObjectShell()->GetVisArea().GetSize();
[ # # ]
980 [ # # ][ # # ]: 0 : if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 )
[ # # ]
981 : : {
982 [ # # ]: 0 : SvBorder aBorder( GetBorderPixel() );
983 : 0 : Size aSize( rSize );
984 : 0 : aSize.Width() -= (aBorder.Left() + aBorder.Right());
985 : 0 : aSize.Height() -= (aBorder.Top() + aBorder.Bottom());
986 [ # # ][ # # ]: 0 : Size aObjSizePixel = GetWindow()->LogicToPixel( aObjSize, MAP_TWIP );
[ # # ]
987 : 0 : SfxViewShell::SetZoomFactor( Fraction( aSize.Width(), aObjSizePixel.Width() ),
988 [ # # # # ]: 0 : Fraction( aSize.Height(), aObjSizePixel.Height() ) );
[ # # ]
989 : : }
990 : :
991 : 0 : bInInnerResizePixel = sal_True;
992 [ # # ]: 0 : const sal_Bool bHScrollVisible = pHScrollbar->IsVisible(sal_True);
993 [ # # ]: 0 : const sal_Bool bVScrollVisible = pVScrollbar->IsVisible(sal_True);
994 : 0 : sal_Bool bRepeat = sal_False;
995 [ # # ]: 0 : do
996 : : {
997 : 0 : Size aSz( rSize );
998 : 0 : SvBorder aBorder;
999 [ # # ]: 0 : CalcAndSetBorderPixel( aBorder, sal_True );
1000 [ # # ][ # # ]: 0 : if ( GetViewFrame()->GetFrame().IsInPlace() )
[ # # ]
1001 : : {
1002 : 0 : Size aViewSize( aSz );
1003 : 0 : Point aViewPos( rOfst );
1004 : 0 : aViewSize.Height() -= (aBorder.Top() + aBorder.Bottom());
1005 : 0 : aViewSize.Width() -= (aBorder.Left() + aBorder.Right());
1006 : 0 : aViewPos.X() += aBorder.Left();
1007 : 0 : aViewPos.Y() += aBorder.Top();
1008 [ # # ]: 0 : GetEditWin().SetPosSizePixel( aViewPos, aViewSize );
1009 : : }
1010 : : else
1011 : : {
1012 : 0 : aSz.Height() += aBorder.Top() + aBorder.Bottom();
1013 : 0 : aSz.Width() += aBorder.Left() + aBorder.Right();
1014 : : }
1015 : :
1016 : 0 : Size aEditSz( GetEditWin().GetOutputSizePixel() );
1017 : 0 : ViewResizePixel( GetEditWin(), rOfst, aSz, aEditSz, sal_True, *pVScrollbar,
1018 : : *pHScrollbar, pPageUpBtn, pPageDownBtn,
1019 : : pNaviBtn,
1020 : : *pScrollFill, pVRuler, pHRuler,
1021 [ # # ][ # # ]: 0 : 0 != PTR_CAST(SwWebView, this),
1022 [ # # ][ # # ]: 0 : pWrtShell->GetViewOptions()->IsVRulerRight());
[ # # ][ # # ]
1023 [ # # ]: 0 : if ( bShowAtResize )
1024 [ # # ]: 0 : ShowAtResize();
1025 : :
1026 [ # # ][ # # ]: 0 : if( pHRuler->IsVisible() || pVRuler->IsVisible() )
[ # # ][ # # ]
[ # # ]
1027 : : {
1028 : 0 : const Fraction& rFrac = GetEditWin().GetMapMode().GetScaleX();
1029 : 0 : sal_uInt16 nZoom = 100;
1030 [ # # ]: 0 : if (0 != rFrac.GetDenominator())
1031 : 0 : nZoom = sal_uInt16(rFrac.GetNumerator() * 100L / rFrac.GetDenominator());
1032 : :
1033 [ # # ]: 0 : const Fraction aFrac( nZoom, 100 );
1034 [ # # ]: 0 : pVRuler->SetZoom( aFrac );
1035 [ # # ]: 0 : pHRuler->SetZoom( aFrac );
1036 [ # # ]: 0 : InvalidateRulerPos(); //Inhalt invalidieren.
1037 : : }
1038 : : //CursorStack zuruecksetzen, da die Cursorpositionen fuer PageUp/-Down
1039 : : //nicht mehr zum aktuell sichtbaren Bereich passen
1040 [ # # ]: 0 : pWrtShell->ResetCursorStack();
1041 : :
1042 : : //EditWin niemals einstellen!
1043 : :
1044 : : //VisArea einstellen, aber dort nicht das SetVisArea der DocShell rufen!
1045 : 0 : bProtectDocShellVisArea = sal_True;
1046 [ # # ]: 0 : CalcVisArea( aEditSz );
1047 : : //visibility changes of the automatic horizontal scrollbar
1048 : : //require to repeat the ViewResizePixel() call - but only once!
1049 [ # # ]: 0 : if(bRepeat)
1050 : 0 : bRepeat = sal_False;
1051 [ # # ][ # # ]: 0 : else if(bHScrollVisible != pHScrollbar->IsVisible(sal_True) ||
[ # # ][ # # ]
1052 [ # # ]: 0 : bVScrollVisible != pVScrollbar->IsVisible(sal_True))
1053 : 0 : bRepeat = sal_True;
1054 : : }while( bRepeat );
1055 : 0 : bProtectDocShellVisArea = sal_False;
1056 : 0 : bInInnerResizePixel = sal_False;
1057 : 0 : }
1058 : :
1059 : 3815 : void SwView::OuterResizePixel( const Point &rOfst, const Size &rSize )
1060 : : {
1061 : : // #i16909# return, if no size (caused by minimize window).
1062 [ + - ][ + + ]: 3815 : if ( bInOuterResizePixel || ( !rSize.Width() && !rSize.Height() ) )
[ + - ][ + + ]
1063 : 3815 : return;
1064 : 2862 : bInOuterResizePixel = sal_True;
1065 : :
1066 : : // feststellen, ob Scrollbars angezeigt werden duerfen
1067 : 2862 : sal_Bool bShowH = sal_True,
1068 : 2862 : bShowV = sal_True,
1069 : 2862 : bAuto = sal_True,
1070 : 2862 : bHAuto = sal_True;
1071 : :
1072 : 2862 : const SwViewOption *pVOpt = pWrtShell->GetViewOptions();
1073 [ - + ][ + + ]: 2862 : if ( !pVOpt->IsReadonly() || pVOpt->IsStarOneSetting() )
[ + + ]
1074 : : {
1075 : 2856 : bShowH = pVOpt->IsViewHScrollBar();
1076 : 2856 : bShowV = pVOpt->IsViewVScrollBar();
1077 : : }
1078 : :
1079 [ + - ]: 2862 : SwDocShell* pDocSh = GetDocShell();
1080 [ + - ]: 2862 : sal_Bool bIsPreview = pDocSh->IsPreview();
1081 [ - + ]: 2862 : if( bIsPreview )
1082 : : {
1083 : 0 : bShowH = bShowV = bHAuto = bAuto = sal_False;
1084 : : }
1085 [ + - ][ + + ]: 2862 : if(pHScrollbar->IsVisible(sal_False) != bShowH && !bHAuto)
[ - + ][ - + ]
1086 [ # # ]: 0 : ShowHScrollbar(bShowH);
1087 [ + - ]: 2862 : pHScrollbar->SetAuto( bHAuto );
1088 [ + - ][ + + ]: 2862 : if(pVScrollbar->IsVisible(sal_False) != bShowV && !bAuto)
[ - + ][ - + ]
1089 [ # # ]: 0 : ShowVScrollbar(bShowV);
1090 [ + - ]: 2862 : pVScrollbar->SetAuto(bAuto);
1091 : :
1092 [ + - ]: 2862 : SET_CURR_SHELL( pWrtShell );
1093 : 2862 : sal_Bool bRepeat = sal_False;
1094 : 2862 : long nCnt = 0;
1095 : :
1096 : 2862 : sal_Bool bUnLockView = !pWrtShell->IsViewLocked();
1097 : 2862 : pWrtShell->LockView( sal_True );
1098 [ + - ]: 2862 : pWrtShell->LockPaint();
1099 : :
1100 [ + + ]: 2873 : do {
1101 : 2873 : ++nCnt;
1102 [ + - ]: 2873 : const sal_Bool bScroll1 = pVScrollbar->IsVisible(sal_True);
1103 [ + - ]: 2873 : const sal_Bool bScroll2 = pHScrollbar->IsVisible(sal_True);
1104 : 2873 : SvBorder aBorder;
1105 [ + - ]: 2873 : CalcAndSetBorderPixel( aBorder, sal_False );
1106 : 2873 : const Size aEditSz( GetEditWin().GetOutputSizePixel() );
1107 : 2873 : ViewResizePixel( GetEditWin(), rOfst, rSize, aEditSz, sal_False, *pVScrollbar,
1108 : : *pHScrollbar, pPageUpBtn, pPageDownBtn,
1109 : : pNaviBtn,
1110 : : *pScrollFill, pVRuler, pHRuler,
1111 [ + - ][ + - ]: 2873 : 0 != PTR_CAST(SwWebView, this),
1112 [ + + ][ + - ]: 8619 : pWrtShell->GetViewOptions()->IsVRulerRight() );
[ + - ][ + - ]
1113 [ + + ]: 2873 : if ( bShowAtResize )
1114 [ + - ]: 1292 : ShowAtResize();
1115 : :
1116 [ + - ][ + + ]: 2873 : if( pHRuler->IsVisible() || pVRuler->IsVisible() )
[ + - ][ + + ]
[ + + ]
1117 [ + - ]: 2637 : InvalidateRulerPos(); //Inhalt invalidieren.
1118 : :
1119 : : //CursorStack zuruecksetzen, da die Cursorpositionen fuer PageUp/-Down
1120 : : //nicht mehr zum aktuell sichtbaren Bereich passen
1121 [ + - ]: 2873 : pWrtShell->ResetCursorStack();
1122 : :
1123 : : OSL_ENSURE( !GetEditWin().IsVisible() ||
1124 : : (( aEditSz.Width() > 0 && aEditSz.Height() > 0 )
1125 : : || !aVisArea.IsEmpty()), "Small world, isn't it?" );
1126 : :
1127 : : //EditWin niemals einstellen!
1128 : :
1129 : : //Die VisArea muss aber natuerlich eingestellt werden.
1130 : : //jetzt ist auch der richtige Zeitpunkt den Zoom neu zu berechnen wenn
1131 : : //es kein einfacher Faktor ist.
1132 [ + - ]: 2873 : pWrtShell->StartAction();
1133 [ + - ]: 2873 : CalcVisArea( aEditSz );
1134 : :
1135 : : //Damit auch beim outplace editing die Seitenbreite sofort
1136 : : //angepasst wird.
1137 : : //TODO/LATER: is that still necessary?!
1138 : : /*
1139 : : if ( pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
1140 : : pDocSh->SetVisArea(
1141 : : pDocSh->SfxInPlaceObject::GetVisArea() );*/
1142 [ + + + + ]: 3168 : if ( pWrtShell->GetViewOptions()->GetZoomType() != SVX_ZOOM_PERCENT &&
[ + + ]
1143 : 295 : !pWrtShell->GetViewOptions()->getBrowseMode() )
1144 [ + - ]: 3 : _SetZoom( aEditSz, (SvxZoomType)pWrtShell->GetViewOptions()->GetZoomType(), 100, sal_True );
1145 [ + - ]: 2873 : pWrtShell->EndAction();
1146 : :
1147 [ + - ]: 2873 : bRepeat = bScroll1 != pVScrollbar->IsVisible(sal_True);
1148 [ + + ]: 2873 : if ( !bRepeat )
1149 [ + - ]: 2867 : bRepeat = bScroll2 != pHScrollbar->IsVisible(sal_True);
1150 : :
1151 : : //Nicht endlosschleifen. Moeglichst dann stoppen wenn die
1152 : : //(Auto-)Scrollbars sichtbar sind.
1153 [ + + ][ + - ]: 2873 : if ( bRepeat &&
[ - + ][ # # ]
[ # # ]
1154 : : ( nCnt > 10 || ( nCnt > 3 && bHAuto && bAuto ) )
1155 : : )
1156 : : {
1157 : 0 : bRepeat = sal_False;
1158 : : }
1159 : :
1160 : : }while ( bRepeat );
1161 : :
1162 [ + - ][ + + ]: 2862 : if( pVScrollbar->IsVisible(sal_False) || pVScrollbar->IsAuto())
[ + - ][ + - ]
1163 : : {
1164 [ + - ]: 2862 : sal_Bool bShowButtons = pVScrollbar->IsVisible(sal_True);
1165 [ + - ][ + - ]: 2862 : if(pPageUpBtn && pPageUpBtn->IsVisible() != bShowButtons)
[ + + ][ + + ]
1166 : : {
1167 [ + - ]: 2 : pPageUpBtn->Show(bShowButtons);
1168 [ + - ]: 2 : if(pPageDownBtn)
1169 [ + - ]: 2 : pPageDownBtn->Show(bShowButtons);
1170 [ + - ]: 2 : if(pNaviBtn)
1171 [ + - ]: 2 : pNaviBtn->Show(bShowButtons);
1172 : : }
1173 : : }
1174 : :
1175 [ + - ]: 2862 : pWrtShell->UnlockPaint();
1176 [ + + ]: 2862 : if( bUnLockView )
1177 : 2839 : pWrtShell->LockView( sal_False );
1178 : :
1179 : 2862 : bInOuterResizePixel = sal_False;
1180 : :
1181 [ + - ]: 2862 : if ( mpPostItMgr )
1182 : : {
1183 [ + - ]: 2862 : mpPostItMgr->CalcRects();
1184 [ + - ]: 2862 : mpPostItMgr->LayoutPostIts();
1185 [ + - ]: 3815 : }
1186 : : }
1187 : :
1188 : 0 : void SwView::SetZoomFactor( const Fraction &rX, const Fraction &rY )
1189 : : {
1190 [ # # ]: 0 : const Fraction &rFrac = rX < rY ? rX : rY;
1191 [ # # ][ # # ]: 0 : SetZoom( SVX_ZOOM_PERCENT, (short) long(rFrac * Fraction( 100, 1 )) );
[ # # ]
1192 : :
1193 : : //Um Rundungsfehler zu minimieren lassen wir von der Basisklasse ggf.
1194 : : //auch die krummen Werte einstellen
1195 : 0 : SfxViewShell::SetZoomFactor( rX, rY );
1196 : 0 : }
1197 : :
1198 : 0 : Size SwView::GetOptimalSizePixel() const
1199 : : {
1200 : 0 : Size aPgSize;
1201 [ # # ]: 0 : if ( pWrtShell->GetViewOptions()->getBrowseMode() )
1202 [ # # ]: 0 : aPgSize = SvxPaperInfo::GetPaperSize(PAPER_A4);
1203 : : else
1204 : : {
1205 [ # # ]: 0 : aPgSize = GetWrtShell().GetAnyCurRect(RECT_PAGE).SSize();
1206 : 0 : aPgSize.Width() += DOCUMENTBORDER * 2;
1207 : :
1208 [ # # ][ # # ]: 0 : const SwPageDesc &rDesc = pWrtShell->GetPageDesc( pWrtShell->GetCurPageDesc() );
1209 [ # # ]: 0 : if( nsUseOnPage::PD_MIRROR == rDesc.GetUseOn() )
1210 : : {
1211 [ # # ]: 0 : const SvxLRSpaceItem &rLRSpace = rDesc.GetMaster().GetLRSpace();
1212 [ # # ]: 0 : const SvxLRSpaceItem &rLeftLRSpace = rDesc.GetLeft().GetLRSpace();
1213 : 0 : aPgSize.Width() += Abs( long(rLeftLRSpace.GetLeft()) - long(rLRSpace.GetLeft()) );
1214 : : }
1215 : : }
1216 [ # # ]: 0 : return GetEditWin().LogicToPixel( aPgSize );
1217 : : }
1218 : :
1219 : 5726 : sal_Bool SwView::UpdateScrollbars()
1220 : : {
1221 : 5726 : sal_Bool bRet = sal_False;
1222 [ + + ]: 5726 : if ( !aVisArea.IsEmpty() )
1223 : : {
1224 [ + - ]: 3090 : const sal_Bool bBorder = IsDocumentBorder();
1225 : 3090 : Rectangle aTmpRect( aVisArea );
1226 [ + + ]: 3090 : if ( bBorder )
1227 : : {
1228 : 54 : Point aPt( DOCUMENTBORDER, DOCUMENTBORDER );
1229 [ + - ]: 54 : aPt = AlignToPixel( aPt );
1230 [ + - ]: 54 : aTmpRect.Move( -aPt.X(), -aPt.Y() );
1231 : : }
1232 : :
1233 : 3090 : Size aTmpSz( aDocSz );
1234 [ + + ]: 3090 : const long lOfst = bBorder ? 0 : DOCUMENTBORDER * 2L;
1235 : 3090 : aTmpSz.Width() += lOfst; aTmpSz.Height() += lOfst;
1236 : :
1237 : : {
1238 [ + - ]: 3090 : const sal_Bool bVScrollVisible = pVScrollbar->IsVisible(sal_True);
1239 [ + - ]: 3090 : pVScrollbar->DocSzChgd( aTmpSz );
1240 [ + - ]: 3090 : pVScrollbar->ViewPortChgd( aTmpRect );
1241 : :
1242 [ + - ]: 3090 : sal_Bool bShowButtons = pVScrollbar->IsVisible(sal_True);
1243 [ + - ][ + - ]: 3090 : if(pPageUpBtn && pPageUpBtn->IsVisible() != bShowButtons)
[ + + ][ + + ]
1244 : : {
1245 [ + - ]: 2 : pPageUpBtn->Show(bShowButtons);
1246 [ + - ]: 2 : if(pPageDownBtn)
1247 [ + - ]: 2 : pPageDownBtn->Show(bShowButtons);
1248 [ + - ]: 2 : if(pNaviBtn)
1249 [ + - ]: 2 : pNaviBtn->Show(bShowButtons);
1250 : : }
1251 : :
1252 [ + - ][ + + ]: 3090 : if ( bVScrollVisible != pVScrollbar->IsVisible(sal_True) )
1253 : 44 : bRet = sal_True;
1254 : : }
1255 : : {
1256 [ + - ]: 3090 : const sal_Bool bHScrollVisible = pHScrollbar->IsVisible(sal_True);
1257 [ + - ]: 3090 : pHScrollbar->DocSzChgd( aTmpSz );
1258 [ + - ]: 3090 : pHScrollbar->ViewPortChgd( aTmpRect );
1259 [ + - ][ + + ]: 3090 : if ( bHScrollVisible != pHScrollbar->IsVisible(sal_True) )
1260 : 54 : bRet = sal_True;
1261 [ + - ][ + + ]: 3090 : pScrollFill->Show(pHScrollbar->IsVisible(sal_True) && pVScrollbar->IsVisible(sal_True) );
[ + - ][ + + ]
[ + - ]
1262 : : }
1263 : : }
1264 : 5726 : return bRet;
1265 : : }
1266 : :
1267 : 0 : void SwView::Move()
1268 : : {
1269 [ # # ]: 0 : if ( GetWrtShell().IsInSelect() )
1270 : 0 : GetWrtShell().EndSelect();
1271 : 0 : SfxViewShell::Move();
1272 : 0 : }
1273 : :
1274 : 0 : sal_Bool SwView::HandleWheelCommands( const CommandEvent& rCEvt )
1275 : : {
1276 : 0 : sal_Bool bOk = sal_False;
1277 : 0 : const CommandWheelData* pWData = rCEvt.GetWheelData();
1278 [ # # ][ # # ]: 0 : if( pWData && COMMAND_WHEEL_ZOOM == pWData->GetMode() )
[ # # ]
1279 : : {
1280 : 0 : long nFact = pWrtShell->GetViewOptions()->GetZoom();
1281 [ # # ]: 0 : if( 0L > pWData->GetDelta() )
1282 : 0 : nFact = Max( (long) 20, basegfx::zoomtools::zoomOut( nFact ));
1283 : : else
1284 : 0 : nFact = Min( (long) 600, basegfx::zoomtools::zoomIn( nFact ));
1285 : :
1286 : 0 : SetZoom( SVX_ZOOM_PERCENT, nFact );
1287 : 0 : bOk = sal_True;
1288 : : }
1289 : : else
1290 : : {
1291 [ # # ][ # # ]: 0 : if (pWData && (COMMAND_WHEEL_SCROLL==pWData->GetMode()) && (((sal_uLong)0xFFFFFFFF) == pWData->GetScrollLines()))
[ # # ][ # # ]
1292 : : {
1293 [ # # ]: 0 : if (pWData->GetDelta()<0)
1294 : 0 : PhyPageDown();
1295 : : else
1296 : 0 : PhyPageUp();
1297 : 0 : bOk = sal_True;
1298 : : }
1299 : : else
1300 : : bOk = pEditWin->HandleScrollCommand( rCEvt,
1301 : 0 : pHScrollbar, pVScrollbar);
1302 : : }
1303 : 0 : return bOk;
1304 : : }
1305 : :
1306 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|