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