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