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 91 void SwView::SetZoom( SvxZoomType eZoomType, short nFactor, sal_Bool bViewOnly ) 92 { 93 _SetZoom( GetEditWin().GetOutputSizePixel(), eZoomType, nFactor, bViewOnly ); 94 } 95 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 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 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 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 */ 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 --------------------------------------------------*/ 378 IMPL_STATIC_LINK( SwView, MoveNavigationHdl, bool *, pbNext ) 379 { 380 if ( !pbNext ) 381 return 0; 382 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->getMarksBegin(); 459 ppMark != pMarkAccess->getMarksEnd(); 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 case NID_POSTIT: 486 { 487 sw::sidebarwindows::SwSidebarWin* pPostIt = pThis->GetPostItMgr()->GetActiveSidebarWin(); 488 if (pPostIt) 489 pThis->GetPostItMgr()->SetActiveSidebarWin(0); 490 SwFieldType* pFldType = rSh.GetFldType(0, RES_POSTITFLD); 491 if (rSh.MoveFldType(pFldType, bNext)) 492 pThis->GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT); 493 else 494 //first/last item 495 pThis->GetPostItMgr()->SetActiveSidebarWin(pPostIt); 496 } 497 break; 498 case NID_SRCH_REP: 499 if(pSrchItem) 500 { 501 sal_Bool bBackward = pSrchItem->GetBackward(); 502 if(rSh.HasSelection() && !bNext == rSh.IsCrsrPtAtEnd()) 503 rSh.SwapPam(); 504 pSrchItem->SetBackward(!bNext); 505 SfxRequest aReq(FN_REPEAT_SEARCH, SFX_CALLMODE_SLOT, pThis->GetPool()); 506 pThis->ExecSearch(aReq); 507 pSrchItem->SetBackward(bBackward); 508 } 509 break; 510 case NID_INDEX_ENTRY: 511 rSh.GotoNxtPrvTOXMark(bNext); 512 break; 513 514 case NID_TABLE_FORMULA: 515 rSh.GotoNxtPrvTblFormula( bNext ); 516 break; 517 518 case NID_TABLE_FORMULA_ERROR: 519 rSh.GotoNxtPrvTblFormula( bNext, sal_True ); 520 break; 521 } 522 pThis->pEditWin->GrabFocus(); 523 delete pbNext; 524 return 0; 525 } 526 527 /************************************************************************* 528 |* 529 |* SwView::CreateTab() 530 |* 531 |* Beschreibung 532 |* Ersterstellung VB 29.05.91 533 |* Letzte Aenderung OS 09.05.96 534 |* 535 *************************************************************************/ 536 537 int SwView::CreateTab() 538 { 539 pHRuler->SetActive(GetFrame() && IsActive()); 540 541 pHRuler->Show(); 542 InvalidateBorder(); 543 return 1; 544 } 545 546 /************************************************************************* 547 |* 548 |* SwView::KillTab() 549 |* 550 |* Beschreibung 551 |* Ersterstellung VB 29.05.91 552 |* Letzte Aenderung OS 09.05.96 553 |* 554 *************************************************************************/ 555 556 int SwView::KillTab() 557 { 558 pHRuler->Hide(); 559 InvalidateBorder(); 560 return 1; 561 } 562 563 void SwView::ChangeTabMetric( FieldUnit eUnit ) 564 { 565 if(pHRuler->GetUnit() != eUnit ) 566 { 567 pHRuler->SetUnit( eUnit ); 568 pHRuler->Invalidate(); 569 } 570 } 571 572 void SwView::ChangeVLinealMetric( FieldUnit eUnit ) 573 { 574 if(pVRuler->GetUnit() != eUnit) 575 { 576 pVRuler->SetUnit( eUnit ); 577 pVRuler->Invalidate(); 578 } 579 } 580 /* -----------------------------07.04.01 17:09-------------------------------- 581 582 ---------------------------------------------------------------------------*/ 583 void SwView::GetVLinealMetric(FieldUnit& eToFill) const 584 { 585 eToFill = pVRuler->GetUnit(); 586 } 587 /* -----------------------------07.04.01 17:09-------------------------------- 588 589 ---------------------------------------------------------------------------*/ 590 void SwView::GetHLinealMetric(FieldUnit& eToFill) const 591 { 592 eToFill = pHRuler->GetUnit(); 593 } 594 /************************************************************************* 595 |* 596 |* SwView::CreateVLineal() 597 |* 598 |* Beschreibung 599 |* Ersterstellung VB 29.05.91 600 |* 601 *************************************************************************/ 602 603 int SwView::CreateVLineal() 604 { 605 pHRuler->SetBorderPos( pVRuler->GetSizePixel().Width()-1 ); 606 607 pVRuler->SetActive(GetFrame() && IsActive()); 608 pVRuler->Show(); 609 InvalidateBorder(); 610 return 1; 611 } 612 613 /************************************************************************* 614 |* 615 |* SwView::KillVLineal() 616 |* 617 |* Beschreibung 618 |* Ersterstellung VB 29.05.91 619 |* 620 *************************************************************************/ 621 622 int SwView::KillVLineal() 623 { 624 pVRuler->Hide(); 625 pHRuler->SetBorderPos( 0 ); 626 InvalidateBorder(); 627 return 1; 628 } 629 /************************************************************************* 630 |* 631 |* SwView::ExecRulerClick() 632 |* 633 |* Beschreibung 634 |* Ersterstellung OS 15.06.95 635 |* Letzte Aenderung 636 |* 637 *************************************************************************/ 638 639 IMPL_LINK( SwView, ExecRulerClick, Ruler *, pRuler ) 640 { 641 sal_uInt16 nDefPage = 0; 642 switch( pRuler->GetClickType() ) 643 { 644 case RULER_TYPE_DONTKNOW: 645 case RULER_TYPE_OUTSIDE: 646 case RULER_TYPE_INDENT: 647 case RULER_TYPE_MARGIN1: 648 case RULER_TYPE_MARGIN2: 649 nDefPage = TP_PARA_STD; 650 break; 651 default: 652 nDefPage = TP_TABULATOR; 653 654 } 655 656 SfxUInt16Item aDefPage(SID_PARA_DLG, nDefPage); 657 GetViewFrame()->GetDispatcher()->Execute( SID_PARA_DLG, 658 SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, 659 &aDefPage, 0L ); 660 return 0; 661 } 662 663 664 /*-----------------20.02.97 09:11------------------- 665 666 --------------------------------------------------*/ 667 668 sal_uInt16 SwView::GetMoveType() 669 { 670 return nMoveType; 671 } 672 /*-----------------20.02.97 09:11------------------- 673 674 --------------------------------------------------*/ 675 676 void SwView::SetMoveType(sal_uInt16 nSet) 677 { 678 sal_Bool bLastPage = nMoveType == NID_PGE; 679 nMoveType = nSet; 680 sal_Bool bNewPage = nMoveType == NID_PGE; 681 if(bNewPage != bLastPage) 682 { 683 Color aColor(bNewPage ? COL_BLACK : VIEW_IMAGECOLOR); 684 const TypeId aTypeId = TYPE(SwView); 685 SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId); 686 while( pView ) 687 { 688 pView->SetImageButtonColor(aColor); 689 pView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId); 690 } 691 } 692 } 693 694 /*-----------------20.06.97 11:18------------------- 695 696 --------------------------------------------------*/ 697 void SwView::SetActMark(sal_Int32 nSet) 698 { 699 nActMark = nSet; 700 } 701 702 /*-----------------15.03.97 10:53------------------- 703 704 --------------------------------------------------*/ 705 706 void SwView::SetImageButtonColor(Color& rColor) 707 { 708 if(pPageUpBtn) 709 { 710 pPageUpBtn->SetControlForeground(rColor); 711 pPageDownBtn->SetControlForeground(rColor); 712 } 713 } 714 /* -----------------------------2002/06/26 13:57------------------------------ 715 716 ---------------------------------------------------------------------------*/ 717 void SwView::ShowHScrollbar(sal_Bool bShow) 718 { 719 DBG_ASSERT(pHScrollbar, "Scrollbar invalid"); 720 pHScrollbar->ExtendedShow(bShow); 721 } 722 /* -----------------------------2002/06/26 13:57------------------------------ 723 724 ---------------------------------------------------------------------------*/ 725 sal_Bool SwView::IsHScrollbarVisible()const 726 { 727 DBG_ASSERT(pHScrollbar, "Scrollbar invalid"); 728 return pHScrollbar->IsVisible( sal_False ) || pHScrollbar->IsAuto(); 729 } 730 /* -----------------------------2002/06/26 13:57------------------------------ 731 732 ---------------------------------------------------------------------------*/ 733 void SwView::ShowVScrollbar(sal_Bool bShow) 734 { 735 DBG_ASSERT(pVScrollbar, "Scrollbar invalid"); 736 pVScrollbar->ExtendedShow(bShow); 737 pPageUpBtn->Show(bShow); 738 pPageDownBtn->Show(bShow); 739 pNaviBtn->Show(bShow); 740 } 741 /* -----------------------------2002/06/26 13:57------------------------------ 742 743 ---------------------------------------------------------------------------*/ 744 sal_Bool SwView::IsVScrollbarVisible()const 745 { 746 DBG_ASSERT(pVScrollbar, "Scrollbar invalid"); 747 return pVScrollbar->IsVisible( sal_False ); 748 } 749 750 751