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