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::unique_ptr<SwPaM> pPam(new SwPaM(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.get();
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  uno::Reference< beans::XPropertySetInfo > aRet;
1020  if(m_xShapeAgg.is())
1021  {
1022  const uno::Type& rPropSetType = cppu::UnoType<beans::XPropertySet>::get();
1023  uno::Any aPSet = m_xShapeAgg->queryAggregation( rPropSetType );
1024  if(auto xPrSet = o3tl::tryAccess<uno::Reference<beans::XPropertySet>>(
1025  aPSet))
1026  {
1027  uno::Reference< beans::XPropertySetInfo > xInfo = (*xPrSet)->getPropertySetInfo();
1028  // Expand PropertySetInfo!
1029  const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
1030  aRet = new SfxExtItemPropertySetInfo( m_pPropertyMapEntries, aPropSeq );
1031  }
1032  }
1033  if(!aRet.is())
1034  aRet = m_pPropSet->getPropertySetInfo();
1035  return aRet;
1036 }
1037 
1038 void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
1039 {
1040  SolarMutexGuard aGuard;
1041  SwFrameFormat* pFormat = GetFrameFormat();
1042  const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
1043  if(!m_xShapeAgg.is())
1044  return;
1045 
1046  if(pEntry)
1047  {
1048  if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
1049  throw beans::PropertyVetoException ("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1050  // with the layout it is possible to move the anchor without changing the position
1051  if(pFormat)
1052  {
1053  SwAttrSet aSet(pFormat->GetAttrSet());
1054  SwDoc* pDoc = pFormat->GetDoc();
1055  if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORFRAME == pEntry->nMemberId)
1056  {
1057  bool bDone = false;
1058  uno::Reference<text::XTextFrame> xFrame;
1059  if(aValue >>= xFrame)
1060  {
1061  SwXFrame* pFrame = comphelper::getUnoTunnelImplementation<SwXFrame>(xFrame);
1062  if(pFrame && pFrame->GetFrameFormat() &&
1063  pFrame->GetFrameFormat()->GetDoc() == pDoc)
1064  {
1065  UnoActionContext aCtx(pDoc);
1066  SfxItemSet aItemSet( pDoc->GetAttrPool(),
1068  aItemSet.SetParent(&pFormat->GetAttrSet());
1069  SwFormatAnchor aAnchor = static_cast<const SwFormatAnchor&>(aItemSet.Get(pEntry->nWID));
1070  SwPosition aPos(*pFrame->GetFrameFormat()->GetContent().GetContentIdx());
1071  aAnchor.SetAnchor(&aPos);
1072  aAnchor.SetType(RndStdIds::FLY_AT_FLY);
1073  aItemSet.Put(aAnchor);
1074  pFormat->SetFormatAttr(aItemSet);
1075  bDone = true;
1076  }
1077  }
1078  if(!bDone)
1079  throw lang::IllegalArgumentException();
1080  }
1081  else if(RES_OPAQUE == pEntry->nWID)
1082  {
1083  SvxShape* pSvxShape = GetSvxShape();
1084  SAL_WARN_IF(!pSvxShape, "sw.uno", "No SvxShape found!");
1085  if(pSvxShape)
1086  {
1087  SdrObject* pObj = pSvxShape->GetSdrObject();
1088  // set layer of new drawing
1089  // object to corresponding invisible layer.
1090  bool bIsVisible = pDoc->getIDocumentDrawModelAccess().IsVisibleLayerId( pObj->GetLayer() );
1091  if(SdrInventor::FmForm != pObj->GetObjInventor())
1092  {
1093  pObj->SetLayer( *o3tl::doAccess<bool>(aValue)
1094  ? ( bIsVisible ? pDoc->getIDocumentDrawModelAccess().GetHeavenId() : pDoc->getIDocumentDrawModelAccess().GetInvisibleHeavenId() )
1095  : ( bIsVisible ? pDoc->getIDocumentDrawModelAccess().GetHellId() : pDoc->getIDocumentDrawModelAccess().GetInvisibleHellId() ));
1096  }
1097  else
1098  {
1099  pObj->SetLayer( bIsVisible ? pDoc->getIDocumentDrawModelAccess().GetControlsId() : pDoc->getIDocumentDrawModelAccess().GetInvisibleControlsId());
1100  }
1101 
1102  }
1103 
1104  }
1105  // #i26791# - special handling for property FN_TEXT_RANGE
1106  else if ( FN_TEXT_RANGE == pEntry->nWID )
1107  {
1108  SwFormatAnchor aAnchor( aSet.Get( RES_ANCHOR ) );
1109  if (aAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
1110  {
1111  // set property <TextRange> not valid for to-page anchored shapes
1112  throw lang::IllegalArgumentException();
1113  }
1114 
1115  std::unique_ptr<SwUnoInternalPaM> pInternalPam(
1116  new SwUnoInternalPaM( *(pFormat->GetDoc()) ));
1117  uno::Reference< text::XTextRange > xRg;
1118  aValue >>= xRg;
1119  if (!::sw::XTextRangeToSwPaM(*pInternalPam, xRg) )
1120  {
1121  throw uno::RuntimeException();
1122  }
1123 
1124  if (aAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR)
1125  {
1126  //delete old SwFormatFlyCnt
1127  //With AnchorAsCharacter the current TextAttribute has to be deleted.
1128  //Tbis removes the frame format too.
1129  //To prevent this the connection between format and attribute has to be broken before.
1130  const SwPosition *pPos = aAnchor.GetContentAnchor();
1131  SwTextNode *pTextNode = pPos->nNode.GetNode().GetTextNode();
1132  SAL_WARN_IF( !pTextNode->HasHints(), "sw.uno", "Missing FlyInCnt-Hint." );
1133  const sal_Int32 nIdx = pPos->nContent.GetIndex();
1134  SwTextAttr * const pHint =
1135  pTextNode->GetTextAttrForCharAt(
1136  nIdx, RES_TXTATR_FLYCNT );
1137  assert(pHint && "Missing Hint.");
1138  SAL_WARN_IF( pHint->Which() != RES_TXTATR_FLYCNT,
1139  "sw.uno", "Missing FlyInCnt-Hint." );
1140  SAL_WARN_IF( pHint->GetFlyCnt().GetFrameFormat() != pFormat,
1141  "sw.uno", "Wrong TextFlyCnt-Hint." );
1142  const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt())
1143  .SetFlyFormat();
1144 
1145  //The connection is removed now the attribute can be deleted.
1146  pTextNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx );
1147  //create a new one
1148  SwTextNode *pNd = pInternalPam->GetNode().GetTextNode();
1149  SAL_WARN_IF( !pNd, "sw.uno", "Cursor not at TextNode." );
1150  SwFormatFlyCnt aFormat( pFormat );
1151  pNd->InsertItem(aFormat, pInternalPam->GetPoint()
1152  ->nContent.GetIndex(), 0 );
1153  }
1154  else
1155  {
1156  aAnchor.SetAnchor( pInternalPam->GetPoint() );
1157  aSet.Put(aAnchor);
1158  pFormat->SetFormatAttr(aSet);
1159  }
1160  }
1161  else if (pEntry->nWID == FN_TEXT_BOX)
1162  {
1163  bool bValue(false);
1164  aValue >>= bValue;
1165  if (bValue)
1166  SwTextBoxHelper::create(pFormat);
1167  else
1168  SwTextBoxHelper::destroy(pFormat);
1169 
1170  }
1171  else if (pEntry->nWID == RES_CHAIN)
1172  {
1173  if (pEntry->nMemberId == MID_CHAIN_NEXTNAME || pEntry->nMemberId == MID_CHAIN_PREVNAME)
1174  SwTextBoxHelper::syncProperty(pFormat, pEntry->nWID, pEntry->nMemberId, aValue);
1175  }
1176  // #i28749#
1177  else if ( FN_SHAPE_POSITION_LAYOUT_DIR == pEntry->nWID )
1178  {
1179  sal_Int16 nPositionLayoutDir = 0;
1180  aValue >>= nPositionLayoutDir;
1181  pFormat->SetPositionLayoutDir( nPositionLayoutDir );
1182  }
1183  else if( pDoc->getIDocumentLayoutAccess().GetCurrentLayout())
1184  {
1185  UnoActionContext aCtx(pDoc);
1186  if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == pEntry->nMemberId)
1187  {
1188  SdrObject* pObj = pFormat->FindSdrObject();
1189  SdrMarkList aList;
1190  SdrMark aMark(pObj);
1191  aList.InsertEntry(aMark);
1192  sal_Int32 nAnchor = 0;
1193  cppu::enum2int( nAnchor, aValue );
1194  pDoc->ChgAnchor( aList, static_cast<RndStdIds>(nAnchor),
1195  false, true );
1196  }
1197  else
1198  {
1199  m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
1200  pFormat->SetFormatAttr(aSet);
1201  }
1202  }
1203  else if( RES_FRM_SIZE == pEntry->nWID &&
1206  || pEntry->nMemberId == MID_FRMSIZE_REL_WIDTH_RELATION ) )
1207  {
1208  SvxShape* pSvxShape = GetSvxShape();
1209  SAL_WARN_IF(!pSvxShape, "sw.uno", "No SvxShape found!");
1210  if(pSvxShape)
1211  {
1212  SdrObject* pObj = pSvxShape->GetSdrObject();
1213  sal_Int16 nPercent(100);
1214  aValue >>= nPercent;
1215  switch (pEntry->nMemberId)
1216  {
1217  case MID_FRMSIZE_REL_WIDTH:
1218  pObj->SetRelativeWidth( nPercent / 100.0 );
1219  break;
1221  pObj->SetRelativeHeight( nPercent / 100.0 );
1222  break;
1224  pObj->SetRelativeWidthRelation(nPercent);
1225  break;
1227  pObj->SetRelativeHeightRelation(nPercent);
1228  break;
1229  }
1230  }
1231  }
1232  else if (pEntry->nWID == RES_HORI_ORIENT
1233  && pEntry->nMemberId == MID_HORIORIENT_RELATION
1234  && aSet.Get(RES_ANCHOR).GetAnchorId() == RndStdIds::FLY_AT_PAGE)
1235  {
1236  uno::Any value(aValue);
1237  sal_Int16 nRelOrient(text::RelOrientation::PAGE_FRAME);
1238  aValue >>= nRelOrient;
1239  if (sw::GetAtPageRelOrientation(nRelOrient, true))
1240  {
1241  SAL_WARN("sw.core", "SwXShape: fixing invalid horizontal RelOrientation for at-page anchor");
1242  value <<= nRelOrient;
1243  }
1244  m_pPropSet->setPropertyValue( *pEntry, value, aSet );
1245  pFormat->SetFormatAttr(aSet);
1246  }
1247  else
1248  {
1249  m_pPropSet->setPropertyValue( *pEntry, aValue, aSet );
1250 
1251  if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == pEntry->nMemberId)
1252  {
1253  bool bSetAttr = true;
1254  text::TextContentAnchorType eNewAnchor = static_cast<text::TextContentAnchorType>(SWUnoHelper::GetEnumAsInt32( aValue ));
1255 
1256  //if old anchor was in_cntnt the related text attribute has to be removed
1257  const SwFormatAnchor& rOldAnchor = pFormat->GetAnchor();
1258  RndStdIds eOldAnchorId = rOldAnchor.GetAnchorId();
1259  SdrObject* pObj = pFormat->FindSdrObject();
1260  SwFrameFormat *pFlyFormat = FindFrameFormat( pObj );
1261  pFlyFormat->DelFrames();
1262  if( text::TextContentAnchorType_AS_CHARACTER != eNewAnchor &&
1263  (RndStdIds::FLY_AS_CHAR == eOldAnchorId))
1264  {
1265  //With AnchorAsCharacter the current TextAttribute has to be deleted.
1266  //Tbis removes the frame format too.
1267  //To prevent this the connection between format and attribute has to be broken before.
1268  const SwPosition *pPos = rOldAnchor.GetContentAnchor();
1269  SwTextNode *pTextNode = pPos->nNode.GetNode().GetTextNode();
1270  SAL_WARN_IF( !pTextNode->HasHints(), "sw.uno", "Missing FlyInCnt-Hint." );
1271  const sal_Int32 nIdx = pPos->nContent.GetIndex();
1272  SwTextAttr * const pHint =
1273  pTextNode->GetTextAttrForCharAt(
1274  nIdx, RES_TXTATR_FLYCNT );
1275  assert(pHint && "Missing Hint.");
1276  SAL_WARN_IF( pHint->Which() != RES_TXTATR_FLYCNT,
1277  "sw.uno", "Missing FlyInCnt-Hint." );
1278  SAL_WARN_IF( pHint->GetFlyCnt().GetFrameFormat() != pFlyFormat,
1279  "sw.uno", "Wrong TextFlyCnt-Hint." );
1280  const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt())
1281  .SetFlyFormat();
1282 
1283  //The connection is removed now the attribute can be deleted.
1284  pTextNode->DeleteAttributes(RES_TXTATR_FLYCNT, nIdx);
1285  }
1286  else if( text::TextContentAnchorType_AT_PAGE != eNewAnchor &&
1287  (RndStdIds::FLY_AT_PAGE == eOldAnchorId))
1288  {
1289  SwFormatAnchor aNewAnchor( dynamic_cast< const SwFormatAnchor& >( aSet.Get( RES_ANCHOR ) ) );
1290  //if the fly has been anchored at page then it needs to be connected
1291  //to the content position
1292  SwPaM aPam(pDoc->GetNodes().GetEndOfContent());
1293  if( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() )
1294  {
1296  Point aTmp( pObj->GetSnapRect().TopLeft() );
1297  pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetModelPositionForViewPoint( aPam.GetPoint(), aTmp, &aState );
1298  }
1299  else
1300  {
1301  //without access to the layout the last node of the body will be used as anchor position
1302  aPam.Move( fnMoveBackward, GoInDoc );
1303  }
1304  //anchor position has to be inserted after the text attribute has been inserted
1305  aNewAnchor.SetAnchor( aPam.GetPoint() );
1306  aSet.Put( aNewAnchor );
1307  pFormat->SetFormatAttr(aSet);
1308  bSetAttr = false;
1309  }
1310  if( text::TextContentAnchorType_AS_CHARACTER == eNewAnchor &&
1311  (RndStdIds::FLY_AS_CHAR != eOldAnchorId))
1312  {
1313  SwPaM aPam(pDoc->GetNodes().GetEndOfContent());
1314  if( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() )
1315  {
1317  Point aTmp( pObj->GetSnapRect().TopLeft() );
1318  pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetModelPositionForViewPoint( aPam.GetPoint(), aTmp, &aState );
1319  }
1320  else
1321  {
1322  //without access to the layout the last node of the body will be used as anchor position
1323  aPam.Move( fnMoveBackward, GoInDoc );
1324  }
1325  //the RES_TXTATR_FLYCNT needs to be added now
1326  SwTextNode *pNd = aPam.GetNode().GetTextNode();
1327  SAL_WARN_IF( !pNd, "sw.uno", "Cursor is not in a TextNode." );
1328  SwFormatFlyCnt aFormat( pFlyFormat );
1329  pNd->InsertItem(aFormat,
1330  aPam.GetPoint()->nContent.GetIndex(), 0 );
1331  --aPam.GetPoint()->nContent; // InsertItem moved it
1332  SwFormatAnchor aNewAnchor(
1333  dynamic_cast<const SwFormatAnchor&>(
1334  aSet.Get(RES_ANCHOR)));
1335  aNewAnchor.SetAnchor( aPam.GetPoint() );
1336  aSet.Put( aNewAnchor );
1337  }
1338  if( bSetAttr )
1339  pFormat->SetFormatAttr(aSet);
1340  }
1341  else
1342  pFormat->SetFormatAttr(aSet);
1343  }
1344  // We have a pFormat and a pEntry as well: try to sync TextBox property.
1345  SwTextBoxHelper::syncProperty(pFormat, pEntry->nWID, pEntry->nMemberId, aValue);
1346  }
1347  else
1348  {
1349  SfxPoolItem* pItem = nullptr;
1350  switch(pEntry->nWID)
1351  {
1352  case RES_ANCHOR:
1353  pItem = m_pImpl->GetAnchor(true);
1354  break;
1355  case RES_HORI_ORIENT:
1356  pItem = m_pImpl->GetHOrient(true);
1357  break;
1358  case RES_VERT_ORIENT:
1359  pItem = m_pImpl->GetVOrient(true);
1360  break;
1361  case RES_LR_SPACE:
1362  pItem = m_pImpl->GetLRSpace(true);
1363  break;
1364  case RES_UL_SPACE:
1365  pItem = m_pImpl->GetULSpace(true);
1366  break;
1367  case RES_SURROUND:
1368  pItem = m_pImpl->GetSurround(true);
1369  break;
1370  case FN_TEXT_RANGE:
1371  if(auto tr = o3tl::tryAccess<
1372  uno::Reference<text::XTextRange>>(aValue))
1373  {
1374  uno::Reference< text::XTextRange > & rRange = m_pImpl->GetTextRange();
1375  rRange = *tr;
1376  }
1377  break;
1378  case RES_OPAQUE :
1379  m_pImpl->SetOpaque(*o3tl::doAccess<bool>(aValue));
1380  break;
1381  // #i26791#
1382  case RES_FOLLOW_TEXT_FLOW:
1383  {
1384  pItem = m_pImpl->GetFollowTextFlow( true );
1385  }
1386  break;
1387  // #i28701#
1389  {
1390  pItem = m_pImpl->GetWrapInfluenceOnObjPos( true );
1391  }
1392  break;
1393  // #i28749#
1395  {
1396  sal_Int16 nPositionLayoutDir = 0;
1397  aValue >>= nPositionLayoutDir;
1398  m_pImpl->SetPositionLayoutDir( nPositionLayoutDir );
1399  }
1400  break;
1401  }
1402  if(pItem)
1403  pItem->PutValue(aValue, pEntry->nMemberId);
1404  }
1405  }
1406  else
1407  {
1408  const uno::Type& rPSetType =
1410  uno::Any aPSet = m_xShapeAgg->queryAggregation(rPSetType);
1411  auto xPrSet = o3tl::tryAccess<uno::Reference<beans::XPropertySet>>(
1412  aPSet);
1413  if(!xPrSet)
1414  throw uno::RuntimeException();
1415  // #i31698# - setting the caption point of a
1416  // caption object doesn't have to change the object position.
1417  // Thus, keep the position, before the caption point is set and
1418  // restore it afterwards.
1419  awt::Point aKeepedPosition( 0, 0 );
1420  if ( rPropertyName == "CaptionPoint" && getShapeType() == "com.sun.star.drawing.CaptionShape" )
1421  {
1422  aKeepedPosition = getPosition();
1423  }
1424  if( pFormat && pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() )
1425  {
1426  UnoActionContext aCtx(pFormat->GetDoc());
1427  (*xPrSet)->setPropertyValue(rPropertyName, aValue);
1428  }
1429  else
1430  (*xPrSet)->setPropertyValue(rPropertyName, aValue);
1431 
1432  if (pFormat)
1433  {
1434  // We have a pFormat (but no pEntry): try to sync TextBox property.
1435  SwTextBoxHelper::syncProperty(pFormat, rPropertyName, aValue);
1436  }
1437 
1438  // #i31698# - restore object position, if caption point is set.
1439  if ( rPropertyName == "CaptionPoint" && getShapeType() == "com.sun.star.drawing.CaptionShape" )
1440  {
1441  setPosition( aKeepedPosition );
1442  }
1443  }
1444 }
1445 
1446 uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName)
1447 {
1448  SolarMutexGuard aGuard;
1449  uno::Any aRet;
1450  SwFrameFormat* pFormat = GetFrameFormat();
1451  if(m_xShapeAgg.is())
1452  {
1453  const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
1454  if(pEntry)
1455  {
1456  if(pFormat)
1457  {
1458  if(RES_OPAQUE == pEntry->nWID)
1459  {
1460  SvxShape* pSvxShape = GetSvxShape();
1461  OSL_ENSURE(pSvxShape, "No SvxShape found!");
1462  if(pSvxShape)
1463  {
1464  SdrObject* pObj = pSvxShape->GetSdrObject();
1465  // consider invisible layers
1466  aRet <<=
1467  ( pObj->GetLayer() != pFormat->GetDoc()->getIDocumentDrawModelAccess().GetHellId() &&
1468  pObj->GetLayer() != pFormat->GetDoc()->getIDocumentDrawModelAccess().GetInvisibleHellId() );
1469  }
1470  }
1471  else if(FN_ANCHOR_POSITION == pEntry->nWID)
1472  {
1473  SvxShape* pSvxShape = GetSvxShape();
1474  OSL_ENSURE(pSvxShape, "No SvxShape found!");
1475  if(pSvxShape)
1476  {
1477  SdrObject* pObj = pSvxShape->GetSdrObject();
1478  Point aPt = pObj->GetAnchorPos();
1479  awt::Point aPoint( convertTwipToMm100( aPt.X() ),
1480  convertTwipToMm100( aPt.Y() ) );
1481  aRet <<= aPoint;
1482  }
1483  }
1484  // #i26791# - special handling for FN_TEXT_RANGE
1485  else if ( FN_TEXT_RANGE == pEntry->nWID )
1486  {
1487  const SwFormatAnchor aAnchor = pFormat->GetAnchor();
1488  if (aAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
1489  {
1490  // return nothing, because property <TextRange> isn't
1491  // valid for to-page anchored shapes
1492  uno::Any aAny;
1493  aRet = aAny;
1494  }
1495  else
1496  {
1497  if ( aAnchor.GetContentAnchor() )
1498  {
1499  const uno::Reference< text::XTextRange > xTextRange
1501  *pFormat->GetDoc(),
1502  *aAnchor.GetContentAnchor(),
1503  nullptr );
1504  aRet <<= xTextRange;
1505  }
1506  else
1507  {
1508  // return nothing
1509  uno::Any aAny;
1510  aRet = aAny;
1511  }
1512  }
1513  }
1514  else if (pEntry->nWID == FN_TEXT_BOX)
1515  {
1516  bool bValue = SwTextBoxHelper::isTextBox(pFormat, RES_DRAWFRMFMT);
1517  aRet <<= bValue;
1518  }
1519  else if (pEntry->nWID == RES_CHAIN)
1520  {
1521  switch (pEntry->nMemberId)
1522  {
1523  case MID_CHAIN_PREVNAME:
1524  case MID_CHAIN_NEXTNAME:
1525  case MID_CHAIN_NAME:
1526  SwTextBoxHelper::getProperty(pFormat, pEntry->nWID, pEntry->nMemberId, aRet);
1527  break;
1528  }
1529  }
1530  // #i28749#
1531  else if ( FN_SHAPE_TRANSFORMATION_IN_HORI_L2R == pEntry->nWID )
1532  {
1533  // get property <::drawing::Shape::Transformation>
1534  // without conversion to layout direction as below
1535  aRet = _getPropAtAggrObj( "Transformation" );
1536  }
1537  else if ( FN_SHAPE_POSITION_LAYOUT_DIR == pEntry->nWID )
1538  {
1539  aRet <<= pFormat->GetPositionLayoutDir();
1540  }
1541  // #i36248#
1542  else if ( FN_SHAPE_STARTPOSITION_IN_HORI_L2R == pEntry->nWID )
1543  {
1544  // get property <::drawing::Shape::StartPosition>
1545  // without conversion to layout direction as below
1546  aRet = _getPropAtAggrObj( "StartPosition" );
1547  }
1548  else if ( FN_SHAPE_ENDPOSITION_IN_HORI_L2R == pEntry->nWID )
1549  {
1550  // get property <::drawing::Shape::EndPosition>
1551  // without conversion to layout direction as below
1552  aRet = _getPropAtAggrObj( "EndPosition" );
1553  }
1554  else if (pEntry->nWID == RES_FRM_SIZE &&
1555  (pEntry->nMemberId == MID_FRMSIZE_REL_HEIGHT ||
1556  pEntry->nMemberId == MID_FRMSIZE_REL_WIDTH ||
1559  {
1560  SvxShape* pSvxShape = GetSvxShape();
1561  SAL_WARN_IF(!pSvxShape, "sw.uno", "No SvxShape found!");
1562  sal_Int16 nRet = 0;
1563  if (pSvxShape)
1564  {
1565  SdrObject* pObj = pSvxShape->GetSdrObject();
1566  switch (pEntry->nMemberId)
1567  {
1568  case MID_FRMSIZE_REL_WIDTH:
1569  if (pObj->GetRelativeWidth())
1570  nRet = *pObj->GetRelativeWidth() * 100;
1571  break;
1573  if (pObj->GetRelativeHeight())
1574  nRet = *pObj->GetRelativeHeight() * 100;
1575  break;
1577  nRet = pObj->GetRelativeWidthRelation();
1578  break;
1580  nRet = pObj->GetRelativeHeightRelation();
1581  break;
1582  }
1583  }
1584  aRet <<= nRet;
1585  }
1586  else
1587  {
1588  const SwAttrSet& rSet = pFormat->GetAttrSet();
1589  m_pPropSet->getPropertyValue(*pEntry, rSet, aRet);
1590  }
1591  }
1592  else
1593  {
1594  SfxPoolItem* pItem = nullptr;
1595  switch(pEntry->nWID)
1596  {
1597  case RES_ANCHOR:
1598  pItem = m_pImpl->GetAnchor();
1599  break;
1600  case RES_HORI_ORIENT:
1601  pItem = m_pImpl->GetHOrient();
1602  break;
1603  case RES_VERT_ORIENT:
1604  pItem = m_pImpl->GetVOrient();
1605  break;
1606  case RES_LR_SPACE:
1607  pItem = m_pImpl->GetLRSpace();
1608  break;
1609  case RES_UL_SPACE:
1610  pItem = m_pImpl->GetULSpace();
1611  break;
1612  case RES_SURROUND:
1613  pItem = m_pImpl->GetSurround();
1614  break;
1615  case FN_TEXT_RANGE :
1616  aRet <<= m_pImpl->GetTextRange();
1617  break;
1618  case RES_OPAQUE :
1619  aRet <<= m_pImpl->GetOpaque();
1620  break;
1621  case FN_ANCHOR_POSITION :
1622  {
1623  aRet <<= awt::Point();
1624  }
1625  break;
1626  // #i26791#
1627  case RES_FOLLOW_TEXT_FLOW :
1628  {
1629  pItem = m_pImpl->GetFollowTextFlow();
1630  }
1631  break;
1632  // #i28701#
1634  {
1635  pItem = m_pImpl->GetWrapInfluenceOnObjPos();
1636  }
1637  break;
1638  // #i28749#
1640  {
1641  // get property <::drawing::Shape::Transformation>
1642  // without conversion to layout direction as below
1643  aRet = _getPropAtAggrObj( "Transformation" );
1644  }
1645  break;
1647  {
1648  aRet <<= m_pImpl->GetPositionLayoutDir();
1649  }
1650  break;
1651  // #i36248#
1653  {
1654  // get property <::drawing::Shape::StartPosition>
1655  // without conversion to layout direction as below
1656  aRet = _getPropAtAggrObj( "StartPosition" );
1657  }
1658  break;
1660  {
1661  // get property <::drawing::Shape::StartPosition>
1662  // without conversion to layout direction as below
1663  aRet = _getPropAtAggrObj( "EndPosition" );
1664  }
1665  break;
1666  }
1667  if(pItem)
1668  pItem->QueryValue(aRet, pEntry->nMemberId);
1669  }
1670  }
1671  else
1672  {
1673  aRet = _getPropAtAggrObj( rPropertyName );
1674 
1675  // #i31698# - convert the position (translation)
1676  // of the drawing object in the transformation
1677  if ( rPropertyName == "Transformation" )
1678  {
1679  drawing::HomogenMatrix3 aMatrix;
1680  aRet >>= aMatrix;
1681  aRet <<= ConvertTransformationToLayoutDir( aMatrix );
1682  }
1683  // #i36248#
1684  else if ( rPropertyName == "StartPosition" )
1685  {
1686  awt::Point aStartPos;
1687  aRet >>= aStartPos;
1688  // #i59051#
1689  aRet <<= ConvertStartOrEndPosToLayoutDir( aStartPos );
1690  }
1691  else if ( rPropertyName == "EndPosition" )
1692  {
1693  awt::Point aEndPos;
1694  aRet >>= aEndPos;
1695  // #i59051#
1696  aRet <<= ConvertStartOrEndPosToLayoutDir( aEndPos );
1697  }
1698  // #i59051#
1699  else if ( rPropertyName == "PolyPolygonBezier" )
1700  {
1701  drawing::PolyPolygonBezierCoords aPath;
1702  aRet >>= aPath;
1703  aRet <<= ConvertPolyPolygonBezierToLayoutDir( aPath );
1704  }
1705  else if (rPropertyName == "ZOrder")
1706  {
1707  // Convert the real draw page position to the logical one that ignores textboxes.
1708  if (pFormat)
1709  {
1710  const SdrObject* pObj = pFormat->FindRealSdrObject();
1711  if (pObj)
1712  {
1713  bool bConvert = true;
1714  if (SvxShape* pSvxShape = GetSvxShape())
1715  // In case of group shapes, pSvxShape points to the child shape, while pObj points to the outermost group shape.
1716  if (pSvxShape->GetSdrObject() != pObj)
1717  // Textboxes are not expected inside group shapes, so no conversion is necessary there.
1718  bConvert = false;
1719  if (bConvert)
1720  {
1721  aRet <<= SwTextBoxHelper::getOrdNum(pObj);
1722  }
1723  }
1724  }
1725  }
1726  }
1727  }
1728  return aRet;
1729 }
1730 
1731 uno::Any SwXShape::_getPropAtAggrObj( const OUString& _rPropertyName )
1732 {
1733  uno::Any aRet;
1734 
1735  const uno::Type& rPSetType =
1737  uno::Any aPSet = m_xShapeAgg->queryAggregation(rPSetType);
1738  auto xPrSet = o3tl::tryAccess<uno::Reference<beans::XPropertySet>>(aPSet);
1739  if ( !xPrSet )
1740  {
1741  throw uno::RuntimeException();
1742  }
1743  aRet = (*xPrSet)->getPropertyValue( _rPropertyName );
1744 
1745  return aRet;
1746 }
1747 
1748 beans::PropertyState SwXShape::getPropertyState( const OUString& rPropertyName )
1749 {
1750  SolarMutexGuard aGuard;
1751  uno::Sequence< OUString > aNames { rPropertyName };
1752  uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aNames);
1753  return aStates.getConstArray()[0];
1754 }
1755 
1756 uno::Sequence< beans::PropertyState > SwXShape::getPropertyStates(
1757  const uno::Sequence< OUString >& aPropertyNames )
1758 {
1759  SolarMutexGuard aGuard;
1760  SwFrameFormat* pFormat = GetFrameFormat();
1761  uno::Sequence< beans::PropertyState > aRet(aPropertyNames.getLength());
1762  if(!m_xShapeAgg.is())
1763  throw uno::RuntimeException();
1764 
1765  SvxShape* pSvxShape = GetSvxShape();
1766  bool bGroupMember = false;
1767  bool bFormControl = false;
1768  SdrObject* pObject = pSvxShape ? pSvxShape->GetSdrObject() : nullptr;
1769  if(pObject)
1770  {
1771  bGroupMember = pObject->getParentSdrObjectFromSdrObject() != nullptr;
1772  bFormControl = pObject->GetObjInventor() == SdrInventor::FmForm;
1773  }
1774  const OUString* pNames = aPropertyNames.getConstArray();
1775  beans::PropertyState* pRet = aRet.getArray();
1776  uno::Reference< XPropertyState > xShapePrState;
1777  for(sal_Int32 nProperty = 0; nProperty < aPropertyNames.getLength(); nProperty++)
1778  {
1779  const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( pNames[nProperty] );
1780  if(pEntry)
1781  {
1782  if(RES_OPAQUE == pEntry->nWID)
1783  pRet[nProperty] = bFormControl ?
1784  beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
1785  else if(FN_ANCHOR_POSITION == pEntry->nWID)
1786  pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
1787  else if(FN_TEXT_RANGE == pEntry->nWID)
1788  pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
1789  else if(bGroupMember)
1790  pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE;
1791  else if (pEntry->nWID == RES_FRM_SIZE &&
1794  pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
1795  else if (pEntry->nWID == FN_TEXT_BOX)
1796  {
1797  // The TextBox property is set, if we can find a textbox for this shape.
1798  if (pFormat && SwTextBoxHelper::isTextBox(pFormat, RES_DRAWFRMFMT))
1799  pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
1800  else
1801  pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE;
1802  }
1803  else if(pFormat)
1804  {
1805  const SwAttrSet& rSet = pFormat->GetAttrSet();
1806  SfxItemState eItemState = rSet.GetItemState(pEntry->nWID, false);
1807 
1808  if(SfxItemState::SET == eItemState)
1809  pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
1810  else if(SfxItemState::DEFAULT == eItemState)
1811  pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE;
1812  else
1813  pRet[nProperty] = beans::PropertyState_AMBIGUOUS_VALUE;
1814  }
1815  else
1816  {
1817  SfxPoolItem* pItem = nullptr;
1818  switch(pEntry->nWID)
1819  {
1820  case RES_ANCHOR:
1821  pItem = m_pImpl->GetAnchor();
1822  break;
1823  case RES_HORI_ORIENT:
1824  pItem = m_pImpl->GetHOrient();
1825  break;
1826  case RES_VERT_ORIENT:
1827  pItem = m_pImpl->GetVOrient();
1828  break;
1829  case RES_LR_SPACE:
1830  pItem = m_pImpl->GetLRSpace();
1831  break;
1832  case RES_UL_SPACE:
1833  pItem = m_pImpl->GetULSpace();
1834  break;
1835  case RES_SURROUND:
1836  pItem = m_pImpl->GetSurround();
1837  break;
1838  // #i28701#
1840  {
1841  pItem = m_pImpl->GetWrapInfluenceOnObjPos();
1842  }
1843  break;
1844  }
1845  if(pItem)
1846  pRet[nProperty] = beans::PropertyState_DIRECT_VALUE;
1847  else
1848  pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE;
1849  }
1850  }
1851  else
1852  {
1853  if(!xShapePrState.is())
1854  {
1855  const uno::Type& rPStateType = cppu::UnoType<XPropertyState>::get();
1856  uno::Any aPState = m_xShapeAgg->queryAggregation(rPStateType);
1857  auto ps = o3tl::tryAccess<uno::Reference<XPropertyState>>(
1858  aPState);
1859  if(!ps)
1860  throw uno::RuntimeException();
1861  xShapePrState = *ps;
1862  }
1863  pRet[nProperty] = xShapePrState->getPropertyState(pNames[nProperty]);
1864  }
1865  }
1866 
1867  return aRet;
1868 }
1869 
1870 void SwXShape::setPropertyToDefault( const OUString& rPropertyName )
1871 {
1872  SolarMutexGuard aGuard;
1873  SwFrameFormat* pFormat = GetFrameFormat();
1874  if(!m_xShapeAgg.is())
1875  throw uno::RuntimeException();
1876 
1877  const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
1878  if(pEntry)
1879  {
1880  if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
1881  throw uno::RuntimeException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1882  if(pFormat)
1883  {
1884  const SfxItemSet& rSet = pFormat->GetAttrSet();
1885  SfxItemSet aSet(pFormat->GetDoc()->GetAttrPool(), {{pEntry->nWID, pEntry->nWID}});
1886  aSet.SetParent(&rSet);
1887  aSet.ClearItem(pEntry->nWID);
1888  pFormat->GetDoc()->SetAttr(aSet, *pFormat);
1889  }
1890  else
1891  {
1892  switch(pEntry->nWID)
1893  {
1894  case RES_ANCHOR: m_pImpl->RemoveAnchor(); break;
1895  case RES_HORI_ORIENT: m_pImpl->RemoveHOrient(); break;
1896  case RES_VERT_ORIENT: m_pImpl->RemoveVOrient(); break;
1897  case RES_LR_SPACE: m_pImpl->RemoveLRSpace(); break;
1898  case RES_UL_SPACE: m_pImpl->RemoveULSpace(); break;
1899  case RES_SURROUND: m_pImpl->RemoveSurround();break;
1900  case RES_OPAQUE : m_pImpl->SetOpaque(false); break;
1901  case FN_TEXT_RANGE :
1902  break;
1903  // #i26791#
1904  case RES_FOLLOW_TEXT_FLOW:
1905  {
1906  m_pImpl->RemoveFollowTextFlow();
1907  }
1908  break;
1909  // #i28701#
1911  {
1912  m_pImpl->RemoveWrapInfluenceOnObjPos();
1913  }
1914  break;
1915  }
1916  }
1917  }
1918  else
1919  {
1920  const uno::Type& rPStateType = cppu::UnoType<XPropertyState>::get();
1921  uno::Any aPState = m_xShapeAgg->queryAggregation(rPStateType);
1922  auto xShapePrState = o3tl::tryAccess<uno::Reference<XPropertyState>>(
1923  aPState);
1924  if(!xShapePrState)
1925  throw uno::RuntimeException();
1926  (*xShapePrState)->setPropertyToDefault( rPropertyName );
1927  }
1928 
1929 }
1930 
1931 uno::Any SwXShape::getPropertyDefault( const OUString& rPropertyName )
1932 {
1933  SolarMutexGuard aGuard;
1934  SwFrameFormat* pFormat = GetFrameFormat();
1935  uno::Any aRet;
1936  if(!m_xShapeAgg.is())
1937  throw uno::RuntimeException();
1938 
1939  const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
1940  if(pEntry)
1941  {
1942  if(!(pEntry->nWID < RES_FRMATR_END && pFormat))
1943  throw uno::RuntimeException();
1944 
1945  const SfxPoolItem& rDefItem =
1946  pFormat->GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
1947  rDefItem.QueryValue(aRet, pEntry->nMemberId);
1948 
1949  }
1950  else
1951  {
1952  const uno::Type& rPStateType = cppu::UnoType<XPropertyState>::get();
1953  uno::Any aPState = m_xShapeAgg->queryAggregation(rPStateType);
1954  auto xShapePrState = o3tl::tryAccess<uno::Reference<XPropertyState>>(
1955  aPState);
1956  if(!xShapePrState)
1957  throw uno::RuntimeException();
1958  (*xShapePrState)->getPropertyDefault( rPropertyName );
1959  }
1960 
1961  return aRet;
1962 }
1963 
1965  const OUString& _propertyName,
1966  const uno::Reference< beans::XPropertyChangeListener > & _listener )
1967 {
1968  if ( !m_xShapeAgg.is() )
1969  throw uno::RuntimeException("no shape aggregate", *this );
1970 
1971  // must be handled by the aggregate
1972  uno::Reference< beans::XPropertySet > xShapeProps;
1973  if ( m_xShapeAgg->queryAggregation( cppu::UnoType<beans::XPropertySet>::get() ) >>= xShapeProps )
1974  xShapeProps->addPropertyChangeListener( _propertyName, _listener );
1975 }
1976 
1978  const OUString& _propertyName,
1979  const uno::Reference< beans::XPropertyChangeListener > & _listener)
1980 {
1981  if ( !m_xShapeAgg.is() )
1982  throw uno::RuntimeException("no shape aggregate", *this );
1983 
1984  // must be handled by the aggregate
1985  uno::Reference< beans::XPropertySet > xShapeProps;
1986  if ( m_xShapeAgg->queryAggregation( cppu::UnoType<beans::XPropertySet>::get() ) >>= xShapeProps )
1987  xShapeProps->removePropertyChangeListener( _propertyName, _listener );
1988 }
1989 
1991  const OUString& /*PropertyName*/,
1992  const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/ )
1993 {
1994  OSL_FAIL("not implemented");
1995 }
1996 
1998  const OUString& /*PropertyName*/,
1999  const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
2000 {
2001  OSL_FAIL("not implemented");
2002 }
2003 
2004 void SwXShape::Notify(const SfxHint& rHint)
2005 {
2006  if(rHint.GetId() == SfxHintId::Dying)
2007  {
2008  m_pFormat = nullptr;
2009  EndListeningAll();
2010  }
2011 }
2012 
2013 void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
2014 {
2015  SolarMutexGuard aGuard;
2016 
2017  // get access to SwDoc
2018  // (see also SwXTextRange::XTextRangeToSwPaM)
2019  const SwDoc* pDoc = nullptr;
2020  uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
2021  if(xRangeTunnel.is())
2022  {
2023  SwXTextRange* pRange = nullptr;
2024  OTextCursorHelper* pCursor = nullptr;
2025  SwXTextPortion* pPortion = nullptr;
2026  SwXText* pText = nullptr;
2027  SwXParagraph* pParagraph = nullptr;
2028 
2029  pRange = reinterpret_cast< SwXTextRange * >(
2030  sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
2031  pText = reinterpret_cast< SwXText * >(
2032  sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXText::getUnoTunnelId()) ));
2033  pCursor = reinterpret_cast< OTextCursorHelper * >(
2034  sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
2035  pPortion = reinterpret_cast< SwXTextPortion * >(
2036  sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextPortion::getUnoTunnelId()) ));
2037  pParagraph = reinterpret_cast< SwXParagraph * >(
2038  sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXParagraph::getUnoTunnelId( ) ) ) );
2039 
2040  if (pRange)
2041  pDoc = &pRange->GetDoc();
2042  else if (pText)
2043  pDoc = pText->GetDoc();
2044  else if (pCursor)
2045  pDoc = pCursor->GetDoc();
2046  else if (pPortion)
2047  pDoc = &pPortion->GetCursor().GetDoc();
2048  else if (pParagraph && pParagraph->GetTextNode())
2049  pDoc = &pParagraph->GetTextNode()->GetDoc();
2050 
2051  }
2052 
2053  if(!pDoc)
2054  throw uno::RuntimeException();
2055  const SwDocShell* pDocSh = pDoc->GetDocShell();
2056  if (!pDocSh)
2057  return;
2058 
2059  uno::Reference<frame::XModel> xModel = pDocSh->GetModel();
2060  uno::Reference< drawing::XDrawPageSupplier > xDPS(xModel, uno::UNO_QUERY);
2061  if (xDPS.is())
2062  {
2063  uno::Reference< drawing::XDrawPage > xDP( xDPS->getDrawPage() );
2064  if (xDP.is())
2065  {
2066  uno::Any aPos;
2067  aPos <<= xTextRange;
2068  setPropertyValue("TextRange", aPos);
2069  uno::Reference< drawing::XShape > xTemp( static_cast<cppu::OWeakObject*>(this), uno::UNO_QUERY );
2070  xDP->add( xTemp );
2071  }
2072  }
2073 }
2074 
2075 uno::Reference< text::XTextRange > SwXShape::getAnchor()
2076 {
2077  SolarMutexGuard aGuard;
2078  uno::Reference< text::XTextRange > aRef;
2079  SwFrameFormat* pFormat = GetFrameFormat();
2080  if(pFormat)
2081  {
2082  const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
2083  // return an anchor for non-page bound frames
2084  // and for page bound frames that have a page no == NULL and a content position
2085  if ((rAnchor.GetAnchorId() != RndStdIds::FLY_AT_PAGE) ||
2086  (rAnchor.GetContentAnchor() && !rAnchor.GetPageNum()))
2087  {
2088  const SwPosition &rPos = *(pFormat->GetAnchor().GetContentAnchor());
2089  if (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA)
2090  { // ensure that SwXTextRange has SwIndex
2091  aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), SwPosition(rPos.nNode), nullptr);
2092  }
2093  else
2094  {
2095  aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), rPos, nullptr);
2096  }
2097  }
2098  }
2099  else
2100  aRef = m_pImpl->GetTextRange();
2101  return aRef;
2102 }
2103 
2105 {
2106  SolarMutexGuard aGuard;
2107  SwFrameFormat* pFormat = GetFrameFormat();
2108  if(pFormat)
2109  {
2110  // determine correct <SdrObject>
2111  SvxShape* pSvxShape = GetSvxShape();
2112  SdrObject* pObj = pSvxShape ? pSvxShape->GetSdrObject() : nullptr;
2113  // safety assertion:
2114  // <pObj> must be the same as <pFormat->FindSdrObject()>, if <pObj> isn't
2115  // a 'virtual' drawing object.
2116  // correct assertion and refine it for safety reason.
2117  OSL_ENSURE( !pObj ||
2118  dynamic_cast<const SwDrawVirtObj*>( pObj) != nullptr ||
2120  pObj == pFormat->FindSdrObject(),
2121  "<SwXShape::dispose(..) - different 'master' drawing objects!!" );
2122  // perform delete of draw frame format *not*
2123  // for 'virtual' drawing objects.
2124  // no delete of draw format for members
2125  // of a group
2126  if ( pObj &&
2127  dynamic_cast<const SwDrawVirtObj*>( pObj) == nullptr &&
2129  pObj->IsInserted() )
2130  {
2131  if (pFormat->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR)
2132  {
2133  const SwPosition &rPos = *(pFormat->GetAnchor().GetContentAnchor());
2134  SwTextNode *pTextNode = rPos.nNode.GetNode().GetTextNode();
2135  const sal_Int32 nIdx = rPos.nContent.GetIndex();
2136  pTextNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx );
2137  }
2138  else
2139  pFormat->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat( pFormat );
2140  }
2141  }
2142  if(m_xShapeAgg.is())
2143  {
2144  uno::Any aAgg(m_xShapeAgg->queryAggregation( cppu::UnoType<XComponent>::get()));
2145  uno::Reference<XComponent> xComp;
2146  aAgg >>= xComp;
2147  if(xComp.is())
2148  xComp->dispose();
2149  }
2150  if(m_pPage)
2151  const_cast<SwFmDrawPage*>(m_pPage)->RemoveShape(this);
2152  m_pPage = nullptr;
2153 }
2154 
2156  const uno::Reference< lang::XEventListener > & aListener)
2157 {
2158  SvxShape* pSvxShape = GetSvxShape();
2159  if(pSvxShape)
2160  pSvxShape->addEventListener(aListener);
2161 }
2162 
2164  const uno::Reference< lang::XEventListener > & aListener)
2165 {
2166  SvxShape* pSvxShape = GetSvxShape();
2167  if(pSvxShape)
2168  pSvxShape->removeEventListener(aListener);
2169 }
2170 
2172 {
2173  return "SwXShape";
2174 }
2175 
2176 sal_Bool SwXShape::supportsService(const OUString& rServiceName)
2177 {
2178  return cppu::supportsService(this, rServiceName);
2179 }
2180 
2181 uno::Sequence< OUString > SwXShape::getSupportedServiceNames()
2182 {
2183  uno::Sequence< OUString > aSeq;
2184  if (SvxShape* pSvxShape = GetSvxShape())
2185  aSeq = pSvxShape->getSupportedServiceNames();
2187  aSeq, std::initializer_list<std::u16string_view>{ u"com.sun.star.drawing.Shape" });
2188 }
2189 
2191 {
2192  if(m_xShapeAgg.is())
2193  return comphelper::getUnoTunnelImplementation<SvxShape>(m_xShapeAgg);
2194  return nullptr;
2195 }
2196 
2197 // #i31698#
2198 // implementation of virtual methods from drawing::XShape
2199 awt::Point SAL_CALL SwXShape::getPosition()
2200 {
2201  awt::Point aPos( GetAttrPosition() );
2202 
2203  // handle group members
2204  SvxShape* pSvxShape = GetSvxShape();
2205  if ( pSvxShape )
2206  {
2207  SdrObject* pTopGroupObj = GetTopGroupObj( pSvxShape );
2208  if ( pTopGroupObj )
2209  {
2210  // #i34750# - get attribute position of top group
2211  // shape and add offset between top group object and group member
2212  uno::Reference< drawing::XShape > xGroupShape( pTopGroupObj->getUnoShape(), uno::UNO_QUERY );
2213  aPos = xGroupShape->getPosition();
2214  // add offset between top group object and group member
2215  // to the determined attribute position
2216  // #i34750#:
2217  // consider the layout direction
2218  const tools::Rectangle aMemberObjRect = GetSvxShape()->GetSdrObject()->GetSnapRect();
2219  const tools::Rectangle aGroupObjRect = pTopGroupObj->GetSnapRect();
2220  // #i53320# - relative position of group member and
2221  // top group object is always given in horizontal left-to-right layout.
2222  awt::Point aOffset( 0, 0 );
2223  {
2224  aOffset.X = ( aMemberObjRect.Left() - aGroupObjRect.Left() );
2225  aOffset.Y = ( aMemberObjRect.Top() - aGroupObjRect.Top() );
2226  }
2227  aOffset.X = convertTwipToMm100(aOffset.X);
2228  aOffset.Y = convertTwipToMm100(aOffset.Y);
2229  aPos.X += aOffset.X;
2230  aPos.Y += aOffset.Y;
2231  }
2232  }
2233 
2234  return aPos;
2235 }
2236 
2237 void SAL_CALL SwXShape::setPosition( const awt::Point& aPosition )
2238 {
2239  SdrObject* pTopGroupObj = GetTopGroupObj();
2240  if ( !pTopGroupObj )
2241  {
2242  // #i37877# - no adjustment of position attributes,
2243  // if the position also has to be applied at the drawing object and
2244  // a contact object is already registered at the drawing object.
2245  bool bApplyPosAtDrawObj(false);
2246  bool bNoAdjustOfPosProp(false);
2247  // #i35798# - apply position also to drawing object,
2248  // if drawing object has no anchor position set.
2249  if ( mxShape.is() )
2250  {
2251  SvxShape* pSvxShape = GetSvxShape();
2252  if ( pSvxShape )
2253  {
2254  const SdrObject* pObj = pSvxShape->GetSdrObject();
2255  if ( pObj &&
2256  pObj->GetAnchorPos().X() == 0 &&
2257  pObj->GetAnchorPos().Y() == 0 )
2258  {
2259  bApplyPosAtDrawObj = true;
2260  if ( pObj->GetUserCall() &&
2261  dynamic_cast<const SwDrawContact*>( pObj->GetUserCall()) != nullptr )
2262  {
2263  bNoAdjustOfPosProp = true;
2264  }
2265  }
2266  }
2267  }
2268  // shape isn't a group member. Thus, set positioning attributes
2269  if ( !bNoAdjustOfPosProp )
2270  {
2271  AdjustPositionProperties( aPosition );
2272  }
2273  if ( bApplyPosAtDrawObj )
2274  {
2275  mxShape->setPosition( aPosition );
2276  }
2277  }
2278  else if ( mxShape.is() )
2279  {
2280  // shape is a member of a group. Thus, set its position.
2281  awt::Point aNewPos( aPosition );
2282  // The given position is given in the according layout direction. Thus,
2283  // it has to be converted to a position in horizontal left-to-right
2284  // layout.
2285  // convert given absolute attribute position in layout direction into
2286  // position in horizontal left-to-right layout.
2287  {
2288  aNewPos = ConvertPositionToHoriL2R( aNewPos, getSize() );
2289  }
2290  // Convert given absolute position in horizontal left-to-right
2291  // layout into relative position in horizontal left-to-right layout.
2292  uno::Reference< drawing::XShape > xGroupShape( pTopGroupObj->getUnoShape(), uno::UNO_QUERY );
2293  {
2294  // #i34750#
2295  // use method <xGroupShape->getPosition()> to get the correct
2296  // position of the top group object.
2297  awt::Point aAttrPosInHoriL2R(
2298  ConvertPositionToHoriL2R( xGroupShape->getPosition(),
2299  xGroupShape->getSize() ) );
2300  aNewPos.X = o3tl::saturating_sub(aNewPos.X, aAttrPosInHoriL2R.X);
2301  aNewPos.Y = o3tl::saturating_sub(aNewPos.Y, aAttrPosInHoriL2R.Y);
2302  }
2303  // convert relative position in horizontal left-to-right layout into
2304  // absolute position in horizontal left-to-right layout
2305  {
2306  // #i34750#
2307  // use method <SvxShape->getPosition()> to get the correct
2308  // 'Drawing layer' position of the top group shape.
2309  auto pSvxGroupShape = comphelper::getUnoTunnelImplementation<SvxShape>(pTopGroupObj->getUnoShape());
2310  const awt::Point aGroupPos = pSvxGroupShape->getPosition();
2311  aNewPos.X = o3tl::saturating_add(aNewPos.X, aGroupPos.X);
2312  aNewPos.Y = o3tl::saturating_add(aNewPos.Y, aGroupPos.Y);
2313  }
2314  // set position
2315  mxShape->setPosition( aNewPos );
2316  }
2317 }
2318 
2319 awt::Size SAL_CALL SwXShape::getSize()
2320 {
2321  awt::Size aSize;
2322  if ( mxShape.is() )
2323  {
2324  aSize = mxShape->getSize();
2325  }
2326  return aSize;
2327 }
2328 
2329 void SAL_CALL SwXShape::setSize( const awt::Size& aSize )
2330 {
2331  comphelper::ProfileZone aZone("SwXShape::setSize");
2332 
2333  if ( mxShape.is() )
2334  {
2335  mxShape->setSize( aSize );
2336  }
2338 }
2339 // #i31698#
2340 // implementation of virtual methods from drawing::XShapeDescriptor
2341 OUString SAL_CALL SwXShape::getShapeType()
2342 {
2343  if ( mxShape.is() )
2344  {
2345  return mxShape->getShapeType();
2346  }
2347  return OUString();
2348 }
2353 {
2354  SdrObject* pTopGroupObj( nullptr );
2355 
2356  SvxShape* pSvxShape = _pSvxShape ? _pSvxShape : GetSvxShape();
2357  if ( pSvxShape )
2358  {
2359  SdrObject* pSdrObj = pSvxShape->GetSdrObject();
2360  if ( pSdrObj && pSdrObj->getParentSdrObjectFromSdrObject() )
2361  {
2362  pTopGroupObj = pSdrObj->getParentSdrObjectFromSdrObject();
2363  while ( pTopGroupObj->getParentSdrObjectFromSdrObject() )
2364  {
2365  pTopGroupObj = pTopGroupObj->getParentSdrObjectFromSdrObject();
2366  }
2367  }
2368  }
2369 
2370  return pTopGroupObj;
2371 }
2372 
2377 {
2378  awt::Point aAttrPos;
2379 
2380  uno::Any aHoriPos( getPropertyValue("HoriOrientPosition") );
2381  aHoriPos >>= aAttrPos.X;
2382  uno::Any aVertPos( getPropertyValue("VertOrientPosition") );
2383  aVertPos >>= aAttrPos.Y;
2384  // #i35798# - fallback, if attribute position is (0,0)
2385  // and no anchor position is applied to the drawing object
2386  SvxShape* pSvxShape = GetSvxShape();
2387  if ( pSvxShape )
2388  {
2389  const SdrObject* pObj = pSvxShape->GetSdrObject();
2390  if ( pObj &&
2391  pObj->GetAnchorPos().X() == 0 &&
2392  pObj->GetAnchorPos().Y() == 0 &&
2393  aAttrPos.X == 0 && aAttrPos.Y == 0 )
2394  {
2395  const tools::Rectangle aObjRect = pObj->GetSnapRect();
2396  aAttrPos.X = convertTwipToMm100(aObjRect.Left());
2397  aAttrPos.Y = convertTwipToMm100(aObjRect.Top());
2398  }
2399  }
2400  // #i35007# - If drawing object is anchored as-character,
2401  // it's x-position isn't sensible. Thus, return the x-position as zero in this case.
2402  text::TextContentAnchorType eTextAnchorType =
2403  text::TextContentAnchorType_AT_PARAGRAPH;
2404  {
2405  uno::Any aAny = getPropertyValue( "AnchorType" );
2406  aAny >>= eTextAnchorType;
2407  }
2408  if ( eTextAnchorType == text::TextContentAnchorType_AS_CHARACTER )
2409  {
2410  aAttrPos.X = 0;
2411  }
2412 
2413  return aAttrPos;
2414 }
2415 
2420 awt::Point SwXShape::ConvertPositionToHoriL2R( const awt::Point& rObjPos,
2421  const awt::Size& rObjSize )
2422 {
2423  awt::Point aObjPosInHoriL2R( rObjPos );
2424 
2425  SwFrameFormat* pFrameFormat = GetFrameFormat();
2426  if ( pFrameFormat )
2427  {
2428  SwFrameFormat::tLayoutDir eLayoutDir = pFrameFormat->GetLayoutDir();
2429  switch ( eLayoutDir )
2430  {
2432  {
2433  // nothing to do
2434  }
2435  break;
2437  {
2438  aObjPosInHoriL2R.X = -rObjPos.X - rObjSize.Width;
2439  }
2440  break;
2442  {
2443  aObjPosInHoriL2R.X = -rObjPos.Y - rObjSize.Width;
2444  aObjPosInHoriL2R.Y = rObjPos.X;
2445  }
2446  break;
2447  default:
2448  {
2449  OSL_FAIL( "<SwXShape::ConvertPositionToHoriL2R(..)> - unsupported layout direction" );
2450  }
2451  }
2452  }
2453 
2454  return aObjPosInHoriL2R;
2455 }
2456 
2462  const drawing::HomogenMatrix3& rMatrixInHoriL2R )
2463 {
2464  drawing::HomogenMatrix3 aMatrix(rMatrixInHoriL2R);
2465 
2466  // #i44334#, #i44681# - direct manipulation of the
2467  // transformation structure isn't valid, if it contains rotation.
2468  SvxShape* pSvxShape = GetSvxShape();
2469  OSL_ENSURE( pSvxShape,
2470  "<SwXShape::ConvertTransformationToLayoutDir(..)> - no SvxShape found!");
2471  if ( pSvxShape )
2472  {
2473  const SdrObject* pObj = pSvxShape->GetSdrObject();
2474  OSL_ENSURE( pObj,
2475  "<SwXShape::ConvertTransformationToLayoutDir(..)> - no SdrObject found!");
2476  if ( pObj )
2477  {
2478  // get position of object in Writer coordinate system.
2479  awt::Point aPos( getPosition() );
2480  // get position of object in Drawing layer coordinate system
2481  const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() );
2482  const awt::Point aObjPos(
2483  convertTwipToMm100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ),
2484  convertTwipToMm100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) );
2485  // determine difference between these positions according to the
2486  // Writer coordinate system
2487  const awt::Point aTranslateDiff( aPos.X - aObjPos.X,
2488  aPos.Y - aObjPos.Y );
2489  // apply translation difference to transformation matrix.
2490  if ( aTranslateDiff.X != 0 || aTranslateDiff.Y != 0 )
2491  {
2492  // #i73079# - use correct matrix type
2493  ::basegfx::B2DHomMatrix aTempMatrix;
2494 
2495  aTempMatrix.set(0, 0, aMatrix.Line1.Column1 );
2496  aTempMatrix.set(0, 1, aMatrix.Line1.Column2 );
2497  aTempMatrix.set(0, 2, aMatrix.Line1.Column3 );
2498  aTempMatrix.set(1, 0, aMatrix.Line2.Column1 );
2499  aTempMatrix.set(1, 1, aMatrix.Line2.Column2 );
2500  aTempMatrix.set(1, 2, aMatrix.Line2.Column3 );
2501  aTempMatrix.set(2, 0, aMatrix.Line3.Column1 );
2502  aTempMatrix.set(2, 1, aMatrix.Line3.Column2 );
2503  aTempMatrix.set(2, 2, aMatrix.Line3.Column3 );
2504  // #i73079#
2505  aTempMatrix.translate( aTranslateDiff.X, aTranslateDiff.Y );
2506  aMatrix.Line1.Column1 = aTempMatrix.get(0, 0);
2507  aMatrix.Line1.Column2 = aTempMatrix.get(0, 1);
2508  aMatrix.Line1.Column3 = aTempMatrix.get(0, 2);
2509  aMatrix.Line2.Column1 = aTempMatrix.get(1, 0);
2510  aMatrix.Line2.Column2 = aTempMatrix.get(1, 1);
2511  aMatrix.Line2.Column3 = aTempMatrix.get(1, 2);
2512  aMatrix.Line3.Column1 = aTempMatrix.get(2, 0);
2513  aMatrix.Line3.Column2 = aTempMatrix.get(2, 1);
2514  aMatrix.Line3.Column3 = aTempMatrix.get(2, 2);
2515  }
2516  }
2517  }
2518 
2519  return aMatrix;
2520 }
2521 
2525 void SwXShape::AdjustPositionProperties( const awt::Point& rPosition )
2526 {
2527  // handle x-position
2528  // #i35007# - no handling of x-position, if drawing
2529  // object is anchored as-character, because it doesn't make sense.
2530  text::TextContentAnchorType eTextAnchorType =
2531  text::TextContentAnchorType_AT_PARAGRAPH;
2532  {
2533  uno::Any aAny = getPropertyValue( "AnchorType" );
2534  aAny >>= eTextAnchorType;
2535  }
2536  if ( eTextAnchorType != text::TextContentAnchorType_AS_CHARACTER )
2537  {
2538  // determine current x-position
2539  static const OUStringLiteral aHoriPosPropStr(u"HoriOrientPosition");
2540  uno::Any aHoriPos( getPropertyValue( aHoriPosPropStr ) );
2541  sal_Int32 dCurrX = 0;
2542  aHoriPos >>= dCurrX;
2543  // change x-position attribute, if needed
2544  if ( dCurrX != rPosition.X )
2545  {
2546  // adjust x-position orientation to text::HoriOrientation::NONE, if needed
2547  // Note: has to be done before setting x-position attribute
2548  static const OUStringLiteral aHoriOrientPropStr(u"HoriOrient");
2549  uno::Any aHoriOrient( getPropertyValue( aHoriOrientPropStr ) );
2550  sal_Int16 eHoriOrient;
2551  if (aHoriOrient >>= eHoriOrient) // may be void
2552  {
2553  if ( eHoriOrient != text::HoriOrientation::NONE )
2554  {
2555  eHoriOrient = text::HoriOrientation::NONE;
2556  aHoriOrient <<= eHoriOrient;
2557  setPropertyValue( aHoriOrientPropStr, aHoriOrient );
2558  }
2559  }
2560  // set x-position attribute
2561  aHoriPos <<= rPosition.X;
2562  setPropertyValue( aHoriPosPropStr, aHoriPos );
2563  }
2564  }
2565 
2566  // handle y-position
2567  {
2568  // determine current y-position
2569  static const OUStringLiteral aVertPosPropStr(u"VertOrientPosition");
2570  uno::Any aVertPos( getPropertyValue( aVertPosPropStr ) );
2571  sal_Int32 dCurrY = 0;
2572  aVertPos >>= dCurrY;
2573  // change y-position attribute, if needed
2574  if ( dCurrY != rPosition.Y )
2575  {
2576  // adjust y-position orientation to text::VertOrientation::NONE, if needed
2577  // Note: has to be done before setting y-position attribute
2578  static const OUStringLiteral aVertOrientPropStr(u"VertOrient");
2579  uno::Any aVertOrient( getPropertyValue( aVertOrientPropStr ) );
2580  sal_Int16 eVertOrient;
2581  if (aVertOrient >>= eVertOrient) // may be void
2582  {
2583  if ( eVertOrient != text::VertOrientation::NONE )
2584  {
2585  eVertOrient = text::VertOrientation::NONE;
2586  aVertOrient <<= eVertOrient;
2587  setPropertyValue( aVertOrientPropStr, aVertOrient );
2588  }
2589  }
2590  // set y-position attribute
2591  aVertPos <<= rPosition.Y;
2592  setPropertyValue( aVertPosPropStr, aVertPos );
2593  }
2594  }
2595 }
2596 
2602  const css::awt::Point& aStartOrEndPos )
2603 {
2604  awt::Point aConvertedPos( aStartOrEndPos );
2605 
2606  SvxShape* pSvxShape = GetSvxShape();
2607  OSL_ENSURE( pSvxShape,
2608  "<SwXShape::ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!");
2609  if ( pSvxShape )
2610  {
2611  const SdrObject* pObj = pSvxShape->GetSdrObject();
2612  OSL_ENSURE( pObj,
2613  "<SwXShape::ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!");
2614  if ( pObj )
2615  {
2616  // get position of object in Writer coordinate system.
2617  awt::Point aPos( getPosition() );
2618  // get position of object in Drawing layer coordinate system
2619  const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() );
2620  const awt::Point aObjPos(
2621  convertTwipToMm100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ),
2622  convertTwipToMm100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) );
2623  // determine difference between these positions according to the
2624  // Writer coordinate system
2625  const awt::Point aTranslateDiff( aPos.X - aObjPos.X,
2626  aPos.Y - aObjPos.Y );
2627  // apply translation difference to transformation matrix.
2628  if ( aTranslateDiff.X != 0 || aTranslateDiff.Y != 0 )
2629  {
2630  aConvertedPos.X = aConvertedPos.X + aTranslateDiff.X;
2631  aConvertedPos.Y = aConvertedPos.Y + aTranslateDiff.Y;
2632  }
2633  }
2634  }
2635 
2636  return aConvertedPos;
2637 }
2638 
2639 css::drawing::PolyPolygonBezierCoords SwXShape::ConvertPolyPolygonBezierToLayoutDir(
2640  const css::drawing::PolyPolygonBezierCoords& aPath )
2641 {
2642  drawing::PolyPolygonBezierCoords aConvertedPath( aPath );
2643 
2644  SvxShape* pSvxShape = GetSvxShape();
2645  OSL_ENSURE( pSvxShape,
2646  "<SwXShape::ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!");
2647  if ( pSvxShape )
2648  {
2649  const SdrObject* pObj = pSvxShape->GetSdrObject();
2650  OSL_ENSURE( pObj,
2651  "<SwXShape::ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!");
2652  if ( pObj )
2653  {
2654  // get position of object in Writer coordinate system.
2655  awt::Point aPos( getPosition() );
2656  // get position of object in Drawing layer coordinate system
2657  const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() );
2658  const awt::Point aObjPos(
2659  convertTwipToMm100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ),
2660  convertTwipToMm100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) );
2661  // determine difference between these positions according to the
2662  // Writer coordinate system
2663  const awt::Point aTranslateDiff( aPos.X - aObjPos.X,
2664  aPos.Y - aObjPos.Y );
2665  // apply translation difference to PolyPolygonBezier.
2666  if ( aTranslateDiff.X != 0 || aTranslateDiff.Y != 0 )
2667  {
2669  aTranslateDiff.X, aTranslateDiff.Y));
2670 
2671  for(drawing::PointSequence& rInnerSequence : aConvertedPath.Coordinates)
2672  {
2673  for(awt::Point& rPoint : rInnerSequence)
2674  {
2675  basegfx::B2DPoint aNewCoordinatePair(rPoint.X, rPoint.Y);
2676  aNewCoordinatePair *= aMatrix;
2677  rPoint.X = basegfx::fround(aNewCoordinatePair.getX());
2678  rPoint.Y = basegfx::fround(aNewCoordinatePair.getY());
2679  }
2680  }
2681  }
2682  }
2683  }
2684 
2685  return aConvertedPath;
2686 }
2687 
2688 SwXGroupShape::SwXGroupShape(uno::Reference<XInterface> & xShape,
2689  SwDoc const*const pDoc)
2690  : SwXShape(xShape, pDoc)
2691 {
2692 #if OSL_DEBUG_LEVEL > 0
2693  uno::Reference<XShapes> xShapes(m_xShapeAgg, uno::UNO_QUERY);
2694  OSL_ENSURE(xShapes.is(), "no SvxShape found or shape is not a group shape");
2695 #endif
2696 }
2697 
2699 {
2700 }
2701 
2703 {
2704  uno::Any aRet;
2705  if(rType == cppu::UnoType<XShapes>::get())
2706  aRet <<= uno::Reference<XShapes>(this);
2707  else
2708  aRet = SwXShape::queryInterface(rType);
2709  return aRet;
2710 }
2711 
2712 void SwXGroupShape::acquire( ) noexcept
2713 {
2715 }
2716 
2717 void SwXGroupShape::release( ) noexcept
2718 {
2720 }
2721 
2722 void SwXGroupShape::add( const uno::Reference< XShape >& xShape )
2723 {
2724  SolarMutexGuard aGuard;
2725  SvxShape* pSvxShape = GetSvxShape();
2726  SwFrameFormat* pFormat = GetFrameFormat();
2727  if(!(pSvxShape && pFormat))
2728  throw uno::RuntimeException();
2729 
2730  uno::Reference<XShapes> xShapes;
2731  if( m_xShapeAgg.is() )
2732  {
2733  const uno::Type& rType = cppu::UnoType<XShapes>::get();
2734  uno::Any aAgg = m_xShapeAgg->queryAggregation( rType );
2735  aAgg >>= xShapes;
2736  }
2737  if(!xShapes.is())
2738  throw uno::RuntimeException();
2739 
2740  xShapes->add(xShape);
2741 
2742 
2743  uno::Reference<lang::XUnoTunnel> xTunnel(xShape, uno::UNO_QUERY);
2744  SwXShape* pSwShape = nullptr;
2745  if(xShape.is())
2746  pSwShape = reinterpret_cast< SwXShape * >(
2747  sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXShape::getUnoTunnelId()) ));
2748  if(!(pSwShape && pSwShape->m_bDescriptor))
2749  return;
2750 
2751  SvxShape* pAddShape = reinterpret_cast< SvxShape * >(
2752  sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
2753  if(pAddShape)
2754  {
2755  SdrObject* pObj = pAddShape->GetSdrObject();
2756  if(pObj)
2757  {
2758  SwDoc* pDoc = pFormat->GetDoc();
2759  // set layer of new drawing
2760  // object to corresponding invisible layer.
2761  if( SdrInventor::FmForm != pObj->GetObjInventor())
2762  {
2763  pObj->SetLayer( pSwShape->m_pImpl->GetOpaque()
2766  }
2767  else
2768  {
2770  }
2771  }
2772  }
2773  pSwShape->m_bDescriptor = false;
2774  //add the group member to the format of the group
2775  SwFrameFormat* pShapeFormat = ::FindFrameFormat( pSvxShape->GetSdrObject() );
2776 
2777  if(pShapeFormat)
2778  pSwShape->SetFrameFormat(pShapeFormat);
2779 
2780 }
2781 
2782 void SwXGroupShape::remove( const uno::Reference< XShape >& xShape )
2783 {
2784  SolarMutexGuard aGuard;
2785  uno::Reference<XShapes> xShapes;
2786  if( m_xShapeAgg.is() )
2787  {
2788  const uno::Type& rType = cppu::UnoType<XShapes>::get();
2789  uno::Any aAgg = m_xShapeAgg->queryAggregation( rType );
2790  aAgg >>= xShapes;
2791  }
2792  if(!xShapes.is())
2793  throw uno::RuntimeException();
2794  xShapes->remove(xShape);
2795 }
2796 
2798 {
2799  SolarMutexGuard aGuard;
2800  uno::Reference<XIndexAccess> xAcc;
2801  if( m_xShapeAgg.is() )
2802  {
2804  uno::Any aAgg = m_xShapeAgg->queryAggregation( rType );
2805  aAgg >>= xAcc;
2806  }
2807  if(!xAcc.is())
2808  throw uno::RuntimeException();
2809  return xAcc->getCount();
2810 }
2811 
2813 {
2814  SolarMutexGuard aGuard;
2815  uno::Reference<XIndexAccess> xAcc;
2816  if( m_xShapeAgg.is() )
2817  {
2819  uno::Any aAgg = m_xShapeAgg->queryAggregation( rType );
2820  aAgg >>= xAcc;
2821  }
2822  if(!xAcc.is())
2823  throw uno::RuntimeException();
2824  return xAcc->getByIndex(nIndex);
2825 }
2826 
2828 {
2829  SolarMutexGuard aGuard;
2830  uno::Reference<XIndexAccess> xAcc;
2831  if( m_xShapeAgg.is() )
2832  {
2834  uno::Any aAgg = m_xShapeAgg->queryAggregation( rType );
2835  aAgg >>= xAcc;
2836  }
2837  if(!xAcc.is())
2838  throw uno::RuntimeException();
2839  return xAcc->getElementType();
2840 }
2841 
2843 {
2844  SolarMutexGuard aGuard;
2845  uno::Reference<XIndexAccess> xAcc;
2846  if( m_xShapeAgg.is() )
2847  {
2849  uno::Any aAgg = m_xShapeAgg->queryAggregation( rType );
2850  aAgg >>= xAcc;
2851  }
2852  if(!xAcc.is())
2853  throw uno::RuntimeException();
2854  return xAcc->hasElements();
2855 }
2856 
2857 /* 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:1756
std::unique_ptr< SwFormatFollowTextFlow > m_pFollowTextFlow
Definition: unodraw.cxx:94
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:2688
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
virtual sal_Int32 SAL_CALL getCount() override
Definition: unodraw.cxx:2797
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unodraw.cxx:1964
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:660
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
SwDocShell * GetDocShell()
Definition: doc.hxx:1353
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:1038
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unodraw.cxx:2827
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
std::enable_if< std::is_signed< T >::value, T >::type saturating_sub(T a, T b)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unodraw.cxx:2176
#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:1977
static sal_Int32 getOrdNum(const SdrObject *pObject)
Get the order of the shape, excluding TextBoxes.
double getX() const
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:187
constexpr sal_uInt16 RES_FRMATR_END(133)
SdrObject * GetTopGroupObj(SvxShape *_pSvxShape=nullptr)
method to determine top group object
Definition: unodraw.cxx:2352
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
double getY() const
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:2104
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:2842
sal_uInt16 Which() const
Definition: txatbase.hxx:114
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
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:256
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:3050
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:762
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
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
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:2199
virtual ~SwXGroupShape() override
Definition: unodraw.cxx:2698
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:2717
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:2155
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2471
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:814
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unodraw.cxx:1997
void UnmarkAll()
SdrPage * mpPage
#define FN_TEXT_RANGE
Definition: cmdid.h:806
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:1748
bool IsOLENode() const
Definition: node.hxx:656
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:101
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:2376
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:2181
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:2461
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:821
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:820
SwDoc & GetDoc()
Definition: node.hxx:212
std::unique_ptr< SvxULSpaceItem > m_pULSpace
Definition: unodraw.cxx:89
virtual SwFrameFormat::tLayoutDir GetLayoutDir() const
Definition: atrfrm.cxx:2781
SwFrameFormat * GetFormat()
Definition: dcontact.hxx:112
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
#define FN_SHAPE_STARTPOSITION_IN_HORI_L2R
Definition: cmdid.h:822
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
SvxShape * GetSvxShape()
Definition: unodraw.cxx:2190
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:2601
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:60
std::enable_if< std::is_signed< T >::value, T >::type saturating_add(T a, T b)
const SdrMarkList & GetMarkedObjectList() const
FlyAnchors.
Definition: fmtanchr.hxx:34
std::unique_ptr< SdrView > mpView
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unodraw.cxx: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:2644
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:2782
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:652
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:49
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:1096
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:200
OUString GetUniqueShapeName() const
Definition: doclay.cxx:1384
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:450
#define FN_TEXT_BOX
Definition: cmdid.h:825
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:900
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:2639
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
constexpr TypedWhichId< SwFormatChain > RES_CHAIN(114)
#define FN_SHAPE_ENDPOSITION_IN_HORI_L2R
Definition: cmdid.h:823
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:2722
SwFormatFollowTextFlow * GetFollowTextFlow(bool _bCreate=false)
Definition: unodraw.cxx:201
virtual OUString SAL_CALL getImplementationName() override
Definition: unodraw.cxx:2171
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:1446
#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:2702
#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:2792
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:2237
virtual SwDrawModel * GetOrCreateDrawModel()=0
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
SwNodes & GetNodes()
Definition: doc.hxx:408
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:3189
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:2525
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:1731
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:2319
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:2420
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.
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:148
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:3478
virtual void SAL_CALL acquire() noexcept override
Definition: unodraw.cxx:2712
static css::uno::Reference< css::text::XTextContent > CreateXTextGraphicObject(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3431
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unodraw.cxx:2163
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:1199
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
virtual void Notify(const SfxHint &) override
Definition: unodraw.cxx:2004
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
Definition: unodraw.cxx:1931
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:2812
bool m_bDescriptor
Definition: unodraw.hxx:150
SwFrameFormat * GetFrameFormat() const
Definition: unodraw.hxx:257
SdrObjUserCall * GetUserCall() const
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
Definition: unodraw.cxx:1870
bool Is3DObj() const
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
virtual OUString SAL_CALL getShapeType() override
Definition: unodraw.cxx:2341
virtual void SetPositionLayoutDir(const sal_Int16 _nPositionLayoutDir)
Definition: atrfrm.cxx:2796
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:138
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
SdrObject * FindRealSdrObject()
Definition: atrfrm.cxx:2713
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:2013
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:1320
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unodraw.cxx:2075
virtual void SAL_CALL setSize(const css::awt::Size &aSize) override
Definition: unodraw.cxx:2329
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:845
bool HasHints() const
Definition: ndtxt.hxx:220
const double * GetRelativeHeight() const
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1494
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unodraw.cxx:1990
const SwFormatFlyCnt & GetFlyCnt() const
Definition: txatbase.hxx:210
Base class of the Writer document model elements.
Definition: node.hxx:80