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