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