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