LCOV - code coverage report
Current view: top level - libreoffice/svx/source/svdraw - svdobj.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 756 1675 45.1 %
Date: 2012-12-17 Functions: 149 283 52.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/lang/XComponent.hpp>
      21             : 
      22             : #define _USE_MATH_DEFINES
      23             : #include <math.h>
      24             : #include <vcl/metaact.hxx>   // for TakeContour
      25             : #include <vcl/cvtsvm.hxx>
      26             : #include <tools/line.hxx>
      27             : #include <tools/bigint.hxx>
      28             : #include <tools/diagnose_ex.h>
      29             : #include <tools/helpers.hxx>
      30             : #include <vector>
      31             : #include <svx/svdobj.hxx>
      32             : #include <svx/xpoly.hxx>
      33             : #include <svx/svdetc.hxx>
      34             : #include <svx/svdtrans.hxx>
      35             : #include <svx/svdhdl.hxx>
      36             : #include <svx/svddrag.hxx>
      37             : #include <svx/svdmodel.hxx>
      38             : #include <svx/svdpage.hxx>
      39             : #include <svx/svdovirt.hxx>  // for Add/Del Ref
      40             : #include <svx/svdview.hxx>   // for Dragging (check Ortho)
      41             : #include "svx/svdglob.hxx"   // StringCache
      42             : #include <svx/svdstr.hrc>    // the object's name
      43             : #include <svx/svdogrp.hxx>   // Factory
      44             : #include <svx/svdopath.hxx>  // Factory
      45             : #include <svx/svdoedge.hxx>  // Factory
      46             : #include <svx/svdorect.hxx>  // Factory
      47             : #include <svx/svdocirc.hxx>  // Factory
      48             : #include <svx/svdotext.hxx>  // Factory
      49             : #include <svx/svdomeas.hxx>  // Factory
      50             : #include <svx/svdograf.hxx>  // Factory
      51             : #include <svx/svdoole2.hxx>  // Factory
      52             : #include <svx/svdocapt.hxx>  // Factory
      53             : #include <svx/svdopage.hxx>  // Factory
      54             : #include <svx/svdouno.hxx>   // Factory
      55             : #include <svx/svdattrx.hxx> // NotPersistItems
      56             : #include <svx/svdoashp.hxx>
      57             : #include <svx/svdomedia.hxx>
      58             : #include <svx/xlnwtit.hxx>
      59             : #include <svx/xlnstwit.hxx>
      60             : #include <svx/xlnedwit.hxx>
      61             : #include <svx/xlnstit.hxx>
      62             : #include <svx/xlnedit.hxx>
      63             : #include <svx/xlnstcit.hxx>
      64             : #include <svx/xlnedcit.hxx>
      65             : #include <svx/xlndsit.hxx>
      66             : #include <svx/xlnclit.hxx>
      67             : #include <svx/xflclit.hxx>
      68             : #include <svx/svditer.hxx>
      69             : #include <svx/xlntrit.hxx>
      70             : #include <svx/xfltrit.hxx>
      71             : #include <svx/xflftrit.hxx>
      72             : #include "svx/xlinjoit.hxx"
      73             : #include <svx/unopage.hxx>
      74             : #include <editeng/eeitem.hxx>
      75             : #include <svx/xenum.hxx>
      76             : #include <svx/xgrad.hxx>
      77             : #include <svx/xhatch.hxx>
      78             : #include <svx/xflhtit.hxx>
      79             : #include <svx/xbtmpit.hxx>
      80             : #include <svx/svdpool.hxx>
      81             : #include <editeng/editeng.hxx>
      82             : #include <svl/whiter.hxx>
      83             : 
      84             : #include <svx/fmmodel.hxx>
      85             : #include <sfx2/objsh.hxx>
      86             : #include <sfx2/objface.hxx>
      87             : #include <vcl/graphictools.hxx>
      88             : #include <svtools/colorcfg.hxx>
      89             : #include <svx/sdr/properties/emptyproperties.hxx>
      90             : #include <svx/sdr/contact/viewcontactofsdrobj.hxx>
      91             : #include <svx/sdr/contact/viewcontactofgraphic.hxx>
      92             : #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
      93             : #include <svx/sdr/contact/displayinfo.hxx>
      94             : #include <basegfx/polygon/b2dpolygon.hxx>
      95             : #include <basegfx/polygon/b2dpolygontools.hxx>
      96             : #include <basegfx/matrix/b2dhommatrix.hxx>
      97             : #include <basegfx/polygon/b2dpolypolygontools.hxx>
      98             : #include <basegfx/range/b2drange.hxx>
      99             : #include <svx/unoshape.hxx>
     100             : #include <vcl/virdev.hxx>
     101             : #include <basegfx/polygon/b2dpolypolygoncutter.hxx>
     102             : #include <drawinglayer/processor2d/contourextractor2d.hxx>
     103             : #include <drawinglayer/processor2d/linegeometryextractor2d.hxx>
     104             : #include <svx/polysc3d.hxx>
     105             : #include "svx/svdotable.hxx"
     106             : #include "svx/shapepropertynotifier.hxx"
     107             : #include <svx/sdrhittesthelper.hxx>
     108             : #include <svx/svdundo.hxx>
     109             : #include <basegfx/matrix/b2dhommatrixtools.hxx>
     110             : #include <svx/sdrobjectfilter.hxx>
     111             : #include "svdconv.hxx"
     112             : 
     113             : using namespace ::com::sun::star;
     114             : 
     115             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     116             : 
     117           0 : TYPEINIT0(SdrObjUserCall);
     118             : 
     119         654 : SdrObjUserCall::~SdrObjUserCall()
     120             : {
     121         654 : }
     122             : 
     123        1827 : void SdrObjUserCall::Changed(const SdrObject& /*rObj*/, SdrUserCallType /*eType*/, const Rectangle& /*rOldBoundRect*/)
     124             : {
     125        1827 : }
     126             : 
     127           0 : SdrObjMacroHitRec::SdrObjMacroHitRec() :
     128             :     pOut(NULL),
     129             :     pVisiLayer(NULL),
     130             :     pPageView(NULL),
     131             :     nTol(0),
     132           0 :     bDown(false) {}
     133             : 
     134             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     135             : 
     136           0 : TYPEINIT0(SdrObjUserData);
     137             : 
     138        1144 : SdrObjUserData::SdrObjUserData(sal_uInt32 nInv, sal_uInt16 nId, sal_uInt16 nVer) :
     139             :     nInventor(nInv),
     140             :     nIdentifier(nId),
     141        1144 :     nVersion(nVer) {}
     142             : 
     143           2 : SdrObjUserData::SdrObjUserData(const SdrObjUserData& rData) :
     144             :     nInventor(rData.nInventor),
     145             :     nIdentifier(rData.nIdentifier),
     146           2 :     nVersion(rData.nVersion) {}
     147             : 
     148        1034 : SdrObjUserData::~SdrObjUserData() {}
     149             : 
     150        8294 : sal_uInt32 SdrObjUserData::GetInventor() const
     151             : {
     152        8294 :     return nInventor;
     153             : }
     154             : 
     155        6968 : sal_uInt16 SdrObjUserData::GetId() const
     156             : {
     157        6968 :     return nIdentifier;
     158             : }
     159             : 
     160           0 : bool SdrObjUserData::HasMacro(const SdrObject* /*pObj*/) const
     161             : {
     162           0 :     return false;
     163             : }
     164             : 
     165           0 : SdrObject* SdrObjUserData::CheckMacroHit(const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const
     166             : {
     167           0 :     if(pObj)
     168             :     {
     169           0 :         if(rRec.pPageView)
     170             :         {
     171           0 :             return SdrObjectPrimitiveHit(*pObj, rRec.aPos, rRec.nTol, *rRec.pPageView, rRec.pVisiLayer, false);
     172             :         }
     173             :     }
     174             : 
     175           0 :     return 0;
     176             : }
     177             : 
     178           0 : Pointer SdrObjUserData::GetMacroPointer(const SdrObjMacroHitRec& /*rRec*/, const SdrObject* /*pObj*/) const
     179             : {
     180           0 :     return Pointer(POINTER_REFHAND);
     181             : }
     182             : 
     183           0 : void SdrObjUserData::PaintMacro(OutputDevice& rOut, const Rectangle& /*rDirtyRect*/, const SdrObjMacroHitRec& /*rRec*/, const SdrObject* pObj) const
     184             : {
     185           0 :     if(!pObj)
     186           0 :         return;
     187             : 
     188           0 :     const RasterOp eRop(rOut.GetRasterOp());
     189           0 :     const basegfx::B2DPolyPolygon aPolyPolygon(pObj->TakeXorPoly());
     190           0 :     const sal_uInt32 nCount(aPolyPolygon.count());
     191             : 
     192           0 :     rOut.SetLineColor(COL_BLACK);
     193           0 :     rOut.SetFillColor();
     194           0 :     rOut.SetRasterOp(ROP_INVERT);
     195             : 
     196           0 :     for(sal_uInt32 a(0); a < nCount; a++)
     197             :     {
     198           0 :         rOut.DrawPolyLine(aPolyPolygon.getB2DPolygon(a));
     199             :     }
     200             : 
     201           0 :     rOut.SetRasterOp(eRop);
     202             : }
     203             : 
     204           0 : bool SdrObjUserData::DoMacro(const SdrObjMacroHitRec& /*rRec*/, SdrObject* /*pObj*/)
     205             : {
     206           0 :     return false;
     207             : }
     208             : 
     209           0 : rtl::OUString SdrObjUserData::GetMacroPopupComment(const SdrObjMacroHitRec& /*rRec*/, const SdrObject* /*pObj*/) const
     210             : {
     211           0 :     return rtl::OUString();
     212             : }
     213             : 
     214        1120 : SdrObjUserDataList::SdrObjUserDataList() {}
     215        1008 : SdrObjUserDataList::~SdrObjUserDataList() {}
     216             : 
     217        8296 : size_t SdrObjUserDataList::GetUserDataCount() const
     218             : {
     219        8296 :     return static_cast<sal_uInt16>(maList.size());
     220             : }
     221             : 
     222           0 : const SdrObjUserData* SdrObjUserDataList::GetUserData(size_t nNum) const
     223             : {
     224           0 :     return &maList.at(nNum);
     225             : }
     226             : 
     227        8296 : SdrObjUserData* SdrObjUserDataList::GetUserData(size_t nNum)
     228             : {
     229        8296 :     return &maList.at(nNum);
     230             : }
     231             : 
     232        1120 : void SdrObjUserDataList::AppendUserData(SdrObjUserData* pData)
     233             : {
     234        1120 :     maList.push_back(pData);
     235        1120 : }
     236             : 
     237           0 : void SdrObjUserDataList::DeleteUserData(size_t nNum)
     238             : {
     239           0 :     maList.erase(maList.begin()+nNum);
     240           0 : }
     241             : 
     242             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     243             : 
     244             : DBG_NAME(SdrObjGeoData);
     245             : 
     246         156 : SdrObjGeoData::SdrObjGeoData():
     247             :     pGPL(NULL),
     248             :     bMovProt(false),
     249             :     bSizProt(false),
     250             :     bNoPrint(false),
     251             :     bClosedObj(false),
     252             :     mbVisible(true),
     253         156 :     mnLayerID(0)
     254             : {
     255             :     DBG_CTOR(SdrObjGeoData,NULL);
     256         156 : }
     257             : 
     258         156 : SdrObjGeoData::~SdrObjGeoData()
     259             : {
     260             :     DBG_DTOR(SdrObjGeoData,NULL);
     261         156 :     delete pGPL;
     262         156 : }
     263             : 
     264             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     265             : 
     266           0 : TYPEINIT0(SdrObjPlusData);
     267             : 
     268        4766 : SdrObjPlusData::SdrObjPlusData():
     269             :     pBroadcast(NULL),
     270             :     pUserDataList(NULL),
     271        4766 :     pGluePoints(NULL)
     272             : {
     273        4766 : }
     274             : 
     275       13026 : SdrObjPlusData::~SdrObjPlusData()
     276             : {
     277        4342 :     if (pBroadcast   !=NULL) delete pBroadcast;
     278        4342 :     if (pUserDataList!=NULL) delete pUserDataList;
     279        4342 :     if (pGluePoints  !=NULL) delete pGluePoints;
     280        8684 : }
     281             : 
     282           4 : SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const
     283             : {
     284           4 :     SdrObjPlusData* pNeuPlusData=new SdrObjPlusData;
     285           4 :     if (pUserDataList!=NULL) {
     286           2 :         sal_uInt16 nAnz=pUserDataList->GetUserDataCount();
     287           2 :         if (nAnz!=0) {
     288           2 :             pNeuPlusData->pUserDataList=new SdrObjUserDataList;
     289           4 :             for (sal_uInt16 i=0; i<nAnz; i++) {
     290           2 :                 SdrObjUserData* pNeuUserData=pUserDataList->GetUserData(i)->Clone(pObj1);
     291           2 :                 if (pNeuUserData!=NULL) {
     292           2 :                     pNeuPlusData->pUserDataList->AppendUserData(pNeuUserData);
     293             :                 } else {
     294             :                     OSL_FAIL("SdrObjPlusData::Clone(): UserData.Clone() returns NULL.");
     295             :                 }
     296             :             }
     297             :         }
     298             :     }
     299           4 :     if (pGluePoints!=NULL) pNeuPlusData->pGluePoints=new SdrGluePointList(*pGluePoints);
     300             :     // MtfAnimator isn't copied either
     301             : 
     302             :     // #i68101#
     303             :     // copy object name, title and description
     304           4 :     pNeuPlusData->aObjName = aObjName;
     305           4 :     pNeuPlusData->aObjTitle = aObjTitle;
     306           4 :     pNeuPlusData->aObjDescription = aObjDescription;
     307             : 
     308           4 :     return pNeuPlusData;
     309             : }
     310             : 
     311           0 : void SdrObjPlusData::SetGluePoints(const SdrGluePointList& rPts)
     312             : {
     313           0 :     return *pGluePoints = rPts;
     314             : }
     315             : 
     316           0 : SdrObjTransformInfoRec::SdrObjTransformInfoRec() :
     317             :     bSelectAllowed(true),
     318             :     bMoveAllowed(true),
     319             :     bResizeFreeAllowed(true),
     320             :     bResizePropAllowed(true),
     321             :     bRotateFreeAllowed(true),
     322             :     bRotate90Allowed(true),
     323             :     bMirrorFreeAllowed(true),
     324             :     bMirror45Allowed(true),
     325             :     bMirror90Allowed(true),
     326             :     bTransparenceAllowed(true),
     327             :     bGradientAllowed(true),
     328             :     bShearAllowed(true),
     329             :     bEdgeRadiusAllowed(true),
     330             :     bNoOrthoDesired(true),
     331             :     bNoContortion(true),
     332             :     bCanConvToPath(true),
     333             :     bCanConvToPoly(true),
     334             :     bCanConvToContour(false),
     335             :     bCanConvToPathLineToArea(true),
     336           0 :     bCanConvToPolyLineToArea(true) {}
     337             : 
     338             : //////////////////////////////////////////////////////////////////////////////
     339             : // BaseProperties section
     340             : 
     341           0 : sdr::properties::BaseProperties* SdrObject::CreateObjectSpecificProperties()
     342             : {
     343           0 :     return new sdr::properties::EmptyProperties(*this);
     344             : }
     345             : 
     346      603756 : sdr::properties::BaseProperties& SdrObject::GetProperties() const
     347             : {
     348      603756 :     if(!mpProperties)
     349             :     {
     350             :         const_cast< SdrObject* >(this)->mpProperties =
     351       10914 :             const_cast< SdrObject* >(this)->CreateObjectSpecificProperties();
     352             :     }
     353             : 
     354      603756 :     return *mpProperties;
     355             : }
     356             : 
     357             : //////////////////////////////////////////////////////////////////////////////
     358             : // ObjectUser section
     359             : 
     360       17932 : void SdrObject::AddObjectUser(sdr::ObjectUser& rNewUser)
     361             : {
     362       17932 :     maObjectUsers.push_back(&rNewUser);
     363       17932 : }
     364             : 
     365       31384 : void SdrObject::RemoveObjectUser(sdr::ObjectUser& rOldUser)
     366             : {
     367       31384 :     const ::sdr::ObjectUserVector::iterator aFindResult = ::std::find(maObjectUsers.begin(), maObjectUsers.end(), &rOldUser);
     368       31384 :     if(aFindResult != maObjectUsers.end())
     369             :     {
     370       16990 :         maObjectUsers.erase(aFindResult);
     371             :     }
     372       31384 : }
     373             : 
     374             : //////////////////////////////////////////////////////////////////////////////
     375             : // DrawContact section
     376             : 
     377           0 : sdr::contact::ViewContact* SdrObject::CreateObjectSpecificViewContact()
     378             : {
     379           0 :     return new sdr::contact::ViewContactOfSdrObj(*this);
     380             : }
     381             : 
     382      178705 : sdr::contact::ViewContact& SdrObject::GetViewContact() const
     383             : {
     384      178705 :     if(!mpViewContact)
     385             :     {
     386             :         const_cast< SdrObject* >(this)->mpViewContact =
     387       11762 :             const_cast< SdrObject* >(this)->CreateObjectSpecificViewContact();
     388             :     }
     389             : 
     390      178705 :     return *mpViewContact;
     391             : }
     392             : 
     393             : // DrawContact support: Methods for handling Object changes
     394      106197 : void SdrObject::ActionChanged() const
     395             : {
     396             :     // Do necessary ViewContact actions
     397      106197 :     GetViewContact().ActionChanged();
     398      106197 : }
     399             : 
     400             : //////////////////////////////////////////////////////////////////////////////
     401             : 
     402       98104 : void SdrObject::SetBoundRectDirty()
     403             : {
     404       98104 :     aOutRect = Rectangle();
     405       98104 : }
     406             : 
     407             : //////////////////////////////////////////////////////////////////////////////
     408             : 
     409             : DBG_NAME(SdrObject);
     410      249752 : TYPEINIT1(SdrObject,SfxListener);
     411             : 
     412       12048 : SdrObject::SdrObject()
     413             :     :mpProperties(0L)
     414             :     ,mpViewContact(0L)
     415             :     ,pObjList(NULL)
     416             :     ,pPage(NULL)
     417             :     ,pModel(NULL)
     418             :     ,pUserCall(NULL)
     419             :     ,pPlusData(NULL)
     420             :     ,nOrdNum(0)
     421             :     ,mnNavigationPosition(SAL_MAX_UINT32)
     422             :     ,mnLayerID(0)
     423             :     ,mpSvxShape( NULL )
     424       12048 :     ,maWeakUnoShape()
     425             : {
     426             :     DBG_CTOR(SdrObject,NULL);
     427       12048 :     bVirtObj         =false;
     428       12048 :     bSnapRectDirty   =true;
     429       12048 :     bNetLock         =false;
     430       12048 :     bInserted        =false;
     431       12048 :     bGrouped         =false;
     432       12048 :     bMovProt         =false;
     433       12048 :     bSizProt         =false;
     434       12048 :     bNoPrint         =false;
     435       12048 :     bEmptyPresObj    =false;
     436       12048 :     bNotVisibleAsMaster=false;
     437       12048 :     bClosedObj       =false;
     438       12048 :     mbVisible        = true;
     439             : 
     440             :     // #i25616#
     441       12048 :     mbLineIsOutsideGeometry = false;
     442             : 
     443             :     // #i25616#
     444       12048 :     mbSupportTextIndentingOnLineWidthChange = false;
     445             : 
     446       12048 :     bNotMasterCachable=false;
     447       12048 :     bIsEdge=false;
     448       12048 :     bIs3DObj=false;
     449       12048 :     bMarkProt=false;
     450       12048 :     bIsUnoObj=false;
     451       12048 : }
     452             : 
     453       22492 : SdrObject::~SdrObject()
     454             : {
     455             :     // tell all the registered ObjectUsers that the page is in destruction
     456       11246 :     ::sdr::ObjectUserVector aListCopy(maObjectUsers.begin(), maObjectUsers.end());
     457       12094 :     for(::sdr::ObjectUserVector::iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); ++aIterator)
     458             :     {
     459         848 :         sdr::ObjectUser* pObjectUser = *aIterator;
     460             :         DBG_ASSERT(pObjectUser, "SdrObject::~SdrObject: corrupt ObjectUser list (!)");
     461         848 :         pObjectUser->ObjectInDestruction(*this);
     462             :     }
     463             : 
     464             :     // Clear the vector. This means that user do not need to call RemoveObjectUser()
     465             :     // when they get called from ObjectInDestruction().
     466       11246 :     maObjectUsers.clear();
     467             : 
     468             :     try
     469             :     {
     470       11246 :         SvxShape* pSvxShape = getSvxShape();
     471       11246 :         if ( pSvxShape )
     472             :         {
     473             :             OSL_ENSURE(!pSvxShape->HasSdrObjectOwnership(),"Please check where this call come from and replace it with SdrObject::Free");
     474        1292 :             pSvxShape->InvalidateSdrObject();
     475        1292 :             uno::Reference< lang::XComponent > xShapeComp( getWeakUnoShape(), uno::UNO_QUERY_THROW );
     476        1292 :             xShapeComp->dispose();
     477             :         }
     478             :     }
     479           0 :     catch( const uno::Exception& )
     480             :     {
     481             :         DBG_UNHANDLED_EXCEPTION();
     482             :     }
     483             : 
     484             :     DBG_DTOR(SdrObject,NULL);
     485       11246 :     SendUserCall(SDRUSERCALL_DELETE, GetLastBoundRect());
     486       11246 :     if (pPlusData!=NULL) delete pPlusData;
     487             : 
     488       11246 :     if(mpProperties)
     489             :     {
     490       10748 :         delete mpProperties;
     491       10748 :         mpProperties = 0L;
     492             :     }
     493             : 
     494       11246 :     if(mpViewContact)
     495             :     {
     496       11162 :         delete mpViewContact;
     497       11162 :         mpViewContact = 0L;
     498       11246 :     }
     499       11246 : }
     500             : 
     501       99340 : void SdrObject::Free( SdrObject*& _rpObject )
     502             : {
     503       99340 :     SdrObject* pObject = _rpObject; _rpObject = NULL;
     504       99340 :     if ( pObject == NULL )
     505             :         // nothing to do
     506       88374 :         return;
     507             : 
     508       10966 :     SvxShape* pShape = pObject->getSvxShape();
     509       10966 :     if ( pShape && pShape->HasSdrObjectOwnership() )
     510             :         // only the shape is allowed to delete me, and will reset the ownership before doing so
     511           0 :         return;
     512             : 
     513       10966 :     delete pObject;
     514             : }
     515             : 
     516        4762 : SdrObjPlusData* SdrObject::NewPlusData() const
     517             : {
     518        4762 :     return new SdrObjPlusData;
     519             : }
     520             : 
     521      105409 : void SdrObject::SetRectsDirty(sal_Bool bNotMyself)
     522             : {
     523      105409 :     if (!bNotMyself) {
     524       35110 :         SetBoundRectDirty();
     525       35110 :         bSnapRectDirty=true;
     526             :     }
     527      105409 :     if (pObjList!=NULL) {
     528       51099 :         pObjList->SetRectsDirty();
     529             :     }
     530      105409 : }
     531             : 
     532       17090 : void SdrObject::SetModel(SdrModel* pNewModel)
     533             : {
     534       17090 :     if(pNewModel && pPage)
     535             :     {
     536       12430 :         if(pPage->GetModel() != pNewModel)
     537             :         {
     538           0 :             pPage = NULL;
     539             :         }
     540             :     }
     541             : 
     542             :     // update listeners at possible API wrapper object
     543       17090 :     if( pModel != pNewModel )
     544             :     {
     545       11904 :         SvxShape* pShape = getSvxShape();
     546       11904 :         if( pShape )
     547          26 :             pShape->ChangeModel( pNewModel );
     548             :     }
     549             : 
     550       17090 :     pModel = pNewModel;
     551       17090 : }
     552             : 
     553      284424 : SdrModel* SdrObject::GetModel() const
     554             : {
     555      284424 :     return pModel;
     556             : }
     557             : 
     558       12742 : void SdrObject::SetObjList(SdrObjList* pNewObjList)
     559             : {
     560       12742 :     pObjList=pNewObjList;
     561       12742 : }
     562             : 
     563      113707 : SdrObjList* SdrObject::GetObjList() const
     564             : {
     565      113707 :     return pObjList;
     566             : }
     567             : 
     568       20286 : void SdrObject::SetPage(SdrPage* pNewPage)
     569             : {
     570       20286 :     pPage=pNewPage;
     571       20286 :     if (pPage!=NULL) {
     572       16272 :         SdrModel* pMod=pPage->GetModel();
     573       16272 :         if (pMod!=pModel && pMod!=NULL) {
     574        8152 :             SetModel(pMod);
     575             :         }}
     576       20286 : }
     577             : 
     578       29897 : SdrPage* SdrObject::GetPage() const
     579             : {
     580       29897 :     return pPage;
     581             : }
     582             : 
     583             : // init global static itempool
     584             : SdrItemPool* SdrObject::mpGlobalItemPool = NULL;
     585             : 
     586       54182 : SdrItemPool& SdrObject::GetGlobalDrawObjectItemPool()
     587             : {
     588       54182 :     if(!mpGlobalItemPool)
     589             :     {
     590          53 :         mpGlobalItemPool = new SdrItemPool();
     591          53 :         SfxItemPool* pGlobalOutlPool = EditEngine::CreatePool();
     592          53 :         mpGlobalItemPool->SetSecondaryPool(pGlobalOutlPool);
     593          53 :         mpGlobalItemPool->SetDefaultMetric((SfxMapUnit)SdrEngineDefaults::GetMapUnit());
     594          53 :         mpGlobalItemPool->FreezeIdRanges();
     595             :     }
     596             : 
     597       54182 :     return *mpGlobalItemPool;
     598             : }
     599             : 
     600       90972 : SdrItemPool* SdrObject::GetObjectItemPool() const
     601             : {
     602       90972 :     if(pModel)
     603       57384 :         return (SdrItemPool*)(&pModel->GetItemPool());
     604             : 
     605             :     // use a static global default pool
     606       33588 :     return &SdrObject::GetGlobalDrawObjectItemPool();
     607             : }
     608             : 
     609      117870 : sal_uInt32 SdrObject::GetObjInventor()   const
     610             : {
     611      117870 :     return SdrInventor;
     612             : }
     613             : 
     614           0 : sal_uInt16 SdrObject::GetObjIdentifier() const
     615             : {
     616           0 :     return sal_uInt16(OBJ_NONE);
     617             : }
     618             : 
     619           0 : void SdrObject::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
     620             : {
     621           0 :     rInfo.bRotateFreeAllowed=false;
     622           0 :     rInfo.bMirrorFreeAllowed=false;
     623           0 :     rInfo.bTransparenceAllowed = false;
     624           0 :     rInfo.bGradientAllowed = false;
     625           0 :     rInfo.bShearAllowed     =false;
     626           0 :     rInfo.bEdgeRadiusAllowed=false;
     627           0 :     rInfo.bCanConvToPath    =false;
     628           0 :     rInfo.bCanConvToPoly    =false;
     629           0 :     rInfo.bCanConvToContour = false;
     630           0 :     rInfo.bCanConvToPathLineToArea=false;
     631           0 :     rInfo.bCanConvToPolyLineToArea=false;
     632           0 : }
     633             : 
     634       16937 : SdrLayerID SdrObject::GetLayer() const
     635             : {
     636       16937 :     return mnLayerID;
     637             : }
     638             : 
     639          16 : void SdrObject::getMergedHierarchyLayerSet(SetOfByte& rSet) const
     640             : {
     641          16 :     rSet.Set(GetLayer());
     642          16 :     SdrObjList* pOL=GetSubList();
     643          16 :     if (pOL!=NULL) {
     644           0 :         sal_uIntPtr nObjAnz=pOL->GetObjCount();
     645           0 :         for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz; nObjNum++) {
     646           0 :             pOL->GetObj(nObjNum)->getMergedHierarchyLayerSet(rSet);
     647             :         }
     648             :     }
     649          16 : }
     650             : 
     651        2616 : void SdrObject::NbcSetLayer(SdrLayerID nLayer)
     652             : {
     653        2616 :     if(GetLayer() != nLayer)
     654             :     {
     655        1718 :         mnLayerID = nLayer;
     656             :     }
     657        2616 : }
     658             : 
     659        1662 : void SdrObject::SetLayer(SdrLayerID nLayer)
     660             : {
     661        1662 :     NbcSetLayer(nLayer);
     662        1662 :     SetChanged();
     663        1662 :     BroadcastObjectChange();
     664        1662 : }
     665             : 
     666         384 : void SdrObject::AddListener(SfxListener& rListener)
     667             : {
     668         384 :     ImpForcePlusData();
     669         384 :     if (pPlusData->pBroadcast==NULL) pPlusData->pBroadcast=new SfxBroadcaster;
     670         384 :     rListener.StartListening(*pPlusData->pBroadcast);
     671         384 : }
     672             : 
     673          92 : void SdrObject::RemoveListener(SfxListener& rListener)
     674             : {
     675          92 :     if (pPlusData!=NULL && pPlusData->pBroadcast!=NULL) {
     676          92 :         rListener.EndListening(*pPlusData->pBroadcast);
     677          92 :         if (!pPlusData->pBroadcast->HasListeners()) {
     678          92 :             delete pPlusData->pBroadcast;
     679          92 :             pPlusData->pBroadcast=NULL;
     680             :         }
     681             :     }
     682          92 : }
     683             : 
     684           0 : const SfxBroadcaster* SdrObject::GetBroadcaster() const
     685             : {
     686           0 :     return pPlusData!=NULL ? pPlusData->pBroadcast : NULL;
     687             : }
     688             : 
     689         384 : void SdrObject::AddReference(SdrVirtObj& rVrtObj)
     690             : {
     691         384 :     AddListener(rVrtObj);
     692         384 : }
     693             : 
     694          92 : void SdrObject::DelReference(SdrVirtObj& rVrtObj)
     695             : {
     696          92 :     RemoveListener(rVrtObj);
     697          92 : }
     698             : 
     699           0 : bool SdrObject::HasRefPoint() const
     700             : {
     701           0 :     return false;
     702             : }
     703             : 
     704           0 : Point SdrObject::GetRefPoint() const
     705             : {
     706           0 :     return GetCurrentBoundRect().Center();
     707             : }
     708             : 
     709           0 : void SdrObject::SetRefPoint(const Point& /*rPnt*/)
     710             : {
     711           0 : }
     712             : 
     713       12480 : bool SdrObject::IsGroupObject() const
     714             : {
     715       12480 :     return GetSubList()!=NULL;
     716             : }
     717             : 
     718       42320 : SdrObjList* SdrObject::GetSubList() const
     719             : {
     720       42320 :     return NULL;
     721             : }
     722             : 
     723         558 : SdrObject* SdrObject::GetUpGroup() const
     724             : {
     725         558 :     return pObjList!=NULL ? pObjList->GetOwnerObj() : NULL;
     726             : }
     727             : 
     728        3372 : void SdrObject::SetName(const rtl::OUString& rStr)
     729             : {
     730        3372 :     if (!rStr.isEmpty() && !pPlusData)
     731             :     {
     732        3244 :         ImpForcePlusData();
     733             :     }
     734             : 
     735        3372 :     if(pPlusData && !pPlusData->aObjName.equals(rStr))
     736             :     {
     737             :         // Undo/Redo for setting object's name (#i73249#)
     738        3280 :         bool bUndo( false );
     739        3280 :         if ( GetModel() && GetModel()->IsUndoEnabled() )
     740             :         {
     741         128 :             bUndo = true;
     742             :             SdrUndoAction* pUndoAction =
     743         128 :                     GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr(
     744             :                                                     *this,
     745             :                                                     SdrUndoObjStrAttr::OBJ_NAME,
     746             :                                                     GetName(),
     747         128 :                                                     rStr );
     748         128 :             GetModel()->BegUndo( pUndoAction->GetComment() );
     749         128 :             GetModel()->AddUndo( pUndoAction );
     750             :         }
     751        3280 :         pPlusData->aObjName = rStr;
     752             :         // Undo/Redo for setting object's name (#i73249#)
     753        3280 :         if ( bUndo )
     754             :         {
     755         128 :             GetModel()->EndUndo();
     756             :         }
     757        3280 :         SetChanged();
     758        3280 :         BroadcastObjectChange();
     759             :     }
     760        3372 : }
     761             : 
     762        4094 : rtl::OUString SdrObject::GetName() const
     763             : {
     764        4094 :     if(pPlusData)
     765             :     {
     766        2540 :         return pPlusData->aObjName;
     767             :     }
     768             : 
     769        1554 :     return rtl::OUString();
     770             : }
     771             : 
     772           2 : void SdrObject::SetTitle(const rtl::OUString& rStr)
     773             : {
     774           2 :     if (!rStr.isEmpty() && !pPlusData)
     775             :     {
     776           0 :         ImpForcePlusData();
     777             :     }
     778             : 
     779           2 :     if(pPlusData && pPlusData->aObjTitle != rStr)
     780             :     {
     781             :         // Undo/Redo for setting object's title (#i73249#)
     782           0 :         bool bUndo( false );
     783           0 :         if ( GetModel() && GetModel()->IsUndoEnabled() )
     784             :         {
     785           0 :             bUndo = true;
     786             :             SdrUndoAction* pUndoAction =
     787           0 :                     GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr(
     788             :                                                     *this,
     789             :                                                     SdrUndoObjStrAttr::OBJ_TITLE,
     790             :                                                     GetTitle(),
     791           0 :                                                     rStr );
     792           0 :             GetModel()->BegUndo( pUndoAction->GetComment() );
     793           0 :             GetModel()->AddUndo( pUndoAction );
     794             :         }
     795           0 :         pPlusData->aObjTitle = rStr;
     796             :         // Undo/Redo for setting object's title (#i73249#)
     797           0 :         if ( bUndo )
     798             :         {
     799           0 :             GetModel()->EndUndo();
     800             :         }
     801           0 :         SetChanged();
     802           0 :         BroadcastObjectChange();
     803             :     }
     804           2 : }
     805             : 
     806         164 : rtl::OUString SdrObject::GetTitle() const
     807             : {
     808         164 :     if(pPlusData)
     809             :     {
     810         118 :         return pPlusData->aObjTitle;
     811             :     }
     812             : 
     813          46 :     return rtl::OUString();
     814             : }
     815             : 
     816          32 : void SdrObject::SetDescription(const rtl::OUString& rStr)
     817             : {
     818          32 :     if (!rStr.isEmpty() && !pPlusData)
     819             :     {
     820          28 :         ImpForcePlusData();
     821             :     }
     822             : 
     823          32 :     if(pPlusData && !pPlusData->aObjDescription.equals(rStr))
     824             :     {
     825             :         // Undo/Redo for setting object's description (#i73249#)
     826          28 :         bool bUndo( false );
     827          28 :         if ( GetModel() && GetModel()->IsUndoEnabled() )
     828             :         {
     829           0 :             bUndo = true;
     830             :             SdrUndoAction* pUndoAction =
     831           0 :                     GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr(
     832             :                                                     *this,
     833             :                                                     SdrUndoObjStrAttr::OBJ_DESCRIPTION,
     834             :                                                     GetDescription(),
     835           0 :                                                     rStr );
     836           0 :             GetModel()->BegUndo( pUndoAction->GetComment() );
     837           0 :             GetModel()->AddUndo( pUndoAction );
     838             :         }
     839          28 :         pPlusData->aObjDescription = rStr;
     840             :         // Undo/Redo for setting object's description (#i73249#)
     841          28 :         if ( bUndo )
     842             :         {
     843           0 :             GetModel()->EndUndo();
     844             :         }
     845          28 :         SetChanged();
     846          28 :         BroadcastObjectChange();
     847             :     }
     848          32 : }
     849             : 
     850         200 : rtl::OUString SdrObject::GetDescription() const
     851             : {
     852         200 :     if(pPlusData)
     853             :     {
     854         134 :         return pPlusData->aObjDescription;
     855             :     }
     856             : 
     857          66 :     return rtl::OUString();
     858             : }
     859             : 
     860        3000 : sal_uInt32 SdrObject::GetOrdNum() const
     861             : {
     862        3000 :     if (pObjList!=NULL) {
     863        3000 :         if (pObjList->IsObjOrdNumsDirty()) {
     864        1500 :             pObjList->RecalcObjOrdNums();
     865             :         }
     866           0 :     } else ((SdrObject*)this)->nOrdNum=0;
     867        3000 :     return nOrdNum;
     868             : }
     869             : 
     870        2376 : sal_uInt32 SdrObject::GetOrdNumDirect() const
     871             : {
     872        2376 :     return nOrdNum;
     873             : }
     874             : 
     875       17002 : void SdrObject::SetOrdNum(sal_uInt32 nNum)
     876             : {
     877       17002 :     nOrdNum = nNum;
     878       17002 : }
     879             : 
     880         154 : sal_uInt32 SdrObject::GetNavigationPosition (void)
     881             : {
     882         154 :     if (pObjList!=NULL && pObjList->RecalcNavigationPositions())
     883             :     {
     884           0 :         return mnNavigationPosition;
     885             :     }
     886             :     else
     887         154 :         return GetOrdNum();
     888             : }
     889             : 
     890             : 
     891             : 
     892             : 
     893           0 : void SdrObject::SetNavigationPosition (const sal_uInt32 nNewPosition)
     894             : {
     895           0 :     mnNavigationPosition = nNewPosition;
     896           0 : }
     897             : 
     898             : 
     899             : 
     900             : 
     901             : // To make clearer that this method may trigger RecalcBoundRect and thus may be
     902             : // expensive and sometimes problematic (inside a bigger object change you will get
     903             : // non-useful BoundRects sometimes) I rename that method from GetBoundRect() to
     904             : // GetCurrentBoundRect().
     905        9493 : const Rectangle& SdrObject::GetCurrentBoundRect() const
     906             : {
     907        9493 :     if(aOutRect.IsEmpty())
     908             :     {
     909        8999 :         const_cast< SdrObject* >(this)->RecalcBoundRect();
     910             :     }
     911             : 
     912        9493 :     return aOutRect;
     913             : }
     914             : 
     915             : // To have a possibility to get the last calculated BoundRect e.g for producing
     916             : // the first rectangle for repaints (old and new need to be used) without forcing
     917             : // a RecalcBoundRect (which may be problematical and expensive sometimes) I add here
     918             : // a new method for accessing the last BoundRect.
     919       57068 : const Rectangle& SdrObject::GetLastBoundRect() const
     920             : {
     921       57068 :     return aOutRect;
     922             : }
     923             : 
     924        9661 : void SdrObject::RecalcBoundRect()
     925             : {
     926             :     // #i101680# suppress BoundRect calculations on import(s)
     927        9661 :     if(pModel && pModel->isLocked())
     928        8517 :         return;
     929             : 
     930             :     // central new method which will calculate the BoundRect using primitive geometry
     931        1144 :     if(aOutRect.IsEmpty())
     932             :     {
     933        1116 :         const drawinglayer::primitive2d::Primitive2DSequence xPrimitives(GetViewContact().getViewIndependentPrimitive2DSequence());
     934             : 
     935        1116 :         if(xPrimitives.hasElements())
     936             :         {
     937             :             // use neutral ViewInformation and get the range of the primitives
     938         644 :             const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
     939         644 :             const basegfx::B2DRange aRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xPrimitives, aViewInformation2D));
     940             : 
     941         644 :             if(!aRange.isEmpty())
     942             :             {
     943             :                 aOutRect = Rectangle(
     944        1288 :                         (sal_Int32)floor(aRange.getMinX()), (sal_Int32)floor(aRange.getMinY()),
     945        1932 :                         (sal_Int32)ceil(aRange.getMaxX()), (sal_Int32)ceil(aRange.getMaxY()));
     946             :                 return;
     947         644 :             }
     948        1116 :         }
     949             :     }
     950             : }
     951             : 
     952       65919 : void SdrObject::BroadcastObjectChange() const
     953             : {
     954       65919 :     if( pModel && pModel->isLocked() )
     955      126889 :         return;
     956             : 
     957        4949 :     sal_Bool bPlusDataBroadcast(pPlusData && pPlusData->pBroadcast);
     958        4949 :     sal_Bool bObjectChange(IsInserted() && pModel);
     959             : 
     960        4949 :     if(bPlusDataBroadcast || bObjectChange)
     961             :     {
     962        3259 :         SdrHint aHint(*this);
     963             : 
     964        3259 :         if(bPlusDataBroadcast)
     965             :         {
     966           0 :             pPlusData->pBroadcast->Broadcast(aHint);
     967             :         }
     968             : 
     969        3259 :         if(bObjectChange)
     970             :         {
     971        3259 :             pModel->Broadcast(aHint);
     972        3259 :         }
     973             :     }
     974             : }
     975             : 
     976       91417 : void SdrObject::SetChanged()
     977             : {
     978             :     // For testing purposes, use the new ViewContact for change
     979             :     // notification now.
     980       91417 :     ActionChanged();
     981             : 
     982       91417 :     if(IsInserted() && pModel)
     983             :     {
     984       47611 :         pModel->SetChanged();
     985             :     }
     986       91417 : }
     987             : 
     988             : // tooling for painting a single object to an OutputDevice.
     989          24 : bool SdrObject::SingleObjectPainter(OutputDevice& rOut) const
     990             : {
     991          24 :     sdr::contact::SdrObjectVector aObjectVector;
     992          24 :     aObjectVector.push_back(const_cast< SdrObject* >(this));
     993             : 
     994          24 :     sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, aObjectVector, GetPage());
     995          24 :     sdr::contact::DisplayInfo aDisplayInfo;
     996             : 
     997          24 :     aPainter.ProcessDisplay(aDisplayInfo);
     998             : 
     999          24 :     return true;
    1000             : }
    1001             : 
    1002           0 : bool SdrObject::LineGeometryUsageIsNecessary() const
    1003             : {
    1004           0 :     XLineStyle eXLS = (XLineStyle)((const XLineStyleItem&)GetMergedItem(XATTR_LINESTYLE)).GetValue();
    1005           0 :     return (eXLS != XLINE_NONE);
    1006             : }
    1007             : 
    1008           0 : SdrObject* SdrObject::Clone() const
    1009             : {
    1010           0 :     return CloneHelper< SdrObject >();
    1011             : }
    1012             : 
    1013           8 : SdrObject& SdrObject::operator=(const SdrObject& rObj)
    1014             : {
    1015           8 :     if( this == &rObj )
    1016           0 :         return *this;
    1017             : 
    1018           8 :     if(mpProperties)
    1019             :     {
    1020           0 :         delete mpProperties;
    1021           0 :         mpProperties = 0L;
    1022             :     }
    1023             : 
    1024           8 :     if(mpViewContact)
    1025             :     {
    1026           0 :         delete mpViewContact;
    1027           0 :         mpViewContact = 0L;
    1028             :     }
    1029             : 
    1030             :     // The Clone() method uses the local copy constructor from the individual
    1031             :     // sdr::properties::BaseProperties class. Since the target class maybe for another
    1032             :     // draw object, an SdrObject needs to be provided, as in the normal constructor.
    1033           8 :     mpProperties = &rObj.GetProperties().Clone(*this);
    1034             : 
    1035           8 :     pModel  =rObj.pModel;
    1036           8 :     pPage = rObj.pPage;
    1037           8 :     aOutRect=rObj.aOutRect;
    1038           8 :     mnLayerID = rObj.mnLayerID;
    1039           8 :     aAnchor =rObj.aAnchor;
    1040           8 :     bVirtObj=rObj.bVirtObj;
    1041           8 :     bSizProt=rObj.bSizProt;
    1042           8 :     bMovProt=rObj.bMovProt;
    1043           8 :     bNoPrint=rObj.bNoPrint;
    1044           8 :     mbVisible=rObj.mbVisible;
    1045           8 :     bMarkProt=rObj.bMarkProt;
    1046           8 :     bEmptyPresObj =rObj.bEmptyPresObj;
    1047           8 :     bNotVisibleAsMaster=rObj.bNotVisibleAsMaster;
    1048           8 :     bSnapRectDirty=true;
    1049           8 :     bNotMasterCachable=rObj.bNotMasterCachable;
    1050           8 :     delete pPlusData;
    1051           8 :     pPlusData=NULL;
    1052           8 :     if (rObj.pPlusData!=NULL) {
    1053           4 :         pPlusData=rObj.pPlusData->Clone(this);
    1054             :     }
    1055           8 :     if (pPlusData!=NULL && pPlusData->pBroadcast!=NULL) {
    1056           0 :         delete pPlusData->pBroadcast; // broadcaster isn't copied
    1057           0 :         pPlusData->pBroadcast=NULL;
    1058             :     }
    1059           8 :     aGridOffset = rObj.aGridOffset;
    1060           8 :     return *this;
    1061             : }
    1062             : 
    1063           0 : void SdrObject::TakeObjNameSingul(XubString& rName) const
    1064             : {
    1065           0 :     rName=ImpGetResStr(STR_ObjNameSingulNONE);
    1066             : 
    1067           0 :     String aName( GetName() );
    1068           0 :     if(aName.Len())
    1069             :     {
    1070           0 :         rName += sal_Unicode(' ');
    1071           0 :         rName += sal_Unicode('\'');
    1072           0 :         rName += aName;
    1073           0 :         rName += sal_Unicode('\'');
    1074           0 :     }
    1075           0 : }
    1076             : 
    1077           0 : void SdrObject::TakeObjNamePlural(XubString& rName) const
    1078             : {
    1079           0 :     rName=ImpGetResStr(STR_ObjNamePluralNONE);
    1080           0 : }
    1081             : 
    1082           0 : void SdrObject::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, rtl::OUString& rStr, sal_uInt16 nVal) const
    1083             : {
    1084           0 :     rStr = ImpGetResStr(nStrCacheID);
    1085           0 :     sal_Int32 nPos = rStr.indexOf("%1");
    1086           0 :     if (nPos >= 0)
    1087             :     {
    1088             :         // Replace '%1' with the object name.
    1089           0 :         XubString aObjName;
    1090           0 :         TakeObjNameSingul(aObjName);
    1091           0 :         rStr = rStr.replaceAt(nPos, 2, aObjName);
    1092             :     }
    1093             : 
    1094           0 :     nPos = rStr.indexOf("%2");
    1095           0 :     if (nPos >= 0)
    1096             :         // Replace '%2' with the passed value.
    1097             :         rStr = rStr.replaceAt(
    1098           0 :             nPos, 2, rtl::OUString::valueOf(static_cast<sal_Int32>(nVal)));
    1099           0 : }
    1100             : 
    1101        4790 : void SdrObject::ImpForcePlusData()
    1102             : {
    1103        4790 :     if (!pPlusData)
    1104        4762 :         pPlusData = NewPlusData();
    1105        4790 : }
    1106             : 
    1107           0 : rtl::OUString SdrObject::GetWinkStr(long nWink, bool bNoDegChar) const
    1108             : {
    1109           0 :     rtl::OUString aStr;
    1110           0 :     if (pModel!=NULL) {
    1111           0 :         pModel->TakeWinkStr(nWink,aStr,bNoDegChar);
    1112             :     }
    1113           0 :     return aStr;
    1114             : }
    1115             : 
    1116           0 : rtl::OUString SdrObject::GetMetrStr(long nVal, MapUnit /*eWantMap*/, bool bNoUnitChars) const
    1117             : {
    1118           0 :     rtl::OUString aStr;
    1119           0 :     if (pModel!=NULL) {
    1120           0 :         pModel->TakeMetricStr(nVal,aStr,bNoUnitChars);
    1121             :     }
    1122           0 :     return aStr;
    1123             : }
    1124             : 
    1125           0 : basegfx::B2DPolyPolygon SdrObject::TakeXorPoly() const
    1126             : {
    1127           0 :     basegfx::B2DPolyPolygon aRetval;
    1128           0 :     const Rectangle aR(GetCurrentBoundRect());
    1129           0 :     const basegfx::B2DRange aRange(aR.Left(), aR.Top(), aR.Right(), aR.Bottom());
    1130           0 :     aRetval.append(basegfx::tools::createPolygonFromRect(aRange));
    1131             : 
    1132           0 :     return aRetval;
    1133             : }
    1134             : 
    1135           0 : basegfx::B2DPolyPolygon SdrObject::TakeContour() const
    1136             : {
    1137           0 :     basegfx::B2DPolyPolygon aRetval;
    1138             : 
    1139             :     // create cloned object without text, but with XLINE_SOLID,
    1140             :     // COL_BLACK as line color and XFILL_NONE
    1141           0 :     SdrObject* pClone = Clone();
    1142             : 
    1143           0 :     if(pClone)
    1144             :     {
    1145           0 :         const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(this);
    1146             : 
    1147           0 :         if(pTextObj)
    1148             :         {
    1149             :             // no text and no text animation
    1150           0 :             pClone->SetMergedItem(SdrTextAniKindItem(SDRTEXTANI_NONE));
    1151           0 :             pClone->SetOutlinerParaObject(0);
    1152             :         }
    1153             : 
    1154           0 :         const SdrEdgeObj* pEdgeObj = dynamic_cast< const SdrEdgeObj* >(this);
    1155             : 
    1156           0 :         if(pEdgeObj)
    1157             :         {
    1158             :             // create connections if connector, will be cleaned up when
    1159             :             // deleting the connector again
    1160           0 :             SdrObject* pLeft = pEdgeObj->GetConnectedNode(true);
    1161           0 :             SdrObject* pRight = pEdgeObj->GetConnectedNode(false);
    1162             : 
    1163           0 :             if(pLeft)
    1164             :             {
    1165           0 :                 pClone->ConnectToNode(true, pLeft);
    1166             :             }
    1167             : 
    1168           0 :             if(pRight)
    1169             :             {
    1170           0 :                 pClone->ConnectToNode(false, pRight);
    1171             :             }
    1172             :         }
    1173             : 
    1174           0 :         SfxItemSet aNewSet(*GetObjectItemPool());
    1175             : 
    1176             :         // #i101980# ignore LineWidth; that's what the old implementation
    1177             :         // did. With line width, the result may be huge due to fat/thick
    1178             :         // line decompositions
    1179           0 :         aNewSet.Put(XLineWidthItem(0));
    1180             : 
    1181             :         // solid black lines and no fill
    1182           0 :         aNewSet.Put(XLineStyleItem(XLINE_SOLID));
    1183           0 :         aNewSet.Put(XLineColorItem(String(), Color(COL_BLACK)));
    1184           0 :         aNewSet.Put(XFillStyleItem(XFILL_NONE));
    1185           0 :         pClone->SetMergedItemSet(aNewSet);
    1186             : 
    1187             :         // get sequence from clone
    1188           0 :         const sdr::contact::ViewContact& rVC(pClone->GetViewContact());
    1189           0 :         const drawinglayer::primitive2d::Primitive2DSequence xSequence(rVC.getViewIndependentPrimitive2DSequence());
    1190             : 
    1191           0 :         if(xSequence.hasElements())
    1192             :         {
    1193             :             // use neutral ViewInformation
    1194           0 :             const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
    1195             : 
    1196             :             // create extractor, process and get result (with hairlines as opened polygons)
    1197           0 :             drawinglayer::processor2d::ContourExtractor2D aExtractor(aViewInformation2D, false);
    1198           0 :             aExtractor.process(xSequence);
    1199           0 :             const basegfx::B2DPolyPolygonVector& rResult(aExtractor.getExtractedContour());
    1200           0 :             const sal_uInt32 nSize(rResult.size());
    1201             : 
    1202             :             // when count is one, it is implied that the object has only its normal
    1203             :             // contour anyways and TakeCountour() is to return an empty PolyPolygon
    1204             :             // (see old implementation for historical reasons)
    1205           0 :             if(nSize > 1)
    1206             :             {
    1207             :                 // the topology for contour is correctly a vector of PolyPolygons; for
    1208             :                 // historical reasons cut it back to a single PolyPolygon here
    1209           0 :                 for(sal_uInt32 a(0); a < nSize; a++)
    1210             :                 {
    1211           0 :                     aRetval.append(rResult[a]);
    1212             :                 }
    1213           0 :             }
    1214             :         }
    1215             : 
    1216           0 :         delete pClone;
    1217             :     }
    1218             : 
    1219           0 :     return aRetval;
    1220             : }
    1221             : 
    1222           0 : sal_uInt32 SdrObject::GetHdlCount() const
    1223             : {
    1224           0 :     return 8L;
    1225             : }
    1226             : 
    1227           0 : SdrHdl* SdrObject::GetHdl(sal_uInt32 nHdlNum) const
    1228             : {
    1229           0 :     SdrHdl* pH=NULL;
    1230           0 :     const Rectangle& rR=GetSnapRect();
    1231           0 :     switch (nHdlNum) {
    1232           0 :         case 0: pH=new SdrHdl(rR.TopLeft(),     HDL_UPLFT); break;
    1233           0 :         case 1: pH=new SdrHdl(rR.TopCenter(),   HDL_UPPER); break;
    1234           0 :         case 2: pH=new SdrHdl(rR.TopRight(),    HDL_UPRGT); break;
    1235           0 :         case 3: pH=new SdrHdl(rR.LeftCenter(),  HDL_LEFT ); break;
    1236           0 :         case 4: pH=new SdrHdl(rR.RightCenter(), HDL_RIGHT); break;
    1237           0 :         case 5: pH=new SdrHdl(rR.BottomLeft(),  HDL_LWLFT); break;
    1238           0 :         case 6: pH=new SdrHdl(rR.BottomCenter(),HDL_LOWER); break;
    1239           0 :         case 7: pH=new SdrHdl(rR.BottomRight(), HDL_LWRGT); break;
    1240             :     }
    1241           0 :     return pH;
    1242             : }
    1243             : 
    1244           0 : sal_uInt32 SdrObject::GetPlusHdlCount(const SdrHdl& /*rHdl*/) const
    1245             : {
    1246           0 :     return 0L;
    1247             : }
    1248             : 
    1249           0 : SdrHdl* SdrObject::GetPlusHdl(const SdrHdl& /*rHdl*/, sal_uInt32 /*nPlNum*/) const
    1250             : {
    1251           0 :     return 0L;
    1252             : }
    1253             : 
    1254           0 : void SdrObject::AddToHdlList(SdrHdlList& rHdlList) const
    1255             : {
    1256           0 :     sal_uInt32 nAnz=GetHdlCount();
    1257           0 :     for (sal_uInt32 i=0L; i<nAnz; i++) {
    1258           0 :         SdrHdl* pHdl=GetHdl(i);
    1259           0 :         if (pHdl!=NULL) {
    1260           0 :             rHdlList.AddHdl(pHdl);
    1261             :         }
    1262             :     }
    1263           0 : }
    1264             : 
    1265           0 : Rectangle SdrObject::ImpDragCalcRect(const SdrDragStat& rDrag) const
    1266             : {
    1267           0 :     Rectangle aTmpRect(GetSnapRect());
    1268           0 :     Rectangle aRect(aTmpRect);
    1269           0 :     const SdrHdl* pHdl=rDrag.GetHdl();
    1270           0 :     SdrHdlKind eHdl=pHdl==NULL ? HDL_MOVE : pHdl->GetKind();
    1271           0 :     bool bEcke=(eHdl==HDL_UPLFT || eHdl==HDL_UPRGT || eHdl==HDL_LWLFT || eHdl==HDL_LWRGT);
    1272           0 :     bool bOrtho=rDrag.GetView()!=NULL && rDrag.GetView()->IsOrtho();
    1273           0 :     bool bBigOrtho=bEcke && bOrtho && rDrag.GetView()->IsBigOrtho();
    1274           0 :     Point aPos(rDrag.GetNow());
    1275           0 :     bool bLft=(eHdl==HDL_UPLFT || eHdl==HDL_LEFT  || eHdl==HDL_LWLFT);
    1276           0 :     bool bRgt=(eHdl==HDL_UPRGT || eHdl==HDL_RIGHT || eHdl==HDL_LWRGT);
    1277           0 :     bool bTop=(eHdl==HDL_UPRGT || eHdl==HDL_UPPER || eHdl==HDL_UPLFT);
    1278           0 :     bool bBtm=(eHdl==HDL_LWRGT || eHdl==HDL_LOWER || eHdl==HDL_LWLFT);
    1279           0 :     if (bLft) aTmpRect.Left()  =aPos.X();
    1280           0 :     if (bRgt) aTmpRect.Right() =aPos.X();
    1281           0 :     if (bTop) aTmpRect.Top()   =aPos.Y();
    1282           0 :     if (bBtm) aTmpRect.Bottom()=aPos.Y();
    1283           0 :     if (bOrtho) { // Ortho
    1284           0 :         long nWdt0=aRect.Right() -aRect.Left();
    1285           0 :         long nHgt0=aRect.Bottom()-aRect.Top();
    1286           0 :         long nXMul=aTmpRect.Right() -aTmpRect.Left();
    1287           0 :         long nYMul=aTmpRect.Bottom()-aTmpRect.Top();
    1288           0 :         long nXDiv=nWdt0;
    1289           0 :         long nYDiv=nHgt0;
    1290           0 :         bool bXNeg=(nXMul<0)!=(nXDiv<0);
    1291           0 :         bool bYNeg=(nYMul<0)!=(nYDiv<0);
    1292           0 :         nXMul=Abs(nXMul);
    1293           0 :         nYMul=Abs(nYMul);
    1294           0 :         nXDiv=Abs(nXDiv);
    1295           0 :         nYDiv=Abs(nYDiv);
    1296           0 :         Fraction aXFact(nXMul,nXDiv); // fractions for canceling
    1297           0 :         Fraction aYFact(nYMul,nYDiv); // and for comparing
    1298           0 :         nXMul=aXFact.GetNumerator();
    1299           0 :         nYMul=aYFact.GetNumerator();
    1300           0 :         nXDiv=aXFact.GetDenominator();
    1301           0 :         nYDiv=aYFact.GetDenominator();
    1302           0 :         if (bEcke) { // corner point handles
    1303           0 :             bool bUseX=(aXFact<aYFact) != bBigOrtho;
    1304           0 :             if (bUseX) {
    1305           0 :                 long nNeed=long(BigInt(nHgt0)*BigInt(nXMul)/BigInt(nXDiv));
    1306           0 :                 if (bYNeg) nNeed=-nNeed;
    1307           0 :                 if (bTop) aTmpRect.Top()=aTmpRect.Bottom()-nNeed;
    1308           0 :                 if (bBtm) aTmpRect.Bottom()=aTmpRect.Top()+nNeed;
    1309             :             } else {
    1310           0 :                 long nNeed=long(BigInt(nWdt0)*BigInt(nYMul)/BigInt(nYDiv));
    1311           0 :                 if (bXNeg) nNeed=-nNeed;
    1312           0 :                 if (bLft) aTmpRect.Left()=aTmpRect.Right()-nNeed;
    1313           0 :                 if (bRgt) aTmpRect.Right()=aTmpRect.Left()+nNeed;
    1314             :             }
    1315             :         } else { // apex handles
    1316           0 :             if ((bLft || bRgt) && nXDiv!=0) {
    1317           0 :                 long nHgt0b=aRect.Bottom()-aRect.Top();
    1318           0 :                 long nNeed=long(BigInt(nHgt0b)*BigInt(nXMul)/BigInt(nXDiv));
    1319           0 :                 aTmpRect.Top()-=(nNeed-nHgt0b)/2;
    1320           0 :                 aTmpRect.Bottom()=aTmpRect.Top()+nNeed;
    1321             :             }
    1322           0 :             if ((bTop || bBtm) && nYDiv!=0) {
    1323           0 :                 long nWdt0b=aRect.Right()-aRect.Left();
    1324           0 :                 long nNeed=long(BigInt(nWdt0b)*BigInt(nYMul)/BigInt(nYDiv));
    1325           0 :                 aTmpRect.Left()-=(nNeed-nWdt0b)/2;
    1326           0 :                 aTmpRect.Right()=aTmpRect.Left()+nNeed;
    1327             :             }
    1328             :         }
    1329             :     }
    1330           0 :     aTmpRect.Justify();
    1331           0 :     return aTmpRect;
    1332             : }
    1333             : 
    1334             : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1335             : 
    1336           0 : bool SdrObject::hasSpecialDrag() const
    1337             : {
    1338           0 :     return false;
    1339             : }
    1340             : 
    1341           0 : bool SdrObject::supportsFullDrag() const
    1342             : {
    1343           0 :     return true;
    1344             : }
    1345             : 
    1346           0 : SdrObject* SdrObject::getFullDragClone() const
    1347             : {
    1348             :     // default uses simple clone
    1349           0 :     return Clone();
    1350             : }
    1351             : 
    1352           0 : bool SdrObject::beginSpecialDrag(SdrDragStat& rDrag) const
    1353             : {
    1354           0 :     const SdrHdl* pHdl = rDrag.GetHdl();
    1355             : 
    1356           0 :     SdrHdlKind eHdl = (pHdl == NULL) ? HDL_MOVE : pHdl->GetKind();
    1357             : 
    1358           0 :     if(eHdl==HDL_UPLFT || eHdl==HDL_UPPER || eHdl==HDL_UPRGT ||
    1359             :         eHdl==HDL_LEFT || eHdl==HDL_RIGHT || eHdl==HDL_LWLFT ||
    1360             :         eHdl==HDL_LOWER || eHdl==HDL_LWRGT)
    1361             :     {
    1362           0 :         return true;
    1363             :     }
    1364             : 
    1365           0 :     return false;
    1366             : }
    1367             : 
    1368           0 : bool SdrObject::applySpecialDrag(SdrDragStat& rDrag)
    1369             : {
    1370           0 :     Rectangle aNewRect(ImpDragCalcRect(rDrag));
    1371             : 
    1372           0 :     if(aNewRect != GetSnapRect())
    1373             :     {
    1374           0 :            NbcSetSnapRect(aNewRect);
    1375             :     }
    1376             : 
    1377           0 :     return true;
    1378             : }
    1379             : 
    1380           0 : String SdrObject::getSpecialDragComment(const SdrDragStat& /*rDrag*/) const
    1381             : {
    1382           0 :     return String();
    1383             : }
    1384             : 
    1385           0 : basegfx::B2DPolyPolygon SdrObject::getSpecialDragPoly(const SdrDragStat& /*rDrag*/) const
    1386             : {
    1387             :     // default has nothing to add
    1388           0 :     return basegfx::B2DPolyPolygon();
    1389             : }
    1390             : 
    1391             : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1392             : // Create
    1393           0 : bool SdrObject::BegCreate(SdrDragStat& rStat)
    1394             : {
    1395           0 :     rStat.SetOrtho4Possible();
    1396           0 :     Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
    1397           0 :     aRect1.Justify();
    1398           0 :     rStat.SetActionRect(aRect1);
    1399           0 :     aOutRect = aRect1;
    1400           0 :     return true;
    1401             : }
    1402             : 
    1403           0 : bool SdrObject::MovCreate(SdrDragStat& rStat)
    1404             : {
    1405           0 :     rStat.TakeCreateRect(aOutRect);
    1406           0 :     rStat.SetActionRect(aOutRect);
    1407           0 :     aOutRect.Justify();
    1408             : 
    1409           0 :     return true;
    1410             : }
    1411             : 
    1412           0 : bool SdrObject::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
    1413             : {
    1414           0 :     rStat.TakeCreateRect(aOutRect);
    1415           0 :     aOutRect.Justify();
    1416             : 
    1417           0 :     return (eCmd==SDRCREATE_FORCEEND || rStat.GetPointAnz()>=2);
    1418             : }
    1419             : 
    1420           0 : void SdrObject::BrkCreate(SdrDragStat& /*rStat*/)
    1421             : {
    1422           0 : }
    1423             : 
    1424           0 : bool SdrObject::BckCreate(SdrDragStat& /*rStat*/)
    1425             : {
    1426           0 :     return false;
    1427             : }
    1428             : 
    1429           0 : basegfx::B2DPolyPolygon SdrObject::TakeCreatePoly(const SdrDragStat& rDrag) const
    1430             : {
    1431           0 :     Rectangle aRect1;
    1432           0 :     rDrag.TakeCreateRect(aRect1);
    1433           0 :     aRect1.Justify();
    1434             : 
    1435           0 :     basegfx::B2DPolyPolygon aRetval;
    1436           0 :     const basegfx::B2DRange aRange(aRect1.Left(), aRect1.Top(), aRect1.Right(), aRect1.Bottom());
    1437           0 :     aRetval.append(basegfx::tools::createPolygonFromRect(aRange));
    1438           0 :     return aRetval;
    1439             : }
    1440             : 
    1441           0 : Pointer SdrObject::GetCreatePointer() const
    1442             : {
    1443           0 :     return Pointer(POINTER_CROSS);
    1444             : }
    1445             : 
    1446             : // transformations
    1447           0 : void SdrObject::NbcMove(const Size& rSiz)
    1448             : {
    1449           0 :     MoveRect(aOutRect,rSiz);
    1450           0 :     SetRectsDirty();
    1451           0 : }
    1452             : 
    1453           0 : void SdrObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
    1454             : {
    1455           0 :     bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
    1456           0 :     bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
    1457           0 :     if (bXMirr || bYMirr) {
    1458           0 :         Point aRef1(GetSnapRect().Center());
    1459           0 :         if (bXMirr) {
    1460           0 :             Point aRef2(aRef1);
    1461           0 :             aRef2.Y()++;
    1462           0 :             NbcMirrorGluePoints(aRef1,aRef2);
    1463             :         }
    1464           0 :         if (bYMirr) {
    1465           0 :             Point aRef2(aRef1);
    1466           0 :             aRef2.X()++;
    1467           0 :             NbcMirrorGluePoints(aRef1,aRef2);
    1468             :         }
    1469             :     }
    1470           0 :     ResizeRect(aOutRect,rRef,xFact,yFact);
    1471           0 :     SetRectsDirty();
    1472           0 : }
    1473             : 
    1474           0 : void SdrObject::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
    1475             : {
    1476           0 :     SetGlueReallyAbsolute(true);
    1477           0 :     aOutRect.Move(-rRef.X(),-rRef.Y());
    1478           0 :     Rectangle R(aOutRect);
    1479           0 :     if (sn==1.0 && cs==0.0) { // 90deg
    1480           0 :         aOutRect.Left()  =-R.Bottom();
    1481           0 :         aOutRect.Right() =-R.Top();
    1482           0 :         aOutRect.Top()   =R.Left();
    1483           0 :         aOutRect.Bottom()=R.Right();
    1484           0 :     } else if (sn==0.0 && cs==-1.0) { // 180deg
    1485           0 :         aOutRect.Left()  =-R.Right();
    1486           0 :         aOutRect.Right() =-R.Left();
    1487           0 :         aOutRect.Top()   =-R.Bottom();
    1488           0 :         aOutRect.Bottom()=-R.Top();
    1489           0 :     } else if (sn==-1.0 && cs==0.0) { // 270deg
    1490           0 :         aOutRect.Left()  =R.Top();
    1491           0 :         aOutRect.Right() =R.Bottom();
    1492           0 :         aOutRect.Top()   =-R.Right();
    1493           0 :         aOutRect.Bottom()=-R.Left();
    1494             :     }
    1495           0 :     aOutRect.Move(rRef.X(),rRef.Y());
    1496           0 :     aOutRect.Justify(); // just in case
    1497           0 :     SetRectsDirty();
    1498           0 :     NbcRotateGluePoints(rRef,nWink,sn,cs);
    1499           0 :     SetGlueReallyAbsolute(false);
    1500           0 : }
    1501             : 
    1502           0 : void SdrObject::NbcMirror(const Point& rRef1, const Point& rRef2)
    1503             : {
    1504           0 :     SetGlueReallyAbsolute(true);
    1505           0 :     aOutRect.Move(-rRef1.X(),-rRef1.Y());
    1506           0 :     Rectangle R(aOutRect);
    1507           0 :     long dx=rRef2.X()-rRef1.X();
    1508           0 :     long dy=rRef2.Y()-rRef1.Y();
    1509           0 :     if (dx==0) {          // vertical axis
    1510           0 :         aOutRect.Left() =-R.Right();
    1511           0 :         aOutRect.Right()=-R.Left();
    1512           0 :     } else if (dy==0) {   // horizontal axis
    1513           0 :         aOutRect.Top()   =-R.Bottom();
    1514           0 :         aOutRect.Bottom()=-R.Top();
    1515           0 :     } else if (dx==dy) {  // 45deg axis
    1516           0 :         aOutRect.Left()  =R.Top();
    1517           0 :         aOutRect.Right() =R.Bottom();
    1518           0 :         aOutRect.Top()   =R.Left();
    1519           0 :         aOutRect.Bottom()=R.Right();
    1520           0 :     } else if (dx==-dy) { // 45deg axis
    1521           0 :         aOutRect.Left()  =-R.Bottom();
    1522           0 :         aOutRect.Right() =-R.Top();
    1523           0 :         aOutRect.Top()   =-R.Right();
    1524           0 :         aOutRect.Bottom()=-R.Left();
    1525             :     }
    1526           0 :     aOutRect.Move(rRef1.X(),rRef1.Y());
    1527           0 :     aOutRect.Justify(); // just in case
    1528           0 :     SetRectsDirty();
    1529           0 :     NbcMirrorGluePoints(rRef1,rRef2);
    1530           0 :     SetGlueReallyAbsolute(false);
    1531           0 : }
    1532             : 
    1533           0 : void SdrObject::NbcShear(const Point& rRef, long nWink, double tn, bool bVShear)
    1534             : {
    1535           0 :     SetGlueReallyAbsolute(true);
    1536           0 :     NbcShearGluePoints(rRef,nWink,tn,bVShear);
    1537           0 :     SetGlueReallyAbsolute(false);
    1538           0 : }
    1539             : 
    1540       12274 : void SdrObject::Move(const Size& rSiz)
    1541             : {
    1542       12274 :     if (rSiz.Width()!=0 || rSiz.Height()!=0) {
    1543        4857 :         Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    1544        4857 :         NbcMove(rSiz);
    1545        4857 :         SetChanged();
    1546        4857 :         BroadcastObjectChange();
    1547        4857 :         SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
    1548             :     }
    1549       12274 : }
    1550             : 
    1551          10 : void SdrObject::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative)
    1552             : {
    1553          10 :     if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) {
    1554          10 :         if (bUnsetRelative)
    1555             :         {
    1556           8 :             mnRelativeWidth.reset( );
    1557           8 :             mnRelativeHeight.reset( );
    1558             :         }
    1559          10 :         Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    1560          10 :         NbcResize(rRef,xFact,yFact);
    1561          10 :         SetChanged();
    1562          10 :         BroadcastObjectChange();
    1563          10 :         SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    1564             :     }
    1565          10 : }
    1566             : 
    1567          12 : void SdrObject::Rotate(const Point& rRef, long nWink, double sn, double cs)
    1568             : {
    1569          12 :     if (nWink!=0) {
    1570          12 :         Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    1571          12 :         NbcRotate(rRef,nWink,sn,cs);
    1572          12 :         SetChanged();
    1573          12 :         BroadcastObjectChange();
    1574          12 :         SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    1575             :     }
    1576          12 : }
    1577             : 
    1578           0 : void SdrObject::Mirror(const Point& rRef1, const Point& rRef2)
    1579             : {
    1580           0 :     Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    1581           0 :     NbcMirror(rRef1,rRef2);
    1582           0 :     SetChanged();
    1583           0 :     BroadcastObjectChange();
    1584           0 :     SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    1585           0 : }
    1586             : 
    1587           0 : void SdrObject::Shear(const Point& rRef, long nWink, double tn, bool bVShear)
    1588             : {
    1589           0 :     if (nWink!=0) {
    1590           0 :         Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    1591           0 :         NbcShear(rRef,nWink,tn,bVShear);
    1592           0 :         SetChanged();
    1593           0 :         BroadcastObjectChange();
    1594           0 :         SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    1595             :     }
    1596           0 : }
    1597             : 
    1598           0 : void SdrObject::NbcSetRelativePos(const Point& rPnt)
    1599             : {
    1600           0 :     Point aRelPos0(GetSnapRect().TopLeft()-aAnchor);
    1601           0 :     Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
    1602           0 :     NbcMove(aSiz); // This also calls SetRectsDirty()
    1603           0 : }
    1604             : 
    1605           0 : void SdrObject::SetRelativePos(const Point& rPnt)
    1606             : {
    1607           0 :     if (rPnt!=GetRelativePos()) {
    1608           0 :         Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    1609           0 :         NbcSetRelativePos(rPnt);
    1610           0 :         SetChanged();
    1611           0 :         BroadcastObjectChange();
    1612           0 :         SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
    1613             :     }
    1614           0 : }
    1615             : 
    1616           0 : Point SdrObject::GetRelativePos() const
    1617             : {
    1618           0 :     return GetSnapRect().TopLeft()-aAnchor;
    1619             : }
    1620             : 
    1621           0 : void SdrObject::ImpSetAnchorPos(const Point& rPnt)
    1622             : {
    1623           0 :     aAnchor = rPnt;
    1624           0 : }
    1625             : 
    1626         106 : void SdrObject::NbcSetAnchorPos(const Point& rPnt)
    1627             : {
    1628         106 :     Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
    1629         106 :     aAnchor=rPnt;
    1630         106 :     NbcMove(aSiz); // This also calls SetRectsDirty()
    1631         106 : }
    1632             : 
    1633         128 : void SdrObject::SetAnchorPos(const Point& rPnt)
    1634             : {
    1635         128 :     if (rPnt!=aAnchor) {
    1636         106 :         Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    1637         106 :         NbcSetAnchorPos(rPnt);
    1638         106 :         SetChanged();
    1639         106 :         BroadcastObjectChange();
    1640         106 :         SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
    1641             :     }
    1642         128 : }
    1643             : 
    1644        7454 : const Point& SdrObject::GetAnchorPos() const
    1645             : {
    1646        7454 :     return aAnchor;
    1647             : }
    1648             : 
    1649           0 : void SdrObject::RecalcSnapRect()
    1650             : {
    1651           0 : }
    1652             : 
    1653         398 : const Rectangle& SdrObject::GetSnapRect() const
    1654             : {
    1655         398 :     return aOutRect;
    1656             : }
    1657             : 
    1658         334 : void SdrObject::NbcSetSnapRect(const Rectangle& rRect)
    1659             : {
    1660         334 :     aOutRect=rRect;
    1661         334 : }
    1662             : 
    1663          60 : const Rectangle& SdrObject::GetLogicRect() const
    1664             : {
    1665          60 :     return GetSnapRect();
    1666             : }
    1667             : 
    1668         304 : void SdrObject::NbcSetLogicRect(const Rectangle& rRect)
    1669             : {
    1670         304 :     NbcSetSnapRect(rRect);
    1671         304 : }
    1672             : 
    1673         172 : void SdrObject::AdjustToMaxRect( const Rectangle& rMaxRect, bool /* bShrinkOnly = false */ )
    1674             : {
    1675         172 :     SetLogicRect( rMaxRect );
    1676         172 : }
    1677             : 
    1678        8828 : void SdrObject::SetSnapRect(const Rectangle& rRect)
    1679             : {
    1680        8828 :     Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    1681        8828 :     NbcSetSnapRect(rRect);
    1682        8828 :     SetChanged();
    1683        8828 :     BroadcastObjectChange();
    1684        8828 :     SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    1685        8828 : }
    1686             : 
    1687        5656 : void SdrObject::SetLogicRect(const Rectangle& rRect)
    1688             : {
    1689        5656 :     Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    1690        5656 :     NbcSetLogicRect(rRect);
    1691        5656 :     SetChanged();
    1692        5656 :     BroadcastObjectChange();
    1693        5656 :     SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    1694        5656 : }
    1695             : 
    1696           0 : long SdrObject::GetRotateAngle() const
    1697             : {
    1698           0 :     return 0;
    1699             : }
    1700             : 
    1701           0 : long SdrObject::GetShearAngle(bool /*bVertical*/) const
    1702             : {
    1703           0 :     return 0;
    1704             : }
    1705             : 
    1706           0 : sal_uInt32 SdrObject::GetSnapPointCount() const
    1707             : {
    1708           0 :     return GetPointCount();
    1709             : }
    1710             : 
    1711           0 : Point SdrObject::GetSnapPoint(sal_uInt32 i) const
    1712             : {
    1713           0 :     return GetPoint(i);
    1714             : }
    1715             : 
    1716          24 : sal_Bool SdrObject::IsPolyObj() const
    1717             : {
    1718          24 :     return false;
    1719             : }
    1720             : 
    1721           0 : sal_uInt32 SdrObject::GetPointCount() const
    1722             : {
    1723           0 :     return 0L;
    1724             : }
    1725             : 
    1726           0 : Point SdrObject::GetPoint(sal_uInt32 /*i*/) const
    1727             : {
    1728           0 :     return Point();
    1729             : }
    1730             : 
    1731           0 : void SdrObject::SetPoint(const Point& rPnt, sal_uInt32 i)
    1732             : {
    1733           0 :     Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    1734           0 :     NbcSetPoint(rPnt, i);
    1735           0 :     SetChanged();
    1736           0 :     BroadcastObjectChange();
    1737           0 :     SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    1738           0 : }
    1739             : 
    1740           0 : void SdrObject::NbcSetPoint(const Point& /*rPnt*/, sal_uInt32 /*i*/)
    1741             : {
    1742           0 : }
    1743             : 
    1744           0 : bool SdrObject::HasTextEdit() const
    1745             : {
    1746           0 :     return false;
    1747             : }
    1748             : 
    1749           0 : sal_Bool SdrObject::BegTextEdit(SdrOutliner& /*rOutl*/)
    1750             : {
    1751           0 :     return false;
    1752             : }
    1753             : 
    1754           0 : void SdrObject::EndTextEdit(SdrOutliner& /*rOutl*/)
    1755             : {
    1756           0 : }
    1757             : 
    1758        1650 : void SdrObject::SetOutlinerParaObject(OutlinerParaObject* pTextObject)
    1759             : {
    1760        1650 :     Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    1761        1650 :     NbcSetOutlinerParaObject(pTextObject);
    1762        1650 :     SetChanged();
    1763        1650 :     BroadcastObjectChange();
    1764        1650 :     if (GetCurrentBoundRect()!=aBoundRect0) {
    1765          74 :         SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    1766             :     }
    1767        1650 : }
    1768             : 
    1769           0 : void SdrObject::NbcSetOutlinerParaObject(OutlinerParaObject* /*pTextObject*/)
    1770             : {
    1771           0 : }
    1772             : 
    1773           0 : OutlinerParaObject* SdrObject::GetOutlinerParaObject() const
    1774             : {
    1775           0 :     return NULL;
    1776             : }
    1777             : 
    1778          14 : void SdrObject::NbcReformatText()
    1779             : {
    1780          14 : }
    1781             : 
    1782           0 : void SdrObject::ReformatText()
    1783             : {
    1784           0 :     Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    1785           0 :     NbcReformatText();
    1786           0 :     SetChanged();
    1787           0 :     BroadcastObjectChange();
    1788           0 :     if (GetCurrentBoundRect()!=aBoundRect0) {
    1789           0 :         SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    1790             :     }
    1791           0 : }
    1792             : 
    1793           0 : void SdrObject::BurnInStyleSheetAttributes()
    1794             : {
    1795           0 :     GetProperties().ForceStyleToHardAttributes();
    1796           0 : }
    1797             : 
    1798           0 : SdrObjUserData* SdrObject::ImpGetMacroUserData() const
    1799             : {
    1800           0 :     SdrObjUserData* pData=NULL;
    1801           0 :     sal_uInt16 nAnz=GetUserDataCount();
    1802           0 :     for (sal_uInt16 nNum=nAnz; nNum>0 && pData==NULL;) {
    1803           0 :         nNum--;
    1804           0 :         pData=GetUserData(nNum);
    1805           0 :         if (!pData->HasMacro(this)) pData=NULL;
    1806             :     }
    1807           0 :     return pData;
    1808             : }
    1809             : 
    1810           0 : bool SdrObject::HasMacro() const
    1811             : {
    1812           0 :     SdrObjUserData* pData=ImpGetMacroUserData();
    1813           0 :     return pData!=NULL ? pData->HasMacro(this) : false;
    1814             : }
    1815             : 
    1816           0 : SdrObject* SdrObject::CheckMacroHit(const SdrObjMacroHitRec& rRec) const
    1817             : {
    1818           0 :     SdrObjUserData* pData = ImpGetMacroUserData();
    1819             : 
    1820           0 :     if(pData)
    1821             :     {
    1822           0 :         return pData->CheckMacroHit(rRec, this);
    1823             :     }
    1824             : 
    1825           0 :     if(rRec.pPageView)
    1826             :     {
    1827           0 :         return SdrObjectPrimitiveHit(*this, rRec.aPos, rRec.nTol, *rRec.pPageView, rRec.pVisiLayer, false);
    1828             :     }
    1829             : 
    1830           0 :     return 0;
    1831             : }
    1832             : 
    1833           0 : Pointer SdrObject::GetMacroPointer(const SdrObjMacroHitRec& rRec) const
    1834             : {
    1835           0 :     SdrObjUserData* pData=ImpGetMacroUserData();
    1836           0 :     if (pData!=NULL) {
    1837           0 :         return pData->GetMacroPointer(rRec,this);
    1838             :     }
    1839           0 :     return Pointer(POINTER_REFHAND);
    1840             : }
    1841             : 
    1842           0 : void SdrObject::PaintMacro(OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const
    1843             : {
    1844           0 :     SdrObjUserData* pData=ImpGetMacroUserData();
    1845             : 
    1846           0 :     if(pData)
    1847             :     {
    1848           0 :         pData->PaintMacro(rOut,rDirtyRect,rRec,this);
    1849             :     }
    1850             :     else
    1851             :     {
    1852           0 :         const RasterOp eRop(rOut.GetRasterOp());
    1853           0 :         const basegfx::B2DPolyPolygon aPolyPolygon(TakeXorPoly());
    1854           0 :         const sal_uInt32 nCount(aPolyPolygon.count());
    1855             : 
    1856           0 :         rOut.SetLineColor(COL_BLACK);
    1857           0 :         rOut.SetFillColor();
    1858           0 :         rOut.SetRasterOp(ROP_INVERT);
    1859             : 
    1860           0 :         for(sal_uInt32 a(0); a < nCount; a++)
    1861             :         {
    1862           0 :             rOut.DrawPolyLine(aPolyPolygon.getB2DPolygon(a));
    1863             :         }
    1864             : 
    1865           0 :         rOut.SetRasterOp(eRop);
    1866             :     }
    1867           0 : }
    1868             : 
    1869           0 : bool SdrObject::DoMacro(const SdrObjMacroHitRec& rRec)
    1870             : {
    1871           0 :     SdrObjUserData* pData=ImpGetMacroUserData();
    1872           0 :     if (pData!=NULL) {
    1873           0 :         return pData->DoMacro(rRec,this);
    1874             :     }
    1875           0 :     return false;
    1876             : }
    1877             : 
    1878           0 : rtl::OUString SdrObject::GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const
    1879             : {
    1880           0 :     SdrObjUserData* pData=ImpGetMacroUserData();
    1881           0 :     if (pData!=NULL) {
    1882           0 :         return pData->GetMacroPopupComment(rRec,this);
    1883             :     }
    1884           0 :     return rtl::OUString();
    1885             : }
    1886             : 
    1887           0 : bool SdrObject::IsMacroHit(const SdrObjMacroHitRec& rRec) const
    1888             : {
    1889           0 :     return CheckMacroHit(rRec) != NULL;
    1890             : }
    1891             : 
    1892             : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1893             : 
    1894           0 : SdrObjGeoData* SdrObject::NewGeoData() const
    1895             : {
    1896           0 :     return new SdrObjGeoData;
    1897             : }
    1898             : 
    1899         156 : void SdrObject::SaveGeoData(SdrObjGeoData& rGeo) const
    1900             : {
    1901         156 :     rGeo.aBoundRect    =GetCurrentBoundRect();
    1902         156 :     rGeo.aAnchor       =aAnchor       ;
    1903         156 :     rGeo.bMovProt      =bMovProt      ;
    1904         156 :     rGeo.bSizProt      =bSizProt      ;
    1905         156 :     rGeo.bNoPrint      =bNoPrint      ;
    1906         156 :     rGeo.mbVisible     =mbVisible     ;
    1907         156 :     rGeo.bClosedObj    =bClosedObj    ;
    1908         156 :     rGeo.mnLayerID = mnLayerID;
    1909             : 
    1910             :     // user-defined glue points
    1911         156 :     if (pPlusData!=NULL && pPlusData->pGluePoints!=NULL) {
    1912           0 :         if (rGeo.pGPL!=NULL) {
    1913           0 :             *rGeo.pGPL=*pPlusData->pGluePoints;
    1914             :         } else {
    1915           0 :             rGeo.pGPL=new SdrGluePointList(*pPlusData->pGluePoints);
    1916             :         }
    1917             :     } else {
    1918         156 :         if (rGeo.pGPL!=NULL) {
    1919           0 :             delete rGeo.pGPL;
    1920           0 :             rGeo.pGPL=NULL;
    1921             :         }
    1922             :     }
    1923         156 : }
    1924             : 
    1925           0 : void SdrObject::RestGeoData(const SdrObjGeoData& rGeo)
    1926             : {
    1927           0 :     SetRectsDirty();
    1928           0 :     aOutRect      =rGeo.aBoundRect    ;
    1929           0 :     aAnchor       =rGeo.aAnchor       ;
    1930           0 :     bMovProt      =rGeo.bMovProt      ;
    1931           0 :     bSizProt      =rGeo.bSizProt      ;
    1932           0 :     bNoPrint      =rGeo.bNoPrint      ;
    1933           0 :     mbVisible     =rGeo.mbVisible     ;
    1934           0 :     bClosedObj    =rGeo.bClosedObj    ;
    1935           0 :     mnLayerID = rGeo.mnLayerID;
    1936             : 
    1937             :     // user-defined glue points
    1938           0 :     if (rGeo.pGPL!=NULL) {
    1939           0 :         ImpForcePlusData();
    1940           0 :         if (pPlusData->pGluePoints!=NULL) {
    1941           0 :             *pPlusData->pGluePoints=*rGeo.pGPL;
    1942             :         } else {
    1943           0 :             pPlusData->pGluePoints=new SdrGluePointList(*rGeo.pGPL);
    1944             :         }
    1945             :     } else {
    1946           0 :         if (pPlusData!=NULL && pPlusData->pGluePoints!=NULL) {
    1947           0 :             delete pPlusData->pGluePoints;
    1948           0 :             pPlusData->pGluePoints=NULL;
    1949             :         }
    1950             :     }
    1951           0 : }
    1952             : 
    1953           0 : SdrObjGeoData* SdrObject::GetGeoData() const
    1954             : {
    1955           0 :     SdrObjGeoData* pGeo=NewGeoData();
    1956           0 :     SaveGeoData(*pGeo);
    1957           0 :     return pGeo;
    1958             : }
    1959             : 
    1960           0 : void SdrObject::SetGeoData(const SdrObjGeoData& rGeo)
    1961             : {
    1962           0 :     Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    1963           0 :     RestGeoData(rGeo);
    1964           0 :     SetChanged();
    1965           0 :     BroadcastObjectChange();
    1966           0 :     SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    1967           0 : }
    1968             : 
    1969             : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1970             : // ItemSet access
    1971             : 
    1972      389762 : const SfxItemSet& SdrObject::GetObjectItemSet() const
    1973             : {
    1974      389762 :     return GetProperties().GetObjectItemSet();
    1975             : }
    1976             : 
    1977      141550 : const SfxItemSet& SdrObject::GetMergedItemSet() const
    1978             : {
    1979      141550 :     return GetProperties().GetMergedItemSet();
    1980             : }
    1981             : 
    1982         450 : void SdrObject::SetObjectItem(const SfxPoolItem& rItem)
    1983             : {
    1984         450 :     GetProperties().SetObjectItem(rItem);
    1985         450 : }
    1986             : 
    1987       20250 : void SdrObject::SetMergedItem(const SfxPoolItem& rItem)
    1988             : {
    1989       20250 :     GetProperties().SetMergedItem(rItem);
    1990       20250 : }
    1991             : 
    1992         222 : void SdrObject::ClearMergedItem(const sal_uInt16 nWhich)
    1993             : {
    1994         222 :     GetProperties().ClearMergedItem(nWhich);
    1995         222 : }
    1996             : 
    1997           0 : void SdrObject::SetObjectItemSet(const SfxItemSet& rSet)
    1998             : {
    1999           0 :     GetProperties().SetObjectItemSet(rSet);
    2000           0 : }
    2001             : 
    2002        4014 : void SdrObject::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems)
    2003             : {
    2004        4014 :     GetProperties().SetMergedItemSet(rSet, bClearAllItems);
    2005        4014 : }
    2006             : 
    2007       29348 : const SfxPoolItem& SdrObject::GetObjectItem(const sal_uInt16 nWhich) const
    2008             : {
    2009       29348 :     return GetObjectItemSet().Get(nWhich);
    2010             : }
    2011             : 
    2012      132450 : const SfxPoolItem& SdrObject::GetMergedItem(const sal_uInt16 nWhich) const
    2013             : {
    2014      132450 :     return GetMergedItemSet().Get(nWhich);
    2015             : }
    2016             : 
    2017        7098 : void SdrObject::SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems)
    2018             : {
    2019        7098 :     GetProperties().SetMergedItemSetAndBroadcast(rSet, bClearAllItems);
    2020        7098 : }
    2021             : 
    2022          26 : void SdrObject::ApplyNotPersistAttr(const SfxItemSet& rAttr)
    2023             : {
    2024          26 :     Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
    2025          26 :     NbcApplyNotPersistAttr(rAttr);
    2026          26 :     SetChanged();
    2027          26 :     BroadcastObjectChange();
    2028          26 :     SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
    2029          26 : }
    2030             : 
    2031          26 : void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
    2032             : {
    2033          26 :     const Rectangle& rSnap=GetSnapRect();
    2034          26 :     const Rectangle& rLogic=GetLogicRect();
    2035          26 :     Point aRef1(rSnap.Center());
    2036          26 :     Point aRef2(aRef1); aRef2.Y()++;
    2037          26 :     const SfxPoolItem *pPoolItem=NULL;
    2038          26 :     if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1X,true,&pPoolItem)==SFX_ITEM_SET) {
    2039           0 :         aRef1.X()=((const SdrTransformRef1XItem*)pPoolItem)->GetValue();
    2040             :     }
    2041          26 :     if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1Y,true,&pPoolItem)==SFX_ITEM_SET) {
    2042           0 :         aRef1.Y()=((const SdrTransformRef1YItem*)pPoolItem)->GetValue();
    2043             :     }
    2044          26 :     if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2X,true,&pPoolItem)==SFX_ITEM_SET) {
    2045           0 :         aRef2.X()=((const SdrTransformRef2XItem*)pPoolItem)->GetValue();
    2046             :     }
    2047          26 :     if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2Y,true,&pPoolItem)==SFX_ITEM_SET) {
    2048           0 :         aRef2.Y()=((const SdrTransformRef2YItem*)pPoolItem)->GetValue();
    2049             :     }
    2050             : 
    2051          26 :     Rectangle aNewSnap(rSnap);
    2052          26 :     if (rAttr.GetItemState(SDRATTR_MOVEX,true,&pPoolItem)==SFX_ITEM_SET) {
    2053           0 :         long n=((const SdrMoveXItem*)pPoolItem)->GetValue();
    2054           0 :         aNewSnap.Move(n,0);
    2055             :     }
    2056          26 :     if (rAttr.GetItemState(SDRATTR_MOVEY,true,&pPoolItem)==SFX_ITEM_SET) {
    2057           0 :         long n=((const SdrMoveYItem*)pPoolItem)->GetValue();
    2058           0 :         aNewSnap.Move(0,n);
    2059             :     }
    2060          26 :     if (rAttr.GetItemState(SDRATTR_ONEPOSITIONX,true,&pPoolItem)==SFX_ITEM_SET) {
    2061           0 :         long n=((const SdrOnePositionXItem*)pPoolItem)->GetValue();
    2062           0 :         aNewSnap.Move(n-aNewSnap.Left(),0);
    2063             :     }
    2064          26 :     if (rAttr.GetItemState(SDRATTR_ONEPOSITIONY,true,&pPoolItem)==SFX_ITEM_SET) {
    2065           0 :         long n=((const SdrOnePositionYItem*)pPoolItem)->GetValue();
    2066           0 :         aNewSnap.Move(0,n-aNewSnap.Top());
    2067             :     }
    2068          26 :     if (rAttr.GetItemState(SDRATTR_ONESIZEWIDTH,true,&pPoolItem)==SFX_ITEM_SET) {
    2069           0 :         long n=((const SdrOneSizeWidthItem*)pPoolItem)->GetValue();
    2070           0 :         aNewSnap.Right()=aNewSnap.Left()+n;
    2071             :     }
    2072          26 :     if (rAttr.GetItemState(SDRATTR_ONESIZEHEIGHT,true,&pPoolItem)==SFX_ITEM_SET) {
    2073           0 :         long n=((const SdrOneSizeHeightItem*)pPoolItem)->GetValue();
    2074           0 :         aNewSnap.Bottom()=aNewSnap.Top()+n;
    2075             :     }
    2076          26 :     if (aNewSnap!=rSnap) {
    2077           0 :         if (aNewSnap.GetSize()==rSnap.GetSize()) {
    2078           0 :             NbcMove(Size(aNewSnap.Left()-rSnap.Left(),aNewSnap.Top()-rSnap.Top()));
    2079             :         } else {
    2080           0 :             NbcSetSnapRect(aNewSnap);
    2081             :         }
    2082             :     }
    2083             : 
    2084          26 :     if (rAttr.GetItemState(SDRATTR_SHEARANGLE,true,&pPoolItem)==SFX_ITEM_SET) {
    2085           0 :         long n=((const SdrShearAngleItem*)pPoolItem)->GetValue();
    2086           0 :         n-=GetShearAngle();
    2087           0 :         if (n!=0) {
    2088           0 :             double nTan=tan(n*nPi180);
    2089           0 :             NbcShear(aRef1,n,nTan,false);
    2090             :         }
    2091             :     }
    2092          26 :     if (rAttr.GetItemState(SDRATTR_ROTATEANGLE,true,&pPoolItem)==SFX_ITEM_SET) {
    2093           0 :         long n=((const SdrRotateAngleItem*)pPoolItem)->GetValue();
    2094           0 :         n-=GetRotateAngle();
    2095           0 :         if (n!=0) {
    2096           0 :             double nSin=sin(n*nPi180);
    2097           0 :             double nCos=cos(n*nPi180);
    2098           0 :             NbcRotate(aRef1,n,nSin,nCos);
    2099             :         }
    2100             :     }
    2101          26 :     if (rAttr.GetItemState(SDRATTR_ROTATEONE,true,&pPoolItem)==SFX_ITEM_SET) {
    2102           0 :         long n=((const SdrRotateOneItem*)pPoolItem)->GetValue();
    2103           0 :         double nSin=sin(n*nPi180);
    2104           0 :         double nCos=cos(n*nPi180);
    2105           0 :         NbcRotate(aRef1,n,nSin,nCos);
    2106             :     }
    2107          26 :     if (rAttr.GetItemState(SDRATTR_HORZSHEARONE,true,&pPoolItem)==SFX_ITEM_SET) {
    2108           0 :         long n=((const SdrHorzShearOneItem*)pPoolItem)->GetValue();
    2109           0 :         double nTan=tan(n*nPi180);
    2110           0 :         NbcShear(aRef1,n,nTan,false);
    2111             :     }
    2112          26 :     if (rAttr.GetItemState(SDRATTR_VERTSHEARONE,true,&pPoolItem)==SFX_ITEM_SET) {
    2113           0 :         long n=((const SdrVertShearOneItem*)pPoolItem)->GetValue();
    2114           0 :         double nTan=tan(n*nPi180);
    2115           0 :         NbcShear(aRef1,n,nTan,true);
    2116             :     }
    2117             : 
    2118          26 :     if (rAttr.GetItemState(SDRATTR_OBJMOVEPROTECT,true,&pPoolItem)==SFX_ITEM_SET) {
    2119           0 :         bool b=((const SdrObjMoveProtectItem*)pPoolItem)->GetValue();
    2120           0 :         SetMoveProtect(b);
    2121             :     }
    2122          26 :     if (rAttr.GetItemState(SDRATTR_OBJSIZEPROTECT,true,&pPoolItem)==SFX_ITEM_SET) {
    2123           0 :         bool b=((const SdrObjSizeProtectItem*)pPoolItem)->GetValue();
    2124           0 :         SetResizeProtect(b);
    2125             :     }
    2126             : 
    2127             :     /* move protect always sets size protect */
    2128          26 :     if( IsMoveProtect() )
    2129           0 :         SetResizeProtect( true );
    2130             : 
    2131          26 :     if (rAttr.GetItemState(SDRATTR_OBJPRINTABLE,true,&pPoolItem)==SFX_ITEM_SET) {
    2132           0 :         bool b=((const SdrObjPrintableItem*)pPoolItem)->GetValue();
    2133           0 :         SetPrintable(b);
    2134             :     }
    2135             : 
    2136          26 :     if (rAttr.GetItemState(SDRATTR_OBJVISIBLE,true,&pPoolItem)==SFX_ITEM_SET) {
    2137           0 :         bool b=((const SdrObjVisibleItem*)pPoolItem)->GetValue();
    2138           0 :         SetVisible(b);
    2139             :     }
    2140             : 
    2141          26 :     SdrLayerID nLayer=SDRLAYER_NOTFOUND;
    2142          26 :     if (rAttr.GetItemState(SDRATTR_LAYERID,true,&pPoolItem)==SFX_ITEM_SET) {
    2143           0 :         nLayer=((const SdrLayerIdItem*)pPoolItem)->GetValue();
    2144             :     }
    2145          26 :     if (rAttr.GetItemState(SDRATTR_LAYERNAME,true,&pPoolItem)==SFX_ITEM_SET && pModel!=NULL) {
    2146           0 :         XubString aLayerName=((const SdrLayerNameItem*)pPoolItem)->GetValue();
    2147           0 :         const SdrLayerAdmin* pLayAd=pPage!=NULL ? &pPage->GetLayerAdmin() : pModel!=NULL ? &pModel->GetLayerAdmin() : NULL;
    2148           0 :         if (pLayAd!=NULL) {
    2149           0 :             const SdrLayer* pLayer=pLayAd->GetLayer(aLayerName, true);
    2150           0 :             if (pLayer!=NULL) {
    2151           0 :                 nLayer=pLayer->GetID();
    2152             :             }
    2153           0 :         }
    2154             : 
    2155             :     }
    2156          26 :     if (nLayer!=SDRLAYER_NOTFOUND) {
    2157           0 :         NbcSetLayer(nLayer);
    2158             :     }
    2159             : 
    2160          26 :     if (rAttr.GetItemState(SDRATTR_OBJECTNAME,true,&pPoolItem)==SFX_ITEM_SET) {
    2161           2 :         XubString aName=((const SdrObjectNameItem*)pPoolItem)->GetValue();
    2162           2 :         SetName(aName);
    2163             :     }
    2164          26 :     Rectangle aNewLogic(rLogic);
    2165          26 :     if (rAttr.GetItemState(SDRATTR_LOGICSIZEWIDTH,true,&pPoolItem)==SFX_ITEM_SET) {
    2166           0 :         long n=((const SdrLogicSizeWidthItem*)pPoolItem)->GetValue();
    2167           0 :         aNewLogic.Right()=aNewLogic.Left()+n;
    2168             :     }
    2169          26 :     if (rAttr.GetItemState(SDRATTR_LOGICSIZEHEIGHT,true,&pPoolItem)==SFX_ITEM_SET) {
    2170           0 :         long n=((const SdrLogicSizeHeightItem*)pPoolItem)->GetValue();
    2171           0 :         aNewLogic.Bottom()=aNewLogic.Top()+n;
    2172             :     }
    2173          26 :     if (aNewLogic!=rLogic) {
    2174           0 :         NbcSetLogicRect(aNewLogic);
    2175             :     }
    2176          26 :     Fraction aResizeX(1,1);
    2177          26 :     Fraction aResizeY(1,1);
    2178          26 :     if (rAttr.GetItemState(SDRATTR_RESIZEXONE,true,&pPoolItem)==SFX_ITEM_SET) {
    2179           0 :         aResizeX*=((const SdrResizeXOneItem*)pPoolItem)->GetValue();
    2180             :     }
    2181          26 :     if (rAttr.GetItemState(SDRATTR_RESIZEYONE,true,&pPoolItem)==SFX_ITEM_SET) {
    2182           0 :         aResizeY*=((const SdrResizeYOneItem*)pPoolItem)->GetValue();
    2183             :     }
    2184          26 :     if (aResizeX!=Fraction(1,1) || aResizeY!=Fraction(1,1)) {
    2185           0 :         NbcResize(aRef1,aResizeX,aResizeY);
    2186             :     }
    2187          26 : }
    2188             : 
    2189           0 : static void lcl_SetItem(SfxItemSet& rAttr, bool bMerge, const SfxPoolItem& rItem)
    2190             : {
    2191           0 :     if (bMerge) rAttr.MergeValue(rItem,true);
    2192           0 :     else rAttr.Put(rItem);
    2193           0 : }
    2194             : 
    2195           0 : void SdrObject::TakeNotPersistAttr(SfxItemSet& rAttr, bool bMerge) const
    2196             : {
    2197           0 :     const Rectangle& rSnap=GetSnapRect();
    2198           0 :     const Rectangle& rLogic=GetLogicRect();
    2199           0 :     lcl_SetItem(rAttr,bMerge,SdrObjMoveProtectItem(IsMoveProtect()));
    2200           0 :     lcl_SetItem(rAttr,bMerge,SdrObjSizeProtectItem(IsResizeProtect()));
    2201           0 :     lcl_SetItem(rAttr,bMerge,SdrObjPrintableItem(IsPrintable()));
    2202           0 :     lcl_SetItem(rAttr,bMerge,SdrObjVisibleItem(IsVisible()));
    2203           0 :     lcl_SetItem(rAttr,bMerge,SdrRotateAngleItem(GetRotateAngle()));
    2204           0 :     lcl_SetItem(rAttr,bMerge,SdrShearAngleItem(GetShearAngle()));
    2205           0 :     lcl_SetItem(rAttr,bMerge,SdrOneSizeWidthItem(rSnap.GetWidth()-1));
    2206           0 :     lcl_SetItem(rAttr,bMerge,SdrOneSizeHeightItem(rSnap.GetHeight()-1));
    2207           0 :     lcl_SetItem(rAttr,bMerge,SdrOnePositionXItem(rSnap.Left()));
    2208           0 :     lcl_SetItem(rAttr,bMerge,SdrOnePositionYItem(rSnap.Top()));
    2209           0 :     if (rLogic.GetWidth()!=rSnap.GetWidth()) {
    2210           0 :         lcl_SetItem(rAttr,bMerge,SdrLogicSizeWidthItem(rLogic.GetWidth()-1));
    2211             :     }
    2212           0 :     if (rLogic.GetHeight()!=rSnap.GetHeight()) {
    2213           0 :         lcl_SetItem(rAttr,bMerge,SdrLogicSizeHeightItem(rLogic.GetHeight()-1));
    2214             :     }
    2215           0 :     XubString aName(GetName());
    2216             : 
    2217           0 :     if(aName.Len())
    2218             :     {
    2219           0 :         lcl_SetItem(rAttr, bMerge, SdrObjectNameItem(aName));
    2220             :     }
    2221             : 
    2222           0 :     lcl_SetItem(rAttr,bMerge,SdrLayerIdItem(GetLayer()));
    2223           0 :     const SdrLayerAdmin* pLayAd=pPage!=NULL ? &pPage->GetLayerAdmin() : pModel!=NULL ? &pModel->GetLayerAdmin() : NULL;
    2224           0 :     if (pLayAd!=NULL) {
    2225           0 :         const SdrLayer* pLayer=pLayAd->GetLayerPerID(GetLayer());
    2226           0 :         if (pLayer!=NULL) {
    2227           0 :             lcl_SetItem(rAttr,bMerge,SdrLayerNameItem(pLayer->GetName()));
    2228             :         }
    2229             :     }
    2230           0 :     Point aRef1(rSnap.Center());
    2231           0 :     Point aRef2(aRef1); aRef2.Y()++;
    2232           0 :     lcl_SetItem(rAttr,bMerge,SdrTransformRef1XItem(aRef1.X()));
    2233           0 :     lcl_SetItem(rAttr,bMerge,SdrTransformRef1YItem(aRef1.Y()));
    2234           0 :     lcl_SetItem(rAttr,bMerge,SdrTransformRef2XItem(aRef2.X()));
    2235           0 :     lcl_SetItem(rAttr,bMerge,SdrTransformRef2YItem(aRef2.Y()));
    2236           0 : }
    2237             : 
    2238        6056 : SfxStyleSheet* SdrObject::GetStyleSheet() const
    2239             : {
    2240        6056 :     return GetProperties().GetStyleSheet();
    2241             : }
    2242             : 
    2243         354 : void SdrObject::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
    2244             : {
    2245         354 :     Rectangle aBoundRect0;
    2246             : 
    2247         354 :     if(pUserCall)
    2248           0 :         aBoundRect0 = GetLastBoundRect();
    2249             : 
    2250         354 :     NbcSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
    2251         354 :     SetChanged();
    2252         354 :     BroadcastObjectChange();
    2253         354 :     SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect0);
    2254         354 : }
    2255             : 
    2256         788 : void SdrObject::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
    2257             : {
    2258             :     // only allow graphic and presentation styles for shapes
    2259         788 :     if( pNewStyleSheet && (pNewStyleSheet->GetFamily() == SFX_STYLE_FAMILY_PARA) && (pNewStyleSheet->GetFamily() == SFX_STYLE_FAMILY_PAGE) )
    2260         788 :         return;
    2261             : 
    2262         788 :     GetProperties().SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
    2263             : }
    2264             : 
    2265             : // Broadcasting while setting attributes is managed by the AttrObj.
    2266             : ////////////////////////////////////////////////////////////////////////////////////////////////////
    2267             : 
    2268           0 : bool SdrObject::IsNode() const
    2269             : {
    2270           0 :     return true;
    2271             : }
    2272             : 
    2273           0 : SdrGluePoint SdrObject::GetVertexGluePoint(sal_uInt16 nPosNum) const
    2274             : {
    2275             :     // #i41936# Use SnapRect for default GluePoints
    2276           0 :     const Rectangle aR(GetSnapRect());
    2277           0 :     Point aPt;
    2278             : 
    2279           0 :     switch(nPosNum)
    2280             :     {
    2281           0 :         case 0 : aPt = aR.TopCenter();    break;
    2282           0 :         case 1 : aPt = aR.RightCenter();  break;
    2283           0 :         case 2 : aPt = aR.BottomCenter(); break;
    2284           0 :         case 3 : aPt = aR.LeftCenter();   break;
    2285             :     }
    2286             : 
    2287           0 :     aPt -= aR.Center();
    2288           0 :     SdrGluePoint aGP(aPt);
    2289           0 :     aGP.SetPercent(false);
    2290             : 
    2291           0 :     return aGP;
    2292             : }
    2293             : 
    2294           0 : SdrGluePoint SdrObject::GetCornerGluePoint(sal_uInt16 nPosNum) const
    2295             : {
    2296           0 :     Rectangle aR(GetCurrentBoundRect());
    2297           0 :     Point aPt;
    2298           0 :     switch (nPosNum) {
    2299           0 :         case 0 : aPt=aR.TopLeft();     break;
    2300           0 :         case 1 : aPt=aR.TopRight();    break;
    2301           0 :         case 2 : aPt=aR.BottomRight(); break;
    2302           0 :         case 3 : aPt=aR.BottomLeft();  break;
    2303             :     }
    2304           0 :     aPt-=GetSnapRect().Center();
    2305           0 :     SdrGluePoint aGP(aPt);
    2306           0 :     aGP.SetPercent(false);
    2307           0 :     return aGP;
    2308             : }
    2309             : 
    2310       15566 : const SdrGluePointList* SdrObject::GetGluePointList() const
    2311             : {
    2312       15566 :     if (pPlusData!=NULL) return pPlusData->pGluePoints;
    2313       13380 :     return NULL;
    2314             : }
    2315             : 
    2316             : 
    2317          16 : SdrGluePointList* SdrObject::ForceGluePointList()
    2318             : {
    2319          16 :     ImpForcePlusData();
    2320          16 :     if (pPlusData->pGluePoints==NULL) {
    2321           4 :         pPlusData->pGluePoints=new SdrGluePointList;
    2322             :     }
    2323          16 :     return pPlusData->pGluePoints;
    2324             : }
    2325             : 
    2326         220 : void SdrObject::SetGlueReallyAbsolute(bool bOn)
    2327             : {
    2328             :     // First a const call to see whether there are any glue points.
    2329             :     // Force const call!
    2330         220 :     if (GetGluePointList()!=NULL) {
    2331           0 :         SdrGluePointList* pGPL=ForceGluePointList();
    2332           0 :         pGPL->SetReallyAbsolute(bOn,*this);
    2333             :     }
    2334         220 : }
    2335             : 
    2336          74 : void SdrObject::NbcRotateGluePoints(const Point& rRef, long nWink, double sn, double cs)
    2337             : {
    2338             :     // First a const call to see whether there are any glue points.
    2339             :     // Force const call!
    2340          74 :     if (GetGluePointList()!=NULL) {
    2341           0 :         SdrGluePointList* pGPL=ForceGluePointList();
    2342           0 :         pGPL->Rotate(rRef,nWink,sn,cs,this);
    2343             :     }
    2344          74 : }
    2345             : 
    2346       15296 : void SdrObject::NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2)
    2347             : {
    2348             :     // First a const call to see whether there are any glue points.
    2349             :     // Force const call!
    2350       15296 :     if (GetGluePointList()!=NULL) {
    2351           0 :         SdrGluePointList* pGPL=ForceGluePointList();
    2352           0 :         pGPL->Mirror(rRef1,rRef2,this);
    2353             :     }
    2354       15296 : }
    2355             : 
    2356           0 : void SdrObject::NbcShearGluePoints(const Point& rRef, long nWink, double tn, bool bVShear)
    2357             : {
    2358             :     // First a const call to see whether there are any glue points.
    2359             :     // Force const call!
    2360           0 :     if (GetGluePointList()!=NULL) {
    2361           0 :         SdrGluePointList* pGPL=ForceGluePointList();
    2362           0 :         pGPL->Shear(rRef,nWink,tn,bVShear,this);
    2363             :     }
    2364           0 : }
    2365             : 
    2366           0 : bool SdrObject::IsEdge() const
    2367             : {
    2368           0 :     return false;
    2369             : }
    2370             : 
    2371           0 : void SdrObject::ConnectToNode(bool /*bTail1*/, SdrObject* /*pObj*/)
    2372             : {
    2373           0 : }
    2374             : 
    2375           0 : void SdrObject::DisconnectFromNode(bool /*bTail1*/)
    2376             : {
    2377           0 : }
    2378             : 
    2379           0 : SdrObject* SdrObject::GetConnectedNode(bool /*bTail1*/) const
    2380             : {
    2381           0 :     return NULL;
    2382             : }
    2383             : 
    2384             : ////////////////////////////////////////////////////////////////////////////////////////////////////
    2385             : 
    2386           0 : SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, bool bForceLineDash) const
    2387             : {
    2388           0 :     bool bNoChange(true);
    2389             : 
    2390           0 :     if(pRet->LineGeometryUsageIsNecessary())
    2391             :     {
    2392           0 :         basegfx::B2DPolyPolygon aMergedLineFillPolyPolygon;
    2393           0 :         basegfx::B2DPolyPolygon aMergedHairlinePolyPolygon;
    2394           0 :         const drawinglayer::primitive2d::Primitive2DSequence xSequence(pRet->GetViewContact().getViewIndependentPrimitive2DSequence());
    2395             : 
    2396           0 :         if(xSequence.hasElements())
    2397             :         {
    2398             :             // use neutral ViewInformation
    2399           0 :             const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
    2400             : 
    2401             :             // create extractor, process and get result
    2402           0 :             drawinglayer::processor2d::LineGeometryExtractor2D aExtractor(aViewInformation2D);
    2403           0 :             aExtractor.process(xSequence);
    2404             : 
    2405             :             // #i102241# check for line results
    2406           0 :             const basegfx::B2DPolygonVector& rHairlineVector = aExtractor.getExtractedHairlines();
    2407             : 
    2408           0 :             if(!rHairlineVector.empty())
    2409             :             {
    2410             :                 // for SdrObject creation, just copy all to a single Hairline-PolyPolygon
    2411           0 :                 for(sal_uInt32 a(0); a < rHairlineVector.size(); a++)
    2412             :                 {
    2413           0 :                     aMergedHairlinePolyPolygon.append(rHairlineVector[a]);
    2414             :                 }
    2415             :             }
    2416             : 
    2417             :             // #i102241# check for fill rsults
    2418           0 :             const basegfx::B2DPolyPolygonVector& rLineFillVector(aExtractor.getExtractedLineFills());
    2419             : 
    2420           0 :             if(!rLineFillVector.empty())
    2421             :             {
    2422             :                 // merge to a single PolyPolygon (OR)
    2423           0 :                 aMergedLineFillPolyPolygon = basegfx::tools::mergeToSinglePolyPolygon(rLineFillVector);
    2424           0 :             }
    2425             :         }
    2426             : 
    2427             :         //  || aMergedHairlinePolyPolygon.Count() removed; the conversion is ONLY
    2428             :         // useful when new closed filled polygons are created
    2429           0 :         if(aMergedLineFillPolyPolygon.count() || (bForceLineDash && aMergedHairlinePolyPolygon.count()))
    2430             :         {
    2431           0 :             SfxItemSet aSet(pRet->GetMergedItemSet());
    2432           0 :             XFillStyle eOldFillStyle = ((const XFillStyleItem&)(aSet.Get(XATTR_FILLSTYLE))).GetValue();
    2433           0 :             SdrPathObj* aLinePolygonPart = NULL;
    2434           0 :             SdrPathObj* aLineHairlinePart = NULL;
    2435           0 :             bool bBuildGroup(false);
    2436             : 
    2437           0 :             if(aMergedLineFillPolyPolygon.count())
    2438             :             {
    2439             :                 // create SdrObject for filled line geometry
    2440           0 :                 aLinePolygonPart = new SdrPathObj(OBJ_PATHFILL, aMergedLineFillPolyPolygon);
    2441           0 :                 aLinePolygonPart->SetModel(pRet->GetModel());
    2442             : 
    2443             :                 // correct item properties
    2444           0 :                 aSet.Put(XLineWidthItem(0L));
    2445           0 :                 aSet.Put(XLineStyleItem(XLINE_NONE));
    2446           0 :                 Color aColorLine = ((const XLineColorItem&)(aSet.Get(XATTR_LINECOLOR))).GetColorValue();
    2447           0 :                 sal_uInt16 nTransLine = ((const XLineTransparenceItem&)(aSet.Get(XATTR_LINETRANSPARENCE))).GetValue();
    2448           0 :                 aSet.Put(XFillColorItem(XubString(), aColorLine));
    2449           0 :                 aSet.Put(XFillStyleItem(XFILL_SOLID));
    2450           0 :                 aSet.Put(XFillTransparenceItem(nTransLine));
    2451             : 
    2452           0 :                 aLinePolygonPart->SetMergedItemSet(aSet);
    2453             :             }
    2454             : 
    2455           0 :             if(aMergedHairlinePolyPolygon.count())
    2456             :             {
    2457             :                 // create SdrObject for hairline geometry
    2458             :                 // OBJ_PATHLINE is necessary here, not OBJ_PATHFILL. This is intended
    2459             :                 // to get a non-filled object. If the poly is closed, the PathObj takes care for
    2460             :                 // the correct closed state.
    2461           0 :                 aLineHairlinePart = new SdrPathObj(OBJ_PATHLINE, aMergedHairlinePolyPolygon);
    2462           0 :                 aLineHairlinePart->SetModel(pRet->GetModel());
    2463             : 
    2464           0 :                 aSet.Put(XLineWidthItem(0L));
    2465           0 :                 aSet.Put(XFillStyleItem(XFILL_NONE));
    2466           0 :                 aSet.Put(XLineStyleItem(XLINE_SOLID));
    2467             : 
    2468             :                 // it is also necessary to switch off line start and ends here
    2469           0 :                 aSet.Put(XLineStartWidthItem(0));
    2470           0 :                 aSet.Put(XLineEndWidthItem(0));
    2471             : 
    2472           0 :                 aLineHairlinePart->SetMergedItemSet(aSet);
    2473             : 
    2474           0 :                 if(aLinePolygonPart)
    2475             :                 {
    2476           0 :                     bBuildGroup = true;
    2477             :                 }
    2478             :             }
    2479             : 
    2480             :             // check if original geometry should be added (e.g. filled and closed)
    2481           0 :             bool bAddOriginalGeometry(false);
    2482           0 :             SdrPathObj* pPath = PTR_CAST(SdrPathObj, pRet);
    2483             : 
    2484           0 :             if(pPath && pPath->IsClosed())
    2485             :             {
    2486           0 :                 if(eOldFillStyle != XFILL_NONE)
    2487             :                 {
    2488           0 :                     bAddOriginalGeometry = true;
    2489             :                 }
    2490             :             }
    2491             : 
    2492             :             // do we need a group?
    2493           0 :             if(bBuildGroup || bAddOriginalGeometry)
    2494             :             {
    2495           0 :                 SdrObject* pGroup = new SdrObjGroup;
    2496           0 :                 pGroup->SetModel(pRet->GetModel());
    2497             : 
    2498           0 :                 if(bAddOriginalGeometry)
    2499             :                 {
    2500             :                     // Add a clone of the original geometry.
    2501           0 :                     aSet.ClearItem();
    2502           0 :                     aSet.Put(pRet->GetMergedItemSet());
    2503           0 :                     aSet.Put(XLineStyleItem(XLINE_NONE));
    2504           0 :                     aSet.Put(XLineWidthItem(0L));
    2505             : 
    2506           0 :                     SdrObject* pClone = pRet->Clone();
    2507             : 
    2508           0 :                     pClone->SetModel(pRet->GetModel());
    2509           0 :                     pClone->SetMergedItemSet(aSet);
    2510             : 
    2511           0 :                     pGroup->GetSubList()->NbcInsertObject(pClone);
    2512             :                 }
    2513             : 
    2514           0 :                 if(aLinePolygonPart)
    2515             :                 {
    2516           0 :                     pGroup->GetSubList()->NbcInsertObject(aLinePolygonPart);
    2517             :                 }
    2518             : 
    2519           0 :                 if(aLineHairlinePart)
    2520             :                 {
    2521           0 :                     pGroup->GetSubList()->NbcInsertObject(aLineHairlinePart);
    2522             :                 }
    2523             : 
    2524           0 :                 pRet = pGroup;
    2525             : 
    2526             :                 // be more careful with the state describing bool
    2527           0 :                 bNoChange = false;
    2528             :             }
    2529             :             else
    2530             :             {
    2531           0 :                 if(aLinePolygonPart)
    2532             :                 {
    2533           0 :                     pRet = aLinePolygonPart;
    2534             :                     // be more careful with the state describing bool
    2535           0 :                     bNoChange = false;
    2536             :                 }
    2537           0 :                 else if(aLineHairlinePart)
    2538             :                 {
    2539           0 :                     pRet = aLineHairlinePart;
    2540             :                     // be more careful with the state describing bool
    2541           0 :                     bNoChange = false;
    2542             :                 }
    2543           0 :             }
    2544           0 :         }
    2545             :     }
    2546             : 
    2547           0 :     if(bNoChange)
    2548             :     {
    2549             :         // due to current method usage, create and return a clone when nothing has changed
    2550           0 :         SdrObject* pClone = pRet->Clone();
    2551           0 :         pClone->SetModel(pRet->GetModel());
    2552           0 :         pRet = pClone;
    2553             :     }
    2554             : 
    2555           0 :     return pRet;
    2556             : }
    2557             : 
    2558         972 : bool SdrObject::IsVirtualObj() const
    2559             : {
    2560         972 :     return bVirtObj;
    2561             : }
    2562             : 
    2563         458 : bool SdrObject::IsClosedObj() const
    2564             : {
    2565         458 :     return bClosedObj;
    2566             : }
    2567             : 
    2568        4180 : bool SdrObject::IsEdgeObj() const
    2569             : {
    2570        4180 :     return bIsEdge;
    2571             : }
    2572             : 
    2573          24 : bool SdrObject::Is3DObj() const
    2574             : {
    2575          24 :     return bIs3DObj;
    2576             : }
    2577             : 
    2578          32 : bool SdrObject::IsUnoObj() const
    2579             : {
    2580          32 :     return bIsUnoObj;
    2581             : }
    2582             : 
    2583          18 : void SdrObject::SetMarkProtect(bool bProt)
    2584             : {
    2585          18 :     bMarkProt = bProt;
    2586          18 : }
    2587             : 
    2588         108 : bool SdrObject::IsMarkProtect() const
    2589             : {
    2590         108 :     return bMarkProt;
    2591             : }
    2592             : 
    2593      121314 : bool SdrObject::IsInserted() const
    2594             : {
    2595      121314 :     return bInserted;
    2596             : }
    2597             : 
    2598         216 : bool SdrObject::IsMoveProtect() const
    2599             : {
    2600         216 :     return bMovProt;
    2601             : }
    2602             : 
    2603         340 : bool SdrObject::IsResizeProtect() const
    2604             : {
    2605         340 :     return bSizProt;
    2606             : }
    2607             : 
    2608         156 : bool SdrObject::IsPrintable() const
    2609             : {
    2610         156 :     return !bNoPrint;
    2611             : }
    2612             : 
    2613        1210 : bool SdrObject::IsVisible() const
    2614             : {
    2615        1210 :     return mbVisible;
    2616             : }
    2617             : 
    2618         714 : void SdrObject::SetEmptyPresObj(bool bEpt)
    2619             : {
    2620         714 :     bEmptyPresObj = bEpt;
    2621         714 : }
    2622             : 
    2623        2982 : bool SdrObject::IsEmptyPresObj() const
    2624             : {
    2625        2982 :     return bEmptyPresObj;
    2626             : }
    2627             : 
    2628         112 : void SdrObject::SetNotVisibleAsMaster(bool bFlg)
    2629             : {
    2630         112 :     bNotVisibleAsMaster=bFlg;
    2631         112 : }
    2632             : 
    2633           0 : bool SdrObject::IsNotVisibleAsMaster() const
    2634             : {
    2635           0 :     return bNotVisibleAsMaster;
    2636             : }
    2637             : 
    2638           0 : bool SdrObject::LineIsOutsideGeometry() const
    2639             : {
    2640           0 :     return mbLineIsOutsideGeometry;
    2641             : }
    2642             : 
    2643        7024 : bool SdrObject::DoesSupportTextIndentingOnLineWidthChange() const
    2644             : {
    2645        7024 :     return mbSupportTextIndentingOnLineWidthChange;
    2646             : }
    2647             : 
    2648             : // convert this path object to contour object, even when it is a group
    2649           0 : SdrObject* SdrObject::ConvertToContourObj(SdrObject* pRet, bool bForceLineDash) const
    2650             : {
    2651           0 :     if(pRet->ISA(SdrObjGroup))
    2652             :     {
    2653           0 :         SdrObjList* pObjList2 = pRet->GetSubList();
    2654           0 :         SdrObject* pGroup = new SdrObjGroup;
    2655           0 :         pGroup->SetModel(pRet->GetModel());
    2656             : 
    2657           0 :         for(sal_uInt32 a=0;a<pObjList2->GetObjCount();a++)
    2658             :         {
    2659           0 :             SdrObject* pIterObj = pObjList2->GetObj(a);
    2660           0 :             pGroup->GetSubList()->NbcInsertObject(ConvertToContourObj(pIterObj, bForceLineDash));
    2661             :         }
    2662             : 
    2663           0 :         pRet = pGroup;
    2664             :     }
    2665             :     else
    2666             :     {
    2667           0 :         if(pRet && pRet->ISA(SdrPathObj))
    2668             :         {
    2669           0 :             SdrPathObj* pPathObj = (SdrPathObj*)pRet;
    2670             : 
    2671             :             // bezier geometry got created, even for straight edges since the given
    2672             :             // object is a result of DoConvertToPolyObj. For conversion to contour
    2673             :             // this is not really needed and can be reduced again AFAP
    2674           0 :             pPathObj->SetPathPoly(basegfx::tools::simplifyCurveSegments(pPathObj->GetPathPoly()));
    2675             :         }
    2676             : 
    2677           0 :         pRet = ImpConvertToContourObj(pRet, bForceLineDash);
    2678             :     }
    2679             : 
    2680             :     // #i73441# preserve LayerID
    2681           0 :     if(pRet && pRet->GetLayer() != GetLayer())
    2682             :     {
    2683           0 :         pRet->SetLayer(GetLayer());
    2684             :     }
    2685             : 
    2686           0 :     return pRet;
    2687             : }
    2688             : 
    2689             : ////////////////////////////////////////////////////////////////////////////////////////////////////
    2690             : 
    2691           0 : SdrObject* SdrObject::ConvertToPolyObj(bool bBezier, bool bLineToArea) const
    2692             : {
    2693           0 :     SdrObject* pRet = DoConvertToPolyObj(bBezier, true);
    2694             : 
    2695           0 :     if(pRet && bLineToArea)
    2696             :     {
    2697           0 :         SdrObject* pNewRet = ConvertToContourObj(pRet);
    2698           0 :         delete pRet;
    2699           0 :         pRet = pNewRet;
    2700             :     }
    2701             : 
    2702             :     // #i73441# preserve LayerID
    2703           0 :     if(pRet && pRet->GetLayer() != GetLayer())
    2704             :     {
    2705           0 :         pRet->SetLayer(GetLayer());
    2706             :     }
    2707             : 
    2708           0 :     return pRet;
    2709             : }
    2710             : 
    2711             : ////////////////////////////////////////////////////////////////////////////////////////////////////
    2712             : 
    2713           0 : SdrObject* SdrObject::DoConvertToPolyObj(sal_Bool /*bBezier*/, bool /*bAddText*/) const
    2714             : {
    2715           0 :     return NULL;
    2716             : }
    2717             : 
    2718             : ////////////////////////////////////////////////////////////////////////////////////////////////////
    2719             : 
    2720       12742 : void SdrObject::SetInserted(bool bIns)
    2721             : {
    2722       12742 :     if (bIns!=IsInserted()) {
    2723       12742 :         bInserted=bIns;
    2724       12742 :         Rectangle aBoundRect0(GetLastBoundRect());
    2725       12742 :         if (bIns) SendUserCall(SDRUSERCALL_INSERTED,aBoundRect0);
    2726        1672 :         else SendUserCall(SDRUSERCALL_REMOVED,aBoundRect0);
    2727             : 
    2728       12742 :         if (pPlusData!=NULL && pPlusData->pBroadcast!=NULL) {
    2729          74 :             SdrHint aHint(*this);
    2730          74 :             aHint.SetKind(bIns?HINT_OBJINSERTED:HINT_OBJREMOVED);
    2731          74 :             pPlusData->pBroadcast->Broadcast(aHint);
    2732             :         }
    2733             :     }
    2734       12742 : }
    2735             : 
    2736          36 : void SdrObject::SetMoveProtect(bool bProt)
    2737             : {
    2738          36 :     if(IsMoveProtect() != bProt)
    2739             :     {
    2740             :         // #i77187# secured and simplified
    2741          18 :         bMovProt = bProt;
    2742          18 :         SetChanged();
    2743          18 :         BroadcastObjectChange();
    2744             :     }
    2745          36 : }
    2746             : 
    2747         102 : void SdrObject::SetResizeProtect(bool bProt)
    2748             : {
    2749         102 :     if(IsResizeProtect() != bProt)
    2750             :     {
    2751             :         // #i77187# secured and simplified
    2752          86 :         bSizProt = bProt;
    2753          86 :         SetChanged();
    2754          86 :         BroadcastObjectChange();
    2755             :     }
    2756         102 : }
    2757             : 
    2758        3006 : void SdrObject::SetPrintable(bool bPrn)
    2759             : {
    2760        3006 :     if( bPrn == bNoPrint )
    2761             :     {
    2762           0 :         bNoPrint=!bPrn;
    2763           0 :         SetChanged();
    2764           0 :         if (IsInserted() && pModel!=NULL)
    2765             :         {
    2766           0 :             SdrHint aHint(*this);
    2767           0 :             pModel->Broadcast(aHint);
    2768             :         }
    2769             :     }
    2770        3006 : }
    2771             : 
    2772        3006 : void SdrObject::SetVisible(bool bVisible)
    2773             : {
    2774        3006 :     if( bVisible != mbVisible )
    2775             :     {
    2776           0 :         mbVisible = bVisible;
    2777           0 :         SetChanged();
    2778           0 :         if (IsInserted() && pModel!=NULL)
    2779             :         {
    2780           0 :             SdrHint aHint(*this);
    2781           0 :             pModel->Broadcast(aHint);
    2782             :         }
    2783             :     }
    2784        3006 : }
    2785             : 
    2786             : ////////////////////////////////////////////////////////////////////////////////////////////////////
    2787             : 
    2788       17208 : sal_uInt16 SdrObject::GetUserDataCount() const
    2789             : {
    2790       17208 :     if (pPlusData==NULL || pPlusData->pUserDataList==NULL) return 0;
    2791        8294 :     return pPlusData->pUserDataList->GetUserDataCount();
    2792             : }
    2793             : 
    2794        8294 : SdrObjUserData* SdrObject::GetUserData(sal_uInt16 nNum) const
    2795             : {
    2796        8294 :     if (pPlusData==NULL || pPlusData->pUserDataList==NULL) return NULL;
    2797        8294 :     return pPlusData->pUserDataList->GetUserData(nNum);
    2798             : }
    2799             : 
    2800        1118 : void SdrObject::AppendUserData(SdrObjUserData* pData)
    2801             : {
    2802        1118 :     if (!pData)
    2803             :     {
    2804             :         OSL_FAIL("SdrObject::AppendUserData(): pData is NULL pointer.");
    2805        1118 :         return;
    2806             :     }
    2807             : 
    2808        1118 :     ImpForcePlusData();
    2809        1118 :     if (!pPlusData->pUserDataList)
    2810        1118 :         pPlusData->pUserDataList = new SdrObjUserDataList;
    2811             : 
    2812        1118 :     pPlusData->pUserDataList->AppendUserData(pData);
    2813             : }
    2814             : 
    2815           0 : void SdrObject::DeleteUserData(sal_uInt16 nNum)
    2816             : {
    2817           0 :     sal_uInt16 nAnz=GetUserDataCount();
    2818           0 :     if (nNum<nAnz) {
    2819           0 :         pPlusData->pUserDataList->DeleteUserData(nNum);
    2820           0 :         if (nAnz==1)  {
    2821           0 :             delete pPlusData->pUserDataList;
    2822           0 :             pPlusData->pUserDataList=NULL;
    2823             :         }
    2824             :     } else {
    2825             :         OSL_FAIL("SdrObject::DeleteUserData(): Invalid Index.");
    2826             :     }
    2827           0 : }
    2828             : 
    2829       16708 : void SdrObject::SetUserCall(SdrObjUserCall* pUser)
    2830             : {
    2831       16708 :     pUserCall = pUser;
    2832       16708 : }
    2833             : 
    2834       75972 : SdrObjUserCall* SdrObject::GetUserCall() const
    2835             : {
    2836       75972 :     return pUserCall;
    2837             : }
    2838             : 
    2839       82033 : void SdrObject::SendUserCall(SdrUserCallType eUserCall, const Rectangle& rBoundRect) const
    2840             : {
    2841       82033 :     SdrObjGroup* pGroup = NULL;
    2842             : 
    2843       82033 :     if( pObjList && pObjList->GetListKind() == SDROBJLIST_GROUPOBJ )
    2844       45300 :         pGroup = (SdrObjGroup*) pObjList->GetOwnerObj();
    2845             : 
    2846       82033 :     if ( pUserCall )
    2847             :     {
    2848        8463 :         pUserCall->Changed( *this, eUserCall, rBoundRect );
    2849             :     }
    2850             : 
    2851      209366 :     while( pGroup )
    2852             :     {
    2853             :         // broadcast to group
    2854       45300 :         if( pGroup->GetUserCall() )
    2855             :         {
    2856         200 :             SdrUserCallType eChildUserType = SDRUSERCALL_CHILD_CHGATTR;
    2857             : 
    2858         200 :             switch( eUserCall )
    2859             :             {
    2860             :                 case SDRUSERCALL_MOVEONLY:
    2861          32 :                     eChildUserType = SDRUSERCALL_CHILD_MOVEONLY;
    2862          32 :                 break;
    2863             : 
    2864             :                 case SDRUSERCALL_RESIZE:
    2865          24 :                     eChildUserType = SDRUSERCALL_CHILD_RESIZE;
    2866          24 :                 break;
    2867             : 
    2868             :                 case SDRUSERCALL_CHGATTR:
    2869         136 :                     eChildUserType = SDRUSERCALL_CHILD_CHGATTR;
    2870         136 :                 break;
    2871             : 
    2872             :                 case SDRUSERCALL_DELETE:
    2873           0 :                     eChildUserType = SDRUSERCALL_CHILD_DELETE;
    2874           0 :                 break;
    2875             : 
    2876             :                 case SDRUSERCALL_COPY:
    2877           0 :                     eChildUserType = SDRUSERCALL_CHILD_COPY;
    2878           0 :                 break;
    2879             : 
    2880             :                 case SDRUSERCALL_INSERTED:
    2881           8 :                     eChildUserType = SDRUSERCALL_CHILD_INSERTED;
    2882           8 :                 break;
    2883             : 
    2884             :                 case SDRUSERCALL_REMOVED:
    2885           0 :                     eChildUserType = SDRUSERCALL_CHILD_REMOVED;
    2886           0 :                 break;
    2887             : 
    2888           0 :                 default: break;
    2889             :             }
    2890             : 
    2891         200 :             pGroup->GetUserCall()->Changed( *this, eChildUserType, rBoundRect );
    2892             :         }
    2893             : 
    2894      126182 :         if( pGroup->GetObjList()                                       &&
    2895       41192 :             pGroup->GetObjList()->GetListKind() == SDROBJLIST_GROUPOBJ &&
    2896       39690 :             pGroup != (SdrObjGroup*) pObjList->GetOwnerObj() )
    2897           0 :             pGroup = (SdrObjGroup*) pObjList->GetOwnerObj();
    2898             :         else
    2899       45300 :             pGroup = NULL;
    2900             :     }
    2901             : 
    2902             :     // notify our UNO shape listeners
    2903       82033 :     switch ( eUserCall )
    2904             :     {
    2905             :     case SDRUSERCALL_RESIZE:
    2906       29932 :         notifyShapePropertyChange( ::svx::eShapeSize );
    2907             :         // fall through - RESIZE might also imply a change of the position
    2908             :     case SDRUSERCALL_MOVEONLY:
    2909       36225 :         notifyShapePropertyChange( ::svx::eShapePosition );
    2910       36225 :         break;
    2911             :     default:
    2912             :         // not interested in
    2913       45808 :         break;
    2914             :     }
    2915       82033 : }
    2916             : 
    2917             : // change ItemPool for this object
    2918       10814 : void SdrObject::MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel)
    2919             : {
    2920       10814 :     if(pSrcPool && pDestPool && (pSrcPool != pDestPool))
    2921             :     {
    2922       10814 :         GetProperties().MoveToItemPool(pSrcPool, pDestPool, pNewModel);
    2923             :     }
    2924       10814 : }
    2925             : 
    2926       46494 : void SdrObject::impl_setUnoShape( const uno::Reference< uno::XInterface >& _rxUnoShape )
    2927             : {
    2928       46494 :     maWeakUnoShape = _rxUnoShape;
    2929       46494 :     mpSvxShape = SvxShape::getImplementation( _rxUnoShape );
    2930       46494 : }
    2931             : 
    2932             : /** only for internal use! */
    2933      101185 : SvxShape* SdrObject::getSvxShape() const
    2934             : {
    2935             :     DBG_TESTSOLARMUTEX();
    2936             :         // retrieving the impl pointer and subsequently using it is not thread-safe, of course, so it needs to be
    2937             :         // guarded by the SolarMutex
    2938             : 
    2939             : #if OSL_DEBUG_LEVE > 0
    2940             :     uno::Reference< uno::XInterface > xShape( maWeakUnoShape );
    2941             :     OSL_ENSURE( !( !xShapeGuard.is() && mpSvxShape ),
    2942             :         "SdrObject::getSvxShape: still having IMPL-Pointer to dead object!" );
    2943             : #endif
    2944             : 
    2945      101185 :     return mpSvxShape;
    2946             : }
    2947             : 
    2948       16382 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SdrObject::getUnoShape()
    2949             : {
    2950             :     // try weak reference first
    2951       16382 :     uno::Reference< uno::XInterface > xShape( getWeakUnoShape() );
    2952       16382 :     if( !xShape.is() )
    2953             :     {
    2954             :         OSL_ENSURE( mpSvxShape == NULL, "SdrObject::getUnoShape: XShape already dead, but still an IMPL pointer!" );
    2955       13536 :         if ( pPage )
    2956             :         {
    2957        6758 :             uno::Reference< uno::XInterface > xPage( pPage->getUnoPage() );
    2958        6758 :             if( xPage.is() )
    2959             :             {
    2960        6758 :                 SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation(xPage);
    2961        6758 :                 if( pDrawPage )
    2962             :                 {
    2963             :                     // create one
    2964        6758 :                     xShape = pDrawPage->_CreateShape( this );
    2965        6758 :                     impl_setUnoShape( xShape );
    2966             :                 }
    2967        6758 :             }
    2968             :         }
    2969             :         else
    2970             :         {
    2971        6778 :             mpSvxShape = SvxDrawPage::CreateShapeByTypeAndInventor( GetObjIdentifier(), GetObjInventor(), this, NULL );
    2972        6778 :             maWeakUnoShape = xShape = static_cast< ::cppu::OWeakObject* >( mpSvxShape );
    2973             :         }
    2974             :     }
    2975             : 
    2976       16382 :     return xShape;
    2977             : }
    2978             : 
    2979       39736 : void SdrObject::setUnoShape(const uno::Reference<uno::XInterface >& _rxUnoShape)
    2980             : {
    2981       39736 :     impl_setUnoShape( _rxUnoShape );
    2982       39736 : }
    2983             : 
    2984         826 : ::svx::PropertyChangeNotifier& SdrObject::getShapePropertyChangeNotifier()
    2985             : {
    2986             :     DBG_TESTSOLARMUTEX();
    2987             : 
    2988         826 :     SvxShape* pSvxShape = getSvxShape();
    2989         826 :     ENSURE_OR_THROW( pSvxShape, "no SvxShape, yet!" );
    2990         826 :     return pSvxShape->getShapePropertyChangeNotifier();
    2991             : }
    2992             : 
    2993       66243 : void SdrObject::notifyShapePropertyChange( const ::svx::ShapeProperty _eProperty ) const
    2994             : {
    2995             :     DBG_TESTSOLARMUTEX();
    2996             : 
    2997       66243 :     SvxShape* pSvxShape = const_cast< SdrObject* >( this )->getSvxShape();
    2998       66243 :     if ( pSvxShape )
    2999       38272 :         return pSvxShape->getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty );
    3000             : }
    3001             : 
    3002             : ////////////////////////////////////////////////////////////////////////////////////////////////////
    3003             : //
    3004             : // transformation interface for StarOfficeAPI. This implements support for
    3005             : // homogeneous 3x3 matrices containing the transformation of the SdrObject. At the
    3006             : // moment it contains a shearX, rotation and translation, but for setting all linear
    3007             : // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
    3008             : //
    3009             : ////////////////////////////////////////////////////////////////////////////////////////////////////
    3010             : // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
    3011             : // with the base geometry and returns TRUE. Otherwise it returns FALSE.
    3012          30 : sal_Bool SdrObject::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& /*rPolyPolygon*/) const
    3013             : {
    3014             :     // any kind of SdrObject, just use SnapRect
    3015          30 :     Rectangle aRectangle(GetSnapRect());
    3016             : 
    3017             :     // convert to transformation values
    3018          30 :     basegfx::B2DTuple aScale(aRectangle.GetWidth(), aRectangle.GetHeight());
    3019          30 :     basegfx::B2DTuple aTranslate(aRectangle.Left(), aRectangle.Top());
    3020             : 
    3021             :     // position maybe relative to anchorpos, convert
    3022          30 :     if( pModel && pModel->IsWriter() )
    3023             :     {
    3024           0 :         if(GetAnchorPos().X() || GetAnchorPos().Y())
    3025             :         {
    3026           0 :             aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
    3027             :         }
    3028             :     }
    3029             : 
    3030             :     // force MapUnit to 100th mm
    3031          30 :     SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
    3032          30 :     if(eMapUnit != SFX_MAPUNIT_100TH_MM)
    3033             :     {
    3034           0 :         switch(eMapUnit)
    3035             :         {
    3036             :             case SFX_MAPUNIT_TWIP :
    3037             :             {
    3038             :                 // position
    3039           0 :                 aTranslate.setX(ImplTwipsToMM(aTranslate.getX()));
    3040           0 :                 aTranslate.setY(ImplTwipsToMM(aTranslate.getY()));
    3041             : 
    3042             :                 // size
    3043           0 :                 aScale.setX(ImplTwipsToMM(aScale.getX()));
    3044           0 :                 aScale.setY(ImplTwipsToMM(aScale.getY()));
    3045             : 
    3046           0 :                 break;
    3047             :             }
    3048             :             default:
    3049             :             {
    3050             :                 OSL_FAIL("TRGetBaseGeometry: Missing unit translation to 100th mm!");
    3051             :             }
    3052             :         }
    3053             :     }
    3054             : 
    3055             :     // build matrix
    3056          30 :     rMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix(aScale, aTranslate);
    3057             : 
    3058          30 :     return false;
    3059             : }
    3060             : 
    3061             : // sets the base geometry of the object using infos contained in the homogeneous 3x3 matrix.
    3062             : // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
    3063             : // to use (0,0) as upper left and will be scaled to the given size in the matrix.
    3064          30 : void SdrObject::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/)
    3065             : {
    3066             :     // break up matrix
    3067          30 :     basegfx::B2DTuple aScale;
    3068          30 :     basegfx::B2DTuple aTranslate;
    3069             :     double fRotate, fShearX;
    3070          30 :     rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
    3071             : 
    3072             :     // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
    3073             :     // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
    3074          30 :     if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
    3075             :     {
    3076           0 :         aScale.setX(fabs(aScale.getX()));
    3077           0 :         aScale.setY(fabs(aScale.getY()));
    3078           0 :         fRotate = fmod(fRotate + F_PI, F_2PI);
    3079             :     }
    3080             : 
    3081             :     // force metric to pool metric
    3082          30 :     SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
    3083          30 :     if(eMapUnit != SFX_MAPUNIT_100TH_MM)
    3084             :     {
    3085           0 :         switch(eMapUnit)
    3086             :         {
    3087             :             case SFX_MAPUNIT_TWIP :
    3088             :             {
    3089             :                 // position
    3090           0 :                 aTranslate.setX(ImplMMToTwips(aTranslate.getX()));
    3091           0 :                 aTranslate.setY(ImplMMToTwips(aTranslate.getY()));
    3092             : 
    3093             :                 // size
    3094           0 :                 aScale.setX(ImplMMToTwips(aScale.getX()));
    3095           0 :                 aScale.setY(ImplMMToTwips(aScale.getY()));
    3096             : 
    3097           0 :                 break;
    3098             :             }
    3099             :             default:
    3100             :             {
    3101             :                 OSL_FAIL("TRSetBaseGeometry: Missing unit translation to PoolMetric!");
    3102             :             }
    3103             :         }
    3104             :     }
    3105             : 
    3106             :     // if anchor is used, make position relative to it
    3107          30 :     if( pModel && pModel->IsWriter() )
    3108             :     {
    3109           0 :         if(GetAnchorPos().X() || GetAnchorPos().Y())
    3110             :         {
    3111           0 :             aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
    3112             :         }
    3113             :     }
    3114             : 
    3115             :     // build BaseRect
    3116          30 :     Point aPoint(FRound(aTranslate.getX()), FRound(aTranslate.getY()));
    3117          30 :     Rectangle aBaseRect(aPoint, Size(FRound(aScale.getX()), FRound(aScale.getY())));
    3118             : 
    3119             :     // set BaseRect
    3120          30 :     SetSnapRect(aBaseRect);
    3121          30 : }
    3122             : 
    3123             : // Give info if object is in destruction
    3124           0 : bool SdrObject::IsInDestruction() const
    3125             : {
    3126           0 :     if(pModel)
    3127           0 :         return pModel->IsInDestruction();
    3128           0 :     return false;
    3129             : }
    3130             : 
    3131             : // return if fill is != XFILL_NONE
    3132           0 : bool SdrObject::HasFillStyle() const
    3133             : {
    3134           0 :     return (((const XFillStyleItem&)GetObjectItem(XATTR_FILLSTYLE)).GetValue() != XFILL_NONE);
    3135             : }
    3136             : 
    3137           0 : bool SdrObject::HasLineStyle() const
    3138             : {
    3139           0 :     return (((const XLineStyleItem&)GetObjectItem(XATTR_LINESTYLE)).GetValue() != XLINE_NONE);
    3140             : }
    3141             : 
    3142             : 
    3143             : // #i52224#
    3144             : // on import of OLE object from MS documents the BLIP size might be retrieved,
    3145             : // the following four methods are used to control it;
    3146             : // usually this data makes no sence after the import is finished, since the object
    3147             : // might be resized
    3148             : 
    3149           8 : Rectangle SdrObject::GetBLIPSizeRectangle() const
    3150             : {
    3151           8 :     return maBLIPSizeRectangle;
    3152             : }
    3153             : 
    3154          16 : void SdrObject::SetBLIPSizeRectangle( const Rectangle& aRect )
    3155             : {
    3156          16 :     maBLIPSizeRectangle = aRect;
    3157          16 : }
    3158             : 
    3159          92 : void SdrObject::SetContextWritingMode( const sal_Int16 /*_nContextWritingMode*/ )
    3160             : {
    3161             :     // this base class does not support different writing modes, so ignore the call
    3162          92 : }
    3163             : 
    3164             : 
    3165           0 : SdrObjFactory::SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pNewPage, SdrModel* pNewModel)
    3166             : {
    3167           0 :     nInventor=nInvent;
    3168           0 :     nIdentifier=nIdent;
    3169           0 :     pNewObj=NULL;
    3170           0 :     pPage=pNewPage;
    3171           0 :     pModel=pNewModel;
    3172           0 :     pObj=NULL;
    3173           0 :     pNewData=NULL;
    3174           0 : }
    3175             : 
    3176        6970 : SdrObject* SdrObjFactory::MakeNewObject(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pPage, SdrModel* pModel)
    3177             : {
    3178        6970 :     if(pModel == NULL && pPage != NULL)
    3179        6962 :         pModel = pPage->GetModel();
    3180        6970 :     SdrObject* pObj = NULL;
    3181             : 
    3182        6970 :     if(nInvent == SdrInventor)
    3183             :     {
    3184        6970 :         switch (nIdent)
    3185             :         {
    3186           0 :             case sal_uInt16(OBJ_NONE       ): pObj=new SdrObject;                   break;
    3187        2476 :             case sal_uInt16(OBJ_GRUP       ): pObj=new SdrObjGroup;                 break;
    3188           0 :             case sal_uInt16(OBJ_LINE       ): pObj=new SdrPathObj(OBJ_LINE       ); break;
    3189         992 :             case sal_uInt16(OBJ_POLY       ): pObj=new SdrPathObj(OBJ_POLY       ); break;
    3190         508 :             case sal_uInt16(OBJ_PLIN       ): pObj=new SdrPathObj(OBJ_PLIN       ); break;
    3191           6 :             case sal_uInt16(OBJ_PATHLINE   ): pObj=new SdrPathObj(OBJ_PATHLINE   ); break;
    3192           4 :             case sal_uInt16(OBJ_PATHFILL   ): pObj=new SdrPathObj(OBJ_PATHFILL   ); break;
    3193           0 :             case sal_uInt16(OBJ_FREELINE   ): pObj=new SdrPathObj(OBJ_FREELINE   ); break;
    3194           0 :             case sal_uInt16(OBJ_FREEFILL   ): pObj=new SdrPathObj(OBJ_FREEFILL   ); break;
    3195           0 :             case sal_uInt16(OBJ_PATHPOLY   ): pObj=new SdrPathObj(OBJ_POLY       ); break;
    3196           0 :             case sal_uInt16(OBJ_PATHPLIN   ): pObj=new SdrPathObj(OBJ_PLIN       ); break;
    3197           0 :             case sal_uInt16(OBJ_EDGE       ): pObj=new SdrEdgeObj;                  break;
    3198         916 :             case sal_uInt16(OBJ_RECT       ): pObj=new SdrRectObj;                  break;
    3199           6 :             case sal_uInt16(OBJ_CIRC       ): pObj=new SdrCircObj(OBJ_CIRC       ); break;
    3200           0 :             case sal_uInt16(OBJ_SECT       ): pObj=new SdrCircObj(OBJ_SECT       ); break;
    3201           0 :             case sal_uInt16(OBJ_CARC       ): pObj=new SdrCircObj(OBJ_CARC       ); break;
    3202           0 :             case sal_uInt16(OBJ_CCUT       ): pObj=new SdrCircObj(OBJ_CCUT       ); break;
    3203        1814 :             case sal_uInt16(OBJ_TEXT       ): pObj=new SdrRectObj(OBJ_TEXT       ); break;
    3204           0 :             case sal_uInt16(OBJ_TEXTEXT    ): pObj=new SdrRectObj(OBJ_TEXTEXT    ); break;
    3205           0 :             case sal_uInt16(OBJ_TITLETEXT  ): pObj=new SdrRectObj(OBJ_TITLETEXT  ); break;
    3206           0 :             case sal_uInt16(OBJ_OUTLINETEXT): pObj=new SdrRectObj(OBJ_OUTLINETEXT); break;
    3207           0 :             case sal_uInt16(OBJ_MEASURE    ): pObj=new SdrMeasureObj;               break;
    3208          66 :             case sal_uInt16(OBJ_GRAF       ): pObj=new SdrGrafObj;                  break;
    3209           8 :             case sal_uInt16(OBJ_OLE2       ): pObj=new SdrOle2Obj;                  break;
    3210           0 :             case sal_uInt16(OBJ_FRAME      ): pObj=new SdrOle2Obj(true);            break;
    3211           2 :             case sal_uInt16(OBJ_CAPTION    ): pObj=new SdrCaptionObj;               break;
    3212           0 :             case sal_uInt16(OBJ_PAGE       ): pObj=new SdrPageObj;                  break;
    3213           0 :             case sal_uInt16(OBJ_UNO        ): pObj=new SdrUnoObj(String());         break;
    3214         168 :             case sal_uInt16(OBJ_CUSTOMSHAPE  ): pObj=new SdrObjCustomShape();       break;
    3215           0 :             case sal_uInt16(OBJ_MEDIA      ): pObj=new SdrMediaObj();               break;
    3216           4 :             case sal_uInt16(OBJ_TABLE      ): pObj=new ::sdr::table::SdrTableObj(pModel);   break;
    3217             :         }
    3218             :     }
    3219             : 
    3220        6970 :     if(pObj == NULL)
    3221             :     {
    3222           0 :         SdrObjFactory* pFact=new SdrObjFactory(nInvent,nIdent,pPage,pModel);
    3223           0 :         SdrLinkList& rLL=ImpGetUserMakeObjHdl();
    3224           0 :         unsigned nAnz=rLL.GetLinkCount();
    3225           0 :         unsigned i=0;
    3226           0 :         while (i<nAnz && pObj==NULL) {
    3227           0 :             rLL.GetLink(i).Call((void*)pFact);
    3228           0 :             pObj=pFact->pNewObj;
    3229           0 :             i++;
    3230             :         }
    3231           0 :         delete pFact;
    3232             :     }
    3233             : 
    3234             :     if(pObj == NULL)
    3235             :     {
    3236             :         // Well, if no one wants it...
    3237             :     }
    3238             : 
    3239        6970 :     if(pObj != NULL)
    3240             :     {
    3241        6970 :         if(pPage != NULL)
    3242        6962 :             pObj->SetPage(pPage);
    3243           8 :         else if(pModel != NULL)
    3244           0 :             pObj->SetModel(pModel);
    3245             :     }
    3246             : 
    3247        6970 :     return pObj;
    3248             : }
    3249             : 
    3250         152 : void SdrObjFactory::InsertMakeObjectHdl(const Link& rLink)
    3251             : {
    3252         152 :     SdrLinkList& rLL=ImpGetUserMakeObjHdl();
    3253         152 :     rLL.InsertLink(rLink);
    3254         152 : }
    3255             : 
    3256          24 : void SdrObjFactory::RemoveMakeObjectHdl(const Link& rLink)
    3257             : {
    3258          24 :     SdrLinkList& rLL=ImpGetUserMakeObjHdl();
    3259          24 :     rLL.RemoveLink(rLink);
    3260          24 : }
    3261             : 
    3262          92 : void SdrObjFactory::InsertMakeUserDataHdl(const Link& rLink)
    3263             : {
    3264          92 :     SdrLinkList& rLL=ImpGetUserMakeObjUserDataHdl();
    3265          92 :     rLL.InsertLink(rLink);
    3266          92 : }
    3267             : 
    3268          76 : void SdrObjFactory::RemoveMakeUserDataHdl(const Link& rLink)
    3269             : {
    3270          76 :     SdrLinkList& rLL=ImpGetUserMakeObjUserDataHdl();
    3271          76 :     rLL.RemoveLink(rLink);
    3272          76 : }
    3273             : 
    3274             : namespace svx
    3275             : {
    3276           0 :     ISdrObjectFilter::~ISdrObjectFilter()
    3277             :     {
    3278           0 :     }
    3279             : }
    3280             : 
    3281             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10