xref: /aoo42x/main/svx/source/svdraw/svdedtv1.cxx (revision ee093554)
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 <svx/svdedtv.hxx>
28cdf0e10cSrcweir #include <math.h>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #ifndef _MATH_H
31cdf0e10cSrcweir #define _MATH_H
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #include <tools/bigint.hxx>
34cdf0e10cSrcweir #include <svl/itemiter.hxx>
35cdf0e10cSrcweir #include <vcl/msgbox.hxx>
36cdf0e10cSrcweir #include <svx/rectenum.hxx>
37cdf0e10cSrcweir #include <svx/svxids.hrc>   // fuer SID_ATTR_TRANSFORM_...
38cdf0e10cSrcweir #include <svx/svdattr.hxx>  // fuer Get/SetGeoAttr
39cdf0e10cSrcweir #include "svx/svditext.hxx"
40cdf0e10cSrcweir #include "svx/svditer.hxx"
41cdf0e10cSrcweir #include <svx/svdtrans.hxx>
42cdf0e10cSrcweir #include <svx/svdundo.hxx>
43cdf0e10cSrcweir #include <svx/svdpage.hxx>
44cdf0e10cSrcweir #include <svx/svdpagv.hxx>
45cdf0e10cSrcweir #include <svx/svdlayer.hxx> // fuer MergeNotPersistAttr
46cdf0e10cSrcweir #include <svx/svdattrx.hxx> // fuer MergeNotPersistAttr
47cdf0e10cSrcweir #include <svx/svdetc.hxx>   // fuer SearchOutlinerItems
48cdf0e10cSrcweir #include <svx/svdopath.hxx>  // fuer Crook
49cdf0e10cSrcweir #include "svx/svdstr.hrc"   // Namen aus der Resource
50cdf0e10cSrcweir #include "svx/svdglob.hxx"  // StringCache
51cdf0e10cSrcweir #include <editeng/eeitem.hxx>
52cdf0e10cSrcweir #include <svl/aeitem.hxx>
53cdf0e10cSrcweir #include <svl/whiter.hxx>
54cdf0e10cSrcweir #include <svx/sdr/contact/objectcontact.hxx>
55cdf0e10cSrcweir #include <svx/sdr/contact/viewcontact.hxx>
56cdf0e10cSrcweir #include <svx/e3dsceneupdater.hxx>
57cdf0e10cSrcweir #include <svx/obj3d.hxx>
58d5370dc8SArmin Le Grand #include <basegfx/matrix/b2dhommatrix.hxx>
59d5370dc8SArmin Le Grand #include <svx/AffineMatrixItem.hxx>
60d5370dc8SArmin Le Grand #include <basegfx/matrix/b2dhommatrixtools.hxx>
61cdf0e10cSrcweir 
62cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
63cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
64cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
65cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
66cdf0e10cSrcweir //
67cdf0e10cSrcweir //  @@@@@ @@@@@  @@ @@@@@@  @@ @@ @@ @@@@@ @@   @@
68cdf0e10cSrcweir //  @@    @@  @@ @@   @@    @@ @@ @@ @@    @@   @@
69cdf0e10cSrcweir //  @@    @@  @@ @@   @@    @@ @@ @@ @@    @@ @ @@
70cdf0e10cSrcweir //  @@@@  @@  @@ @@   @@    @@@@@ @@ @@@@  @@@@@@@
71cdf0e10cSrcweir //  @@    @@  @@ @@   @@     @@@  @@ @@    @@@@@@@
72cdf0e10cSrcweir //  @@    @@  @@ @@   @@     @@@  @@ @@    @@@ @@@
73cdf0e10cSrcweir //  @@@@@ @@@@@  @@   @@      @   @@ @@@@@ @@   @@
74cdf0e10cSrcweir //
75cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
76cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
77cdf0e10cSrcweir 
78cdf0e10cSrcweir void SdrEditView::SetMarkedObjRect(const Rectangle& rRect, sal_Bool bCopy)
79cdf0e10cSrcweir {
80cdf0e10cSrcweir 	DBG_ASSERT(!rRect.IsEmpty(),"SetMarkedObjRect() mit leerem Rect mach keinen Sinn");
81cdf0e10cSrcweir 	if (rRect.IsEmpty()) return;
82cdf0e10cSrcweir 	sal_uIntPtr nAnz=GetMarkedObjectCount();
83cdf0e10cSrcweir 	if (nAnz==0) return;
84cdf0e10cSrcweir 	Rectangle aR0(GetMarkedObjRect());
85cdf0e10cSrcweir 	DBG_ASSERT(!aR0.IsEmpty(),"SetMarkedObjRect(): GetMarkedObjRect() ist leer");
86cdf0e10cSrcweir 	if (aR0.IsEmpty()) return;
87cdf0e10cSrcweir 	long x0=aR0.Left();
88cdf0e10cSrcweir 	long y0=aR0.Top();
89cdf0e10cSrcweir 	long w0=aR0.Right()-x0;
90cdf0e10cSrcweir 	long h0=aR0.Bottom()-y0;
91cdf0e10cSrcweir 	long x1=rRect.Left();
92cdf0e10cSrcweir 	long y1=rRect.Top();
93cdf0e10cSrcweir 	long w1=rRect.Right()-x1;
94cdf0e10cSrcweir 	long h1=rRect.Bottom()-y1;
95cdf0e10cSrcweir 	XubString aStr;
96cdf0e10cSrcweir 	ImpTakeDescriptionStr(STR_EditPosSize,aStr);
97cdf0e10cSrcweir 	if (bCopy)
98cdf0e10cSrcweir 		aStr+=ImpGetResStr(STR_EditWithCopy);
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	const bool bUndo = IsUndoEnabled();
101cdf0e10cSrcweir 	if( bUndo )
102cdf0e10cSrcweir 		BegUndo(aStr);
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	if (bCopy)
105cdf0e10cSrcweir 		CopyMarkedObj();
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 	for (sal_uIntPtr nm=0; nm<nAnz; nm++)
108cdf0e10cSrcweir 	{
109cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nm);
110cdf0e10cSrcweir 		SdrObject* pO=pM->GetMarkedSdrObj();
111cdf0e10cSrcweir 		if( bUndo )
112cdf0e10cSrcweir 			AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 		Rectangle aR1(pO->GetSnapRect());
115cdf0e10cSrcweir 		if (!aR1.IsEmpty())
116cdf0e10cSrcweir 		{
117cdf0e10cSrcweir 			if (aR1==aR0)
118cdf0e10cSrcweir 			{
119cdf0e10cSrcweir 				aR1=rRect;
120cdf0e10cSrcweir 			}
121cdf0e10cSrcweir 			else
122cdf0e10cSrcweir 			{ // aR1 von aR0 nach rRect transformieren
123cdf0e10cSrcweir 				aR1.Move(-x0,-y0);
124cdf0e10cSrcweir 				BigInt l(aR1.Left());
125cdf0e10cSrcweir 				BigInt r(aR1.Right());
126cdf0e10cSrcweir 				BigInt t(aR1.Top());
127cdf0e10cSrcweir 				BigInt b(aR1.Bottom());
128cdf0e10cSrcweir 				if (w0!=0) {
129cdf0e10cSrcweir 					l*=w1; l/=w0;
130cdf0e10cSrcweir 					r*=w1; r/=w0;
131cdf0e10cSrcweir 				} else {
132cdf0e10cSrcweir 					l=0; r=w1;
133cdf0e10cSrcweir 				}
134cdf0e10cSrcweir 				if (h0!=0) {
135cdf0e10cSrcweir 					t*=h1; t/=h0;
136cdf0e10cSrcweir 					b*=h1; b/=h0;
137cdf0e10cSrcweir 				} else {
138cdf0e10cSrcweir 					t=0; b=h1;
139cdf0e10cSrcweir 				}
140cdf0e10cSrcweir 				aR1.Left  ()=long(l);
141cdf0e10cSrcweir 				aR1.Right ()=long(r);
142cdf0e10cSrcweir 				aR1.Top   ()=long(t);
143cdf0e10cSrcweir 				aR1.Bottom()=long(b);
144cdf0e10cSrcweir 				aR1.Move(x1,y1);
145cdf0e10cSrcweir 			}
146cdf0e10cSrcweir 			pO->SetSnapRect(aR1);
147cdf0e10cSrcweir 		} else {
148cdf0e10cSrcweir 			DBG_ERROR("SetMarkedObjRect(): pObj->GetSnapRect() liefert leeres Rect");
149cdf0e10cSrcweir 		}
150cdf0e10cSrcweir 	}
151cdf0e10cSrcweir 	if( bUndo )
152cdf0e10cSrcweir 		EndUndo();
153cdf0e10cSrcweir }
154cdf0e10cSrcweir 
155cdf0e10cSrcweir std::vector< SdrUndoAction* > SdrEditView::CreateConnectorUndo( SdrObject& rO )
156cdf0e10cSrcweir {
157cdf0e10cSrcweir 	std::vector< SdrUndoAction* > vUndoActions;
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	if ( rO.GetBroadcaster() )
160cdf0e10cSrcweir 	{
161cdf0e10cSrcweir 		const SdrPage* pPage = rO.GetPage();
162cdf0e10cSrcweir 		if ( pPage )
163cdf0e10cSrcweir 		{
164cdf0e10cSrcweir 			SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
165cdf0e10cSrcweir 			while( aIter.IsMore() )
166cdf0e10cSrcweir 			{
167cdf0e10cSrcweir 				SdrObject* pPartObj = aIter.Next();
168cdf0e10cSrcweir 				if ( pPartObj->ISA( SdrEdgeObj ) )
169cdf0e10cSrcweir 				{
170cdf0e10cSrcweir 					if ( ( pPartObj->GetConnectedNode( sal_False ) == &rO ) ||
171cdf0e10cSrcweir 						 ( pPartObj->GetConnectedNode( sal_True  ) == &rO ) )
172cdf0e10cSrcweir 					{
173cdf0e10cSrcweir 						vUndoActions.push_back( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject( *pPartObj ) );
174cdf0e10cSrcweir 					}
175cdf0e10cSrcweir 				}
176cdf0e10cSrcweir 			}
177cdf0e10cSrcweir 		}
178cdf0e10cSrcweir 	}
179cdf0e10cSrcweir 	return vUndoActions;
180cdf0e10cSrcweir }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir void SdrEditView::AddUndoActions( std::vector< SdrUndoAction* >& rUndoActions )
183cdf0e10cSrcweir {
184cdf0e10cSrcweir 	std::vector< SdrUndoAction* >::iterator aUndoActionIter( rUndoActions.begin() );
185cdf0e10cSrcweir 	while( aUndoActionIter != rUndoActions.end() )
186cdf0e10cSrcweir 		AddUndo( *aUndoActionIter++ );
187cdf0e10cSrcweir }
188cdf0e10cSrcweir 
189cdf0e10cSrcweir void SdrEditView::MoveMarkedObj(const Size& rSiz, bool bCopy)
190cdf0e10cSrcweir {
191cdf0e10cSrcweir 	const bool bUndo = IsUndoEnabled();
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 	if( bUndo )
194cdf0e10cSrcweir 	{
195cdf0e10cSrcweir 		XubString aStr(ImpGetResStr(STR_EditMove));
196cdf0e10cSrcweir 		if (bCopy)
197cdf0e10cSrcweir 			aStr+=ImpGetResStr(STR_EditWithCopy);
198cdf0e10cSrcweir 		// benoetigt eigene UndoGroup wegen Parameter
199cdf0e10cSrcweir 		BegUndo(aStr,GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_MOVE);
200cdf0e10cSrcweir 	}
201cdf0e10cSrcweir 
202cdf0e10cSrcweir 	if (bCopy)
203cdf0e10cSrcweir 		CopyMarkedObj();
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
206cdf0e10cSrcweir 	for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
207cdf0e10cSrcweir 	{
208cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nm);
209cdf0e10cSrcweir 		SdrObject* pO=pM->GetMarkedSdrObj();
210cdf0e10cSrcweir 		if( bUndo )
211cdf0e10cSrcweir 		{
212cdf0e10cSrcweir 			std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
213cdf0e10cSrcweir 			AddUndoActions( vConnectorUndoActions );
214cdf0e10cSrcweir 			AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pO,rSiz));
215cdf0e10cSrcweir 		}
216cdf0e10cSrcweir 		pO->Move(rSiz);
217cdf0e10cSrcweir 	}
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 	if( bUndo )
220cdf0e10cSrcweir 		EndUndo();
221cdf0e10cSrcweir }
222cdf0e10cSrcweir 
223cdf0e10cSrcweir void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy)
224cdf0e10cSrcweir {
225cdf0e10cSrcweir 	const bool bUndo = IsUndoEnabled();
226cdf0e10cSrcweir 	if( bUndo )
227cdf0e10cSrcweir 	{
228cdf0e10cSrcweir 		XubString aStr;
229cdf0e10cSrcweir 		ImpTakeDescriptionStr(STR_EditResize,aStr);
230cdf0e10cSrcweir 		if (bCopy)
231cdf0e10cSrcweir 			aStr+=ImpGetResStr(STR_EditWithCopy);
232cdf0e10cSrcweir 		BegUndo(aStr);
233cdf0e10cSrcweir 	}
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 	if (bCopy)
236cdf0e10cSrcweir 		CopyMarkedObj();
237cdf0e10cSrcweir 
238cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
239cdf0e10cSrcweir 	for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
240cdf0e10cSrcweir 	{
241cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nm);
242cdf0e10cSrcweir 		SdrObject* pO=pM->GetMarkedSdrObj();
243cdf0e10cSrcweir 		if( bUndo )
244cdf0e10cSrcweir 		{
245cdf0e10cSrcweir 			std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
246cdf0e10cSrcweir 			AddUndoActions( vConnectorUndoActions );
247cdf0e10cSrcweir 			AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
248cdf0e10cSrcweir 		}
249cdf0e10cSrcweir 		pO->Resize(rRef,xFact,yFact);
250cdf0e10cSrcweir 	}
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 	if( bUndo )
253cdf0e10cSrcweir 		EndUndo();
254cdf0e10cSrcweir }
255*ee093554SAndre Fischer void SdrEditView::ResizeMultMarkedObj(const Point& rRef,
256*ee093554SAndre Fischer     const Fraction& xFact,
257*ee093554SAndre Fischer     const Fraction& yFact,
258*ee093554SAndre Fischer     const bool bCopy,
259*ee093554SAndre Fischer     const bool bWdh,
260*ee093554SAndre Fischer     const bool bHgt)
261*ee093554SAndre Fischer {
262*ee093554SAndre Fischer 	const bool bUndo = IsUndoEnabled();
263*ee093554SAndre Fischer 	if( bUndo )
264*ee093554SAndre Fischer 	{
265*ee093554SAndre Fischer 		XubString aStr;
266*ee093554SAndre Fischer 		ImpTakeDescriptionStr(STR_EditResize,aStr);
267*ee093554SAndre Fischer 		if (bCopy)
268*ee093554SAndre Fischer 			aStr+=ImpGetResStr(STR_EditWithCopy);
269*ee093554SAndre Fischer 		BegUndo(aStr);
270*ee093554SAndre Fischer 	}
271*ee093554SAndre Fischer 
272*ee093554SAndre Fischer 	if (bCopy)
273*ee093554SAndre Fischer 		CopyMarkedObj();
274*ee093554SAndre Fischer 
275*ee093554SAndre Fischer 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
276*ee093554SAndre Fischer 	for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
277*ee093554SAndre Fischer 	{
278*ee093554SAndre Fischer 		SdrMark* pM=GetSdrMarkByIndex(nm);
279*ee093554SAndre Fischer 		SdrObject* pO=pM->GetMarkedSdrObj();
280*ee093554SAndre Fischer 		if( bUndo )
281*ee093554SAndre Fischer 		{
282*ee093554SAndre Fischer 			std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
283*ee093554SAndre Fischer 			AddUndoActions( vConnectorUndoActions );
284*ee093554SAndre Fischer 			AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
285*ee093554SAndre Fischer         }
286*ee093554SAndre Fischer 
287*ee093554SAndre Fischer         Fraction aFrac(1,1);
288*ee093554SAndre Fischer         if (bWdh && bHgt)
289*ee093554SAndre Fischer             pO->Resize(rRef, xFact, yFact);
290*ee093554SAndre Fischer         else if (bWdh)
291*ee093554SAndre Fischer             pO->Resize(rRef, xFact, aFrac);
292*ee093554SAndre Fischer         else if (bHgt)
293*ee093554SAndre Fischer             pO->Resize(rRef, aFrac, yFact);
294*ee093554SAndre Fischer     }
295*ee093554SAndre Fischer 	if( bUndo )
296*ee093554SAndre Fischer 		EndUndo();
297*ee093554SAndre Fischer }
298cdf0e10cSrcweir 
299cdf0e10cSrcweir long SdrEditView::GetMarkedObjRotate() const
300cdf0e10cSrcweir {
301cdf0e10cSrcweir 	sal_Bool b1st=sal_True;
302cdf0e10cSrcweir 	sal_Bool bOk=sal_True;
303cdf0e10cSrcweir 	long nWink=0;
304cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
305cdf0e10cSrcweir 	for (sal_uIntPtr nm=0; nm<nMarkAnz && bOk; nm++) {
306cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nm);
307cdf0e10cSrcweir 		SdrObject* pO=pM->GetMarkedSdrObj();
308cdf0e10cSrcweir 		long nWink2=pO->GetRotateAngle();
309cdf0e10cSrcweir 		if (b1st) nWink=nWink2;
310cdf0e10cSrcweir 		else if (nWink2!=nWink) bOk=sal_False;
311cdf0e10cSrcweir 		b1st=sal_False;
312cdf0e10cSrcweir 	}
313cdf0e10cSrcweir 	if (!bOk) nWink=0;
314cdf0e10cSrcweir 	return nWink;
315cdf0e10cSrcweir }
316cdf0e10cSrcweir 
317cdf0e10cSrcweir void SdrEditView::RotateMarkedObj(const Point& rRef, long nWink, bool bCopy)
318cdf0e10cSrcweir {
319cdf0e10cSrcweir 	const bool bUndo = IsUndoEnabled();
320cdf0e10cSrcweir 	if( bUndo )
321cdf0e10cSrcweir 	{
322cdf0e10cSrcweir 		XubString aStr;
323cdf0e10cSrcweir 		ImpTakeDescriptionStr(STR_EditRotate,aStr);
324cdf0e10cSrcweir 		if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
325cdf0e10cSrcweir 		BegUndo(aStr);
326cdf0e10cSrcweir 	}
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 	if (bCopy)
329cdf0e10cSrcweir 		CopyMarkedObj();
330cdf0e10cSrcweir 
331cdf0e10cSrcweir 	double nSin=sin(nWink*nPi180);
332cdf0e10cSrcweir 	double nCos=cos(nWink*nPi180);
333cdf0e10cSrcweir 	const sal_uInt32 nMarkAnz(GetMarkedObjectCount());
334cdf0e10cSrcweir 
335cdf0e10cSrcweir     if(nMarkAnz)
336cdf0e10cSrcweir     {
337cdf0e10cSrcweir         std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
338cdf0e10cSrcweir 
339cdf0e10cSrcweir         for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
340cdf0e10cSrcweir         {
341cdf0e10cSrcweir 		    SdrMark* pM = GetSdrMarkByIndex(nm);
342cdf0e10cSrcweir 		    SdrObject* pO = pM->GetMarkedSdrObj();
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 			if( bUndo )
345cdf0e10cSrcweir 			{
346cdf0e10cSrcweir 				// extra undo actions for changed connector which now may hold it's layouted path (SJ)
347cdf0e10cSrcweir 				std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
348cdf0e10cSrcweir 				AddUndoActions( vConnectorUndoActions );
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 				AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
351cdf0e10cSrcweir 			}
352cdf0e10cSrcweir 
353cdf0e10cSrcweir             // set up a scene updater if object is a 3d object
354cdf0e10cSrcweir             if(dynamic_cast< E3dObject* >(pO))
355cdf0e10cSrcweir             {
356cdf0e10cSrcweir                 aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pO));
357cdf0e10cSrcweir             }
358cdf0e10cSrcweir 
359cdf0e10cSrcweir             pO->Rotate(rRef,nWink,nSin,nCos);
360cdf0e10cSrcweir 	    }
361cdf0e10cSrcweir 
362cdf0e10cSrcweir         // fire scene updaters
363cdf0e10cSrcweir         while(!aUpdaters.empty())
364cdf0e10cSrcweir         {
365cdf0e10cSrcweir             delete aUpdaters.back();
366cdf0e10cSrcweir             aUpdaters.pop_back();
367cdf0e10cSrcweir         }
368cdf0e10cSrcweir     }
369cdf0e10cSrcweir 
370cdf0e10cSrcweir 	if( bUndo )
371cdf0e10cSrcweir 		EndUndo();
372cdf0e10cSrcweir }
373cdf0e10cSrcweir 
374cdf0e10cSrcweir void SdrEditView::MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy)
375cdf0e10cSrcweir {
376cdf0e10cSrcweir 	const bool bUndo = IsUndoEnabled();
377cdf0e10cSrcweir 
378cdf0e10cSrcweir 	if( bUndo )
379cdf0e10cSrcweir 	{
380cdf0e10cSrcweir 		XubString aStr;
381cdf0e10cSrcweir 		Point aDif(rRef2-rRef1);
382cdf0e10cSrcweir 		if (aDif.X()==0) ImpTakeDescriptionStr(STR_EditMirrorHori,aStr);
383cdf0e10cSrcweir 		else if (aDif.Y()==0) ImpTakeDescriptionStr(STR_EditMirrorVert,aStr);
384cdf0e10cSrcweir 		else if (Abs(aDif.X())==Abs(aDif.Y())) ImpTakeDescriptionStr(STR_EditMirrorDiag,aStr);
385cdf0e10cSrcweir 		else ImpTakeDescriptionStr(STR_EditMirrorFree,aStr);
386cdf0e10cSrcweir 		if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
387cdf0e10cSrcweir 		BegUndo(aStr);
388cdf0e10cSrcweir 	}
389cdf0e10cSrcweir 
390cdf0e10cSrcweir 	if (bCopy)
391cdf0e10cSrcweir 		CopyMarkedObj();
392cdf0e10cSrcweir 
393cdf0e10cSrcweir 	const sal_uInt32 nMarkAnz(GetMarkedObjectCount());
394cdf0e10cSrcweir 
395cdf0e10cSrcweir     if(nMarkAnz)
396cdf0e10cSrcweir     {
397cdf0e10cSrcweir         std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
398cdf0e10cSrcweir 
399cdf0e10cSrcweir         for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
400cdf0e10cSrcweir         {
401cdf0e10cSrcweir 		    SdrMark* pM = GetSdrMarkByIndex(nm);
402cdf0e10cSrcweir 		    SdrObject* pO = pM->GetMarkedSdrObj();
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 			if( bUndo )
405cdf0e10cSrcweir 			{
406cdf0e10cSrcweir 				// extra undo actions for changed connector which now may hold it's layouted path (SJ)
407cdf0e10cSrcweir 				std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
408cdf0e10cSrcweir 				AddUndoActions( vConnectorUndoActions );
409cdf0e10cSrcweir 
410cdf0e10cSrcweir 				AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
411cdf0e10cSrcweir 			}
412cdf0e10cSrcweir 
413cdf0e10cSrcweir             // set up a scene updater if object is a 3d object
414cdf0e10cSrcweir             if(dynamic_cast< E3dObject* >(pO))
415cdf0e10cSrcweir             {
416cdf0e10cSrcweir                 aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pO));
417cdf0e10cSrcweir             }
418cdf0e10cSrcweir 
419cdf0e10cSrcweir             pO->Mirror(rRef1,rRef2);
420cdf0e10cSrcweir 	    }
421cdf0e10cSrcweir 
422cdf0e10cSrcweir         // fire scene updaters
423cdf0e10cSrcweir         while(!aUpdaters.empty())
424cdf0e10cSrcweir         {
425cdf0e10cSrcweir             delete aUpdaters.back();
426cdf0e10cSrcweir             aUpdaters.pop_back();
427cdf0e10cSrcweir         }
428cdf0e10cSrcweir     }
429cdf0e10cSrcweir 
430cdf0e10cSrcweir 	if( bUndo )
431cdf0e10cSrcweir 		EndUndo();
432cdf0e10cSrcweir }
433cdf0e10cSrcweir 
434cdf0e10cSrcweir void SdrEditView::MirrorMarkedObjHorizontal(sal_Bool bCopy)
435cdf0e10cSrcweir {
436cdf0e10cSrcweir 	Point aCenter(GetMarkedObjRect().Center());
437cdf0e10cSrcweir 	Point aPt2(aCenter);
438cdf0e10cSrcweir 	aPt2.Y()++;
439cdf0e10cSrcweir 	MirrorMarkedObj(aCenter,aPt2,bCopy);
440cdf0e10cSrcweir }
441cdf0e10cSrcweir 
442cdf0e10cSrcweir void SdrEditView::MirrorMarkedObjVertical(sal_Bool bCopy)
443cdf0e10cSrcweir {
444cdf0e10cSrcweir 	Point aCenter(GetMarkedObjRect().Center());
445cdf0e10cSrcweir 	Point aPt2(aCenter);
446cdf0e10cSrcweir 	aPt2.X()++;
447cdf0e10cSrcweir 	MirrorMarkedObj(aCenter,aPt2,bCopy);
448cdf0e10cSrcweir }
449cdf0e10cSrcweir 
450cdf0e10cSrcweir long SdrEditView::GetMarkedObjShear() const
451cdf0e10cSrcweir {
452cdf0e10cSrcweir 	sal_Bool b1st=sal_True;
453cdf0e10cSrcweir 	sal_Bool bOk=sal_True;
454cdf0e10cSrcweir 	long nWink=0;
455cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
456cdf0e10cSrcweir 	for (sal_uIntPtr nm=0; nm<nMarkAnz && bOk; nm++) {
457cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nm);
458cdf0e10cSrcweir 		SdrObject* pO=pM->GetMarkedSdrObj();
459cdf0e10cSrcweir 		long nWink2=pO->GetShearAngle();
460cdf0e10cSrcweir 		if (b1st) nWink=nWink2;
461cdf0e10cSrcweir 		else if (nWink2!=nWink) bOk=sal_False;
462cdf0e10cSrcweir 		b1st=sal_False;
463cdf0e10cSrcweir 	}
464cdf0e10cSrcweir 	if (nWink>SDRMAXSHEAR) nWink=SDRMAXSHEAR;
465cdf0e10cSrcweir 	if (nWink<-SDRMAXSHEAR) nWink=-SDRMAXSHEAR;
466cdf0e10cSrcweir 	if (!bOk) nWink=0;
467cdf0e10cSrcweir 	return nWink;
468cdf0e10cSrcweir }
469cdf0e10cSrcweir 
470cdf0e10cSrcweir void SdrEditView::ShearMarkedObj(const Point& rRef, long nWink, bool bVShear, bool bCopy)
471cdf0e10cSrcweir {
472cdf0e10cSrcweir 	const bool bUndo = IsUndoEnabled();
473cdf0e10cSrcweir 
474cdf0e10cSrcweir 	if( bUndo )
475cdf0e10cSrcweir 	{
476cdf0e10cSrcweir 		XubString aStr;
477cdf0e10cSrcweir 		ImpTakeDescriptionStr(STR_EditShear,aStr);
478cdf0e10cSrcweir 		if (bCopy)
479cdf0e10cSrcweir 			aStr+=ImpGetResStr(STR_EditWithCopy);
480cdf0e10cSrcweir 		BegUndo(aStr);
481cdf0e10cSrcweir 	}
482cdf0e10cSrcweir 
483cdf0e10cSrcweir 	if (bCopy)
484cdf0e10cSrcweir 		CopyMarkedObj();
485cdf0e10cSrcweir 
486cdf0e10cSrcweir 	double nTan=tan(nWink*nPi180);
487cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
488cdf0e10cSrcweir 	for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
489cdf0e10cSrcweir 	{
490cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nm);
491cdf0e10cSrcweir 		SdrObject* pO=pM->GetMarkedSdrObj();
492cdf0e10cSrcweir 		if( bUndo )
493cdf0e10cSrcweir 		{
494cdf0e10cSrcweir 			std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
495cdf0e10cSrcweir 			AddUndoActions( vConnectorUndoActions );
496cdf0e10cSrcweir 			AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
497cdf0e10cSrcweir 		}
498cdf0e10cSrcweir 		pO->Shear(rRef,nWink,nTan,bVShear);
499cdf0e10cSrcweir 	}
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 	if( bUndo )
502cdf0e10cSrcweir 		EndUndo();
503cdf0e10cSrcweir }
504cdf0e10cSrcweir 
505cdf0e10cSrcweir void SdrEditView::ImpCrookObj(SdrObject* pO, const Point& rRef, const Point& rRad,
506cdf0e10cSrcweir 	SdrCrookMode eMode, sal_Bool bVertical, sal_Bool bNoContortion, sal_Bool bRotate, const Rectangle& rMarkRect)
507cdf0e10cSrcweir {
508cdf0e10cSrcweir 	SdrPathObj* pPath=PTR_CAST(SdrPathObj,pO);
509cdf0e10cSrcweir 	sal_Bool bDone = sal_False;
510cdf0e10cSrcweir 
511cdf0e10cSrcweir 	if(pPath!=NULL && !bNoContortion)
512cdf0e10cSrcweir 	{
513cdf0e10cSrcweir 		XPolyPolygon aXPP(pPath->GetPathPoly());
514cdf0e10cSrcweir 		switch (eMode) {
515cdf0e10cSrcweir 			case SDRCROOK_ROTATE : CrookRotatePoly (aXPP,rRef,rRad,bVertical);           break;
516cdf0e10cSrcweir 			case SDRCROOK_SLANT  : CrookSlantPoly  (aXPP,rRef,rRad,bVertical);           break;
517cdf0e10cSrcweir 			case SDRCROOK_STRETCH: CrookStretchPoly(aXPP,rRef,rRad,bVertical,rMarkRect); break;
518cdf0e10cSrcweir 		} // switch
519cdf0e10cSrcweir 		pPath->SetPathPoly(aXPP.getB2DPolyPolygon());
520cdf0e10cSrcweir 		bDone = sal_True;
521cdf0e10cSrcweir 	}
522cdf0e10cSrcweir 
523cdf0e10cSrcweir 	if(!bDone && !pPath && pO->IsPolyObj() && 0L != pO->GetPointCount())
524cdf0e10cSrcweir 	{
525cdf0e10cSrcweir 		// FuerPolyObj's, aber NICHT fuer SdrPathObj's, z.B. fuer's Bemassungsobjekt
526cdf0e10cSrcweir 		sal_uInt32 nPtAnz(pO->GetPointCount());
527cdf0e10cSrcweir 		XPolygon aXP((sal_uInt16)nPtAnz);
528cdf0e10cSrcweir 		sal_uInt32 nPtNum;
529cdf0e10cSrcweir 
530cdf0e10cSrcweir 		for(nPtNum = 0L; nPtNum < nPtAnz; nPtNum++)
531cdf0e10cSrcweir 		{
532cdf0e10cSrcweir 			Point aPt(pO->GetPoint(nPtNum));
533cdf0e10cSrcweir 			aXP[(sal_uInt16)nPtNum]=aPt;
534cdf0e10cSrcweir 		}
535cdf0e10cSrcweir 
536cdf0e10cSrcweir 		switch (eMode)
537cdf0e10cSrcweir 		{
538cdf0e10cSrcweir 			case SDRCROOK_ROTATE : CrookRotatePoly (aXP,rRef,rRad,bVertical);           break;
539cdf0e10cSrcweir 			case SDRCROOK_SLANT  : CrookSlantPoly  (aXP,rRef,rRad,bVertical);           break;
540cdf0e10cSrcweir 			case SDRCROOK_STRETCH: CrookStretchPoly(aXP,rRef,rRad,bVertical,rMarkRect); break;
541cdf0e10cSrcweir 		}
542cdf0e10cSrcweir 
543cdf0e10cSrcweir 		for(nPtNum = 0L; nPtNum < nPtAnz; nPtNum++)
544cdf0e10cSrcweir 		{
545cdf0e10cSrcweir 			// hier koennte man vieleicht auch mal das Broadcasting optimieren
546cdf0e10cSrcweir 			// ist aber z.Zt. bei den 2 Punkten des Bemassungsobjekts noch nicht so tragisch
547cdf0e10cSrcweir 			pO->SetPoint(aXP[(sal_uInt16)nPtNum],nPtNum);
548cdf0e10cSrcweir 		}
549cdf0e10cSrcweir 
550cdf0e10cSrcweir 		bDone = sal_True;
551cdf0e10cSrcweir 	}
552cdf0e10cSrcweir 
553cdf0e10cSrcweir 	if(!bDone)
554cdf0e10cSrcweir 	{
555cdf0e10cSrcweir 		// Fuer alle anderen oder wenn bNoContortion
556cdf0e10cSrcweir 		Point aCtr0(pO->GetSnapRect().Center());
557cdf0e10cSrcweir 		Point aCtr1(aCtr0);
558cdf0e10cSrcweir 		sal_Bool bRotOk(sal_False);
559cdf0e10cSrcweir 		double nSin(0.0), nCos(1.0);
560cdf0e10cSrcweir 		double nWink(0.0);
561cdf0e10cSrcweir 
562cdf0e10cSrcweir 		if(0 != rRad.X() && 0 != rRad.Y())
563cdf0e10cSrcweir 		{
564cdf0e10cSrcweir 			bRotOk = bRotate;
565cdf0e10cSrcweir 
566cdf0e10cSrcweir 			switch (eMode)
567cdf0e10cSrcweir 			{
568cdf0e10cSrcweir 				case SDRCROOK_ROTATE : nWink=CrookRotateXPoint (aCtr1,NULL,NULL,rRef,rRad,nSin,nCos,bVertical); bRotOk=bRotate; break;
569cdf0e10cSrcweir 				case SDRCROOK_SLANT  : nWink=CrookSlantXPoint  (aCtr1,NULL,NULL,rRef,rRad,nSin,nCos,bVertical);           break;
570cdf0e10cSrcweir 				case SDRCROOK_STRETCH: nWink=CrookStretchXPoint(aCtr1,NULL,NULL,rRef,rRad,nSin,nCos,bVertical,rMarkRect); break;
571cdf0e10cSrcweir 			}
572cdf0e10cSrcweir 		}
573cdf0e10cSrcweir 
574cdf0e10cSrcweir 		aCtr1 -= aCtr0;
575cdf0e10cSrcweir 
576cdf0e10cSrcweir 		if(bRotOk)
577cdf0e10cSrcweir 			pO->Rotate(aCtr0, Round(nWink/nPi180), nSin, nCos);
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 		pO->Move(Size(aCtr1.X(),aCtr1.Y()));
580cdf0e10cSrcweir 	}
581cdf0e10cSrcweir }
582cdf0e10cSrcweir 
583cdf0e10cSrcweir void SdrEditView::CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookMode eMode,
584cdf0e10cSrcweir 	bool bVertical, bool bNoContortion, bool bCopy)
585cdf0e10cSrcweir {
586cdf0e10cSrcweir 	Rectangle aMarkRect(GetMarkedObjRect());
587cdf0e10cSrcweir 	const bool bUndo = IsUndoEnabled();
588cdf0e10cSrcweir 
589cdf0e10cSrcweir 	bool bRotate=bNoContortion && eMode==SDRCROOK_ROTATE && IsRotateAllowed(sal_False);
590cdf0e10cSrcweir 
591cdf0e10cSrcweir 	if( bUndo )
592cdf0e10cSrcweir 	{
593cdf0e10cSrcweir 		XubString aStr;
594cdf0e10cSrcweir 		ImpTakeDescriptionStr(bNoContortion?STR_EditCrook:STR_EditCrookContortion,aStr);
595cdf0e10cSrcweir 		if (bCopy)
596cdf0e10cSrcweir 			aStr+=ImpGetResStr(STR_EditWithCopy);
597cdf0e10cSrcweir 		BegUndo(aStr);
598cdf0e10cSrcweir 	}
599cdf0e10cSrcweir 
600cdf0e10cSrcweir 	if (bCopy)
601cdf0e10cSrcweir 		CopyMarkedObj();
602cdf0e10cSrcweir 
603cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
604cdf0e10cSrcweir 	for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
605cdf0e10cSrcweir 	{
606cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nm);
607cdf0e10cSrcweir 		SdrObject* pO=pM->GetMarkedSdrObj();
608cdf0e10cSrcweir 		if( bUndo )
609cdf0e10cSrcweir 			AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
610cdf0e10cSrcweir 
611cdf0e10cSrcweir 		const SdrObjList* pOL=pO->GetSubList();
612cdf0e10cSrcweir 		if (bNoContortion || pOL==NULL) {
613cdf0e10cSrcweir 			ImpCrookObj(pO,rRef,rRad,eMode,bVertical,bNoContortion,bRotate,aMarkRect);
614cdf0e10cSrcweir 		} else {
615cdf0e10cSrcweir 			SdrObjListIter aIter(*pOL,IM_DEEPNOGROUPS);
616cdf0e10cSrcweir 			while (aIter.IsMore()) {
617cdf0e10cSrcweir 				SdrObject* pO1=aIter.Next();
618cdf0e10cSrcweir 				ImpCrookObj(pO1,rRef,rRad,eMode,bVertical,bNoContortion,bRotate,aMarkRect);
619cdf0e10cSrcweir 			}
620cdf0e10cSrcweir 		}
621cdf0e10cSrcweir 	}
622cdf0e10cSrcweir 
623cdf0e10cSrcweir 	if( bUndo )
624cdf0e10cSrcweir 		EndUndo();
625cdf0e10cSrcweir }
626cdf0e10cSrcweir 
627cdf0e10cSrcweir void SdrEditView::ImpDistortObj(SdrObject* pO, const Rectangle& rRef, const XPolygon& rDistortedRect, sal_Bool bNoContortion)
628cdf0e10cSrcweir {
629cdf0e10cSrcweir 	SdrPathObj* pPath = PTR_CAST(SdrPathObj, pO);
630cdf0e10cSrcweir 
631cdf0e10cSrcweir 	if(!bNoContortion && pPath)
632cdf0e10cSrcweir 	{
633cdf0e10cSrcweir 		XPolyPolygon aXPP(pPath->GetPathPoly());
634cdf0e10cSrcweir 		aXPP.Distort(rRef, rDistortedRect);
635cdf0e10cSrcweir 		pPath->SetPathPoly(aXPP.getB2DPolyPolygon());
636cdf0e10cSrcweir 	}
637cdf0e10cSrcweir 	else if(pO->IsPolyObj())
638cdf0e10cSrcweir 	{
639cdf0e10cSrcweir 		// z.B. fuer's Bemassungsobjekt
640cdf0e10cSrcweir 		sal_uInt32 nPtAnz(pO->GetPointCount());
641cdf0e10cSrcweir 		XPolygon aXP((sal_uInt16)nPtAnz);
642cdf0e10cSrcweir 		sal_uInt32 nPtNum;
643cdf0e10cSrcweir 
644cdf0e10cSrcweir 		for(nPtNum = 0L; nPtNum < nPtAnz; nPtNum++)
645cdf0e10cSrcweir 		{
646cdf0e10cSrcweir 			Point aPt(pO->GetPoint(nPtNum));
647cdf0e10cSrcweir 			aXP[(sal_uInt16)nPtNum]=aPt;
648cdf0e10cSrcweir 		}
649cdf0e10cSrcweir 
650cdf0e10cSrcweir 		aXP.Distort(rRef, rDistortedRect);
651cdf0e10cSrcweir 
652cdf0e10cSrcweir 		for(nPtNum = 0L; nPtNum < nPtAnz; nPtNum++)
653cdf0e10cSrcweir 		{
654cdf0e10cSrcweir 			// hier koennte man vieleicht auch mal das Broadcasting optimieren
655cdf0e10cSrcweir 			// ist aber z.Zt. bei den 2 Punkten des Bemassungsobjekts noch nicht so tragisch
656cdf0e10cSrcweir 			pO->SetPoint(aXP[(sal_uInt16)nPtNum],nPtNum);
657cdf0e10cSrcweir 		}
658cdf0e10cSrcweir 	}
659cdf0e10cSrcweir }
660cdf0e10cSrcweir 
661cdf0e10cSrcweir void SdrEditView::DistortMarkedObj(const Rectangle& rRef, const XPolygon& rDistortedRect, bool bNoContortion, bool bCopy)
662cdf0e10cSrcweir {
663cdf0e10cSrcweir 	const bool bUndo = IsUndoEnabled();
664cdf0e10cSrcweir 
665cdf0e10cSrcweir 	if( bUndo )
666cdf0e10cSrcweir 	{
667cdf0e10cSrcweir 		XubString aStr;
668cdf0e10cSrcweir 		ImpTakeDescriptionStr(STR_EditDistort,aStr);
669cdf0e10cSrcweir 		if (bCopy)
670cdf0e10cSrcweir 			aStr+=ImpGetResStr(STR_EditWithCopy);
671cdf0e10cSrcweir 		BegUndo(aStr);
672cdf0e10cSrcweir 	}
673cdf0e10cSrcweir 
674cdf0e10cSrcweir 	if (bCopy)
675cdf0e10cSrcweir 		CopyMarkedObj();
676cdf0e10cSrcweir 
677cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
678cdf0e10cSrcweir 	for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
679cdf0e10cSrcweir 	{
680cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nm);
681cdf0e10cSrcweir 		SdrObject* pO=pM->GetMarkedSdrObj();
682cdf0e10cSrcweir 		if( bUndo )
683cdf0e10cSrcweir 			AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
684cdf0e10cSrcweir 
685cdf0e10cSrcweir 		Rectangle aRefRect(rRef);
686cdf0e10cSrcweir 		XPolygon  aRefPoly(rDistortedRect);
687cdf0e10cSrcweir 		const SdrObjList* pOL=pO->GetSubList();
688cdf0e10cSrcweir 		if (bNoContortion || pOL==NULL) {
689cdf0e10cSrcweir 			ImpDistortObj(pO,aRefRect,aRefPoly,bNoContortion);
690cdf0e10cSrcweir 		} else {
691cdf0e10cSrcweir 			SdrObjListIter aIter(*pOL,IM_DEEPNOGROUPS);
692cdf0e10cSrcweir 			while (aIter.IsMore()) {
693cdf0e10cSrcweir 				SdrObject* pO1=aIter.Next();
694cdf0e10cSrcweir 				ImpDistortObj(pO1,aRefRect,aRefPoly,bNoContortion);
695cdf0e10cSrcweir 			}
696cdf0e10cSrcweir 		}
697cdf0e10cSrcweir 	}
698cdf0e10cSrcweir 	if( bUndo )
699cdf0e10cSrcweir 		EndUndo();
700cdf0e10cSrcweir }
701cdf0e10cSrcweir 
702cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
703cdf0e10cSrcweir 
704cdf0e10cSrcweir void SdrEditView::SetNotPersistAttrToMarked(const SfxItemSet& rAttr, sal_Bool /*bReplaceAll*/)
705cdf0e10cSrcweir {
706cdf0e10cSrcweir 	// bReplaceAll hat hier keinerlei Wirkung
707cdf0e10cSrcweir 	Rectangle aAllSnapRect(GetMarkedObjRect());
708cdf0e10cSrcweir 	const SfxPoolItem *pPoolItem=NULL;
709cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1X,sal_True,&pPoolItem)==SFX_ITEM_SET) {
710cdf0e10cSrcweir 		long n=((const SdrTransformRef1XItem*)pPoolItem)->GetValue();
711cdf0e10cSrcweir 		SetRef1(Point(n,GetRef1().Y()));
712cdf0e10cSrcweir 	}
713cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1Y,sal_True,&pPoolItem)==SFX_ITEM_SET) {
714cdf0e10cSrcweir 		long n=((const SdrTransformRef1YItem*)pPoolItem)->GetValue();
715cdf0e10cSrcweir 		SetRef1(Point(GetRef1().X(),n));
716cdf0e10cSrcweir 	}
717cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2X,sal_True,&pPoolItem)==SFX_ITEM_SET) {
718cdf0e10cSrcweir 		long n=((const SdrTransformRef2XItem*)pPoolItem)->GetValue();
719cdf0e10cSrcweir 		SetRef2(Point(n,GetRef2().Y()));
720cdf0e10cSrcweir 	}
721cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2Y,sal_True,&pPoolItem)==SFX_ITEM_SET) {
722cdf0e10cSrcweir 		long n=((const SdrTransformRef2YItem*)pPoolItem)->GetValue();
723cdf0e10cSrcweir 		SetRef2(Point(GetRef2().X(),n));
724cdf0e10cSrcweir 	}
725cdf0e10cSrcweir 	long nAllPosX=0; sal_Bool bAllPosX=sal_False;
726cdf0e10cSrcweir 	long nAllPosY=0; sal_Bool bAllPosY=sal_False;
727cdf0e10cSrcweir 	long nAllWdt=0;  sal_Bool bAllWdt=sal_False;
728cdf0e10cSrcweir 	long nAllHgt=0;  sal_Bool bAllHgt=sal_False;
729cdf0e10cSrcweir 	sal_Bool bDoIt=sal_False;
730cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_ALLPOSITIONX,sal_True,&pPoolItem)==SFX_ITEM_SET) {
731cdf0e10cSrcweir 		nAllPosX=((const SdrAllPositionXItem*)pPoolItem)->GetValue();
732cdf0e10cSrcweir 		bAllPosX=sal_True; bDoIt=sal_True;
733cdf0e10cSrcweir 	}
734cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_ALLPOSITIONY,sal_True,&pPoolItem)==SFX_ITEM_SET) {
735cdf0e10cSrcweir 		nAllPosY=((const SdrAllPositionYItem*)pPoolItem)->GetValue();
736cdf0e10cSrcweir 		bAllPosY=sal_True; bDoIt=sal_True;
737cdf0e10cSrcweir 	}
738cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_ALLSIZEWIDTH,sal_True,&pPoolItem)==SFX_ITEM_SET) {
739cdf0e10cSrcweir 		nAllWdt=((const SdrAllSizeWidthItem*)pPoolItem)->GetValue();
740cdf0e10cSrcweir 		bAllWdt=sal_True; bDoIt=sal_True;
741cdf0e10cSrcweir 	}
742cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_ALLSIZEHEIGHT,sal_True,&pPoolItem)==SFX_ITEM_SET) {
743cdf0e10cSrcweir 		nAllHgt=((const SdrAllSizeHeightItem*)pPoolItem)->GetValue();
744cdf0e10cSrcweir 		bAllHgt=sal_True; bDoIt=sal_True;
745cdf0e10cSrcweir 	}
746cdf0e10cSrcweir 	if (bDoIt) {
747cdf0e10cSrcweir 		Rectangle aRect(aAllSnapRect); // !!! fuer PolyPt's und GluePt's aber bitte noch aendern !!!
748cdf0e10cSrcweir 		if (bAllPosX) aRect.Move(nAllPosX-aRect.Left(),0);
749cdf0e10cSrcweir 		if (bAllPosY) aRect.Move(0,nAllPosY-aRect.Top());
750cdf0e10cSrcweir 		if (bAllWdt)  aRect.Right()=aAllSnapRect.Left()+nAllWdt;
751cdf0e10cSrcweir 		if (bAllHgt)  aRect.Bottom()=aAllSnapRect.Top()+nAllHgt;
752cdf0e10cSrcweir 		SetMarkedObjRect(aRect);
753cdf0e10cSrcweir 	}
754cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_RESIZEXALL,sal_True,&pPoolItem)==SFX_ITEM_SET) {
755cdf0e10cSrcweir 		Fraction aXFact=((const SdrResizeXAllItem*)pPoolItem)->GetValue();
756cdf0e10cSrcweir 		ResizeMarkedObj(aAllSnapRect.TopLeft(),aXFact,Fraction(1,1));
757cdf0e10cSrcweir 	}
758cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_RESIZEYALL,sal_True,&pPoolItem)==SFX_ITEM_SET) {
759cdf0e10cSrcweir 		Fraction aYFact=((const SdrResizeYAllItem*)pPoolItem)->GetValue();
760cdf0e10cSrcweir 		ResizeMarkedObj(aAllSnapRect.TopLeft(),Fraction(1,1),aYFact);
761cdf0e10cSrcweir 	}
762cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_ROTATEALL,sal_True,&pPoolItem)==SFX_ITEM_SET) {
763cdf0e10cSrcweir 		long nAngle=((const SdrRotateAllItem*)pPoolItem)->GetValue();
764cdf0e10cSrcweir 		RotateMarkedObj(aAllSnapRect.Center(),nAngle);
765cdf0e10cSrcweir 	}
766cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_HORZSHEARALL,sal_True,&pPoolItem)==SFX_ITEM_SET) {
767cdf0e10cSrcweir 		long nAngle=((const SdrHorzShearAllItem*)pPoolItem)->GetValue();
768cdf0e10cSrcweir 		ShearMarkedObj(aAllSnapRect.Center(),nAngle,sal_False);
769cdf0e10cSrcweir 	}
770cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_VERTSHEARALL,sal_True,&pPoolItem)==SFX_ITEM_SET) {
771cdf0e10cSrcweir 		long nAngle=((const SdrVertShearAllItem*)pPoolItem)->GetValue();
772cdf0e10cSrcweir 		ShearMarkedObj(aAllSnapRect.Center(),nAngle,sal_True);
773cdf0e10cSrcweir 	}
774cdf0e10cSrcweir 
775cdf0e10cSrcweir 	const bool bUndo = IsUndoEnabled();
776cdf0e10cSrcweir 
777cdf0e10cSrcweir 	// Todo: WhichRange nach Notwendigkeit ueberpruefen.
778cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
779cdf0e10cSrcweir 	for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
780cdf0e10cSrcweir 	{
781cdf0e10cSrcweir 		const SdrMark* pM=GetSdrMarkByIndex(nm);
782cdf0e10cSrcweir 		SdrObject* pObj=pM->GetMarkedSdrObj();
783cdf0e10cSrcweir 		//const SdrPageView* pPV=pM->GetPageView();
784cdf0e10cSrcweir 		if( bUndo )
785cdf0e10cSrcweir 			AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
786cdf0e10cSrcweir 
787cdf0e10cSrcweir 		pObj->ApplyNotPersistAttr(rAttr);
788cdf0e10cSrcweir 	}
789cdf0e10cSrcweir }
790cdf0e10cSrcweir 
791cdf0e10cSrcweir void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr, sal_Bool /*bOnlyHardAttr*/) const
792cdf0e10cSrcweir {
793cdf0e10cSrcweir 	// bOnlyHardAttr hat hier keinerlei Wirkung
794cdf0e10cSrcweir 	// Hier muss ausserdem noch der Nullpunkt und
795cdf0e10cSrcweir 	// die PvPos berueksichtigt werden.
796cdf0e10cSrcweir 	Rectangle aAllSnapRect(GetMarkedObjRect()); // !!! fuer PolyPt's und GluePt's aber bitte noch aendern !!!
797cdf0e10cSrcweir 	long nAllSnapPosX=aAllSnapRect.Left();
798cdf0e10cSrcweir 	long nAllSnapPosY=aAllSnapRect.Top();
799cdf0e10cSrcweir 	long nAllSnapWdt=aAllSnapRect.GetWidth()-1;
800cdf0e10cSrcweir 	long nAllSnapHgt=aAllSnapRect.GetHeight()-1;
801cdf0e10cSrcweir 	// koennte mal zu CheckPossibilities mit rein
802cdf0e10cSrcweir 	sal_Bool bMovProtect=sal_False,bMovProtectDC=sal_False;
803cdf0e10cSrcweir 	sal_Bool bSizProtect=sal_False,bSizProtectDC=sal_False;
804cdf0e10cSrcweir 	sal_Bool bPrintable =sal_True ,bPrintableDC=sal_False;
805cdf0e10cSrcweir 	sal_Bool bVisible = sal_True, bVisibleDC=sal_False;
806cdf0e10cSrcweir 	SdrLayerID nLayerId=0; sal_Bool bLayerDC=sal_False;
807cdf0e10cSrcweir 	XubString aObjName;     sal_Bool bObjNameDC=sal_False,bObjNameSet=sal_False;
808cdf0e10cSrcweir 	long nSnapPosX=0;      sal_Bool bSnapPosXDC=sal_False;
809cdf0e10cSrcweir 	long nSnapPosY=0;      sal_Bool bSnapPosYDC=sal_False;
810cdf0e10cSrcweir 	long nSnapWdt=0;       sal_Bool bSnapWdtDC=sal_False;
811cdf0e10cSrcweir 	long nSnapHgt=0;       sal_Bool bSnapHgtDC=sal_False;
812cdf0e10cSrcweir 	long nLogicWdt=0;      sal_Bool bLogicWdtDC=sal_False,bLogicWdtDiff=sal_False;
813cdf0e10cSrcweir 	long nLogicHgt=0;      sal_Bool bLogicHgtDC=sal_False,bLogicHgtDiff=sal_False;
814cdf0e10cSrcweir 	long nRotAngle=0;      sal_Bool bRotAngleDC=sal_False;
815cdf0e10cSrcweir 	long nShrAngle=0;      sal_Bool bShrAngleDC=sal_False;
816cdf0e10cSrcweir 	Rectangle aSnapRect;
817cdf0e10cSrcweir 	Rectangle aLogicRect;
818cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
819cdf0e10cSrcweir 	for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++) {
820cdf0e10cSrcweir 		const SdrMark* pM=GetSdrMarkByIndex(nm);
821cdf0e10cSrcweir 		const SdrObject* pObj=pM->GetMarkedSdrObj();
822cdf0e10cSrcweir 		if (nm==0) {
823cdf0e10cSrcweir 			nLayerId=pObj->GetLayer();
824cdf0e10cSrcweir 			bMovProtect=pObj->IsMoveProtect();
825cdf0e10cSrcweir 			bSizProtect=pObj->IsResizeProtect();
826cdf0e10cSrcweir 			bPrintable =pObj->IsPrintable();
827cdf0e10cSrcweir 			bVisible = pObj->IsVisible();
828cdf0e10cSrcweir 			Rectangle aSnapRect2(pObj->GetSnapRect());
829cdf0e10cSrcweir 			Rectangle aLogicRect2(pObj->GetLogicRect());
830cdf0e10cSrcweir 			nSnapPosX=aSnapRect2.Left();
831cdf0e10cSrcweir 			nSnapPosY=aSnapRect2.Top();
832cdf0e10cSrcweir 			nSnapWdt=aSnapRect2.GetWidth()-1;
833cdf0e10cSrcweir 			nSnapHgt=aSnapRect2.GetHeight()-1;
834cdf0e10cSrcweir 			nLogicWdt=aLogicRect2.GetWidth()-1;
835cdf0e10cSrcweir 			nLogicHgt=aLogicRect2.GetHeight()-1;
836cdf0e10cSrcweir 			bLogicWdtDiff=nLogicWdt!=nSnapWdt;
837cdf0e10cSrcweir 			bLogicHgtDiff=nLogicHgt!=nSnapHgt;
838cdf0e10cSrcweir 			nRotAngle=pObj->GetRotateAngle();
839cdf0e10cSrcweir 			nShrAngle=pObj->GetShearAngle();
840cdf0e10cSrcweir 		} else {
841cdf0e10cSrcweir 			if (!bLayerDC      && nLayerId   !=pObj->GetLayer())        bLayerDC=sal_True;
842cdf0e10cSrcweir 			if (!bMovProtectDC && bMovProtect!=pObj->IsMoveProtect())   bMovProtectDC=sal_True;
843cdf0e10cSrcweir 			if (!bSizProtectDC && bSizProtect!=pObj->IsResizeProtect()) bSizProtectDC=sal_True;
844cdf0e10cSrcweir 			if (!bPrintableDC  && bPrintable !=pObj->IsPrintable())     bPrintableDC=sal_True;
845cdf0e10cSrcweir 			if (!bVisibleDC	   && bVisible !=pObj->IsVisible())         bVisibleDC=sal_True;
846cdf0e10cSrcweir 			if (!bRotAngleDC   && nRotAngle  !=pObj->GetRotateAngle())  bRotAngleDC=sal_True;
847cdf0e10cSrcweir 			if (!bShrAngleDC   && nShrAngle  !=pObj->GetShearAngle())   bShrAngleDC=sal_True;
848cdf0e10cSrcweir 			if (!bSnapWdtDC || !bSnapHgtDC || !bSnapPosXDC || !bSnapPosYDC || !bLogicWdtDiff || !bLogicHgtDiff) {
849cdf0e10cSrcweir 				aSnapRect=pObj->GetSnapRect();
850cdf0e10cSrcweir 				if (nSnapPosX!=aSnapRect.Left()) bSnapPosXDC=sal_True;
851cdf0e10cSrcweir 				if (nSnapPosY!=aSnapRect.Top()) bSnapPosYDC=sal_True;
852cdf0e10cSrcweir 				if (nSnapWdt!=aSnapRect.GetWidth()-1) bSnapWdtDC=sal_True;
853cdf0e10cSrcweir 				if (nSnapHgt!=aSnapRect.GetHeight()-1) bSnapHgtDC=sal_True;
854cdf0e10cSrcweir 			}
855cdf0e10cSrcweir 			if (!bLogicWdtDC || !bLogicHgtDC || !bLogicWdtDiff || !bLogicHgtDiff) {
856cdf0e10cSrcweir 				aLogicRect=pObj->GetLogicRect();
857cdf0e10cSrcweir 				if (nLogicWdt!=aLogicRect.GetWidth()-1) bLogicWdtDC=sal_True;
858cdf0e10cSrcweir 				if (nLogicHgt!=aLogicRect.GetHeight()-1) bLogicHgtDC=sal_True;
859cdf0e10cSrcweir 				if (!bLogicWdtDiff && aSnapRect.GetWidth()!=aLogicRect.GetWidth()) bLogicWdtDiff=sal_True;
860cdf0e10cSrcweir 				if (!bLogicHgtDiff && aSnapRect.GetHeight()!=aLogicRect.GetHeight()) bLogicHgtDiff=sal_True;
861cdf0e10cSrcweir 			}
862cdf0e10cSrcweir 		}
863cdf0e10cSrcweir 		if (!bObjNameDC ) {
864cdf0e10cSrcweir 			if (!bObjNameSet) {
865cdf0e10cSrcweir 				aObjName=pObj->GetName();
866cdf0e10cSrcweir 			} else {
867cdf0e10cSrcweir 				if (aObjName!=pObj->GetName()) bObjNameDC=sal_True;
868cdf0e10cSrcweir 			}
869cdf0e10cSrcweir 		}
870cdf0e10cSrcweir 	}
871cdf0e10cSrcweir 
872cdf0e10cSrcweir 	if (bSnapPosXDC || nAllSnapPosX!=nSnapPosX) rAttr.Put(SdrAllPositionXItem(nAllSnapPosX));
873cdf0e10cSrcweir 	if (bSnapPosYDC || nAllSnapPosY!=nSnapPosY) rAttr.Put(SdrAllPositionYItem(nAllSnapPosY));
874cdf0e10cSrcweir 	if (bSnapWdtDC  || nAllSnapWdt !=nSnapWdt ) rAttr.Put(SdrAllSizeWidthItem(nAllSnapWdt));
875cdf0e10cSrcweir 	if (bSnapHgtDC  || nAllSnapHgt !=nSnapHgt ) rAttr.Put(SdrAllSizeHeightItem(nAllSnapHgt));
876cdf0e10cSrcweir 
877cdf0e10cSrcweir 	// Items fuer reine Transformationen
878cdf0e10cSrcweir 	rAttr.Put(SdrMoveXItem());
879cdf0e10cSrcweir 	rAttr.Put(SdrMoveYItem());
880cdf0e10cSrcweir 	rAttr.Put(SdrResizeXOneItem());
881cdf0e10cSrcweir 	rAttr.Put(SdrResizeYOneItem());
882cdf0e10cSrcweir 	rAttr.Put(SdrRotateOneItem());
883cdf0e10cSrcweir 	rAttr.Put(SdrHorzShearOneItem());
884cdf0e10cSrcweir 	rAttr.Put(SdrVertShearOneItem());
885cdf0e10cSrcweir 
886cdf0e10cSrcweir 	if (nMarkAnz>1) {
887cdf0e10cSrcweir 		rAttr.Put(SdrResizeXAllItem());
888cdf0e10cSrcweir 		rAttr.Put(SdrResizeYAllItem());
889cdf0e10cSrcweir 		rAttr.Put(SdrRotateAllItem());
890cdf0e10cSrcweir 		rAttr.Put(SdrHorzShearAllItem());
891cdf0e10cSrcweir 		rAttr.Put(SdrVertShearAllItem());
892cdf0e10cSrcweir 	}
893cdf0e10cSrcweir 
894cdf0e10cSrcweir 	if(eDragMode == SDRDRAG_ROTATE || eDragMode == SDRDRAG_MIRROR)
895cdf0e10cSrcweir 	{
896cdf0e10cSrcweir 		rAttr.Put(SdrTransformRef1XItem(GetRef1().X()));
897cdf0e10cSrcweir 		rAttr.Put(SdrTransformRef1YItem(GetRef1().Y()));
898cdf0e10cSrcweir 	}
899cdf0e10cSrcweir 
900cdf0e10cSrcweir 	if(eDragMode == SDRDRAG_MIRROR)
901cdf0e10cSrcweir 	{
902cdf0e10cSrcweir 		rAttr.Put(SdrTransformRef2XItem(GetRef2().X()));
903cdf0e10cSrcweir 		rAttr.Put(SdrTransformRef2YItem(GetRef2().Y()));
904cdf0e10cSrcweir 	}
905cdf0e10cSrcweir }
906cdf0e10cSrcweir 
907cdf0e10cSrcweir SfxItemSet SdrEditView::GetAttrFromMarked(sal_Bool bOnlyHardAttr) const
908cdf0e10cSrcweir {
909cdf0e10cSrcweir 	SfxItemSet aSet(pMod->GetItemPool());
910cdf0e10cSrcweir 	MergeAttrFromMarked(aSet,bOnlyHardAttr);
911cdf0e10cSrcweir     //the EE_FEATURE items should not be set with SetAttrToMarked (see error message there)
912cdf0e10cSrcweir     //so we do not set them here
913cdf0e10cSrcweir 	// #i32448#
914cdf0e10cSrcweir 	// Do not disable, but clear the items.
915cdf0e10cSrcweir     aSet.ClearItem(EE_FEATURE_TAB);
916cdf0e10cSrcweir     aSet.ClearItem(EE_FEATURE_LINEBR);
917cdf0e10cSrcweir     aSet.ClearItem(EE_FEATURE_NOTCONV);
918cdf0e10cSrcweir     aSet.ClearItem(EE_FEATURE_FIELD);
919cdf0e10cSrcweir 	return aSet;
920cdf0e10cSrcweir }
921cdf0e10cSrcweir 
922cdf0e10cSrcweir void SdrEditView::MergeAttrFromMarked(SfxItemSet& rAttr, sal_Bool bOnlyHardAttr) const
923cdf0e10cSrcweir {
924cdf0e10cSrcweir 	sal_uInt32 nMarkAnz(GetMarkedObjectCount());
925cdf0e10cSrcweir 
926cdf0e10cSrcweir 	for(sal_uInt32 a(0); a < nMarkAnz; a++)
927cdf0e10cSrcweir 	{
928cdf0e10cSrcweir 		// #80277# merging was done wrong in the prev version
929cdf0e10cSrcweir 		//const SfxItemSet& rSet = GetMarkedObjectByIndex()->GetItemSet();
930cdf0e10cSrcweir 		const SfxItemSet& rSet = GetMarkedObjectByIndex(a)->GetMergedItemSet();
931cdf0e10cSrcweir 		SfxWhichIter aIter(rSet);
932cdf0e10cSrcweir 		sal_uInt16 nWhich(aIter.FirstWhich());
933cdf0e10cSrcweir 
934cdf0e10cSrcweir 		while(nWhich)
935cdf0e10cSrcweir 		{
936cdf0e10cSrcweir 			if(!bOnlyHardAttr)
937cdf0e10cSrcweir 			{
938cdf0e10cSrcweir 				if(SFX_ITEM_DONTCARE == rSet.GetItemState(nWhich, sal_False))
939cdf0e10cSrcweir 					rAttr.InvalidateItem(nWhich);
940cdf0e10cSrcweir 				else
941cdf0e10cSrcweir 					rAttr.MergeValue(rSet.Get(nWhich), sal_True);
942cdf0e10cSrcweir 			}
943cdf0e10cSrcweir 			else if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False))
944cdf0e10cSrcweir 			{
945cdf0e10cSrcweir 				const SfxPoolItem& rItem = rSet.Get(nWhich);
946cdf0e10cSrcweir 				rAttr.MergeValue(rItem, sal_True);
947cdf0e10cSrcweir 			}
948cdf0e10cSrcweir 
949cdf0e10cSrcweir 			nWhich = aIter.NextWhich();
950cdf0e10cSrcweir 		}
951cdf0e10cSrcweir 	}
952cdf0e10cSrcweir }
953cdf0e10cSrcweir 
954cdf0e10cSrcweir void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, sal_Bool bReplaceAll)
955cdf0e10cSrcweir {
956cdf0e10cSrcweir 	if (AreObjectsMarked())
957cdf0e10cSrcweir 	{
958cdf0e10cSrcweir #ifdef DBG_UTIL
959cdf0e10cSrcweir 		{
960cdf0e10cSrcweir 			sal_Bool bHasEEFeatureItems=sal_False;
961cdf0e10cSrcweir 			SfxItemIter aIter(rAttr);
962cdf0e10cSrcweir 			const SfxPoolItem* pItem=aIter.FirstItem();
963cdf0e10cSrcweir 			while (!bHasEEFeatureItems && pItem!=NULL) {
964cdf0e10cSrcweir 				if (!IsInvalidItem(pItem)) {
965cdf0e10cSrcweir 					sal_uInt16 nW=pItem->Which();
966cdf0e10cSrcweir 					if (nW>=EE_FEATURE_START && nW<=EE_FEATURE_END) bHasEEFeatureItems=sal_True;
967cdf0e10cSrcweir 				}
968cdf0e10cSrcweir 				pItem=aIter.NextItem();
969cdf0e10cSrcweir 			}
970cdf0e10cSrcweir 			if(bHasEEFeatureItems)
971cdf0e10cSrcweir 			{
972cdf0e10cSrcweir 				String aMessage;
973cdf0e10cSrcweir 				aMessage.AppendAscii("SdrEditView::SetAttrToMarked(): Das setzen von EE_FEATURE-Items an der SdrView macht keinen Sinn! Es fuehrt nur zu Overhead und nicht mehr lesbaren Dokumenten.");
974cdf0e10cSrcweir 				InfoBox(NULL, aMessage).Execute();
975cdf0e10cSrcweir 			}
976cdf0e10cSrcweir 		}
977cdf0e10cSrcweir #endif
978cdf0e10cSrcweir 
979cdf0e10cSrcweir 		// #103836# if the user thets character attributes to the complete shape,
980cdf0e10cSrcweir 		//			we want to remove all hard set character attributes with same
981cdf0e10cSrcweir 		//			which ids from the text. We do that later but here we remember
982cdf0e10cSrcweir 		//			all character attribute which id's that are set.
983cdf0e10cSrcweir 		std::vector<sal_uInt16> aCharWhichIds;
984cdf0e10cSrcweir 		{
985cdf0e10cSrcweir 			SfxItemIter aIter(rAttr);
986cdf0e10cSrcweir 			const SfxPoolItem* pItem=aIter.FirstItem();
987cdf0e10cSrcweir 			while( pItem!=NULL )
988cdf0e10cSrcweir 			{
989cdf0e10cSrcweir 				if (!IsInvalidItem(pItem))
990cdf0e10cSrcweir 				{
991cdf0e10cSrcweir 					sal_uInt16 nWhich = pItem->Which();
992cdf0e10cSrcweir 					if (nWhich>=EE_CHAR_START && nWhich<=EE_CHAR_END)
993cdf0e10cSrcweir 						aCharWhichIds.push_back( nWhich );
994cdf0e10cSrcweir 				}
995cdf0e10cSrcweir 				pItem=aIter.NextItem();
996cdf0e10cSrcweir 			}
997cdf0e10cSrcweir 		}
998cdf0e10cSrcweir 
999cdf0e10cSrcweir 		// Joe, 2.7.98: Damit Undo nach Format.Standard auch die Textattribute korrekt restauriert
1000cdf0e10cSrcweir 		sal_Bool bHasEEItems=SearchOutlinerItems(rAttr,bReplaceAll);
1001cdf0e10cSrcweir 
1002cdf0e10cSrcweir 		// AW 030100: save additional geom info when para or char attributes
1003cdf0e10cSrcweir 		// are changed and the geom form of the text object might be changed
1004cdf0e10cSrcweir 		sal_Bool bPossibleGeomChange(sal_False);
1005cdf0e10cSrcweir 		SfxWhichIter aIter(rAttr);
1006cdf0e10cSrcweir 		sal_uInt16 nWhich = aIter.FirstWhich();
1007cdf0e10cSrcweir 		while(!bPossibleGeomChange && nWhich)
1008cdf0e10cSrcweir 		{
1009cdf0e10cSrcweir 			SfxItemState eState = rAttr.GetItemState(nWhich);
1010cdf0e10cSrcweir 			if(eState == SFX_ITEM_SET)
1011cdf0e10cSrcweir 			{
1012cdf0e10cSrcweir 				if((nWhich >= SDRATTR_TEXT_MINFRAMEHEIGHT && nWhich <= SDRATTR_TEXT_CONTOURFRAME)
1013cdf0e10cSrcweir 					|| nWhich == SDRATTR_3DOBJ_PERCENT_DIAGONAL
1014cdf0e10cSrcweir 					|| nWhich == SDRATTR_3DOBJ_BACKSCALE
1015cdf0e10cSrcweir 					|| nWhich == SDRATTR_3DOBJ_DEPTH
1016cdf0e10cSrcweir 					|| nWhich == SDRATTR_3DOBJ_END_ANGLE
1017cdf0e10cSrcweir 					|| nWhich == SDRATTR_3DSCENE_DISTANCE)
1018cdf0e10cSrcweir 				{
1019cdf0e10cSrcweir 					bPossibleGeomChange = sal_True;
1020cdf0e10cSrcweir 				}
1021cdf0e10cSrcweir 			}
1022cdf0e10cSrcweir 			nWhich = aIter.NextWhich();
1023cdf0e10cSrcweir 		}
1024cdf0e10cSrcweir 
1025cdf0e10cSrcweir 		const bool bUndo = IsUndoEnabled();
1026cdf0e10cSrcweir 		if( bUndo )
1027cdf0e10cSrcweir 		{
1028cdf0e10cSrcweir 			XubString aStr;
1029cdf0e10cSrcweir 			ImpTakeDescriptionStr(STR_EditSetAttributes,aStr);
1030cdf0e10cSrcweir 			BegUndo(aStr);
1031cdf0e10cSrcweir 		}
1032cdf0e10cSrcweir 
1033cdf0e10cSrcweir 		const sal_uInt32 nMarkAnz(GetMarkedObjectCount());
1034cdf0e10cSrcweir         std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
1035cdf0e10cSrcweir 
1036cdf0e10cSrcweir 		// create ItemSet without SFX_ITEM_DONTCARE. Put()
1037cdf0e10cSrcweir 		// uses it's second parameter (bInvalidAsDefault) to
1038cdf0e10cSrcweir 		// remove all such items to set them to default.
1039cdf0e10cSrcweir 		SfxItemSet aAttr(*rAttr.GetPool(), rAttr.GetRanges());
1040cdf0e10cSrcweir 		aAttr.Put(rAttr, sal_True);
1041cdf0e10cSrcweir 
1042cdf0e10cSrcweir 		// #i38135#
1043cdf0e10cSrcweir 		bool bResetAnimationTimer(false);
1044cdf0e10cSrcweir 
1045cdf0e10cSrcweir 		for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
1046cdf0e10cSrcweir 		{
1047cdf0e10cSrcweir 			SdrMark* pM=GetSdrMarkByIndex(nm);
1048cdf0e10cSrcweir 			SdrObject* pObj = pM->GetMarkedSdrObj();
1049cdf0e10cSrcweir 
1050cdf0e10cSrcweir 			if( bUndo )
1051cdf0e10cSrcweir 			{
1052cdf0e10cSrcweir 				std::vector< SdrUndoAction* > vConnectorUndoActions;
1053cdf0e10cSrcweir 				SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >( pObj );
1054cdf0e10cSrcweir 				if ( pEdgeObj )
1055cdf0e10cSrcweir 					bPossibleGeomChange = sal_True;
1056cdf0e10cSrcweir 				else if( bUndo )
1057cdf0e10cSrcweir 					vConnectorUndoActions = CreateConnectorUndo( *pObj );
1058cdf0e10cSrcweir 
1059cdf0e10cSrcweir 				AddUndoActions( vConnectorUndoActions );
1060cdf0e10cSrcweir 			}
1061cdf0e10cSrcweir 
1062cdf0e10cSrcweir 			// new geometry undo
1063cdf0e10cSrcweir 			if(bPossibleGeomChange && bUndo)
1064cdf0e10cSrcweir 			{
1065cdf0e10cSrcweir 				// save position and size of obect, too
1066cdf0e10cSrcweir 				AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
1067cdf0e10cSrcweir 			}
1068cdf0e10cSrcweir 
1069cdf0e10cSrcweir 			if( bUndo )
1070cdf0e10cSrcweir 			{
1071cdf0e10cSrcweir 				// #i8508#
1072cdf0e10cSrcweir 				// If this is a text object also rescue the OutlinerParaObject since
1073cdf0e10cSrcweir 				// applying attributes to the object may change text layout when
1074cdf0e10cSrcweir 				// multiple portions exist with multiple formats. If a OutlinerParaObject
1075cdf0e10cSrcweir 				// really exists and needs to be rescued is evaluated in the undo
1076cdf0e10cSrcweir 				// implementation itself.
1077cdf0e10cSrcweir 				const bool bRescueText = dynamic_cast< SdrTextObj* >(pObj) != 0;
1078cdf0e10cSrcweir 
1079cdf0e10cSrcweir 				// add attribute undo
1080cdf0e10cSrcweir 				AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj,sal_False,bHasEEItems || bPossibleGeomChange || bRescueText));
1081cdf0e10cSrcweir 			}
1082cdf0e10cSrcweir 
1083cdf0e10cSrcweir             // set up a scxene updater if object is a 3d object
1084cdf0e10cSrcweir             if(dynamic_cast< E3dObject* >(pObj))
1085cdf0e10cSrcweir             {
1086cdf0e10cSrcweir                 aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pObj));
1087cdf0e10cSrcweir             }
1088cdf0e10cSrcweir 
1089cdf0e10cSrcweir             // set attributes at object
1090cdf0e10cSrcweir 			pObj->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
1091cdf0e10cSrcweir 
1092cdf0e10cSrcweir 			if(pObj->ISA(SdrTextObj))
1093cdf0e10cSrcweir 			{
1094cdf0e10cSrcweir 				SdrTextObj* pTextObj = ((SdrTextObj*)pObj);
1095cdf0e10cSrcweir 
1096cdf0e10cSrcweir 				if(!aCharWhichIds.empty())
1097cdf0e10cSrcweir 				{
1098cdf0e10cSrcweir 					Rectangle aOldBoundRect = pTextObj->GetLastBoundRect();
1099cdf0e10cSrcweir 
1100cdf0e10cSrcweir 					// #110094#-14 pTextObj->SendRepaintBroadcast(pTextObj->GetBoundRect());
1101cdf0e10cSrcweir 					pTextObj->RemoveOutlinerCharacterAttribs( aCharWhichIds );
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir 					// object has changed, should be called form
1104cdf0e10cSrcweir 					// RemoveOutlinerCharacterAttribs. This will change when the text
1105cdf0e10cSrcweir 					// object implementation changes.
1106cdf0e10cSrcweir 					pTextObj->SetChanged();
1107cdf0e10cSrcweir 
1108cdf0e10cSrcweir 					pTextObj->BroadcastObjectChange();
1109cdf0e10cSrcweir 					pTextObj->SendUserCall(SDRUSERCALL_CHGATTR, aOldBoundRect);
1110cdf0e10cSrcweir 				}
1111cdf0e10cSrcweir 			}
1112cdf0e10cSrcweir 
1113cdf0e10cSrcweir 			// #i38495#
1114cdf0e10cSrcweir 			if(!bResetAnimationTimer)
1115cdf0e10cSrcweir 			{
1116cdf0e10cSrcweir     			if(pObj->GetViewContact().isAnimatedInAnyViewObjectContact())
1117cdf0e10cSrcweir 				{
1118cdf0e10cSrcweir 					bResetAnimationTimer = true;
1119cdf0e10cSrcweir 				}
1120cdf0e10cSrcweir 			}
1121cdf0e10cSrcweir 		}
1122cdf0e10cSrcweir 
1123cdf0e10cSrcweir         // fire scene updaters
1124cdf0e10cSrcweir         while(!aUpdaters.empty())
1125cdf0e10cSrcweir         {
1126cdf0e10cSrcweir             delete aUpdaters.back();
1127cdf0e10cSrcweir             aUpdaters.pop_back();
1128cdf0e10cSrcweir         }
1129cdf0e10cSrcweir 
1130cdf0e10cSrcweir         // #i38135#
1131cdf0e10cSrcweir 		if(bResetAnimationTimer)
1132cdf0e10cSrcweir 		{
1133cdf0e10cSrcweir 			SetAnimationTimer(0L);
1134cdf0e10cSrcweir 		}
1135cdf0e10cSrcweir 
1136cdf0e10cSrcweir 		// besser vorher checken, was gemacht werden soll:
1137cdf0e10cSrcweir 		// pObj->SetAttr() oder SetNotPersistAttr()
1138cdf0e10cSrcweir 		// !!! fehlende Implementation !!!
1139cdf0e10cSrcweir 		SetNotPersistAttrToMarked(rAttr,bReplaceAll);
1140cdf0e10cSrcweir 
1141cdf0e10cSrcweir 		if( bUndo )
1142cdf0e10cSrcweir 			EndUndo();
1143cdf0e10cSrcweir 	}
1144cdf0e10cSrcweir }
1145cdf0e10cSrcweir 
1146cdf0e10cSrcweir SfxStyleSheet* SdrEditView::GetStyleSheetFromMarked() const
1147cdf0e10cSrcweir {
1148cdf0e10cSrcweir 	SfxStyleSheet* pRet=NULL;
1149cdf0e10cSrcweir 	sal_Bool b1st=sal_True;
1150cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
1151cdf0e10cSrcweir 	for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++) {
1152cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nm);
1153cdf0e10cSrcweir 		SfxStyleSheet* pSS=pM->GetMarkedSdrObj()->GetStyleSheet();
1154cdf0e10cSrcweir 		if (b1st) pRet=pSS;
1155cdf0e10cSrcweir 		else if (pRet!=pSS) return NULL; // verschiedene StyleSheets
1156cdf0e10cSrcweir 		b1st=sal_False;
1157cdf0e10cSrcweir 	}
1158cdf0e10cSrcweir 	return pRet;
1159cdf0e10cSrcweir }
1160cdf0e10cSrcweir 
1161cdf0e10cSrcweir void SdrEditView::SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
1162cdf0e10cSrcweir {
1163cdf0e10cSrcweir 	if (AreObjectsMarked())
1164cdf0e10cSrcweir 	{
1165cdf0e10cSrcweir 		const bool bUndo = IsUndoEnabled();
1166cdf0e10cSrcweir 
1167cdf0e10cSrcweir 		if( bUndo )
1168cdf0e10cSrcweir 		{
1169cdf0e10cSrcweir 			XubString aStr;
1170cdf0e10cSrcweir 			if (pStyleSheet!=NULL)
1171cdf0e10cSrcweir 				ImpTakeDescriptionStr(STR_EditSetStylesheet,aStr);
1172cdf0e10cSrcweir 			else
1173cdf0e10cSrcweir 				ImpTakeDescriptionStr(STR_EditDelStylesheet,aStr);
1174cdf0e10cSrcweir 			BegUndo(aStr);
1175cdf0e10cSrcweir 		}
1176cdf0e10cSrcweir 
1177cdf0e10cSrcweir 		sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
1178cdf0e10cSrcweir 		for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
1179cdf0e10cSrcweir 		{
1180cdf0e10cSrcweir 			SdrMark* pM=GetSdrMarkByIndex(nm);
1181cdf0e10cSrcweir 			if( bUndo )
1182cdf0e10cSrcweir 			{
1183cdf0e10cSrcweir 	            AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pM->GetMarkedSdrObj()));
1184cdf0e10cSrcweir 				AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pM->GetMarkedSdrObj(),true,true));
1185cdf0e10cSrcweir 			}
1186cdf0e10cSrcweir 			pM->GetMarkedSdrObj()->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
1187cdf0e10cSrcweir 		}
1188cdf0e10cSrcweir 
1189cdf0e10cSrcweir 		if( bUndo )
1190cdf0e10cSrcweir 			EndUndo();
1191cdf0e10cSrcweir 	}
1192cdf0e10cSrcweir }
1193cdf0e10cSrcweir 
1194cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1195cdf0e10cSrcweir 
1196cdf0e10cSrcweir /* new interface src537 */
1197cdf0e10cSrcweir sal_Bool SdrEditView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const
1198cdf0e10cSrcweir {
1199cdf0e10cSrcweir 	if(GetMarkedObjectCount())
1200cdf0e10cSrcweir 	{
1201cdf0e10cSrcweir 		rTargetSet.Put(GetAttrFromMarked(bOnlyHardAttr), sal_False);
1202cdf0e10cSrcweir 		return sal_True;
1203cdf0e10cSrcweir 	}
1204cdf0e10cSrcweir 	else
1205cdf0e10cSrcweir 	{
1206cdf0e10cSrcweir 		return SdrMarkView::GetAttributes(rTargetSet, bOnlyHardAttr);
1207cdf0e10cSrcweir 	}
1208cdf0e10cSrcweir }
1209cdf0e10cSrcweir 
1210cdf0e10cSrcweir sal_Bool SdrEditView::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
1211cdf0e10cSrcweir {
1212cdf0e10cSrcweir 	if (GetMarkedObjectCount()!=0) {
1213cdf0e10cSrcweir 		SetAttrToMarked(rSet,bReplaceAll);
1214cdf0e10cSrcweir 		return sal_True;
1215cdf0e10cSrcweir 	} else {
1216cdf0e10cSrcweir 		return SdrMarkView::SetAttributes(rSet,bReplaceAll);
1217cdf0e10cSrcweir 	}
1218cdf0e10cSrcweir }
1219cdf0e10cSrcweir 
1220cdf0e10cSrcweir SfxStyleSheet* SdrEditView::GetStyleSheet() const // SfxStyleSheet* SdrEditView::GetStyleSheet(sal_Bool& rOk) const
1221cdf0e10cSrcweir {
1222cdf0e10cSrcweir 	if (GetMarkedObjectCount()!=0) {
1223cdf0e10cSrcweir 		//rOk=sal_True;
1224cdf0e10cSrcweir 		return GetStyleSheetFromMarked();
1225cdf0e10cSrcweir 	} else {
1226cdf0e10cSrcweir 		return SdrMarkView::GetStyleSheet(); // SdrMarkView::GetStyleSheet(rOk);
1227cdf0e10cSrcweir 	}
1228cdf0e10cSrcweir }
1229cdf0e10cSrcweir 
1230cdf0e10cSrcweir sal_Bool SdrEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
1231cdf0e10cSrcweir {
1232cdf0e10cSrcweir 	if (GetMarkedObjectCount()!=0) {
1233cdf0e10cSrcweir 		SetStyleSheetToMarked(pStyleSheet,bDontRemoveHardAttr);
1234cdf0e10cSrcweir 		return sal_True;
1235cdf0e10cSrcweir 	} else {
1236cdf0e10cSrcweir 		return SdrMarkView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
1237cdf0e10cSrcweir 	}
1238cdf0e10cSrcweir }
1239cdf0e10cSrcweir 
1240cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1241cdf0e10cSrcweir 
1242cdf0e10cSrcweir SfxItemSet SdrEditView::GetGeoAttrFromMarked() const
1243cdf0e10cSrcweir {
1244cdf0e10cSrcweir 	SfxItemSet aRetSet(pMod->GetItemPool(),   // SID_ATTR_TRANSFORM_... aus s:svxids.hrc
1245d5370dc8SArmin Le Grand         SID_ATTR_TRANSFORM_POS_X,               SID_ATTR_TRANSFORM_ANGLE,
1246d5370dc8SArmin Le Grand         SID_ATTR_TRANSFORM_PROTECT_POS,         SID_ATTR_TRANSFORM_AUTOHEIGHT,
1247d5370dc8SArmin Le Grand         SDRATTR_ECKENRADIUS,                    SDRATTR_ECKENRADIUS,
1248d5370dc8SArmin Le Grand         0);
1249d5370dc8SArmin Le Grand 
1250d5370dc8SArmin Le Grand     if (AreObjectsMarked())
1251d5370dc8SArmin Le Grand     {
1252cdf0e10cSrcweir 		SfxItemSet aMarkAttr(GetAttrFromMarked(sal_False)); // wg. AutoGrowHeight und Eckenradius
1253cdf0e10cSrcweir 		Rectangle aRect(GetMarkedObjRect());
1254d5370dc8SArmin Le Grand 
1255d5370dc8SArmin Le Grand         if(GetSdrPageView())
1256cdf0e10cSrcweir 		{
1257cdf0e10cSrcweir 			GetSdrPageView()->LogicToPagePos(aRect);
1258cdf0e10cSrcweir 		}
1259cdf0e10cSrcweir 
1260cdf0e10cSrcweir 		// Position
1261cdf0e10cSrcweir 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_POS_X,aRect.Left()));
1262cdf0e10cSrcweir 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_POS_Y,aRect.Top()));
1263cdf0e10cSrcweir 
1264cdf0e10cSrcweir 		// Groesse
1265cdf0e10cSrcweir 		long nResizeRefX=aRect.Left();
1266cdf0e10cSrcweir 		long nResizeRefY=aRect.Top();
1267cdf0e10cSrcweir 		if (eDragMode==SDRDRAG_ROTATE) { // Drehachse auch als Referenz fuer Resize
1268cdf0e10cSrcweir 			nResizeRefX=aRef1.X();
1269cdf0e10cSrcweir 			nResizeRefY=aRef1.Y();
1270cdf0e10cSrcweir 		}
1271cdf0e10cSrcweir 		aRetSet.Put(SfxUInt32Item(SID_ATTR_TRANSFORM_WIDTH,aRect.Right()-aRect.Left()));
1272cdf0e10cSrcweir 		aRetSet.Put(SfxUInt32Item(SID_ATTR_TRANSFORM_HEIGHT,aRect.Bottom()-aRect.Top()));
1273cdf0e10cSrcweir 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_RESIZE_REF_X,nResizeRefX));
1274cdf0e10cSrcweir 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_RESIZE_REF_Y,nResizeRefY));
1275cdf0e10cSrcweir 
1276cdf0e10cSrcweir 		Point aRotateAxe(aRef1);
1277cdf0e10cSrcweir 
1278cdf0e10cSrcweir 		if(GetSdrPageView())
1279cdf0e10cSrcweir 		{
1280cdf0e10cSrcweir 			GetSdrPageView()->LogicToPagePos(aRotateAxe);
1281cdf0e10cSrcweir 		}
1282cdf0e10cSrcweir 
1283cdf0e10cSrcweir 		// Drehung
1284cdf0e10cSrcweir 		long nRotateRefX=aRect.Center().X();
1285cdf0e10cSrcweir 		long nRotateRefY=aRect.Center().Y();
1286cdf0e10cSrcweir 		if (eDragMode==SDRDRAG_ROTATE) {
1287cdf0e10cSrcweir 			nRotateRefX=aRotateAxe.X();
1288cdf0e10cSrcweir 			nRotateRefY=aRotateAxe.Y();
1289cdf0e10cSrcweir 		}
1290cdf0e10cSrcweir 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_ANGLE,GetMarkedObjRotate()));
1291cdf0e10cSrcweir 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_ROT_X,nRotateRefX));
1292cdf0e10cSrcweir 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_ROT_Y,nRotateRefY));
1293cdf0e10cSrcweir 
1294cdf0e10cSrcweir 		// Shear
1295cdf0e10cSrcweir 		long nShearRefX=aRect.Left();
1296cdf0e10cSrcweir 		long nShearRefY=aRect.Bottom();
1297cdf0e10cSrcweir 		if (eDragMode==SDRDRAG_ROTATE) { // Drehachse auch als Referenz fuer Shear
1298cdf0e10cSrcweir 			nShearRefX=aRotateAxe.X();
1299cdf0e10cSrcweir 			nShearRefY=aRotateAxe.Y();
1300cdf0e10cSrcweir 		}
1301cdf0e10cSrcweir 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR,GetMarkedObjShear()));
1302cdf0e10cSrcweir 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_X,nShearRefX));
1303cdf0e10cSrcweir 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_Y,nShearRefY));
1304cdf0e10cSrcweir 
1305cdf0e10cSrcweir 		// Pruefen der einzelnen Objekte, ob Objekte geschuetzt sind
1306cdf0e10cSrcweir 		const SdrMarkList& rMarkList=GetMarkedObjectList();
1307cdf0e10cSrcweir 		sal_uIntPtr nMarkCount=rMarkList.GetMarkCount();
1308cdf0e10cSrcweir 		SdrObject* pObj=rMarkList.GetMark(0)->GetMarkedSdrObj();
1309cdf0e10cSrcweir 		sal_Bool bPosProt=pObj->IsMoveProtect();
1310cdf0e10cSrcweir 		sal_Bool bSizProt=pObj->IsResizeProtect();
1311cdf0e10cSrcweir 		sal_Bool bPosProtDontCare=sal_False;
1312cdf0e10cSrcweir 		sal_Bool bSizProtDontCare=sal_False;
1313*ee093554SAndre Fischer 		for (sal_uIntPtr i=1; i<nMarkCount && (!bPosProtDontCare || !bSizProtDontCare); i++)
1314d5370dc8SArmin Le Grand         {
1315cdf0e10cSrcweir 			pObj=rMarkList.GetMark(i)->GetMarkedSdrObj();
1316*ee093554SAndre Fischer 			if (bPosProt!=pObj->IsMoveProtect()) bPosProtDontCare=sal_True;
1317*ee093554SAndre Fischer 			if (bSizProt!=pObj->IsResizeProtect()) bSizProtDontCare=sal_True;
1318d5370dc8SArmin Le Grand         }
1319*ee093554SAndre Fischer 
1320cdf0e10cSrcweir 		// InvalidateItem setzt das Item auf DONT_CARE
1321cdf0e10cSrcweir 		if (bPosProtDontCare) {
1322cdf0e10cSrcweir 			aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_PROTECT_POS);
1323cdf0e10cSrcweir 		} else {
1324cdf0e10cSrcweir 			aRetSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_PROTECT_POS,bPosProt));
1325cdf0e10cSrcweir 		}
1326cdf0e10cSrcweir 		if (bSizProtDontCare) {
1327cdf0e10cSrcweir 			aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_PROTECT_SIZE);
1328cdf0e10cSrcweir 		} else {
1329cdf0e10cSrcweir 			aRetSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_PROTECT_SIZE,bSizProt));
1330cdf0e10cSrcweir 		}
1331cdf0e10cSrcweir 
1332cdf0e10cSrcweir 		SfxItemState eState=aMarkAttr.GetItemState(SDRATTR_TEXT_AUTOGROWWIDTH);
1333cdf0e10cSrcweir 		sal_Bool bAutoGrow=((SdrTextAutoGrowWidthItem&)(aMarkAttr.Get(SDRATTR_TEXT_AUTOGROWWIDTH))).GetValue();
1334cdf0e10cSrcweir 		if (eState==SFX_ITEM_DONTCARE) {
1335cdf0e10cSrcweir 			aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_AUTOWIDTH);
1336cdf0e10cSrcweir 		} else if (eState==SFX_ITEM_SET) {
1337cdf0e10cSrcweir 			aRetSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_AUTOWIDTH,bAutoGrow));
1338cdf0e10cSrcweir 		}
1339cdf0e10cSrcweir 
1340cdf0e10cSrcweir 		eState=aMarkAttr.GetItemState(SDRATTR_TEXT_AUTOGROWHEIGHT);
1341cdf0e10cSrcweir 		bAutoGrow=((SdrTextAutoGrowHeightItem&)(aMarkAttr.Get(SDRATTR_TEXT_AUTOGROWHEIGHT))).GetValue();
1342cdf0e10cSrcweir 		if (eState==SFX_ITEM_DONTCARE) {
1343cdf0e10cSrcweir 			aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_AUTOHEIGHT);
1344cdf0e10cSrcweir 		} else if (eState==SFX_ITEM_SET) {
1345cdf0e10cSrcweir 			aRetSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_AUTOHEIGHT,bAutoGrow));
1346cdf0e10cSrcweir 		}
1347cdf0e10cSrcweir 
1348cdf0e10cSrcweir 		eState=aMarkAttr.GetItemState(SDRATTR_ECKENRADIUS);
1349cdf0e10cSrcweir 		long nRadius=((SdrEckenradiusItem&)(aMarkAttr.Get(SDRATTR_ECKENRADIUS))).GetValue();
1350cdf0e10cSrcweir 		if (eState==SFX_ITEM_DONTCARE) {
1351cdf0e10cSrcweir 			aRetSet.InvalidateItem(SDRATTR_ECKENRADIUS);
1352cdf0e10cSrcweir 		} else if (eState==SFX_ITEM_SET) {
1353cdf0e10cSrcweir 			aRetSet.Put(SdrEckenradiusItem(nRadius));
1354cdf0e10cSrcweir 		}
1355cdf0e10cSrcweir 
1356d5370dc8SArmin Le Grand         basegfx::B2DHomMatrix aTransformation;
1357d5370dc8SArmin Le Grand 
1358d5370dc8SArmin Le Grand         if(nMarkCount > 1)
1359d5370dc8SArmin Le Grand         {
1360d5370dc8SArmin Le Grand             // multiple objects, range is collected in aRect
1361d5370dc8SArmin Le Grand             aTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix(
1362d5370dc8SArmin Le Grand                 aRect.Left(), aRect.Top(),
1363d5370dc8SArmin Le Grand                 aRect.getWidth(), aRect.getHeight());
1364d5370dc8SArmin Le Grand         }
1365d5370dc8SArmin Le Grand         else if(pObj)
1366d5370dc8SArmin Le Grand         {
1367d5370dc8SArmin Le Grand             // single object, get homogen transformation
1368d5370dc8SArmin Le Grand             basegfx::B2DPolyPolygon aPolyPolygon;
1369d5370dc8SArmin Le Grand 
1370d5370dc8SArmin Le Grand             pObj->TRGetBaseGeometry(aTransformation, aPolyPolygon);
1371d5370dc8SArmin Le Grand         }
1372d5370dc8SArmin Le Grand 
1373d5370dc8SArmin Le Grand         if(aTransformation.isIdentity())
1374d5370dc8SArmin Le Grand         {
1375d5370dc8SArmin Le Grand             aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_MATRIX);
1376d5370dc8SArmin Le Grand         }
1377d5370dc8SArmin Le Grand         else
1378d5370dc8SArmin Le Grand         {
1379d5370dc8SArmin Le Grand             com::sun::star::geometry::AffineMatrix2D aAffineMatrix2D;
1380d5370dc8SArmin Le Grand             Point aPageOffset(0, 0);
1381d5370dc8SArmin Le Grand 
1382d5370dc8SArmin Le Grand             if(GetSdrPageView())
1383d5370dc8SArmin Le Grand             {
1384d5370dc8SArmin Le Grand                 aPageOffset = GetSdrPageView()->GetPageOrigin();
1385d5370dc8SArmin Le Grand             }
1386d5370dc8SArmin Le Grand 
1387d5370dc8SArmin Le Grand             aAffineMatrix2D.m00 = aTransformation.get(0, 0);
1388d5370dc8SArmin Le Grand             aAffineMatrix2D.m01 = aTransformation.get(0, 1);
1389d5370dc8SArmin Le Grand             aAffineMatrix2D.m02 = aTransformation.get(0, 2) - aPageOffset.X();
1390d5370dc8SArmin Le Grand             aAffineMatrix2D.m10 = aTransformation.get(1, 0);
1391d5370dc8SArmin Le Grand             aAffineMatrix2D.m11 = aTransformation.get(1, 1);
1392d5370dc8SArmin Le Grand             aAffineMatrix2D.m12 = aTransformation.get(1, 2) - aPageOffset.Y();
1393d5370dc8SArmin Le Grand 
1394d5370dc8SArmin Le Grand             aRetSet.Put(AffineMatrixItem(&aAffineMatrix2D));
1395d5370dc8SArmin Le Grand         }
1396cdf0e10cSrcweir 	}
1397d5370dc8SArmin Le Grand 
1398cdf0e10cSrcweir 	return aRetSet;
1399cdf0e10cSrcweir }
1400cdf0e10cSrcweir 
1401cdf0e10cSrcweir Point ImpGetPoint(Rectangle aRect, RECT_POINT eRP)
1402cdf0e10cSrcweir {
1403cdf0e10cSrcweir 	switch(eRP) {
1404cdf0e10cSrcweir 		case RP_LT: return aRect.TopLeft();
1405cdf0e10cSrcweir 		case RP_MT: return aRect.TopCenter();
1406cdf0e10cSrcweir 		case RP_RT: return aRect.TopRight();
1407cdf0e10cSrcweir 		case RP_LM: return aRect.LeftCenter();
1408cdf0e10cSrcweir 		case RP_MM: return aRect.Center();
1409cdf0e10cSrcweir 		case RP_RM: return aRect.RightCenter();
1410cdf0e10cSrcweir 		case RP_LB: return aRect.BottomLeft();
1411cdf0e10cSrcweir 		case RP_MB: return aRect.BottomCenter();
1412cdf0e10cSrcweir 		case RP_RB: return aRect.BottomRight();
1413cdf0e10cSrcweir 	}
1414cdf0e10cSrcweir 	return Point(); // Sollte nicht vorkommen !
1415cdf0e10cSrcweir }
1416cdf0e10cSrcweir 
1417cdf0e10cSrcweir void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
1418cdf0e10cSrcweir {
1419cdf0e10cSrcweir 	Rectangle aRect(GetMarkedObjRect());
1420cdf0e10cSrcweir 
1421cdf0e10cSrcweir 	if(GetSdrPageView())
1422cdf0e10cSrcweir 	{
1423cdf0e10cSrcweir 		GetSdrPageView()->LogicToPagePos(aRect);
1424cdf0e10cSrcweir 	}
1425cdf0e10cSrcweir 
1426cdf0e10cSrcweir 	long nOldRotateAngle=GetMarkedObjRotate();
1427cdf0e10cSrcweir 	long nOldShearAngle=GetMarkedObjShear();
1428cdf0e10cSrcweir 	const SdrMarkList& rMarkList=GetMarkedObjectList();
1429cdf0e10cSrcweir 	sal_uIntPtr nMarkCount=rMarkList.GetMarkCount();
1430cdf0e10cSrcweir 	SdrObject* pObj=NULL;
1431cdf0e10cSrcweir 
1432cdf0e10cSrcweir 	RECT_POINT eSizePoint=RP_MM;
1433cdf0e10cSrcweir 	long nPosDX=0;
1434cdf0e10cSrcweir 	long nPosDY=0;
1435cdf0e10cSrcweir 	long nSizX=0;
1436cdf0e10cSrcweir 	long nSizY=0;
1437cdf0e10cSrcweir 	long nRotateAngle=0;
1438cdf0e10cSrcweir 
1439cdf0e10cSrcweir 	// #86909#
1440cdf0e10cSrcweir 	sal_Bool bModeIsRotate(eDragMode == SDRDRAG_ROTATE);
1441cdf0e10cSrcweir 	long nRotateX(0);
1442cdf0e10cSrcweir 	long nRotateY(0);
1443cdf0e10cSrcweir 	long nOldRotateX(0);
1444cdf0e10cSrcweir 	long nOldRotateY(0);
1445cdf0e10cSrcweir 	if(bModeIsRotate)
1446cdf0e10cSrcweir 	{
1447cdf0e10cSrcweir 		Point aRotateAxe(aRef1);
1448cdf0e10cSrcweir 
1449cdf0e10cSrcweir 		if(GetSdrPageView())
1450cdf0e10cSrcweir 		{
1451cdf0e10cSrcweir 			GetSdrPageView()->LogicToPagePos(aRotateAxe);
1452cdf0e10cSrcweir 		}
1453cdf0e10cSrcweir 
1454cdf0e10cSrcweir 		nRotateX = nOldRotateX = aRotateAxe.X();
1455cdf0e10cSrcweir 		nRotateY = nOldRotateY = aRotateAxe.Y();
1456cdf0e10cSrcweir 	}
1457cdf0e10cSrcweir 
1458cdf0e10cSrcweir 	long nNewShearAngle=0;
1459cdf0e10cSrcweir 	long nShearAngle=0;
1460cdf0e10cSrcweir 	long nShearX=0;
1461cdf0e10cSrcweir 	long nShearY=0;
1462cdf0e10cSrcweir 	sal_Bool bShearVert=sal_False;
1463cdf0e10cSrcweir 
1464cdf0e10cSrcweir 	sal_Bool bChgPos=sal_False;
1465cdf0e10cSrcweir 	sal_Bool bChgSiz=sal_False;
1466*ee093554SAndre Fischer 	sal_Bool bChgWdh=sal_False;
1467cdf0e10cSrcweir 	sal_Bool bChgHgt=sal_False;
1468cdf0e10cSrcweir 	sal_Bool bRotate=sal_False;
1469cdf0e10cSrcweir 	sal_Bool bShear =sal_False;
1470cdf0e10cSrcweir 
1471cdf0e10cSrcweir 	sal_Bool bSetAttr=sal_False;
1472cdf0e10cSrcweir 	SfxItemSet aSetAttr(pMod->GetItemPool());
1473cdf0e10cSrcweir 
1474cdf0e10cSrcweir 	const SfxPoolItem* pPoolItem=NULL;
1475cdf0e10cSrcweir 
1476cdf0e10cSrcweir 	// Position
1477cdf0e10cSrcweir 	if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_POS_X,sal_True,&pPoolItem)) {
1478cdf0e10cSrcweir 		nPosDX=((const SfxInt32Item*)pPoolItem)->GetValue()-aRect.Left();
1479cdf0e10cSrcweir 		bChgPos=sal_True;
1480cdf0e10cSrcweir 	}
1481cdf0e10cSrcweir 	if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_POS_Y,sal_True,&pPoolItem)){
1482cdf0e10cSrcweir 		nPosDY=((const SfxInt32Item*)pPoolItem)->GetValue()-aRect.Top();
1483cdf0e10cSrcweir 		bChgPos=sal_True;
1484cdf0e10cSrcweir 	}
1485cdf0e10cSrcweir 	// Groesse
1486cdf0e10cSrcweir 	if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_WIDTH,sal_True,&pPoolItem)) {
1487cdf0e10cSrcweir 		nSizX=((const SfxUInt32Item*)pPoolItem)->GetValue();
1488cdf0e10cSrcweir 		bChgSiz=sal_True;
1489*ee093554SAndre Fischer         bChgWdh=sal_True;
1490cdf0e10cSrcweir 	}
1491cdf0e10cSrcweir 	if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_HEIGHT,sal_True,&pPoolItem)) {
1492cdf0e10cSrcweir 		nSizY=((const SfxUInt32Item*)pPoolItem)->GetValue();
1493cdf0e10cSrcweir 		bChgSiz=sal_True;
1494cdf0e10cSrcweir 		bChgHgt=sal_True;
1495cdf0e10cSrcweir 	}
1496cdf0e10cSrcweir 	if (bChgSiz) {
1497cdf0e10cSrcweir 		eSizePoint=(RECT_POINT)((const SfxAllEnumItem&)rAttr.Get(SID_ATTR_TRANSFORM_SIZE_POINT)).GetValue();
1498cdf0e10cSrcweir 	}
1499cdf0e10cSrcweir 
1500cdf0e10cSrcweir 	// Rotation
1501cdf0e10cSrcweir 	if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_ANGLE,sal_True,&pPoolItem)) {
1502cdf0e10cSrcweir 		nRotateAngle=((const SfxInt32Item*)pPoolItem)->GetValue()-nOldRotateAngle;
1503cdf0e10cSrcweir 		bRotate = (nRotateAngle != 0);
1504cdf0e10cSrcweir 	}
1505cdf0e10cSrcweir 
1506cdf0e10cSrcweir 	// #86909# pos rot point x
1507cdf0e10cSrcweir 	if(bRotate || SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_ROT_X, sal_True ,&pPoolItem))
1508cdf0e10cSrcweir 		nRotateX = ((const SfxInt32Item&)rAttr.Get(SID_ATTR_TRANSFORM_ROT_X)).GetValue();
1509cdf0e10cSrcweir 
1510cdf0e10cSrcweir 	// #86909# pos rot point y
1511cdf0e10cSrcweir 	if(bRotate || SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_ROT_Y, sal_True ,&pPoolItem))
1512cdf0e10cSrcweir 		nRotateY = ((const SfxInt32Item&)rAttr.Get(SID_ATTR_TRANSFORM_ROT_Y)).GetValue();
1513cdf0e10cSrcweir 
1514cdf0e10cSrcweir 	// Shear
1515cdf0e10cSrcweir 	if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_SHEAR,sal_True,&pPoolItem)) {
1516cdf0e10cSrcweir 		nNewShearAngle=((const SfxInt32Item*)pPoolItem)->GetValue();
1517cdf0e10cSrcweir 		if (nNewShearAngle>SDRMAXSHEAR) nNewShearAngle=SDRMAXSHEAR;
1518cdf0e10cSrcweir 		if (nNewShearAngle<-SDRMAXSHEAR) nNewShearAngle=-SDRMAXSHEAR;
1519cdf0e10cSrcweir 		if (nNewShearAngle!=nOldShearAngle) {
1520cdf0e10cSrcweir 			bShearVert=((const SfxBoolItem&)rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_VERTICAL)).GetValue();
1521cdf0e10cSrcweir 			if (bShearVert) {
1522cdf0e10cSrcweir 				nShearAngle=nNewShearAngle;
1523cdf0e10cSrcweir 			} else {
1524cdf0e10cSrcweir 				if (nNewShearAngle!=0 && nOldShearAngle!=0) {
1525cdf0e10cSrcweir 					// Bugfix #25714#.
1526cdf0e10cSrcweir 					double nOld=tan((double)nOldShearAngle*nPi180);
1527cdf0e10cSrcweir 					double nNew=tan((double)nNewShearAngle*nPi180);
1528cdf0e10cSrcweir 					nNew-=nOld;
1529cdf0e10cSrcweir 					nNew=atan(nNew)/nPi180;
1530cdf0e10cSrcweir 					nShearAngle=Round(nNew);
1531cdf0e10cSrcweir 				} else {
1532cdf0e10cSrcweir 					nShearAngle=nNewShearAngle-nOldShearAngle;
1533cdf0e10cSrcweir 				}
1534cdf0e10cSrcweir 			}
1535cdf0e10cSrcweir 			bShear=nShearAngle!=0;
1536cdf0e10cSrcweir 			if (bShear) {
1537cdf0e10cSrcweir 				nShearX=((const SfxInt32Item&)rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_X)).GetValue();
1538cdf0e10cSrcweir 				nShearY=((const SfxInt32Item&)rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_Y)).GetValue();
1539cdf0e10cSrcweir 			}
1540cdf0e10cSrcweir 		}
1541cdf0e10cSrcweir 	}
1542cdf0e10cSrcweir 
1543cdf0e10cSrcweir 	// AutoGrow
1544cdf0e10cSrcweir 	if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_AUTOWIDTH,sal_True,&pPoolItem)) {
1545cdf0e10cSrcweir 		sal_Bool bAutoGrow=((const SfxBoolItem*)pPoolItem)->GetValue();
1546cdf0e10cSrcweir 		aSetAttr.Put(SdrTextAutoGrowWidthItem(bAutoGrow));
1547cdf0e10cSrcweir 		bSetAttr=sal_True;
1548cdf0e10cSrcweir 	}
1549cdf0e10cSrcweir 
1550cdf0e10cSrcweir 	if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_AUTOHEIGHT,sal_True,&pPoolItem)) {
1551cdf0e10cSrcweir 		sal_Bool bAutoGrow=((const SfxBoolItem*)pPoolItem)->GetValue();
1552cdf0e10cSrcweir 		aSetAttr.Put(SdrTextAutoGrowHeightItem(bAutoGrow));
1553cdf0e10cSrcweir 		bSetAttr=sal_True;
1554cdf0e10cSrcweir 	}
1555cdf0e10cSrcweir 
1556cdf0e10cSrcweir 	// Eckenradius
1557cdf0e10cSrcweir 	if (bEdgeRadiusAllowed && SFX_ITEM_SET==rAttr.GetItemState(SDRATTR_ECKENRADIUS,sal_True,&pPoolItem)) {
1558cdf0e10cSrcweir 		long nRadius=((SdrEckenradiusItem*)pPoolItem)->GetValue();
1559cdf0e10cSrcweir 		aSetAttr.Put(SdrEckenradiusItem(nRadius));
1560cdf0e10cSrcweir 		bSetAttr=sal_True;
1561cdf0e10cSrcweir 	}
1562cdf0e10cSrcweir 
1563cdf0e10cSrcweir 	ForcePossibilities();
1564cdf0e10cSrcweir 
1565cdf0e10cSrcweir 	BegUndo(ImpGetResStr(STR_EditTransform),GetDescriptionOfMarkedObjects());
1566cdf0e10cSrcweir 
1567cdf0e10cSrcweir 	if (bSetAttr) {
1568cdf0e10cSrcweir 		SetAttrToMarked(aSetAttr,sal_False);
1569cdf0e10cSrcweir 	}
1570cdf0e10cSrcweir 
1571cdf0e10cSrcweir 	// Groesse und Hoehe aendern
1572cdf0e10cSrcweir 	if (bChgSiz && (bResizeFreeAllowed || bResizePropAllowed)) {
1573cdf0e10cSrcweir 		Fraction aWdt(nSizX,aRect.Right()-aRect.Left());
1574cdf0e10cSrcweir 		Fraction aHgt(nSizY,aRect.Bottom()-aRect.Top());
1575cdf0e10cSrcweir 		Point aRef(ImpGetPoint(aRect,eSizePoint));
1576cdf0e10cSrcweir 
1577cdf0e10cSrcweir 		if(GetSdrPageView())
1578cdf0e10cSrcweir 		{
1579cdf0e10cSrcweir 			GetSdrPageView()->PagePosToLogic(aRef);
1580cdf0e10cSrcweir 		}
1581cdf0e10cSrcweir 
1582*ee093554SAndre Fischer         ResizeMultMarkedObj(aRef, aWdt, aHgt, false, bChgWdh, bChgHgt);
1583cdf0e10cSrcweir 	}
1584cdf0e10cSrcweir 
1585cdf0e10cSrcweir 	// Rotieren
1586cdf0e10cSrcweir 	if (bRotate && (bRotateFreeAllowed || bRotate90Allowed)) {
1587cdf0e10cSrcweir 		Point aRef(nRotateX,nRotateY);
1588cdf0e10cSrcweir 
1589cdf0e10cSrcweir 		if(GetSdrPageView())
1590cdf0e10cSrcweir 		{
1591cdf0e10cSrcweir 			GetSdrPageView()->PagePosToLogic(aRef);
1592cdf0e10cSrcweir 		}
1593cdf0e10cSrcweir 
1594cdf0e10cSrcweir 		RotateMarkedObj(aRef,nRotateAngle);
1595cdf0e10cSrcweir 	}
1596cdf0e10cSrcweir 
1597cdf0e10cSrcweir 	// #86909# set rotation point position
1598cdf0e10cSrcweir 	if(bModeIsRotate && (nRotateX != nOldRotateX || nRotateY != nOldRotateY))
1599cdf0e10cSrcweir 	{
1600cdf0e10cSrcweir 		Point aNewRef1(nRotateX, nRotateY);
1601cdf0e10cSrcweir 
1602cdf0e10cSrcweir 		if(GetSdrPageView())
1603cdf0e10cSrcweir 		{
1604cdf0e10cSrcweir 			GetSdrPageView()->PagePosToLogic(aNewRef1);
1605cdf0e10cSrcweir 		}
1606cdf0e10cSrcweir 
1607cdf0e10cSrcweir 		SetRef1(aNewRef1);
1608cdf0e10cSrcweir 	}
1609cdf0e10cSrcweir 
1610cdf0e10cSrcweir 	// Shear
1611cdf0e10cSrcweir 	if (bShear && bShearAllowed) {
1612cdf0e10cSrcweir 		Point aRef(nShearX,nShearY);
1613cdf0e10cSrcweir 
1614cdf0e10cSrcweir 		if(GetSdrPageView())
1615cdf0e10cSrcweir 		{
1616cdf0e10cSrcweir 			GetSdrPageView()->PagePosToLogic(aRef);
1617cdf0e10cSrcweir 		}
1618cdf0e10cSrcweir 
1619cdf0e10cSrcweir 		ShearMarkedObj(aRef,nShearAngle,bShearVert);
1620cdf0e10cSrcweir 
1621cdf0e10cSrcweir         // #i74358#
1622cdf0e10cSrcweir 		// ShearMarkedObj creates a linear combination of the existing transformation and
1623cdf0e10cSrcweir 		// the new shear to apply. If the object is already transformed (e.g. rotated) the
1624cdf0e10cSrcweir 		// linear combination will not decompose to the same start values again, but to a
1625cdf0e10cSrcweir 		// new combination. Thus it makes no sense to check if the wanted shear is reached
1626cdf0e10cSrcweir 		// or not. Taking out.
1627cdf0e10cSrcweir #if 0
1628cdf0e10cSrcweir         long nTempAngle=GetMarkedObjShear();
1629cdf0e10cSrcweir 		if (nTempAngle!=0 && nTempAngle!=nNewShearAngle && !bShearVert) {
1630cdf0e10cSrcweir 			// noch eine 2. Iteration zur Kompensation der Rundungsfehler
1631cdf0e10cSrcweir 			double nOld=tan((double)nTempAngle*nPi180);
1632cdf0e10cSrcweir 			double nNew=tan((double)nNewShearAngle*nPi180);
1633cdf0e10cSrcweir 			nNew-=nOld;
1634cdf0e10cSrcweir 			nNew=atan(nNew)/nPi180;
1635cdf0e10cSrcweir 			nTempAngle=Round(nNew);
1636cdf0e10cSrcweir 			if (nTempAngle!=0) {
1637cdf0e10cSrcweir 				ShearMarkedObj(aRef,nTempAngle,bShearVert);
1638cdf0e10cSrcweir 			}
1639cdf0e10cSrcweir 		}
1640cdf0e10cSrcweir #endif
1641cdf0e10cSrcweir 	}
1642cdf0e10cSrcweir 
1643cdf0e10cSrcweir 	// Position aendern
1644cdf0e10cSrcweir 	if (bChgPos && bMoveAllowed) {
1645cdf0e10cSrcweir 		MoveMarkedObj(Size(nPosDX,nPosDY));
1646cdf0e10cSrcweir 	}
1647cdf0e10cSrcweir 
1648cdf0e10cSrcweir 	// protect position
1649cdf0e10cSrcweir 	if(SFX_ITEM_SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_PROTECT_POS, sal_True, &pPoolItem))
1650cdf0e10cSrcweir 	{
1651cdf0e10cSrcweir 		const sal_Bool bProtPos(((const SfxBoolItem*)pPoolItem)->GetValue());
1652cdf0e10cSrcweir 		bool bChanged(false);
1653cdf0e10cSrcweir 
1654cdf0e10cSrcweir 		for(sal_uInt32 i(0); i < nMarkCount; i++)
1655cdf0e10cSrcweir 		{
1656cdf0e10cSrcweir 			pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1657cdf0e10cSrcweir 
1658cdf0e10cSrcweir 			if(pObj->IsMoveProtect() != bProtPos)
1659cdf0e10cSrcweir 			{
1660cdf0e10cSrcweir 				bChanged = true;
1661cdf0e10cSrcweir 				pObj->SetMoveProtect(bProtPos);
1662cdf0e10cSrcweir 
1663cdf0e10cSrcweir 				if(bProtPos)
1664cdf0e10cSrcweir 				{
1665cdf0e10cSrcweir 					pObj->SetResizeProtect(true);
1666cdf0e10cSrcweir 				}
1667cdf0e10cSrcweir 			}
1668cdf0e10cSrcweir 		}
1669cdf0e10cSrcweir 
1670cdf0e10cSrcweir 		if(bChanged)
1671cdf0e10cSrcweir 		{
1672cdf0e10cSrcweir 			bMoveProtect = bProtPos;
1673cdf0e10cSrcweir 
1674cdf0e10cSrcweir 			if(bProtPos)
1675cdf0e10cSrcweir 			{
1676cdf0e10cSrcweir 				bResizeProtect = true;
1677cdf0e10cSrcweir 			}
1678cdf0e10cSrcweir 
1679cdf0e10cSrcweir 			// #i77187# there is no simple method to get the toolbars updated
1680cdf0e10cSrcweir 			// in the application. The App is listening to selection change and i
1681cdf0e10cSrcweir 			// will use it here (even if not true). It's acceptable since changing
1682cdf0e10cSrcweir 			// this model data is pretty rare and only possible using the F4 dialog
1683cdf0e10cSrcweir 			MarkListHasChanged();
1684cdf0e10cSrcweir 		}
1685cdf0e10cSrcweir 	}
1686cdf0e10cSrcweir 
1687cdf0e10cSrcweir 	if(!bMoveProtect)
1688cdf0e10cSrcweir 	{
1689cdf0e10cSrcweir 		// protect size
1690cdf0e10cSrcweir 		if(SFX_ITEM_SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_PROTECT_SIZE, sal_True, &pPoolItem))
1691cdf0e10cSrcweir 		{
1692cdf0e10cSrcweir 			const sal_Bool bProtSize(((const SfxBoolItem*)pPoolItem)->GetValue());
1693cdf0e10cSrcweir 			bool bChanged(false);
1694cdf0e10cSrcweir 
1695cdf0e10cSrcweir 			for(sal_uInt32 i(0); i < nMarkCount; i++)
1696cdf0e10cSrcweir 			{
1697cdf0e10cSrcweir 				pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1698cdf0e10cSrcweir 
1699cdf0e10cSrcweir 				if(pObj->IsResizeProtect() != bProtSize)
1700cdf0e10cSrcweir 				{
1701cdf0e10cSrcweir 					bChanged = true;
1702cdf0e10cSrcweir 					pObj->SetResizeProtect(bProtSize);
1703cdf0e10cSrcweir 				}
1704cdf0e10cSrcweir 			}
1705cdf0e10cSrcweir 
1706cdf0e10cSrcweir 			if(bChanged)
1707cdf0e10cSrcweir 			{
1708cdf0e10cSrcweir 				bResizeProtect = bProtSize;
1709cdf0e10cSrcweir 
1710cdf0e10cSrcweir 				// #i77187# see above
1711cdf0e10cSrcweir 				MarkListHasChanged();
1712cdf0e10cSrcweir 			}
1713cdf0e10cSrcweir 		}
1714cdf0e10cSrcweir 	}
1715cdf0e10cSrcweir 
1716cdf0e10cSrcweir 	EndUndo();
1717cdf0e10cSrcweir }
1718cdf0e10cSrcweir 
1719cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1720cdf0e10cSrcweir 
1721cdf0e10cSrcweir sal_Bool SdrEditView::IsAlignPossible() const
1722cdf0e10cSrcweir {  // Mindestens 2 markierte Objekte, davon mind. 1 beweglich
1723cdf0e10cSrcweir 	ForcePossibilities();
1724cdf0e10cSrcweir 	sal_uIntPtr nAnz=GetMarkedObjectCount();
1725cdf0e10cSrcweir 	if (nAnz==0) return sal_False;         // Nix markiert!
1726cdf0e10cSrcweir 	if (nAnz==1) return bMoveAllowed;  // einzelnes Obj an der Seite ausrichten
1727cdf0e10cSrcweir 	return bOneOrMoreMovable;          // ansonsten ist MarkCount>=2
1728cdf0e10cSrcweir }
1729cdf0e10cSrcweir 
1730cdf0e10cSrcweir void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert, sal_Bool bBoundRects)
1731cdf0e10cSrcweir {
1732cdf0e10cSrcweir 	if (eHor==SDRHALIGN_NONE && eVert==SDRVALIGN_NONE)
1733cdf0e10cSrcweir 		return;
1734cdf0e10cSrcweir 
1735cdf0e10cSrcweir 	SortMarkedObjects();
1736cdf0e10cSrcweir 	if (GetMarkedObjectCount()<1)
1737cdf0e10cSrcweir 		return;
1738cdf0e10cSrcweir 
1739cdf0e10cSrcweir 	const bool bUndo = IsUndoEnabled();
1740cdf0e10cSrcweir 	if( bUndo )
1741cdf0e10cSrcweir 	{
1742cdf0e10cSrcweir 		XubString aStr(GetDescriptionOfMarkedObjects());
1743cdf0e10cSrcweir 		if (eHor==SDRHALIGN_NONE)
1744cdf0e10cSrcweir 		{
1745cdf0e10cSrcweir 			switch (eVert)
1746cdf0e10cSrcweir 			{
1747cdf0e10cSrcweir 				case SDRVALIGN_TOP   : ImpTakeDescriptionStr(STR_EditAlignVTop   ,aStr); break;
1748cdf0e10cSrcweir 				case SDRVALIGN_BOTTOM: ImpTakeDescriptionStr(STR_EditAlignVBottom,aStr); break;
1749cdf0e10cSrcweir 				case SDRVALIGN_CENTER: ImpTakeDescriptionStr(STR_EditAlignVCenter,aStr); break;
1750cdf0e10cSrcweir 				default: break;
1751cdf0e10cSrcweir 			}
1752cdf0e10cSrcweir 		}
1753cdf0e10cSrcweir 		else if (eVert==SDRVALIGN_NONE)
1754cdf0e10cSrcweir 		{
1755cdf0e10cSrcweir 			switch (eHor)
1756cdf0e10cSrcweir 			{
1757cdf0e10cSrcweir 				case SDRHALIGN_LEFT  : ImpTakeDescriptionStr(STR_EditAlignHLeft  ,aStr); break;
1758cdf0e10cSrcweir 				case SDRHALIGN_RIGHT : ImpTakeDescriptionStr(STR_EditAlignHRight ,aStr); break;
1759cdf0e10cSrcweir 				case SDRHALIGN_CENTER: ImpTakeDescriptionStr(STR_EditAlignHCenter,aStr); break;
1760cdf0e10cSrcweir 				default: break;
1761cdf0e10cSrcweir 			}
1762cdf0e10cSrcweir 		}
1763cdf0e10cSrcweir 		else if (eHor==SDRHALIGN_CENTER && eVert==SDRVALIGN_CENTER)
1764cdf0e10cSrcweir 		{
1765cdf0e10cSrcweir 			ImpTakeDescriptionStr(STR_EditAlignCenter,aStr);
1766cdf0e10cSrcweir 		}
1767cdf0e10cSrcweir 		else
1768cdf0e10cSrcweir 		{
1769cdf0e10cSrcweir 			ImpTakeDescriptionStr(STR_EditAlign,aStr);
1770cdf0e10cSrcweir 		}
1771cdf0e10cSrcweir 		BegUndo(aStr);
1772cdf0e10cSrcweir 	}
1773cdf0e10cSrcweir 
1774cdf0e10cSrcweir 	Rectangle aBound;
1775cdf0e10cSrcweir 	sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
1776cdf0e10cSrcweir 	sal_uIntPtr nm;
1777cdf0e10cSrcweir 	sal_Bool bHasFixed=sal_False;
1778cdf0e10cSrcweir 	for (nm=0; nm<nMarkAnz; nm++)
1779cdf0e10cSrcweir 	{
1780cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nm);
1781cdf0e10cSrcweir 		SdrObject* pObj=pM->GetMarkedSdrObj();
1782cdf0e10cSrcweir 		SdrObjTransformInfoRec aInfo;
1783cdf0e10cSrcweir 		pObj->TakeObjInfo(aInfo);
1784cdf0e10cSrcweir 		if (!aInfo.bMoveAllowed || pObj->IsMoveProtect())
1785cdf0e10cSrcweir 		{
1786cdf0e10cSrcweir 			Rectangle aObjRect(bBoundRects?pObj->GetCurrentBoundRect():pObj->GetSnapRect());
1787cdf0e10cSrcweir 			aBound.Union(aObjRect);
1788cdf0e10cSrcweir 			bHasFixed=sal_True;
1789cdf0e10cSrcweir 		}
1790cdf0e10cSrcweir 	}
1791cdf0e10cSrcweir 	if (!bHasFixed)
1792cdf0e10cSrcweir 	{
1793cdf0e10cSrcweir 		if (nMarkAnz==1)
1794cdf0e10cSrcweir 		{	// einzelnes Obj an der Seite ausrichten
1795cdf0e10cSrcweir 			const SdrObject* pObj=GetMarkedObjectByIndex(0L);
1796cdf0e10cSrcweir 			const SdrPage* pPage=pObj->GetPage();
1797cdf0e10cSrcweir 			const SdrPageGridFrameList* pGFL=pPage->GetGridFrameList(GetSdrPageViewOfMarkedByIndex(0),&(pObj->GetSnapRect()));
1798cdf0e10cSrcweir 			const SdrPageGridFrame* pFrame=NULL;
1799cdf0e10cSrcweir 			if (pGFL!=NULL && pGFL->GetCount()!=0)
1800cdf0e10cSrcweir 			{ // Writer
1801cdf0e10cSrcweir 				pFrame=&((*pGFL)[0]);
1802cdf0e10cSrcweir 			}
1803cdf0e10cSrcweir 
1804cdf0e10cSrcweir 			if (pFrame!=NULL)
1805cdf0e10cSrcweir 			{ // Writer
1806cdf0e10cSrcweir 				aBound=pFrame->GetUserArea();
1807cdf0e10cSrcweir 			}
1808cdf0e10cSrcweir 			else
1809cdf0e10cSrcweir 			{
1810cdf0e10cSrcweir 				aBound=Rectangle(pPage->GetLftBorder(),pPage->GetUppBorder(),
1811cdf0e10cSrcweir 								 pPage->GetWdt()-pPage->GetRgtBorder(),
1812cdf0e10cSrcweir 								 pPage->GetHgt()-pPage->GetLwrBorder());
1813cdf0e10cSrcweir 			}
1814cdf0e10cSrcweir 		}
1815cdf0e10cSrcweir 		else
1816cdf0e10cSrcweir 		{
1817cdf0e10cSrcweir 			if (bBoundRects)
1818cdf0e10cSrcweir 				aBound=GetMarkedObjBoundRect();
1819cdf0e10cSrcweir 			else
1820cdf0e10cSrcweir 				aBound=GetMarkedObjRect();
1821cdf0e10cSrcweir 		}
1822cdf0e10cSrcweir 	}
1823cdf0e10cSrcweir 	Point aCenter(aBound.Center());
1824cdf0e10cSrcweir 	for (nm=0; nm<nMarkAnz; nm++)
1825cdf0e10cSrcweir 	{
1826cdf0e10cSrcweir 		SdrMark* pM=GetSdrMarkByIndex(nm);
1827cdf0e10cSrcweir 		SdrObject* pObj=pM->GetMarkedSdrObj();
1828cdf0e10cSrcweir 		SdrObjTransformInfoRec aInfo;
1829cdf0e10cSrcweir 		pObj->TakeObjInfo(aInfo);
1830cdf0e10cSrcweir 		if (aInfo.bMoveAllowed && !pObj->IsMoveProtect())
1831cdf0e10cSrcweir 		{
1832cdf0e10cSrcweir 			// SdrPageView* pPV=pM->GetPageView();
1833cdf0e10cSrcweir 			long nXMov=0;
1834cdf0e10cSrcweir 			long nYMov=0;
1835cdf0e10cSrcweir 			Rectangle aObjRect(bBoundRects?pObj->GetCurrentBoundRect():pObj->GetSnapRect());
1836cdf0e10cSrcweir 			switch (eVert)
1837cdf0e10cSrcweir 			{
1838cdf0e10cSrcweir 				case SDRVALIGN_TOP   : nYMov=aBound.Top()   -aObjRect.Top()       ; break;
1839cdf0e10cSrcweir 				case SDRVALIGN_BOTTOM: nYMov=aBound.Bottom()-aObjRect.Bottom()    ; break;
1840cdf0e10cSrcweir 				case SDRVALIGN_CENTER: nYMov=aCenter.Y()    -aObjRect.Center().Y(); break;
1841cdf0e10cSrcweir 				default: break;
1842cdf0e10cSrcweir 			}
1843cdf0e10cSrcweir 			switch (eHor)
1844cdf0e10cSrcweir 			{
1845cdf0e10cSrcweir 				case SDRHALIGN_LEFT  : nXMov=aBound.Left()  -aObjRect.Left()      ; break;
1846cdf0e10cSrcweir 				case SDRHALIGN_RIGHT : nXMov=aBound.Right() -aObjRect.Right()     ; break;
1847cdf0e10cSrcweir 				case SDRHALIGN_CENTER: nXMov=aCenter.X()    -aObjRect.Center().X(); break;
1848cdf0e10cSrcweir 				default: break;
1849cdf0e10cSrcweir 			}
1850cdf0e10cSrcweir 			if (nXMov!=0 || nYMov!=0)
1851cdf0e10cSrcweir 			{
1852cdf0e10cSrcweir 				// #104104# SdrEdgeObj needs an extra SdrUndoGeoObj since the
1853cdf0e10cSrcweir 				// connections may need to be saved
1854cdf0e10cSrcweir 				if( bUndo )
1855cdf0e10cSrcweir 				{
1856cdf0e10cSrcweir 					if( dynamic_cast<SdrEdgeObj*>(pObj) )
1857cdf0e10cSrcweir 					{
1858cdf0e10cSrcweir 						AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
1859cdf0e10cSrcweir 					}
1860cdf0e10cSrcweir 
1861cdf0e10cSrcweir 					AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pObj,Size(nXMov,nYMov)));
1862cdf0e10cSrcweir 				}
1863cdf0e10cSrcweir 
1864cdf0e10cSrcweir 				pObj->Move(Size(nXMov,nYMov));
1865cdf0e10cSrcweir 			}
1866cdf0e10cSrcweir 		}
1867cdf0e10cSrcweir 	}
1868cdf0e10cSrcweir 
1869cdf0e10cSrcweir 	if( bUndo )
1870cdf0e10cSrcweir 		EndUndo();
1871cdf0e10cSrcweir }
1872cdf0e10cSrcweir 
1873