LibreOffice Module sw (master)  1
unodraw.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 
20 #include <memory>
21 #include <sal/config.h>
22 #include <sal/log.hxx>
23 
24 #include <cmdid.h>
25 #include <unomid.h>
26 
27 #include <drawdoc.hxx>
28 #include <unodraw.hxx>
29 #include <unocoll.hxx>
30 #include <unoframe.hxx>
31 #include <unoparagraph.hxx>
32 #include <unotextrange.hxx>
33 #include <svx/svditer.hxx>
34 #include <swunohelper.hxx>
35 #include <textboxhelper.hxx>
36 #include <doc.hxx>
37 #include <docary.hxx>
38 #include <IDocumentUndoRedo.hxx>
41 #include <fmtcntnt.hxx>
42 #include <fmtflcnt.hxx>
43 #include <txtatr.hxx>
44 #include <docsh.hxx>
45 #include <unomap.hxx>
46 #include <unoport.hxx>
47 #include <TextCursorHelper.hxx>
48 #include <dflyobj.hxx>
49 #include <ndtxt.hxx>
50 #include <svx/svdview.hxx>
51 #include <svx/unoshape.hxx>
52 #include <dcontact.hxx>
53 #include <svx/fmglob.hxx>
54 #include <fmtornt.hxx>
55 #include <fmtsrnd.hxx>
56 #include <fmtfollowtextflow.hxx>
57 #include <rootfrm.hxx>
58 #include <editeng/lrspitem.hxx>
59 #include <editeng/ulspitem.hxx>
60 #include <o3tl/any.hxx>
61 #include <o3tl/safeint.hxx>
63 #include <crstate.hxx>
64 #include <comphelper/extract.hxx>
67 #include <svx/scene3d.hxx>
68 #include <com/sun/star/beans/PropertyAttribute.hpp>
69 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
71 #include <com/sun/star/text/TextContentAnchorType.hpp>
73 #include <com/sun/star/drawing/PointSequence.hpp>
74 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
75 
76 using namespace ::com::sun::star;
77 
79 {
80  bool const m_isInReading;
81  std::unique_ptr<SwFormatHoriOrient> m_pHOrient;
82  std::unique_ptr<SwFormatVertOrient> m_pVOrient;
83  std::unique_ptr<SwFormatAnchor> m_pAnchor;
84  std::unique_ptr<SwFormatSurround> m_pSurround;
85  std::unique_ptr<SvxULSpaceItem> m_pULSpace;
86  std::unique_ptr<SvxLRSpaceItem> m_pLRSpace;
87  bool bOpaque;
88  uno::Reference< text::XTextRange > xTextRange;
89  // #i26791#
90  std::unique_ptr<SwFormatFollowTextFlow> m_pFollowTextFlow;
91  // #i28701#
92  std::unique_ptr<SwFormatWrapInfluenceOnObjPos> m_pWrapInfluenceOnObjPos;
93  // #i28749#
95 
98 
99 public:
101 
102 public:
103  SwShapeDescriptor_Impl(SwDoc const*const pDoc)
104  : m_isInReading(pDoc && pDoc->IsInReading())
105  // #i32349# - no defaults, in order to determine on
106  // adding a shape, if positioning attributes are set or not.
107  , bOpaque(false)
108  // #i26791#
109  , m_pFollowTextFlow( new SwFormatFollowTextFlow(false) )
110  // #i28701# #i35017#
111  , m_pWrapInfluenceOnObjPos( new SwFormatWrapInfluenceOnObjPos(
112  text::WrapInfluenceOnPosition::ONCE_CONCURRENT) )
113  // #i28749#
114  , mnPositionLayoutDir(text::PositionLayoutDir::PositionInLayoutDirOfAnchor)
115  , bInitializedPropertyNotifier(false)
116  {}
117 
118  SwFormatAnchor* GetAnchor(bool bCreate = false)
119  {
120  if (bCreate && !m_pAnchor)
121  {
122  m_pAnchor.reset(new SwFormatAnchor(RndStdIds::FLY_AS_CHAR));
123  }
124  return m_pAnchor.get();
125  }
126  SwFormatHoriOrient* GetHOrient(bool bCreate = false)
127  {
128  if (bCreate && !m_pHOrient)
129  {
130  // #i26791#
131  m_pHOrient.reset(new SwFormatHoriOrient(0, text::HoriOrientation::NONE, text::RelOrientation::FRAME));
132  }
133  return m_pHOrient.get();
134  }
135  SwFormatVertOrient* GetVOrient(bool bCreate = false)
136  {
137  if (bCreate && !m_pVOrient)
138  {
139  if (m_isInReading && // tdf#113938 extensions might rely on old default
140  (!GetAnchor(true) || m_pAnchor->GetAnchorId() == RndStdIds::FLY_AS_CHAR))
141  { // for as-char, NONE ("from-top") is not a good default
142  m_pVOrient.reset(new SwFormatVertOrient(0, text::VertOrientation::TOP, text::RelOrientation::FRAME));
143  }
144  else
145  { // #i26791#
146  m_pVOrient.reset(new SwFormatVertOrient(0, text::VertOrientation::NONE, text::RelOrientation::FRAME));
147  }
148  }
149  return m_pVOrient.get();
150  }
151 
152  SwFormatSurround* GetSurround(bool bCreate = false)
153  {
154  if (bCreate && !m_pSurround)
155  {
156  m_pSurround.reset(new SwFormatSurround());
157  }
158  return m_pSurround.get();
159  }
160  SvxLRSpaceItem* GetLRSpace(bool bCreate = false)
161  {
162  if (bCreate && !m_pLRSpace)
163  {
164  m_pLRSpace.reset(new SvxLRSpaceItem(RES_LR_SPACE));
165  }
166  return m_pLRSpace.get();
167  }
168  SvxULSpaceItem* GetULSpace(bool bCreate = false)
169  {
170  if (bCreate && !m_pULSpace)
171  {
172  m_pULSpace.reset(new SvxULSpaceItem(RES_UL_SPACE));
173  }
174  return m_pULSpace.get();
175  }
176  uno::Reference< text::XTextRange > & GetTextRange()
177  {
178  return xTextRange;
179  }
180  bool IsOpaque() const
181  {
182  return bOpaque;
183  }
184  const bool& GetOpaque() const
185  {
186  return bOpaque;
187  }
188  void RemoveHOrient() { m_pHOrient.reset(); }
189  void RemoveVOrient() { m_pVOrient.reset(); }
190  void RemoveAnchor() { m_pAnchor.reset(); }
191  void RemoveSurround() { m_pSurround.reset(); }
192  void RemoveULSpace() { m_pULSpace.reset(); }
193  void RemoveLRSpace() { m_pLRSpace.reset(); }
194  void SetOpaque(bool bSet){bOpaque = bSet;}
195 
196  // #i26791#
197  SwFormatFollowTextFlow* GetFollowTextFlow( bool _bCreate = false )
198  {
199  if (_bCreate && !m_pFollowTextFlow)
200  {
201  m_pFollowTextFlow.reset(new SwFormatFollowTextFlow(false));
202  }
203  return m_pFollowTextFlow.get();
204  }
206  {
207  m_pFollowTextFlow.reset();
208  }
209 
210  // #i28749#
211  sal_Int16 GetPositionLayoutDir() const
212  {
213  return mnPositionLayoutDir;
214  }
215  void SetPositionLayoutDir( sal_Int16 _nPositionLayoutDir )
216  {
217  switch ( _nPositionLayoutDir )
218  {
219  case text::PositionLayoutDir::PositionInHoriL2R:
220  case text::PositionLayoutDir::PositionInLayoutDirOfAnchor:
221  {
222  mnPositionLayoutDir = _nPositionLayoutDir;
223  }
224  break;
225  default:
226  {
227  OSL_FAIL( "<SwShapeDescriptor_Impl::SetPositionLayoutDir(..)> - invalid attribute value." );
228  }
229  }
230  }
231 
232  // #i28701#
234  const bool _bCreate = false )
235  {
236  if (_bCreate && !m_pWrapInfluenceOnObjPos)
237  {
238  m_pWrapInfluenceOnObjPos.reset(new SwFormatWrapInfluenceOnObjPos(
239  // #i35017#
240  text::WrapInfluenceOnPosition::ONCE_CONCURRENT));
241  }
242  return m_pWrapInfluenceOnObjPos.get();
243  }
245  {
246  m_pWrapInfluenceOnObjPos.reset();
247  }
248 };
249 
251  SvxFmDrawPage( pPage ), pPageView(nullptr)
252 {
253 }
254 
256 {
257  while (!m_vShapes.empty())
258  m_vShapes.back()->dispose();
259  RemovePageView();
260 }
261 
262 const SdrMarkList& SwFmDrawPage::PreGroup(const uno::Reference< drawing::XShapes > & xShapes)
263 {
264  SelectObjectsInView( xShapes, GetPageView() );
265  const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
266  return rMarkList;
267 }
268 
269 void SwFmDrawPage::PreUnGroup(const uno::Reference< drawing::XShapeGroup >& rShapeGroup)
270 {
271  SelectObjectInView( rShapeGroup, GetPageView() );
272 }
273 
275 {
276  if(!pPageView)
277  pPageView = mpView->ShowSdrPage( mpPage );
278  return pPageView;
279 }
280 
282 {
283  if(pPageView && mpView)
284  mpView->HideSdrPage();
285  pPageView = nullptr;
286 }
287 
288 uno::Reference<drawing::XShape> SwFmDrawPage::GetShape(SdrObject* pObj)
289 {
290  if(!pObj)
291  return nullptr;
292  SwFrameFormat* pFormat = ::FindFrameFormat( pObj );
293  SwFmDrawPage* pPage = dynamic_cast<SwFmDrawPage*>(pFormat);
294  if(!pPage || pPage->m_vShapes.empty())
295  return uno::Reference<drawing::XShape>(pObj->getUnoShape(), uno::UNO_QUERY);
296  for(auto pShape : pPage->m_vShapes)
297  {
298  SvxShape* pSvxShape = pShape->GetSvxShape();
299  if (pSvxShape && pSvxShape->GetSdrObject() == pObj)
300  return uno::Reference<drawing::XShape>(static_cast<::cppu::OWeakObject*>(pShape), uno::UNO_QUERY);
301  }
302  return nullptr;
303 }
304 
305 uno::Reference<drawing::XShapeGroup> SwFmDrawPage::GetShapeGroup(SdrObject* pObj)
306 {
307  return uno::Reference<drawing::XShapeGroup>(GetShape(pObj), uno::UNO_QUERY);
308 }
309 
310 uno::Reference< drawing::XShape > SwFmDrawPage::CreateShape( SdrObject *pObj ) const
311 {
312  uno::Reference< drawing::XShape > xRet;
313  if(dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr || pObj->GetObjInventor() == SdrInventor::Swg)
314  {
315  SwFlyDrawContact* pFlyContact = static_cast<SwFlyDrawContact*>(pObj->GetUserCall());
316  if(pFlyContact)
317  {
318  SwFrameFormat* pFlyFormat = pFlyContact->GetFormat();
319  SwDoc* pDoc = pFlyFormat->GetDoc();
320  const SwNodeIndex* pIdx;
321  if( RES_FLYFRMFMT == pFlyFormat->Which()
322  && nullptr != ( pIdx = pFlyFormat->GetContent().GetContentIdx() )
323  && pIdx->GetNodes().IsDocNodes()
324  )
325  {
326  const SwNode* pNd = pDoc->GetNodes()[ pIdx->GetIndex() + 1 ];
327  if(!pNd->IsNoTextNode())
328  {
329  xRet.set(SwXTextFrame::CreateXTextFrame(*pDoc, pFlyFormat),
330  uno::UNO_QUERY);
331  }
332  else if( pNd->IsGrfNode() )
333  {
335  *pDoc, pFlyFormat), uno::UNO_QUERY);
336  }
337  else if( pNd->IsOLENode() )
338  {
340  *pDoc, pFlyFormat), uno::UNO_QUERY);
341  }
342  }
343  else
344  {
345  OSL_FAIL( "<SwFmDrawPage::CreateShape(..)> - could not retrieve type. Thus, no shape created." );
346  return xRet;
347  }
348  }
349  }
350  else
351  {
352  // own block - temporary object has to be destroyed before
353  // the delegator is set #81670#
354  {
355  xRet = SvxFmDrawPage::CreateShape( pObj );
356  }
357  uno::Reference< XUnoTunnel > xShapeTunnel(xRet, uno::UNO_QUERY);
358  //don't create an SwXShape if it already exists
359  SwXShape* pShape = nullptr;
360  if(xShapeTunnel.is())
361  pShape = reinterpret_cast< SwXShape * >(
362  sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SwXShape::getUnoTunnelId()) ));
363  if(!pShape)
364  {
365  xShapeTunnel = nullptr;
366  uno::Reference< uno::XInterface > xCreate(xRet, uno::UNO_QUERY);
367  xRet = nullptr;
368  if ( pObj->IsGroupObject() && (!pObj->Is3DObj() || (dynamic_cast<const E3dScene*>( pObj) != nullptr)) )
369  pShape = new SwXGroupShape(xCreate, nullptr);
370  else
371  pShape = new SwXShape(xCreate, nullptr);
372  uno::Reference<beans::XPropertySet> xPrSet = pShape;
373  xRet.set(xPrSet, uno::UNO_QUERY);
374  }
375  const_cast<std::vector<SwXShape*>*>(&m_vShapes)->push_back(pShape);
376  pShape->m_pPage = this;
377  }
378  return xRet;
379 }
380 
381 namespace
382 {
383  class SwXShapesEnumeration
384  : public SwSimpleEnumeration_Base
385  {
386  private:
387  std::vector< css::uno::Any > m_aShapes;
388  protected:
389  virtual ~SwXShapesEnumeration() override {};
390  public:
391  explicit SwXShapesEnumeration(SwXDrawPage* const pDrawPage);
392 
393  //XEnumeration
394  virtual sal_Bool SAL_CALL hasMoreElements() override;
395  virtual uno::Any SAL_CALL nextElement() override;
396 
397  //XServiceInfo
398  virtual OUString SAL_CALL getImplementationName() override;
399  virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
400  virtual uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
401  };
402 }
403 
404 SwXShapesEnumeration::SwXShapesEnumeration(SwXDrawPage* const pDrawPage)
405  : m_aShapes()
406 {
407  SolarMutexGuard aGuard;
408  sal_Int32 nCount = pDrawPage->getCount();
409  m_aShapes.reserve(nCount);
410  for(sal_Int32 nIdx = 0; nIdx < nCount; nIdx++)
411  {
412  uno::Reference<drawing::XShape> xShape(pDrawPage->getByIndex(nIdx), uno::UNO_QUERY);
413  m_aShapes.push_back(uno::makeAny(xShape));
414  }
415 }
416 
417 sal_Bool SwXShapesEnumeration::hasMoreElements()
418 {
419  SolarMutexGuard aGuard;
420  return !m_aShapes.empty();
421 }
422 
423 uno::Any SwXShapesEnumeration::nextElement()
424 {
425  SolarMutexGuard aGuard;
426  if(m_aShapes.empty())
427  throw container::NoSuchElementException();
428  uno::Any aResult = m_aShapes.back();
429  m_aShapes.pop_back();
430  return aResult;
431 }
432 
433 OUString SwXShapesEnumeration::getImplementationName()
434 {
435  return "SwXShapeEnumeration";
436 }
437 
438 sal_Bool SwXShapesEnumeration::supportsService(const OUString& ServiceName)
439 {
440  return cppu::supportsService(this, ServiceName);
441 }
442 
443 uno::Sequence< OUString > SwXShapesEnumeration::getSupportedServiceNames()
444 {
445  return { OUString("com.sun.star.container.XEnumeration") };
446 }
447 
448 uno::Reference< container::XEnumeration > SwXDrawPage::createEnumeration()
449 {
450  SolarMutexGuard aGuard;
451  return uno::Reference< container::XEnumeration >(
452  new SwXShapesEnumeration(this));
453 }
454 
456 {
457  return "SwXDrawPage";
458 }
459 
460 sal_Bool SwXDrawPage::supportsService(const OUString& rServiceName)
461 {
462  return cppu::supportsService(this, rServiceName);
463 }
464 
465 uno::Sequence< OUString > SwXDrawPage::getSupportedServiceNames()
466 {
467  uno::Sequence<OUString> aRet { "com.sun.star.drawing.GenericDrawPage" };
468  return aRet;
469 }
470 
472  pDoc(pDc),
473  pDrawPage(nullptr)
474 {
475 }
476 
478 {
479  if(xPageAgg.is())
480  {
481  uno::Reference< uno::XInterface > xInt;
482  xPageAgg->setDelegator(xInt);
483  }
484 }
485 
487 {
489  if(!aRet.hasValue())
490  {
491  // secure with checking if page exists. This may not be the case
492  // either for new SW docs with no yet graphics usage or when
493  // the doc is closed and someone else still holds a UNO reference
494  // to the XDrawPage (in that case, pDoc is set to 0)
495  SwFmDrawPage* pPage = GetSvxPage();
496 
497  if(pPage)
498  {
499  aRet = pPage->queryAggregation(aType);
500  }
501  }
502  return aRet;
503 }
504 
505 uno::Sequence< uno::Type > SwXDrawPage::getTypes()
506 {
509  GetSvxPage()->getTypes(),
510  uno::Sequence { cppu::UnoType<form::XFormsSupplier2>::get() });
511 }
512 
514 {
515  SolarMutexGuard aGuard;
516  if(!pDoc)
517  throw uno::RuntimeException();
519  return 0;
520  else
521  {
522  GetSvxPage();
523  return SwTextBoxHelper::getCount(pDrawPage->GetSdrPage());
524  }
525 }
526 
528 {
529  SolarMutexGuard aGuard;
530  if(!pDoc)
531  throw uno::RuntimeException();
533  throw lang::IndexOutOfBoundsException();
534 
535  GetSvxPage();
536  return SwTextBoxHelper::getByIndex(pDrawPage->GetSdrPage(), nIndex);
537 }
538 
540 {
542 }
543 
545 {
546  SolarMutexGuard aGuard;
547  if(!pDoc)
548  throw uno::RuntimeException();
550  return false;
551  else
552  return GetSvxPage()->hasElements();
553 }
554 
555 void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
556 {
557  SolarMutexGuard aGuard;
558  if(!pDoc)
559  throw uno::RuntimeException();
560  uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShape, uno::UNO_QUERY);
561  SwXShape* pShape = nullptr;
562  SvxShape* pSvxShape = nullptr;
563  if(xShapeTunnel.is())
564  {
565  pShape = reinterpret_cast< SwXShape * >(
566  sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SwXShape::getUnoTunnelId()) ));
567  pSvxShape = reinterpret_cast< SvxShape * >(
568  sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
569  }
570 
571  // this is not a writer shape
572  if(!pShape)
573  throw uno::RuntimeException("illegal object",
574  static_cast< cppu::OWeakObject * > ( this ) );
575 
576  // we're already registered in the model / SwXDrawPage::add() already called
577  if(pShape->m_pPage || pShape->m_pFormat || !pShape->m_bDescriptor )
578  return;
579 
580  // we're inserted elsewhere already
581  if ( pSvxShape->GetSdrObject() )
582  {
583  if ( pSvxShape->GetSdrObject()->IsInserted() )
584  {
585  return;
586  }
587  }
588  GetSvxPage()->add(xShape);
589 
590  OSL_ENSURE(pSvxShape, "Why is here no SvxShape?");
591  // this position is definitely in 1/100 mm
592  awt::Point aMM100Pos(pSvxShape->getPosition());
593 
594  // now evaluate the properties of SwShapeDescriptor_Impl
596 
598  RES_FRMATR_END-1>{} );
599  SwFormatAnchor aAnchor( RndStdIds::FLY_AS_CHAR );
600  bool bOpaque = false;
601  if( pDesc )
602  {
603  if(pDesc->GetSurround())
604  aSet.Put( *pDesc->GetSurround());
605  // all items are already in Twip
606  if(pDesc->GetLRSpace())
607  {
608  aSet.Put(*pDesc->GetLRSpace());
609  }
610  if(pDesc->GetULSpace())
611  {
612  aSet.Put(*pDesc->GetULSpace());
613  }
614  if(pDesc->GetAnchor())
615  aAnchor = *pDesc->GetAnchor();
616 
617  // #i32349# - if no horizontal position exists, create one
618  if ( !pDesc->GetHOrient() )
619  {
620  SwFormatHoriOrient* pHori = pDesc->GetHOrient( true );
621  SwTwips nHoriPos = convertMm100ToTwip(aMM100Pos.X);
622  pHori->SetPos( nHoriPos );
623  }
624  {
625  if(pDesc->GetHOrient()->GetHoriOrient() == text::HoriOrientation::NONE)
626  aMM100Pos.X = convertTwipToMm100(pDesc->GetHOrient()->GetPos());
627  aSet.Put( *pDesc->GetHOrient() );
628  }
629  // #i32349# - if no vertical position exists, create one
630  if ( !pDesc->GetVOrient() )
631  {
632  SwFormatVertOrient* pVert = pDesc->GetVOrient( true );
633  SwTwips nVertPos = convertMm100ToTwip(aMM100Pos.Y);
634  pVert->SetPos( nVertPos );
635  }
636  {
637  if(pDesc->GetVOrient()->GetVertOrient() == text::VertOrientation::NONE)
638  aMM100Pos.Y = convertTwipToMm100(pDesc->GetVOrient()->GetPos());
639  aSet.Put( *pDesc->GetVOrient() );
640  }
641 
642  if(pDesc->GetSurround())
643  aSet.Put( *pDesc->GetSurround());
644  bOpaque = pDesc->IsOpaque();
645 
646  // #i26791#
647  if ( pDesc->GetFollowTextFlow() )
648  {
649  aSet.Put( *pDesc->GetFollowTextFlow() );
650  }
651 
652  // #i28701#
653  if ( pDesc->GetWrapInfluenceOnObjPos() )
654  {
655  aSet.Put( *pDesc->GetWrapInfluenceOnObjPos() );
656  }
657  }
658 
659  pSvxShape->setPosition(aMM100Pos);
660  SdrObject* pObj = pSvxShape->GetSdrObject();
661  // #108784# - set layer of new drawing object to corresponding
662  // invisible layer.
663  if(SdrInventor::FmForm != pObj->GetObjInventor())
665  else
667 
668  std::unique_ptr<SwPaM> pPam(new SwPaM(pDoc->GetNodes().GetEndOfContent()));
669  std::unique_ptr<SwUnoInternalPaM> pInternalPam;
670  uno::Reference< text::XTextRange > xRg;
671  if( pDesc && (xRg = pDesc->GetTextRange()).is() )
672  {
673  pInternalPam.reset(new SwUnoInternalPaM(*pDoc));
674  if (!::sw::XTextRangeToSwPaM(*pInternalPam, xRg))
675  throw uno::RuntimeException();
676 
677  if(RndStdIds::FLY_AT_FLY == aAnchor.GetAnchorId() &&
678  !pInternalPam->GetNode().FindFlyStartNode())
679  {
680  aAnchor.SetType(RndStdIds::FLY_AS_CHAR);
681  }
682  else if (RndStdIds::FLY_AT_PAGE == aAnchor.GetAnchorId())
683  {
684  aAnchor.SetAnchor(pInternalPam->Start());
685  }
686 
687  }
688  else if ((aAnchor.GetAnchorId() != RndStdIds::FLY_AT_PAGE) && pDoc->getIDocumentLayoutAccess().GetCurrentLayout())
689  {
691  Point aTmp(convertMm100ToTwip(aMM100Pos.X), convertMm100ToTwip(aMM100Pos.Y));
692  pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetCursorOfst( pPam->GetPoint(), aTmp, &aState );
693  aAnchor.SetAnchor( pPam->GetPoint() );
694 
695  // #i32349# - adjustment of vertical positioning
696  // attributes no longer needed, because it's already got a default.
697  }
698  else
699  {
700  aAnchor.SetType(RndStdIds::FLY_AT_PAGE);
701 
702  // #i32349# - adjustment of vertical positioning
703  // attributes no longer needed, because it's already got a default.
704  }
705  aSet.Put(aAnchor);
706  SwPaM* pTemp = pInternalPam.get();
707  if ( !pTemp )
708  pTemp = pPam.get();
709  UnoActionContext aAction(pDoc);
710  pDoc->getIDocumentContentOperations().InsertDrawObj( *pTemp, *pObj, aSet );
711  SwFrameFormat* pFormat = ::FindFrameFormat( pObj );
712  if(pFormat)
713  pShape->SetFrameFormat(pFormat);
714  pShape->m_bDescriptor = false;
715 
716  pPam.reset();
717  pInternalPam.reset();
718 }
719 
720 void SwXDrawPage::remove(const uno::Reference< drawing::XShape > & xShape)
721 {
722  SolarMutexGuard aGuard;
723  if(!pDoc)
724  throw uno::RuntimeException();
725  uno::Reference<lang::XComponent> xComp(xShape, uno::UNO_QUERY);
726  xComp->dispose();
727 }
728 
729 uno::Reference< drawing::XShapeGroup > SwXDrawPage::group(const uno::Reference< drawing::XShapes > & xShapes)
730 {
731  SolarMutexGuard aGuard;
732  if(!pDoc || !xShapes.is())
733  throw uno::RuntimeException();
734  uno::Reference< drawing::XShapeGroup > xRet;
735  if(xPageAgg.is())
736  {
737 
738  SwFmDrawPage* pPage = GetSvxPage();
739  if(pPage) //TODO: can this be Null?
740  {
741  // mark and return MarkList
742  const SdrMarkList& rMarkList = pPage->PreGroup(xShapes);
743  if ( rMarkList.GetMarkCount() > 1 )
744  {
745  for (size_t i = 0; i < rMarkList.GetMarkCount(); ++i)
746  {
747  const SdrObject *pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
748  if (RndStdIds::FLY_AS_CHAR == ::FindFrameFormat(const_cast<SdrObject*>(
749  pObj))->GetAnchor().GetAnchorId())
750  {
751  throw uno::RuntimeException(); // FlyInCnt!
752  }
753  }
754 
755  UnoActionContext aContext(pDoc);
757 
758  SwDrawContact* pContact = pDoc->GroupSelection( *pPage->GetDrawView() );
759  pDoc->ChgAnchor(
760  pPage->GetDrawView()->GetMarkedObjectList(),
761  RndStdIds::FLY_AT_PARA,
762  true, false );
763 
764  pPage->GetDrawView()->UnmarkAll();
765  if(pContact)
766  xRet = SwFmDrawPage::GetShapeGroup( pContact->GetMaster() );
768  }
769  pPage->RemovePageView();
770  }
771  }
772  return xRet;
773 }
774 
775 void SwXDrawPage::ungroup(const uno::Reference< drawing::XShapeGroup > & rShapeGroup)
776 {
777  SolarMutexGuard aGuard;
778  if(!pDoc)
779  throw uno::RuntimeException();
780  if(xPageAgg.is())
781  {
782  SwFmDrawPage* pPage = GetSvxPage();
783  if(pPage) //TODO: can this be Null?
784  {
785  pPage->PreUnGroup(rShapeGroup);
786  UnoActionContext aContext(pDoc);
788 
789  pDoc->UnGroupSelection( *pPage->GetDrawView() );
791  RndStdIds::FLY_AT_PARA,
792  true, false );
794  pPage->RemovePageView();
795  }
796  }
797 }
798 
800 {
801  if(!xPageAgg.is() && pDoc)
802  {
803  SolarMutexGuard aGuard;
804  // #i52858#
806  SdrPage* pPage = pModel->GetPage( 0 );
807 
808  {
809  // We need a Ref to the object during queryInterface or else
810  // it will be deleted
811  pDrawPage = new SwFmDrawPage(pPage);
812  uno::Reference< drawing::XDrawPage > xPage = pDrawPage;
813  uno::Any aAgg = xPage->queryInterface(cppu::UnoType<uno::XAggregation>::get());
814  aAgg >>= xPageAgg;
815  }
816  if( xPageAgg.is() )
817  xPageAgg->setDelegator( static_cast<cppu::OWeakObject*>(this) );
818  }
819  return pDrawPage;
820 }
821 
826 {
827  pDoc = nullptr;
828 }
829 
830 namespace
831 {
832  class theSwXShapeUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXShapeUnoTunnelId > {};
833 }
834 
835 const uno::Sequence< sal_Int8 > & SwXShape::getUnoTunnelId()
836 {
837  return theSwXShapeUnoTunnelId::get().getSeq();
838 }
839 
840 sal_Int64 SAL_CALL SwXShape::getSomething( const uno::Sequence< sal_Int8 >& rId )
841 {
842  if( isUnoTunnelId<SwXShape>(rId) )
843  {
844  return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
845  }
846 
847  if( xShapeAgg.is() )
848  {
849  const uno::Type& rTunnelType = cppu::UnoType<lang::XUnoTunnel>::get();
850  uno::Any aAgg = xShapeAgg->queryAggregation( rTunnelType );
851  if(auto xAggTunnel = o3tl::tryAccess<uno::Reference<lang::XUnoTunnel>>(
852  aAgg))
853  {
854  if(xAggTunnel->is())
855  return (*xAggTunnel)->getSomething(rId);
856  }
857  }
858  return 0;
859 }
860 namespace
861 {
862  void lcl_addShapePropertyEventFactories( SdrObject& _rObj, SwXShape& _rShape )
863  {
864  std::shared_ptr<svx::IPropertyValueProvider> pProvider( new svx::PropertyValueProvider( _rShape, "AnchorType" ) );
866  }
867 }
868 
870  uno::Reference<uno::XInterface> & xShape,
871  SwDoc const*const pDoc)
872  : m_pPage(nullptr)
873  , m_pFormat(nullptr)
874  , m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_SHAPE))
875  , m_pPropertyMapEntries(aSwMapProvider.GetPropertyMapEntries(PROPERTY_MAP_TEXT_SHAPE))
876  , pImpl(new SwShapeDescriptor_Impl(pDoc))
877  , m_bDescriptor(true)
878 {
879  if(!xShape.is()) // default Ctor
880  return;
881 
883  //aAgg contains a reference of the SvxShape!
884  {
885  uno::Any aAgg = xShape->queryInterface(rAggType);
886  aAgg >>= xShapeAgg;
887  // #i31698#
888  if ( xShapeAgg.is() )
889  {
890  xShapeAgg->queryAggregation( cppu::UnoType<drawing::XShape>::get()) >>= mxShape;
891  OSL_ENSURE( mxShape.is(),
892  "<SwXShape::SwXShape(..)> - no XShape found at <xShapeAgg>" );
893  }
894  }
895  xShape = nullptr;
896  osl_atomic_increment(&m_refCount);
897  if( xShapeAgg.is() )
898  xShapeAgg->setDelegator( static_cast<cppu::OWeakObject*>(this) );
899  osl_atomic_decrement(&m_refCount);
900 
901  uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY);
902  SvxShape* pShape = nullptr;
903  if(xShapeTunnel.is())
904  pShape = reinterpret_cast< SvxShape * >(
905  sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
906 
907  SdrObject* pObj = pShape ? pShape->GetSdrObject() : nullptr;
908  if(pObj)
909  {
910  auto pFormat = ::FindFrameFormat( pObj );
911  if(pFormat)
912  SetFrameFormat(pFormat);
913 
914  lcl_addShapePropertyEventFactories( *pObj, *this );
915  pImpl->bInitializedPropertyNotifier = true;
916  }
917 
918 }
919 
921 {
922  SdrObjListIter aIter( _rObj, SdrIterMode::DeepNoGroups );
923  while ( aIter.IsMore() )
924  {
925  SdrObject* pCurrent = aIter.Next();
926  OSL_ENSURE( pCurrent, "SwXShape::AddExistingShapeToFormat: invalid object list element!" );
927  if ( !pCurrent )
928  continue;
929 
930  SwXShape* pSwShape = nullptr;
931  uno::Reference< lang::XUnoTunnel > xShapeTunnel( pCurrent->getWeakUnoShape(), uno::UNO_QUERY );
932  if ( xShapeTunnel.is() )
933  pSwShape = reinterpret_cast< SwXShape * >(
934  sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething( SwXShape::getUnoTunnelId() ) ) );
935  if ( pSwShape )
936  {
937  if ( pSwShape->m_bDescriptor )
938  {
939  auto pFormat = ::FindFrameFormat( pCurrent );
940  if ( pFormat )
941  pSwShape->SetFrameFormat(pFormat);
942  pSwShape->m_bDescriptor = false;
943  }
944 
945  if ( !pSwShape->pImpl->bInitializedPropertyNotifier )
946  {
947  lcl_addShapePropertyEventFactories( *pCurrent, *pSwShape );
948  pSwShape->pImpl->bInitializedPropertyNotifier = true;
949  }
950  }
951  }
952 }
953 
955 {
956  SolarMutexGuard aGuard;
957  if (xShapeAgg.is())
958  {
959  uno::Reference< uno::XInterface > xRef;
960  xShapeAgg->setDelegator(xRef);
961  }
962  pImpl.reset();
963  EndListeningAll();
964  if(m_pPage)
965  const_cast<SwFmDrawPage*>(m_pPage)->RemoveShape(this);
966  m_pPage = nullptr;
967 }
968 
970 {
972  if (aRet.hasValue())
973  return aRet;
974 
975  aRet = SwXShapeBaseClass::queryInterface(aType);
976  // #i53320# - follow-up of #i31698#
977  // interface drawing::XShape is overloaded. Thus, provide
978  // correct object instance.
979  if(!aRet.hasValue() && xShapeAgg.is())
980  {
981  if(aType == cppu::UnoType<XShape>::get())
982  aRet <<= uno::Reference<XShape>(this);
983  else
984  aRet = xShapeAgg->queryAggregation(aType);
985  }
986  return aRet;
987 }
988 
989 uno::Sequence< uno::Type > SwXShape::getTypes( )
990 {
991  uno::Sequence< uno::Type > aRet = SwXShapeBaseClass::getTypes();
992  if(xShapeAgg.is())
993  {
994  uno::Any aProv = xShapeAgg->queryAggregation(cppu::UnoType<XTypeProvider>::get());
995  if(aProv.hasValue())
996  {
997  uno::Reference< XTypeProvider > xAggProv;
998  aProv >>= xAggProv;
999  return comphelper::concatSequences(aRet, xAggProv->getTypes());
1000  }
1001  }
1002  return aRet;
1003 }
1004 
1005 uno::Sequence< sal_Int8 > SwXShape::getImplementationId( )
1006 {
1007  return css::uno::Sequence<sal_Int8>();
1008 }
1009 
1010 uno::Reference< beans::XPropertySetInfo > SwXShape::getPropertySetInfo()
1011 {
1012  SolarMutexGuard aGuard;
1013  uno::Reference< beans::XPropertySetInfo > aRet;
1014  if(xShapeAgg.is())
1015  {
1016  const uno::Type& rPropSetType = cppu::UnoType<beans::XPropertySet>::get();
1017  uno::Any aPSet = xShapeAgg->queryAggregation( rPropSetType );
1018  if(auto xPrSet = o3tl::tryAccess<uno::Reference<beans::XPropertySet>>(
1019  aPSet))
1020  {
1021  uno::Reference< beans::XPropertySetInfo > xInfo = (*xPrSet)->getPropertySetInfo();
1022  // Expand PropertySetInfo!
1023  const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
1024  aRet = new SfxExtItemPropertySetInfo( m_pPropertyMapEntries, aPropSeq );
1025  }
1026  }
1027  if(!aRet.is())
1028  aRet = m_pPropSet->getPropertySetInfo();
1029  return aRet;
1030 }
1031 
1032 void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
1033 {
1034  SolarMutexGuard aGuard;
1035  SwFrameFormat* pFormat = GetFrameFormat();
1036  const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
1037  if(xShapeAgg.is())
1038  {
1039  if(pEntry)
1040  {
1041  if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
1042  throw beans::PropertyVetoException ("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1043  // with the layout it is possible to move the anchor without changing the position
1044  if(pFormat)
1045  {
1046  SwAttrSet aSet(pFormat->GetAttrSet());
1047  SwDoc* pDoc = pFormat->GetDoc();
1048  if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORFRAME == pEntry->nMemberId)
1049  {
1050  bool bDone = false;
1051  uno::Reference<text::XTextFrame> xFrame;
1052  if(aValue >>= xFrame)
1053  {
1054  uno::Reference<lang::XUnoTunnel> xTunnel(xFrame, uno::UNO_QUERY);
1055  SwXFrame* pFrame = xTunnel.is() ?
1056  reinterpret_cast< SwXFrame * >(
1057  sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXFrame::getUnoTunnelId()) ))
1058  : nullptr;
1059  if(pFrame && pFrame->GetFrameFormat() &&
1060  pFrame->GetFrameFormat()->GetDoc() == pDoc)
1061  {
1062  UnoActionContext aCtx(pDoc);
1063  SfxItemSet aItemSet( pDoc->GetAttrPool(),
1065  aItemSet.SetParent(&pFormat->GetAttrSet());
1066  SwFormatAnchor aAnchor = static_cast<const SwFormatAnchor&>(aItemSet.Get(pEntry->nWID));
1067  SwPosition aPos(*pFrame->GetFrameFormat()->GetContent().GetContentIdx());
1068  aAnchor.SetAnchor(&aPos);
1069  aAnchor.SetType(RndStdIds::FLY_AT_FLY);
1070  aItemSet.Put(aAnchor);
1071  pFormat->SetFormatAttr(aItemSet);
1072  bDone = true;
1073  }
1074  }
1075  if(!bDone)
1076  throw lang::IllegalArgumentException();
1077  }
1078  else if(RES_OPAQUE == pEntry->nWID)
1079  {
1080  SvxShape* pSvxShape = GetSvxShape();
1081  SAL_WARN_IF(!pSvxShape, "sw.uno", "No SvxShape found!");
1082  if(pSvxShape)
1083  {
1084  SdrObject* pObj = pSvxShape->GetSdrObject();
1085  // set layer of new drawing
1086  // object to corresponding invisible layer.
1087  bool bIsVisible = pDoc->getIDocumentDrawModelAccess().IsVisibleLayerId( pObj->GetLayer() );
1088  if(SdrInventor::FmForm != pObj->GetObjInventor())
1089  {
1090  pObj->SetLayer( *o3tl::doAccess<bool>(aValue)
1091  ? ( bIsVisible ? pDoc->getIDocumentDrawModelAccess().GetHeavenId() : pDoc->getIDocumentDrawModelAccess().GetInvisibleHeavenId() )
1092  : ( bIsVisible ? pDoc->getIDocumentDrawModelAccess().GetHellId() : pDoc->getIDocumentDrawModelAccess().GetInvisibleHellId() ));
1093  }
1094  else
1095  {
1096  pObj->SetLayer( bIsVisible ? pDoc->getIDocumentDrawModelAccess().GetControlsId() : pDoc->getIDocumentDrawModelAccess().GetInvisibleControlsId());
1097  }
1098 
1099  }
1100 
1101  }
1102  // #i26791# - special handling for property FN_TEXT_RANGE
1103  else if ( FN_TEXT_RANGE == pEntry->nWID )
1104  {
1105  SwFormatAnchor aAnchor( aSet.Get( RES_ANCHOR ) );
1106  if (aAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
1107  {
1108  // set property <TextRange> not valid for to-page anchored shapes
1109  throw lang::IllegalArgumentException();
1110  }
1111 
1112  std::unique_ptr<SwUnoInternalPaM> pInternalPam(
1113  new SwUnoInternalPaM( *(pFormat->GetDoc()) ));
1114  uno::Reference< text::XTextRange > xRg;
1115  aValue >>= xRg;
1116  if (!::sw::XTextRangeToSwPaM(*pInternalPam, xRg) )
1117  {
1118  throw uno::RuntimeException();
1119  }
1120 
1121  if (aAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR)
1122  {
1123  //delete old SwFormatFlyCnt
1124  //With AnchorAsCharacter the current TextAttribute has to be deleted.
1125  //Tbis removes the frame format too.
1126  //To prevent this the connection between format and attribute has to be broken before.
1127  const SwPosition *pPos = aAnchor.GetContentAnchor();
1128  SwTextNode *pTextNode = pPos->nNode.GetNode().GetTextNode();
1129  SAL_WARN_IF( !pTextNode->HasHints(), "sw.uno", "Missing FlyInCnt-Hint." );
1130  const sal_Int32 nIdx = pPos->nContent.GetIndex();
1131  SwTextAttr * const pHint =
1132  pTextNode->GetTextAttrForCharAt(
1133  nIdx, RES_TXTATR_FLYCNT );
1134  assert(pHint && "Missing Hint.");
1135  SAL_WARN_IF( pHint->Which() != RES_TXTATR_FLYCNT,
1136  "sw.uno", "Missing FlyInCnt-Hint." );
1137  SAL_WARN_IF( pHint->GetFlyCnt().GetFrameFormat() != pFormat,
1138  "sw.uno", "Wrong TextFlyCnt-Hint." );
1139  const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt())
1140  .SetFlyFormat();
1141 
1142  //The connection is removed now the attribute can be deleted.
1143  pTextNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx );
1144  //create a new one
1145  SwTextNode *pNd = pInternalPam->GetNode().GetTextNode();
1146  SAL_WARN_IF( !pNd, "sw.uno", "Cursor not at TextNode." );
1147  SwFormatFlyCnt aFormat( pFormat );
1148  pNd->InsertItem(aFormat, pInternalPam->GetPoint()
1149  ->nContent.GetIndex(), 0 );
1150  }
1151  else
1152  {
1153  aAnchor.SetAnchor( pInternalPam->GetPoint() );
1154  aSet.Put(aAnchor);
1155  pFormat->SetFormatAttr(aSet);
1156  }
1157  }
1158  else if (pEntry->nWID == FN_TEXT_BOX)
1159  {
1160  bool bValue(false);
1161  aValue >>= bValue;
1162  if (bValue)
1163  SwTextBoxHelper::create(pFormat);
1164  else
1165  SwTextBoxHelper::destroy(pFormat);
1166 
1167  }
1168  else if (pEntry->nWID == RES_CHAIN)
1169  {
1170  if (pEntry->nMemberId == MID_CHAIN_NEXTNAME || pEntry->nMemberId == MID_CHAIN_PREVNAME)
1171  SwTextBoxHelper::syncProperty(pFormat, pEntry->nWID, pEntry->nMemberId, aValue);
1172  }
1173  // #i28749#
1174  else if ( FN_SHAPE_POSITION_LAYOUT_DIR == pEntry->nWID )
1175  {
1176  sal_Int16 nPositionLayoutDir = 0;
1177  aValue >>= nPositionLayoutDir;
1178  pFormat->SetPositionLayoutDir( nPositionLayoutDir );
1179  }
1180  else if( pDoc->getIDocumentLayoutAccess().GetCurrentLayout())
1181  {
1182  UnoActionContext aCtx(pDoc);
1183  if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == pEntry->nMemberId)
1184  {
1185  SdrObject* pObj = pFormat->FindSdrObject();
1186  SdrMarkList aList;
1187  SdrMark aMark(pObj);
1188  aList.InsertEntry(aMark);
1189  sal_Int32 nAnchor = 0;
1190  cppu::enum2int( nAnchor, aValue );
1191  pDoc->ChgAnchor( aList, static_cast<RndStdIds>(nAnchor),
1192  false, true );
1193  }
1194  else
1195  {
1196  m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
1197  pFormat->SetFormatAttr(aSet);
1198  }
1199  }
1200  else if( RES_FRM_SIZE == pEntry->nWID &&
1203  || pEntry->nMemberId == MID_FRMSIZE_REL_WIDTH_RELATION ) )
1204  {
1205  SvxShape* pSvxShape = GetSvxShape();
1206  SAL_WARN_IF(!pSvxShape, "sw.uno", "No SvxShape found!");
1207  if(pSvxShape)
1208  {
1209  SdrObject* pObj = pSvxShape->GetSdrObject();
1210  sal_Int16 nPercent(100);
1211  aValue >>= nPercent;
1212  switch (pEntry->nMemberId)
1213  {
1214  case MID_FRMSIZE_REL_WIDTH:
1215  pObj->SetRelativeWidth( nPercent / 100.0 );
1216  break;
1218  pObj->SetRelativeHeight( nPercent / 100.0 );
1219  break;
1221  pObj->SetRelativeWidthRelation(nPercent);
1222  break;
1224  pObj->SetRelativeHeightRelation(nPercent);
1225  break;
1226  }
1227  }
1228  }
1229  else
1230  {
1231  m_pPropSet->setPropertyValue( *pEntry, aValue, aSet );
1232 
1233  if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == pEntry->nMemberId)
1234  {
1235  bool bSetAttr = true;
1236  text::TextContentAnchorType eNewAnchor = static_cast<text::TextContentAnchorType>(SWUnoHelper::GetEnumAsInt32( aValue ));
1237 
1238  //if old anchor was in_cntnt the related text attribute has to be removed
1239  const SwFormatAnchor& rOldAnchor = pFormat->GetAnchor();
1240  RndStdIds eOldAnchorId = rOldAnchor.GetAnchorId();
1241  SdrObject* pObj = pFormat->FindSdrObject();
1242  SwFrameFormat *pFlyFormat = FindFrameFormat( pObj );
1243  pFlyFormat->DelFrames();
1244  if( text::TextContentAnchorType_AS_CHARACTER != eNewAnchor &&
1245  (RndStdIds::FLY_AS_CHAR == eOldAnchorId))
1246  {
1247  //With AnchorAsCharacter the current TextAttribute has to be deleted.
1248  //Tbis removes the frame format too.
1249  //To prevent this the connection between format and attribute has to be broken before.
1250  const SwPosition *pPos = rOldAnchor.GetContentAnchor();
1251  SwTextNode *pTextNode = pPos->nNode.GetNode().GetTextNode();
1252  SAL_WARN_IF( !pTextNode->HasHints(), "sw.uno", "Missing FlyInCnt-Hint." );
1253  const sal_Int32 nIdx = pPos->nContent.GetIndex();
1254  SwTextAttr * const pHint =
1255  pTextNode->GetTextAttrForCharAt(
1256  nIdx, RES_TXTATR_FLYCNT );
1257  assert(pHint && "Missing Hint.");
1258  SAL_WARN_IF( pHint->Which() != RES_TXTATR_FLYCNT,
1259  "sw.uno", "Missing FlyInCnt-Hint." );
1260  SAL_WARN_IF( pHint->GetFlyCnt().GetFrameFormat() != pFlyFormat,
1261  "sw.uno", "Wrong TextFlyCnt-Hint." );
1262  const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt())
1263  .SetFlyFormat();
1264 
1265  //The connection is removed now the attribute can be deleted.
1266  pTextNode->DeleteAttributes(RES_TXTATR_FLYCNT, nIdx);
1267  }
1268  else if( text::TextContentAnchorType_AT_PAGE != eNewAnchor &&
1269  (RndStdIds::FLY_AT_PAGE == eOldAnchorId))
1270  {
1271  SwFormatAnchor aNewAnchor( dynamic_cast< const SwFormatAnchor& >( aSet.Get( RES_ANCHOR ) ) );
1272  //if the fly has been anchored at page then it needs to be connected
1273  //to the content position
1274  SwPaM aPam(pDoc->GetNodes().GetEndOfContent());
1275  if( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() )
1276  {
1278  Point aTmp( pObj->GetSnapRect().TopLeft() );
1279  pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetCursorOfst( aPam.GetPoint(), aTmp, &aState );
1280  }
1281  else
1282  {
1283  //without access to the layout the last node of the body will be used as anchor position
1284  aPam.Move( fnMoveBackward, GoInDoc );
1285  }
1286  //anchor position has to be inserted after the text attribute has been inserted
1287  aNewAnchor.SetAnchor( aPam.GetPoint() );
1288  aSet.Put( aNewAnchor );
1289  pFormat->SetFormatAttr(aSet);
1290  bSetAttr = false;
1291  }
1292  if( text::TextContentAnchorType_AS_CHARACTER == eNewAnchor &&
1293  (RndStdIds::FLY_AS_CHAR != eOldAnchorId))
1294  {
1295  SwPaM aPam(pDoc->GetNodes().GetEndOfContent());
1296  if( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() )
1297  {
1299  Point aTmp( pObj->GetSnapRect().TopLeft() );
1300  pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetCursorOfst( aPam.GetPoint(), aTmp, &aState );
1301  }
1302  else
1303  {
1304  //without access to the layout the last node of the body will be used as anchor position
1305  aPam.Move( fnMoveBackward, GoInDoc );
1306  }
1307  //the RES_TXTATR_FLYCNT needs to be added now
1308  SwTextNode *pNd = aPam.GetNode().GetTextNode();
1309  SAL_WARN_IF( !pNd, "sw.uno", "Cursor is not in a TextNode." );
1310  SwFormatFlyCnt aFormat( pFlyFormat );
1311  pNd->InsertItem(aFormat,
1312  aPam.GetPoint()->nContent.GetIndex(), 0 );
1313  --aPam.GetPoint()->nContent; // InsertItem moved it
1314  SwFormatAnchor aNewAnchor(
1315  dynamic_cast<const SwFormatAnchor&>(
1316  aSet.Get(RES_ANCHOR)));
1317  aNewAnchor.SetAnchor( aPam.GetPoint() );
1318  aSet.Put( aNewAnchor );
1319  }
1320  if( bSetAttr )
1321  pFormat->SetFormatAttr(aSet);
1322  }
1323  else
1324  pFormat->SetFormatAttr(aSet);
1325  }
1326  // We have a pFormat and a pEntry as well: try to sync TextBox property.
1327  SwTextBoxHelper::syncProperty(pFormat, pEntry->nWID, pEntry->nMemberId, aValue);
1328  }
1329  else
1330  {
1331  SfxPoolItem* pItem = nullptr;
1332  switch(pEntry->nWID)
1333  {
1334  case RES_ANCHOR:
1335  pItem = pImpl->GetAnchor(true);
1336  break;
1337  case RES_HORI_ORIENT:
1338  pItem = pImpl->GetHOrient(true);
1339  break;
1340  case RES_VERT_ORIENT:
1341  pItem = pImpl->GetVOrient(true);
1342  break;
1343  case RES_LR_SPACE:
1344  pItem = pImpl->GetLRSpace(true);
1345  break;
1346  case RES_UL_SPACE:
1347  pItem = pImpl->GetULSpace(true);
1348  break;
1349  case RES_SURROUND:
1350  pItem = pImpl->GetSurround(true);
1351  break;
1352  case FN_TEXT_RANGE:
1353  if(auto tr = o3tl::tryAccess<
1354  uno::Reference<text::XTextRange>>(aValue))
1355  {
1356  uno::Reference< text::XTextRange > & rRange = pImpl->GetTextRange();
1357  rRange = *tr;
1358  }
1359  break;
1360  case RES_OPAQUE :
1361  pImpl->SetOpaque(*o3tl::doAccess<bool>(aValue));
1362  break;
1363  // #i26791#
1364  case RES_FOLLOW_TEXT_FLOW:
1365  {
1366  pItem = pImpl->GetFollowTextFlow( true );
1367  }
1368  break;
1369  // #i28701#
1371  {
1372  pItem = pImpl->GetWrapInfluenceOnObjPos( true );
1373  }
1374  break;
1375  // #i28749#
1377  {
1378  sal_Int16 nPositionLayoutDir = 0;
1379  aValue >>= nPositionLayoutDir;
1380  pImpl->SetPositionLayoutDir( nPositionLayoutDir );
1381  }
1382  break;
1383  }
1384  if(pItem)
1385  pItem->PutValue(aValue, pEntry->nMemberId);
1386  }
1387  }
1388  else
1389  {
1390  const uno::Type& rPSetType =
1392  uno::Any aPSet = xShapeAgg->queryAggregation(rPSetType);
1393  auto xPrSet = o3tl::tryAccess<uno::Reference<beans::XPropertySet>>(
1394  aPSet);
1395  if(!xPrSet)
1396  throw uno::RuntimeException();
1397  // #i31698# - setting the caption point of a
1398  // caption object doesn't have to change the object position.
1399  // Thus, keep the position, before the caption point is set and
1400  // restore it afterwards.
1401  awt::Point aKeepedPosition( 0, 0 );
1402  if ( rPropertyName == "CaptionPoint" && getShapeType() == "com.sun.star.drawing.CaptionShape" )
1403  {
1404  aKeepedPosition = getPosition();
1405  }
1406  if( pFormat && pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() )
1407  {
1408  UnoActionContext aCtx(pFormat->GetDoc());
1409  (*xPrSet)->setPropertyValue(rPropertyName, aValue);
1410  }
1411  else
1412  (*xPrSet)->setPropertyValue(rPropertyName, aValue);
1413 
1414  if (pFormat)
1415  {
1416  // We have a pFormat (but no pEntry): try to sync TextBox property.
1417  SwTextBoxHelper::syncProperty(pFormat, rPropertyName, aValue);
1418  }
1419 
1420  // #i31698# - restore object position, if caption point is set.
1421  if ( rPropertyName == "CaptionPoint" && getShapeType() == "com.sun.star.drawing.CaptionShape" )
1422  {
1423  setPosition( aKeepedPosition );
1424  }
1425  }
1426  }
1427 }
1428 
1429 uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName)
1430 {
1431  SolarMutexGuard aGuard;
1432  uno::Any aRet;
1433  SwFrameFormat* pFormat = GetFrameFormat();
1434  if(xShapeAgg.is())
1435  {
1436  const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
1437  if(pEntry)
1438  {
1439  if(pFormat)
1440  {
1441  if(RES_OPAQUE == pEntry->nWID)
1442  {
1443  SvxShape* pSvxShape = GetSvxShape();
1444  OSL_ENSURE(pSvxShape, "No SvxShape found!");
1445  if(pSvxShape)
1446  {
1447  SdrObject* pObj = pSvxShape->GetSdrObject();
1448  // consider invisible layers
1449  aRet <<=
1450  ( pObj->GetLayer() != pFormat->GetDoc()->getIDocumentDrawModelAccess().GetHellId() &&
1451  pObj->GetLayer() != pFormat->GetDoc()->getIDocumentDrawModelAccess().GetInvisibleHellId() );
1452  }
1453  }
1454  else if(FN_ANCHOR_POSITION == pEntry->nWID)
1455  {
1456  SvxShape* pSvxShape = GetSvxShape();
1457  OSL_ENSURE(pSvxShape, "No SvxShape found!");
1458  if(pSvxShape)
1459  {
1460  SdrObject* pObj = pSvxShape->GetSdrObject();
1461  Point aPt = pObj->GetAnchorPos();
1462  awt::Point aPoint( convertTwipToMm100( aPt.X() ),
1463  convertTwipToMm100( aPt.Y() ) );
1464  aRet <<= aPoint;
1465  }
1466  }
1467  // #i26791# - special handling for FN_TEXT_RANGE
1468  else if ( FN_TEXT_RANGE == pEntry->nWID )
1469  {
1470  const SwFormatAnchor aAnchor = pFormat->GetAnchor();
1471  if (aAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
1472  {
1473  // return nothing, because property <TextRange> isn't
1474  // valid for to-page anchored shapes
1475  uno::Any aAny;
1476  aRet = aAny;
1477  }
1478  else
1479  {
1480  if ( aAnchor.GetContentAnchor() )
1481  {
1482  const uno::Reference< text::XTextRange > xTextRange
1484  *pFormat->GetDoc(),
1485  *aAnchor.GetContentAnchor(),
1486  nullptr );
1487  aRet <<= xTextRange;
1488  }
1489  else
1490  {
1491  // return nothing
1492  uno::Any aAny;
1493  aRet = aAny;
1494  }
1495  }
1496  }
1497  else if (pEntry->nWID == FN_TEXT_BOX)
1498  {
1499  bool bValue = SwTextBoxHelper::isTextBox(pFormat, RES_DRAWFRMFMT);
1500  aRet <<= bValue;
1501  }
1502  else if (pEntry->nWID == RES_CHAIN)
1503  {
1504  switch (pEntry->nMemberId)
1505  {
1506  case MID_CHAIN_PREVNAME:
1507  case MID_CHAIN_NEXTNAME:
1508  case MID_CHAIN_NAME:
1509  SwTextBoxHelper::getProperty(pFormat, pEntry->nWID, pEntry->nMemberId, aRet);
1510  break;
1511  }
1512  }
1513  // #i28749#
1514  else if ( FN_SHAPE_TRANSFORMATION_IN_HORI_L2R == pEntry->nWID )
1515  {
1516  // get property <::drawing::Shape::Transformation>
1517  // without conversion to layout direction as below
1518  aRet = _getPropAtAggrObj( "Transformation" );
1519  }
1520  else if ( FN_SHAPE_POSITION_LAYOUT_DIR == pEntry->nWID )
1521  {
1522  aRet <<= pFormat->GetPositionLayoutDir();
1523  }
1524  // #i36248#
1525  else if ( FN_SHAPE_STARTPOSITION_IN_HORI_L2R == pEntry->nWID )
1526  {
1527  // get property <::drawing::Shape::StartPosition>
1528  // without conversion to layout direction as below
1529  aRet = _getPropAtAggrObj( "StartPosition" );
1530  }
1531  else if ( FN_SHAPE_ENDPOSITION_IN_HORI_L2R == pEntry->nWID )
1532  {
1533  // get property <::drawing::Shape::EndPosition>
1534  // without conversion to layout direction as below
1535  aRet = _getPropAtAggrObj( "EndPosition" );
1536  }
1537  else if (pEntry->nWID == RES_FRM_SIZE &&
1538  (pEntry->nMemberId == MID_FRMSIZE_REL_HEIGHT ||
1539  pEntry->nMemberId == MID_FRMSIZE_REL_WIDTH ||
1542  {
1543  SvxShape* pSvxShape = GetSvxShape();
1544  SAL_WARN_IF(!pSvxShape, "sw.uno", "No SvxShape found!");
1545  sal_Int16 nRet = 0;
1546  if (pSvxShape)
1547  {
1548  SdrObject* pObj = pSvxShape->GetSdrObject();
1549  switch (pEntry->nMemberId)
1550  {
1551  case MID_FRMSIZE_REL_WIDTH:
1552  if (pObj->GetRelativeWidth())
1553  nRet = *pObj->GetRelativeWidth() * 100;
1554  break;
1556  if (pObj->GetRelativeHeight())
1557  nRet = *pObj->GetRelativeHeight() * 100;
1558  break;
1560  nRet = pObj->GetRelativeWidthRelation();
1561  break;
1563  nRet = pObj->GetRelativeHeightRelation();
1564  break;
1565  }
1566  }
1567  aRet <<= nRet;
1568  }
1569  else
1570  {
1571  const SwAttrSet& rSet = pFormat->GetAttrSet();
1572  m_pPropSet->getPropertyValue(*pEntry, rSet, aRet);
1573  }
1574  }
1575  else
1576  {
1577  SfxPoolItem* pItem = nullptr;
1578  switch(pEntry->nWID)
1579  {
1580  case RES_ANCHOR:
1581  pItem = pImpl->GetAnchor();
1582  break;
1583  case RES_HORI_ORIENT:
1584  pItem = pImpl->GetHOrient();
1585  break;
1586  case RES_VERT_ORIENT:
1587  pItem = pImpl->GetVOrient();
1588  break;
1589  case RES_LR_SPACE:
1590  pItem = pImpl->GetLRSpace();
1591  break;
1592  case RES_UL_SPACE:
1593  pItem = pImpl->GetULSpace();
1594  break;
1595  case RES_SURROUND:
1596  pItem = pImpl->GetSurround();
1597  break;
1598  case FN_TEXT_RANGE :
1599  aRet <<= pImpl->GetTextRange();
1600  break;
1601  case RES_OPAQUE :
1602  aRet <<= pImpl->GetOpaque();
1603  break;
1604  case FN_ANCHOR_POSITION :
1605  {
1606  aRet <<= awt::Point();
1607  }
1608  break;
1609  // #i26791#
1610  case RES_FOLLOW_TEXT_FLOW :
1611  {
1612  pItem = pImpl->GetFollowTextFlow();
1613  }
1614  break;
1615  // #i28701#
1617  {
1618  pItem = pImpl->GetWrapInfluenceOnObjPos();
1619  }
1620  break;
1621  // #i28749#
1623  {
1624  // get property <::drawing::Shape::Transformation>
1625  // without conversion to layout direction as below
1626  aRet = _getPropAtAggrObj( "Transformation" );
1627  }
1628  break;
1630  {
1631  aRet <<= pImpl->GetPositionLayoutDir();
1632  }
1633  break;
1634  // #i36248#
1636  {
1637  // get property <::drawing::Shape::StartPosition>
1638  // without conversion to layout direction as below
1639  aRet = _getPropAtAggrObj( "StartPosition" );
1640  }
1641  break;
1643  {
1644  // get property <::drawing::Shape::StartPosition>
1645  // without conversion to layout direction as below
1646  aRet = _getPropAtAggrObj( "EndPosition" );
1647  }
1648  break;
1649  }
1650  if(pItem)
1651  pItem->QueryValue(aRet, pEntry->nMemberId);
1652  }
1653  }
1654  else
1655  {
1656  aRet = _getPropAtAggrObj( rPropertyName );
1657 
1658  // #i31698# - convert the position (translation)
1659  // of the drawing object in the transformation
1660  if ( rPropertyName == "Transformation" )
1661  {
1662  drawing::HomogenMatrix3 aMatrix;
1663  aRet >>= aMatrix;
1664  aRet <<= ConvertTransformationToLayoutDir( aMatrix );
1665  }
1666  // #i36248#
1667  else if ( rPropertyName == "StartPosition" )
1668  {
1669  awt::Point aStartPos;
1670  aRet >>= aStartPos;
1671  // #i59051#
1672  aRet <<= ConvertStartOrEndPosToLayoutDir( aStartPos );
1673  }
1674  else if ( rPropertyName == "EndPosition" )
1675  {
1676  awt::Point aEndPos;
1677  aRet >>= aEndPos;
1678  // #i59051#
1679  aRet <<= ConvertStartOrEndPosToLayoutDir( aEndPos );
1680  }
1681  // #i59051#
1682  else if ( rPropertyName == "PolyPolygonBezier" )
1683  {
1684  drawing::PolyPolygonBezierCoords aPath;
1685  aRet >>= aPath;
1686  aRet <<= ConvertPolyPolygonBezierToLayoutDir( aPath );
1687  }
1688  else if (rPropertyName == "ZOrder")
1689  {
1690  // Convert the real draw page position to the logical one that ignores textboxes.
1691  if (pFormat)
1692  {
1693  const SdrObject* pObj = pFormat->FindRealSdrObject();
1694  if (pObj)
1695  {
1696  bool bConvert = true;
1697  if (SvxShape* pSvxShape = GetSvxShape())
1698  // In case of group shapes, pSvxShape points to the child shape, while pObj points to the outermost group shape.
1699  if (pSvxShape->GetSdrObject() != pObj)
1700  // Textboxes are not expected inside group shapes, so no conversion is necessary there.
1701  bConvert = false;
1702  if (bConvert)
1703  {
1704  aRet <<= SwTextBoxHelper::getOrdNum(pObj);
1705  }
1706  }
1707  }
1708  }
1709  }
1710  }
1711  return aRet;
1712 }
1713 
1714 uno::Any SwXShape::_getPropAtAggrObj( const OUString& _rPropertyName )
1715 {
1716  uno::Any aRet;
1717 
1718  const uno::Type& rPSetType =
1720  uno::Any aPSet = xShapeAgg->queryAggregation(rPSetType);
1721  auto xPrSet = o3tl::tryAccess<uno::Reference<beans::XPropertySet>>(aPSet);
1722  if ( !xPrSet )
1723  {
1724  throw uno::RuntimeException();
1725  }
1726  aRet = (*xPrSet)->getPropertyValue( _rPropertyName );
1727 
1728  return aRet;
1729 }
1730 
1731 beans::PropertyState SwXShape::getPropertyState( const OUString& rPropertyName )
1732 {
1733  SolarMutexGuard aGuard;
1734  uno::Sequence< OUString > aNames { rPropertyName };
1735  uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aNames);
1736  return aStates.getConstArray()[0];
1737 }
1738 
1739 uno::Sequence< beans::PropertyState > SwXShape::getPropertyStates(
1740  const uno::Sequence< OUString >& aPropertyNames )
1741 {
1742  SolarMutexGuard aGuard;
1743  SwFrameFormat* pFormat = GetFrameFormat();
1744  uno::Sequence< beans::PropertyState > aRet(aPropertyNames.getLength());
1745  if(!xShapeAgg.is())
1746  throw uno::RuntimeException();
1747 
1748  SvxShape* pSvxShape = GetSvxShape();
1749  bool bGroupMember = false;
1750  bool bFormControl = false;
1751  SdrObject* pObject = pSvxShape ? pSvxShape->GetSdrObject() : nullptr;
1752  if(pObject)
1753  {
1754  bGroupMember = pObject->getParentSdrObjectFromSdrObject() != nullptr;
1755  bFormControl = pObject->GetObjInventor() == SdrInventor::FmForm;
1756  }
1757  const OUString* pNames = aPropertyNames.getConstArray();
1758  beans::PropertyState* pRet = aRet.getArray();
1759  uno::Reference< XPropertyState > xShapePrState;
1760  for(sal_Int32 nProperty = 0; nProperty < aPropertyNames.getLength(); nProperty++)
1761  {
1762  const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName( pNames[nProperty] );
1763  if(pEntry)
1764  {
1765  if(RES_OPAQUE == pEntry->nWID)
1766  pRet[nProperty] = bFormControl ?
1767  beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
1768  else if(FN_ANCHOR_POSITION == pEntry->nWID)
1769  pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
1770  else if(FN_TEXT_RANGE == pEntry->nWID)
1771  pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
1772  else if(bGroupMember)
1773  pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE;
1774  else if (pEntry->nWID == RES_FRM_SIZE &&
1777  pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
1778  else if (pEntry->nWID == FN_TEXT_BOX)
1779  {
1780  // The TextBox property is set, if we can find a textbox for this shape.
1781  if (pFormat && SwTextBoxHelper::isTextBox(pFormat, RES_DRAWFRMFMT))
1782  pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
1783  else
1784  pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE;
1785  }
1786  else if(pFormat)
1787  {
1788  const SwAttrSet& rSet = pFormat->GetAttrSet();
1789  SfxItemState eItemState = rSet.GetItemState(pEntry->nWID, false);
1790 
1791  if(SfxItemState::SET == eItemState)
1792  pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
1793  else if(SfxItemState::DEFAULT == eItemState)
1794  pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE;
1795  else
1796  pRet[nProperty] = beans::PropertyState_AMBIGUOUS_VALUE;
1797  }
1798  else
1799  {
1800  SfxPoolItem* pItem = nullptr;
1801  switch(pEntry->nWID)
1802  {
1803  case RES_ANCHOR:
1804  pItem = pImpl->GetAnchor();
1805  break;
1806  case RES_HORI_ORIENT:
1807  pItem = pImpl->GetHOrient();
1808  break;
1809  case RES_VERT_ORIENT:
1810  pItem = pImpl->GetVOrient();
1811  break;
1812  case RES_LR_SPACE:
1813  pItem = pImpl->GetLRSpace();
1814  break;
1815  case RES_UL_SPACE:
1816  pItem = pImpl->GetULSpace();
1817  break;
1818  case RES_SURROUND:
1819  pItem = pImpl->GetSurround();
1820  break;
1821  // #i28701#
1823  {
1824  pItem = pImpl->GetWrapInfluenceOnObjPos();
1825  }
1826  break;
1827  }
1828  if(pItem)
1829  pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
1830  else
1831  pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE;
1832  }
1833  }
1834  else
1835  {
1836  if(!xShapePrState.is())
1837  {
1838  const uno::Type& rPStateType = cppu::UnoType<XPropertyState>::get();
1839  uno::Any aPState = xShapeAgg->queryAggregation(rPStateType);
1840  auto ps = o3tl::tryAccess<uno::Reference<XPropertyState>>(
1841  aPState);
1842  if(!ps)
1843  throw uno::RuntimeException();
1844  xShapePrState = *ps;
1845  }
1846  pRet[nProperty] = xShapePrState->getPropertyState(pNames[nProperty]);
1847  }
1848  }
1849 
1850  return aRet;
1851 }
1852 
1853 void SwXShape::setPropertyToDefault( const OUString& rPropertyName )
1854 {
1855  SolarMutexGuard aGuard;
1856  SwFrameFormat* pFormat = GetFrameFormat();
1857  if(!xShapeAgg.is())
1858  throw uno::RuntimeException();
1859 
1860  const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
1861  if(pEntry)
1862  {
1863  if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
1864  throw uno::RuntimeException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1865  if(pFormat)
1866  {
1867  const SfxItemSet& rSet = pFormat->GetAttrSet();
1868  SfxItemSet aSet(pFormat->GetDoc()->GetAttrPool(), {{pEntry->nWID, pEntry->nWID}});
1869  aSet.SetParent(&rSet);
1870  aSet.ClearItem(pEntry->nWID);
1871  pFormat->GetDoc()->SetAttr(aSet, *pFormat);
1872  }
1873  else
1874  {
1875  switch(pEntry->nWID)
1876  {
1877  case RES_ANCHOR: pImpl->RemoveAnchor(); break;
1878  case RES_HORI_ORIENT: pImpl->RemoveHOrient(); break;
1879  case RES_VERT_ORIENT: pImpl->RemoveVOrient(); break;
1880  case RES_LR_SPACE: pImpl->RemoveLRSpace(); break;
1881  case RES_UL_SPACE: pImpl->RemoveULSpace(); break;
1882  case RES_SURROUND: pImpl->RemoveSurround();break;
1883  case RES_OPAQUE : pImpl->SetOpaque(false); break;
1884  case FN_TEXT_RANGE :
1885  break;
1886  // #i26791#
1887  case RES_FOLLOW_TEXT_FLOW:
1888  {
1889  pImpl->RemoveFollowTextFlow();
1890  }
1891  break;
1892  // #i28701#
1894  {
1895  pImpl->RemoveWrapInfluenceOnObjPos();
1896  }
1897  break;
1898  }
1899  }
1900  }
1901  else
1902  {
1903  const uno::Type& rPStateType = cppu::UnoType<XPropertyState>::get();
1904  uno::Any aPState = xShapeAgg->queryAggregation(rPStateType);
1905  auto xShapePrState = o3tl::tryAccess<uno::Reference<XPropertyState>>(
1906  aPState);
1907  if(!xShapePrState)
1908  throw uno::RuntimeException();
1909  (*xShapePrState)->setPropertyToDefault( rPropertyName );
1910  }
1911 
1912 }
1913 
1914 uno::Any SwXShape::getPropertyDefault( const OUString& rPropertyName )
1915 {
1916  SolarMutexGuard aGuard;
1917  SwFrameFormat* pFormat = GetFrameFormat();
1918  uno::Any aRet;
1919  if(!xShapeAgg.is())
1920  throw uno::RuntimeException();
1921 
1922  const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
1923  if(pEntry)
1924  {
1925  if(!(pEntry->nWID < RES_FRMATR_END && pFormat))
1926  throw uno::RuntimeException();
1927 
1928  const SfxPoolItem& rDefItem =
1929  pFormat->GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
1930  rDefItem.QueryValue(aRet, pEntry->nMemberId);
1931 
1932  }
1933  else
1934  {
1935  const uno::Type& rPStateType = cppu::UnoType<XPropertyState>::get();
1936  uno::Any aPState = xShapeAgg->queryAggregation(rPStateType);
1937  auto xShapePrState = o3tl::tryAccess<uno::Reference<XPropertyState>>(
1938  aPState);
1939  if(!xShapePrState)
1940  throw uno::RuntimeException();
1941  (*xShapePrState)->getPropertyDefault( rPropertyName );
1942  }
1943 
1944  return aRet;
1945 }
1946 
1948  const OUString& _propertyName,
1949  const uno::Reference< beans::XPropertyChangeListener > & _listener )
1950 {
1951  if ( !xShapeAgg.is() )
1952  throw uno::RuntimeException("no shape aggregate", *this );
1953 
1954  // must be handled by the aggregate
1955  uno::Reference< beans::XPropertySet > xShapeProps;
1956  if ( xShapeAgg->queryAggregation( cppu::UnoType<beans::XPropertySet>::get() ) >>= xShapeProps )
1957  xShapeProps->addPropertyChangeListener( _propertyName, _listener );
1958 }
1959 
1961  const OUString& _propertyName,
1962  const uno::Reference< beans::XPropertyChangeListener > & _listener)
1963 {
1964  if ( !xShapeAgg.is() )
1965  throw uno::RuntimeException("no shape aggregate", *this );
1966 
1967  // must be handled by the aggregate
1968  uno::Reference< beans::XPropertySet > xShapeProps;
1969  if ( xShapeAgg->queryAggregation( cppu::UnoType<beans::XPropertySet>::get() ) >>= xShapeProps )
1970  xShapeProps->removePropertyChangeListener( _propertyName, _listener );
1971 }
1972 
1974  const OUString& /*PropertyName*/,
1975  const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/ )
1976 {
1977  OSL_FAIL("not implemented");
1978 }
1979 
1981  const OUString& /*PropertyName*/,
1982  const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
1983 {
1984  OSL_FAIL("not implemented");
1985 }
1986 
1987 void SwXShape::Notify(const SfxHint& rHint)
1988 {
1989  if(rHint.GetId() == SfxHintId::Dying)
1990  {
1991  m_pFormat = nullptr;
1992  EndListeningAll();
1993  }
1994 }
1995 
1996 void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
1997 {
1998  SolarMutexGuard aGuard;
1999 
2000  // get access to SwDoc
2001  // (see also SwXTextRange::XTextRangeToSwPaM)
2002  const SwDoc* pDoc = nullptr;
2003  uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
2004  if(xRangeTunnel.is())
2005  {
2006  SwXTextRange* pRange = nullptr;
2007  OTextCursorHelper* pCursor = nullptr;
2008  SwXTextPortion* pPortion = nullptr;
2009  SwXText* pText = nullptr;
2010  SwXParagraph* pParagraph = nullptr;
2011 
2012  pRange = reinterpret_cast< SwXTextRange * >(
2013  sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
2014  pText = reinterpret_cast< SwXText * >(
2015  sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXText::getUnoTunnelId()) ));
2016  pCursor = reinterpret_cast< OTextCursorHelper * >(
2017  sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
2018  pPortion = reinterpret_cast< SwXTextPortion * >(
2019  sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextPortion::getUnoTunnelId()) ));
2020  pParagraph = reinterpret_cast< SwXParagraph * >(
2021  sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXParagraph::getUnoTunnelId( ) ) ) );
2022 
2023  if (pRange)
2024  pDoc = &pRange->GetDoc();
2025  else if (pText)
2026  pDoc = pText->GetDoc();
2027  else if (pCursor)
2028  pDoc = pCursor->GetDoc();
2029  else if (pPortion)
2030  pDoc = pPortion->GetCursor().GetDoc();
2031  else if (pParagraph && pParagraph->GetTextNode())
2032  pDoc = pParagraph->GetTextNode()->GetDoc();
2033 
2034  }
2035 
2036  if(!pDoc)
2037  throw uno::RuntimeException();
2038  if (const SwDocShell* pDocSh = pDoc->GetDocShell())
2039  {
2040  uno::Reference<frame::XModel> xModel = pDocSh->GetModel();
2041  uno::Reference< drawing::XDrawPageSupplier > xDPS(xModel, uno::UNO_QUERY);
2042  if (xDPS.is())
2043  {
2044  uno::Reference< drawing::XDrawPage > xDP( xDPS->getDrawPage() );
2045  if (xDP.is())
2046  {
2047  uno::Any aPos;
2048  aPos <<= xTextRange;
2049  setPropertyValue("TextRange", aPos);
2050  uno::Reference< drawing::XShape > xTemp( static_cast<cppu::OWeakObject*>(this), uno::UNO_QUERY );
2051  xDP->add( xTemp );
2052  }
2053  }
2054  }
2055 }
2056 
2057 uno::Reference< text::XTextRange > SwXShape::getAnchor()
2058 {
2059  SolarMutexGuard aGuard;
2060  uno::Reference< text::XTextRange > aRef;
2061  SwFrameFormat* pFormat = GetFrameFormat();
2062  if(pFormat)
2063  {
2064  const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
2065  // return an anchor for non-page bound frames
2066  // and for page bound frames that have a page no == NULL and a content position
2067  if ((rAnchor.GetAnchorId() != RndStdIds::FLY_AT_PAGE) ||
2068  (rAnchor.GetContentAnchor() && !rAnchor.GetPageNum()))
2069  {
2070  const SwPosition &rPos = *(pFormat->GetAnchor().GetContentAnchor());
2071  aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), rPos, nullptr);
2072  }
2073  }
2074  else
2075  aRef = pImpl->GetTextRange();
2076  return aRef;
2077 }
2078 
2080 {
2081  SolarMutexGuard aGuard;
2082  SwFrameFormat* pFormat = GetFrameFormat();
2083  if(pFormat)
2084  {
2085  // determine correct <SdrObject>
2086  SvxShape* pSvxShape = GetSvxShape();
2087  SdrObject* pObj = pSvxShape ? pSvxShape->GetSdrObject() : nullptr;
2088  // safety assertion:
2089  // <pObj> must be the same as <pFormat->FindSdrObject()>, if <pObj> isn't
2090  // a 'virtual' drawing object.
2091  // correct assertion and refine it for safety reason.
2092  OSL_ENSURE( !pObj ||
2093  dynamic_cast<const SwDrawVirtObj*>( pObj) != nullptr ||
2095  pObj == pFormat->FindSdrObject(),
2096  "<SwXShape::dispose(..) - different 'master' drawing objects!!" );
2097  // perform delete of draw frame format *not*
2098  // for 'virtual' drawing objects.
2099  // no delete of draw format for members
2100  // of a group
2101  if ( pObj &&
2102  dynamic_cast<const SwDrawVirtObj*>( pObj) == nullptr &&
2104  pObj->IsInserted() )
2105  {
2106  if (pFormat->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR)
2107  {
2108  const SwPosition &rPos = *(pFormat->GetAnchor().GetContentAnchor());
2109  SwTextNode *pTextNode = rPos.nNode.GetNode().GetTextNode();
2110  const sal_Int32 nIdx = rPos.nContent.GetIndex();
2111  pTextNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx );
2112  }
2113  else
2114  pFormat->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat( pFormat );
2115  }
2116  }
2117  if(xShapeAgg.is())
2118  {
2119  uno::Any aAgg(xShapeAgg->queryAggregation( cppu::UnoType<XComponent>::get()));
2120  uno::Reference<XComponent> xComp;
2121  aAgg >>= xComp;
2122  if(xComp.is())
2123  xComp->dispose();
2124  }
2125  if(m_pPage)
2126  const_cast<SwFmDrawPage*>(m_pPage)->RemoveShape(this);
2127  m_pPage = nullptr;
2128 }
2129 
2131  const uno::Reference< lang::XEventListener > & aListener)
2132 {
2133  SvxShape* pSvxShape = GetSvxShape();
2134  if(pSvxShape)
2135  pSvxShape->addEventListener(aListener);
2136 }
2137 
2139  const uno::Reference< lang::XEventListener > & aListener)
2140 {
2141  SvxShape* pSvxShape = GetSvxShape();
2142  if(pSvxShape)
2143  pSvxShape->removeEventListener(aListener);
2144 }
2145 
2147 {
2148  return "SwXShape";
2149 }
2150 
2151 sal_Bool SwXShape::supportsService(const OUString& rServiceName)
2152 {
2153  return cppu::supportsService(this, rServiceName);
2154 }
2155 
2156 uno::Sequence< OUString > SwXShape::getSupportedServiceNames()
2157 {
2158  uno::Sequence< OUString > aSeq;
2159  if (SvxShape* pSvxShape = GetSvxShape())
2160  aSeq = pSvxShape->getSupportedServiceNames();
2161  aSeq.realloc(aSeq.getLength() + 1);
2162  aSeq.getArray()[aSeq.getLength() - 1] = "com.sun.star.drawing.Shape";
2163  return aSeq;
2164 }
2165 
2167 {
2168  SvxShape* pSvxShape = nullptr;
2169  if(xShapeAgg.is())
2170  {
2171  uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY);
2172  if(xShapeTunnel.is())
2173  pSvxShape = reinterpret_cast< SvxShape * >(
2174  sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
2175  }
2176  return pSvxShape;
2177 }
2178 
2179 // #i31698#
2180 // implementation of virtual methods from drawing::XShape
2181 awt::Point SAL_CALL SwXShape::getPosition()
2182 {
2183  awt::Point aPos( GetAttrPosition() );
2184 
2185  // handle group members
2186  SvxShape* pSvxShape = GetSvxShape();
2187  if ( pSvxShape )
2188  {
2189  SdrObject* pTopGroupObj = GetTopGroupObj( pSvxShape );
2190  if ( pTopGroupObj )
2191  {
2192  // #i34750# - get attribute position of top group
2193  // shape and add offset between top group object and group member
2194  uno::Reference< drawing::XShape > xGroupShape( pTopGroupObj->getUnoShape(), uno::UNO_QUERY );
2195  aPos = xGroupShape->getPosition();
2196  // add offset between top group object and group member
2197  // to the determined attribute position
2198  // #i34750#:
2199  // consider the layout direction
2200  const tools::Rectangle aMemberObjRect = GetSvxShape()->GetSdrObject()->GetSnapRect();
2201  const tools::Rectangle aGroupObjRect = pTopGroupObj->GetSnapRect();
2202  // #i53320# - relative position of group member and
2203  // top group object is always given in horizontal left-to-right layout.
2204  awt::Point aOffset( 0, 0 );
2205  {
2206  aOffset.X = ( aMemberObjRect.Left() - aGroupObjRect.Left() );
2207  aOffset.Y = ( aMemberObjRect.Top() - aGroupObjRect.Top() );
2208  }
2209  aOffset.X = convertTwipToMm100(aOffset.X);
2210  aOffset.Y = convertTwipToMm100(aOffset.Y);
2211  aPos.X += aOffset.X;
2212  aPos.Y += aOffset.Y;
2213  }
2214  }
2215 
2216  return aPos;
2217 }
2218 
2219 void SAL_CALL SwXShape::setPosition( const awt::Point& aPosition )
2220 {
2221  SdrObject* pTopGroupObj = GetTopGroupObj();
2222  if ( !pTopGroupObj )
2223  {
2224  // #i37877# - no adjustment of position attributes,
2225  // if the position also has to be applied at the drawing object and
2226  // a contact object is already registered at the drawing object.
2227  bool bApplyPosAtDrawObj(false);
2228  bool bNoAdjustOfPosProp(false);
2229  // #i35798# - apply position also to drawing object,
2230  // if drawing object has no anchor position set.
2231  if ( mxShape.is() )
2232  {
2233  SvxShape* pSvxShape = GetSvxShape();
2234  if ( pSvxShape )
2235  {
2236  const SdrObject* pObj = pSvxShape->GetSdrObject();
2237  if ( pObj &&
2238  pObj->GetAnchorPos().X() == 0 &&
2239  pObj->GetAnchorPos().Y() == 0 )
2240  {
2241  bApplyPosAtDrawObj = true;
2242  if ( pObj->GetUserCall() &&
2243  dynamic_cast<const SwDrawContact*>( pObj->GetUserCall()) != nullptr )
2244  {
2245  bNoAdjustOfPosProp = true;
2246  }
2247  }
2248  }
2249  }
2250  // shape isn't a group member. Thus, set positioning attributes
2251  if ( !bNoAdjustOfPosProp )
2252  {
2253  AdjustPositionProperties( aPosition );
2254  }
2255  if ( bApplyPosAtDrawObj )
2256  {
2257  mxShape->setPosition( aPosition );
2258  }
2259  }
2260  else if ( mxShape.is() )
2261  {
2262  // shape is a member of a group. Thus, set its position.
2263  awt::Point aNewPos( aPosition );
2264  // The given position is given in the according layout direction. Thus,
2265  // it has to be converted to a position in horizontal left-to-right
2266  // layout.
2267  // convert given absolute attribute position in layout direction into
2268  // position in horizontal left-to-right layout.
2269  {
2270  aNewPos = ConvertPositionToHoriL2R( aNewPos, getSize() );
2271  }
2272  // Convert given absolute position in horizontal left-to-right
2273  // layout into relative position in horizontal left-to-right layout.
2274  uno::Reference< drawing::XShape > xGroupShape( pTopGroupObj->getUnoShape(), uno::UNO_QUERY );
2275  {
2276  // #i34750#
2277  // use method <xGroupShape->getPosition()> to get the correct
2278  // position of the top group object.
2279  awt::Point aAttrPosInHoriL2R(
2280  ConvertPositionToHoriL2R( xGroupShape->getPosition(),
2281  xGroupShape->getSize() ) );
2282  aNewPos.X = o3tl::saturating_sub(aNewPos.X, aAttrPosInHoriL2R.X);
2283  aNewPos.Y = o3tl::saturating_sub(aNewPos.Y, aAttrPosInHoriL2R.Y);
2284  }
2285  // convert relative position in horizontal left-to-right layout into
2286  // absolute position in horizontal left-to-right layout
2287  {
2288  // #i34750#
2289  // use method <SvxShape->getPosition()> to get the correct
2290  // 'Drawing layer' position of the top group shape.
2291  uno::Reference< lang::XUnoTunnel > xGrpShapeTunnel(
2292  pTopGroupObj->getUnoShape(),
2293  uno::UNO_QUERY );
2294  SvxShape* pSvxGroupShape = reinterpret_cast< SvxShape * >(
2295  sal::static_int_cast< sal_IntPtr >( xGrpShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
2296  const awt::Point aGroupPos = pSvxGroupShape->getPosition();
2297  aNewPos.X = o3tl::saturating_add(aNewPos.X, aGroupPos.X);
2298  aNewPos.Y = o3tl::saturating_add(aNewPos.Y, aGroupPos.Y);
2299  }
2300  // set position
2301  mxShape->setPosition( aNewPos );
2302  }
2303 }
2304 
2305 awt::Size SAL_CALL SwXShape::getSize()
2306 {
2307  awt::Size aSize;
2308  if ( mxShape.is() )
2309  {
2310  aSize = mxShape->getSize();
2311  }
2312  return aSize;
2313 }
2314 
2315 void SAL_CALL SwXShape::setSize( const awt::Size& aSize )
2316 {
2317  comphelper::ProfileZone aZone("SwXShape::setSize");
2318 
2319  if ( mxShape.is() )
2320  {
2321  mxShape->setSize( aSize );
2322  }
2324 }
2325 // #i31698#
2326 // implementation of virtual methods from drawing::XShapeDescriptor
2327 OUString SAL_CALL SwXShape::getShapeType()
2328 {
2329  if ( mxShape.is() )
2330  {
2331  return mxShape->getShapeType();
2332  }
2333  return OUString();
2334 }
2339 {
2340  SdrObject* pTopGroupObj( nullptr );
2341 
2342  SvxShape* pSvxShape = _pSvxShape ? _pSvxShape : GetSvxShape();
2343  if ( pSvxShape )
2344  {
2345  SdrObject* pSdrObj = pSvxShape->GetSdrObject();
2346  if ( pSdrObj && pSdrObj->getParentSdrObjectFromSdrObject() )
2347  {
2348  pTopGroupObj = pSdrObj->getParentSdrObjectFromSdrObject();
2349  while ( pTopGroupObj->getParentSdrObjectFromSdrObject() )
2350  {
2351  pTopGroupObj = pTopGroupObj->getParentSdrObjectFromSdrObject();
2352  }
2353  }
2354  }
2355 
2356  return pTopGroupObj;
2357 }
2358 
2363 {
2364  awt::Point aAttrPos;
2365 
2366  uno::Any aHoriPos( getPropertyValue("HoriOrientPosition") );
2367  aHoriPos >>= aAttrPos.X;
2368  uno::Any aVertPos( getPropertyValue("VertOrientPosition") );
2369  aVertPos >>= aAttrPos.Y;
2370  // #i35798# - fallback, if attribute position is (0,0)
2371  // and no anchor position is applied to the drawing object
2372  SvxShape* pSvxShape = GetSvxShape();
2373  if ( pSvxShape )
2374  {
2375  const SdrObject* pObj = pSvxShape->GetSdrObject();
2376  if ( pObj &&
2377  pObj->GetAnchorPos().X() == 0 &&
2378  pObj->GetAnchorPos().Y() == 0 &&
2379  aAttrPos.X == 0 && aAttrPos.Y == 0 )
2380  {
2381  const tools::Rectangle aObjRect = pObj->GetSnapRect();
2382  aAttrPos.X = convertTwipToMm100(aObjRect.Left());
2383  aAttrPos.Y = convertTwipToMm100(aObjRect.Top());
2384  }
2385  }
2386  // #i35007# - If drawing object is anchored as-character,
2387  // it's x-position isn't sensible. Thus, return the x-position as zero in this case.
2388  text::TextContentAnchorType eTextAnchorType =
2389  text::TextContentAnchorType_AT_PARAGRAPH;
2390  {
2391  uno::Any aAny = getPropertyValue( "AnchorType" );
2392  aAny >>= eTextAnchorType;
2393  }
2394  if ( eTextAnchorType == text::TextContentAnchorType_AS_CHARACTER )
2395  {
2396  aAttrPos.X = 0;
2397  }
2398 
2399  return aAttrPos;
2400 }
2401 
2406 awt::Point SwXShape::ConvertPositionToHoriL2R( const awt::Point& rObjPos,
2407  const awt::Size& rObjSize )
2408 {
2409  awt::Point aObjPosInHoriL2R( rObjPos );
2410 
2411  SwFrameFormat* pFrameFormat = GetFrameFormat();
2412  if ( pFrameFormat )
2413  {
2414  SwFrameFormat::tLayoutDir eLayoutDir = pFrameFormat->GetLayoutDir();
2415  switch ( eLayoutDir )
2416  {
2418  {
2419  // nothing to do
2420  }
2421  break;
2423  {
2424  aObjPosInHoriL2R.X = -rObjPos.X - rObjSize.Width;
2425  }
2426  break;
2428  {
2429  aObjPosInHoriL2R.X = -rObjPos.Y - rObjSize.Width;
2430  aObjPosInHoriL2R.Y = rObjPos.X;
2431  }
2432  break;
2433  default:
2434  {
2435  OSL_FAIL( "<SwXShape::ConvertPositionToHoriL2R(..)> - unsupported layout direction" );
2436  }
2437  }
2438  }
2439 
2440  return aObjPosInHoriL2R;
2441 }
2442 
2448  const drawing::HomogenMatrix3& rMatrixInHoriL2R )
2449 {
2450  drawing::HomogenMatrix3 aMatrix(rMatrixInHoriL2R);
2451 
2452  // #i44334#, #i44681# - direct manipulation of the
2453  // transformation structure isn't valid, if it contains rotation.
2454  SvxShape* pSvxShape = GetSvxShape();
2455  OSL_ENSURE( pSvxShape,
2456  "<SwXShape::ConvertTransformationToLayoutDir(..)> - no SvxShape found!");
2457  if ( pSvxShape )
2458  {
2459  const SdrObject* pObj = pSvxShape->GetSdrObject();
2460  OSL_ENSURE( pObj,
2461  "<SwXShape::ConvertTransformationToLayoutDir(..)> - no SdrObject found!");
2462  if ( pObj )
2463  {
2464  // get position of object in Writer coordinate system.
2465  awt::Point aPos( getPosition() );
2466  // get position of object in Drawing layer coordinate system
2467  const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() );
2468  const awt::Point aObjPos(
2469  convertTwipToMm100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ),
2470  convertTwipToMm100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) );
2471  // determine difference between these positions according to the
2472  // Writer coordinate system
2473  const awt::Point aTranslateDiff( aPos.X - aObjPos.X,
2474  aPos.Y - aObjPos.Y );
2475  // apply translation difference to transformation matrix.
2476  if ( aTranslateDiff.X != 0 || aTranslateDiff.Y != 0 )
2477  {
2478  // #i73079# - use correct matrix type
2479  ::basegfx::B2DHomMatrix aTempMatrix;
2480 
2481  aTempMatrix.set(0, 0, aMatrix.Line1.Column1 );
2482  aTempMatrix.set(0, 1, aMatrix.Line1.Column2 );
2483  aTempMatrix.set(0, 2, aMatrix.Line1.Column3 );
2484  aTempMatrix.set(1, 0, aMatrix.Line2.Column1 );
2485  aTempMatrix.set(1, 1, aMatrix.Line2.Column2 );
2486  aTempMatrix.set(1, 2, aMatrix.Line2.Column3 );
2487  aTempMatrix.set(2, 0, aMatrix.Line3.Column1 );
2488  aTempMatrix.set(2, 1, aMatrix.Line3.Column2 );
2489  aTempMatrix.set(2, 2, aMatrix.Line3.Column3 );
2490  // #i73079#
2491  aTempMatrix.translate( aTranslateDiff.X, aTranslateDiff.Y );
2492  aMatrix.Line1.Column1 = aTempMatrix.get(0, 0);
2493  aMatrix.Line1.Column2 = aTempMatrix.get(0, 1);
2494  aMatrix.Line1.Column3 = aTempMatrix.get(0, 2);
2495  aMatrix.Line2.Column1 = aTempMatrix.get(1, 0);
2496  aMatrix.Line2.Column2 = aTempMatrix.get(1, 1);
2497  aMatrix.Line2.Column3 = aTempMatrix.get(1, 2);
2498  aMatrix.Line3.Column1 = aTempMatrix.get(2, 0);
2499  aMatrix.Line3.Column2 = aTempMatrix.get(2, 1);
2500  aMatrix.Line3.Column3 = aTempMatrix.get(2, 2);
2501  }
2502  }
2503  }
2504 
2505  return aMatrix;
2506 }
2507 
2511 void SwXShape::AdjustPositionProperties( const awt::Point& rPosition )
2512 {
2513  // handle x-position
2514  // #i35007# - no handling of x-position, if drawing
2515  // object is anchored as-character, because it doesn't make sense.
2516  text::TextContentAnchorType eTextAnchorType =
2517  text::TextContentAnchorType_AT_PARAGRAPH;
2518  {
2519  uno::Any aAny = getPropertyValue( "AnchorType" );
2520  aAny >>= eTextAnchorType;
2521  }
2522  if ( eTextAnchorType != text::TextContentAnchorType_AS_CHARACTER )
2523  {
2524  // determine current x-position
2525  const OUString aHoriPosPropStr("HoriOrientPosition");
2526  uno::Any aHoriPos( getPropertyValue( aHoriPosPropStr ) );
2527  sal_Int32 dCurrX = 0;
2528  aHoriPos >>= dCurrX;
2529  // change x-position attribute, if needed
2530  if ( dCurrX != rPosition.X )
2531  {
2532  // adjust x-position orientation to text::HoriOrientation::NONE, if needed
2533  // Note: has to be done before setting x-position attribute
2534  const OUString aHoriOrientPropStr("HoriOrient");
2535  uno::Any aHoriOrient( getPropertyValue( aHoriOrientPropStr ) );
2536  sal_Int16 eHoriOrient;
2537  if (aHoriOrient >>= eHoriOrient) // may be void
2538  {
2539  if ( eHoriOrient != text::HoriOrientation::NONE )
2540  {
2541  eHoriOrient = text::HoriOrientation::NONE;
2542  aHoriOrient <<= eHoriOrient;
2543  setPropertyValue( aHoriOrientPropStr, aHoriOrient );
2544  }
2545  }
2546  // set x-position attribute
2547  aHoriPos <<= rPosition.X;
2548  setPropertyValue( aHoriPosPropStr, aHoriPos );
2549  }
2550  }
2551 
2552  // handle y-position
2553  {
2554  // determine current y-position
2555  const OUString aVertPosPropStr("VertOrientPosition");
2556  uno::Any aVertPos( getPropertyValue( aVertPosPropStr ) );
2557  sal_Int32 dCurrY = 0;
2558  aVertPos >>= dCurrY;
2559  // change y-position attribute, if needed
2560  if ( dCurrY != rPosition.Y )
2561  {
2562  // adjust y-position orientation to text::VertOrientation::NONE, if needed
2563  // Note: has to be done before setting y-position attribute
2564  const OUString aVertOrientPropStr("VertOrient");
2565  uno::Any aVertOrient( getPropertyValue( aVertOrientPropStr ) );
2566  sal_Int16 eVertOrient;
2567  if (aVertOrient >>= eVertOrient) // may be void
2568  {
2569  if ( eVertOrient != text::VertOrientation::NONE )
2570  {
2571  eVertOrient = text::VertOrientation::NONE;
2572  aVertOrient <<= eVertOrient;
2573  setPropertyValue( aVertOrientPropStr, aVertOrient );
2574  }
2575  }
2576  // set y-position attribute
2577  aVertPos <<= rPosition.Y;
2578  setPropertyValue( aVertPosPropStr, aVertPos );
2579  }
2580  }
2581 }
2582 
2588  const css::awt::Point& aStartOrEndPos )
2589 {
2590  awt::Point aConvertedPos( aStartOrEndPos );
2591 
2592  SvxShape* pSvxShape = GetSvxShape();
2593  OSL_ENSURE( pSvxShape,
2594  "<SwXShape::ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!");
2595  if ( pSvxShape )
2596  {
2597  const SdrObject* pObj = pSvxShape->GetSdrObject();
2598  OSL_ENSURE( pObj,
2599  "<SwXShape::ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!");
2600  if ( pObj )
2601  {
2602  // get position of object in Writer coordinate system.
2603  awt::Point aPos( getPosition() );
2604  // get position of object in Drawing layer coordinate system
2605  const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() );
2606  const awt::Point aObjPos(
2607  convertTwipToMm100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ),
2608  convertTwipToMm100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) );
2609  // determine difference between these positions according to the
2610  // Writer coordinate system
2611  const awt::Point aTranslateDiff( aPos.X - aObjPos.X,
2612  aPos.Y - aObjPos.Y );
2613  // apply translation difference to transformation matrix.
2614  if ( aTranslateDiff.X != 0 || aTranslateDiff.Y != 0 )
2615  {
2616  aConvertedPos.X = aConvertedPos.X + aTranslateDiff.X;
2617  aConvertedPos.Y = aConvertedPos.Y + aTranslateDiff.Y;
2618  }
2619  }
2620  }
2621 
2622  return aConvertedPos;
2623 }
2624 
2625 css::drawing::PolyPolygonBezierCoords SwXShape::ConvertPolyPolygonBezierToLayoutDir(
2626  const css::drawing::PolyPolygonBezierCoords& aPath )
2627 {
2628  drawing::PolyPolygonBezierCoords aConvertedPath( aPath );
2629 
2630  SvxShape* pSvxShape = GetSvxShape();
2631  OSL_ENSURE( pSvxShape,
2632  "<SwXShape::ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!");
2633  if ( pSvxShape )
2634  {
2635  const SdrObject* pObj = pSvxShape->GetSdrObject();
2636  OSL_ENSURE( pObj,
2637  "<SwXShape::ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!");
2638  if ( pObj )
2639  {
2640  // get position of object in Writer coordinate system.
2641  awt::Point aPos( getPosition() );
2642  // get position of object in Drawing layer coordinate system
2643  const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() );
2644  const awt::Point aObjPos(
2645  convertTwipToMm100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ),
2646  convertTwipToMm100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) );
2647  // determine difference between these positions according to the
2648  // Writer coordinate system
2649  const awt::Point aTranslateDiff( aPos.X - aObjPos.X,
2650  aPos.Y - aObjPos.Y );
2651  // apply translation difference to PolyPolygonBezier.
2652  if ( aTranslateDiff.X != 0 || aTranslateDiff.Y != 0 )
2653  {
2655  aTranslateDiff.X, aTranslateDiff.Y));
2656 
2657  for(drawing::PointSequence& rInnerSequence : aConvertedPath.Coordinates)
2658  {
2659  for(awt::Point& rPoint : rInnerSequence)
2660  {
2661  basegfx::B2DPoint aNewCoordinatePair(rPoint.X, rPoint.Y);
2662  aNewCoordinatePair *= aMatrix;
2663  rPoint.X = basegfx::fround(aNewCoordinatePair.getX());
2664  rPoint.Y = basegfx::fround(aNewCoordinatePair.getY());
2665  }
2666  }
2667  }
2668  }
2669  }
2670 
2671  return aConvertedPath;
2672 }
2673 
2674 SwXGroupShape::SwXGroupShape(uno::Reference<XInterface> & xShape,
2675  SwDoc const*const pDoc)
2676  : SwXShape(xShape, pDoc)
2677 {
2678 #if OSL_DEBUG_LEVEL > 0
2679  uno::Reference<XShapes> xShapes(xShapeAgg, uno::UNO_QUERY);
2680  OSL_ENSURE(xShapes.is(), "no SvxShape found or shape is not a group shape");
2681 #endif
2682 }
2683 
2685 {
2686 }
2687 
2689 {
2690  uno::Any aRet;
2691  if(rType == cppu::UnoType<XShapes>::get())
2692  aRet <<= uno::Reference<XShapes>(this);
2693  else
2694  aRet = SwXShape::queryInterface(rType);
2695  return aRet;
2696 }
2697 
2698 void SwXGroupShape::acquire( ) throw()
2699 {
2701 }
2702 
2703 void SwXGroupShape::release( ) throw()
2704 {
2706 }
2707 
2708 void SwXGroupShape::add( const uno::Reference< XShape >& xShape )
2709 {
2710  SolarMutexGuard aGuard;
2711  SvxShape* pSvxShape = GetSvxShape();
2712  SwFrameFormat* pFormat = GetFrameFormat();
2713  if(!(pSvxShape && pFormat))
2714  throw uno::RuntimeException();
2715 
2716  uno::Reference<XShapes> xShapes;
2717  if( xShapeAgg.is() )
2718  {
2719  const uno::Type& rType = cppu::UnoType<XShapes>::get();
2720  uno::Any aAgg = xShapeAgg->queryAggregation( rType );
2721  aAgg >>= xShapes;
2722  }
2723  if(!xShapes.is())
2724  throw uno::RuntimeException();
2725 
2726  xShapes->add(xShape);
2727 
2728 
2729  uno::Reference<lang::XUnoTunnel> xTunnel(xShape, uno::UNO_QUERY);
2730  SwXShape* pSwShape = nullptr;
2731  if(xShape.is())
2732  pSwShape = reinterpret_cast< SwXShape * >(
2733  sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXShape::getUnoTunnelId()) ));
2734  if(pSwShape && pSwShape->m_bDescriptor)
2735  {
2736  SvxShape* pAddShape = reinterpret_cast< SvxShape * >(
2737  sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
2738  if(pAddShape)
2739  {
2740  SdrObject* pObj = pAddShape->GetSdrObject();
2741  if(pObj)
2742  {
2743  SwDoc* pDoc = pFormat->GetDoc();
2744  // set layer of new drawing
2745  // object to corresponding invisible layer.
2746  if( SdrInventor::FmForm != pObj->GetObjInventor())
2747  {
2748  pObj->SetLayer( pSwShape->pImpl->GetOpaque()
2751  }
2752  else
2753  {
2755  }
2756  }
2757  }
2758  pSwShape->m_bDescriptor = false;
2759  //add the group member to the format of the group
2760  SwFrameFormat* pShapeFormat = ::FindFrameFormat( pSvxShape->GetSdrObject() );
2761 
2762  if(pShapeFormat)
2763  pSwShape->SetFrameFormat(pShapeFormat);
2764  }
2765 
2766 }
2767 
2768 void SwXGroupShape::remove( const uno::Reference< XShape >& xShape )
2769 {
2770  SolarMutexGuard aGuard;
2771  uno::Reference<XShapes> xShapes;
2772  if( xShapeAgg.is() )
2773  {
2774  const uno::Type& rType = cppu::UnoType<XShapes>::get();
2775  uno::Any aAgg = xShapeAgg->queryAggregation( rType );
2776  aAgg >>= xShapes;
2777  }
2778  if(!xShapes.is())
2779  throw uno::RuntimeException();
2780  xShapes->remove(xShape);
2781 }
2782 
2784 {
2785  SolarMutexGuard aGuard;
2786  uno::Reference<XIndexAccess> xAcc;
2787  if( xShapeAgg.is() )
2788  {
2790  uno::Any aAgg = xShapeAgg->queryAggregation( rType );
2791  aAgg >>= xAcc;
2792  }
2793  if(!xAcc.is())
2794  throw uno::RuntimeException();
2795  return xAcc->getCount();
2796 }
2797 
2799 {
2800  SolarMutexGuard aGuard;
2801  uno::Reference<XIndexAccess> xAcc;
2802  if( xShapeAgg.is() )
2803  {
2805  uno::Any aAgg = xShapeAgg->queryAggregation( rType );
2806  aAgg >>= xAcc;
2807  }
2808  if(!xAcc.is())
2809  throw uno::RuntimeException();
2810  return xAcc->getByIndex(nIndex);
2811 }
2812 
2814 {
2815  SolarMutexGuard aGuard;
2816  uno::Reference<XIndexAccess> xAcc;
2817  if( xShapeAgg.is() )
2818  {
2820  uno::Any aAgg = xShapeAgg->queryAggregation( rType );
2821  aAgg >>= xAcc;
2822  }
2823  if(!xAcc.is())
2824  throw uno::RuntimeException();
2825  return xAcc->getElementType();
2826 }
2827 
2829 {
2830  SolarMutexGuard aGuard;
2831  uno::Reference<XIndexAccess> xAcc;
2832  if( xShapeAgg.is() )
2833  {
2835  uno::Any aAgg = xShapeAgg->queryAggregation( rType );
2836  aAgg >>= xAcc;
2837  }
2838  if(!xAcc.is())
2839  throw uno::RuntimeException();
2840  return xAcc->hasElements();
2841 }
2842 
2843 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool GetCursorOfst(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Primary passes the call to the first page.
Definition: trvlfrm.cxx:420
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Point TopLeft() const
static css::uno::Reference< css::drawing::XShapeGroup > GetShapeGroup(SdrObject *pObj)
Definition: unodraw.cxx:305
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &aPropertyName) override
Definition: unodraw.cxx:1739
std::unique_ptr< SwFormatFollowTextFlow > m_pFollowTextFlow
Definition: unodraw.cxx:90
void SetRelativeWidthRelation(sal_Int16 eValue)
#define MID_CHAIN_NAME
Definition: unomid.h:58
void SelectObjectsInView(const css::uno::Reference< css::drawing::XShapes > &aShapes, SdrPageView *pPageView)
const css::uno::WeakReference< css::uno::XInterface > & getWeakUnoShape() const
SwXGroupShape(css::uno::Reference< css::uno::XInterface > &xShape, SwDoc const *pDoc)
Definition: unodraw.cxx:2674
virtual sal_Int32 SAL_CALL getCount() override
Definition: unodraw.cxx:2783
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unodraw.cxx:1947
SvxULSpaceItem * GetULSpace(bool bCreate=false)
Definition: unodraw.cxx:168
#define RES_FRM_SIZE
Definition: hintids.hxx:194
bool hasValue()
virtual const SwDoc * GetDoc() const =0
svx::PropertyChangeNotifier & getShapePropertyChangeNotifier()
static css::uno::Any getByIndex(SdrPage const *pPage, sal_Int32 nIndex)
Get a shape by index, excluding TextBoxes.
size_t GetMarkCount() const
Marks a position in the document model.
Definition: pam.hxx:35
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
bool IsGrfNode() const
Definition: node.hxx:656
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
SwShapeDescriptor_Impl(const SwShapeDescriptor_Impl &)=delete
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
std::unique_ptr< SwFormatWrapInfluenceOnObjPos > m_pWrapInfluenceOnObjPos
Definition: unodraw.cxx:92
virtual const SwRootFrame * GetCurrentLayout() const =0
std::unique_ptr< SwShapeDescriptor_Impl > pImpl
Definition: unodraw.hxx:150
SwDocShell * GetDocShell()
Definition: doc.hxx:1341
#define RES_HORI_ORIENT
Definition: hintids.hxx:208
const bool & GetOpaque() const
Definition: unodraw.cxx:184
stay with the cursor inside text
Definition: crstate.hxx:127
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unodraw.cxx:527
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unodraw.cxx:1032
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unodraw.cxx:2813
SwNodeIndex nNode
Definition: pam.hxx:37
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &aType) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: unodraw.cxx:1005
bool IsOpaque() const
Definition: unodraw.cxx:180
static void destroy(SwFrameFormat *pShape)
Destroy a TextBox for a shape.
virtual SdrLayerID GetInvisibleControlsId() const =0
SwFormatSurround * GetSurround(bool bCreate=false)
Definition: unodraw.cxx:152
std::enable_if< std::is_signed< T >::value, T >::type saturating_sub(T a, T b)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unodraw.cxx:2151
#define MID_FRMSIZE_REL_WIDTH
Definition: unomid.h:72
sal_uInt16 GetPageNum() const
Definition: fmtanchr.hxx:66
SwFormatWrapInfluenceOnObjPos * GetWrapInfluenceOnObjPos(const bool _bCreate=false)
Definition: unodraw.cxx:233
const SwFrameFormat * GetFrameFormat() const
Definition: unoframe.hxx:151
Reference< XFrame > xFrame
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unodraw.cxx:465
#define RES_SURROUND
Definition: hintids.hxx:206
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unodraw.cxx:1960
static sal_Int32 getOrdNum(const SdrObject *pObject)
Get the order of the shape, excluding TextBoxes.
double getX() const
#define RES_FRMATR_END
Definition: hintids.hxx:236
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
bool IsInserted() const
Definition: doc.hxx:185
SdrObject * GetTopGroupObj(SvxShape *_pSvxShape=nullptr)
method to determine top group object
Definition: unodraw.cxx:2338
void SetRelativeHeightRelation(sal_Int16 eValue)
sal_uInt16 sal_Char sal_Char * pDesc
OUString getImplementationName()
SvxLRSpaceItem * GetLRSpace(bool bCreate=false)
Definition: unodraw.cxx:160
double getY() const
SwNode & GetNode() const
Definition: ndindex.hxx:118
virtual css::uno::Reference< css::drawing::XShape > CreateShape(SdrObject *pObj) const override
Definition: unodraw.cxx:310
long SwTwips
Definition: swtypes.hxx:49
virtual void SAL_CALL dispose() override
Definition: unodraw.cxx:2079
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: unodraw.cxx:989
sal_Int16 GetPositionLayoutDir() const
Definition: unodraw.cxx:211
SdrMark * GetMark(size_t nNum) const
SwFormatHoriOrient * GetHOrient(bool bCreate=false)
Definition: unodraw.cxx:126
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:176
const SwFmDrawPage * m_pPage
Definition: unodraw.hxx:139
virtual sal_Bool SAL_CALL hasElements() override
Definition: unodraw.cxx:2828
sal_uInt16 Which() const
Definition: txatbase.hxx:110
#define RES_WRAP_INFLUENCE_ON_OBJPOS
Definition: hintids.hxx:230
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:347
virtual void SAL_CALL acquire() SAL_OVERRIDE
void PreUnGroup(const css::uno::Reference< css::drawing::XShapeGroup > &rShapeGroup)
Definition: unodraw.cxx:269
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unotext.cxx:1208
virtual css::uno::Reference< css::drawing::XShapeGroup > SAL_CALL group(const css::uno::Reference< css::drawing::XShapes > &xShapes) override
Definition: unodraw.cxx:729
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
SfxHintId GetId() const
SwShapeDescriptor_Impl * GetDescImpl()
Definition: unodraw.hxx:258
double get(sal_uInt16 nRow, sal_uInt16 nColumn) const
SwFrameFormat * m_pFormat
Definition: unodraw.hxx:140
static css::uno::Any queryInterface(const SwFrameFormat *pShape, const css::uno::Type &rType)
Get interface of a shape's TextBox, if there is any.
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:187
virtual const tools::Rectangle & GetSnapRect() const
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
Definition: ndtxt.cxx:3059
virtual void SAL_CALL acquire() override
Definition: unodraw.cxx:2698
#define RES_CHAIN
Definition: hintids.hxx:219
const SwDoc & GetDoc() const
Definition: unoobj2.cxx:789
SwXDrawPage(SwDoc *pDoc)
Definition: unodraw.cxx:471
virtual css::uno::Reference< css::uno::XInterface > getUnoShape()
#define MID_FRMSIZE_SIZE
Definition: unomid.h:70
bool IsMore() const
SwIndex nContent
Definition: pam.hxx:38
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
virtual css::awt::Point SAL_CALL getPosition() override
Definition: unodraw.cxx:2181
virtual ~SwXGroupShape() override
Definition: unodraw.cxx:2684
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history...
Definition: docfmt.cxx:478
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
void RemovePageView()
Definition: unodraw.cxx:281
sal_uLong GetIndex() const
Definition: ndindex.hxx:151
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType)
Is the frame format a text box?
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unodraw.cxx:2130
SdrPageView * GetPageView()
Definition: unodraw.cxx:274
void SetRelativeHeight(double nValue)
bool enum2int(sal_Int32 &rnEnum, const css::uno::Any &rAny)
std::enable_if< !(detail::IsDerivedReference< T >::value||detail::IsUnoSequenceType< T >::value||std::is_base_of< css::uno::XInterface, T >::value), typename detail::Optional< T >::type >::type tryAccess(css::uno::Any const &any)
const SfxItemPropertyMapEntry * m_pPropertyMapEntries
Definition: unodraw.hxx:148
bool bInitializedPropertyNotifier
Definition: unodraw.cxx:100
#define RES_UL_SPACE
Definition: hintids.hxx:197
SwTextAttr * InsertItem(SfxPoolItem &rAttr, const sal_Int32 nStart, const sal_Int32 nEnd, const SetAttrMode nMode=SetAttrMode::DEFAULT)
create new text attribute from rAttr and insert it
Definition: thints.cxx:1224
long Top() const
void getPropertyValue(const SfxItemPropertySimpleEntry &rEntry, const SfxItemSet &rSet, css::uno::Any &rAny) const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
void SetRelativeWidth(double nValue)
virtual OUString SAL_CALL getImplementationName() override
Definition: unodraw.cxx:455
SwFrameFormat * FindFrameFormat(SdrObject *pObj)
The Get reverse way: seeks the format to the specified object.
Definition: dcontact.cxx:125
#define FN_ANCHOR_POSITION
Definition: cmdid.h:790
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unodraw.cxx:1980
void UnmarkAll()
SdrPage * mpPage
#define FN_TEXT_RANGE
Definition: cmdid.h:782
virtual css::uno::Reference< css::drawing::XShape > CreateShape(SdrObject *pObj) const override
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange)
Definition: unoobj2.cxx:1008
SdrPageView * pPageView
Definition: unodraw.hxx:46
B2IRange fround(const B2DRange &rRange)
void SetPositionLayoutDir(sal_Int16 _nPositionLayoutDir)
Definition: unodraw.cxx:215
std::unique_ptr< SwFormatSurround > m_pSurround
Definition: unodraw.cxx:84
#define RES_FOLLOW_TEXT_FLOW
Definition: hintids.hxx:228
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override
Definition: unodraw.cxx:1731
bool IsOLENode() const
Definition: node.hxx:652
void registerProvider(const ShapeProperty _eProperty, const std::shared_ptr< IPropertyValueProvider > &_rProvider)
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:164
virtual SdrLayerID GetInvisibleHellId() const =0
SwDrawContact * GroupSelection(SdrView &)
Definition: docdraw.cxx:198
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
ContactObject for connection between frames (or their formats respectively) in SwClient and the drawo...
Definition: dcontact.hxx:175
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
css::awt::Point GetAttrPosition()
method to determine position according to the positioning attributes
Definition: unodraw.cxx:2362
#define RES_FLYFRMFMT
Definition: hintids.hxx:274
sal_Int16 mnPositionLayoutDir
Definition: unodraw.cxx:94
SdrObject * GetMarkedSdrObj() const
SwShapeDescriptor_Impl & operator=(const SwShapeDescriptor_Impl &)=delete
#define MID_CHAIN_NEXTNAME
Definition: unomid.h:57
void EndListeningAll()
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unodraw.cxx:2156
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
css::drawing::HomogenMatrix3 ConvertTransformationToLayoutDir(const css::drawing::HomogenMatrix3 &rMatrixInHoriL2R)
method to convert the transformation of the drawing object to the layout direction, the drawing object is in
Definition: unodraw.cxx:2447
virtual void SetLayer(SdrLayerID nLayer)
virtual sal_Bool SAL_CALL hasElements() override
Definition: unodraw.cxx:544
#define MID_ANCHOR_ANCHORTYPE
Definition: unomid.h:43
Style of a layout element.
Definition: frmfmt.hxx:57
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unodraw.cxx:1010
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
css::uno::Sequence< OUString > getSupportedServiceNames()
#define FN_SHAPE_POSITION_LAYOUT_DIR
Definition: cmdid.h:797
uno::Reference< text::XTextRange > xTextRange
Definition: unodraw.cxx:88
virtual void SAL_CALL add(const css::uno::Reference< css::drawing::XShape > &xShape) override
#define RES_ANCHOR
Definition: hintids.hxx:209
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
virtual void SAL_CALL setPosition(const css::awt::Point &aPosition) override
#define FN_SHAPE_TRANSFORMATION_IN_HORI_L2R
Definition: cmdid.h:796
std::unique_ptr< SvxULSpaceItem > m_pULSpace
Definition: unodraw.cxx:85
virtual SwFrameFormat::tLayoutDir GetLayoutDir() const
Definition: atrfrm.cxx:2754
SwFrameFormat * GetFormat()
Definition: dcontact.hxx:112
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
void SelectObjectInView(const css::uno::Reference< css::drawing::XShape > &xShape, SdrPageView *pPageView)
#define FN_SHAPE_STARTPOSITION_IN_HORI_L2R
Definition: cmdid.h:798
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
#define RES_VERT_ORIENT
Definition: hintids.hxx:207
SvxShape * GetSvxShape()
Definition: unodraw.cxx:2166
uno::Reference< text::XTextRange > & GetTextRange()
Definition: unodraw.cxx:176
css::awt::Point ConvertStartOrEndPosToLayoutDir(const css::awt::Point &aStartOrEndPos)
method to convert start or end position of the drawing object to the Writer specific position...
Definition: unodraw.cxx:2587
int i
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:60
std::enable_if< std::is_signed< T >::value, T >::type saturating_add(T a, T b)
const SdrMarkList & GetMarkedObjectList() const
FlyAnchors.
Definition: fmtanchr.hxx:34
std::unique_ptr< SdrView > mpView
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unodraw.cxx:835
SwDoc * GetDoc()
Definition: node.hxx:702
const SdrPage * GetPage(sal_uInt16 nPgNum) const
SwDoc * GetDoc() const
Definition: pam.hxx:243
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual void DelFrames()
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: atrfrm.cxx:2617
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
Definition: unodraw.cxx:486
unsigned char sal_Bool
virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XShape > &xShape) override
Definition: unodraw.cxx:2768
void UnGroupSelection(SdrView &)
Definition: docdraw.cxx:302
::cppu::WeakImplHelper< css::lang::XServiceInfo, css::container::XEnumeration > SwSimpleEnumeration_Base
const SfxItemPropertyMap & getPropertyMap() const
static void getProperty(SwFrameFormat const *pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, css::uno::Any &rValue)
Get a property of the underlying TextFrame.
virtual const SdrObject * GetMaster() const override
Definition: dcontact.hxx:350
bool IsNoTextNode() const
Definition: node.hxx:648
bool IsGroupObject() const
SwFmDrawPage * GetSvxPage()
Definition: unodraw.cxx:799
void setPropertyValue(const SfxItemPropertySimpleEntry &rEntry, const css::uno::Any &aVal, SfxItemSet &rSet) const
SdrView * GetDrawView()
Definition: unodraw.hxx:55
css::uno::Reference< css::drawing::XShape > mxShape
Definition: unodraw.hxx:145
Marks a node in the document model.
Definition: ndindex.hxx:31
css::uno::Type const & get()
std::vector< SwXShape * > m_vShapes
Definition: unodraw.hxx:47
bool GoInDoc(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:880
SwFormatAnchor * GetAnchor(bool bCreate=false)
Definition: unodraw.cxx:118
SwXShape(css::uno::Reference< css::uno::XInterface > &xShape, SwDoc const *const pDoc)
Definition: unodraw.cxx:869
void RemoveWrapInfluenceOnObjPos()
Definition: unodraw.cxx:244
std::unique_ptr< SvxLRSpaceItem > m_pLRSpace
Definition: unodraw.cxx:86
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
SwShapeDescriptor_Impl(SwDoc const *const pDoc)
Definition: unodraw.cxx:103
virtual sal_Int32 SAL_CALL getCount() override
Definition: unodraw.cxx:513
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &...rSn)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unoport.cxx:783
static css::uno::Reference< css::drawing::XShape > GetShape(SdrObject *pObj)
Definition: unodraw.cxx:288
const SfxItemPropertySimpleEntry * getByName(const OUString &rName) const
const double * GetRelativeWidth() const
long X() const
sal_Int16 GetRelativeWidthRelation() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:437
virtual SdrInventor GetObjInventor() const
virtual SdrLayerID GetHellId() const =0
virtual SdrLayerID GetLayer() const
virtual ~SwXDrawPage() override
Definition: unodraw.cxx:477
std::unique_ptr< SwFormatAnchor > m_pAnchor
Definition: unodraw.cxx:83
#define RES_LR_SPACE
Definition: hintids.hxx:196
void SetFrameFormat(SwFrameFormat *pFormat)
Definition: unodraw.hxx:202
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
#define FN_TEXT_BOX
Definition: cmdid.h:801
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
static void AddExistingShapeToFormat(SdrObject const &_rObj)
Definition: unodraw.cxx:920
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unoobj2.cxx:850
SwFormatVertOrient * GetVOrient(bool bCreate=false)
Definition: unodraw.cxx:135
css::drawing::PolyPolygonBezierCoords ConvertPolyPolygonBezierToLayoutDir(const css::drawing::PolyPolygonBezierCoords &aPath)
method to convert PolyPolygonBezier of the drawing object to the Writer specific position, which is the attribute position in layout direction
Definition: unodraw.cxx:2625
virtual void SAL_CALL add(const css::uno::Reference< css::drawing::XShape > &xShape) override
Definition: unodraw.cxx:555
SdrObject * Next()
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
void DeleteAttributes(const sal_uInt16 nWhich, const sal_Int32 nStart, const sal_Int32 nEnd=0)
delete all attributes of type nWhich at nStart (opt. end nEnd)
Definition: thints.cxx:1673
#define MID_FRMSIZE_REL_HEIGHT_RELATION
Definition: unomid.h:88
const SwDoc * GetDoc() const
Definition: unotext.cxx:135
#define FN_SHAPE_ENDPOSITION_IN_HORI_L2R
Definition: cmdid.h:799
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: unodraw.cxx:448
virtual void SAL_CALL add(const css::uno::Reference< css::drawing::XShape > &xShape) override
Definition: unodraw.cxx:2708
SwFormatFollowTextFlow * GetFollowTextFlow(bool _bCreate=false)
Definition: unodraw.cxx:197
virtual OUString SAL_CALL getImplementationName() override
Definition: unodraw.cxx:2146
virtual SwDrawFrameFormat * InsertDrawObj(const SwPaM &rRg, SdrObject &rDrawObj, const SfxItemSet &rFlyAttrSet)=0
Insert a DrawObject.
#define MID_ANCHOR_ANCHORFRAME
Definition: unomid.h:45
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unodraw.cxx:1429
#define MID_CHAIN_PREVNAME
Definition: unomid.h:56
SfxItemState
virtual css::awt::Point SAL_CALL getPosition() override
virtual sal_Bool SAL_CALL hasElements() override
SwFmDrawPage(SdrPage *pPage)
Definition: unodraw.cxx:250
oslInterlockedCount m_refCount
#define SAL_WARN_IF(condition, area, stream)
#define RES_DRAWFRMFMT
Definition: hintids.hxx:277
virtual SdrLayerID GetInvisibleHeavenId() const =0
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
static void create(SwFrameFormat *pShape)
Create a TextBox for a shape.
virtual ~SwXShape() override
Definition: unodraw.cxx:954
const SwNodes & GetNodes() const
Definition: ndindex.hxx:155
css::uno::Reference< css::uno::XAggregation > xShapeAgg
Definition: unodraw.hxx:142
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
Definition: unodraw.cxx:2688
#define PROPERTY_MAP_TEXT_SHAPE
Definition: unomap.hxx:42
css::uno::Reference< css::uno::XAggregation > xPageAgg
Definition: unodraw.hxx:84
#define MID_FRMSIZE_REL_WIDTH_RELATION
Definition: unomid.h:87
virtual sal_Int16 GetPositionLayoutDir() const
Definition: atrfrm.cxx:2765
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: unodraw.cxx:505
#define RES_OPAQUE
Definition: hintids.hxx:204
sal_Int32 GetIndex() const
Definition: index.hxx:95
virtual void SAL_CALL setPosition(const css::awt::Point &aPosition) override
Definition: unodraw.cxx:2219
virtual SwDrawModel * GetOrCreateDrawModel()=0
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
SwNodes & GetNodes()
Definition: doc.hxx:402
SwUnoCursor & GetCursor() const
Definition: unoport.hxx:230
SdrObject * GetSdrObject() const
bool const m_isInReading
Definition: unodraw.cxx:80
static SW_DLLPUBLIC css::uno::Reference< css::text::XTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3147
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unodraw.cxx:840
std::unique_ptr< SwFormatHoriOrient > m_pHOrient
Definition: unodraw.cxx:81
const SwTextNode * GetTextNode() const
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:131
SwDoc * pDoc
Definition: unodraw.hxx:83
virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XShape > &xShape) override
Definition: unodraw.cxx:720
static sal_Int32 getCount(const SwDoc *pDoc)
Count number of shapes in the document, excluding TextBoxes.
void AdjustPositionProperties(const css::awt::Point &rPosition)
method to adjust the positioning properties
Definition: unodraw.cxx:2511
std::unique_ptr< SwFormatVertOrient > m_pVOrient
Definition: unodraw.cxx:82
long Left() const
void translate(double fX, double fY)
#define RES_TXTATR_FLYCNT
Definition: hintids.hxx:151
css::uno::Any _getPropAtAggrObj(const OUString &_rPropertyName)
method to get property from aggregation object
Definition: unodraw.cxx:1714
const Point & GetAnchorPos() const
void InvalidateSwDoc()
Renamed and outlined to detect where it's called.
Definition: unodraw.cxx:825
Format of a fly content.
Definition: fmtflcnt.hxx:32
SdrObject * getParentSdrObjectFromSdrObject() const
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:93
virtual void SAL_CALL release() SAL_OVERRIDE
virtual css::awt::Size SAL_CALL getSize() override
Definition: unodraw.cxx:2305
css::awt::Point ConvertPositionToHoriL2R(const css::awt::Point &rObjPos, const css::awt::Size &rObjSize)
method to convert the position (translation) of the drawing object to the layout direction horizontal...
Definition: unodraw.cxx:2406
void SetType(RndStdIds nRndId)
Definition: fmtanchr.hxx:71
#define MID_FRMSIZE_REL_HEIGHT
Definition: unomid.h:71
def text(shape, st)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
Definition: unodraw.cxx:969
constexpr sal_Int64 convertTwipToMm100(sal_Int64 n)
virtual void SAL_CALL ungroup(const css::uno::Reference< css::drawing::XShapeGroup > &aGroup) override
Definition: unodraw.cxx:775
sal_Int16 GetRelativeHeightRelation() const
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unoframe.cxx:1169
void Move(long nHorzMove, long nVertMove)
SwFrameFormat * GetFrameFormat() const
Definition: fmtflcnt.hxx:45
static void syncProperty(SwFrameFormat *pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, const css::uno::Any &rValue)
Sync property of TextBox with the one of the shape.
Reference< XModel > xModel
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2336
RndStdIds
const SfxItemPropertySet * m_pPropSet
Definition: unodraw.hxx:147
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unodraw.cxx:460
static css::uno::Reference< css::text::XTextContent > CreateXTextEmbeddedObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3439
static css::uno::Reference< css::text::XTextContent > CreateXTextGraphicObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3392
virtual void SAL_CALL release() override
Definition: unodraw.cxx:2703
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unodraw.cxx:2138
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
static css::uno::Reference< css::text::XTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1112
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
virtual void Notify(const SfxHint &) override
Definition: unodraw.cxx:1987
constexpr sal_Int64 convertMm100ToTwip(sal_Int64 n)
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
Definition: unodraw.cxx:1914
virtual ~SwFmDrawPage() override
Definition: unodraw.cxx:255
const SdrMarkList & PreGroup(const css::uno::Reference< css::drawing::XShapes > &rShapes)
Definition: unodraw.cxx:262
void InsertEntry(const SdrMark &rMark, bool bChkSort=true)
void SetOpaque(bool bSet)
Definition: unodraw.cxx:194
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unodraw.cxx:2798
bool m_bDescriptor
Definition: unodraw.hxx:152
#define RES_FRMATR_BEGIN
Definition: hintids.hxx:192
SwFrameFormat * GetFrameFormat() const
Definition: unodraw.hxx:259
SdrObjUserCall * GetUserCall() const
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
Definition: unodraw.cxx:1853
bool Is3DObj() const
virtual OUString SAL_CALL getShapeType() override
Definition: unodraw.cxx:2327
virtual void SetPositionLayoutDir(const sal_Int16 _nPositionLayoutDir)
Definition: atrfrm.cxx:2769
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:137
SdrObject * FindRealSdrObject()
Definition: atrfrm.cxx:2686
sal_Int32 GetEnumAsInt32(const css::uno::Any &rVal)
Definition: swunohelper.cxx:50
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unodraw.cxx:539
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unodraw.cxx:1996
SwFmDrawPage * pDrawPage
Definition: unodraw.hxx:85
bool ChgAnchor(const SdrMarkList &_rMrkList, RndStdIds _eAnchorType, const bool _bSameOnly, const bool _bPosCorr)
Definition: docfly.cxx:718
long Y() const
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1308
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unodraw.cxx:2057
virtual void SAL_CALL setSize(const css::awt::Size &aSize) override
Definition: unodraw.cxx:2315
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:843
bool HasHints() const
Definition: ndtxt.hxx:221
const double * GetRelativeHeight() const
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1486
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unodraw.cxx:1973
const SwFormatFlyCnt & GetFlyCnt() const
Definition: txatbase.hxx:206
Base class of the Writer document model elements.
Definition: node.hxx:79