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