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