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