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