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