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_sd.hxx" 26 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp> 27 #include <com/sun/star/linguistic2/XSpellChecker1.hpp> 28 29 #include "View.hxx" 30 #include <editeng/unolingu.hxx> 31 #include <sfx2/request.hxx> 32 #include <svx/obj3d.hxx> 33 #include <svx/fmview.hxx> 34 #include <editeng/outliner.hxx> 35 #ifndef _SVX_SVXIDS_HRC 36 #include <svx/svxids.hrc> 37 #endif 38 #include <svx/svdograf.hxx> 39 #include <svx/svdoole2.hxx> 40 #include <svx/svdundo.hxx> 41 #include <vcl/msgbox.hxx> 42 #include <sfx2/dispatch.hxx> 43 #include <sfx2/app.hxx> 44 #include <svx/svdpagv.hxx> 45 #include <sfx2/docfile.hxx> 46 #include <svx/svdoutl.hxx> 47 #include <svx/sdr/contact/displayinfo.hxx> 48 49 #include <svx/svdetc.hxx> 50 #include <editeng/editstat.hxx> 51 52 #include <svx/dialogs.hrc> 53 #include <sfx2/viewfrm.hxx> 54 #include <sfx2/sidebar/EnumContext.hxx> 55 #include <svx/svdopage.hxx> 56 #include <toolkit/helper/vclunohelper.hxx> 57 #include <svx/xlndsit.hxx> 58 #include <svx/xlineit0.hxx> 59 #include <svx/xlnclit.hxx> 60 #include <svx/sidebar/ContextChangeEventMultiplexer.hxx> 61 #include <vcl/virdev.hxx> 62 63 #include "app.hrc" 64 #include "strings.hrc" 65 #include "Window.hxx" 66 #include "Client.hxx" 67 #include "drawdoc.hxx" 68 #include "DrawDocShell.hxx" 69 #include "app.hxx" 70 #include "sdpage.hxx" 71 #include "glob.hrc" 72 #include "sdresid.hxx" 73 #include "DrawViewShell.hxx" 74 #include "futext.hxx" 75 #include "fuinsfil.hxx" 76 #include "slideshow.hxx" 77 #include "stlpool.hxx" 78 #include "FrameView.hxx" 79 #include "ViewClipboard.hxx" 80 #include "undo/undomanager.hxx" 81 #include <svx/sdr/contact/viewobjectcontact.hxx> 82 #include <svx/sdr/contact/viewcontact.hxx> 83 #include <svx/sdr/contact/displayinfo.hxx> 84 #include "EventMultiplexer.hxx" 85 #include "ViewShellBase.hxx" 86 #include "ViewShellManager.hxx" 87 88 #include <basegfx/polygon/b2dpolygontools.hxx> 89 #include <basegfx/color/bcolor.hxx> 90 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> 91 #include <drawinglayer/primitive2d/textlayoutdevice.hxx> 92 #include <drawinglayer/primitive2d/groupprimitive2d.hxx> 93 #include <svx/sdr/contact/objectcontact.hxx> 94 #include <basegfx/matrix/b2dhommatrix.hxx> 95 #include <drawinglayer/primitive2d/textprimitive2d.hxx> 96 #include <svx/unoapi.hxx> 97 #include <basegfx/matrix/b2dhommatrixtools.hxx> 98 99 #include <numeric> 100 101 using namespace com::sun::star; 102 using namespace com::sun::star::uno; 103 namespace sd { 104 105 #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED 106 #define SO2_DECL_SVINPLACEOBJECT_DEFINED 107 SO2_DECL_REF(SvInPlaceObject) 108 #endif 109 110 TYPEINIT1(View, FmFormView); 111 112 /************************************************************************* 113 |* 114 |* Ctor 115 |* 116 \************************************************************************/ 117 118 View::View(SdDrawDocument* pDrawDoc, OutputDevice* pOutDev, 119 ViewShell* pViewShell) 120 : FmFormView(pDrawDoc, pOutDev), 121 mpDoc(pDrawDoc), 122 mpDocSh( pDrawDoc->GetDocSh() ), 123 mpViewSh(pViewShell), 124 mpDragSrcMarkList(NULL), 125 mpDropMarkerObj(NULL), 126 mpDropMarker(NULL), 127 mnDragSrcPgNum(SDRPAGE_NOTFOUND), 128 mnAction(DND_ACTION_NONE), 129 mnLockRedrawSmph(0), 130 mpLockedRedraws(NULL), 131 mbIsDropAllowed(sal_True), 132 maSmartTags(*this), 133 mpClipboard (new ViewClipboard (*this)) 134 { 135 // #i73602# Use default from the configuration 136 SetBufferedOverlayAllowed(getOptionsDrawinglayer().IsOverlayBuffer_DrawImpress()); 137 138 // #i74769#, #i75172# Use default from the configuration 139 SetBufferedOutputAllowed(getOptionsDrawinglayer().IsPaintBuffer_DrawImpress()); 140 141 EnableExtendedKeyInputDispatcher(sal_False); 142 EnableExtendedMouseEventDispatcher(sal_False); 143 EnableExtendedCommandEventDispatcher(sal_False); 144 145 SetUseIncompatiblePathCreateInterface(sal_False); 146 SetMarkHdlWhenTextEdit(sal_True); 147 EnableTextEditOnObjectsWithoutTextIfTextTool(sal_True); 148 149 SetMinMoveDistancePixel(2); 150 SetHitTolerancePixel(2); 151 SetMeasureLayer(String(SdResId(STR_LAYER_MEASURELINES))); 152 153 // Timer fuer verzoegertes Drop (muss fuer MAC sein) 154 maDropErrorTimer.SetTimeoutHdl( LINK(this, View, DropErrorHdl) ); 155 maDropErrorTimer.SetTimeout(50); 156 maDropInsertFileTimer.SetTimeoutHdl( LINK(this, View, DropInsertFileHdl) ); 157 maDropInsertFileTimer.SetTimeout(50); 158 } 159 160 void View::ImplClearDrawDropMarker() 161 { 162 if(mpDropMarker) 163 { 164 delete mpDropMarker; 165 mpDropMarker = 0L; 166 } 167 } 168 169 /************************************************************************* 170 |* 171 |* Dtor 172 |* 173 \************************************************************************/ 174 175 View::~View() 176 { 177 maSmartTags.Dispose(); 178 179 // release content of selection clipboard, if we own the content 180 UpdateSelectionClipboard( sal_True ); 181 182 maDropErrorTimer.Stop(); 183 maDropInsertFileTimer.Stop(); 184 185 ImplClearDrawDropMarker(); 186 187 while(PaintWindowCount()) 188 { 189 // Alle angemeldeten OutDevs entfernen 190 DeleteWindowFromPaintView(GetFirstOutputDevice() /*GetWin(0)*/); 191 } 192 193 // gespeicherte Redraws loeschen 194 if (mpLockedRedraws) 195 { 196 SdViewRedrawRec* pRec = (SdViewRedrawRec*)mpLockedRedraws->First(); 197 while (pRec) 198 { 199 delete pRec; 200 pRec = (SdViewRedrawRec*)mpLockedRedraws->Next(); 201 } 202 delete mpLockedRedraws; 203 } 204 } 205 206 207 class ViewRedirector : public ::sdr::contact::ViewObjectContactRedirector 208 { 209 public: 210 ViewRedirector(); 211 virtual ~ViewRedirector(); 212 213 // all default implementations just call the same methods at the original. To do something 214 // different, overload the method and at least do what the method does. 215 virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence( 216 const sdr::contact::ViewObjectContact& rOriginal, 217 const sdr::contact::DisplayInfo& rDisplayInfo); 218 }; 219 220 ViewRedirector::ViewRedirector() 221 { 222 } 223 224 ViewRedirector::~ViewRedirector() 225 { 226 } 227 228 drawinglayer::primitive2d::Primitive2DSequence ViewRedirector::createRedirectedPrimitive2DSequence( 229 const sdr::contact::ViewObjectContact& rOriginal, 230 const sdr::contact::DisplayInfo& rDisplayInfo) 231 { 232 SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject(); 233 drawinglayer::primitive2d::Primitive2DSequence xRetval; 234 235 if(pObject && pObject->GetPage()) 236 { 237 const bool bDoCreateGeometry(pObject->GetPage()->checkVisibility( rOriginal, rDisplayInfo, true )); 238 239 if(!bDoCreateGeometry && !(( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_PAGE )) ) 240 return xRetval; 241 242 PresObjKind eKind(PRESOBJ_NONE); 243 const bool bSubContentProcessing(rDisplayInfo.GetSubContentActive()); 244 const bool bIsMasterPageObject(pObject->GetPage()->IsMasterPage()); 245 const bool bIsPrinting(rOriginal.GetObjectContact().isOutputToPrinter()); 246 const SdrPageView* pPageView = rOriginal.GetObjectContact().TryToGetSdrPageView(); 247 const SdrPage* pVisualizedPage = GetSdrPageFromXDrawPage(rOriginal.GetObjectContact().getViewInformation2D().getVisualizedPage()); 248 const SdPage* pObjectsSdPage = dynamic_cast< SdPage* >(pObject->GetPage()); 249 const bool bIsInsidePageObj(pPageView && pPageView->GetPage() != pVisualizedPage); 250 251 // check if we need to draw a placeholder border. Never do it for 252 // objects inside a SdrPageObj and never when printing 253 if(!bIsInsidePageObj && !bIsPrinting) 254 { 255 bool bCreateOutline(false); 256 257 if( pObject->IsEmptyPresObj() && pObject->ISA(SdrTextObj) ) 258 { 259 if( !bSubContentProcessing || !pObject->IsNotVisibleAsMaster() ) 260 { 261 eKind = pObjectsSdPage ? pObjectsSdPage->GetPresObjKind(pObject) : PRESOBJ_NONE; 262 bCreateOutline = true; 263 } 264 } 265 else if( ( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_TEXT ) ) 266 { 267 if( pObjectsSdPage ) 268 { 269 eKind = pObjectsSdPage->GetPresObjKind(pObject); 270 271 if((eKind == PRESOBJ_FOOTER) || (eKind == PRESOBJ_HEADER) || (eKind == PRESOBJ_DATETIME) || (eKind == PRESOBJ_SLIDENUMBER) ) 272 { 273 if( !bSubContentProcessing ) 274 { 275 // only draw a boundary for header&footer objects on the masterpage itself 276 bCreateOutline = true; 277 } 278 } 279 } 280 } 281 else if( ( pObject->GetObjInventor() == SdrInventor ) && ( pObject->GetObjIdentifier() == OBJ_PAGE ) ) 282 { 283 // only for handout page, else this frame will be created for each 284 // page preview object in SlideSorter and PagePane 285 if(pObjectsSdPage && PK_HANDOUT == pObjectsSdPage->GetPageKind()) 286 { 287 bCreateOutline = true; 288 } 289 } 290 291 if(bCreateOutline) 292 { 293 // empty presentation objects get a gray frame 294 const svtools::ColorConfig aColorConfig; 295 const svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( svtools::OBJECTBOUNDARIES ) ); 296 297 if( aColor.bIsVisible ) 298 { 299 // get basic object transformation 300 const basegfx::BColor aRGBColor(Color(aColor.nColor).getBColor()); 301 basegfx::B2DHomMatrix aObjectMatrix; 302 basegfx::B2DPolyPolygon aObjectPolyPolygon; 303 pObject->TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon); 304 305 // create dashed border 306 { 307 // create object polygon 308 basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); 309 aPolygon.transform(aObjectMatrix); 310 311 // create line and stroke attribute 312 ::std::vector< double > aDotDashArray; 313 314 aDotDashArray.push_back(160.0); 315 aDotDashArray.push_back(80.0); 316 317 const double fFullDotDashLen(::std::accumulate(aDotDashArray.begin(), aDotDashArray.end(), 0.0)); 318 const drawinglayer::attribute::LineAttribute aLine(aRGBColor); 319 const drawinglayer::attribute::StrokeAttribute aStroke(aDotDashArray, fFullDotDashLen); 320 321 // create primitive and add 322 const drawinglayer::primitive2d::Primitive2DReference xRef(new drawinglayer::primitive2d::PolygonStrokePrimitive2D( 323 aPolygon, 324 aLine, 325 aStroke)); 326 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xRef); 327 } 328 329 // now paint the placeholder description, but only when masterpage 330 // is displayed as page directly (MasterPage view) 331 if(!bSubContentProcessing && bIsMasterPageObject) 332 { 333 String aObjectString; 334 335 switch( eKind ) 336 { 337 case PRESOBJ_TITLE: 338 { 339 if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PK_STANDARD) 340 { 341 static String aTitleAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_TITLE ) ); 342 aObjectString = aTitleAreaStr; 343 } 344 345 break; 346 } 347 case PRESOBJ_OUTLINE: 348 { 349 static String aOutlineAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_OUTLINE ) ); 350 aObjectString = aOutlineAreaStr; 351 break; 352 } 353 case PRESOBJ_FOOTER: 354 { 355 static String aFooterAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_FOOTER ) ); 356 aObjectString = aFooterAreaStr; 357 break; 358 } 359 case PRESOBJ_HEADER: 360 { 361 static String aHeaderAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_HEADER ) ); 362 aObjectString = aHeaderAreaStr; 363 break; 364 } 365 case PRESOBJ_DATETIME: 366 { 367 static String aDateTimeStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_DATETIME ) ); 368 aObjectString = aDateTimeStr; 369 break; 370 } 371 case PRESOBJ_NOTES: 372 { 373 static String aDateTimeStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_NOTES ) ); 374 aObjectString = aDateTimeStr; 375 break; 376 } 377 case PRESOBJ_SLIDENUMBER: 378 { 379 if(pObjectsSdPage && pObjectsSdPage->GetPageKind() == PK_STANDARD) 380 { 381 static String aSlideAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_SLIDE ) ); 382 aObjectString = aSlideAreaStr; 383 } 384 else 385 { 386 static String aNumberAreaStr( SdResId( STR_PLACEHOLDER_DESCRIPTION_NUMBER ) ); 387 aObjectString = aNumberAreaStr; 388 } 389 break; 390 } 391 default: 392 { 393 break; 394 } 395 } 396 397 if( aObjectString.Len() ) 398 { 399 // decompose object matrix to be able to place text correctly 400 basegfx::B2DTuple aScale; 401 basegfx::B2DTuple aTranslate; 402 double fRotate, fShearX; 403 aObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX); 404 405 // create font 406 SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObject ); 407 const SdrTextVertAdjust eTVA(pTextObj ? pTextObj->GetTextVerticalAdjust() : SDRTEXTVERTADJUST_CENTER); 408 Font aScaledVclFont; 409 410 // use a text size factor to get more reliable text sizes from the text layouter 411 // (and from vcl), tipp from HDU 412 static sal_uInt32 nTextSizeFactor(100); 413 414 // use a factor to get more linear text size calculations 415 aScaledVclFont.SetHeight( 500 * nTextSizeFactor ); 416 417 // get basic geometry and get text size 418 drawinglayer::primitive2d::TextLayouterDevice aTextLayouter; 419 aTextLayouter.setFont(aScaledVclFont); 420 const xub_StrLen nTextLength(aObjectString.Len()); 421 422 // do not forget to use the factor again to get the width for the 500 423 const double fTextWidth(aTextLayouter.getTextWidth(aObjectString, 0, nTextLength) * (1.0 / nTextSizeFactor)); 424 const double fTextHeight(aTextLayouter.getTextHeight() * (1.0 / nTextSizeFactor)); 425 426 // calculate text primitive position. If text is at bottom, use top for 427 // the extra text and vice versa 428 const double fHorDist(125); 429 const double fVerDist(125); 430 const double fPosX((aTranslate.getX() + aScale.getX()) - fTextWidth - fHorDist); 431 const double fPosY((SDRTEXTVERTADJUST_BOTTOM == eTVA) 432 ? aTranslate.getY() - fVerDist + fTextHeight 433 : (aTranslate.getY() + aScale.getY()) - fVerDist); 434 435 // get font attributes; use normally scaled font 436 const basegfx::BColor aFontColor(aRGBColor); 437 Font aVclFont; 438 basegfx::B2DVector aTextSizeAttribute; 439 440 aVclFont.SetHeight( 500 ); 441 442 const drawinglayer::attribute::FontAttribute aFontAttribute( 443 drawinglayer::primitive2d::getFontAttributeFromVclFont( 444 aTextSizeAttribute, 445 aVclFont, 446 false, 447 false)); 448 449 // fill text matrix 450 const basegfx::B2DHomMatrix aTextMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( 451 aTextSizeAttribute.getX(), aTextSizeAttribute.getY(), 452 fShearX, 453 fRotate, 454 fPosX, fPosY)); 455 456 // create DXTextArray (can be empty one) 457 const ::std::vector< double > aDXArray; 458 459 // create locale; this may need some more information in the future 460 const ::com::sun::star::lang::Locale aLocale; 461 462 // create primitive and add 463 const drawinglayer::primitive2d::Primitive2DReference xRef( 464 new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( 465 aTextMatrix, 466 aObjectString, 467 0, 468 nTextLength, 469 aDXArray, 470 aFontAttribute, 471 aLocale, 472 aFontColor)); 473 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xRef); 474 } 475 } 476 } 477 } 478 } 479 480 if(bDoCreateGeometry) 481 { 482 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence( 483 xRetval, 484 sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence( 485 rOriginal, 486 rDisplayInfo)); 487 } 488 } 489 else 490 { 491 // not a SdrObject visualisation (maybe e.g. page) or no page 492 xRetval = sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo); 493 } 494 495 return xRetval; 496 } 497 498 /************************************************************************* 499 |* 500 |* Paint-Methode: das Ereignis wird an die View weitergeleitet 501 |* 502 \************************************************************************/ 503 504 void View::CompleteRedraw(OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector /*=0L*/) 505 { 506 // ausfuehren ?? 507 if (mnLockRedrawSmph == 0) 508 { 509 SdrPageView* pPgView = GetSdrPageView(); 510 511 if (pPgView) 512 { 513 SdPage* pPage = (SdPage*) pPgView->GetPage(); 514 if( pPage ) 515 { 516 SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL); 517 bool bScreenDisplay(true); 518 519 if(bScreenDisplay && pOutDev && OUTDEV_PRINTER == pOutDev->GetOutDevType()) 520 { 521 // #i75566# printing; suppress AutoColor BackgroundColor generation 522 // for visibility reasons by giving GetPageBackgroundColor() 523 // the needed hint 524 bScreenDisplay = false; 525 } 526 527 if(bScreenDisplay && pOutDev && pOutDev->GetPDFWriter()) 528 { 529 // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see above) 530 bScreenDisplay = false; 531 } 532 533 // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and 534 // hint value if screen display. Only then the AutoColor mechanisms shall be applied 535 rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pPgView, bScreenDisplay) ); 536 } 537 } 538 539 ViewRedirector aViewRedirector; 540 FmFormView::CompleteRedraw(pOutDev, rReg, pRedirector ? pRedirector : &aViewRedirector); 541 } 542 // oder speichern? 543 else 544 { 545 if (!mpLockedRedraws) 546 mpLockedRedraws = new List; 547 548 SdViewRedrawRec* pRec = new SdViewRedrawRec; 549 pRec->mpOut = pOutDev; 550 pRec->aRect = rReg.GetBoundRect(); 551 mpLockedRedraws->Insert(pRec, LIST_APPEND); 552 } 553 } 554 555 556 /************************************************************************* 557 |* 558 |* Selektion hat sich geaendert 559 |* 560 \************************************************************************/ 561 562 void View::MarkListHasChanged() 563 { 564 FmFormView::MarkListHasChanged(); 565 566 if( GetMarkedObjectCount() > 0 ) 567 maSmartTags.deselect(); 568 } 569 570 571 /************************************************************************* 572 |* 573 |* Attribute setzen 574 |* 575 \************************************************************************/ 576 577 sal_Bool View::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll) 578 { 579 sal_Bool bOk = FmFormView::SetAttributes(rSet, bReplaceAll); 580 return (bOk); 581 } 582 583 584 /************************************************************************* 585 |* 586 |* Attribute holen 587 |* 588 \************************************************************************/ 589 590 sal_Bool View::GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr ) const 591 { 592 return( FmFormView::GetAttributes( rTargetSet, bOnlyHardAttr ) ); 593 } 594 595 596 /************************************************************************* 597 |* 598 |* Ist ein Praesentationsobjekt selektiert? 599 |* 600 \************************************************************************/ 601 602 sal_Bool View::IsPresObjSelected(sal_Bool bOnPage, sal_Bool bOnMasterPage, sal_Bool bCheckPresObjListOnly, sal_Bool bCheckLayoutOnly) const 603 { 604 /************************************************************************** 605 * Ist ein Presentationsobjekt selektiert? 606 **************************************************************************/ 607 SdrMarkList* pMarkList; 608 609 if (mnDragSrcPgNum != SDRPAGE_NOTFOUND && 610 mnDragSrcPgNum != GetSdrPageView()->GetPage()->GetPageNum()) 611 { 612 // Es laeuft gerade Drag&Drop 613 // Source- und Destination-Page unterschiedlich: 614 // es wird die gemerkte MarkList verwendet 615 pMarkList = mpDragSrcMarkList; 616 } 617 else 618 { 619 // Es wird die aktuelle MarkList verwendet 620 pMarkList = new SdrMarkList(GetMarkedObjectList()); 621 } 622 623 SdrMark* pMark; 624 SdPage* pPage; 625 SdrObject* pObj; 626 627 sal_Bool bSelected = sal_False; 628 sal_Bool bMasterPage = sal_False; 629 long nMark; 630 long nMarkMax = long(pMarkList->GetMarkCount()) - 1; 631 632 for (nMark = nMarkMax; (nMark >= 0) && !bSelected; nMark--) 633 { 634 // Rueckwaerts durch die Marklist 635 pMark = pMarkList->GetMark(nMark); 636 pObj = pMark->GetMarkedSdrObj(); 637 638 if ( pObj && ( bCheckPresObjListOnly || pObj->IsEmptyPresObj() || pObj->GetUserCall() ) ) 639 { 640 pPage = (SdPage*) pObj->GetPage(); 641 bMasterPage = pPage->IsMasterPage(); 642 643 if ( (bMasterPage && bOnMasterPage) || (!bMasterPage && bOnPage) ) 644 { 645 if ( pPage && pPage->IsPresObj(pObj) ) 646 { 647 if( bCheckLayoutOnly ) 648 { 649 PresObjKind eKind = pPage->GetPresObjKind(pObj); 650 651 if((eKind != PRESOBJ_FOOTER) && (eKind != PRESOBJ_HEADER) && (eKind != PRESOBJ_DATETIME) && (eKind != PRESOBJ_SLIDENUMBER) ) 652 bSelected = sal_True; 653 } 654 else 655 { 656 bSelected = sal_True; 657 } 658 } 659 } 660 } 661 } 662 663 if (pMarkList != mpDragSrcMarkList) 664 { 665 delete pMarkList; 666 } 667 668 return (bSelected); 669 } 670 671 /************************************************************************* 672 |* 673 |* Alles selektieren 674 |* 675 \************************************************************************/ 676 677 void View::SelectAll() 678 { 679 if ( IsTextEdit() ) 680 { 681 OutlinerView* pOLV = GetTextEditOutlinerView(); 682 const ::Outliner* pOutliner = GetTextEditOutliner(); 683 pOLV->SelectRange( 0, (sal_uInt16) pOutliner->GetParagraphCount() ); 684 } 685 else 686 { 687 MarkAll(); 688 } 689 } 690 691 692 /************************************************************************* 693 |* 694 |* Dokument hat sich geaendert 695 |* 696 \************************************************************************/ 697 698 void View::ModelHasChanged() 699 { 700 // Erst SdrView benachrichtigen 701 FmFormView::ModelHasChanged(); 702 } 703 704 /************************************************************************* 705 |* 706 |* StyleSheet setzen 707 |* 708 \************************************************************************/ 709 710 sal_Bool View::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr) 711 { 712 // weiter an SdrView 713 return FmFormView::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr); 714 } 715 716 717 /************************************************************************* 718 |* 719 |* Texteingabe beginnen 720 |* 721 \************************************************************************/ 722 723 static void SetSpellOptions( SdDrawDocument* pDoc, sal_uLong& rCntrl ) 724 { 725 sal_Bool bOnlineSpell = pDoc->GetOnlineSpell(); 726 727 if( bOnlineSpell ) 728 rCntrl |= EE_CNTRL_ONLINESPELLING; 729 else 730 rCntrl &= ~EE_CNTRL_ONLINESPELLING; 731 } 732 733 sal_Bool View::SdrBeginTextEdit( 734 SdrObject* pObj, SdrPageView* pPV, ::Window* pWin, 735 sal_Bool bIsNewObj, 736 SdrOutliner* pOutl, OutlinerView* pGivenOutlinerView, 737 sal_Bool bDontDeleteOutliner, sal_Bool bOnlyOneView, sal_Bool bGrabFocus ) 738 { 739 GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent( 740 sd::tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT, (void*)pObj ); 741 742 if( pOutl==NULL && pObj ) 743 pOutl = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, pObj->GetModel() ); 744 745 // make draw&impress specific initialisations 746 if( pOutl ) 747 { 748 pOutl->SetStyleSheetPool((SfxStyleSheetPool*) mpDoc->GetStyleSheetPool()); 749 pOutl->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl)); 750 sal_uLong nCntrl = pOutl->GetControlWord(); 751 nCntrl |= EE_CNTRL_ALLOWBIGOBJS; 752 nCntrl |= EE_CNTRL_URLSFXEXECUTE; 753 nCntrl |= EE_CNTRL_MARKFIELDS; 754 nCntrl |= EE_CNTRL_AUTOCORRECT; 755 756 nCntrl &= ~EE_CNTRL_ULSPACESUMMATION; 757 if ( mpDoc->IsSummationOfParagraphs() ) 758 nCntrl |= EE_CNTRL_ULSPACESUMMATION; 759 760 SetSpellOptions( mpDoc, nCntrl ); 761 762 pOutl->SetControlWord(nCntrl); 763 764 Reference< linguistic2::XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() ); 765 if ( xSpellChecker.is() ) 766 pOutl->SetSpeller( xSpellChecker ); 767 768 Reference< linguistic2::XHyphenator > xHyphenator( LinguMgr::GetHyphenator() ); 769 if( xHyphenator.is() ) 770 pOutl->SetHyphenator( xHyphenator ); 771 772 pOutl->SetDefaultLanguage( Application::GetSettings().GetLanguage() ); 773 } 774 775 sal_Bool bReturn = FmFormView::SdrBeginTextEdit( 776 pObj, pPV, pWin, bIsNewObj, pOutl, 777 pGivenOutlinerView, bDontDeleteOutliner, 778 bOnlyOneView, bGrabFocus); 779 780 ContextChangeEventMultiplexer::NotifyContextChange( 781 &GetViewShell()->GetViewShellBase(), 782 ::sfx2::sidebar::EnumContext::Context_DrawText); 783 784 if (bReturn) 785 { 786 ::Outliner* pOL = GetTextEditOutliner(); 787 788 if( pObj && pObj->GetPage() ) 789 { 790 Color aBackground; 791 if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_TABLE ) 792 { 793 aBackground = GetTextEditBackgroundColor(*this); 794 } 795 else 796 { 797 aBackground = pObj->GetPage()->GetPageBackgroundColor(pPV); 798 } 799 if (pOL != NULL) 800 pOL->SetBackgroundColor( aBackground ); 801 } 802 803 if (pOL != NULL) 804 { 805 pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl)); 806 pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl)); 807 } 808 } 809 810 return(bReturn); 811 } 812 813 /** ends current text editing */ 814 SdrEndTextEditKind View::SdrEndTextEdit(sal_Bool bDontDeleteReally ) 815 { 816 SdrObjectWeakRef xObj( GetTextEditObject() ); 817 818 sal_Bool bDefaultTextRestored = RestoreDefaultText( dynamic_cast< SdrTextObj* >( GetTextEditObject() ) ); 819 820 SdrEndTextEditKind eKind = FmFormView::SdrEndTextEdit(bDontDeleteReally); 821 822 if( bDefaultTextRestored ) 823 { 824 if( xObj.is() && !xObj->IsEmptyPresObj() ) 825 { 826 xObj->SetEmptyPresObj( sal_True ); 827 } 828 else 829 { 830 eKind = SDRENDTEXTEDIT_UNCHANGED; 831 } 832 } 833 else if( xObj.is() && xObj->IsEmptyPresObj() ) 834 { 835 SdrTextObj* pObj = dynamic_cast< SdrTextObj* >( xObj.get() ); 836 if( pObj && pObj->HasText() ) 837 { 838 SdrPage* pPage = pObj->GetPage(); 839 if( !pPage || !pPage->IsMasterPage() ) 840 pObj->SetEmptyPresObj( sal_False ); 841 } 842 } 843 844 GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent( 845 sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT, 846 (void*)xObj.get() ); 847 848 if( xObj.is() ) 849 { 850 ContextChangeEventMultiplexer::NotifyContextChange( 851 &GetViewShell()->GetViewShellBase(), 852 ::sfx2::sidebar::EnumContext::Context_Default); 853 854 SdPage* pPage = dynamic_cast< SdPage* >( xObj->GetPage() ); 855 if( pPage ) 856 pPage->onEndTextEdit( xObj.get() ); 857 } 858 859 return(eKind); 860 } 861 862 // -------------------------------------------------------------------- 863 864 /** restores the default text if the given text object is currently in edit mode and 865 no text has been entered already. Is only usefull just before text edit ends. */ 866 bool View::RestoreDefaultText( SdrTextObj* pTextObj ) 867 { 868 bool bRestored = false; 869 870 if( pTextObj && (pTextObj == GetTextEditObject()) ) 871 { 872 if( !pTextObj->HasText() ) 873 { 874 SdPage* pPage = dynamic_cast< SdPage* >( pTextObj->GetPage() ); 875 876 if(pPage) 877 { 878 bRestored = pPage->RestoreDefaultText( pTextObj ); 879 if( bRestored ) 880 { 881 SdrOutliner* pOutliner = GetTextEditOutliner(); 882 pTextObj->SetTextEditOutliner( pOutliner ); 883 OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject(); 884 if (pOutliner) 885 pOutliner->SetText(*pParaObj); 886 } 887 } 888 } 889 } 890 891 return bRestored; 892 } 893 894 /************************************************************************* 895 |* 896 |* Originalgroesse der markierten Objekte setzen 897 |* 898 \************************************************************************/ 899 900 void View::SetMarkedOriginalSize() 901 { 902 SdrUndoGroup* pUndoGroup = new SdrUndoGroup(*mpDoc); 903 sal_uLong nCount = GetMarkedObjectCount(); 904 sal_Bool bOK = sal_False; 905 906 for( sal_uInt32 i = 0; i < nCount; i++ ) 907 { 908 SdrObject* pObj = GetMarkedObjectByIndex(i); 909 910 if( pObj->GetObjInventor() == SdrInventor ) 911 { 912 if( pObj->GetObjIdentifier() == OBJ_OLE2 ) 913 { 914 uno::Reference < embed::XEmbeddedObject > xObj = ((SdrOle2Obj*)pObj)->GetObjRef(); 915 if( xObj.is() ) 916 { 917 // TODO/LEAN: working with VisualArea can switch object to running state 918 919 sal_Int64 nAspect = ((SdrOle2Obj*)pObj)->GetAspect(); 920 Size aOleSize; 921 922 if ( nAspect == embed::Aspects::MSOLE_ICON ) 923 { 924 MapMode aMap100( MAP_100TH_MM ); 925 aOleSize = ((SdrOle2Obj*)pObj)->GetOrigObjSize( &aMap100 ); 926 bOK = sal_True; 927 } 928 else 929 { 930 MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) ); 931 try 932 { 933 awt::Size aSz = xObj->getVisualAreaSize( nAspect ); 934 aOleSize = OutputDevice::LogicToLogic( Size( aSz.Width, aSz.Height ), aUnit, MAP_100TH_MM ); 935 bOK = sal_True; 936 } 937 catch( embed::NoVisualAreaSizeException& ) 938 {} 939 } 940 941 if ( bOK ) 942 { 943 Rectangle aDrawRect( pObj->GetLogicRect() ); 944 945 pUndoGroup->AddAction( mpDoc->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) ); 946 pObj->Resize( aDrawRect.TopLeft(), Fraction( aOleSize.Width(), aDrawRect.GetWidth() ), 947 Fraction( aOleSize.Height(), aDrawRect.GetHeight() ) ); 948 } 949 } 950 } 951 else if( pObj->GetObjIdentifier() == OBJ_GRAF ) 952 { 953 const MapMode aMap100( MAP_100TH_MM ); 954 Size aSize; 955 956 if ( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefMapMode().GetMapUnit() == MAP_PIXEL ) 957 aSize = Application::GetDefaultDevice()->PixelToLogic( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefSize(), aMap100 ); 958 else 959 { 960 aSize = OutputDevice::LogicToLogic( static_cast< SdrGrafObj* >( pObj )->GetGrafPrefSize(), 961 static_cast< SdrGrafObj* >( pObj )->GetGrafPrefMapMode(), 962 aMap100 ); 963 } 964 965 pUndoGroup->AddAction( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj ) ); 966 Rectangle aRect( pObj->GetLogicRect() ); 967 aRect.SetSize( aSize ); 968 pObj->SetLogicRect( aRect ); 969 970 bOK = sal_True; 971 } 972 } 973 } 974 975 if( bOK ) 976 { 977 pUndoGroup->SetComment( String(SdResId(STR_UNDO_ORIGINALSIZE)) ); 978 mpDocSh->GetUndoManager()->AddUndoAction(pUndoGroup); 979 } 980 else 981 delete pUndoGroup; 982 } 983 984 /************************************************************************* 985 |* 986 |* OLE-Obj am Client connecten 987 |* 988 \************************************************************************/ 989 990 void View::DoConnect(SdrOle2Obj* pObj) 991 { 992 if (mpViewSh) 993 { 994 uno::Reference < embed::XEmbeddedObject > xObj( pObj->GetObjRef() ); 995 if( xObj.is() ) 996 { 997 ::sd::Window* pWindow = mpViewSh->GetActiveWindow(); 998 SfxInPlaceClient* pSdClient = mpViewSh-> GetViewShellBase().FindIPClient( xObj, pWindow ); 999 if ( !pSdClient ) 1000 { 1001 pSdClient = new Client(pObj, mpViewSh, pWindow); 1002 Rectangle aRect = pObj->GetLogicRect(); 1003 { 1004 // TODO/LEAN: working with visual area can switch object to running state 1005 Size aDrawSize = aRect.GetSize(); 1006 awt::Size aSz; 1007 1008 MapMode aMapMode( mpDoc->GetScaleUnit() ); 1009 Size aObjAreaSize = pObj->GetOrigObjSize( &aMapMode ); 1010 1011 Fraction aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() ); 1012 Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() ); 1013 aScaleWidth.ReduceInaccurate(10); // kompatibel zum SdrOle2Obj 1014 aScaleHeight.ReduceInaccurate(10); 1015 pSdClient->SetSizeScale(aScaleWidth, aScaleHeight); 1016 1017 // sichtbarer Ausschnitt wird nur inplace veraendert! 1018 // the object area must be set after the scaling, since it triggers resize 1019 aRect.SetSize(aObjAreaSize); 1020 pSdClient->SetObjArea(aRect); 1021 } 1022 } 1023 } 1024 } 1025 } 1026 1027 /************************************************************************* 1028 |* 1029 |* 1030 |* 1031 \************************************************************************/ 1032 1033 sal_Bool View::IsMorphingAllowed() const 1034 { 1035 const SdrMarkList& rMarkList = GetMarkedObjectList(); 1036 sal_Bool bRet = sal_False; 1037 1038 if ( rMarkList.GetMarkCount() == 2 ) 1039 { 1040 const SdrObject* pObj1 = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 1041 const SdrObject* pObj2 = rMarkList.GetMark( 1 )->GetMarkedSdrObj(); 1042 const sal_uInt16 nKind1 = pObj1->GetObjIdentifier(); 1043 const sal_uInt16 nKind2 = pObj2->GetObjIdentifier(); 1044 1045 if ( ( nKind1 != OBJ_TEXT && nKind2 != OBJ_TEXT ) && 1046 ( nKind1 != OBJ_TITLETEXT && nKind2 != OBJ_TITLETEXT ) && 1047 ( nKind1 != OBJ_OUTLINETEXT && nKind2 != OBJ_OUTLINETEXT ) && 1048 ( nKind1 != OBJ_GRUP && nKind2 != OBJ_GRUP ) && 1049 ( nKind1 != OBJ_LINE && nKind2 != OBJ_LINE ) && 1050 ( nKind1 != OBJ_PLIN && nKind2 != OBJ_PLIN ) && 1051 ( nKind1 != OBJ_PATHLINE && nKind2 != OBJ_PATHLINE ) && 1052 ( nKind1 != OBJ_FREELINE && nKind2 != OBJ_FREELINE ) && 1053 ( nKind1 != OBJ_PATHPLIN && nKind2 != OBJ_PATHPLIN ) && 1054 ( nKind1 != OBJ_MEASURE && nKind2 != OBJ_MEASURE ) && 1055 ( nKind1 != OBJ_EDGE && nKind2 != OBJ_EDGE ) && 1056 ( nKind1 != OBJ_GRAF && nKind2 != OBJ_GRAF ) && 1057 ( nKind1 != OBJ_OLE2 && nKind2 != OBJ_OLE2 ) && 1058 ( nKind1 != OBJ_CAPTION && nKind2 != OBJ_CAPTION ) && 1059 !pObj1->ISA( E3dObject) && !pObj2->ISA( E3dObject) ) 1060 { 1061 SfxItemSet aSet1( mpDoc->GetPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE ); 1062 SfxItemSet aSet2( mpDoc->GetPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE ); 1063 1064 aSet1.Put(pObj1->GetMergedItemSet()); 1065 aSet2.Put(pObj2->GetMergedItemSet()); 1066 1067 const XFillStyle eFillStyle1 = ( (const XFillStyleItem&) aSet1.Get( XATTR_FILLSTYLE ) ).GetValue(); 1068 const XFillStyle eFillStyle2 = ( (const XFillStyleItem&) aSet2.Get( XATTR_FILLSTYLE ) ).GetValue(); 1069 1070 if( ( eFillStyle1 == XFILL_NONE || eFillStyle1 == XFILL_SOLID ) && 1071 ( eFillStyle2 == XFILL_NONE || eFillStyle2 == XFILL_SOLID ) ) 1072 bRet = sal_True; 1073 } 1074 } 1075 1076 return bRet; 1077 } 1078 1079 /************************************************************************* 1080 |* 1081 |* 1082 |* 1083 \************************************************************************/ 1084 1085 sal_Bool View::IsVectorizeAllowed() const 1086 { 1087 const SdrMarkList& rMarkList = GetMarkedObjectList(); 1088 sal_Bool bRet = sal_False; 1089 1090 if( rMarkList.GetMarkCount() == 1 ) 1091 { 1092 const SdrGrafObj* pObj = dynamic_cast< const SdrGrafObj* >(rMarkList.GetMark( 0 )->GetMarkedSdrObj()); 1093 1094 if(pObj) 1095 { 1096 if(GRAPHIC_BITMAP == pObj->GetGraphicType() && !pObj->isEmbeddedSvg()) 1097 { 1098 bRet = sal_True; 1099 } 1100 } 1101 } 1102 1103 return bRet; 1104 } 1105 1106 void View::onAccessibilityOptionsChanged() 1107 { 1108 if( mpViewSh ) 1109 { 1110 ::sd::Window* pWindow = mpViewSh->GetActiveWindow(); 1111 if( pWindow ) 1112 { 1113 const StyleSettings& rStyleSettings = pWindow->GetSettings().GetStyleSettings(); 1114 1115 sal_uInt16 nOutputSlot, nPreviewSlot; 1116 1117 SvtAccessibilityOptions& aAccOptions = getAccessibilityOptions(); 1118 1119 if( mpViewSh->GetViewFrame() && mpViewSh->GetViewFrame()->GetDispatcher() ) 1120 { 1121 if( rStyleSettings.GetHighContrastMode() ) 1122 { 1123 nOutputSlot = SID_OUTPUT_QUALITY_CONTRAST; 1124 } 1125 else 1126 { 1127 nOutputSlot = SID_OUTPUT_QUALITY_COLOR; 1128 } 1129 1130 if( rStyleSettings.GetHighContrastMode() && aAccOptions.GetIsForPagePreviews() ) 1131 { 1132 nPreviewSlot = SID_PREVIEW_QUALITY_CONTRAST; 1133 } 1134 else 1135 { 1136 nPreviewSlot = SID_PREVIEW_QUALITY_COLOR; 1137 } 1138 1139 mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nOutputSlot, SFX_CALLMODE_ASYNCHRON ); 1140 mpViewSh->GetViewFrame()->GetDispatcher()->Execute( nPreviewSlot, SFX_CALLMODE_ASYNCHRON ); 1141 } 1142 1143 mpViewSh->Invalidate(); 1144 } 1145 } 1146 } 1147 1148 IMPL_LINK( View, OnParagraphInsertedHdl, ::Outliner *, pOutliner ) 1149 { 1150 Paragraph* pPara = pOutliner->GetHdlParagraph(); 1151 SdrObject* pObj = GetTextEditObject(); 1152 1153 if( pPara && pObj ) 1154 { 1155 SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() ); 1156 if( pPage ) 1157 pPage->onParagraphInserted( pOutliner, pPara, pObj ); 1158 } 1159 return 0; 1160 } 1161 1162 /************************************************************************* 1163 |* 1164 |* Handler fuer das Loeschen von Seiten (Absaetzen) 1165 |* 1166 \************************************************************************/ 1167 1168 IMPL_LINK( View, OnParagraphRemovingHdl, ::Outliner *, pOutliner ) 1169 { 1170 Paragraph* pPara = pOutliner->GetHdlParagraph(); 1171 SdrObject* pObj = GetTextEditObject(); 1172 1173 if( pPara && pObj ) 1174 { 1175 SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() ); 1176 if( pPage ) 1177 pPage->onParagraphRemoving( pOutliner, pPara, pObj ); 1178 } 1179 return 0; 1180 } 1181 1182 bool View::isRecordingUndo() const 1183 { 1184 if( mpDoc && mpDoc->IsUndoEnabled() ) 1185 { 1186 sd::UndoManager* pUndoManager = mpDoc ? mpDoc->GetUndoManager() : 0; 1187 return pUndoManager && pUndoManager->IsInListAction(); 1188 } 1189 else 1190 { 1191 return false; 1192 } 1193 } 1194 1195 void View::AddCustomHdl() 1196 { 1197 maSmartTags.addCustomHandles( aHdl ); 1198 } 1199 1200 void View::updateHandles() 1201 { 1202 AdjustMarkHdl(); 1203 } 1204 1205 SdrViewContext View::GetContext() const 1206 { 1207 SdrViewContext eContext = SDRCONTEXT_STANDARD; 1208 if( maSmartTags.getContext( eContext ) ) 1209 return eContext; 1210 else 1211 return FmFormView::GetContext(); 1212 } 1213 1214 sal_Bool View::HasMarkablePoints() const 1215 { 1216 if( maSmartTags.HasMarkablePoints() ) 1217 return true; 1218 else 1219 return FmFormView::HasMarkablePoints(); 1220 } 1221 1222 sal_uLong View::GetMarkablePointCount() const 1223 { 1224 sal_uLong nCount = FmFormView::GetMarkablePointCount(); 1225 nCount += maSmartTags.GetMarkablePointCount(); 1226 return nCount; 1227 } 1228 1229 sal_Bool View::HasMarkedPoints() const 1230 { 1231 if( maSmartTags.HasMarkedPoints() ) 1232 return true; 1233 else 1234 return FmFormView::HasMarkedPoints(); 1235 } 1236 1237 sal_uLong View::GetMarkedPointCount() const 1238 { 1239 sal_uLong nCount = FmFormView::GetMarkedPointCount(); 1240 nCount += maSmartTags.GetMarkedPointCount(); 1241 return nCount; 1242 } 1243 1244 sal_Bool View::IsPointMarkable(const SdrHdl& rHdl) const 1245 { 1246 if( maSmartTags.IsPointMarkable( rHdl ) ) 1247 return true; 1248 else 1249 return FmFormView::IsPointMarkable( rHdl ); 1250 } 1251 1252 sal_Bool View::MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark ) 1253 { 1254 if( maSmartTags.MarkPoint( rHdl, bUnmark ) ) 1255 return true; 1256 else 1257 return FmFormView::MarkPoint( rHdl, bUnmark ); 1258 } 1259 1260 sal_Bool View::MarkPoints(const Rectangle* pRect, sal_Bool bUnmark) 1261 { 1262 if( maSmartTags.MarkPoints( pRect, bUnmark ) ) 1263 return true; 1264 else 1265 return FmFormView::MarkPoints( pRect, bUnmark ); 1266 } 1267 1268 void View::CheckPossibilities() 1269 { 1270 FmFormView::CheckPossibilities(); 1271 maSmartTags.CheckPossibilities(); 1272 } 1273 1274 void View::OnBeginPasteOrDrop( PasteOrDropInfos* /*pInfos*/ ) 1275 { 1276 } 1277 1278 /** this is called after a paste or drop operation, make sure that the newly inserted paragraphs 1279 get the correct style sheet. */ 1280 void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfos ) 1281 { 1282 SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( GetTextEditObject() ); 1283 SdrOutliner* pOutliner = GetTextEditOutliner(); 1284 if( pOutliner && pTextObj && pTextObj->GetPage() ) 1285 { 1286 SdPage* pPage = static_cast< SdPage* >( pTextObj->GetPage() ); 1287 1288 SfxStyleSheet* pStyleSheet = 0; 1289 1290 const PresObjKind eKind = pPage->GetPresObjKind(pTextObj); 1291 if( eKind != PRESOBJ_NONE ) 1292 pStyleSheet = pPage->GetStyleSheetForPresObj(eKind); 1293 else 1294 pStyleSheet = pTextObj->GetStyleSheet(); 1295 1296 if( eKind == PRESOBJ_OUTLINE ) 1297 { 1298 // for outline shapes, set the correct outline style sheet for each 1299 // new paragraph, depending on the paragraph depth 1300 SfxStyleSheetBasePool* pStylePool = GetDoc()->GetStyleSheetPool(); 1301 1302 for ( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ ) 1303 { 1304 sal_Int16 nDepth = pOutliner->GetDepth( nPara ); 1305 1306 SfxStyleSheet* pStyle = 0; 1307 if( nDepth > 0 ) 1308 { 1309 String aStyleSheetName( pStyleSheet->GetName() ); 1310 aStyleSheetName.Erase( aStyleSheetName.Len() - 1, 1 ); 1311 aStyleSheetName += String::CreateFromInt32( nDepth ); 1312 pStyle = static_cast<SfxStyleSheet*>( pStylePool->Find( aStyleSheetName, pStyleSheet->GetFamily() ) ); 1313 DBG_ASSERT( pStyle, "sd::View::OnEndPasteOrDrop(), Style not found!" ); 1314 } 1315 1316 if( !pStyle ) 1317 pStyle = pStyleSheet; 1318 1319 pOutliner->SetStyleSheet( nPara, pStyle ); 1320 } 1321 } 1322 else 1323 { 1324 // just put the object style on each new paragraph 1325 for ( sal_uInt16 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ ) 1326 { 1327 pOutliner->SetStyleSheet( nPara, pStyleSheet ); 1328 } 1329 } 1330 } 1331 } 1332 1333 } // end of namespace sd 1334