LibreOffice Module svx (master)  1
svdedtv1.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
22 #include <editeng/eeitem.hxx>
23 #include <math.h>
24 #include <svl/itemiter.hxx>
25 #include <svl/whiter.hxx>
26 #include <tools/bigint.hxx>
27 #include <vcl/svapp.hxx>
28 #include <vcl/weld.hxx>
29 
30 #include <getallcharpropids.hxx>
31 #include <svx/dialmgr.hxx>
32 #include <svx/svditer.hxx>
33 #include <svx/strings.hrc>
34 
35 #include <AffineMatrixItem.hxx>
36 #include <svx/e3dsceneupdater.hxx>
37 #include <svx/obj3d.hxx>
38 #include <svx/rectenum.hxx>
40 #include <svx/sdooitm.hxx>
41 #include <svx/sderitm.hxx>
42 #include <svx/sdtagitm.hxx>
43 #include <svx/svdedtv.hxx>
44 #include <svx/svdetc.hxx>
45 #include <svx/svdopath.hxx>
46 #include <svx/svdpage.hxx>
47 #include <svx/svdpagv.hxx>
48 #include <svx/svdtrans.hxx>
49 #include <svx/svdundo.hxx>
50 #include <svx/svxids.hrc>
51 #include <sxallitm.hxx>
52 #include <sxmovitm.hxx>
53 #include <sxreaitm.hxx>
54 #include <sxreoitm.hxx>
55 #include <sxroaitm.hxx>
56 #include <sxrooitm.hxx>
57 #include <sxsalitm.hxx>
58 #include <sxsoitm.hxx>
59 #include <sxtraitm.hxx>
60 #include <svx/xlnedwit.hxx>
61 #include <svx/xlnstwit.hxx>
62 #include <svx/xlnwtit.hxx>
63 #include <svx/xlnclit.hxx>
64 #include <svx/xflclit.hxx>
65 #include <svx/xlntrit.hxx>
66 #include <svx/xfltrit.hxx>
67 #include <svx/sdprcitm.hxx>
68 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
69 #include <rtl/ustring.hxx>
70 #include <sfx2/viewsh.hxx>
71 #include <comphelper/lok.hxx>
72 
73 // EditView
74 
75 
77 {
78  DBG_ASSERT(!rRect.IsEmpty(),"SetMarkedObjRect() with an empty Rect does not make sense.");
79  if (rRect.IsEmpty()) return;
80  const size_t nCount=GetMarkedObjectCount();
81  if (nCount==0) return;
83  DBG_ASSERT(!aR0.IsEmpty(),"SetMarkedObjRect(): GetMarkedObjRect() is empty.");
84  if (aR0.IsEmpty()) return;
85  long x0=aR0.Left();
86  long y0=aR0.Top();
87  long w0=aR0.Right()-x0;
88  long h0=aR0.Bottom()-y0;
89  long x1=rRect.Left();
90  long y1=rRect.Top();
91  long w1=rRect.Right()-x1;
92  long h1=rRect.Bottom()-y1;
93 
94  const bool bUndo = IsUndoEnabled();
95  if( bUndo )
96  {
98  BegUndo(ImpGetDescriptionString(STR_EditPosSize));
99  }
100 
101  for (size_t nm=0; nm<nCount; ++nm)
102  {
103  SdrMark* pM=GetSdrMarkByIndex(nm);
104  SdrObject* pO=pM->GetMarkedSdrObj();
105  if( bUndo )
106  AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
107 
108  tools::Rectangle aR1(pO->GetSnapRect());
109  if (!aR1.IsEmpty())
110  {
111  if (aR1==aR0)
112  {
113  aR1=rRect;
114  }
115  else
116  { // transform aR1 to aR0 after rRect
117  aR1.Move(-x0,-y0);
118  BigInt l(aR1.Left());
119  BigInt r(aR1.Right());
120  BigInt t(aR1.Top());
121  BigInt b(aR1.Bottom());
122  if (w0!=0) {
123  l*=w1; l/=w0;
124  r*=w1; r/=w0;
125  } else {
126  l=0; r=w1;
127  }
128  if (h0!=0) {
129  t*=h1; t/=h0;
130  b*=h1; b/=h0;
131  } else {
132  t=0; b=h1;
133  }
134  aR1.SetLeft(long(l) );
135  aR1.SetRight(long(r) );
136  aR1.SetTop(long(t) );
137  aR1.SetBottom(long(b) );
138  aR1.Move(x1,y1);
139  }
140  pO->SetSnapRect(aR1);
141  } else {
142  OSL_FAIL("SetMarkedObjRect(): pObj->GetSnapRect() returns empty Rect");
143  }
144  }
145  if( bUndo )
146  EndUndo();
147 }
148 
149 std::vector< std::unique_ptr<SdrUndoAction> > SdrEditView::CreateConnectorUndo( SdrObject& rO )
150 {
151  std::vector< std::unique_ptr<SdrUndoAction> > vUndoActions;
152 
153  if ( rO.GetBroadcaster() )
154  {
155  const SdrPage* pPage = rO.getSdrPageFromSdrObject();
156  if ( pPage )
157  {
159  while( aIter.IsMore() )
160  {
161  SdrObject* pPartObj = aIter.Next();
162  if ( dynamic_cast<const SdrEdgeObj*>( pPartObj) != nullptr )
163  {
164  if ( ( pPartObj->GetConnectedNode( false ) == &rO ) ||
165  ( pPartObj->GetConnectedNode( true ) == &rO ) )
166  {
167  vUndoActions.push_back( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject( *pPartObj ) );
168  }
169  }
170  }
171  }
172  }
173  return vUndoActions;
174 }
175 
176 void SdrEditView::AddUndoActions( std::vector< std::unique_ptr<SdrUndoAction> > aUndoActions )
177 {
178  for (auto & rAction : aUndoActions)
179  AddUndo( std::move(rAction) );
180 }
181 
182 void SdrEditView::MoveMarkedObj(const Size& rSiz, bool bCopy)
183 {
184  const bool bUndo = IsUndoEnabled();
185 
186  if( bUndo )
187  {
189  OUString aStr(SvxResId(STR_EditMove));
190  if (bCopy)
191  aStr += SvxResId(STR_EditWithCopy);
192  // needs its own UndoGroup because of its parameters
194  }
195 
196  if (bCopy)
197  CopyMarkedObj();
198 
199  const size_t nMarkCount=GetMarkedObjectCount();
200  for (size_t nm=0; nm<nMarkCount; ++nm)
201  {
202  SdrMark* pM=GetSdrMarkByIndex(nm);
203  SdrObject* pO=pM->GetMarkedSdrObj();
204  if( bUndo )
205  {
207  AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pO,rSiz));
208  }
209  pO->Move(rSiz);
210  }
211 
212  if( bUndo )
213  EndUndo();
214 }
215 
216 void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy)
217 {
218  const bool bUndo = IsUndoEnabled();
219  if( bUndo )
220  {
222  OUString aStr {ImpGetDescriptionString(STR_EditResize)};
223  if (bCopy)
224  aStr+=SvxResId(STR_EditWithCopy);
225  BegUndo(aStr);
226  }
227 
228  if (bCopy)
229  CopyMarkedObj();
230 
231  const size_t nMarkCount=GetMarkedObjectCount();
232  for (size_t nm=0; nm<nMarkCount; ++nm)
233  {
234  SdrMark* pM=GetSdrMarkByIndex(nm);
235  SdrObject* pO=pM->GetMarkedSdrObj();
236  if( bUndo )
237  {
239  AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
240  }
241  pO->Resize(rRef,xFact,yFact);
242  }
243 
244  if( bUndo )
245  EndUndo();
246 }
247 void SdrEditView::ResizeMultMarkedObj(const Point& rRef,
248  const Fraction& xFact,
249  const Fraction& yFact,
250  const bool bWdh,
251  const bool bHgt)
252 {
253  const bool bUndo = IsUndoEnabled();
254  if( bUndo )
255  {
257  BegUndo(ImpGetDescriptionString(STR_EditResize));
258  }
259 
260  const size_t nMarkCount=GetMarkedObjectCount();
261  for (size_t nm=0; nm<nMarkCount; ++nm)
262  {
263  SdrMark* pM=GetSdrMarkByIndex(nm);
264  SdrObject* pO=pM->GetMarkedSdrObj();
265  if( bUndo )
266  {
268  AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
269  }
270 
271  Fraction aFrac(1,1);
272  if (bWdh && bHgt)
273  pO->Resize(rRef, xFact, yFact);
274  else if (bWdh)
275  pO->Resize(rRef, xFact, aFrac);
276  else if (bHgt)
277  pO->Resize(rRef, aFrac, yFact);
278  }
279  if( bUndo )
280  EndUndo();
281 }
282 
284 {
285  long nRetval(0);
286 
288  {
289  SdrMark* pM = GetSdrMarkByIndex(0);
290  SdrObject* pO = pM->GetMarkedSdrObj();
291 
292  nRetval = pO->GetRotateAngle();
293  }
294 
295  return nRetval;
296  //sal_Bool b1st=true;
297  //sal_Bool bOk=true;
298  //long nAngle=0;
299  //sal_uIntPtr nMarkCount=GetMarkedObjectCount();
300  //for (sal_uIntPtr nm=0; nm<nMarkCount && bOk; nm++) {
301  // SdrMark* pM=GetSdrMarkByIndex(nm);
302  // SdrObject* pO=pM->GetMarkedSdrObj();
303  // long nAngle2=pO->GetRotateAngle();
304  // if (b1st) nAngle=nAngle2;
305  // else if (nAngle2!=nAngle) bOk=false;
306  // b1st=false;
307  //}
308  //if (!bOk) nAngle=0;
309  //return nAngle;
310 }
311 
312 void SdrEditView::RotateMarkedObj(const Point& rRef, long nAngle, bool bCopy)
313 {
314  const bool bUndo = IsUndoEnabled();
315  if( bUndo )
316  {
318  OUString aStr {ImpGetDescriptionString(STR_EditRotate)};
319  if (bCopy) aStr+=SvxResId(STR_EditWithCopy);
320  BegUndo(aStr);
321  }
322 
323  if (bCopy)
324  CopyMarkedObj();
325 
326  double nSin = sin(nAngle * F_PI18000);
327  double nCos = cos(nAngle * F_PI18000);
328  const size_t nMarkCount(GetMarkedObjectCount());
329 
330  if(nMarkCount)
331  {
332  std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
333 
334  for(size_t nm = 0; nm < nMarkCount; ++nm)
335  {
336  SdrMark* pM = GetSdrMarkByIndex(nm);
337  SdrObject* pO = pM->GetMarkedSdrObj();
338 
339  if( bUndo )
340  {
341  // extra undo actions for changed connector which now may hold its laid out path (SJ)
343 
344  AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
345  }
346 
347  // set up a scene updater if object is a 3d object
348  if(dynamic_cast< E3dObject* >(pO))
349  {
350  aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pO));
351  }
352 
353  pO->Rotate(rRef,nAngle,nSin,nCos);
354  }
355 
356  // fire scene updaters
357  while(!aUpdaters.empty())
358  {
359  delete aUpdaters.back();
360  aUpdaters.pop_back();
361  }
362  }
363 
364  if( bUndo )
365  EndUndo();
366 }
367 
368 void SdrEditView::MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy)
369 {
370  const bool bUndo = IsUndoEnabled();
371 
372  if( bUndo )
373  {
375  OUString aStr;
376  Point aDif(rRef2-rRef1);
377  if (aDif.X()==0)
378  aStr = ImpGetDescriptionString(STR_EditMirrorHori);
379  else if (aDif.Y()==0)
380  aStr = ImpGetDescriptionString(STR_EditMirrorVert);
381  else if (std::abs(aDif.X()) == std::abs(aDif.Y()))
382  aStr = ImpGetDescriptionString(STR_EditMirrorDiag);
383  else
384  aStr = ImpGetDescriptionString(STR_EditMirrorFree);
385  if (bCopy) aStr+=SvxResId(STR_EditWithCopy);
386  BegUndo(aStr);
387  }
388 
389  if (bCopy)
390  CopyMarkedObj();
391 
392  const size_t nMarkCount(GetMarkedObjectCount());
393 
394  if(nMarkCount)
395  {
396  std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
397 
398  for(size_t nm = 0; nm < nMarkCount; ++nm)
399  {
400  SdrMark* pM = GetSdrMarkByIndex(nm);
401  SdrObject* pO = pM->GetMarkedSdrObj();
402 
403  if( bUndo )
404  {
405  // extra undo actions for changed connector which now may hold its laid out path (SJ)
407 
408  AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
409  }
410 
411  // set up a scene updater if object is a 3d object
412  if(dynamic_cast< E3dObject* >(pO))
413  {
414  aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pO));
415  }
416 
417  pO->Mirror(rRef1,rRef2);
418  }
419 
420  // fire scene updaters
421  while(!aUpdaters.empty())
422  {
423  delete aUpdaters.back();
424  aUpdaters.pop_back();
425  }
426  }
427 
428  if( bUndo )
429  EndUndo();
430 }
431 
433 {
435  Point aPt2(aCenter);
436  aPt2.AdjustY( 1 );
437  MirrorMarkedObj(aCenter,aPt2);
438 }
439 
441 {
443  Point aPt2(aCenter);
444  aPt2.AdjustX( 1 );
445  MirrorMarkedObj(aCenter,aPt2);
446 }
447 
449 {
450  bool b1st=true;
451  bool bOk=true;
452  long nAngle=0;
453  const size_t nMarkCount=GetMarkedObjectCount();
454  for (size_t nm=0; nm<nMarkCount && bOk; ++nm) {
455  SdrMark* pM=GetSdrMarkByIndex(nm);
456  SdrObject* pO=pM->GetMarkedSdrObj();
457  long nAngle2=pO->GetShearAngle();
458  if (b1st) nAngle=nAngle2;
459  else if (nAngle2!=nAngle) bOk=false;
460  b1st=false;
461  }
462  if (nAngle>SDRMAXSHEAR) nAngle=SDRMAXSHEAR;
463  if (nAngle<-SDRMAXSHEAR) nAngle=-SDRMAXSHEAR;
464  if (!bOk) nAngle=0;
465  return nAngle;
466 }
467 
468 void SdrEditView::ShearMarkedObj(const Point& rRef, long nAngle, bool bVShear, bool bCopy)
469 {
470  const bool bUndo = IsUndoEnabled();
471 
472  if( bUndo )
473  {
475  OUString aStr {ImpGetDescriptionString(STR_EditShear)};
476  if (bCopy)
477  aStr+=SvxResId(STR_EditWithCopy);
478  BegUndo(aStr);
479  }
480 
481  if (bCopy)
482  CopyMarkedObj();
483 
484  double nTan = tan(nAngle * F_PI18000);
485  const size_t nMarkCount=GetMarkedObjectCount();
486  for (size_t nm=0; nm<nMarkCount; ++nm)
487  {
488  SdrMark* pM=GetSdrMarkByIndex(nm);
489  SdrObject* pO=pM->GetMarkedSdrObj();
490  if( bUndo )
491  {
493  AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
494  }
495  pO->Shear(rRef,nAngle,nTan,bVShear);
496  }
497 
498  if( bUndo )
499  EndUndo();
500 }
501 
502 void SdrEditView::ImpCrookObj(SdrObject* pO, const Point& rRef, const Point& rRad,
503  SdrCrookMode eMode, bool bVertical, bool bNoContortion, bool bRotate, const tools::Rectangle& rMarkRect)
504 {
505  SdrPathObj* pPath=dynamic_cast<SdrPathObj*>( pO );
506  bool bDone = false;
507 
508  if(pPath!=nullptr && !bNoContortion)
509  {
510  XPolyPolygon aXPP(pPath->GetPathPoly());
511  switch (eMode) {
512  case SdrCrookMode::Rotate : CrookRotatePoly (aXPP,rRef,rRad,bVertical); break;
513  case SdrCrookMode::Slant : CrookSlantPoly (aXPP,rRef,rRad,bVertical); break;
514  case SdrCrookMode::Stretch: CrookStretchPoly(aXPP,rRef,rRad,bVertical,rMarkRect); break;
515  } // switch
516  pPath->SetPathPoly(aXPP.getB2DPolyPolygon());
517  bDone = true;
518  }
519 
520  if(!bDone && !pPath && pO->IsPolyObj() && 0 != pO->GetPointCount())
521  {
522  // for PolyObj's, but NOT for SdrPathObj's, e.g. the measurement object
523  sal_uInt32 nPointCount(pO->GetPointCount());
524  XPolygon aXP(static_cast<sal_uInt16>(nPointCount));
525  sal_uInt32 nPtNum;
526 
527  for(nPtNum = 0; nPtNum < nPointCount; nPtNum++)
528  {
529  Point aPt(pO->GetPoint(nPtNum));
530  aXP[static_cast<sal_uInt16>(nPtNum)]=aPt;
531  }
532 
533  switch (eMode)
534  {
535  case SdrCrookMode::Rotate : CrookRotatePoly (aXP,rRef,rRad,bVertical); break;
536  case SdrCrookMode::Slant : CrookSlantPoly (aXP,rRef,rRad,bVertical); break;
537  case SdrCrookMode::Stretch: CrookStretchPoly(aXP,rRef,rRad,bVertical,rMarkRect); break;
538  }
539 
540  for(nPtNum = 0; nPtNum < nPointCount; nPtNum++)
541  {
542  // broadcasting could be optimized here, but for the
543  // current two points of the measurement object, it's fine
544  pO->SetPoint(aXP[static_cast<sal_uInt16>(nPtNum)],nPtNum);
545  }
546 
547  bDone = true;
548  }
549 
550  if(!bDone)
551  {
552  // for all others or if bNoContortion
553  Point aCtr0(pO->GetSnapRect().Center());
554  Point aCtr1(aCtr0);
555  bool bRotOk(false);
556  double nSin(0.0), nCos(1.0);
557  double nAngle(0.0);
558 
559  if(0 != rRad.X() && 0 != rRad.Y())
560  {
561  bRotOk = bRotate;
562 
563  switch (eMode)
564  {
565  case SdrCrookMode::Rotate : nAngle=CrookRotateXPoint (aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical); bRotOk=bRotate; break;
566  case SdrCrookMode::Slant : nAngle=CrookSlantXPoint (aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical); break;
567  case SdrCrookMode::Stretch: nAngle=CrookStretchXPoint(aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical,rMarkRect); break;
568  }
569  }
570 
571  aCtr1 -= aCtr0;
572 
573  if(bRotOk)
574  pO->Rotate(aCtr0, FRound(nAngle / F_PI18000), nSin, nCos);
575 
576  pO->Move(Size(aCtr1.X(),aCtr1.Y()));
577  }
578 }
579 
580 void SdrEditView::CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookMode eMode,
581  bool bVertical, bool bNoContortion, bool bCopy)
582 {
584  const bool bUndo = IsUndoEnabled();
585 
586  bool bRotate=bNoContortion && eMode==SdrCrookMode::Rotate && IsRotateAllowed();
587 
588  if( bUndo )
589  {
591  OUString aStr {ImpGetDescriptionString(bNoContortion ? STR_EditCrook : STR_EditCrookContortion)};
592  if (bCopy)
593  aStr+=SvxResId(STR_EditWithCopy);
594  BegUndo(aStr);
595  }
596 
597  if (bCopy)
598  CopyMarkedObj();
599 
600  const size_t nMarkCount=GetMarkedObjectCount();
601  for (size_t nm=0; nm<nMarkCount; ++nm)
602  {
603  SdrMark* pM=GetSdrMarkByIndex(nm);
604  SdrObject* pO=pM->GetMarkedSdrObj();
605  if( bUndo )
606  AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
607 
608  const SdrObjList* pOL=pO->GetSubList();
609  if (bNoContortion || pOL==nullptr) {
610  ImpCrookObj(pO,rRef,rRad,eMode,bVertical,bNoContortion,bRotate,aMarkRect);
611  } else {
613  while (aIter.IsMore()) {
614  SdrObject* pO1=aIter.Next();
615  ImpCrookObj(pO1,rRef,rRad,eMode,bVertical,bNoContortion,bRotate,aMarkRect);
616  }
617  }
618  }
619 
620  if( bUndo )
621  EndUndo();
622 }
623 
624 void SdrEditView::ImpDistortObj(SdrObject* pO, const tools::Rectangle& rRef, const XPolygon& rDistortedRect, bool bNoContortion)
625 {
626  SdrPathObj* pPath = dynamic_cast<SdrPathObj*>( pO );
627 
628  if(!bNoContortion && pPath)
629  {
630  XPolyPolygon aXPP(pPath->GetPathPoly());
631  aXPP.Distort(rRef, rDistortedRect);
632  pPath->SetPathPoly(aXPP.getB2DPolyPolygon());
633  }
634  else if(pO->IsPolyObj())
635  {
636  // e. g. for the measurement object
637  sal_uInt32 nPointCount(pO->GetPointCount());
638  XPolygon aXP(static_cast<sal_uInt16>(nPointCount));
639  sal_uInt32 nPtNum;
640 
641  for(nPtNum = 0; nPtNum < nPointCount; nPtNum++)
642  {
643  Point aPt(pO->GetPoint(nPtNum));
644  aXP[static_cast<sal_uInt16>(nPtNum)]=aPt;
645  }
646 
647  aXP.Distort(rRef, rDistortedRect);
648 
649  for(nPtNum = 0; nPtNum < nPointCount; nPtNum++)
650  {
651  // broadcasting could be optimized here, but for the
652  // current two points of the measurement object it's fine
653  pO->SetPoint(aXP[static_cast<sal_uInt16>(nPtNum)],nPtNum);
654  }
655  }
656 }
657 
658 void SdrEditView::DistortMarkedObj(const tools::Rectangle& rRef, const XPolygon& rDistortedRect, bool bNoContortion, bool bCopy)
659 {
660  const bool bUndo = IsUndoEnabled();
661 
662  if( bUndo )
663  {
665  OUString aStr {ImpGetDescriptionString(STR_EditDistort)};
666  if (bCopy)
667  aStr+=SvxResId(STR_EditWithCopy);
668  BegUndo(aStr);
669  }
670 
671  if (bCopy)
672  CopyMarkedObj();
673 
674  const size_t nMarkCount=GetMarkedObjectCount();
675  for (size_t nm=0; nm<nMarkCount; ++nm)
676  {
677  SdrMark* pM=GetSdrMarkByIndex(nm);
678  SdrObject* pO=pM->GetMarkedSdrObj();
679  if( bUndo )
680  AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
681 
682  tools::Rectangle aRefRect(rRef);
683  const SdrObjList* pOL=pO->GetSubList();
684  if (bNoContortion || pOL==nullptr) {
685  ImpDistortObj(pO,aRefRect,rDistortedRect,bNoContortion);
686  } else {
688  while (aIter.IsMore()) {
689  SdrObject* pO1=aIter.Next();
690  ImpDistortObj(pO1,aRefRect,rDistortedRect,bNoContortion);
691  }
692  }
693  }
694  if( bUndo )
695  EndUndo();
696 }
697 
698 
700 {
701  // bReplaceAll has no effect here
702  tools::Rectangle aAllSnapRect(GetMarkedObjRect());
703  const SfxPoolItem *pPoolItem=nullptr;
704  if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1X,true,&pPoolItem)==SfxItemState::SET) {
705  long n=static_cast<const SdrTransformRef1XItem*>(pPoolItem)->GetValue();
706  SetRef1(Point(n,GetRef1().Y()));
707  }
708  if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1Y,true,&pPoolItem)==SfxItemState::SET) {
709  long n=static_cast<const SdrTransformRef1YItem*>(pPoolItem)->GetValue();
710  SetRef1(Point(GetRef1().X(),n));
711  }
712  if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2X,true,&pPoolItem)==SfxItemState::SET) {
713  long n=static_cast<const SdrTransformRef2XItem*>(pPoolItem)->GetValue();
714  SetRef2(Point(n,GetRef2().Y()));
715  }
716  if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2Y,true,&pPoolItem)==SfxItemState::SET) {
717  long n=static_cast<const SdrTransformRef2YItem*>(pPoolItem)->GetValue();
718  SetRef2(Point(GetRef2().X(),n));
719  }
720  long nAllPosX=0; bool bAllPosX=false;
721  long nAllPosY=0; bool bAllPosY=false;
722  long nAllWdt=0; bool bAllWdt=false;
723  long nAllHgt=0; bool bAllHgt=false;
724  bool bDoIt=false;
725  if (rAttr.GetItemState(SDRATTR_ALLPOSITIONX,true,&pPoolItem)==SfxItemState::SET) {
726  nAllPosX=static_cast<const SdrAllPositionXItem*>(pPoolItem)->GetValue();
727  bAllPosX=true; bDoIt=true;
728  }
729  if (rAttr.GetItemState(SDRATTR_ALLPOSITIONY,true,&pPoolItem)==SfxItemState::SET) {
730  nAllPosY=static_cast<const SdrAllPositionYItem*>(pPoolItem)->GetValue();
731  bAllPosY=true; bDoIt=true;
732  }
733  if (rAttr.GetItemState(SDRATTR_ALLSIZEWIDTH,true,&pPoolItem)==SfxItemState::SET) {
734  nAllWdt=static_cast<const SdrAllSizeWidthItem*>(pPoolItem)->GetValue();
735  bAllWdt=true; bDoIt=true;
736  }
737  if (rAttr.GetItemState(SDRATTR_ALLSIZEHEIGHT,true,&pPoolItem)==SfxItemState::SET) {
738  nAllHgt=static_cast<const SdrAllSizeHeightItem*>(pPoolItem)->GetValue();
739  bAllHgt=true; bDoIt=true;
740  }
741  if (bDoIt) {
742  tools::Rectangle aRect(aAllSnapRect); // TODO: change this for PolyPt's and GluePt's!!!
743  if (bAllPosX) aRect.Move(nAllPosX-aRect.Left(),0);
744  if (bAllPosY) aRect.Move(0,nAllPosY-aRect.Top());
745  if (bAllWdt) aRect.SetRight(aAllSnapRect.Left()+nAllWdt );
746  if (bAllHgt) aRect.SetBottom(aAllSnapRect.Top()+nAllHgt );
747  SetMarkedObjRect(aRect);
748  }
749  if (rAttr.GetItemState(SDRATTR_RESIZEXALL,true,&pPoolItem)==SfxItemState::SET) {
750  Fraction aXFact=static_cast<const SdrResizeXAllItem*>(pPoolItem)->GetValue();
751  ResizeMarkedObj(aAllSnapRect.TopLeft(),aXFact,Fraction(1,1));
752  }
753  if (rAttr.GetItemState(SDRATTR_RESIZEYALL,true,&pPoolItem)==SfxItemState::SET) {
754  Fraction aYFact=static_cast<const SdrResizeYAllItem*>(pPoolItem)->GetValue();
755  ResizeMarkedObj(aAllSnapRect.TopLeft(),Fraction(1,1),aYFact);
756  }
757  if (rAttr.GetItemState(SDRATTR_ROTATEALL,true,&pPoolItem)==SfxItemState::SET) {
758  long nAngle=static_cast<const SdrRotateAllItem*>(pPoolItem)->GetValue();
759  RotateMarkedObj(aAllSnapRect.Center(),nAngle);
760  }
761  if (rAttr.GetItemState(SDRATTR_HORZSHEARALL,true,&pPoolItem)==SfxItemState::SET) {
762  long nAngle=static_cast<const SdrHorzShearAllItem*>(pPoolItem)->GetValue();
763  ShearMarkedObj(aAllSnapRect.Center(),nAngle);
764  }
765  if (rAttr.GetItemState(SDRATTR_VERTSHEARALL,true,&pPoolItem)==SfxItemState::SET) {
766  long nAngle=static_cast<const SdrVertShearAllItem*>(pPoolItem)->GetValue();
767  ShearMarkedObj(aAllSnapRect.Center(),nAngle,true);
768  }
769 
770  const bool bUndo = IsUndoEnabled();
771 
772  // TODO: check if WhichRange is necessary.
773  const size_t nMarkCount=GetMarkedObjectCount();
774  for (size_t nm=0; nm<nMarkCount; ++nm)
775  {
776  const SdrMark* pM=GetSdrMarkByIndex(nm);
777  SdrObject* pObj=pM->GetMarkedSdrObj();
778  if( bUndo )
779  AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
780 
781  pObj->ApplyNotPersistAttr(rAttr);
782  }
783 }
784 
786 {
787  // TODO: Take into account the origin and PvPos.
788  tools::Rectangle aAllSnapRect(GetMarkedObjRect()); // TODO: change this for PolyPt's and GluePt's!!!
789  long nAllSnapPosX=aAllSnapRect.Left();
790  long nAllSnapPosY=aAllSnapRect.Top();
791  long nAllSnapWdt=aAllSnapRect.GetWidth()-1;
792  long nAllSnapHgt=aAllSnapRect.GetHeight()-1;
793  // TODO: could go into CheckPossibilities
794  bool bMovProtect = false, bMovProtectDC = false;
795  bool bSizProtect = false, bSizProtectDC = false;
796  bool bPrintable = true, bPrintableDC = false;
797  bool bVisible = true, bVisibleDC = false;
798  SdrLayerID nLayerId(0);
799  bool bLayerDC=false;
800  long nSnapPosX=0; bool bSnapPosXDC=false;
801  long nSnapPosY=0; bool bSnapPosYDC=false;
802  long nSnapWdt=0; bool bSnapWdtDC=false;
803  long nSnapHgt=0; bool bSnapHgtDC=false;
804  long nLogicWdt=0; bool bLogicWdtDC=false,bLogicWdtDiff=false;
805  long nLogicHgt=0; bool bLogicHgtDC=false,bLogicHgtDiff=false;
806  long nRotAngle=0; bool bRotAngleDC=false;
807  long nShrAngle=0; bool bShrAngleDC=false;
808  tools::Rectangle aSnapRect;
809  tools::Rectangle aLogicRect;
810  const size_t nMarkCount=GetMarkedObjectCount();
811  for (size_t nm=0; nm<nMarkCount; ++nm) {
812  const SdrMark* pM=GetSdrMarkByIndex(nm);
813  const SdrObject* pObj=pM->GetMarkedSdrObj();
814  if (nm==0) {
815  nLayerId=pObj->GetLayer();
816  bMovProtect=pObj->IsMoveProtect();
817  bSizProtect=pObj->IsResizeProtect();
818  bPrintable =pObj->IsPrintable();
819  bVisible = pObj->IsVisible();
820  tools::Rectangle aSnapRect2(pObj->GetSnapRect());
821  tools::Rectangle aLogicRect2(pObj->GetLogicRect());
822  nSnapPosX=aSnapRect2.Left();
823  nSnapPosY=aSnapRect2.Top();
824  nSnapWdt=aSnapRect2.GetWidth()-1;
825  nSnapHgt=aSnapRect2.GetHeight()-1;
826  nLogicWdt=aLogicRect2.GetWidth()-1;
827  nLogicHgt=aLogicRect2.GetHeight()-1;
828  bLogicWdtDiff=nLogicWdt!=nSnapWdt;
829  bLogicHgtDiff=nLogicHgt!=nSnapHgt;
830  nRotAngle=pObj->GetRotateAngle();
831  nShrAngle=pObj->GetShearAngle();
832  } else {
833  if (!bLayerDC && nLayerId !=pObj->GetLayer()) bLayerDC = true;
834  if (!bMovProtectDC && bMovProtect!=pObj->IsMoveProtect()) bMovProtectDC = true;
835  if (!bSizProtectDC && bSizProtect!=pObj->IsResizeProtect()) bSizProtectDC = true;
836  if (!bPrintableDC && bPrintable !=pObj->IsPrintable()) bPrintableDC = true;
837  if (!bVisibleDC && bVisible !=pObj->IsVisible()) bVisibleDC=true;
838  if (!bRotAngleDC && nRotAngle !=pObj->GetRotateAngle()) bRotAngleDC=true;
839  if (!bShrAngleDC && nShrAngle !=pObj->GetShearAngle()) bShrAngleDC=true;
840  if (!bSnapWdtDC || !bSnapHgtDC || !bSnapPosXDC || !bSnapPosYDC || !bLogicWdtDiff || !bLogicHgtDiff) {
841  aSnapRect=pObj->GetSnapRect();
842  if (nSnapPosX!=aSnapRect.Left()) bSnapPosXDC=true;
843  if (nSnapPosY!=aSnapRect.Top()) bSnapPosYDC=true;
844  if (nSnapWdt!=aSnapRect.GetWidth()-1) bSnapWdtDC=true;
845  if (nSnapHgt!=aSnapRect.GetHeight()-1) bSnapHgtDC=true;
846  }
847  if (!bLogicWdtDC || !bLogicHgtDC || !bLogicWdtDiff || !bLogicHgtDiff) {
848  aLogicRect=pObj->GetLogicRect();
849  if (nLogicWdt!=aLogicRect.GetWidth()-1) bLogicWdtDC=true;
850  if (nLogicHgt!=aLogicRect.GetHeight()-1) bLogicHgtDC=true;
851  if (!bLogicWdtDiff && aSnapRect.GetWidth()!=aLogicRect.GetWidth()) bLogicWdtDiff=true;
852  if (!bLogicHgtDiff && aSnapRect.GetHeight()!=aLogicRect.GetHeight()) bLogicHgtDiff=true;
853  }
854  }
855  }
856 
857  if (bSnapPosXDC || nAllSnapPosX!=nSnapPosX) rAttr.Put(SdrAllPositionXItem(nAllSnapPosX));
858  if (bSnapPosYDC || nAllSnapPosY!=nSnapPosY) rAttr.Put(SdrAllPositionYItem(nAllSnapPosY));
859  if (bSnapWdtDC || nAllSnapWdt !=nSnapWdt ) rAttr.Put(SdrAllSizeWidthItem(nAllSnapWdt));
860  if (bSnapHgtDC || nAllSnapHgt !=nSnapHgt ) rAttr.Put(SdrAllSizeHeightItem(nAllSnapHgt));
861 
862  // items for pure transformations
863  rAttr.Put(SdrMoveXItem());
864  rAttr.Put(SdrMoveYItem());
865  rAttr.Put(SdrResizeXOneItem());
866  rAttr.Put(SdrResizeYOneItem());
867  rAttr.Put(SdrRotateOneItem());
868  rAttr.Put(SdrHorzShearOneItem());
869  rAttr.Put(SdrVertShearOneItem());
870 
871  if (nMarkCount>1) {
872  rAttr.Put(SdrResizeXAllItem());
873  rAttr.Put(SdrResizeYAllItem());
874  rAttr.Put(SdrRotateAllItem());
875  rAttr.Put(SdrHorzShearAllItem());
876  rAttr.Put(SdrVertShearAllItem());
877  }
878 
880  {
881  rAttr.Put(SdrTransformRef1XItem(GetRef1().X()));
882  rAttr.Put(SdrTransformRef1YItem(GetRef1().Y()));
883  }
884 
886  {
887  rAttr.Put(SdrTransformRef2XItem(GetRef2().X()));
888  rAttr.Put(SdrTransformRef2YItem(GetRef2().Y()));
889  }
890 }
891 
893 {
894  SfxItemSet aSet(mpModel->GetItemPool());
895  MergeAttrFromMarked(aSet,bOnlyHardAttr);
896  //the EE_FEATURE items should not be set with SetAttrToMarked (see error message there)
897  //so we do not set them here
898  // #i32448#
899  // Do not disable, but clear the items.
900  aSet.ClearItem(EE_FEATURE_TAB);
901  aSet.ClearItem(EE_FEATURE_LINEBR);
902  aSet.ClearItem(EE_FEATURE_NOTCONV);
903  aSet.ClearItem(EE_FEATURE_FIELD);
904 
905  return aSet;
906 }
907 
908 void SdrEditView::MergeAttrFromMarked(SfxItemSet& rAttr, bool bOnlyHardAttr) const
909 {
910  const size_t nMarkCount(GetMarkedObjectCount());
911 
912  for(size_t a = 0; a < nMarkCount; ++a)
913  {
914  // #80277# merging was done wrong in the prev version
916  SfxWhichIter aIter(rSet);
917  sal_uInt16 nWhich(aIter.FirstWhich());
918 
919  while(nWhich)
920  {
921  if(!bOnlyHardAttr)
922  {
923  if(SfxItemState::DONTCARE == rSet.GetItemState(nWhich, false))
924  rAttr.InvalidateItem(nWhich);
925  else
926  rAttr.MergeValue(rSet.Get(nWhich), true);
927  }
928  else if(SfxItemState::SET == rSet.GetItemState(nWhich, false))
929  {
930  const SfxPoolItem& rItem = rSet.Get(nWhich);
931  rAttr.MergeValue(rItem, true);
932  }
933 
935  {
936  OUString sPayload;
937  switch(nWhich)
938  {
939  case XATTR_LINECOLOR:
940  {
941  const SfxPoolItem* pItem = rSet.GetItem(XATTR_LINECOLOR);
942  if (pItem)
943  {
944  Color aColor = static_cast<const XLineColorItem*>(pItem)->GetColorValue();
945  sPayload = OUString::number(static_cast<sal_uInt32>(aColor));
946 
947  sPayload = ".uno:XLineColor=" + sPayload;
948  }
949  break;
950  }
951 
952  case XATTR_FILLCOLOR:
953  {
954  const SfxPoolItem* pItem = rSet.GetItem(XATTR_FILLCOLOR);
955  if (pItem)
956  {
957  Color aColor = static_cast<const XFillColorItem*>(pItem)->GetColorValue();
958  sPayload = OUString::number(static_cast<sal_uInt32>(aColor));
959 
960  sPayload = ".uno:FillColor=" + sPayload;
961  }
962  break;
963  }
964 
966  {
967  const SfxPoolItem* pItem = rSet.GetItem(XATTR_FILLTRANSPARENCE);
968  if (pItem)
969  {
970  sal_uInt16 nTransparency = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
971  sPayload = OUString::number(nTransparency);
972 
973  sPayload = ".uno:FillTransparence=" + sPayload;
974  }
975  break;
976  }
977 
979  {
980  const SfxPoolItem* pItem = rSet.GetItem(XATTR_LINETRANSPARENCE);
981  if (pItem)
982  {
983  sal_uInt16 nTransparency = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
984  sPayload = OUString::number(nTransparency);
985 
986  sPayload = ".uno:LineTransparence=" + sPayload;
987  }
988  break;
989  }
990 
991  case XATTR_LINEWIDTH:
992  {
993  const SfxPoolItem* pItem = rSet.GetItem(XATTR_LINEWIDTH);
994  if (pItem)
995  {
996  sal_uInt32 nWidth = static_cast<const XLineWidthItem*>(pItem)->GetValue();
997  sPayload = OUString::number(nWidth);
998 
999  sPayload = ".uno:LineWidth=" + sPayload;
1000  }
1001  break;
1002  }
1003 
1005  {
1006  const SfxPoolItem* pItem = rSet.GetItem(SDRATTR_SHADOWTRANSPARENCE);
1007  if (pItem)
1008  {
1009  sal_uInt16 nWidth = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1010  sPayload = OUString::number(nWidth);
1011 
1012  sPayload = ".uno:FillShadowTransparency=" + sPayload;
1013  }
1014  break;
1015  }
1016  }
1017 
1018  if (!sPayload.isEmpty())
1019  GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
1020  OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
1021  }
1022 
1023  nWhich = aIter.NextWhich();
1024  }
1025  }
1026 }
1027 
1028 std::vector<sal_uInt16> GetAllCharPropIds(const SfxItemSet& rSet)
1029 {
1030  std::vector<sal_uInt16> aCharWhichIds;
1031  {
1032  SfxItemIter aIter(rSet);
1033  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
1034  {
1035  if (!IsInvalidItem(pItem))
1036  {
1037  sal_uInt16 nWhich = pItem->Which();
1038  if (nWhich>=EE_CHAR_START && nWhich<=EE_CHAR_END)
1039  aCharWhichIds.push_back( nWhich );
1040  }
1041  }
1042  }
1043  return aCharWhichIds;
1044 }
1045 
1046 void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll)
1047 {
1048  if (!AreObjectsMarked())
1049  return;
1050 
1051 #ifdef DBG_UTIL
1052  {
1053  bool bHasEEFeatureItems=false;
1054  SfxItemIter aIter(rAttr);
1055  for (const SfxPoolItem* pItem = aIter.GetCurItem(); !bHasEEFeatureItems && pItem;
1056  pItem = aIter.NextItem())
1057  {
1058  if (!IsInvalidItem(pItem)) {
1059  sal_uInt16 nW=pItem->Which();
1060  if (nW>=EE_FEATURE_START && nW<=EE_FEATURE_END) bHasEEFeatureItems=true;
1061  }
1062  }
1063  if(bHasEEFeatureItems)
1064  {
1065  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr,
1066  VclMessageType::Info, VclButtonsType::Ok,
1067  "SdrEditView::SetAttrToMarked(): Setting EE_FEATURE items at the SdrView does not make sense! It only leads to overhead and unreadable documents."));
1068  xInfoBox->run();
1069  }
1070  }
1071 #endif
1072 
1073  // #103836# if the user sets character attributes to the complete shape,
1074  // we want to remove all hard set character attributes with same
1075  // which ids from the text. We do that later but here we remember
1076  // all character attribute which id's that are set.
1077  std::vector<sal_uInt16> aCharWhichIds(GetAllCharPropIds(rAttr));
1078 
1079  // To make Undo reconstruct text attributes correctly after Format.Standard
1080  bool bHasEEItems=SearchOutlinerItems(rAttr,bReplaceAll);
1081 
1082  // save additional geometry information when paragraph or character attributes
1083  // are changed and the geometrical shape of the text object might be changed
1084  bool bPossibleGeomChange(false);
1085  SfxWhichIter aIter(rAttr);
1086  sal_uInt16 nWhich = aIter.FirstWhich();
1087  while(!bPossibleGeomChange && nWhich)
1088  {
1089  SfxItemState eState = rAttr.GetItemState(nWhich);
1090  if(eState == SfxItemState::SET)
1091  {
1092  if((nWhich >= SDRATTR_TEXT_MINFRAMEHEIGHT && nWhich <= SDRATTR_TEXT_CONTOURFRAME)
1093  || nWhich == SDRATTR_3DOBJ_PERCENT_DIAGONAL
1094  || nWhich == SDRATTR_3DOBJ_BACKSCALE
1095  || nWhich == SDRATTR_3DOBJ_DEPTH
1096  || nWhich == SDRATTR_3DOBJ_END_ANGLE
1097  || nWhich == SDRATTR_3DSCENE_DISTANCE)
1098  {
1099  bPossibleGeomChange = true;
1100  }
1101  }
1102  nWhich = aIter.NextWhich();
1103  }
1104 
1105  const bool bUndo = IsUndoEnabled();
1106  if( bUndo )
1107  {
1109  BegUndo(ImpGetDescriptionString(STR_EditSetAttributes));
1110  }
1111 
1112  const size_t nMarkCount(GetMarkedObjectCount());
1113  std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
1114 
1115  // create ItemSet without SfxItemState::DONTCARE. Put()
1116  // uses its second parameter (bInvalidAsDefault) to
1117  // remove all such items to set them to default.
1118  SfxItemSet aAttr(*rAttr.GetPool(), rAttr.GetRanges());
1119  aAttr.Put(rAttr);
1120 
1121  // #i38135#
1122  bool bResetAnimationTimer(false);
1123 
1124  const bool bLineStartWidthExplicitChange(SfxItemState::SET
1125  == aAttr.GetItemState(XATTR_LINESTARTWIDTH));
1126  const bool bLineEndWidthExplicitChange(SfxItemState::SET
1127  == aAttr.GetItemState(XATTR_LINEENDWIDTH));
1128  // check if LineWidth is part of the change
1129  const bool bAdaptStartEndWidths(!(bLineStartWidthExplicitChange && bLineEndWidthExplicitChange)
1130  && SfxItemState::SET == aAttr.GetItemState(XATTR_LINEWIDTH));
1131  sal_Int32 nNewLineWidth(0);
1132 
1133  if(bAdaptStartEndWidths)
1134  {
1135  nNewLineWidth = aAttr.Get(XATTR_LINEWIDTH).GetValue();
1136  }
1137 
1138  for (size_t nm=0; nm<nMarkCount; ++nm)
1139  {
1140  SdrMark* pM=GetSdrMarkByIndex(nm);
1141  SdrObject* pObj = pM->GetMarkedSdrObj();
1142 
1143  if( bUndo )
1144  {
1145  SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >( pObj );
1146  if ( pEdgeObj )
1147  bPossibleGeomChange = true;
1148  else
1149  AddUndoActions( CreateConnectorUndo( *pObj ) );
1150  }
1151 
1152  // new geometry undo
1153  if(bPossibleGeomChange && bUndo)
1154  {
1155  // save position and size of object, too
1156  AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
1157  }
1158 
1159  if( bUndo )
1160  {
1161  // #i8508#
1162  // If this is a text object also rescue the OutlinerParaObject since
1163  // applying attributes to the object may change text layout when
1164  // multiple portions exist with multiple formats. If an OutlinerParaObject
1165  // really exists and needs to be rescued is evaluated in the undo
1166  // implementation itself.
1167  const bool bRescueText = dynamic_cast< SdrTextObj* >(pObj) != nullptr;
1168 
1169  // add attribute undo
1170  AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj,false,bHasEEItems || bPossibleGeomChange || bRescueText));
1171  }
1172 
1173  // set up a scene updater if object is a 3d object
1174  if(dynamic_cast< E3dObject* >(pObj))
1175  {
1176  aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pObj));
1177  }
1178 
1179  sal_Int32 nOldLineWidth(0);
1180  if (bAdaptStartEndWidths)
1181  {
1182  nOldLineWidth = pObj->GetMergedItem(XATTR_LINEWIDTH).GetValue();
1183  }
1184 
1185  // set attributes at object
1186  pObj->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
1187 
1188  if(bAdaptStartEndWidths)
1189  {
1190  const SfxItemSet& rSet = pObj->GetMergedItemSet();
1191 
1192  if(nOldLineWidth != nNewLineWidth)
1193  {
1194  if(SfxItemState::DONTCARE != rSet.GetItemState(XATTR_LINESTARTWIDTH))
1195  {
1196  const sal_Int32 nValAct(rSet.Get(XATTR_LINESTARTWIDTH).GetValue());
1197  const sal_Int32 nValNewStart(std::max(sal_Int32(0), nValAct + (((nNewLineWidth - nOldLineWidth) * 15) / 10)));
1198 
1199  pObj->SetMergedItem(XLineStartWidthItem(nValNewStart));
1200  }
1201 
1202  if(SfxItemState::DONTCARE != rSet.GetItemState(XATTR_LINEENDWIDTH))
1203  {
1204  const sal_Int32 nValAct(rSet.Get(XATTR_LINEENDWIDTH).GetValue());
1205  const sal_Int32 nValNewEnd(std::max(sal_Int32(0), nValAct + (((nNewLineWidth - nOldLineWidth) * 15) / 10)));
1206 
1207  pObj->SetMergedItem(XLineEndWidthItem(nValNewEnd));
1208  }
1209  }
1210  }
1211 
1212  if(dynamic_cast<const SdrTextObj*>( pObj) != nullptr)
1213  {
1214  SdrTextObj* pTextObj = static_cast<SdrTextObj*>(pObj);
1215 
1216  if(!aCharWhichIds.empty())
1217  {
1218  tools::Rectangle aOldBoundRect = pTextObj->GetLastBoundRect();
1219 
1220  // #110094#-14 pTextObj->SendRepaintBroadcast(pTextObj->GetBoundRect());
1221  pTextObj->RemoveOutlinerCharacterAttribs( aCharWhichIds );
1222 
1223  // object has changed, should be called from
1224  // RemoveOutlinerCharacterAttribs. This will change when the text
1225  // object implementation changes.
1226  pTextObj->SetChanged();
1227 
1228  pTextObj->BroadcastObjectChange();
1229  pTextObj->SendUserCall(SdrUserCallType::ChangeAttr, aOldBoundRect);
1230  }
1231  }
1232 
1233  // #i38495#
1234  if(!bResetAnimationTimer)
1235  {
1237  {
1238  bResetAnimationTimer = true;
1239  }
1240  }
1241  }
1242 
1243  // fire scene updaters
1244  while(!aUpdaters.empty())
1245  {
1246  delete aUpdaters.back();
1247  aUpdaters.pop_back();
1248  }
1249 
1250  // #i38135#
1251  if(bResetAnimationTimer)
1252  {
1253  SetAnimationTimer(0);
1254  }
1255 
1256  // better check before what to do:
1257  // pObj->SetAttr() or SetNotPersistAttr()
1258  // TODO: missing implementation!
1260 
1261  if( bUndo )
1262  EndUndo();
1263 }
1264 
1266 {
1267  SfxStyleSheet* pRet=nullptr;
1268  bool b1st=true;
1269  const size_t nMarkCount=GetMarkedObjectCount();
1270  for (size_t nm=0; nm<nMarkCount; ++nm) {
1271  SdrMark* pM=GetSdrMarkByIndex(nm);
1273  if (b1st) pRet=pSS;
1274  else if (pRet!=pSS) return nullptr; // different stylesheets
1275  b1st=false;
1276  }
1277  return pRet;
1278 }
1279 
1280 void SdrEditView::SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr)
1281 {
1282  if (AreObjectsMarked())
1283  {
1284  const bool bUndo = IsUndoEnabled();
1285 
1286  if( bUndo )
1287  {
1289  OUString aStr;
1290  if (pStyleSheet!=nullptr)
1291  aStr = ImpGetDescriptionString(STR_EditSetStylesheet);
1292  else
1293  aStr = ImpGetDescriptionString(STR_EditDelStylesheet);
1294  BegUndo(aStr);
1295  }
1296 
1297  const size_t nMarkCount=GetMarkedObjectCount();
1298  for (size_t nm=0; nm<nMarkCount; ++nm)
1299  {
1300  SdrMark* pM=GetSdrMarkByIndex(nm);
1301  if( bUndo )
1302  {
1303  AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pM->GetMarkedSdrObj()));
1304  AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pM->GetMarkedSdrObj(),true,true));
1305  }
1306  pM->GetMarkedSdrObj()->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
1307  }
1308 
1309  if( bUndo )
1310  EndUndo();
1311  }
1312 }
1313 
1314 
1315 void SdrEditView::GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const
1316 {
1317  if(GetMarkedObjectCount())
1318  {
1319  rTargetSet.Put(GetAttrFromMarked(bOnlyHardAttr), false);
1320  }
1321  else
1322  {
1323  SdrMarkView::GetAttributes(rTargetSet, bOnlyHardAttr);
1324  }
1325 }
1326 
1327 void SdrEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll)
1328 {
1329  if (GetMarkedObjectCount()!=0) {
1330  SetAttrToMarked(rSet,bReplaceAll);
1331  } else {
1332  SdrMarkView::SetAttributes(rSet,bReplaceAll);
1333  }
1334 }
1335 
1337 {
1338  if (GetMarkedObjectCount()!=0) {
1339  return GetStyleSheetFromMarked();
1340  } else {
1341  return SdrMarkView::GetStyleSheet();
1342  }
1343 }
1344 
1345 void SdrEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr)
1346 {
1347  if (GetMarkedObjectCount()!=0) {
1348  SetStyleSheetToMarked(pStyleSheet,bDontRemoveHardAttr);
1349  } else {
1350  SdrMarkView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
1351  }
1352 }
1353 
1354 
1356 {
1357  SfxItemSet aRetSet(
1358  mpModel->GetItemPool(),
1359  svl::Items< // SID_ATTR_TRANSFORM_... from s:svxids.hrc
1361  SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_ANGLE,
1362  SID_ATTR_TRANSFORM_PROTECT_POS, SID_ATTR_TRANSFORM_AUTOHEIGHT>{});
1363 
1364  if (AreObjectsMarked())
1365  {
1366  SfxItemSet aMarkAttr(GetAttrFromMarked(false)); // because of AutoGrowHeight and corner radius
1368 
1369  if(GetSdrPageView())
1370  {
1371  GetSdrPageView()->LogicToPagePos(aRect);
1372  }
1373 
1374  // position
1375  aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_POS_X,aRect.Left()));
1376  aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_POS_Y,aRect.Top()));
1377 
1378  // size
1379  long nResizeRefX=aRect.Left();
1380  long nResizeRefY=aRect.Top();
1381  if (meDragMode==SdrDragMode::Rotate) { // use rotation axis as a reference for resizing, too
1382  nResizeRefX=maRef1.X();
1383  nResizeRefY=maRef1.Y();
1384  }
1385  aRetSet.Put(SfxUInt32Item(SID_ATTR_TRANSFORM_WIDTH,aRect.Right()-aRect.Left()));
1386  aRetSet.Put(SfxUInt32Item(SID_ATTR_TRANSFORM_HEIGHT,aRect.Bottom()-aRect.Top()));
1387  aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_RESIZE_REF_X,nResizeRefX));
1388  aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_RESIZE_REF_Y,nResizeRefY));
1389 
1390  Point aRotateAxe(maRef1);
1391 
1392  if(GetSdrPageView())
1393  {
1394  GetSdrPageView()->LogicToPagePos(aRotateAxe);
1395  }
1396 
1397  // rotation
1398  long nRotateRefX=aRect.Center().X();
1399  long nRotateRefY=aRect.Center().Y();
1401  nRotateRefX=aRotateAxe.X();
1402  nRotateRefY=aRotateAxe.Y();
1403  }
1404  aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_ANGLE,GetMarkedObjRotate()));
1405  aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_ROT_X,nRotateRefX));
1406  aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_ROT_Y,nRotateRefY));
1407 
1408  // shearing
1409  long nShearRefX=aRect.Left();
1410  long nShearRefY=aRect.Bottom();
1411  if (meDragMode==SdrDragMode::Rotate) { // use rotation axis as a reference for shearing, too
1412  nShearRefX=aRotateAxe.X();
1413  nShearRefY=aRotateAxe.Y();
1414  }
1415  aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR,GetMarkedObjShear()));
1416  aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_X,nShearRefX));
1417  aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_Y,nShearRefY));
1418 
1419  // check every object whether it is protected
1420  const SdrMarkList& rMarkList=GetMarkedObjectList();
1421  const size_t nMarkCount=rMarkList.GetMarkCount();
1422  SdrObject* pObj=rMarkList.GetMark(0)->GetMarkedSdrObj();
1423  bool bPosProt=pObj->IsMoveProtect();
1424  bool bSizProt=pObj->IsResizeProtect();
1425  bool bPosProtDontCare=false;
1426  bool bSizProtDontCare=false;
1427  for (size_t i=1; i<nMarkCount && (!bPosProtDontCare || !bSizProtDontCare); ++i)
1428  {
1429  pObj=rMarkList.GetMark(i)->GetMarkedSdrObj();
1430  if (bPosProt!=pObj->IsMoveProtect()) bPosProtDontCare=true;
1431  if (bSizProt!=pObj->IsResizeProtect()) bSizProtDontCare=true;
1432  }
1433 
1434  // InvalidateItem sets item to DONT_CARE
1435  if (bPosProtDontCare) {
1436  aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_PROTECT_POS);
1437  } else {
1438  aRetSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_PROTECT_POS,bPosProt));
1439  }
1440  if (bSizProtDontCare) {
1441  aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_PROTECT_SIZE);
1442  } else {
1443  aRetSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_PROTECT_SIZE,bSizProt));
1444  }
1445 
1447  bool bAutoGrow=aMarkAttr.Get(SDRATTR_TEXT_AUTOGROWWIDTH).GetValue();
1448  if (eState==SfxItemState::DONTCARE) {
1449  aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_AUTOWIDTH);
1450  } else if (eState==SfxItemState::SET) {
1451  aRetSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_AUTOWIDTH,bAutoGrow));
1452  }
1453 
1454  eState=aMarkAttr.GetItemState(SDRATTR_TEXT_AUTOGROWHEIGHT);
1455  bAutoGrow=aMarkAttr.Get(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue();
1456  if (eState==SfxItemState::DONTCARE) {
1457  aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_AUTOHEIGHT);
1458  } else if (eState==SfxItemState::SET) {
1459  aRetSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_AUTOHEIGHT,bAutoGrow));
1460  }
1461 
1462  eState=aMarkAttr.GetItemState(SDRATTR_ECKENRADIUS);
1463  long nRadius=aMarkAttr.Get(SDRATTR_ECKENRADIUS).GetValue();
1464  if (eState==SfxItemState::DONTCARE) {
1465  aRetSet.InvalidateItem(SDRATTR_ECKENRADIUS);
1466  } else if (eState==SfxItemState::SET) {
1467  aRetSet.Put(makeSdrEckenradiusItem(nRadius));
1468  }
1469 
1470  basegfx::B2DHomMatrix aTransformation;
1471 
1472  if(nMarkCount > 1)
1473  {
1474  // multiple objects, range is collected in aRect
1476  aRect.Left(), aRect.Top(),
1477  aRect.getWidth(), aRect.getHeight());
1478  }
1479  else
1480  {
1481  // single object, get homogen transformation
1482  basegfx::B2DPolyPolygon aPolyPolygon;
1483 
1484  pObj->TRGetBaseGeometry(aTransformation, aPolyPolygon);
1485  }
1486 
1487  if(aTransformation.isIdentity())
1488  {
1489  aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_MATRIX);
1490  }
1491  else
1492  {
1493  css::geometry::AffineMatrix2D aAffineMatrix2D;
1494  Point aPageOffset(0, 0);
1495 
1496  if(GetSdrPageView())
1497  {
1498  aPageOffset = GetSdrPageView()->GetPageOrigin();
1499  }
1500 
1501  aAffineMatrix2D.m00 = aTransformation.get(0, 0);
1502  aAffineMatrix2D.m01 = aTransformation.get(0, 1);
1503  aAffineMatrix2D.m02 = aTransformation.get(0, 2) - aPageOffset.X();
1504  aAffineMatrix2D.m10 = aTransformation.get(1, 0);
1505  aAffineMatrix2D.m11 = aTransformation.get(1, 1);
1506  aAffineMatrix2D.m12 = aTransformation.get(1, 2) - aPageOffset.Y();
1507 
1508  aRetSet.Put(AffineMatrixItem(&aAffineMatrix2D));
1509  }
1510  }
1511 
1512  return aRetSet;
1513 }
1514 
1515 static Point ImpGetPoint(const tools::Rectangle& rRect, RectPoint eRP)
1516 {
1517  switch(eRP) {
1518  case RectPoint::LT: return rRect.TopLeft();
1519  case RectPoint::MT: return rRect.TopCenter();
1520  case RectPoint::RT: return rRect.TopRight();
1521  case RectPoint::LM: return rRect.LeftCenter();
1522  case RectPoint::MM: return rRect.Center();
1523  case RectPoint::RM: return rRect.RightCenter();
1524  case RectPoint::LB: return rRect.BottomLeft();
1525  case RectPoint::MB: return rRect.BottomCenter();
1526  case RectPoint::RB: return rRect.BottomRight();
1527  }
1528  return Point(); // Should not happen!
1529 }
1530 
1532 {
1533  const bool bTiledRendering = comphelper::LibreOfficeKit::isActive();
1534 
1536 
1537  if(GetSdrPageView())
1538  {
1539  GetSdrPageView()->LogicToPagePos(aRect);
1540  }
1541 
1542  long nOldRotateAngle=GetMarkedObjRotate();
1543  long nOldShearAngle=GetMarkedObjShear();
1544  const SdrMarkList& rMarkList=GetMarkedObjectList();
1545  const size_t nMarkCount=rMarkList.GetMarkCount();
1546  SdrObject* pObj=nullptr;
1547 
1548  RectPoint eSizePoint=RectPoint::MM;
1549  long nPosDX=0;
1550  long nPosDY=0;
1551  long nSizX=0;
1552  long nSizY=0;
1553  long nRotateAngle=0;
1554 
1555  bool bModeIsRotate(meDragMode == SdrDragMode::Rotate);
1556  long nRotateX(0);
1557  long nRotateY(0);
1558  long nOldRotateX(0);
1559  long nOldRotateY(0);
1560  if(bModeIsRotate)
1561  {
1562  Point aRotateAxe(maRef1);
1563 
1564  if(GetSdrPageView())
1565  {
1566  GetSdrPageView()->LogicToPagePos(aRotateAxe);
1567  }
1568 
1569  nRotateX = nOldRotateX = aRotateAxe.X();
1570  nRotateY = nOldRotateY = aRotateAxe.Y();
1571  }
1572 
1573  long nShearAngle=0;
1574  long nShearX=0;
1575  long nShearY=0;
1576  bool bShearVert=false;
1577 
1578  bool bChgPos=false;
1579  bool bChgSiz=false;
1580  bool bChgWdh=false;
1581  bool bChgHgt=false;
1582  bool bRotate=false;
1583  bool bShear =false;
1584 
1585  bool bSetAttr=false;
1586  SfxItemSet aSetAttr(mpModel->GetItemPool());
1587 
1588  const SfxPoolItem* pPoolItem=nullptr;
1589 
1590  // position
1591  if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_POS_X,true,&pPoolItem)) {
1592  nPosDX=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue() - aRect.Left();
1593  bChgPos=true;
1594  }
1595  if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_POS_Y,true,&pPoolItem)){
1596  nPosDY=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue() - aRect.Top();
1597  bChgPos=true;
1598  }
1599  // size
1600  if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_WIDTH,true,&pPoolItem)) {
1601  nSizX=static_cast<const SfxUInt32Item*>(pPoolItem)->GetValue();
1602  bChgSiz=true;
1603  bChgWdh=true;
1604  }
1605  if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_HEIGHT,true,&pPoolItem)) {
1606  nSizY=static_cast<const SfxUInt32Item*>(pPoolItem)->GetValue();
1607  bChgSiz=true;
1608  bChgHgt=true;
1609  }
1610  if (bChgSiz) {
1611  if (bTiledRendering && SfxItemState::SET != rAttr.GetItemState(SID_ATTR_TRANSFORM_SIZE_POINT, true, &pPoolItem))
1612  eSizePoint = RectPoint::LT;
1613  else
1614  eSizePoint = static_cast<RectPoint>(rAttr.Get(SID_ATTR_TRANSFORM_SIZE_POINT).GetValue());
1615  }
1616 
1617  // rotation
1618  if (SfxItemState::SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_DELTA_ANGLE, true, &pPoolItem)) {
1619  nRotateAngle = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
1620  bRotate = (nRotateAngle != 0);
1621  }
1622 
1623  // rotation
1624  if (SfxItemState::SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_ANGLE, true, &pPoolItem)) {
1625  nRotateAngle = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue() - nOldRotateAngle;
1626  bRotate = (nRotateAngle != 0);
1627  }
1628 
1629  // position rotation point x
1630  if(bRotate || SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_ROT_X, true ,&pPoolItem))
1631  nRotateX = rAttr.Get(SID_ATTR_TRANSFORM_ROT_X).GetValue();
1632 
1633  // position rotation point y
1634  if(bRotate || SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_ROT_Y, true ,&pPoolItem))
1635  nRotateY = rAttr.Get(SID_ATTR_TRANSFORM_ROT_Y).GetValue();
1636 
1637  // shearing
1638  if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_SHEAR,true,&pPoolItem)) {
1639  long nNewShearAngle=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
1640  if (nNewShearAngle>SDRMAXSHEAR) nNewShearAngle=SDRMAXSHEAR;
1641  if (nNewShearAngle<-SDRMAXSHEAR) nNewShearAngle=-SDRMAXSHEAR;
1642  if (nNewShearAngle!=nOldShearAngle) {
1643  bShearVert=static_cast<const SfxBoolItem&>(rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_VERTICAL)).GetValue();
1644  if (bShearVert) {
1645  nShearAngle=nNewShearAngle;
1646  } else {
1647  if (nNewShearAngle!=0 && nOldShearAngle!=0) {
1648  // bug fix
1649  double nOld = tan(static_cast<double>(nOldShearAngle) * F_PI18000);
1650  double nNew = tan(static_cast<double>(nNewShearAngle) * F_PI18000);
1651  nNew-=nOld;
1652  nNew = atan(nNew) / F_PI18000;
1653  nShearAngle=FRound(nNew);
1654  } else {
1655  nShearAngle=nNewShearAngle-nOldShearAngle;
1656  }
1657  }
1658  bShear=nShearAngle!=0;
1659  if (bShear) {
1660  nShearX=static_cast<const SfxInt32Item&>(rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_X)).GetValue();
1661  nShearY=static_cast<const SfxInt32Item&>(rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_Y)).GetValue();
1662  }
1663  }
1664  }
1665 
1666  // AutoGrow
1667  if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_AUTOWIDTH,true,&pPoolItem)) {
1668  bool bAutoGrow=static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
1669  aSetAttr.Put(makeSdrTextAutoGrowWidthItem(bAutoGrow));
1670  bSetAttr=true;
1671  }
1672 
1673  if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_AUTOHEIGHT,true,&pPoolItem)) {
1674  bool bAutoGrow=static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
1675  aSetAttr.Put(makeSdrTextAutoGrowHeightItem(bAutoGrow));
1676  bSetAttr=true;
1677  }
1678 
1679  // corner radius
1680  if (m_bEdgeRadiusAllowed && SfxItemState::SET==rAttr.GetItemState(SDRATTR_ECKENRADIUS,true,&pPoolItem)) {
1681  long nRadius=static_cast<const SdrMetricItem*>(pPoolItem)->GetValue();
1682  aSetAttr.Put(makeSdrEckenradiusItem(nRadius));
1683  bSetAttr=true;
1684  }
1685 
1687 
1688  BegUndo(SvxResId(STR_EditTransform),GetDescriptionOfMarkedObjects());
1689 
1690  if (bSetAttr) {
1691  SetAttrToMarked(aSetAttr,false);
1692  }
1693 
1694  // change size and height
1695  if (bChgSiz && (m_bResizeFreeAllowed || m_bResizePropAllowed)) {
1696  Fraction aWdt(nSizX,aRect.Right()-aRect.Left());
1697  Fraction aHgt(nSizY,aRect.Bottom()-aRect.Top());
1698  Point aRef(ImpGetPoint(aRect,eSizePoint));
1699 
1700  if(GetSdrPageView())
1701  {
1702  GetSdrPageView()->PagePosToLogic(aRef);
1703  }
1704 
1705  ResizeMultMarkedObj(aRef, aWdt, aHgt, bChgWdh, bChgHgt);
1706  }
1707 
1708  // rotate
1709  if (bRotate && (m_bRotateFreeAllowed || m_bRotate90Allowed)) {
1710  Point aRef(nRotateX,nRotateY);
1711 
1712  if(GetSdrPageView())
1713  {
1714  GetSdrPageView()->PagePosToLogic(aRef);
1715  }
1716 
1717  RotateMarkedObj(aRef,nRotateAngle);
1718  }
1719 
1720  // set rotation point position
1721  if(bModeIsRotate && (nRotateX != nOldRotateX || nRotateY != nOldRotateY))
1722  {
1723  Point aNewRef1(nRotateX, nRotateY);
1724 
1725  if(GetSdrPageView())
1726  {
1727  GetSdrPageView()->PagePosToLogic(aNewRef1);
1728  }
1729 
1730  SetRef1(aNewRef1);
1731  }
1732 
1733  // shear
1734  if (bShear && m_bShearAllowed) {
1735  Point aRef(nShearX,nShearY);
1736 
1737  if(GetSdrPageView())
1738  {
1739  GetSdrPageView()->PagePosToLogic(aRef);
1740  }
1741 
1742  ShearMarkedObj(aRef,nShearAngle,bShearVert);
1743 
1744  // #i74358#
1745  // ShearMarkedObj creates a linear combination of the existing transformation and
1746  // the new shear to apply. If the object is already transformed (e.g. rotated) the
1747  // linear combination will not decompose to the same start values again, but to a
1748  // new combination. Thus it makes no sense to check if the wanted shear is reached
1749  // or not. Taking out.
1750  }
1751 
1752  // change position
1753  if (bChgPos && m_bMoveAllowed) {
1754  MoveMarkedObj(Size(nPosDX,nPosDY));
1755  }
1756 
1757  // protect position
1758  if(SfxItemState::SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_PROTECT_POS, true, &pPoolItem))
1759  {
1760  const bool bProtPos(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
1761  bool bChanged(false);
1762 
1763  for(size_t i = 0; i < nMarkCount; ++i)
1764  {
1765  pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1766 
1767  if(pObj->IsMoveProtect() != bProtPos)
1768  {
1769  bChanged = true;
1770  pObj->SetMoveProtect(bProtPos);
1771 
1772  if(bProtPos)
1773  {
1774  pObj->SetResizeProtect(true);
1775  }
1776  }
1777  }
1778 
1779  if(bChanged)
1780  {
1781  m_bMoveProtect = bProtPos;
1782 
1783  if(bProtPos)
1784  {
1785  m_bResizeProtect = true;
1786  }
1787 
1788  // #i77187# there is no simple method to get the toolbars updated
1789  // in the application. The App is listening to selection change and i
1790  // will use it here (even if not true). It's acceptable since changing
1791  // this model data is pretty rare and only possible using the F4 dialog
1793  }
1794  }
1795 
1796  if(!m_bMoveProtect)
1797  {
1798  // protect size
1799  if(SfxItemState::SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_PROTECT_SIZE, true, &pPoolItem))
1800  {
1801  const bool bProtSize(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
1802  bool bChanged(false);
1803 
1804  for(size_t i = 0; i < nMarkCount; ++i)
1805  {
1806  pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1807 
1808  if(pObj->IsResizeProtect() != bProtSize)
1809  {
1810  bChanged = true;
1811  pObj->SetResizeProtect(bProtSize);
1812  }
1813  }
1814 
1815  if(bChanged)
1816  {
1817  m_bResizeProtect = bProtSize;
1818 
1819  // #i77187# see above
1821  }
1822  }
1823  }
1824 
1825  EndUndo();
1826 }
1827 
1828 
1830 { // at least two selected objects, at least one of them movable
1832  const size_t nCount=GetMarkedObjectCount();
1833  if (nCount==0) return false; // nothing selected!
1834  if (nCount==1) return m_bMoveAllowed; // align single object to page
1835  return m_bOneOrMoreMovable; // otherwise: MarkCount>=2
1836 }
1837 
1839 {
1840  if (eHor==SdrHorAlign::NONE && eVert==SdrVertAlign::NONE)
1841  return;
1842 
1844  if (!GetMarkedObjectCount())
1845  return;
1846 
1847  const bool bUndo = IsUndoEnabled();
1848  if( bUndo )
1849  {
1851  OUString aStr(GetDescriptionOfMarkedObjects());
1852  if (eHor==SdrHorAlign::NONE)
1853  {
1854  switch (eVert)
1855  {
1856  case SdrVertAlign::Top:
1857  aStr = ImpGetDescriptionString(STR_EditAlignVTop);
1858  break;
1859  case SdrVertAlign::Bottom:
1860  aStr = ImpGetDescriptionString(STR_EditAlignVBottom);
1861  break;
1862  case SdrVertAlign::Center:
1863  aStr = ImpGetDescriptionString(STR_EditAlignVCenter);
1864  break;
1865  default: break;
1866  }
1867  }
1868  else if (eVert==SdrVertAlign::NONE)
1869  {
1870  switch (eHor)
1871  {
1872  case SdrHorAlign::Left:
1873  aStr = ImpGetDescriptionString(STR_EditAlignHLeft);
1874  break;
1875  case SdrHorAlign::Right:
1876  aStr = ImpGetDescriptionString(STR_EditAlignHRight);
1877  break;
1878  case SdrHorAlign::Center:
1879  aStr = ImpGetDescriptionString(STR_EditAlignHCenter);
1880  break;
1881  default: break;
1882  }
1883  }
1884  else if (eHor==SdrHorAlign::Center && eVert==SdrVertAlign::Center)
1885  {
1886  aStr = ImpGetDescriptionString(STR_EditAlignCenter);
1887  }
1888  else
1889  {
1890  aStr = ImpGetDescriptionString(STR_EditAlign);
1891  }
1892  BegUndo(aStr);
1893  }
1894 
1895  tools::Rectangle aBound;
1896  const size_t nMarkCount=GetMarkedObjectCount();
1897  bool bHasFixed=false;
1898  for (size_t nm=0; nm<nMarkCount; ++nm)
1899  {
1900  SdrMark* pM=GetSdrMarkByIndex(nm);
1901  SdrObject* pObj=pM->GetMarkedSdrObj();
1902  SdrObjTransformInfoRec aInfo;
1903  pObj->TakeObjInfo(aInfo);
1904  if (!aInfo.bMoveAllowed || pObj->IsMoveProtect())
1905  {
1906  tools::Rectangle aObjRect(pObj->GetSnapRect());
1907  aBound.Union(aObjRect);
1908  bHasFixed=true;
1909  }
1910  }
1911  if (!bHasFixed)
1912  {
1913  if (nMarkCount==1)
1914  { // align single object to page
1915  const SdrObject* pObj=GetMarkedObjectByIndex(0);
1916  const SdrPage* pPage=pObj->getSdrPageFromSdrObject();
1918  const SdrPageGridFrame* pFrame=nullptr;
1919  if (pGFL!=nullptr && pGFL->GetCount()!=0)
1920  { // Writer
1921  pFrame=&((*pGFL)[0]);
1922  }
1923 
1924  if (pFrame!=nullptr)
1925  { // Writer
1926  aBound=pFrame->GetUserArea();
1927  }
1928  else
1929  {
1930  aBound=tools::Rectangle(pPage->GetLeftBorder(),pPage->GetUpperBorder(),
1931  pPage->GetWidth()-pPage->GetRightBorder(),
1932  pPage->GetHeight()-pPage->GetLowerBorder());
1933  }
1934  }
1935  else
1936  {
1937  aBound=GetMarkedObjRect();
1938  }
1939  }
1940  Point aCenter(aBound.Center());
1941  for (size_t nm=0; nm<nMarkCount; ++nm)
1942  {
1943  SdrMark* pM=GetSdrMarkByIndex(nm);
1944  SdrObject* pObj=pM->GetMarkedSdrObj();
1945  SdrObjTransformInfoRec aInfo;
1946  pObj->TakeObjInfo(aInfo);
1947  if (aInfo.bMoveAllowed && !pObj->IsMoveProtect())
1948  {
1949  long nXMov=0;
1950  long nYMov=0;
1951  tools::Rectangle aObjRect(pObj->GetSnapRect());
1952  switch (eVert)
1953  {
1954  case SdrVertAlign::Top : nYMov=aBound.Top() -aObjRect.Top() ; break;
1955  case SdrVertAlign::Bottom: nYMov=aBound.Bottom()-aObjRect.Bottom() ; break;
1956  case SdrVertAlign::Center: nYMov=aCenter.Y() -aObjRect.Center().Y(); break;
1957  default: break;
1958  }
1959  switch (eHor)
1960  {
1961  case SdrHorAlign::Left : nXMov=aBound.Left() -aObjRect.Left() ; break;
1962  case SdrHorAlign::Right : nXMov=aBound.Right() -aObjRect.Right() ; break;
1963  case SdrHorAlign::Center: nXMov=aCenter.X() -aObjRect.Center().X(); break;
1964  default: break;
1965  }
1966  if (nXMov!=0 || nYMov!=0)
1967  {
1968  // SdrEdgeObj needs an extra SdrUndoGeoObj since the
1969  // connections may need to be saved
1970  if( bUndo )
1971  {
1972  if( dynamic_cast<SdrEdgeObj*>(pObj) )
1973  {
1974  AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
1975  }
1976 
1977  AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pObj,Size(nXMov,nYMov)));
1978  }
1979 
1980  pObj->Move(Size(nXMov,nYMov));
1981  }
1982  }
1983  }
1984 
1985  if( bUndo )
1986  EndUndo();
1987 }
1988 
1989 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point TopLeft() const
long getHeight() const
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_AUTOGROWHEIGHT(SDRATTR_MISC_FIRST+2)
XPropertyListType t
Definition: xtable.cxx:370
long GetMarkedObjRotate() const
Definition: svdedtv1.cxx:283
long GetWidth() const
constexpr TypedWhichId< SdrHorzShearAllItem > SDRATTR_HORZSHEARALL(SDRATTR_NOTPERSIST_FIRST+28)
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const
Definition: svdobj.cxx:563
bool SearchOutlinerItems(const SfxItemSet &rSet, bool bInklDefaults, bool *pbOnlyEE)
Search an ItemSet for Outliner/EditEngine Items.
Definition: svdetc.cxx:348
constexpr TypedWhichId< SdrPercentItem > SDRATTR_SHADOWTRANSPARENCE(SDRATTR_SHADOW_FIRST+4)
void MirrorMarkedObj(const Point &rRef1, const Point &rRef2, bool bCopy=false)
Definition: svdedtv1.cxx:368
void RemoveOutlinerCharacterAttribs(const std::vector< sal_uInt16 > &rCharWhichIds)
iterates over the paragraphs of a given SdrObject and removes all hard set character attributes with ...
Definition: svdotxat.cxx:373
bool bVisible
size_t GetMarkCount() const
Definition: svdmark.hxx:180
long GetHeight() const
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true)
Definition: svdobj.cxx:1484
constexpr TypedWhichId< SdrResizeXAllItem > SDRATTR_RESIZEXALL(SDRATTR_NOTPERSIST_FIRST+25)
void SetStyleSheet(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr)
Definition: svdpntv.cxx:1007
#define SDRMAXSHEAR
Definition: svdtrans.hxx:46
void SortMarkedObjects() const
Definition: svdmrkv.hxx:259
constexpr sal_uInt16 EE_FEATURE_TAB(EE_FEATURE_START+0)
void AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert)
Definition: svdedtv1.cxx:1838
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr) const
Definition: svdedtv1.cxx:1315
void SetResizeProtect(bool bProt)
Definition: svdobj.cxx:2568
void SetPoint(const Point &rPnt, sal_uInt32 i)
Definition: svdobj.cxx:1675
long FRound(double fVal)
sal_Int32 GetHeight() const
Definition: svdpage.cxx:1393
constexpr TypedWhichId< SdrTransformRef1XItem > SDRATTR_TRANSFORMREF1X(SDRATTR_NOTPERSIST_FIRST+30)
for the snap-to-grid in Writer
Definition: svdpage.hxx:280
std::string GetValue
void SetNotPersistAttrToMarked(const SfxItemSet &rAttr)
Definition: svdedtv1.cxx:699
virtual bool IsPolyObj() const
Definition: svdobj.cxx:1660
constexpr TypedWhichId< SdrAllSizeWidthItem > SDRATTR_ALLSIZEWIDTH(SDRATTR_NOTPERSIST_FIRST+8)
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_AUTOGROWWIDTH(SDRATTR_MISC_FIRST+12)
Point BottomLeft() const
bool m_bShearAllowed
Definition: svdedtv.hxx:105
long getWidth() const
bool isAnimatedInAnyViewObjectContact() const
bool AreObjectsMarked() const
Definition: svdmrkv.hxx:260
bool IsUndoEnabled() const
Definition: svdedtv.cxx:1027
void MirrorMarkedObjHorizontal()
Definition: svdedtv1.cxx:432
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_CONTOURFRAME(SDRATTR_MISC_FIRST+21)
void SetGeoAttrToMarked(const SfxItemSet &rAttr)
Definition: svdedtv1.cxx:1531
void MergeValue(const SfxPoolItem &rItem, bool bOverwriteDefaults=false)
void ForcePossibilities() const
Definition: svdedtv.hxx:162
void ResizeMultMarkedObj(const Point &rRef, const Fraction &xFact, const Fraction &yFact, const bool bWdh, const bool bHgt)
Definition: svdedtv1.cxx:247
void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr)
Definition: svdobj.cxx:2145
constexpr TypedWhichId< XLineWidthItem > XATTR_LINEWIDTH(XATTR_LINE_FIRST+2)
bool m_bResizeProtect
Definition: svdedtv.hxx:114
static void ImpDistortObj(SdrObject *pO, const tools::Rectangle &rRef, const XPolygon &rDistortedRect, bool bNoContortion)
Definition: svdedtv1.cxx:624
sal_Int64 n
sal_Int32 GetRightBorder() const
Definition: svdpage.cxx:1478
void MirrorMarkedObjVertical()
Definition: svdedtv1.cxx:440
void InvalidateItem(sal_uInt16 nWhich)
void BegUndo()
Definition: svdedtv.hxx:179
sal_uInt16 FirstWhich()
const tools::Rectangle & GetUserArea() const
Definition: svdpage.hxx:287
SdrPageView * GetSdrPageViewOfMarkedByIndex(size_t nNum) const
Definition: svdmrkv.hxx:255
const SfxBroadcaster * GetBroadcaster() const
Definition: svdobj.cxx:627
SdrMark * GetMark(size_t nNum) const
Definition: svdmark.cxx:229
std::vector< std::unique_ptr< SdrUndoAction > > CreateConnectorUndo(SdrObject &rO)
Definition: svdedtv1.cxx:149
constexpr TypedWhichId< SfxUInt32Item > SDRATTR_3DOBJ_DEPTH(SDRATTR_3DOBJ_FIRST+2)
void MergeAttrFromMarked(SfxItemSet &rAttr, bool bOnlyHardAttr) const
Definition: svdedtv1.cxx:908
void EndTextEditAllViews() const
Checks if this or other views have an active text edit, if true, end them.
Definition: svdedtv.cxx:1032
virtual sal_uInt32 GetPointCount() const
Definition: svdobj.cxx:1665
sal_Int32 GetLowerBorder() const
Definition: svdpage.cxx:1483
void PagePosToLogic(Point &rPnt) const
Definition: svdpagv.hxx:212
Center
virtual SdrObjList * GetSubList() const
Definition: svdobj.cxx:647
sal_Int32 GetLeftBorder() const
Definition: svdpage.cxx:1468
double CrookRotateXPoint(Point &rPnt, Point *pC1, Point *pC2, const Point &rCenter, const Point &rRad, double &rSin, double &rCos, bool bVert)
The following methods accept a point of an XPolygon, whereas the neighbouring control points of the a...
Definition: svdtrans.cxx:162
virtual void Rotate(const Point &rRef, long nAngle, double sn, double cs)
Definition: svdobj.cxx:1511
static Point ImpGetPoint(const tools::Rectangle &rRect, RectPoint eRP)
Definition: svdedtv1.cxx:1515
sdr::contact::ViewContact & GetViewContact() const
Definition: svdobj.cxx:245
sal_uInt16 NextWhich()
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
Definition: sdtagitm.hxx:25
double get(sal_uInt16 nRow, sal_uInt16 nColumn) const
const tools::Rectangle & GetMarkedObjRect() const
Definition: svdmrkv.cxx:2410
void Move(long nHorzMoveDelta, long nVertMoveDelta)
Point RightCenter() const
virtual const tools::Rectangle & GetSnapRect() const
Definition: svdobj.cxx:1597
SfxItemSet GetGeoAttrFromMarked() const
Definition: svdedtv1.cxx:1355
bool IsVisible() const
Definition: svdobj.hxx:805
bool IsEmpty() const
SdrModel * mpModel
Definition: svdpntv.hxx:132
constexpr TypedWhichId< XLineTransparenceItem > XATTR_LINETRANSPARENCE(XATTR_LINE_FIRST+10)
bool m_bMoveProtect
Definition: svdedtv.hxx:113
Provides information about various ZObject properties.
Definition: svdobj.hxx:248
constexpr TypedWhichId< SfxUInt32Item > SDRATTR_3DSCENE_DISTANCE(SDRATTR_3DSCENE_FIRST+1)
void SetAttrToMarked(const SfxItemSet &rAttr, bool bReplaceAll)
Definition: svdedtv1.cxx:1046
const SfxPoolItem * NextItem()
SdrCrookMode
Definition: svdsnpv.hxx:83
long Right() const
void LogicToPagePos(Point &rPnt) const
Definition: svdpagv.hxx:210
void CrookRotatePoly(XPolygon &rPoly, const Point &rCenter, const Point &rRad, bool bVert)
Definition: svdtrans.cxx:291
void RotateMarkedObj(const Point &rRef, long nAngle, bool bCopy=false)
Definition: svdedtv1.cxx:312
bool IsMore() const
Definition: svditer.hxx:62
SdrPage * getSdrPageFromSdrObject() const
Definition: svdobj.cxx:263
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
double CrookStretchXPoint(Point &rPnt, Point *pC1, Point *pC2, const Point &rCenter, const Point &rRad, double &rSin, double &rCos, bool bVert, const tools::Rectangle &rRefRect)
Definition: svdtrans.cxx:271
#define X
constexpr TypedWhichId< SdrAllPositionYItem > SDRATTR_ALLPOSITIONY(SDRATTR_NOTPERSIST_FIRST+7)
Point BottomCenter() const
int nCount
tools::Rectangle aMarkRect
Definition: svddrgm1.hxx:142
void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
SfxStyleSheet * GetStyleSheet() const
Definition: svdobj.cxx:2140
void DistortMarkedObj(const tools::Rectangle &rRef, const XPolygon &rDistortedRect, bool bNoContortion, bool bCopy=false)
Definition: svdedtv1.cxx:658
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
long Top() const
bool IsRotateAllowed(bool b90Deg=false) const
Definition: svdedtv.cxx:371
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
Definition: sdtagitm.hxx:29
const Point & GetPageOrigin() const
The Origin always refers to the upper left corner of the Page.
Definition: svdpagv.hxx:207
Point LeftCenter() const
void SetMoveProtect(bool bProt)
Definition: svdobj.cxx:2557
Point maRef1
Definition: svdmrkv.hxx:106
SfxStyleSheet * GetStyleSheet() const
Definition: svdedtv1.cxx:1336
void SetAttributes(const SfxItemSet &rSet, bool bReplaceAll)
Definition: svdedtv1.cxx:1327
virtual SdrObject * GetConnectedNode(bool bTail1) const
Definition: svdobj.cxx:2267
void EndUndo()
Definition: svdedtv.cxx:275
SdrVertAlign
Definition: svdedtv.hxx:44
SdrObject * GetMarkedSdrObj() const
Definition: svdmark.hxx:68
Point BottomRight() const
Everything a View needs to know about a selected object.
Definition: svdmark.hxx:44
SfxStyleSheet * GetStyleSheet() const
Definition: svdpntv.cxx:1002
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr) const
Definition: svdpntv.cxx:982
SdrDragMode meDragMode
Definition: svdmrkv.hxx:119
RectPoint
Definition: rectenum.hxx:22
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
Definition: svdedtv.hxx:183
std::vector< sal_uInt16 > GetAllCharPropIds(const SfxItemSet &rSet)
Definition: svdedtv1.cxx:1028
void CopyMarkedObj()
Definition: svdedtv.cxx:879
void CrookStretchPoly(XPolygon &rPoly, const Point &rCenter, const Point &rRad, bool bVert, const tools::Rectangle &rRefRect)
Definition: svdtrans.cxx:337
virtual const SdrPageGridFrameList * GetGridFrameList(const SdrPageView *pPV, const tools::Rectangle *pRect) const
for snap-to-grid in Writer, also for AlignObjects if 1 object is marked if pRect != null...
Definition: svdpage.cxx:1619
long GetMarkedObjShear() const
Definition: svdedtv1.cxx:448
virtual void MarkListHasChanged() override
Definition: svdedtv.cxx:351
constexpr TypedWhichId< SdrResizeYAllItem > SDRATTR_RESIZEYALL(SDRATTR_NOTPERSIST_FIRST+26)
constexpr TypedWhichId< XLineStartWidthItem > XATTR_LINESTARTWIDTH(XATTR_LINE_FIRST+6)
constexpr TypedWhichId< XFillTransparenceItem > XATTR_FILLTRANSPARENCE(XATTR_FILL_FIRST+5)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
int i
void ResizeMarkedObj(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bCopy=false)
Definition: svdedtv1.cxx:216
void SetPathPoly(const basegfx::B2DPolyPolygon &rPathPoly)
Definition: svdopath.cxx:2738
uno_Any a
SdrMetricItem makeSdrEckenradiusItem(long nRadius)
Definition: sderitm.hxx:25
constexpr TypedWhichId< SdrTransformRef2YItem > SDRATTR_TRANSFORMREF2Y(SDRATTR_NOTPERSIST_FIRST+33)
size_t GetMarkedObjectCount() const
Definition: svdmrkv.hxx:258
void MergeNotPersistAttrFromMarked(SfxItemSet &rAttr) const
Definition: svdedtv1.cxx:785
OUString const & GetDescriptionOfMarkedObjects() const
Definition: svdmrkv.hxx:261
constexpr TypedWhichId< XLineEndWidthItem > XATTR_LINEENDWIDTH(XATTR_LINE_FIRST+7)
bool m_bRotate90Allowed
Definition: svdedtv.hxx:101
sal_Int32 GetUpperBorder() const
Definition: svdpage.cxx:1473
void BroadcastObjectChange() const
Definition: svdobj.cxx:905
bool m_bRotateFreeAllowed
Definition: svdedtv.hxx:100
const SdrMarkList & GetMarkedObjectList() const
Definition: svdmrkv.hxx:252
void SetRight(long v)
bool IsPrintable() const
Definition: svdobj.hxx:803
void SetAttributes(const SfxItemSet &rSet, bool bReplaceAll)
Definition: svdpntv.cxx:997
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:1929
bool bVertical
Definition: svddrgm1.hxx:155
static void ImpCrookObj(SdrObject *pO, const Point &rRef, const Point &rRad, SdrCrookMode eMode, bool bVertical, bool bNoContortion, bool bRotate, const tools::Rectangle &rMarkRect)
Definition: svdedtv1.cxx:502
constexpr sal_uInt16 EE_CHAR_START(EE_PARA_END+1)
long Bottom() const
virtual long GetShearAngle(bool bVertical=false) const
Definition: svdobj.cxx:1645
virtual void Move(const Size &rSiz)
Definition: svdobj.cxx:1467
void SetMergedItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1899
bool isIdentity() const
bool IsResizeProtect() const
Definition: svdobj.hxx:801
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MINFRAMEHEIGHT(SDRATTR_MISC_FIRST+1)
constexpr TypedWhichId< SdrTransformRef2XItem > SDRATTR_TRANSFORMREF2X(SDRATTR_NOTPERSIST_FIRST+32)
constexpr sal_uInt16 EE_CHAR_END(EE_CHAR_START+32)
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:1924
constexpr sal_uInt16 EE_FEATURE_START(EE_CHAR_END+1)
Abstract DrawObject.
Definition: svdobj.hxx:312
virtual SfxViewShell * GetSfxViewShell() const
Get access to the view shell owning this draw view, if any.
Definition: svdmrkv.cxx:1607
constexpr sal_uInt16 EE_FEATURE_LINEBR(EE_FEATURE_TAB+1)
SfxItemPool * GetPool() const
constexpr TypedWhichId< SdrAllSizeHeightItem > SDRATTR_ALLSIZEHEIGHT(SDRATTR_NOTPERSIST_FIRST+9)
virtual void Mirror(const Point &rRef1, const Point &rRef2)
Definition: svdobj.cxx:1522
#define Y
void CrookMarkedObj(const Point &rRef, const Point &rRad, SdrCrookMode eMode, bool bVertical, bool bNoContortion, bool bCopy=false)
Definition: svdedtv1.cxx:580
void SetAnimationTimer(sal_uInt32 nTime)
Definition: svdpntv.cxx:1192
bool m_bResizeFreeAllowed
Definition: svdedtv.hxx:98
sal_uInt16 GetCount() const
Definition: svdpage.hxx:302
virtual SdrLayerID GetLayer() const
Definition: svdobj.cxx:577
constexpr TypedWhichId< SdrRotateAllItem > SDRATTR_ROTATEALL(SDRATTR_NOTPERSIST_FIRST+27)
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
void SetRef1(const Point &rPt)
Definition: svdmrkv.cxx:1585
Point aCenter
Definition: svddrgm1.hxx:144
constexpr sal_uInt16 EE_FEATURE_NOTCONV(EE_FEATURE_LINEBR+1)
void SetStyleSheetToMarked(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr)
Definition: svdedtv1.cxx:1280
virtual const tools::Rectangle & GetLastBoundRect() const
Definition: svdobj.cxx:868
SdrObject * Next()
Definition: svditer.hxx:63
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool IsAlignPossible() const
Definition: svdedtv1.cxx:1829
bool m_bMoveAllowed
Definition: svdedtv.hxx:97
void SetStyleSheet(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr)
Definition: svdedtv1.cxx:1345
SfxItemState
const Point & GetRef2() const
Definition: svdmrkv.hxx:441
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
tools::Rectangle & Union(const tools::Rectangle &rRect)
constexpr TypedWhichId< SfxUInt16Item > SDRATTR_3DOBJ_BACKSCALE(SDRATTR_3DOBJ_FIRST+1)
constexpr TypedWhichId< SdrVertShearAllItem > SDRATTR_VERTSHEARALL(SDRATTR_NOTPERSIST_FIRST+29)
OUString ImpGetDescriptionString(const char *pStrCacheID, ImpGetDescriptionOptions nOpt=ImpGetDescriptionOptions::NONE) const
Definition: svdmrkv.cxx:2430
bool m_bEdgeRadiusAllowed
Definition: svdedtv.hxx:106
void ShearMarkedObj(const Point &rRef, long nAngle, bool bVShear=false, bool bCopy=false)
Definition: svdedtv1.cxx:468
double CrookSlantXPoint(Point &rPnt, Point *pC1, Point *pC2, const Point &rCenter, const Point &rRad, double &rSin, double &rCos, bool bVert)
Definition: svdtrans.cxx:216
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1889
bool m_bResizePropAllowed
Definition: svdedtv.hxx:99
SfxStyleSheet * GetStyleSheetFromMarked() const
Definition: svdedtv1.cxx:1265
void SetBottom(long v)
#define F_PI18000
SfxItemSet GetAttrFromMarked(bool bOnlyHardAttr) const
Definition: svdedtv1.cxx:892
constexpr TypedWhichId< SfxUInt16Item > SDRATTR_3DOBJ_PERCENT_DIAGONAL(SDRATTR_3DOBJ_FIRST+0)
virtual long GetRotateAngle() const
Definition: svdobj.cxx:1640
void AddUndoActions(std::vector< std::unique_ptr< SdrUndoAction > >)
Definition: svdedtv1.cxx:176
SdrObject * GetMarkedObjectByIndex(size_t nNum) const
Definition: svdmrkv.hxx:257
long Left() const
const basegfx::B2DPolyPolygon & GetPathPoly() const
Definition: svdopath.hxx:139
SdrPageView * GetSdrPageView() const
Definition: svdpntv.hxx:310
Helper for 3d object changes affecting 2d geometry.
virtual void Shear(const Point &rRef, long nAngle, double tn, bool bVShear)
Definition: svdobj.cxx:1531
constexpr sal_uInt16 EE_FEATURE_END(EE_FEATURE_FIELD+0)
virtual void SetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1622
const sal_uInt16 * GetRanges() const
constexpr TypedWhichId< SdrTransformRef1YItem > SDRATTR_TRANSFORMREF1Y(SDRATTR_NOTPERSIST_FIRST+31)
SdrHorAlign
Definition: svdedtv.hxx:37
const SfxItemPool & GetItemPool() const
Definition: svdmodel.hxx:314
constexpr sal_uInt16 EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
constexpr TypedWhichId< SfxUInt32Item > SDRATTR_3DOBJ_END_ANGLE(SDRATTR_3DOBJ_FIRST+5)
virtual const tools::Rectangle & GetLogicRect() const
Definition: svdobj.cxx:1607
SdrMark * GetSdrMarkByIndex(size_t nNum) const
Definition: svdmrkv.hxx:256
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:365
sal_Int32 GetWidth() const
Definition: svdpage.cxx:1367
void CrookSlantPoly(XPolygon &rPoly, const Point &rCenter, const Point &rRad, bool bVert)
Definition: svdtrans.cxx:314
SdrCrookMode eMode
Definition: svddrgm1.hxx:164
void SetMarkedObjRect(const tools::Rectangle &rRect)
Definition: svdedtv1.cxx:76
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const
Definition: svdobj.cxx:2887
bool IsInvalidItem(const SfxPoolItem *pItem)
virtual void SetChanged()
Definition: svdobj.cxx:929
constexpr TypedWhichId< SdrMetricItem > SDRATTR_ECKENRADIUS(SDRATTR_MISC_FIRST+0)
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
constexpr TypedWhichId< XLineColorItem > XATTR_LINECOLOR(XATTR_LINE_FIRST+3)
virtual Point GetPoint(sal_uInt32 i) const
Definition: svdobj.cxx:1670
SdrModel * GetModel() const
Definition: svdpntv.hxx:271
void SetRef2(const Point &rPt)
Definition: svdmrkv.cxx:1596
aStr
Point TopRight() const
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
Definition: svdobj.cxx:2654
void ApplyNotPersistAttr(const SfxItemSet &rAttr)
Definition: svdobj.cxx:1934
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
constexpr TypedWhichId< SdrAllPositionXItem > SDRATTR_ALLPOSITIONX(SDRATTR_NOTPERSIST_FIRST+6)
Point Center() const
bool IsMoveProtect() const
Definition: svdobj.hxx:799
Point TopCenter() const
const SfxPoolItem * GetCurItem() const
void Distort(const tools::Rectangle &rRefRect, const XPolygon &rDistortedRect)
Distort a polygon by scaling its coordinates relative to a reference rectangle into an arbitrary rect...
Definition: _xpoly.cxx:928
Utility class SdrEdgeObj.
Definition: svdoedge.hxx:128
const Point & GetRef1() const
Definition: svdmrkv.hxx:437
bool m_bOneOrMoreMovable
Definition: svdedtv.hxx:94
void MoveMarkedObj(const Size &rSiz, bool bCopy=false)
Definition: svdedtv1.cxx:182