xref: /trunk/main/sw/source/ui/uiview/viewmdi.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 
31 
32 
33 #include <string> // HACK: prevent conflict between STLPORT and Workshop headers
34 
35 #include "hintids.hxx"
36 #include <vcl/svapp.hxx>
37 #include <sfx2/dispatch.hxx>
38 #include <svx/ruler.hxx>
39 #include <editeng/lrspitem.hxx>
40 #include <svl/srchitem.hxx>
41 #include <sfx2/request.hxx>
42 #include <swmodule.hxx>
43 #ifndef _VIEW_HXX
44 #include <view.hxx>
45 #endif
46 #include <wrtsh.hxx>
47 #ifndef _DOCSH_HXX
48 #include <docsh.hxx>
49 #endif
50 #include <viewopt.hxx>
51 #include <frmatr.hxx>
52 #ifndef _WDOCSH_HXX
53 #include <wdocsh.hxx>
54 #endif
55 #include <uitool.hxx>
56 #include <edtwin.hxx>
57 #include <pagedesc.hxx>
58 #include <IMark.hxx>
59 #include <fldbas.hxx>
60 #include <workctrl.hxx>
61 #include <usrpref.hxx>
62 #include <scroll.hxx>
63 #ifndef _WVIEW_HXX
64 #include <wview.hxx>
65 #endif
66 
67 #ifndef _CMDID_H
68 #include <cmdid.h>
69 #endif
70 #ifndef _VIEW_HRC
71 #include <view.hrc>
72 #endif
73 #ifndef _RIBBAR_HRC
74 #include <ribbar.hrc>
75 #endif
76 #ifndef _HELPID_H
77 #include <helpid.h>
78 #endif
79 #ifndef _GLOBALS_HRC
80 #include <globals.hrc>
81 #endif
82 
83 #include <IDocumentSettingAccess.hxx>
84 #include <PostItMgr.hxx>
85 
86 sal_uInt16  SwView::nMoveType = NID_PGE;
87 sal_Int32 SwView::nActMark = 0;
88 
89 
90 #define VIEW_IMAGECOLOR COL_LIGHTBLUE
91 
92 using namespace ::com::sun::star::uno;
93 using namespace ::com::sun::star::frame;
94 
95 void SwView::SetZoom( SvxZoomType eZoomType, short nFactor, sal_Bool bViewOnly )
96 {
97     _SetZoom( GetEditWin().GetOutputSizePixel(), eZoomType, nFactor, bViewOnly );
98 }
99 
100 void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
101                         short nFactor, sal_Bool bViewOnly )
102 {
103     sal_Bool bUnLockView = !pWrtShell->IsViewLocked();
104     pWrtShell->LockView( sal_True );
105     pWrtShell->LockPaint();
106 
107     {
108     ACT_KONTEXT(pWrtShell);
109 
110     long nFac = nFactor;
111 
112     sal_Bool bWeb = 0 != PTR_CAST(SwWebView, this);
113     SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb);
114 
115     const SwPageDesc &rDesc = pWrtShell->GetPageDesc( pWrtShell->GetCurPageDesc() );
116     const SvxLRSpaceItem &rLRSpace = rDesc.GetMaster().GetLRSpace();
117     const SwViewOption *pOpt = pWrtShell->GetViewOptions();
118     long lLeftMargin = 0;
119 
120     if( eZoomType != SVX_ZOOM_PERCENT )
121     {
122         const bool bAutomaticViewLayout = 0 == pOpt->GetViewLayoutColumns();
123 
124         const SwRect aPageRect( pWrtShell->GetAnyCurRect( RECT_PAGE_CALC ) );
125         const SwRect aRootRect( pWrtShell->GetAnyCurRect( RECT_PAGES_AREA ) );
126         Size aPageSize( aPageRect.SSize() );
127         Size aRootSize( aRootRect.SSize() );
128 
129         //mod #i6193# added sidebar width
130         SwPostItMgr* pPostItMgr = GetPostItMgr();
131         if (pPostItMgr->HasNotes() && pPostItMgr->ShowNotes())
132             aPageSize.Width() += pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth();
133 
134         const MapMode aTmpMap( MAP_TWIP );
135         const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) );
136 
137         if( nsUseOnPage::PD_MIRROR == rDesc.GetUseOn() )    // gespiegelte Seiten
138         {
139             const SvxLRSpaceItem &rLeftLRSpace = rDesc.GetLeft().GetLRSpace();
140             aPageSize.Width() += Abs( long(rLeftLRSpace.GetLeft()) - long(rLRSpace.GetLeft()) );
141         }
142 
143         if( SVX_ZOOM_OPTIMAL == eZoomType )
144         {
145             if (pPostItMgr->HasNotes() && pPostItMgr->ShowNotes())
146             {
147                 lLeftMargin = long(rLRSpace.GetLeft()) + aPageRect.Left() + nLeftOfst;
148             }
149             else
150             {
151                 aPageSize.Width() -= ( rLRSpace.GetLeft() + rLRSpace.GetRight() + nLeftOfst * 2 );
152                 lLeftMargin = long(rLRSpace.GetLeft()) + aPageRect.Left() + nLeftOfst;
153             }
154             nFac = aWindowSize.Width() * 100 / aPageSize.Width();
155         }
156         else if(SVX_ZOOM_WHOLEPAGE == eZoomType || SVX_ZOOM_PAGEWIDTH == eZoomType )
157         {
158             const long nOf = DOCUMENTBORDER * 2L;
159             long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
160             nTmpWidth += nOf;
161             aPageSize.Height() += nOf;
162             nFac = aWindowSize.Width() * 100 / nTmpWidth;
163 
164             if ( SVX_ZOOM_WHOLEPAGE == eZoomType )
165             {
166                 long nVisPercent = aWindowSize.Height() * 100 / aPageSize.Height();
167                 nFac = Min( nFac, nVisPercent );
168             }
169         }
170         else /*if( SVX_ZOOM_PAGEWIDTH_NOBORDER == eZoomType )*/
171         {
172             const long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
173             nFac = aWindowSize.Width() * 100 / nTmpWidth;
174         }
175     }
176 
177     nFac = Max( long( MINZOOM ), nFac );
178 
179     SwViewOption aOpt( *pOpt );
180     if ( !GetViewFrame()->GetFrame().IsInPlace() )
181     {
182         //MasterUsrPrefs updaten UND DANACH die ViewOptions der aktuellen
183         //View updaten.
184         if ( !bViewOnly &&
185                 (sal_uInt16(nFac)      != pUsrPref->GetZoom() ||
186                 sal_uInt8  (eZoomType) != pUsrPref->GetZoomType()) )
187         {
188             pUsrPref->SetZoom    ( sal_uInt16(nFac) );
189             pUsrPref->SetZoomType( eZoomType );
190             SW_MOD()->ApplyUsrPref( *pUsrPref,
191                     bViewOnly ? this: 0,
192                     bViewOnly ? VIEWOPT_DEST_VIEW_ONLY : 0 );
193             pUsrPref->SetModified();
194         }
195         if ( pOpt->GetZoom() != (sal_uInt16) nFac )
196         {
197             aOpt.SetZoom    ( sal_uInt16(nFac) );
198             aOpt.SetReadonly(pOpt->IsReadonly());
199             pWrtShell->ApplyViewOptions( aOpt );
200         }
201         if ( eZoomType != SVX_ZOOM_PERCENT )
202         {
203             Point aPos;
204 
205             if ( eZoomType == SVX_ZOOM_WHOLEPAGE )
206                 aPos.Y() = pWrtShell->GetAnyCurRect(RECT_PAGE).Top() - DOCUMENTBORDER;
207             else
208             {
209                 //sicherstellen, dass sich der Cursor im sichtbaren
210                 //Bereich befindet, damit nur 1x gescrollt wird
211                 aPos.X() = lLeftMargin;
212                 const SwRect &rCharRect = pWrtShell->GetCharRect();
213                 if ( rCharRect.Top() > GetVisArea().Bottom() ||
214                     rCharRect.Bottom() < aPos.Y() )
215                     aPos.Y() = rCharRect.Top() - rCharRect.Height();
216                 else
217                     aPos.Y() = GetVisArea().Top();
218             }
219             SetVisArea( aPos );
220         }
221         // OS: Notloesung - in CalcVisArea wird u.U. wieder SetZoom gerufen und
222         // dann werden falsche Werte eingestellt
223         ((SwViewOption*)pWrtShell->GetViewOptions())->SetZoomType( eZoomType );
224         CalcVisArea( rEditSize );   //fuer das Neuberechnen des sichtbaren Bereiches
225     }
226     else if ( sal_uInt16(nFac) != pOpt->GetZoom() )
227     {
228         aOpt.SetZoom    ( sal_uInt16(nFac) );
229         pWrtShell->ApplyViewOptions( aOpt );
230     }
231 
232     const Fraction aFrac( nFac, 100 );
233     pVRuler->SetZoom( aFrac );
234     pVRuler->ForceUpdate();
235     pHRuler->SetZoom( aFrac );
236     pHRuler->ForceUpdate();
237     ((SwViewOption*)pWrtShell->GetViewOptions())->SetZoomType( eZoomType );
238     }
239     pWrtShell->UnlockPaint();
240     if( bUnLockView )
241         pWrtShell->LockView( sal_False );
242 
243 //    if ( mpPostItMgr )
244 //    {
245 //        mpPostItMgr->Rescale();
246 //        mpPostItMgr->CalcRects();
247 //        mpPostItMgr->LayoutPostIts();
248 //    }
249 
250 //  eZoom = eZoomType;
251 }
252 
253 void SwView::SetViewLayout( sal_uInt16 nColumns, bool bBookMode, sal_Bool bViewOnly )
254 {
255     const sal_Bool bUnLockView = !pWrtShell->IsViewLocked();
256     pWrtShell->LockView( sal_True );
257     pWrtShell->LockPaint();
258 
259     {
260 
261     ACT_KONTEXT(pWrtShell);
262 
263     if ( !GetViewFrame()->GetFrame().IsInPlace() && !bViewOnly )
264     {
265         const sal_Bool bWeb = 0 != PTR_CAST(SwWebView, this);
266         SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb);
267 
268         //MasterUsrPrefs updaten UND DANACH die ViewOptions der aktuellen
269         //View updaten.
270         if ( nColumns  != pUsrPref->GetViewLayoutColumns() ||
271              bBookMode != pUsrPref->IsViewLayoutBookMode() )
272         {
273             pUsrPref->SetViewLayoutColumns( nColumns );
274             pUsrPref->SetViewLayoutBookMode( bBookMode );
275             SW_MOD()->ApplyUsrPref( *pUsrPref,
276                     bViewOnly ? this: 0,
277                     bViewOnly ? VIEWOPT_DEST_VIEW_ONLY : 0 );
278             pUsrPref->SetModified();
279         }
280     }
281 
282     const SwViewOption *pOpt = pWrtShell->GetViewOptions();
283 
284     if ( nColumns  != pOpt->GetViewLayoutColumns() ||
285          bBookMode != pOpt->IsViewLayoutBookMode() )
286     {
287         SwViewOption aOpt( *pOpt );
288         aOpt.SetViewLayoutColumns( nColumns );
289         aOpt.SetViewLayoutBookMode( bBookMode );
290         pWrtShell->ApplyViewOptions( aOpt );
291     }
292 
293     pVRuler->ForceUpdate();
294     pHRuler->ForceUpdate();
295 
296     }
297 
298     pWrtShell->UnlockPaint();
299     if( bUnLockView )
300         pWrtShell->LockView( sal_False );
301 
302     SfxBindings& rBnd = GetViewFrame()->GetBindings();
303     rBnd.Invalidate( SID_ATTR_VIEWLAYOUT );
304     rBnd.Invalidate( SID_ATTR_ZOOMSLIDER);
305 }
306 
307 /*
308  * Scrollbar - Handler
309  */
310 
311 int SwView::_CreateScrollbar( sal_Bool bHori )
312 {
313     Window *pMDI = &GetViewFrame()->GetWindow();
314     SwScrollbar** ppScrollbar = bHori ? &pHScrollbar : &pVScrollbar;
315 
316     ASSERT( !*ppScrollbar, "vorher abpruefen!" )
317 
318     if( !bHori )
319         CreatePageButtons( !bShowAtResize );
320 
321     *ppScrollbar = new SwScrollbar( pMDI, bHori );
322     UpdateScrollbars();
323     if(bHori)
324         (*ppScrollbar)->SetScrollHdl( LINK( this, SwView, EndScrollHdl ));
325     else
326         (*ppScrollbar)->SetScrollHdl( LINK( this, SwView, ScrollHdl ));
327     (*ppScrollbar)->SetEndScrollHdl( LINK( this, SwView, EndScrollHdl ));
328 
329     (*ppScrollbar)->EnableDrag( sal_True );
330 
331     if(GetWindow())
332         InvalidateBorder();
333 
334     // Scrollbar muss nochmals getestet werden, da im InvalidateBorder u.U. der
335     // Scrollbar wieder geloescht wurde
336     if ( !bShowAtResize && (*ppScrollbar))
337         (*ppScrollbar)->ExtendedShow();
338 
339     return 1;
340 }
341 
342 void SwView::CreatePageButtons(sal_Bool bShow)
343 {
344     Window *pMDI = &GetViewFrame()->GetWindow();
345     pPageUpBtn      = new SwHlpImageButton(pMDI, SW_RES( BTN_PAGEUP ), sal_True );
346     pPageUpBtn->SetHelpId(HID_SCRL_PAGEUP);
347     pPageDownBtn    = new SwHlpImageButton(pMDI, SW_RES( BTN_PAGEDOWN ), sal_False );
348     pPageDownBtn->SetHelpId(HID_SCRL_PAGEDOWN);
349     Reference< XFrame > xFrame = GetViewFrame()->GetFrame().GetFrameInterface();
350     pNaviBtn = new SwNaviImageButton(pMDI, xFrame );
351     pNaviBtn->SetHelpId(HID_SCRL_NAVI);
352     Link aLk( LINK( this, SwView, BtnPage ) );
353     pPageUpBtn->SetClickHdl( aLk );
354     pPageDownBtn->SetClickHdl( aLk );
355     if(nMoveType != NID_PGE)
356     {
357         Color aColor(VIEW_IMAGECOLOR);
358         SetImageButtonColor(aColor);
359     }
360 
361     if(bShow)
362     {
363         pPageUpBtn->Show();
364         pPageDownBtn->Show();
365         pNaviBtn->Show();
366     }
367 };
368 
369 /*
370  * Button-Handler
371  */
372 IMPL_LINK( SwView, BtnPage, Button *, pButton )
373 {
374     // #i75416# move the execution of the search to an asynchronously called static link
375     bool* pbNext = new bool( (pButton == pPageDownBtn) );
376     Application::PostUserEvent( STATIC_LINK(this, SwView, MoveNavigationHdl), pbNext );
377     return 0;
378 }
379 /*-----------------20.06.97 10:46-------------------
380 
381 --------------------------------------------------*/
382 IMPL_STATIC_LINK( SwView, MoveNavigationHdl, bool *, pbNext )
383 {
384     if ( !pbNext )
385         return 0;
386     bool bNext = *pbNext;
387     SwWrtShell& rSh = pThis->GetWrtShell();
388     switch( nMoveType )
389     {
390         case NID_PGE:
391             bNext ? pThis->PhyPageDown() : pThis->PhyPageUp();
392         break;
393         case NID_TBL :
394             rSh.EnterStdMode();
395             if(bNext)
396                 rSh.MoveTable(fnTableNext, fnTableStart);
397             else
398                 rSh.MoveTable(fnTablePrev, fnTableStart);
399         break;
400         case NID_FRM :
401         case NID_GRF:
402         case NID_OLE:
403         {
404             sal_uInt16 eType = GOTOOBJ_FLY_FRM;
405             if(nMoveType == NID_GRF)
406                 eType = GOTOOBJ_FLY_GRF;
407             else if(nMoveType == NID_OLE)
408                 eType = GOTOOBJ_FLY_OLE;
409             sal_Bool bSuccess = bNext ?
410                     rSh.GotoNextFly(eType) :
411                         rSh.GotoPrevFly(eType);
412             if(bSuccess)
413             {
414                 rSh.HideCrsr();
415                 rSh.EnterSelFrmMode();
416             }
417         }
418         break;
419         case NID_DRW :
420         case NID_CTRL:
421             rSh.GotoObj(bNext,
422                     nMoveType == NID_DRW ?
423                         GOTOOBJ_DRAW_SIMPLE :
424                         GOTOOBJ_DRAW_CONTROL);
425         break;
426         case NID_REG :
427             rSh.EnterStdMode();
428             if(bNext)
429                 rSh.MoveRegion(fnRegionNext, fnRegionStart);
430             else
431                 rSh.MoveRegion(fnRegionPrev, fnRegionStart);
432 
433         break;
434         case NID_BKM :
435             rSh.EnterStdMode();
436             pThis->GetViewFrame()->GetDispatcher()->Execute(bNext ?
437                                         FN_NEXT_BOOKMARK :
438                                             FN_PREV_BOOKMARK);
439         break;
440         case NID_OUTL:
441             rSh.EnterStdMode();
442             bNext ? rSh.GotoNextOutline() : rSh.GotoPrevOutline();
443         break;
444         case NID_SEL :
445             bNext ? rSh.GoNextCrsr() : rSh.GoPrevCrsr();
446         break;
447         case NID_FTN:
448             rSh.EnterStdMode();
449             bNext ?
450                 rSh.GotoNextFtnAnchor() :
451                     rSh.GotoPrevFtnAnchor();
452         break;
453         case NID_MARK:
454         {
455             // unselect
456             rSh.MoveCrsr();
457             rSh.EnterStdMode();
458 
459             // collect navigator reminders
460             IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
461             ::std::vector< const ::sw::mark::IMark* > vNavMarks;
462             for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
463                 ppMark != pMarkAccess->getMarksEnd();
464                 ppMark++)
465             {
466                 if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::NAVIGATOR_REMINDER )
467                     vNavMarks.push_back(ppMark->get());
468             }
469 
470             // move
471             if(vNavMarks.size())
472             {
473                 if(bNext)
474                 {
475                     nActMark++;
476                     if (nActMark >= MAX_MARKS || nActMark >= static_cast<sal_Int32>(vNavMarks.size()))
477                         nActMark = 0;
478                 }
479                 else
480                 {
481                     nActMark--;
482                     if (nActMark < 0 || nActMark >= static_cast<sal_Int32>(vNavMarks.size()))
483                         nActMark = vNavMarks.size()-1;
484                 }
485                 rSh.GotoMark(vNavMarks[nActMark]);
486             }
487         }
488         break;
489         case NID_POSTIT:
490         {
491             sw::sidebarwindows::SwSidebarWin* pPostIt = pThis->GetPostItMgr()->GetActiveSidebarWin();
492             if (pPostIt)
493                 pThis->GetPostItMgr()->SetActiveSidebarWin(0);
494             SwFieldType* pFldType = rSh.GetFldType(0, RES_POSTITFLD);
495             if (rSh.MoveFldType(pFldType, bNext))
496                 pThis->GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
497             else
498                 //first/last item
499                 pThis->GetPostItMgr()->SetActiveSidebarWin(pPostIt);
500         }
501         break;
502         case NID_SRCH_REP:
503         if(pSrchItem)
504         {
505             sal_Bool bBackward = pSrchItem->GetBackward();
506             if(rSh.HasSelection() && !bNext == rSh.IsCrsrPtAtEnd())
507                 rSh.SwapPam();
508             pSrchItem->SetBackward(!bNext);
509             SfxRequest aReq(FN_REPEAT_SEARCH, SFX_CALLMODE_SLOT, pThis->GetPool());
510             pThis->ExecSearch(aReq);
511             pSrchItem->SetBackward(bBackward);
512         }
513         break;
514         case NID_INDEX_ENTRY:
515             rSh.GotoNxtPrvTOXMark(bNext);
516         break;
517 
518         case NID_TABLE_FORMULA:
519             rSh.GotoNxtPrvTblFormula( bNext );
520             break;
521 
522         case NID_TABLE_FORMULA_ERROR:
523             rSh.GotoNxtPrvTblFormula( bNext, sal_True );
524             break;
525     }
526     pThis->pEditWin->GrabFocus();
527     delete pbNext;
528     return 0;
529 }
530 
531 /*************************************************************************
532 |*
533 |*  SwView::CreateTab()
534 |*
535 |*  Beschreibung
536 |*  Ersterstellung      VB 29.05.91
537 |*  Letzte Aenderung    OS 09.05.96
538 |*
539 *************************************************************************/
540 
541 int SwView::CreateTab()
542 {
543     pHRuler->SetActive(GetFrame() && IsActive());
544 
545     pHRuler->Show();
546     InvalidateBorder();
547     return 1;
548 }
549 
550 /*************************************************************************
551 |*
552 |*  SwView::KillTab()
553 |*
554 |*  Beschreibung
555 |*  Ersterstellung      VB 29.05.91
556 |*  Letzte Aenderung    OS 09.05.96
557 |*
558 *************************************************************************/
559 
560 int SwView::KillTab()
561 {
562     pHRuler->Hide();
563     InvalidateBorder();
564     return 1;
565 }
566 
567 void SwView::ChangeTabMetric( FieldUnit eUnit )
568 {
569     if(pHRuler->GetUnit() != eUnit )
570     {
571         pHRuler->SetUnit( eUnit );
572         pHRuler->Invalidate();
573     }
574 }
575 
576 void SwView::ChangeVLinealMetric( FieldUnit eUnit )
577 {
578     if(pVRuler->GetUnit() != eUnit)
579     {
580         pVRuler->SetUnit( eUnit );
581         pVRuler->Invalidate();
582     }
583 }
584 /* -----------------------------07.04.01 17:09--------------------------------
585 
586  ---------------------------------------------------------------------------*/
587 void SwView::GetVLinealMetric(FieldUnit& eToFill) const
588 {
589     eToFill = pVRuler->GetUnit();
590 }
591 /* -----------------------------07.04.01 17:09--------------------------------
592 
593  ---------------------------------------------------------------------------*/
594 void SwView::GetHLinealMetric(FieldUnit& eToFill) const
595 {
596     eToFill = pHRuler->GetUnit();
597 }
598 /*************************************************************************
599 |*
600 |*  SwView::CreateVLineal()
601 |*
602 |*  Beschreibung
603 |*  Ersterstellung  VB 29.05.91
604 |*
605 *************************************************************************/
606 
607 int SwView::CreateVLineal()
608 {
609     pHRuler->SetBorderPos( pVRuler->GetSizePixel().Width()-1 );
610 
611     pVRuler->SetActive(GetFrame() && IsActive());
612     pVRuler->Show();
613     InvalidateBorder();
614     return 1;
615 }
616 
617 /*************************************************************************
618 |*
619 |*  SwView::KillVLineal()
620 |*
621 |*  Beschreibung
622 |*  Ersterstellung  VB 29.05.91
623 |*
624 *************************************************************************/
625 
626 int SwView::KillVLineal()
627 {
628     pVRuler->Hide();
629     pHRuler->SetBorderPos( 0 );
630     InvalidateBorder();
631     return 1;
632 }
633 /*************************************************************************
634 |*
635 |*  SwView::ExecRulerClick()
636 |*
637 |*  Beschreibung
638 |*  Ersterstellung  OS 15.06.95
639 |*  Letzte Aenderung
640 |*
641 *************************************************************************/
642 
643 IMPL_LINK( SwView, ExecRulerClick, Ruler *, pRuler )
644 {
645     sal_uInt16 nDefPage = 0;
646     switch( pRuler->GetClickType() )
647     {
648         case RULER_TYPE_DONTKNOW:
649         case RULER_TYPE_OUTSIDE:
650         case RULER_TYPE_INDENT:
651         case RULER_TYPE_MARGIN1:
652         case RULER_TYPE_MARGIN2:
653             nDefPage = TP_PARA_STD;
654         break;
655         default:
656             nDefPage = TP_TABULATOR;
657 
658     }
659 
660     SfxUInt16Item aDefPage(SID_PARA_DLG, nDefPage);
661     GetViewFrame()->GetDispatcher()->Execute( SID_PARA_DLG,
662                                 SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
663                                 &aDefPage, 0L );
664     return 0;
665 }
666 
667 
668 /*-----------------20.02.97 09:11-------------------
669 
670 --------------------------------------------------*/
671 
672 sal_uInt16 SwView::GetMoveType()
673 {
674     return nMoveType;
675 }
676 /*-----------------20.02.97 09:11-------------------
677 
678 --------------------------------------------------*/
679 
680 void SwView::SetMoveType(sal_uInt16 nSet)
681 {
682     sal_Bool bLastPage = nMoveType == NID_PGE;
683     nMoveType = nSet;
684     sal_Bool bNewPage = nMoveType == NID_PGE;
685     if(bNewPage != bLastPage)
686     {
687         Color aColor(bNewPage ? COL_BLACK : VIEW_IMAGECOLOR);
688         const TypeId aTypeId = TYPE(SwView);
689         SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId);
690         while( pView )
691         {
692             pView->SetImageButtonColor(aColor);
693             pView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId);
694         }
695     }
696 }
697 
698 /*-----------------20.06.97 11:18-------------------
699 
700 --------------------------------------------------*/
701 void SwView::SetActMark(sal_Int32 nSet)
702 {
703     nActMark = nSet;
704 }
705 
706 /*-----------------15.03.97 10:53-------------------
707 
708 --------------------------------------------------*/
709 
710 void SwView::SetImageButtonColor(Color& rColor)
711 {
712     if(pPageUpBtn)
713     {
714         pPageUpBtn->SetControlForeground(rColor);
715         pPageDownBtn->SetControlForeground(rColor);
716     }
717 }
718 /* -----------------------------2002/06/26 13:57------------------------------
719 
720  ---------------------------------------------------------------------------*/
721 void SwView::ShowHScrollbar(sal_Bool bShow)
722 {
723     DBG_ASSERT(pHScrollbar, "Scrollbar invalid");
724     pHScrollbar->ExtendedShow(bShow);
725 }
726 /* -----------------------------2002/06/26 13:57------------------------------
727 
728  ---------------------------------------------------------------------------*/
729 sal_Bool SwView::IsHScrollbarVisible()const
730 {
731     DBG_ASSERT(pHScrollbar, "Scrollbar invalid");
732     return pHScrollbar->IsVisible( sal_False ) || pHScrollbar->IsAuto();
733 }
734 /* -----------------------------2002/06/26 13:57------------------------------
735 
736  ---------------------------------------------------------------------------*/
737 void SwView::ShowVScrollbar(sal_Bool bShow)
738 {
739     DBG_ASSERT(pVScrollbar, "Scrollbar invalid");
740     pVScrollbar->ExtendedShow(bShow);
741     pPageUpBtn->Show(bShow);
742     pPageDownBtn->Show(bShow);
743     pNaviBtn->Show(bShow);
744 }
745 /* -----------------------------2002/06/26 13:57------------------------------
746 
747  ---------------------------------------------------------------------------*/
748 sal_Bool SwView::IsVScrollbarVisible()const
749 {
750     DBG_ASSERT(pVScrollbar, "Scrollbar invalid");
751     return pVScrollbar->IsVisible( sal_False );
752 }
753 
754 
755