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