1*f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f6e50924SAndrew Rist * distributed with this work for additional information 6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10*f6e50924SAndrew Rist * 11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f6e50924SAndrew Rist * 13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f6e50924SAndrew Rist * software distributed under the License is distributed on an 15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17*f6e50924SAndrew Rist * specific language governing permissions and limitations 18*f6e50924SAndrew Rist * under the License. 19*f6e50924SAndrew Rist * 20*f6e50924SAndrew Rist *************************************************************/ 21*f6e50924SAndrew Rist 22*f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <vcl/metaact.hxx> 28cdf0e10cSrcweir #include <svx/svdedtv.hxx> 29cdf0e10cSrcweir #include <svx/svdundo.hxx> 30cdf0e10cSrcweir #include <svx/svdograf.hxx> // fuer Possibilities 31cdf0e10cSrcweir #include <svx/svdopath.hxx> 32cdf0e10cSrcweir #include <svx/svdoole2.hxx> 33cdf0e10cSrcweir #include <svx/svdopage.hxx> 34cdf0e10cSrcweir #include <svx/svdoedge.hxx> 35cdf0e10cSrcweir #include <svx/svdlayer.hxx> 36cdf0e10cSrcweir #include <svx/svdpagv.hxx> 37cdf0e10cSrcweir #include <svx/svdpage.hxx> 38cdf0e10cSrcweir #include <svx/svdpoev.hxx> // fuer die PolyPossiblities 39cdf0e10cSrcweir #include "svx/svdstr.hrc" // Namen aus der Resource 40cdf0e10cSrcweir #include "svx/svdglob.hxx" // StringCache 41cdf0e10cSrcweir #include <svx/e3dsceneupdater.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir // #i13033# 44cdf0e10cSrcweir #include <clonelist.hxx> 45cdf0e10cSrcweir 46cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 47cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 48cdf0e10cSrcweir // 49cdf0e10cSrcweir // @@@@@ @@@@@ @@ @@@@@@ @@ @@ @@ @@@@@ @@ @@ 50cdf0e10cSrcweir // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ 51cdf0e10cSrcweir // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ 52cdf0e10cSrcweir // @@@@ @@ @@ @@ @@ @@@@@ @@ @@@@ @@@@@@@ 53cdf0e10cSrcweir // @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@ 54cdf0e10cSrcweir // @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@ 55cdf0e10cSrcweir // @@@@@ @@@@@ @@ @@ @ @@ @@@@@ @@ @@ 56cdf0e10cSrcweir // 57cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 58cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 59cdf0e10cSrcweir 60cdf0e10cSrcweir void SdrEditView::ImpResetPossibilityFlags() 61cdf0e10cSrcweir { 62cdf0e10cSrcweir bReadOnly =sal_False; 63cdf0e10cSrcweir 64cdf0e10cSrcweir bGroupPossible =sal_False; 65cdf0e10cSrcweir bUnGroupPossible =sal_False; 66cdf0e10cSrcweir bGrpEnterPossible =sal_False; 67cdf0e10cSrcweir bDeletePossible =sal_False; 68cdf0e10cSrcweir bToTopPossible =sal_False; 69cdf0e10cSrcweir bToBtmPossible =sal_False; 70cdf0e10cSrcweir bReverseOrderPossible =sal_False; 71cdf0e10cSrcweir 72cdf0e10cSrcweir bImportMtfPossible =sal_False; 73cdf0e10cSrcweir bCombinePossible =sal_False; 74cdf0e10cSrcweir bDismantlePossible =sal_False; 75cdf0e10cSrcweir bCombineNoPolyPolyPossible =sal_False; 76cdf0e10cSrcweir bDismantleMakeLinesPossible=sal_False; 77cdf0e10cSrcweir bOrthoDesiredOnMarked =sal_False; 78cdf0e10cSrcweir 79cdf0e10cSrcweir bMoreThanOneNotMovable =sal_False; 80cdf0e10cSrcweir bOneOrMoreMovable =sal_False; 81cdf0e10cSrcweir bMoreThanOneNoMovRot =sal_False; 82cdf0e10cSrcweir bContortionPossible =sal_False; 83cdf0e10cSrcweir bAllPolys =sal_False; 84cdf0e10cSrcweir bOneOrMorePolys =sal_False; 85cdf0e10cSrcweir bMoveAllowed =sal_False; 86cdf0e10cSrcweir bResizeFreeAllowed =sal_False; 87cdf0e10cSrcweir bResizePropAllowed =sal_False; 88cdf0e10cSrcweir bRotateFreeAllowed =sal_False; 89cdf0e10cSrcweir bRotate90Allowed =sal_False; 90cdf0e10cSrcweir bMirrorFreeAllowed =sal_False; 91cdf0e10cSrcweir bMirror45Allowed =sal_False; 92cdf0e10cSrcweir bMirror90Allowed =sal_False; 93cdf0e10cSrcweir bTransparenceAllowed =sal_False; 94cdf0e10cSrcweir bGradientAllowed =sal_False; 95cdf0e10cSrcweir bShearAllowed =sal_False; 96cdf0e10cSrcweir bEdgeRadiusAllowed =sal_False; 97cdf0e10cSrcweir bCanConvToPath =sal_False; 98cdf0e10cSrcweir bCanConvToPoly =sal_False; 99cdf0e10cSrcweir bCanConvToContour =sal_False; 100cdf0e10cSrcweir bCanConvToPathLineToArea=sal_False; 101cdf0e10cSrcweir bCanConvToPolyLineToArea=sal_False; 102cdf0e10cSrcweir bMoveProtect =sal_False; 103cdf0e10cSrcweir bResizeProtect =sal_False; 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106cdf0e10cSrcweir void SdrEditView::ImpClearVars() 107cdf0e10cSrcweir { 108cdf0e10cSrcweir ImpResetPossibilityFlags(); 109cdf0e10cSrcweir bPossibilitiesDirty=sal_True; // << war von Purify angemeckert 110cdf0e10cSrcweir bBundleVirtObj=sal_False; 111cdf0e10cSrcweir } 112cdf0e10cSrcweir 113cdf0e10cSrcweir SdrEditView::SdrEditView(SdrModel* pModel1, OutputDevice* pOut): 114cdf0e10cSrcweir SdrMarkView(pModel1,pOut) 115cdf0e10cSrcweir { 116cdf0e10cSrcweir ImpClearVars(); 117cdf0e10cSrcweir } 118cdf0e10cSrcweir 119cdf0e10cSrcweir SdrEditView::~SdrEditView() 120cdf0e10cSrcweir { 121cdf0e10cSrcweir } 122cdf0e10cSrcweir 123cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 124cdf0e10cSrcweir 125cdf0e10cSrcweir SdrLayer* SdrEditView::InsertNewLayer(const XubString& rName, sal_uInt16 nPos) 126cdf0e10cSrcweir { 127cdf0e10cSrcweir SdrLayerAdmin& rLA=pMod->GetLayerAdmin(); 128cdf0e10cSrcweir sal_uInt16 nMax=rLA.GetLayerCount(); 129cdf0e10cSrcweir if (nPos>nMax) nPos=nMax; 130cdf0e10cSrcweir SdrLayer* pNewLayer=rLA.NewLayer(rName,nPos); 131cdf0e10cSrcweir 132cdf0e10cSrcweir if( GetModel()->IsUndoEnabled() ) 133cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewLayer(nPos,rLA,*pMod)); 134cdf0e10cSrcweir 135cdf0e10cSrcweir pMod->SetChanged(); 136cdf0e10cSrcweir return pNewLayer; 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir #include <svx/svdogrp.hxx> 140cdf0e10cSrcweir #include <svx/scene3d.hxx> 141cdf0e10cSrcweir 142cdf0e10cSrcweir sal_Bool SdrEditView::ImpDelLayerCheck(SdrObjList* pOL, SdrLayerID nDelID) const 143cdf0e10cSrcweir { 144cdf0e10cSrcweir sal_Bool bDelAll(sal_True); 145cdf0e10cSrcweir sal_uInt32 nObjAnz(pOL->GetObjCount()); 146cdf0e10cSrcweir 147cdf0e10cSrcweir for(sal_uInt32 nObjNum(nObjAnz); nObjNum > 0 && bDelAll;) 148cdf0e10cSrcweir { 149cdf0e10cSrcweir nObjNum--; 150cdf0e10cSrcweir SdrObject* pObj = pOL->GetObj(nObjNum); 151cdf0e10cSrcweir SdrObjList* pSubOL = pObj->GetSubList(); 152cdf0e10cSrcweir 153cdf0e10cSrcweir // #104809# Test explicitely for group objects and 3d scenes 154cdf0e10cSrcweir if(pSubOL && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dScene))) 155cdf0e10cSrcweir { 156cdf0e10cSrcweir if(!ImpDelLayerCheck(pSubOL, nDelID)) 157cdf0e10cSrcweir { 158cdf0e10cSrcweir // Rekursion 159cdf0e10cSrcweir bDelAll = sal_False; 160cdf0e10cSrcweir } 161cdf0e10cSrcweir } 162cdf0e10cSrcweir else 163cdf0e10cSrcweir { 164cdf0e10cSrcweir if(pObj->GetLayer() != nDelID) 165cdf0e10cSrcweir { 166cdf0e10cSrcweir bDelAll = sal_False; 167cdf0e10cSrcweir } 168cdf0e10cSrcweir } 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir return bDelAll; 172cdf0e10cSrcweir } 173cdf0e10cSrcweir 174cdf0e10cSrcweir void SdrEditView::ImpDelLayerDelObjs(SdrObjList* pOL, SdrLayerID nDelID) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir sal_uInt32 nObjAnz(pOL->GetObjCount()); 177cdf0e10cSrcweir // make sure OrdNums are correct 178cdf0e10cSrcweir pOL->GetObj(0)->GetOrdNum(); 179cdf0e10cSrcweir 180cdf0e10cSrcweir const bool bUndo = GetModel()->IsUndoEnabled(); 181cdf0e10cSrcweir 182cdf0e10cSrcweir for(sal_uInt32 nObjNum(nObjAnz); nObjNum > 0;) 183cdf0e10cSrcweir { 184cdf0e10cSrcweir nObjNum--; 185cdf0e10cSrcweir SdrObject* pObj = pOL->GetObj(nObjNum); 186cdf0e10cSrcweir SdrObjList* pSubOL = pObj->GetSubList(); 187cdf0e10cSrcweir 188cdf0e10cSrcweir 189cdf0e10cSrcweir // #104809# Test explicitely for group objects and 3d scenes 190cdf0e10cSrcweir if(pSubOL && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dScene))) 191cdf0e10cSrcweir { 192cdf0e10cSrcweir if(ImpDelLayerCheck(pSubOL, nDelID)) 193cdf0e10cSrcweir { 194cdf0e10cSrcweir if( bUndo ) 195cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true)); 196cdf0e10cSrcweir pOL->RemoveObject(nObjNum); 197cdf0e10cSrcweir 198cdf0e10cSrcweir if( !bUndo ) 199cdf0e10cSrcweir SdrObject::Free( pObj ); 200cdf0e10cSrcweir } 201cdf0e10cSrcweir else 202cdf0e10cSrcweir { 203cdf0e10cSrcweir ImpDelLayerDelObjs(pSubOL, nDelID); 204cdf0e10cSrcweir } 205cdf0e10cSrcweir } 206cdf0e10cSrcweir else 207cdf0e10cSrcweir { 208cdf0e10cSrcweir if(pObj->GetLayer() == nDelID) 209cdf0e10cSrcweir { 210cdf0e10cSrcweir if( bUndo ) 211cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true)); 212cdf0e10cSrcweir pOL->RemoveObject(nObjNum); 213cdf0e10cSrcweir if( !bUndo ) 214cdf0e10cSrcweir SdrObject::Free( pObj ); 215cdf0e10cSrcweir } 216cdf0e10cSrcweir } 217cdf0e10cSrcweir } 218cdf0e10cSrcweir } 219cdf0e10cSrcweir 220cdf0e10cSrcweir void SdrEditView::DeleteLayer(const XubString& rName) 221cdf0e10cSrcweir { 222cdf0e10cSrcweir SdrLayerAdmin& rLA = pMod->GetLayerAdmin(); 223cdf0e10cSrcweir SdrLayer* pLayer = rLA.GetLayer(rName, sal_True); 224cdf0e10cSrcweir sal_uInt16 nLayerNum(rLA.GetLayerPos(pLayer)); 225cdf0e10cSrcweir 226cdf0e10cSrcweir if(SDRLAYER_NOTFOUND != nLayerNum) 227cdf0e10cSrcweir { 228cdf0e10cSrcweir 229cdf0e10cSrcweir SdrLayerID nDelID = pLayer->GetID(); 230cdf0e10cSrcweir 231cdf0e10cSrcweir const bool bUndo = IsUndoEnabled(); 232cdf0e10cSrcweir if( bUndo ) 233cdf0e10cSrcweir BegUndo(ImpGetResStr(STR_UndoDelLayer)); 234cdf0e10cSrcweir 235cdf0e10cSrcweir sal_Bool bMaPg(sal_True); 236cdf0e10cSrcweir 237cdf0e10cSrcweir for(sal_uInt16 nPageKind(0); nPageKind < 2; nPageKind++) 238cdf0e10cSrcweir { 239cdf0e10cSrcweir // MasterPages and DrawPages 240cdf0e10cSrcweir sal_uInt16 nPgAnz(bMaPg ? pMod->GetMasterPageCount() : pMod->GetPageCount()); 241cdf0e10cSrcweir 242cdf0e10cSrcweir for(sal_uInt16 nPgNum(0); nPgNum < nPgAnz; nPgNum++) 243cdf0e10cSrcweir { 244cdf0e10cSrcweir // over all pages 245cdf0e10cSrcweir SdrPage* pPage = (bMaPg) ? pMod->GetMasterPage(nPgNum) : pMod->GetPage(nPgNum); 246cdf0e10cSrcweir sal_uInt32 nObjAnz(pPage->GetObjCount()); 247cdf0e10cSrcweir 248cdf0e10cSrcweir // make sure OrdNums are correct 249cdf0e10cSrcweir if(nObjAnz) 250cdf0e10cSrcweir pPage->GetObj(0)->GetOrdNum(); 251cdf0e10cSrcweir 252cdf0e10cSrcweir for(sal_uInt32 nObjNum(nObjAnz); nObjNum > 0;) 253cdf0e10cSrcweir { 254cdf0e10cSrcweir nObjNum--; 255cdf0e10cSrcweir SdrObject* pObj = pPage->GetObj(nObjNum); 256cdf0e10cSrcweir SdrObjList* pSubOL = pObj->GetSubList(); 257cdf0e10cSrcweir 258cdf0e10cSrcweir // #104809# Test explicitely for group objects and 3d scenes 259cdf0e10cSrcweir if(pSubOL && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dScene))) 260cdf0e10cSrcweir { 261cdf0e10cSrcweir if(ImpDelLayerCheck(pSubOL, nDelID)) 262cdf0e10cSrcweir { 263cdf0e10cSrcweir if( bUndo ) 264cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true)); 265cdf0e10cSrcweir pPage->RemoveObject(nObjNum); 266cdf0e10cSrcweir if( !bUndo ) 267cdf0e10cSrcweir SdrObject::Free(pObj); 268cdf0e10cSrcweir } 269cdf0e10cSrcweir else 270cdf0e10cSrcweir { 271cdf0e10cSrcweir ImpDelLayerDelObjs(pSubOL, nDelID); 272cdf0e10cSrcweir } 273cdf0e10cSrcweir } 274cdf0e10cSrcweir else 275cdf0e10cSrcweir { 276cdf0e10cSrcweir if(pObj->GetLayer() == nDelID) 277cdf0e10cSrcweir { 278cdf0e10cSrcweir if( bUndo ) 279cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true)); 280cdf0e10cSrcweir pPage->RemoveObject(nObjNum); 281cdf0e10cSrcweir if( !bUndo ) 282cdf0e10cSrcweir SdrObject::Free(pObj); 283cdf0e10cSrcweir } 284cdf0e10cSrcweir } 285cdf0e10cSrcweir } 286cdf0e10cSrcweir } 287cdf0e10cSrcweir bMaPg = sal_False; 288cdf0e10cSrcweir } 289cdf0e10cSrcweir 290cdf0e10cSrcweir if( bUndo ) 291cdf0e10cSrcweir { 292cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteLayer(nLayerNum, rLA, *pMod)); 293cdf0e10cSrcweir rLA.RemoveLayer(nLayerNum); 294cdf0e10cSrcweir EndUndo(); 295cdf0e10cSrcweir } 296cdf0e10cSrcweir else 297cdf0e10cSrcweir { 298cdf0e10cSrcweir delete rLA.RemoveLayer(nLayerNum); 299cdf0e10cSrcweir } 300cdf0e10cSrcweir 301cdf0e10cSrcweir pMod->SetChanged(); 302cdf0e10cSrcweir } 303cdf0e10cSrcweir } 304cdf0e10cSrcweir 305cdf0e10cSrcweir void SdrEditView::MoveLayer(const XubString& rName, sal_uInt16 nNewPos) 306cdf0e10cSrcweir { 307cdf0e10cSrcweir SdrLayerAdmin& rLA=pMod->GetLayerAdmin(); 308cdf0e10cSrcweir SdrLayer* pLayer=rLA.GetLayer(rName,sal_True); 309cdf0e10cSrcweir sal_uInt16 nLayerNum=rLA.GetLayerPos(pLayer); 310cdf0e10cSrcweir if (nLayerNum!=SDRLAYER_NOTFOUND) 311cdf0e10cSrcweir { 312cdf0e10cSrcweir if( IsUndoEnabled() ) 313cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveLayer(nLayerNum,rLA,*pMod,nNewPos)); 314cdf0e10cSrcweir rLA.MoveLayer(nLayerNum,nNewPos); 315cdf0e10cSrcweir pMod->SetChanged(); 316cdf0e10cSrcweir } 317cdf0e10cSrcweir } 318cdf0e10cSrcweir 319cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 320cdf0e10cSrcweir 321cdf0e10cSrcweir void SdrEditView::EndUndo() 322cdf0e10cSrcweir { 323cdf0e10cSrcweir // #i13033# 324cdf0e10cSrcweir // Comparison changed to 1L since EndUndo() is called later now 325cdf0e10cSrcweir // and EndUndo WILL change count to count-1 326cdf0e10cSrcweir if(1L == pMod->GetUndoBracketLevel()) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir ImpBroadcastEdgesOfMarkedNodes(); 329cdf0e10cSrcweir } 330cdf0e10cSrcweir 331cdf0e10cSrcweir // #i13033# 332cdf0e10cSrcweir // moved to bottom to still have access to UNDOs inside of 333cdf0e10cSrcweir // ImpBroadcastEdgesOfMarkedNodes() 334cdf0e10cSrcweir pMod->EndUndo(); 335cdf0e10cSrcweir } 336cdf0e10cSrcweir 337cdf0e10cSrcweir void SdrEditView::ImpBroadcastEdgesOfMarkedNodes() 338cdf0e10cSrcweir { 339cdf0e10cSrcweir const List& rAllMarkedObjects = GetTransitiveHullOfMarkedObjects(); 340cdf0e10cSrcweir 341cdf0e10cSrcweir // #i13033# 342cdf0e10cSrcweir // New mechanism to search for necessary disconnections for 343cdf0e10cSrcweir // changed connectors inside the transitive hull of all at 344cdf0e10cSrcweir // the beginning of UNDO selected objects 345cdf0e10cSrcweir for(sal_uInt32 a(0L); a < rAllMarkedObjects.Count(); a++) 346cdf0e10cSrcweir { 347cdf0e10cSrcweir SdrEdgeObj* pEdge = PTR_CAST(SdrEdgeObj, (SdrObject*)rAllMarkedObjects.GetObject(a)); 348cdf0e10cSrcweir 349cdf0e10cSrcweir if(pEdge) 350cdf0e10cSrcweir { 351cdf0e10cSrcweir SdrObject* pObj1 = pEdge->GetConnectedNode(sal_False); 352cdf0e10cSrcweir SdrObject* pObj2 = pEdge->GetConnectedNode(sal_True); 353cdf0e10cSrcweir 354cdf0e10cSrcweir if(pObj1 355cdf0e10cSrcweir && LIST_ENTRY_NOTFOUND == rAllMarkedObjects.GetPos(pObj1) 356cdf0e10cSrcweir && !pEdge->CheckNodeConnection(sal_False)) 357cdf0e10cSrcweir { 358cdf0e10cSrcweir if( IsUndoEnabled() ) 359cdf0e10cSrcweir AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pEdge)); 360cdf0e10cSrcweir pEdge->DisconnectFromNode(sal_False); 361cdf0e10cSrcweir } 362cdf0e10cSrcweir 363cdf0e10cSrcweir if(pObj2 364cdf0e10cSrcweir && LIST_ENTRY_NOTFOUND == rAllMarkedObjects.GetPos(pObj2) 365cdf0e10cSrcweir && !pEdge->CheckNodeConnection(sal_True)) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir if( IsUndoEnabled() ) 368cdf0e10cSrcweir AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pEdge)); 369cdf0e10cSrcweir pEdge->DisconnectFromNode(sal_True); 370cdf0e10cSrcweir } 371cdf0e10cSrcweir } 372cdf0e10cSrcweir } 373cdf0e10cSrcweir 374cdf0e10cSrcweir sal_uIntPtr nMarkedEdgeAnz = GetMarkedEdgesOfMarkedNodes().GetMarkCount(); 375cdf0e10cSrcweir sal_uInt16 i; 376cdf0e10cSrcweir 377cdf0e10cSrcweir for (i=0; i<nMarkedEdgeAnz; i++) { 378cdf0e10cSrcweir SdrMark* pEM = GetMarkedEdgesOfMarkedNodes().GetMark(i); 379cdf0e10cSrcweir SdrObject* pEdgeTmp=pEM->GetMarkedSdrObj(); 380cdf0e10cSrcweir SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pEdgeTmp); 381cdf0e10cSrcweir if (pEdge!=NULL) { 382cdf0e10cSrcweir pEdge->SetEdgeTrackDirty(); 383cdf0e10cSrcweir } 384cdf0e10cSrcweir } 385cdf0e10cSrcweir } 386cdf0e10cSrcweir 387cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 388cdf0e10cSrcweir // 389cdf0e10cSrcweir // #### ### #### #### # #### # # # ##### # ##### #### 390cdf0e10cSrcweir // # # # # # # # # # # # # # # # # 391cdf0e10cSrcweir // #### # # ### ### # #### # # # # # #### ### 392cdf0e10cSrcweir // # # # # # # # # # # # # # # # 393cdf0e10cSrcweir // # ### #### #### # #### # #### # # # ##### #### 394cdf0e10cSrcweir // 395cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 396cdf0e10cSrcweir 397cdf0e10cSrcweir void SdrEditView::MarkListHasChanged() 398cdf0e10cSrcweir { 399cdf0e10cSrcweir SdrMarkView::MarkListHasChanged(); 400cdf0e10cSrcweir bPossibilitiesDirty=sal_True; 401cdf0e10cSrcweir } 402cdf0e10cSrcweir 403cdf0e10cSrcweir void SdrEditView::ModelHasChanged() 404cdf0e10cSrcweir { 405cdf0e10cSrcweir SdrMarkView::ModelHasChanged(); 406cdf0e10cSrcweir bPossibilitiesDirty=sal_True; 407cdf0e10cSrcweir } 408cdf0e10cSrcweir 409cdf0e10cSrcweir sal_Bool SdrEditView::IsResizeAllowed(sal_Bool bProp) const 410cdf0e10cSrcweir { 411cdf0e10cSrcweir ForcePossibilities(); 412cdf0e10cSrcweir if (bResizeProtect) return sal_False; 413cdf0e10cSrcweir if (bProp) return bResizePropAllowed; 414cdf0e10cSrcweir return bResizeFreeAllowed; 415cdf0e10cSrcweir } 416cdf0e10cSrcweir 417cdf0e10cSrcweir sal_Bool SdrEditView::IsRotateAllowed(sal_Bool b90Deg) const 418cdf0e10cSrcweir { 419cdf0e10cSrcweir ForcePossibilities(); 420cdf0e10cSrcweir if (bMoveProtect) return sal_False; 421cdf0e10cSrcweir if (b90Deg) return bRotate90Allowed; 422cdf0e10cSrcweir return bRotateFreeAllowed; 423cdf0e10cSrcweir } 424cdf0e10cSrcweir 425cdf0e10cSrcweir sal_Bool SdrEditView::IsMirrorAllowed(sal_Bool b45Deg, sal_Bool b90Deg) const 426cdf0e10cSrcweir { 427cdf0e10cSrcweir ForcePossibilities(); 428cdf0e10cSrcweir if (bMoveProtect) return sal_False; 429cdf0e10cSrcweir if (b90Deg) return bMirror90Allowed; 430cdf0e10cSrcweir if (b45Deg) return bMirror45Allowed; 431cdf0e10cSrcweir return bMirrorFreeAllowed && !bMoveProtect; 432cdf0e10cSrcweir } 433cdf0e10cSrcweir 434cdf0e10cSrcweir sal_Bool SdrEditView::IsTransparenceAllowed() const 435cdf0e10cSrcweir { 436cdf0e10cSrcweir ForcePossibilities(); 437cdf0e10cSrcweir return bTransparenceAllowed; 438cdf0e10cSrcweir } 439cdf0e10cSrcweir 440cdf0e10cSrcweir sal_Bool SdrEditView::IsGradientAllowed() const 441cdf0e10cSrcweir { 442cdf0e10cSrcweir ForcePossibilities(); 443cdf0e10cSrcweir return bGradientAllowed; 444cdf0e10cSrcweir } 445cdf0e10cSrcweir 446cdf0e10cSrcweir sal_Bool SdrEditView::IsShearAllowed() const 447cdf0e10cSrcweir { 448cdf0e10cSrcweir ForcePossibilities(); 449cdf0e10cSrcweir if (bResizeProtect) return sal_False; 450cdf0e10cSrcweir return bShearAllowed; 451cdf0e10cSrcweir } 452cdf0e10cSrcweir 453cdf0e10cSrcweir sal_Bool SdrEditView::IsEdgeRadiusAllowed() const 454cdf0e10cSrcweir { 455cdf0e10cSrcweir ForcePossibilities(); 456cdf0e10cSrcweir return bEdgeRadiusAllowed; 457cdf0e10cSrcweir } 458cdf0e10cSrcweir 459cdf0e10cSrcweir sal_Bool SdrEditView::IsCrookAllowed(sal_Bool bNoContortion) const 460cdf0e10cSrcweir { 461cdf0e10cSrcweir // CrookMode fehlt hier (weil kein Rotate bei Shear ...) 462cdf0e10cSrcweir ForcePossibilities(); 463cdf0e10cSrcweir if (bNoContortion) { 464cdf0e10cSrcweir if (!bRotateFreeAllowed) return sal_False; // Crook is nich 465cdf0e10cSrcweir return !bMoveProtect && bMoveAllowed; 466cdf0e10cSrcweir } else { 467cdf0e10cSrcweir return !bResizeProtect && bContortionPossible; 468cdf0e10cSrcweir } 469cdf0e10cSrcweir } 470cdf0e10cSrcweir 471cdf0e10cSrcweir sal_Bool SdrEditView::IsDistortAllowed(sal_Bool bNoContortion) const 472cdf0e10cSrcweir { 473cdf0e10cSrcweir ForcePossibilities(); 474cdf0e10cSrcweir if (bNoContortion) { 475cdf0e10cSrcweir return sal_False; 476cdf0e10cSrcweir } else { 477cdf0e10cSrcweir return !bResizeProtect && bContortionPossible; 478cdf0e10cSrcweir } 479cdf0e10cSrcweir } 480cdf0e10cSrcweir 481cdf0e10cSrcweir sal_Bool SdrEditView::IsCombinePossible(sal_Bool bNoPolyPoly) const 482cdf0e10cSrcweir { 483cdf0e10cSrcweir ForcePossibilities(); 484cdf0e10cSrcweir if (bNoPolyPoly) return bCombineNoPolyPolyPossible; 485cdf0e10cSrcweir else return bCombinePossible; 486cdf0e10cSrcweir } 487cdf0e10cSrcweir 488cdf0e10cSrcweir sal_Bool SdrEditView::IsDismantlePossible(sal_Bool bMakeLines) const 489cdf0e10cSrcweir { 490cdf0e10cSrcweir ForcePossibilities(); 491cdf0e10cSrcweir if (bMakeLines) return bDismantleMakeLinesPossible; 492cdf0e10cSrcweir else return bDismantlePossible; 493cdf0e10cSrcweir } 494cdf0e10cSrcweir 495cdf0e10cSrcweir void SdrEditView::CheckPossibilities() 496cdf0e10cSrcweir { 497cdf0e10cSrcweir if (bSomeObjChgdFlag) bPossibilitiesDirty=sal_True; 498cdf0e10cSrcweir 499cdf0e10cSrcweir if(bSomeObjChgdFlag) 500cdf0e10cSrcweir { 501cdf0e10cSrcweir // This call IS necessary to correct the MarkList, in which 502cdf0e10cSrcweir // no longer to the model belonging objects still can reside. 503cdf0e10cSrcweir // These ones nned to be removed. 504cdf0e10cSrcweir CheckMarked(); 505cdf0e10cSrcweir } 506cdf0e10cSrcweir 507cdf0e10cSrcweir if (bPossibilitiesDirty) { 508cdf0e10cSrcweir ImpResetPossibilityFlags(); 509cdf0e10cSrcweir SortMarkedObjects(); 510cdf0e10cSrcweir sal_uIntPtr nMarkAnz=GetMarkedObjectCount(); 511cdf0e10cSrcweir if (nMarkAnz!=0) { 512cdf0e10cSrcweir bReverseOrderPossible=nMarkAnz>=2; 513cdf0e10cSrcweir 514cdf0e10cSrcweir sal_uIntPtr nMovableCount=0; 515cdf0e10cSrcweir bGroupPossible=nMarkAnz>=2; 516cdf0e10cSrcweir bCombinePossible=nMarkAnz>=2; 517cdf0e10cSrcweir if (nMarkAnz==1) { 518cdf0e10cSrcweir // bCombinePossible gruendlicher checken 519cdf0e10cSrcweir // fehlt noch ... 520cdf0e10cSrcweir const SdrObject* pObj=GetMarkedObjectByIndex(0); 521cdf0e10cSrcweir //const SdrPathObj* pPath=PTR_CAST(SdrPathObj,pObj); 522cdf0e10cSrcweir sal_Bool bGroup=pObj->GetSubList()!=NULL; 523cdf0e10cSrcweir sal_Bool bHasText=pObj->GetOutlinerParaObject()!=NULL; 524cdf0e10cSrcweir if (bGroup || bHasText) { 525cdf0e10cSrcweir bCombinePossible=sal_True; 526cdf0e10cSrcweir } 527cdf0e10cSrcweir } 528cdf0e10cSrcweir bCombineNoPolyPolyPossible=bCombinePossible; 529cdf0e10cSrcweir bDeletePossible=sal_True; 530cdf0e10cSrcweir // Zu den Transformationen erstmal ja sagen 531cdf0e10cSrcweir bMoveAllowed =sal_True; 532cdf0e10cSrcweir bResizeFreeAllowed=sal_True; 533cdf0e10cSrcweir bResizePropAllowed=sal_True; 534cdf0e10cSrcweir bRotateFreeAllowed=sal_True; 535cdf0e10cSrcweir bRotate90Allowed =sal_True; 536cdf0e10cSrcweir bMirrorFreeAllowed=sal_True; 537cdf0e10cSrcweir bMirror45Allowed =sal_True; 538cdf0e10cSrcweir bMirror90Allowed =sal_True; 539cdf0e10cSrcweir bShearAllowed =sal_True; 540cdf0e10cSrcweir bEdgeRadiusAllowed=sal_False; 541cdf0e10cSrcweir bContortionPossible=sal_True; 542cdf0e10cSrcweir bCanConvToContour = sal_True; 543cdf0e10cSrcweir 544cdf0e10cSrcweir // these ones are only allowed when single object is selected 545cdf0e10cSrcweir bTransparenceAllowed = (nMarkAnz == 1); 546cdf0e10cSrcweir bGradientAllowed = (nMarkAnz == 1); 547cdf0e10cSrcweir if(bGradientAllowed) 548cdf0e10cSrcweir { 549cdf0e10cSrcweir // gradient depends on fillstyle 550cdf0e10cSrcweir const SdrMark* pM = GetSdrMarkByIndex(0); 551cdf0e10cSrcweir const SdrObject* pObj = pM->GetMarkedSdrObj(); 552cdf0e10cSrcweir 553cdf0e10cSrcweir // maybe group object, so get merged ItemSet 554cdf0e10cSrcweir const SfxItemSet& rSet = pObj->GetMergedItemSet(); 555cdf0e10cSrcweir SfxItemState eState = rSet.GetItemState(XATTR_FILLSTYLE, sal_False); 556cdf0e10cSrcweir 557cdf0e10cSrcweir if(SFX_ITEM_DONTCARE != eState) 558cdf0e10cSrcweir { 559cdf0e10cSrcweir // If state is not DONTCARE, test the item 560cdf0e10cSrcweir XFillStyle eFillStyle = ((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue(); 561cdf0e10cSrcweir 562cdf0e10cSrcweir if(eFillStyle != XFILL_GRADIENT) 563cdf0e10cSrcweir { 564cdf0e10cSrcweir bGradientAllowed = sal_False; 565cdf0e10cSrcweir } 566cdf0e10cSrcweir } 567cdf0e10cSrcweir } 568cdf0e10cSrcweir 569cdf0e10cSrcweir sal_Bool bNoMovRotFound=sal_False; 570cdf0e10cSrcweir const SdrPageView* pPV0=NULL; 571cdf0e10cSrcweir 572cdf0e10cSrcweir for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++) { 573cdf0e10cSrcweir const SdrMark* pM=GetSdrMarkByIndex(nm); 574cdf0e10cSrcweir const SdrObject* pObj=pM->GetMarkedSdrObj(); 575cdf0e10cSrcweir const SdrPageView* pPV=pM->GetPageView(); 576cdf0e10cSrcweir if (pPV!=pPV0) { 577cdf0e10cSrcweir if (pPV->IsReadOnly()) bReadOnly=sal_True; 578cdf0e10cSrcweir pPV0=pPV; 579cdf0e10cSrcweir } 580cdf0e10cSrcweir 581cdf0e10cSrcweir SdrObjTransformInfoRec aInfo; 582cdf0e10cSrcweir pObj->TakeObjInfo(aInfo); 583cdf0e10cSrcweir sal_Bool bMovPrt=pObj->IsMoveProtect(); 584cdf0e10cSrcweir sal_Bool bSizPrt=pObj->IsResizeProtect(); 585cdf0e10cSrcweir if (!bMovPrt && aInfo.bMoveAllowed) nMovableCount++; // Menge der MovableObjs zaehlen 586cdf0e10cSrcweir if (bMovPrt) bMoveProtect=sal_True; 587cdf0e10cSrcweir if (bSizPrt) bResizeProtect=sal_True; 588cdf0e10cSrcweir 589cdf0e10cSrcweir // not allowed when not allowed at one object 590cdf0e10cSrcweir if(!aInfo.bTransparenceAllowed) 591cdf0e10cSrcweir bTransparenceAllowed = sal_False; 592cdf0e10cSrcweir 593cdf0e10cSrcweir // Wenn einer was nicht kann, duerfen's alle nicht 594cdf0e10cSrcweir if (!aInfo.bMoveAllowed ) bMoveAllowed =sal_False; 595cdf0e10cSrcweir if (!aInfo.bResizeFreeAllowed) bResizeFreeAllowed=sal_False; 596cdf0e10cSrcweir if (!aInfo.bResizePropAllowed) bResizePropAllowed=sal_False; 597cdf0e10cSrcweir if (!aInfo.bRotateFreeAllowed) bRotateFreeAllowed=sal_False; 598cdf0e10cSrcweir if (!aInfo.bRotate90Allowed ) bRotate90Allowed =sal_False; 599cdf0e10cSrcweir if (!aInfo.bMirrorFreeAllowed) bMirrorFreeAllowed=sal_False; 600cdf0e10cSrcweir if (!aInfo.bMirror45Allowed ) bMirror45Allowed =sal_False; 601cdf0e10cSrcweir if (!aInfo.bMirror90Allowed ) bMirror90Allowed =sal_False; 602cdf0e10cSrcweir if (!aInfo.bShearAllowed ) bShearAllowed =sal_False; 603cdf0e10cSrcweir if (aInfo.bEdgeRadiusAllowed) bEdgeRadiusAllowed=sal_True; 604cdf0e10cSrcweir if (aInfo.bNoContortion ) bContortionPossible=sal_False; 605cdf0e10cSrcweir // Fuer Crook mit Contortion: Alle Objekte muessen 606cdf0e10cSrcweir // Movable und Rotatable sein, ausser maximal 1 607cdf0e10cSrcweir if (!bMoreThanOneNoMovRot) { 608cdf0e10cSrcweir if (!aInfo.bMoveAllowed || !aInfo.bResizeFreeAllowed) { 609cdf0e10cSrcweir bMoreThanOneNoMovRot=bNoMovRotFound; 610cdf0e10cSrcweir bNoMovRotFound=sal_True; 611cdf0e10cSrcweir } 612cdf0e10cSrcweir } 613cdf0e10cSrcweir 614cdf0e10cSrcweir // when one member cannot be converted, no conversion is possible 615cdf0e10cSrcweir if(!aInfo.bCanConvToContour) 616cdf0e10cSrcweir bCanConvToContour = sal_False; 617cdf0e10cSrcweir 618cdf0e10cSrcweir // Ungroup 619cdf0e10cSrcweir if (!bUnGroupPossible) bUnGroupPossible=pObj->GetSubList()!=NULL; 620cdf0e10cSrcweir // ConvertToCurve: Wenn mind. einer konvertiert werden kann ist das ok. 621cdf0e10cSrcweir if (aInfo.bCanConvToPath ) bCanConvToPath =sal_True; 622cdf0e10cSrcweir if (aInfo.bCanConvToPoly ) bCanConvToPoly =sal_True; 623cdf0e10cSrcweir if (aInfo.bCanConvToPathLineToArea) bCanConvToPathLineToArea=sal_True; 624cdf0e10cSrcweir if (aInfo.bCanConvToPolyLineToArea) bCanConvToPolyLineToArea=sal_True; 625cdf0e10cSrcweir 626cdf0e10cSrcweir // Combine/Dismantle 627cdf0e10cSrcweir if(bCombinePossible) 628cdf0e10cSrcweir { 629cdf0e10cSrcweir bCombinePossible = ImpCanConvertForCombine(pObj); 630cdf0e10cSrcweir bCombineNoPolyPolyPossible = bCombinePossible; 631cdf0e10cSrcweir } 632cdf0e10cSrcweir 633cdf0e10cSrcweir if (!bDismantlePossible) bDismantlePossible = ImpCanDismantle(pObj, sal_False); 634cdf0e10cSrcweir if (!bDismantleMakeLinesPossible) bDismantleMakeLinesPossible = ImpCanDismantle(pObj, sal_True); 635cdf0e10cSrcweir // OrthoDesiredOnMarked checken 636cdf0e10cSrcweir if (!bOrthoDesiredOnMarked && !aInfo.bNoOrthoDesired) bOrthoDesiredOnMarked=sal_True; 637cdf0e10cSrcweir // ImportMtf checken 638cdf0e10cSrcweir 639cdf0e10cSrcweir if (!bImportMtfPossible) { 640cdf0e10cSrcweir sal_Bool bGraf=HAS_BASE(SdrGrafObj,pObj); 641cdf0e10cSrcweir sal_Bool bOle2=HAS_BASE(SdrOle2Obj,pObj); 642cdf0e10cSrcweir 643cdf0e10cSrcweir if( bGraf && 644cdf0e10cSrcweir ((SdrGrafObj*)pObj)->HasGDIMetaFile() && 645cdf0e10cSrcweir !( ((SdrGrafObj*)pObj)->IsEPS() || ((SdrGrafObj*)pObj)->IsRenderGraphic() ) ) 646cdf0e10cSrcweir { 647cdf0e10cSrcweir bImportMtfPossible = sal_True; 648cdf0e10cSrcweir } 649cdf0e10cSrcweir 650cdf0e10cSrcweir if (bOle2) 651cdf0e10cSrcweir bImportMtfPossible=((SdrOle2Obj*)pObj)->GetObjRef().is(); 652cdf0e10cSrcweir } 653cdf0e10cSrcweir } 654cdf0e10cSrcweir 655cdf0e10cSrcweir bMoreThanOneNotMovable=nMovableCount<nMarkAnz-1; 656cdf0e10cSrcweir bOneOrMoreMovable=nMovableCount!=0; 657cdf0e10cSrcweir bGrpEnterPossible=bUnGroupPossible; 658cdf0e10cSrcweir } 659cdf0e10cSrcweir ImpCheckToTopBtmPossible(); 660cdf0e10cSrcweir ((SdrPolyEditView*)this)->ImpCheckPolyPossibilities(); 661cdf0e10cSrcweir bPossibilitiesDirty=sal_False; 662cdf0e10cSrcweir 663cdf0e10cSrcweir if (bReadOnly) { 664cdf0e10cSrcweir sal_Bool bMerker1=bGrpEnterPossible; 665cdf0e10cSrcweir ImpResetPossibilityFlags(); 666cdf0e10cSrcweir bReadOnly=sal_True; 667cdf0e10cSrcweir bGrpEnterPossible=bMerker1; 668cdf0e10cSrcweir } 669cdf0e10cSrcweir if (bMoveAllowed) { 670cdf0e10cSrcweir // Verschieben von angeklebten Verbindern unterbinden 671cdf0e10cSrcweir // Derzeit nur fuer Einfachselektion implementiert. 672cdf0e10cSrcweir if (nMarkAnz==1) { 673cdf0e10cSrcweir SdrObject* pObj=GetMarkedObjectByIndex(0); 674cdf0e10cSrcweir SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj); 675cdf0e10cSrcweir if (pEdge!=NULL) { 676cdf0e10cSrcweir SdrObject* pNode1=pEdge->GetConnectedNode(sal_True); 677cdf0e10cSrcweir SdrObject* pNode2=pEdge->GetConnectedNode(sal_False); 678cdf0e10cSrcweir if (pNode1!=NULL || pNode2!=NULL) bMoveAllowed=sal_False; 679cdf0e10cSrcweir } 680cdf0e10cSrcweir } 681cdf0e10cSrcweir } 682cdf0e10cSrcweir } 683cdf0e10cSrcweir } 684cdf0e10cSrcweir 685cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 686cdf0e10cSrcweir 687cdf0e10cSrcweir void SdrEditView::ForceMarkedObjToAnotherPage() 688cdf0e10cSrcweir { 689cdf0e10cSrcweir sal_Bool bFlg=sal_False; 690cdf0e10cSrcweir for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount(); nm++) { 691cdf0e10cSrcweir SdrMark* pM=GetSdrMarkByIndex(nm); 692cdf0e10cSrcweir SdrObject* pObj=pM->GetMarkedSdrObj(); 693cdf0e10cSrcweir Rectangle aObjRect(pObj->GetCurrentBoundRect()); 694cdf0e10cSrcweir Rectangle aPgRect(pM->GetPageView()->GetPageRect()); 695cdf0e10cSrcweir if (!aObjRect.IsOver(aPgRect)) { 696cdf0e10cSrcweir sal_Bool bFnd=sal_False; 697cdf0e10cSrcweir SdrPageView* pPV = GetSdrPageView(); 698cdf0e10cSrcweir 699cdf0e10cSrcweir if(pPV) 700cdf0e10cSrcweir { 701cdf0e10cSrcweir bFnd = aObjRect.IsOver(pPV->GetPageRect()); 702cdf0e10cSrcweir } 703cdf0e10cSrcweir 704cdf0e10cSrcweir if(bFnd) 705cdf0e10cSrcweir { 706cdf0e10cSrcweir pM->GetPageView()->GetObjList()->RemoveObject(pObj->GetOrdNum()); 707cdf0e10cSrcweir SdrInsertReason aReason(SDRREASON_VIEWCALL); 708cdf0e10cSrcweir pPV->GetObjList()->InsertObject(pObj,CONTAINER_APPEND,&aReason); 709cdf0e10cSrcweir pM->SetPageView(pPV); 710cdf0e10cSrcweir InvalidateAllWin(aObjRect); 711cdf0e10cSrcweir bFlg=sal_True; 712cdf0e10cSrcweir } 713cdf0e10cSrcweir } 714cdf0e10cSrcweir } 715cdf0e10cSrcweir if (bFlg) { 716cdf0e10cSrcweir MarkListHasChanged(); 717cdf0e10cSrcweir } 718cdf0e10cSrcweir } 719cdf0e10cSrcweir 720cdf0e10cSrcweir void SdrEditView::DeleteMarkedList(const SdrMarkList& rMark) 721cdf0e10cSrcweir { 722cdf0e10cSrcweir if (rMark.GetMarkCount()!=0) 723cdf0e10cSrcweir { 724cdf0e10cSrcweir rMark.ForceSort(); 725cdf0e10cSrcweir 726cdf0e10cSrcweir const bool bUndo = IsUndoEnabled(); 727cdf0e10cSrcweir if( bUndo ) 728cdf0e10cSrcweir BegUndo(); 729cdf0e10cSrcweir const sal_uInt32 nMarkAnz(rMark.GetMarkCount()); 730cdf0e10cSrcweir 731cdf0e10cSrcweir if(nMarkAnz) 732cdf0e10cSrcweir { 733cdf0e10cSrcweir sal_uInt32 nm(0); 734cdf0e10cSrcweir std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters; 735cdf0e10cSrcweir 736cdf0e10cSrcweir if( bUndo ) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir for(nm = nMarkAnz; nm > 0;) 739cdf0e10cSrcweir { 740cdf0e10cSrcweir nm--; 741cdf0e10cSrcweir SdrMark* pM = rMark.GetMark(nm); 742cdf0e10cSrcweir SdrObject* pObj = pM->GetMarkedSdrObj(); 743cdf0e10cSrcweir 744cdf0e10cSrcweir // extra undo actions for changed connector which now may hold it's layouted path (SJ) 745cdf0e10cSrcweir std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pObj ) ); 746cdf0e10cSrcweir AddUndoActions( vConnectorUndoActions ); 747cdf0e10cSrcweir 748cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); 749cdf0e10cSrcweir } 750cdf0e10cSrcweir } 751cdf0e10cSrcweir 752cdf0e10cSrcweir // Sicherstellen, dass die OrderNums stimmen: 753cdf0e10cSrcweir rMark.GetMark(0)->GetMarkedSdrObj()->GetOrdNum(); 754cdf0e10cSrcweir 755cdf0e10cSrcweir std::vector< SdrObject* > aRemoved3DObjects; 756cdf0e10cSrcweir 757cdf0e10cSrcweir for(nm = nMarkAnz; nm > 0;) 758cdf0e10cSrcweir { 759cdf0e10cSrcweir nm--; 760cdf0e10cSrcweir SdrMark* pM = rMark.GetMark(nm); 761cdf0e10cSrcweir SdrObject* pObj = pM->GetMarkedSdrObj(); 762cdf0e10cSrcweir SdrObjList* pOL = pObj->GetObjList(); //#52680# 763cdf0e10cSrcweir const sal_uInt32 nOrdNum(pObj->GetOrdNumDirect()); 764cdf0e10cSrcweir 765cdf0e10cSrcweir bool bIs3D = dynamic_cast< E3dObject* >(pObj); 766cdf0e10cSrcweir // set up a scene updater if object is a 3d object 767cdf0e10cSrcweir if(bIs3D) 768cdf0e10cSrcweir { 769cdf0e10cSrcweir aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pObj)); 770cdf0e10cSrcweir } 771cdf0e10cSrcweir 772cdf0e10cSrcweir pOL->RemoveObject(nOrdNum); 773cdf0e10cSrcweir 774cdf0e10cSrcweir if( !bUndo ) 775cdf0e10cSrcweir { 776cdf0e10cSrcweir if( bIs3D ) 777cdf0e10cSrcweir aRemoved3DObjects.push_back( pObj ); // may be needed later 778cdf0e10cSrcweir else 779cdf0e10cSrcweir SdrObject::Free(pObj); 780cdf0e10cSrcweir } 781cdf0e10cSrcweir } 782cdf0e10cSrcweir 783cdf0e10cSrcweir // fire scene updaters 784cdf0e10cSrcweir while(!aUpdaters.empty()) 785cdf0e10cSrcweir { 786cdf0e10cSrcweir delete aUpdaters.back(); 787cdf0e10cSrcweir aUpdaters.pop_back(); 788cdf0e10cSrcweir } 789cdf0e10cSrcweir 790cdf0e10cSrcweir if( !bUndo ) 791cdf0e10cSrcweir { 792cdf0e10cSrcweir // now delete removed scene objects 793cdf0e10cSrcweir while(!aRemoved3DObjects.empty()) 794cdf0e10cSrcweir { 795cdf0e10cSrcweir SdrObject::Free( aRemoved3DObjects.back() ); 796cdf0e10cSrcweir aRemoved3DObjects.pop_back(); 797cdf0e10cSrcweir } 798cdf0e10cSrcweir } 799cdf0e10cSrcweir } 800cdf0e10cSrcweir 801cdf0e10cSrcweir if( bUndo ) 802cdf0e10cSrcweir EndUndo(); 803cdf0e10cSrcweir } 804cdf0e10cSrcweir } 805cdf0e10cSrcweir 806cdf0e10cSrcweir void SdrEditView::DeleteMarkedObj() 807cdf0e10cSrcweir { 808cdf0e10cSrcweir // #i110981# return when nothing is to be done at all 809cdf0e10cSrcweir if(!GetMarkedObjectCount()) 810cdf0e10cSrcweir { 811cdf0e10cSrcweir return; 812cdf0e10cSrcweir } 813cdf0e10cSrcweir 814cdf0e10cSrcweir // moved breaking action and undo start outside loop 815cdf0e10cSrcweir BrkAction(); 816cdf0e10cSrcweir BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_DELETE); 817cdf0e10cSrcweir 818cdf0e10cSrcweir // remove as long as something is selected. This allows to schedule objects for 819cdf0e10cSrcweir // removal for a next run as needed 820cdf0e10cSrcweir while(GetMarkedObjectCount()) 821cdf0e10cSrcweir { 822cdf0e10cSrcweir // vector to remember the parents which may be empty after object removal 823cdf0e10cSrcweir std::vector< SdrObject* > aParents; 824cdf0e10cSrcweir 825cdf0e10cSrcweir { 826cdf0e10cSrcweir const SdrMarkList& rMarkList = GetMarkedObjectList(); 827cdf0e10cSrcweir const sal_uInt32 nCount(rMarkList.GetMarkCount()); 828cdf0e10cSrcweir sal_uInt32 a(0); 829cdf0e10cSrcweir 830cdf0e10cSrcweir for(a = 0; a < nCount; a++) 831cdf0e10cSrcweir { 832cdf0e10cSrcweir // in the first run, add all found parents, but only once 833cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(a); 834cdf0e10cSrcweir SdrObject* pObject = pMark->GetMarkedSdrObj(); 835cdf0e10cSrcweir SdrObject* pParent = pObject->GetObjList()->GetOwnerObj(); 836cdf0e10cSrcweir 837cdf0e10cSrcweir if(pParent) 838cdf0e10cSrcweir { 839cdf0e10cSrcweir if(!aParents.empty()) 840cdf0e10cSrcweir { 841cdf0e10cSrcweir std::vector< SdrObject* >::iterator aFindResult = 842cdf0e10cSrcweir std::find(aParents.begin(), aParents.end(), pParent); 843cdf0e10cSrcweir 844cdf0e10cSrcweir if(aFindResult == aParents.end()) 845cdf0e10cSrcweir { 846cdf0e10cSrcweir aParents.push_back(pParent); 847cdf0e10cSrcweir } 848cdf0e10cSrcweir } 849cdf0e10cSrcweir else 850cdf0e10cSrcweir { 851cdf0e10cSrcweir aParents.push_back(pParent); 852cdf0e10cSrcweir } 853cdf0e10cSrcweir } 854cdf0e10cSrcweir } 855cdf0e10cSrcweir 856cdf0e10cSrcweir if(!aParents.empty()) 857cdf0e10cSrcweir { 858cdf0e10cSrcweir // in a 2nd run, remove all objects which may already be scheduled for 859cdf0e10cSrcweir // removal. I am not sure if this can happen, but theoretically 860cdf0e10cSrcweir // a to-be-removed object may already be the group/3DScene itself 861cdf0e10cSrcweir for(a = 0; a < nCount; a++) 862cdf0e10cSrcweir { 863cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(a); 864cdf0e10cSrcweir SdrObject* pObject = pMark->GetMarkedSdrObj(); 865cdf0e10cSrcweir 866cdf0e10cSrcweir std::vector< SdrObject* >::iterator aFindResult = 867cdf0e10cSrcweir std::find(aParents.begin(), aParents.end(), pObject); 868cdf0e10cSrcweir 869cdf0e10cSrcweir if(aFindResult != aParents.end()) 870cdf0e10cSrcweir { 871cdf0e10cSrcweir aParents.erase(aFindResult); 872cdf0e10cSrcweir } 873cdf0e10cSrcweir } 874cdf0e10cSrcweir } 875cdf0e10cSrcweir } 876cdf0e10cSrcweir 877cdf0e10cSrcweir // original stuff: remove selected objects. Handle clear will 878cdf0e10cSrcweir // do something only once 879cdf0e10cSrcweir DeleteMarkedList(GetMarkedObjectList()); 880cdf0e10cSrcweir GetMarkedObjectListWriteAccess().Clear(); 881cdf0e10cSrcweir aHdl.Clear(); 882cdf0e10cSrcweir 883cdf0e10cSrcweir while(aParents.size() && !GetMarkedObjectCount()) 884cdf0e10cSrcweir { 885cdf0e10cSrcweir // iterate over remembered parents 886cdf0e10cSrcweir SdrObject* pParent = aParents.back(); 887cdf0e10cSrcweir aParents.pop_back(); 888cdf0e10cSrcweir 889cdf0e10cSrcweir if(pParent->GetSubList() && 0 == pParent->GetSubList()->GetObjCount()) 890cdf0e10cSrcweir { 891cdf0e10cSrcweir // we detected an empty parent, a candidate to leave group/3DScene 892cdf0e10cSrcweir // if entered 893cdf0e10cSrcweir if(GetSdrPageView()->GetAktGroup() 894cdf0e10cSrcweir && GetSdrPageView()->GetAktGroup() == pParent) 895cdf0e10cSrcweir { 896cdf0e10cSrcweir GetSdrPageView()->LeaveOneGroup(); 897cdf0e10cSrcweir } 898cdf0e10cSrcweir 899cdf0e10cSrcweir // schedule empty parent for removal 900cdf0e10cSrcweir GetMarkedObjectListWriteAccess().InsertEntry( 901cdf0e10cSrcweir SdrMark(pParent, GetSdrPageView())); 902cdf0e10cSrcweir } 903cdf0e10cSrcweir } 904cdf0e10cSrcweir } 905cdf0e10cSrcweir 906cdf0e10cSrcweir // end undo and change messaging moved at the end 907cdf0e10cSrcweir EndUndo(); 908cdf0e10cSrcweir MarkListHasChanged(); 909cdf0e10cSrcweir } 910cdf0e10cSrcweir 911cdf0e10cSrcweir void SdrEditView::CopyMarkedObj() 912cdf0e10cSrcweir { 913cdf0e10cSrcweir SortMarkedObjects(); 914cdf0e10cSrcweir 915cdf0e10cSrcweir SdrMarkList aSourceObjectsForCopy(GetMarkedObjectList()); 916cdf0e10cSrcweir // Folgende Schleife Anstatt MarkList::Merge(), damit 917cdf0e10cSrcweir // ich jeweils mein Flag an die MarkEntries setzen kann. 918cdf0e10cSrcweir sal_uIntPtr nEdgeAnz = GetEdgesOfMarkedNodes().GetMarkCount(); 919cdf0e10cSrcweir for (sal_uIntPtr nEdgeNum=0; nEdgeNum<nEdgeAnz; nEdgeNum++) { 920cdf0e10cSrcweir SdrMark aM(*GetEdgesOfMarkedNodes().GetMark(nEdgeNum)); 921cdf0e10cSrcweir aM.SetUser(1); 922cdf0e10cSrcweir aSourceObjectsForCopy.InsertEntry(aM); 923cdf0e10cSrcweir } 924cdf0e10cSrcweir aSourceObjectsForCopy.ForceSort(); 925cdf0e10cSrcweir 926cdf0e10cSrcweir // #i13033# 927cdf0e10cSrcweir // New mechanism to re-create the connections of cloned connectors 928cdf0e10cSrcweir CloneList aCloneList; 929cdf0e10cSrcweir 930cdf0e10cSrcweir const bool bUndo = IsUndoEnabled(); 931cdf0e10cSrcweir 932cdf0e10cSrcweir GetMarkedObjectListWriteAccess().Clear(); 933cdf0e10cSrcweir sal_uIntPtr nCloneErrCnt=0; 934cdf0e10cSrcweir sal_uIntPtr nMarkAnz=aSourceObjectsForCopy.GetMarkCount(); 935cdf0e10cSrcweir sal_uIntPtr nm; 936cdf0e10cSrcweir for (nm=0; nm<nMarkAnz; nm++) { 937cdf0e10cSrcweir SdrMark* pM=aSourceObjectsForCopy.GetMark(nm); 938cdf0e10cSrcweir SdrObject* pO=pM->GetMarkedSdrObj()->Clone(); 939cdf0e10cSrcweir if (pO!=NULL) { 940cdf0e10cSrcweir SdrInsertReason aReason(SDRREASON_VIEWCALL); 941cdf0e10cSrcweir pM->GetPageView()->GetObjList()->InsertObject(pO,CONTAINER_APPEND,&aReason); 942cdf0e10cSrcweir 943cdf0e10cSrcweir if( bUndo ) 944cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoCopyObject(*pO)); 945cdf0e10cSrcweir 946cdf0e10cSrcweir SdrMark aME(*pM); 947cdf0e10cSrcweir aME.SetMarkedSdrObj(pO); 948cdf0e10cSrcweir aCloneList.AddPair(pM->GetMarkedSdrObj(), pO); 949cdf0e10cSrcweir 950cdf0e10cSrcweir if (pM->GetUser()==0) 951cdf0e10cSrcweir { 952cdf0e10cSrcweir // Sonst war's nur eine mitzukierende Edge 953cdf0e10cSrcweir GetMarkedObjectListWriteAccess().InsertEntry(aME); 954cdf0e10cSrcweir } 955cdf0e10cSrcweir } else { 956cdf0e10cSrcweir nCloneErrCnt++; 957cdf0e10cSrcweir } 958cdf0e10cSrcweir } 959cdf0e10cSrcweir 960cdf0e10cSrcweir // #i13033# 961cdf0e10cSrcweir // New mechanism to re-create the connections of cloned connectors 962cdf0e10cSrcweir aCloneList.CopyConnections(); 963cdf0e10cSrcweir 964cdf0e10cSrcweir if(0L != nCloneErrCnt) 965cdf0e10cSrcweir { 966cdf0e10cSrcweir #ifdef DBG_UTIL 967cdf0e10cSrcweir ByteString aStr("SdrEditView::CopyMarkedObj(): Fehler beim Clonen "); 968cdf0e10cSrcweir 969cdf0e10cSrcweir if(nCloneErrCnt == 1) 970cdf0e10cSrcweir { 971cdf0e10cSrcweir aStr += "eines Zeichenobjekts."; 972cdf0e10cSrcweir } 973cdf0e10cSrcweir else 974cdf0e10cSrcweir { 975cdf0e10cSrcweir aStr += "von "; 976cdf0e10cSrcweir aStr += ByteString::CreateFromInt32( nCloneErrCnt ); 977cdf0e10cSrcweir aStr += " Zeichenobjekten."; 978cdf0e10cSrcweir } 979cdf0e10cSrcweir 980cdf0e10cSrcweir aStr += " Objektverbindungen werden nicht mitkopiert."; 981cdf0e10cSrcweir DBG_ERROR(aStr.GetBuffer()); 982cdf0e10cSrcweir #endif 983cdf0e10cSrcweir } 984cdf0e10cSrcweir MarkListHasChanged(); 985cdf0e10cSrcweir } 986cdf0e10cSrcweir 987cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 988cdf0e10cSrcweir 989cdf0e10cSrcweir sal_Bool SdrEditView::InsertObjectAtView(SdrObject* pObj, SdrPageView& rPV, sal_uIntPtr nOptions) 990cdf0e10cSrcweir { 991cdf0e10cSrcweir if ((nOptions & SDRINSERT_SETDEFLAYER)!=0) { 992cdf0e10cSrcweir SdrLayerID nLayer=rPV.GetPage()->GetLayerAdmin().GetLayerID(aAktLayer,sal_True); 993cdf0e10cSrcweir if (nLayer==SDRLAYER_NOTFOUND) nLayer=0; 994cdf0e10cSrcweir if (rPV.GetLockedLayers().IsSet(nLayer) || !rPV.GetVisibleLayers().IsSet(nLayer)) { 995cdf0e10cSrcweir SdrObject::Free( pObj ); // Layer gesperrt oder nicht sichtbar 996cdf0e10cSrcweir return sal_False; 997cdf0e10cSrcweir } 998cdf0e10cSrcweir pObj->NbcSetLayer(nLayer); 999cdf0e10cSrcweir } 1000cdf0e10cSrcweir if ((nOptions & SDRINSERT_SETDEFATTR)!=0) { 1001cdf0e10cSrcweir if (pDefaultStyleSheet!=NULL) pObj->NbcSetStyleSheet(pDefaultStyleSheet, sal_False); 1002cdf0e10cSrcweir pObj->SetMergedItemSet(aDefaultAttr); 1003cdf0e10cSrcweir } 1004cdf0e10cSrcweir if (!pObj->IsInserted()) { 1005cdf0e10cSrcweir SdrInsertReason aReason(SDRREASON_VIEWCALL); 1006cdf0e10cSrcweir if ((nOptions & SDRINSERT_NOBROADCAST)!=0) { 1007cdf0e10cSrcweir rPV.GetObjList()->NbcInsertObject(pObj,CONTAINER_APPEND,&aReason); 1008cdf0e10cSrcweir } else { 1009cdf0e10cSrcweir rPV.GetObjList()->InsertObject(pObj,CONTAINER_APPEND,&aReason); 1010cdf0e10cSrcweir } 1011cdf0e10cSrcweir } 1012cdf0e10cSrcweir if( IsUndoEnabled() ) 1013cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pObj)); 1014cdf0e10cSrcweir 1015cdf0e10cSrcweir if ((nOptions & SDRINSERT_DONTMARK)==0) { 1016cdf0e10cSrcweir if ((nOptions & SDRINSERT_ADDMARK)==0) UnmarkAllObj(); 1017cdf0e10cSrcweir MarkObj(pObj,&rPV); 1018cdf0e10cSrcweir } 1019cdf0e10cSrcweir return sal_True; 1020cdf0e10cSrcweir } 1021cdf0e10cSrcweir 1022cdf0e10cSrcweir void SdrEditView::ReplaceObjectAtView(SdrObject* pOldObj, SdrPageView& rPV, SdrObject* pNewObj, sal_Bool bMark) 1023cdf0e10cSrcweir { 1024cdf0e10cSrcweir SdrObjList* pOL=pOldObj->GetObjList(); 1025cdf0e10cSrcweir const bool bUndo = IsUndoEnabled(); 1026cdf0e10cSrcweir if( bUndo ) 1027cdf0e10cSrcweir AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoReplaceObject(*pOldObj,*pNewObj)); 1028cdf0e10cSrcweir 1029cdf0e10cSrcweir if( IsObjMarked( pOldObj ) ) 1030cdf0e10cSrcweir MarkObj( pOldObj, &rPV, sal_True /*unmark!*/ ); 1031cdf0e10cSrcweir 1032cdf0e10cSrcweir pOL->ReplaceObject(pNewObj,pOldObj->GetOrdNum()); 1033cdf0e10cSrcweir 1034cdf0e10cSrcweir if( !bUndo ) 1035cdf0e10cSrcweir SdrObject::Free( pOldObj ); 1036cdf0e10cSrcweir 1037cdf0e10cSrcweir if (bMark) MarkObj(pNewObj,&rPV); 1038cdf0e10cSrcweir } 1039cdf0e10cSrcweir 1040cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 1041cdf0e10cSrcweir 1042cdf0e10cSrcweir bool SdrEditView::IsUndoEnabled() const 1043cdf0e10cSrcweir { 1044cdf0e10cSrcweir return pMod->IsUndoEnabled(); 1045cdf0e10cSrcweir } 1046