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