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