1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unodraw.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
34 #include <swtypes.hxx>
38 #include <unodraw.hxx>
39 #include <unocoll.hxx>
40 #include <unoframe.hxx>
41 #include <unoprnms.hxx>
42 #include <svx/unoprnms.hxx>
43 #include <swunohelper.hxx>
45 #include <fmtflcnt.hxx>
49 #include <unoport.hxx>
50 #include <unocrsr.hxx>
52 #include <dflyobj.hxx>
54 #include <svx/svdview.hxx>
55 #include <svx/unoshape.hxx>
56 #include <dcontact.hxx>
57 #include <svx/fmglob.hxx>
58 #include <fmtornt.hxx>
59 #include <fmtanchr.hxx>
60 #include <fmtsrnd.hxx>
61 // OD 2004-04-21 #i26791#
62 #include <fmtfollowtextflow.hxx>
63 #include <rootfrm.hxx>
64 #include <svx/lrspitem.hxx>
65 #include <svx/ulspitem.hxx>
66 #include <svx/shapepropertynotifier.hxx>
67 #include <crstate.hxx>
68 #include <vos/mutex.hxx>
69 #include <comphelper/extract.hxx>
70 #include <comphelper/stl_types.hxx>
71 #include <comphelper/makesequence.hxx>
72 #include <svx/scene3d.hxx>
73 #include <com/sun/star/beans/PropertyAttribute.hpp>
74 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
75 #include <com/sun/star/text/HoriOrientation.hpp>
76 #include <com/sun/star/text/VertOrientation.hpp>
77 #include <basegfx/numeric/ftools.hxx>
78 // OD 2004-05-05 #i28701#
79 #include <fmtwrapinfluenceonobjpos.hxx>
80 // --> OD 2004-11-10 #i35007#
81 #include <com/sun/star/text/TextContentAnchorType.hpp>
83 // --> OD 2005-03-10 #i44334#, #i44681#
84 // --> OD 2007-01-03 #i73079# - use correct matrix type
85 #include <basegfx/matrix/b2dhommatrix.hxx>
87 // --> OD 2009-01-16 #i59051
88 #include <com/sun/star/drawing/PointSequence.hpp>
91 #include <vcl/svapp.hxx>
95 using ::rtl::OUString
;
96 using namespace ::com::sun::star
;
98 DECLARE_STL_USTRINGACCESS_MAP( uno::Sequence
< sal_Int8
> *, SwShapeImplementationIdMap
);
100 static SwShapeImplementationIdMap aImplementationIdMap
;
102 /* -----------------22.01.99 13:19-------------------
104 * --------------------------------------------------*/
105 class SwShapeDescriptor_Impl
107 SwFmtHoriOrient
* pHOrient
;
108 SwFmtVertOrient
* pVOrient
;
109 SwFmtAnchor
* pAnchor
;
110 SwFmtSurround
* pSurround
;
111 SvxULSpaceItem
* pULSpace
;
112 SvxLRSpaceItem
* pLRSpace
;
114 uno::Reference
< text::XTextRange
> xTextRange
;
115 // OD 2004-04-21 #i26791#
116 SwFmtFollowTextFlow
* mpFollowTextFlow
;
117 // OD 2004-05-05 #i28701# - add property 'WrapInfluenceOnObjPos'
118 SwFmtWrapInfluenceOnObjPos
* pWrapInfluenceOnObjPos
;
119 // --> OD 2004-08-06 #i28749#
120 sal_Int16 mnPositionLayoutDir
;
124 bool bInitializedPropertyNotifier
;
127 SwShapeDescriptor_Impl() :
128 // --> OD 2004-08-18 #i32349# - no defaults, in order to determine on
129 // adding a shape, if positioning attributes are set or not.
138 // OD 2004-04-21 #i26791#
139 mpFollowTextFlow( new SwFmtFollowTextFlow( FALSE
) ),
140 // OD 2004-05-05 #i28701#
141 // --> OD 2004-10-18 #i35017# - constant name has changed
142 pWrapInfluenceOnObjPos( new SwFmtWrapInfluenceOnObjPos(
143 text::WrapInfluenceOnPosition::ONCE_CONCURRENT
) ),
145 // --> OD 2004-08-06 #i28749#
146 mnPositionLayoutDir( text::PositionLayoutDir::PositionInLayoutDirOfAnchor
),
147 bInitializedPropertyNotifier(false)
150 ~SwShapeDescriptor_Impl()
158 // OD 2004-04-22 #i26791#
159 delete mpFollowTextFlow
;
160 // OD 2004-05-05 #i28701#
161 delete pWrapInfluenceOnObjPos
;
163 SwFmtAnchor
* GetAnchor(sal_Bool bCreate
= sal_False
)
165 if(bCreate
&& !pAnchor
)
166 pAnchor
= new SwFmtAnchor(FLY_IN_CNTNT
);
169 SwFmtHoriOrient
* GetHOrient(sal_Bool bCreate
= sal_False
)
171 if (bCreate
&& !pHOrient
)
173 // OD 2004-06-03 #i26791# - change default
174 pHOrient
= new SwFmtHoriOrient( 0, text::HoriOrientation::NONE
, text::RelOrientation::FRAME
);
178 SwFmtVertOrient
* GetVOrient(sal_Bool bCreate
= sal_False
)
180 if(bCreate
&& !pVOrient
)
182 // OD 2004-04-21 #i26791# - change default
183 pVOrient
= new SwFmtVertOrient( 0, text::VertOrientation::NONE
, text::RelOrientation::FRAME
);
188 SwFmtSurround
* GetSurround(sal_Bool bCreate
= sal_False
)
190 if(bCreate
&& !pSurround
)
191 pSurround
= new SwFmtSurround();
194 SvxLRSpaceItem
* GetLRSpace(sal_Bool bCreate
= sal_False
)
196 if(bCreate
&& !pLRSpace
)
197 pLRSpace
= new SvxLRSpaceItem(RES_LR_SPACE
);
200 SvxULSpaceItem
* GetULSpace(sal_Bool bCreate
= sal_False
)
202 if(bCreate
&& !pULSpace
)
203 pULSpace
= new SvxULSpaceItem(RES_UL_SPACE
);
206 uno::Reference
< text::XTextRange
> & GetTextRange()
214 const sal_Bool
& GetOpaque()
218 void RemoveHOrient(){DELETEZ(pHOrient
);}
219 void RemoveVOrient(){DELETEZ(pVOrient
);}
220 void RemoveAnchor(){DELETEZ(pAnchor
);}
221 void RemoveSurround(){DELETEZ(pSurround
);}
222 void RemoveULSpace(){DELETEZ(pULSpace
);}
223 void RemoveLRSpace(){DELETEZ(pLRSpace
);}
224 void SetOpaque(sal_Bool bSet
){bOpaque
= bSet
;}
226 // OD 2004-04-21 #i26791#
227 SwFmtFollowTextFlow
* GetFollowTextFlow( sal_Bool _bCreate
= sal_False
)
229 if ( _bCreate
&& !mpFollowTextFlow
)
230 mpFollowTextFlow
= new SwFmtFollowTextFlow( FALSE
);
231 return mpFollowTextFlow
;
233 void RemoveFollowTextFlow()
235 DELETEZ(mpFollowTextFlow
);
238 // --> OD 2004-08-06 #i28749#
239 sal_Int16
GetPositionLayoutDir() const
241 return mnPositionLayoutDir
;
243 void SetPositionLayoutDir( sal_Int16 _nPositionLayoutDir
)
245 switch ( _nPositionLayoutDir
)
247 case text::PositionLayoutDir::PositionInHoriL2R
:
248 case text::PositionLayoutDir::PositionInLayoutDirOfAnchor
:
250 mnPositionLayoutDir
= _nPositionLayoutDir
;
256 "<SwShapeDescriptor_Impl::SetPositionLayoutDir(..)> - invalid attribute value." );
260 void RemovePositionLayoutDir()
262 mnPositionLayoutDir
= text::PositionLayoutDir::PositionInLayoutDirOfAnchor
;
266 // OD 2004-05-05 #i28701#
267 inline SwFmtWrapInfluenceOnObjPos
* GetWrapInfluenceOnObjPos(
268 const sal_Bool _bCreate
= sal_False
)
270 if ( _bCreate
&& !pWrapInfluenceOnObjPos
)
272 pWrapInfluenceOnObjPos
= new SwFmtWrapInfluenceOnObjPos(
273 // --> OD 2004-10-18 #i35017# - constant name has changed
274 text::WrapInfluenceOnPosition::ONCE_CONCURRENT
);
277 return pWrapInfluenceOnObjPos
;
279 inline void RemoveWrapInfluenceOnObjPos()
281 DELETEZ(pWrapInfluenceOnObjPos
);
284 /****************************************************************************
286 ****************************************************************************/
288 /* -----------------28.01.99 12:03-------------------
290 * --------------------------------------------------*/
291 SwFmDrawPage::SwFmDrawPage( SdrPage
* pPage
) :
292 SvxFmDrawPage( pPage
), pPageView(0)
296 /*-- 22.01.99 11:13:07---------------------------------------------------
298 -----------------------------------------------------------------------*/
299 SwFmDrawPage::~SwFmDrawPage() throw ()
303 /*-- 22.01.99 11:13:07---------------------------------------------------
305 -----------------------------------------------------------------------*/
306 const SdrMarkList
& SwFmDrawPage::PreGroup(const uno::Reference
< drawing::XShapes
> & xShapes
)
308 _SelectObjectsInView( xShapes
, GetPageView() );
309 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
312 /*-- 22.01.99 11:13:08---------------------------------------------------
314 -----------------------------------------------------------------------*/
315 void SwFmDrawPage::PreUnGroup(const uno::Reference
< drawing::XShapeGroup
> xShapeGroup
)
317 uno::Reference
< drawing::XShape
> xShape( xShapeGroup
, uno::UNO_QUERY
);
318 _SelectObjectInView( xShape
, GetPageView() );
320 /*-- 22.01.99 11:13:08---------------------------------------------------
322 -----------------------------------------------------------------------*/
323 SdrPageView
* SwFmDrawPage::GetPageView()
326 pPageView
= mpView
->ShowSdrPage( mpPage
);
329 /*-- 22.01.99 11:13:08---------------------------------------------------
331 -----------------------------------------------------------------------*/
332 void SwFmDrawPage::RemovePageView()
334 if(pPageView
&& mpView
)
335 mpView
->HideSdrPage();
338 /*-- 22.01.99 11:13:09---------------------------------------------------
340 -----------------------------------------------------------------------*/
341 uno::Reference
< uno::XInterface
> SwFmDrawPage::GetInterface( SdrObject
* pObj
)
343 uno::Reference
< XInterface
> xShape
;
346 SwFrmFmt
* pFmt
= ::FindFrmFmt( pObj
);
347 SwXShape
* pxShape
= (SwXShape
*)SwClientIter( *pFmt
).
348 First( TYPE( SwXShape
));
351 xShape
= *(cppu::OWeakObject
*)pxShape
;
354 xShape
= pObj
->getUnoShape();
358 /*-- 22.01.99 11:13:09---------------------------------------------------
360 -----------------------------------------------------------------------*/
361 SdrObject
* SwFmDrawPage::_CreateSdrObject( const uno::Reference
< drawing::XShape
> & xShape
) throw ()
363 //TODO: stimmt das so - kann die Methode weg?
364 return SvxFmDrawPage::_CreateSdrObject( xShape
);
366 /*-- 22.01.99 11:13:09---------------------------------------------------
368 -----------------------------------------------------------------------*/
370 uno::Reference
< drawing::XShape
> SwFmDrawPage::_CreateShape( SdrObject
*pObj
) const throw ()
372 uno::Reference
< drawing::XShape
> xRet
;
373 if(pObj
->ISA(SwVirtFlyDrawObj
) || pObj
->GetObjInventor() == SWGInventor
)
375 SwFlyDrawContact
* pFlyContact
= (SwFlyDrawContact
*)pObj
->GetUserCall();
378 FlyCntType eType
= FLYCNTTYPE_ALL
;
379 SwFrmFmt
* pFlyFmt
= pFlyContact
->GetFmt();
380 SwDoc
* pDoc
= pFlyFmt
->GetDoc();
381 const SwNodeIndex
* pIdx
;
382 if( RES_FLYFRMFMT
== pFlyFmt
->Which()
383 && 0 != ( pIdx
= pFlyFmt
->GetCntnt().GetCntntIdx() )
384 && pIdx
->GetNodes().IsDocNodes()
387 const SwNode
* pNd
= pDoc
->GetNodes()[ pIdx
->GetIndex() + 1 ];
388 if(!pNd
->IsNoTxtNode())
389 eType
= FLYCNTTYPE_FRM
;
390 else if( pNd
->IsGrfNode() )
391 eType
= FLYCNTTYPE_GRF
;
392 else if( pNd
->IsOLENode() )
393 eType
= FLYCNTTYPE_OLE
;
398 "<SwFmDrawPage::_CreateShape(..)> - could not retrieve type. Thus, no shape created." );
401 DBG_ASSERT( eType
!= FLYCNTTYPE_ALL
, "unexpected FlyCntType value for eType" );
402 xRet
= SwXFrames::GetObject( *pFlyFmt
, eType
);
407 // own block - temporary object has to be destroyed before
408 // the delegator is set #81670#
410 xRet
= SvxFmDrawPage::_CreateShape( pObj
);
412 uno::Reference
< XUnoTunnel
> xShapeTunnel(xRet
, uno::UNO_QUERY
);
413 //don't create an SwXShape if it already exists
414 SwXShape
* pShape
= 0;
415 if(xShapeTunnel
.is())
416 pShape
= reinterpret_cast< SwXShape
* >(
417 sal::static_int_cast
< sal_IntPtr
>( xShapeTunnel
->getSomething(SwXShape::getUnoTunnelId()) ));
421 uno::Reference
< uno::XInterface
> xCreate(xRet
, uno::UNO_QUERY
);
423 uno::Reference
< beans::XPropertySet
> xPrSet
;
424 if ( pObj
->IsGroupObject() && (!pObj
->Is3DObj() || ( PTR_CAST(E3dScene
,pObj
) != NULL
) ) )
425 xPrSet
= new SwXGroupShape( xCreate
);
427 xPrSet
= new SwXShape( xCreate
);
428 xRet
= uno::Reference
< drawing::XShape
>(xPrSet
, uno::UNO_QUERY
);
434 /****************************************************************************
435 class SwXShapesEnumeration
436 ****************************************************************************/
439 class SwXShapesEnumeration
: public SwSimpleEnumerationBaseClass
442 typedef ::std::slist
< ::com::sun::star::uno::Any
> shapescontainer_t
;
443 shapescontainer_t m_aShapes
;
445 virtual ~SwXShapesEnumeration() {};
447 SwXShapesEnumeration(SwXDrawPage
* const pDrawPage
);
450 virtual BOOL SAL_CALL
hasMoreElements(void) throw(uno::RuntimeException
);
451 virtual uno::Any SAL_CALL
nextElement(void) throw(container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
);
454 virtual OUString SAL_CALL
getImplementationName(void) throw(uno::RuntimeException
);
455 virtual BOOL SAL_CALL
supportsService(const OUString
& ServiceName
) throw(uno::RuntimeException
);
456 virtual uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames(void) throw(uno::RuntimeException
);
460 SwXShapesEnumeration::SwXShapesEnumeration(SwXDrawPage
* const pDrawPage
)
463 vos::OGuard
aGuard(Application::GetSolarMutex());
464 ::std::insert_iterator
<shapescontainer_t
> pInserter
= ::std::insert_iterator
<shapescontainer_t
>(m_aShapes
, m_aShapes
.begin());
465 sal_Int32 nCount
= pDrawPage
->getCount();
466 for(sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++)
468 uno::Reference
<drawing::XShape
> xShape
= uno::Reference
<drawing::XShape
>(pDrawPage
->getByIndex(nIdx
), uno::UNO_QUERY
);
469 *pInserter
++ = uno::makeAny(xShape
);
473 BOOL
SwXShapesEnumeration::hasMoreElements(void) throw(uno::RuntimeException
)
475 vos::OGuard
aGuard(Application::GetSolarMutex());
476 return !m_aShapes
.empty();
479 uno::Any
SwXShapesEnumeration::nextElement(void) throw(container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
)
481 vos::OGuard
aGuard(Application::GetSolarMutex());
482 if(m_aShapes
.empty())
483 throw container::NoSuchElementException();
484 uno::Any aResult
= *m_aShapes
.begin();
485 m_aShapes
.pop_front();
489 OUString
SwXShapesEnumeration::getImplementationName(void) throw(uno::RuntimeException
)
491 return C2U("SwXShapeEnumeration");
494 BOOL
SwXShapesEnumeration::supportsService(const OUString
& ServiceName
) throw(uno::RuntimeException
)
496 return C2U("com.sun.star.container.XEnumeration") == ServiceName
;
499 uno::Sequence
< OUString
> SwXShapesEnumeration::getSupportedServiceNames(void) throw(uno::RuntimeException
)
501 return ::comphelper::makeSequence(C2U("com.sun.star.container.XEnumeration"));
503 /****************************************************************************
505 ****************************************************************************/
506 uno::Reference
< container::XEnumeration
> SwXDrawPage::createEnumeration(void) throw( uno::RuntimeException
)
508 vos::OGuard
aGuard(Application::GetSolarMutex());
509 return uno::Reference
< container::XEnumeration
>(
510 new SwXShapesEnumeration(this));
512 /* -----------------------------06.04.00 13:14--------------------------------
514 ---------------------------------------------------------------------------*/
515 rtl::OUString
SwXDrawPage::getImplementationName(void) throw( uno::RuntimeException
)
517 return C2U("SwXDrawPage");
519 /* -----------------------------06.04.00 13:14--------------------------------
521 ---------------------------------------------------------------------------*/
522 BOOL
SwXDrawPage::supportsService(const rtl::OUString
& rServiceName
) throw( uno::RuntimeException
)
524 return C2U("com.sun.star.drawing.GenericDrawPage") == rServiceName
;
526 /* -----------------------------06.04.00 13:14--------------------------------
528 ---------------------------------------------------------------------------*/
529 uno::Sequence
< rtl::OUString
> SwXDrawPage::getSupportedServiceNames(void) throw( uno::RuntimeException
)
531 uno::Sequence
< rtl::OUString
> aRet(1);
532 rtl::OUString
* pArray
= aRet
.getArray();
533 pArray
[0] = C2U("com.sun.star.drawing.GenericDrawPage");
536 /*-- 22.01.99 11:22:25---------------------------------------------------
538 -----------------------------------------------------------------------*/
539 SwXDrawPage::SwXDrawPage(SwDoc
* pDc
) :
544 /*-- 22.01.99 11:22:25---------------------------------------------------
546 -----------------------------------------------------------------------*/
547 SwXDrawPage::~SwXDrawPage()
551 uno::Reference
< uno::XInterface
> xInt
;
552 xPageAgg
->setDelegator(xInt
);
555 /* -----------------------------15.06.00 15:00--------------------------------
557 ---------------------------------------------------------------------------*/
558 uno::Any
SwXDrawPage::queryInterface( const uno::Type
& aType
)
559 throw( uno::RuntimeException
)
561 uno::Any aRet
= SwXDrawPageBaseClass::queryInterface(aType
);
564 // secure with checking if page exists. This may not be the case
565 // either for new SW docs with no yet graphics usage or when
566 // the doc is closed and someone else still holds a UNO reference
567 // to the XDrawPage (in that case, pDoc is set to 0)
568 SwFmDrawPage
* pPage
= GetSvxPage();
572 aRet
= pPage
->queryAggregation(aType
);
577 /* -----------------------------15.06.00 15:01--------------------------------
579 ---------------------------------------------------------------------------*/
580 uno::Sequence
< uno::Type
> SwXDrawPage::getTypes() throw( uno::RuntimeException
)
582 uno::Sequence
< uno::Type
> aPageTypes
= SwXDrawPageBaseClass::getTypes();
583 uno::Sequence
< uno::Type
> aSvxTypes
= GetSvxPage()->getTypes();
585 long nIndex
= aPageTypes
.getLength();
586 aPageTypes
.realloc(aPageTypes
.getLength() + aSvxTypes
.getLength() + 1);
588 uno::Type
* pPageTypes
= aPageTypes
.getArray();
589 const uno::Type
* pSvxTypes
= aSvxTypes
.getConstArray();
591 for(nPos
= 0; nPos
< aSvxTypes
.getLength(); nPos
++)
593 pPageTypes
[nIndex
++] = pSvxTypes
[nPos
];
595 pPageTypes
[nIndex
] = ::getCppuType((uno::Reference
<form::XFormsSupplier2
>*)0);
598 /*-- 22.01.99 11:33:44---------------------------------------------------
600 -----------------------------------------------------------------------*/
601 sal_Int32
SwXDrawPage::getCount(void) throw( uno::RuntimeException
)
603 vos::OGuard
aGuard(Application::GetSolarMutex());
605 throw uno::RuntimeException();
606 if(!pDoc
->GetDrawModel())
610 ((SwXDrawPage
*)this)->GetSvxPage();
611 return pDrawPage
->getCount();
614 /*-- 22.01.99 11:33:46---------------------------------------------------
616 -----------------------------------------------------------------------*/
617 uno::Any
SwXDrawPage::getByIndex(sal_Int32 nIndex
)
618 throw( lang::IndexOutOfBoundsException
, lang::WrappedTargetException
,
619 uno::RuntimeException
)
621 vos::OGuard
aGuard(Application::GetSolarMutex());
623 throw uno::RuntimeException();
624 if(!pDoc
->GetDrawModel())
625 throw lang::IndexOutOfBoundsException();
627 ((SwXDrawPage
*)this)->GetSvxPage();
628 return pDrawPage
->getByIndex( nIndex
);
630 /* -----------------22.01.99 13:13-------------------
632 * --------------------------------------------------*/
633 uno::Type
SwXDrawPage::getElementType(void) throw( uno::RuntimeException
)
635 return ::getCppuType((const uno::Reference
<drawing::XShape
>*)0);
637 /* -----------------22.01.99 13:13-------------------
639 * --------------------------------------------------*/
640 sal_Bool
SwXDrawPage::hasElements(void) throw( uno::RuntimeException
)
642 vos::OGuard
aGuard(Application::GetSolarMutex());
644 throw uno::RuntimeException();
645 if(!pDoc
->GetDrawModel())
648 return ((SwXDrawPage
*)this)->GetSvxPage()->hasElements();
651 /* -----------------22.01.99 12:42-------------------
653 * --------------------------------------------------*/
654 void SwXDrawPage::add(const uno::Reference
< drawing::XShape
> & xShape
)
655 throw( uno::RuntimeException
)
657 vos::OGuard
aGuard(Application::GetSolarMutex());
659 throw uno::RuntimeException();
660 uno::Reference
< lang::XUnoTunnel
> xShapeTunnel(xShape
, uno::UNO_QUERY
);
661 SwXShape
* pShape
= 0;
662 SvxShape
* pSvxShape
= 0;
663 if(xShapeTunnel
.is())
665 pShape
= reinterpret_cast< SwXShape
* >(
666 sal::static_int_cast
< sal_IntPtr
>( xShapeTunnel
->getSomething(SwXShape::getUnoTunnelId()) ));
667 pSvxShape
= reinterpret_cast< SvxShape
* >(
668 sal::static_int_cast
< sal_IntPtr
>( xShapeTunnel
->getSomething(SvxShape::getUnoTunnelId()) ));
671 if(!pShape
|| pShape
->GetRegisteredIn() || !pShape
->m_bDescriptor
)
673 uno::RuntimeException aExcept
;
675 aExcept
.Message
= C2U("object already inserted");
677 aExcept
.Message
= C2U("illegal object");
682 if ( pSvxShape
->GetSdrObject() )
684 if ( pSvxShape
->GetSdrObject()->IsInserted() )
690 GetSvxPage()->add(xShape
);
692 uno::Reference
< uno::XAggregation
> xAgg
= pShape
->GetAggregationInterface();
694 DBG_ASSERT(pSvxShape
, "warum gibt es hier kein SvxShape?");
695 //diese Position ist auf jeden Fall in 1/100 mm
696 awt::Point
aMM100Pos(pSvxShape
->getPosition());
698 //jetzt noch die Properties aus dem SwShapeDescriptor_Impl auswerten
699 SwShapeDescriptor_Impl
* pDesc
= pShape
->GetDescImpl();
701 SfxItemSet
aSet( pDoc
->GetAttrPool(), RES_FRMATR_BEGIN
,
703 SwFmtAnchor
aAnchor( FLY_IN_CNTNT
);
704 sal_Bool bOpaque
= sal_False
;
707 if(pDesc
->GetSurround())
708 aSet
.Put( *pDesc
->GetSurround());
709 //die Items sind schon in Twip gesetzt
710 if(pDesc
->GetLRSpace())
712 aSet
.Put(*pDesc
->GetLRSpace());
714 if(pDesc
->GetULSpace())
716 aSet
.Put(*pDesc
->GetULSpace());
718 if(pDesc
->GetAnchor())
719 aAnchor
= *pDesc
->GetAnchor();
721 // --> OD 2004-08-18 #i32349# - if no horizontal position exists, create one
722 if ( !pDesc
->GetHOrient() )
724 SwFmtHoriOrient
* pHori
= pDesc
->GetHOrient( sal_True
);
725 SwTwips nHoriPos
= MM100_TO_TWIP(aMM100Pos
.X
);
726 pHori
->SetPos( nHoriPos
);
730 if(pDesc
->GetHOrient()->GetHoriOrient() == text::HoriOrientation::NONE
)
731 aMM100Pos
.X
= TWIP_TO_MM100(pDesc
->GetHOrient()->GetPos());
732 aSet
.Put( *pDesc
->GetHOrient() );
734 // --> OD 2004-08-18 #i32349# - if no vertical position exists, create one
735 if ( !pDesc
->GetVOrient() )
737 SwFmtVertOrient
* pVert
= pDesc
->GetVOrient( sal_True
);
738 SwTwips nVertPos
= MM100_TO_TWIP(aMM100Pos
.Y
);
739 pVert
->SetPos( nVertPos
);
743 if(pDesc
->GetVOrient()->GetVertOrient() == text::VertOrientation::NONE
)
744 aMM100Pos
.Y
= TWIP_TO_MM100(pDesc
->GetVOrient()->GetPos());
745 aSet
.Put( *pDesc
->GetVOrient() );
748 if(pDesc
->GetSurround())
749 aSet
.Put( *pDesc
->GetSurround());
750 bOpaque
= pDesc
->IsOpaque();
752 // OD 2004-04-22 #i26791#
753 if ( pDesc
->GetFollowTextFlow() )
755 aSet
.Put( *pDesc
->GetFollowTextFlow() );
758 // OD 2004-05-05 #i28701#
759 if ( pDesc
->GetWrapInfluenceOnObjPos() )
761 aSet
.Put( *pDesc
->GetWrapInfluenceOnObjPos() );
765 pSvxShape
->setPosition(aMM100Pos
);
766 SdrObject
* pObj
= pSvxShape
->GetSdrObject();
767 // OD 25.06.2003 #108784# - set layer of new drawing object to corresponding
769 if(FmFormInventor
!= pObj
->GetObjInventor())
770 pObj
->SetLayer( bOpaque
? pDoc
->GetInvisibleHeavenId() : pDoc
->GetInvisibleHellId() );
772 pObj
->SetLayer(pDoc
->GetInvisibleControlsId());
774 SwPaM
* pPam
= new SwPaM(pDoc
->GetNodes().GetEndOfContent());
775 SwUnoInternalPaM
* pInternalPam
= 0;
776 uno::Reference
< text::XTextRange
> xRg
;
777 if( pDesc
&& (xRg
= pDesc
->GetTextRange()).is() )
779 pInternalPam
= new SwUnoInternalPaM(*pDoc
);
780 if(SwXTextRange::XTextRangeToSwPaM(*pInternalPam
, xRg
))
782 if(FLY_AT_FLY
== aAnchor
.GetAnchorId() &&
783 !pInternalPam
->GetNode()->FindFlyStartNode())
784 aAnchor
.SetType(FLY_IN_CNTNT
);
785 else if(FLY_PAGE
== aAnchor
.GetAnchorId())
786 aAnchor
.SetAnchor(pInternalPam
->Start());
789 throw uno::RuntimeException();
791 else if( aAnchor
.GetAnchorId() != FLY_PAGE
&& pDoc
->GetRootFrm() )
793 SwCrsrMoveState
aState( MV_SETONLYTEXT
);
794 Point
aTmp(MM100_TO_TWIP(aMM100Pos
.X
), MM100_TO_TWIP(aMM100Pos
.Y
));
795 pDoc
->GetRootFrm()->GetCrsrOfst( pPam
->GetPoint(), aTmp
, &aState
);
796 aAnchor
.SetAnchor( pPam
->GetPoint() );
798 // --> OD 2004-08-18 #i32349# - adjustment of vertical positioning
799 // attributes no longer needed, because its already got a default.
803 aAnchor
.SetType(FLY_PAGE
);
805 // --> OD 2004-08-18 #i32349# - adjustment of vertical positioning
806 // attributes no longer needed, because its already got a default.
809 SwPaM
* pTemp
= pInternalPam
;
812 UnoActionContext
aAction(pDoc
);
813 pDoc
->Insert( *pTemp
, *pObj
, &aSet
, NULL
);
814 SwFrmFmt
* pFmt
= ::FindFrmFmt( pObj
);
817 pShape
->m_bDescriptor
= sal_False
;
822 /* -----------------22.01.99 12:42-------------------
824 * --------------------------------------------------*/
825 void SwXDrawPage::remove(const uno::Reference
< drawing::XShape
> & xShape
) throw( uno::RuntimeException
)
827 vos::OGuard
aGuard(Application::GetSolarMutex());
829 throw uno::RuntimeException();
830 uno::Reference
<lang::XComponent
> xComp(xShape
, uno::UNO_QUERY
);
833 /* -----------------17.02.99 10:38-------------------
835 * --------------------------------------------------*/
836 uno::Reference
< drawing::XShapeGroup
> SwXDrawPage::group(const uno::Reference
< drawing::XShapes
> & xShapes
) throw( uno::RuntimeException
)
838 vos::OGuard
aGuard(Application::GetSolarMutex());
839 if(!pDoc
|| !xShapes
.is())
840 throw uno::RuntimeException();
841 uno::Reference
< drawing::XShapeGroup
> xRet
;
845 SwFmDrawPage
* pPage
= GetSvxPage();
846 if(pPage
)//kann das auch Null sein?
848 //markieren und MarkList zurueckgeben
849 const SdrMarkList
& rMarkList
= pPage
->PreGroup(xShapes
);
850 if ( rMarkList
.GetMarkCount() > 1 )
852 sal_Bool bFlyInCnt
= sal_False
;
853 for ( sal_uInt16 i
= 0; !bFlyInCnt
&& i
< rMarkList
.GetMarkCount(); ++i
)
855 const SdrObject
*pObj
= rMarkList
.GetMark( i
)->GetMarkedSdrObj();
856 if ( FLY_IN_CNTNT
== ::FindFrmFmt( (SdrObject
*)pObj
)->GetAnchor().GetAnchorId() )
857 bFlyInCnt
= sal_True
;
860 throw uno::RuntimeException();
863 UnoActionContext
aContext(pDoc
);
864 pDoc
->StartUndo( UNDO_START
, NULL
);
866 SwDrawContact
* pContact
= pDoc
->GroupSelection( *pPage
->GetDrawView() );
867 pDoc
->ChgAnchor( pPage
->GetDrawView()->GetMarkedObjectList(), FLY_AT_CNTNT
/*int eAnchorId*/,
868 sal_True
, sal_False
);
870 pPage
->GetDrawView()->UnmarkAll();
873 uno::Reference
< uno::XInterface
> xInt
= pPage
->GetInterface( pContact
->GetMaster() );
874 xRet
= uno::Reference
< drawing::XShapeGroup
>(xInt
, uno::UNO_QUERY
);
876 pDoc
->EndUndo( UNDO_END
, NULL
);
879 pPage
->RemovePageView();
884 /* -----------------17.02.99 10:38-------------------
886 * --------------------------------------------------*/
887 void SwXDrawPage::ungroup(const uno::Reference
< drawing::XShapeGroup
> & xShapeGroup
) throw( uno::RuntimeException
)
889 vos::OGuard
aGuard(Application::GetSolarMutex());
891 throw uno::RuntimeException();
894 SwFmDrawPage
* pPage
= GetSvxPage();
895 if(pPage
)//kann das auch Null sein?
897 pPage
->PreUnGroup(xShapeGroup
);
898 UnoActionContext
aContext(pDoc
);
899 pDoc
->StartUndo( UNDO_START
, NULL
);
901 pDoc
->UnGroupSelection( *pPage
->GetDrawView() );
902 pDoc
->ChgAnchor( pPage
->GetDrawView()->GetMarkedObjectList(), FLY_AT_CNTNT
/*int eAnchorId*/,
903 sal_True
, sal_False
);
904 pDoc
->EndUndo( UNDO_END
, NULL
);
906 pPage
->RemovePageView();
909 /* -----------------05.05.98 17:05-------------------
911 * --------------------------------------------------*/
912 SwFmDrawPage
* SwXDrawPage::GetSvxPage()
914 if(!xPageAgg
.is() && pDoc
)
916 vos::OGuard
aGuard(Application::GetSolarMutex());
917 // --> OD 2005-08-08 #i52858# - method name changed
918 SdrModel
* pModel
= pDoc
->GetOrCreateDrawModel();
920 SdrPage
* pPage
= pModel
->GetPage( 0 );
923 // waehrend des queryInterface braucht man ein Ref auf das
924 // Objekt, sonst wird es geloescht.
925 pDrawPage
= new SwFmDrawPage(pPage
);
926 uno::Reference
< drawing::XDrawPage
> xPage
= pDrawPage
;
927 uno::Any aAgg
= xPage
->queryInterface(::getCppuType((uno::Reference
< uno::XAggregation
>*)0));
928 if(aAgg
.getValueType() == ::getCppuType((uno::Reference
< uno::XAggregation
>*)0))
929 xPageAgg
= *(uno::Reference
< uno::XAggregation
>*)aAgg
.getValue();
932 xPageAgg
->setDelegator( (cppu::OWeakObject
*)this );
937 // renamed and outlined to detect where it's called
938 void SwXDrawPage::InvalidateSwDoc()
943 /****************************************************************************
945 ****************************************************************************/
946 TYPEINIT1(SwXShape
, SwClient
);
947 /* -----------------------------10.03.00 18:02--------------------------------
949 ---------------------------------------------------------------------------*/
950 const uno::Sequence
< sal_Int8
> & SwXShape::getUnoTunnelId()
952 static uno::Sequence
< sal_Int8
> aSeq
= ::CreateUnoTunnelId();
955 /* -----------------------------10.03.00 18:04--------------------------------
957 ---------------------------------------------------------------------------*/
958 sal_Int64 SAL_CALL
SwXShape::getSomething( const uno::Sequence
< sal_Int8
>& rId
)
959 throw(uno::RuntimeException
)
961 if( rId
.getLength() == 16
962 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
963 rId
.getConstArray(), 16 ) )
965 return sal::static_int_cast
< sal_Int64
>( reinterpret_cast< sal_IntPtr
>(this) );
970 const uno::Type
& rTunnelType
= ::getCppuType((uno::Reference
<lang::XUnoTunnel
>*)0 );
971 uno::Any aAgg
= xShapeAgg
->queryAggregation( rTunnelType
);
972 if(aAgg
.getValueType() == rTunnelType
)
974 uno::Reference
<lang::XUnoTunnel
> xAggTunnel
=
975 *(uno::Reference
<lang::XUnoTunnel
>*)aAgg
.getValue();
977 return xAggTunnel
->getSomething(rId
);
984 static void lcl_addShapePropertyEventFactories( SdrObject
& _rObj
, SwXShape
& _rShape
)
986 ::svx::PPropertyValueProvider
pProvider( new ::svx::PropertyValueProvider( _rShape
, "AnchorType" ) );
987 _rObj
.getShapePropertyChangeNotifier().registerProvider( ::svx::eTextShapeAnchorType
, pProvider
);
991 /* -----------------01.02.99 11:38-------------------
993 * --------------------------------------------------*/
994 SwXShape::SwXShape(uno::Reference
< uno::XInterface
> & xShape
) :
995 m_pPropSet(aSwMapProvider
.GetPropertySet(PROPERTY_MAP_TEXT_SHAPE
)),
996 m_pPropertyMapEntries(aSwMapProvider
.GetPropertyMapEntries(PROPERTY_MAP_TEXT_SHAPE
)),
997 pImplementationId(0),
998 pImpl(new SwShapeDescriptor_Impl()),
999 m_bDescriptor(sal_True
)
1001 if(xShape
.is()) // default Ctor
1003 const uno::Type
& rAggType
= ::getCppuType((const uno::Reference
< uno::XAggregation
>*)0);
1004 //aAgg contains a reference of the SvxShape!
1006 uno::Any aAgg
= xShape
->queryInterface(rAggType
);
1007 if(aAgg
.getValueType() == rAggType
)
1008 xShapeAgg
= *(uno::Reference
< uno::XAggregation
>*)aAgg
.getValue();
1009 // --> OD 2004-07-23 #i31698#
1010 if ( xShapeAgg
.is() )
1012 xShapeAgg
->queryAggregation( ::getCppuType((uno::Reference
< drawing::XShape
>*)0) ) >>= mxShape
;
1013 ASSERT( mxShape
.is(),
1014 "<SwXShape::SwXShape(..)> - no XShape found at <xShapeAgg>" );
1020 if( xShapeAgg
.is() )
1021 xShapeAgg
->setDelegator( (cppu::OWeakObject
*)this );
1024 uno::Reference
< lang::XUnoTunnel
> xShapeTunnel(xShapeAgg
, uno::UNO_QUERY
);
1025 SvxShape
* pShape
= 0;
1026 if(xShapeTunnel
.is())
1027 pShape
= reinterpret_cast< SvxShape
* >(
1028 sal::static_int_cast
< sal_IntPtr
>( xShapeTunnel
->getSomething(SvxShape::getUnoTunnelId()) ));
1030 SdrObject
* pObj
= pShape
? pShape
->GetSdrObject() : 0;
1033 SwFrmFmt
* pFmt
= ::FindFrmFmt( pObj
);
1037 lcl_addShapePropertyEventFactories( *pObj
, *this );
1038 pImpl
->bInitializedPropertyNotifier
= true;
1043 /*-- 09.04.09 15:06:13---------------------------------------------------
1045 -----------------------------------------------------------------------*/
1046 void SwXShape::AddExistingShapeToFmt( SdrObject
& _rObj
)
1048 SwXShape
* pSwShape
= NULL
;
1049 uno::Reference
< lang::XUnoTunnel
> xShapeTunnel( _rObj
.getWeakUnoShape(), uno::UNO_QUERY
);
1050 if ( xShapeTunnel
.is() )
1051 pSwShape
= reinterpret_cast< SwXShape
* >(
1052 sal::static_int_cast
< sal_IntPtr
>( xShapeTunnel
->getSomething( SwXShape::getUnoTunnelId() ) ) );
1055 if ( pSwShape
->m_bDescriptor
)
1057 SwFrmFmt
* pFmt
= ::FindFrmFmt( &const_cast< SdrObject
& >( _rObj
) );
1059 pFmt
->Add( pSwShape
);
1060 pSwShape
->m_bDescriptor
= sal_False
;
1063 if ( !pSwShape
->pImpl
->bInitializedPropertyNotifier
)
1065 lcl_addShapePropertyEventFactories( _rObj
, *pSwShape
);
1066 pSwShape
->pImpl
->bInitializedPropertyNotifier
= true;
1071 /*-- 22.01.99 11:42:26---------------------------------------------------
1073 -----------------------------------------------------------------------*/
1074 SwXShape::~SwXShape()
1078 uno::Reference
< uno::XInterface
> xRef
;
1079 xShapeAgg
->setDelegator(xRef
);
1083 /* -----------------------------16.06.00 12:21--------------------------------
1085 ---------------------------------------------------------------------------*/
1086 uno::Any
SwXShape::queryInterface( const uno::Type
& aType
) throw( uno::RuntimeException
)
1088 uno::Any aRet
= SwXShapeBaseClass::queryInterface(aType
);
1089 // --> OD 2005-08-15 #i53320# - follow-up of #i31698#
1090 // interface drawing::XShape is overloaded. Thus, provide
1091 // correct object instance.
1092 if(!aRet
.hasValue() && xShapeAgg
.is())
1094 if(aType
== ::getCppuType((uno::Reference
<XShape
>*)0))
1095 aRet
<<= uno::Reference
<XShape
>(this);
1097 aRet
= xShapeAgg
->queryAggregation(aType
);
1102 /* -----------------------------16.06.00 12:21--------------------------------
1104 ---------------------------------------------------------------------------*/
1105 uno::Sequence
< uno::Type
> SwXShape::getTypes( ) throw(uno::RuntimeException
)
1107 uno::Sequence
< uno::Type
> aRet
= SwXShapeBaseClass::getTypes();
1110 uno::Any aProv
= xShapeAgg
->queryAggregation(::getCppuType((uno::Reference
< XTypeProvider
>*)0));
1111 if(aProv
.hasValue())
1113 uno::Reference
< XTypeProvider
> xAggProv
;
1115 uno::Sequence
< uno::Type
> aAggTypes
= xAggProv
->getTypes();
1116 const uno::Type
* pAggTypes
= aAggTypes
.getConstArray();
1117 long nIndex
= aRet
.getLength();
1119 aRet
.realloc(nIndex
+ aAggTypes
.getLength());
1120 uno::Type
* pBaseTypes
= aRet
.getArray();
1122 for(long i
= 0; i
< aAggTypes
.getLength(); i
++)
1123 pBaseTypes
[nIndex
++] = pAggTypes
[i
];
1128 /* -----------------------------04.04.01 07:37--------------------------------
1130 ---------------------------------------------------------------------------*/
1131 uno::Sequence
< sal_Int8
> SwXShape::getImplementationId( ) throw(uno::RuntimeException
)
1133 vos::OGuard
aGuard( Application::GetSolarMutex() );
1134 // do we need to compute the implementation id for this instance?
1135 if( !pImplementationId
&& xShapeAgg
.is())
1137 uno::Reference
< XShape
> xAggShape
;
1138 xShapeAgg
->queryAggregation( ::getCppuType((uno::Reference
< XShape
>*)0) ) >>= xAggShape
;
1140 if( xAggShape
.is() )
1142 const rtl::OUString
aShapeType( xAggShape
->getShapeType() );
1143 // did we already compute an implementation id for the agregated shape type?
1144 SwShapeImplementationIdMap::iterator
aIter( aImplementationIdMap
.find(aShapeType
) );
1145 if( aIter
== aImplementationIdMap
.end() )
1147 // we need to create a new implementation id for this
1148 // note: this memory is not free'd until application exists
1149 // but since we have a fixed set of shapetypes and the
1150 // memory will be reused this is ok.
1151 pImplementationId
= new uno::Sequence
< sal_Int8
>( 16 );
1152 rtl_createUuid( (sal_uInt8
*) pImplementationId
->getArray(), 0, sal_True
);
1153 aImplementationIdMap
[ aShapeType
] = pImplementationId
;
1157 // use the already computed implementation id
1158 pImplementationId
= (*aIter
).second
;
1162 if( NULL
== pImplementationId
)
1164 DBG_ERROR( "Could not create an implementation id for a SwXShape!" );
1165 return uno::Sequence
< sal_Int8
> ();
1169 return *pImplementationId
;
1172 /*-- 22.01.99 11:42:26---------------------------------------------------
1174 -----------------------------------------------------------------------*/
1175 uno::Reference
< beans::XPropertySetInfo
> SwXShape::getPropertySetInfo(void) throw( uno::RuntimeException
)
1177 vos::OGuard
aGuard(Application::GetSolarMutex());
1178 uno::Reference
< beans::XPropertySetInfo
> aRet
;
1181 const uno::Type
& rPropSetType
= ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
1182 uno::Any aPSet
= xShapeAgg
->queryAggregation( rPropSetType
);
1183 if(aPSet
.getValueType() == rPropSetType
&& aPSet
.getValue())
1185 uno::Reference
< beans::XPropertySet
> xPrSet
=
1186 *(uno::Reference
< beans::XPropertySet
>*)aPSet
.getValue();
1187 uno::Reference
< beans::XPropertySetInfo
> xInfo
= xPrSet
->getPropertySetInfo();
1188 // PropertySetInfo verlaengern!
1189 const uno::Sequence
<beans::Property
> aPropSeq
= xInfo
->getProperties();
1190 aRet
= new SfxExtItemPropertySetInfo( m_pPropertyMapEntries
, aPropSeq
);
1194 aRet
= m_pPropSet
->getPropertySetInfo();
1197 /*-- 22.01.99 11:42:27---------------------------------------------------
1199 -----------------------------------------------------------------------*/
1200 void SwXShape::setPropertyValue(const rtl::OUString
& rPropertyName
, const uno::Any
& aValue
)
1201 throw( beans::UnknownPropertyException
, beans::PropertyVetoException
,
1202 lang::IllegalArgumentException
, lang::WrappedTargetException
,
1203 uno::RuntimeException
)
1205 vos::OGuard
aGuard(Application::GetSolarMutex());
1206 SwFrmFmt
* pFmt
= GetFrmFmt();
1207 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName( rPropertyName
);
1212 if ( pEntry
->nFlags
& beans::PropertyAttribute::READONLY
)
1213 throw beans::PropertyVetoException ( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
1214 //mit Layout kann der Anker umgesetzt werden, ohne dass sich die Position aendert
1217 SwAttrSet
aSet(pFmt
->GetAttrSet());
1218 SwDoc
* pDoc
= pFmt
->GetDoc();
1219 if(RES_ANCHOR
== pEntry
->nWID
&& MID_ANCHOR_ANCHORFRAME
== pEntry
->nMemberId
)
1221 sal_Bool bDone
= sal_True
;
1222 uno::Reference
<text::XTextFrame
> xFrame
;
1223 if(aValue
>>= xFrame
)
1225 uno::Reference
<lang::XUnoTunnel
> xTunnel(xFrame
, uno::UNO_QUERY
);
1226 SwXFrame
* pFrame
= xTunnel
.is() ?
1227 reinterpret_cast< SwXFrame
* >(
1228 sal::static_int_cast
< sal_IntPtr
>( xTunnel
->getSomething(SwXFrame::getUnoTunnelId()) ))
1230 if(pFrame
&& pFrame
->GetFrmFmt() &&
1231 pFrame
->GetFrmFmt()->GetDoc() == pDoc
)
1233 UnoActionContext
aCtx(pDoc
);
1234 SfxItemSet
aItemSet( pDoc
->GetAttrPool(),
1235 RES_FRMATR_BEGIN
, RES_FRMATR_END
- 1 );
1236 aItemSet
.SetParent(&pFmt
->GetAttrSet());
1237 SwFmtAnchor aAnchor
= (const SwFmtAnchor
&)aItemSet
.Get(pEntry
->nWID
);
1238 SwPosition
aPos(*pFrame
->GetFrmFmt()->GetCntnt().GetCntntIdx());
1239 aAnchor
.SetAnchor(&aPos
);
1240 aAnchor
.SetType(FLY_AT_FLY
);
1241 aItemSet
.Put(aAnchor
);
1242 pFmt
->SetFmtAttr(aItemSet
);
1247 throw lang::IllegalArgumentException();
1249 else if(RES_OPAQUE
== pEntry
->nWID
)
1251 SvxShape
* pSvxShape
= GetSvxShape();
1252 DBG_ASSERT(pSvxShape
, "No SvxShape found!");
1255 SdrObject
* pObj
= pSvxShape
->GetSdrObject();
1256 // OD 25.06.2003 #108784# - set layer of new drawing
1257 // object to corresponding invisible layer.
1258 bool bIsVisible
= pDoc
->IsVisibleLayerId( pObj
->GetLayer() );
1259 if(FmFormInventor
!= pObj
->GetObjInventor())
1261 pObj
->SetLayer( *(sal_Bool
*)aValue
.getValue()
1262 ? ( bIsVisible
? pDoc
->GetHeavenId() : pDoc
->GetInvisibleHeavenId() )
1263 : ( bIsVisible
? pDoc
->GetHellId() : pDoc
->GetInvisibleHellId() ));
1267 pObj
->SetLayer( bIsVisible
? pDoc
->GetControlsId() : pDoc
->GetInvisibleControlsId());
1273 // OD 2004-04-22 #i26791# - special handling for property FN_TEXT_RANGE
1274 else if ( FN_TEXT_RANGE
== pEntry
->nWID
)
1276 SwFmtAnchor
aAnchor( static_cast<const SwFmtAnchor
&>(aSet
.Get( RES_ANCHOR
)) );
1277 if ( aAnchor
.GetAnchorId() == FLY_PAGE
)
1279 // set property <TextRange> not valid for to-page anchored shapes
1280 throw lang::IllegalArgumentException();
1284 SwUnoInternalPaM
* pInternalPam
=
1285 new SwUnoInternalPaM( *(pFmt
->GetDoc()) );
1286 uno::Reference
< text::XTextRange
> xRg
;
1288 if ( SwXTextRange::XTextRangeToSwPaM(*pInternalPam
, xRg
) )
1290 if(aAnchor
.GetAnchorId() == FLY_IN_CNTNT
)
1292 //delete old SwFmtFlyCnt
1293 //With AnchorAsCharacter the current TxtAttribute has to be deleted.
1294 //Tbis removes the frame format too.
1295 //To prevent this the connection between format and attribute has to be broken before.
1296 const SwPosition
*pPos
= aAnchor
.GetCntntAnchor();
1297 SwTxtNode
*pTxtNode
= pPos
->nNode
.GetNode().GetTxtNode();
1298 ASSERT( pTxtNode
->HasHints(), "Missing FlyInCnt-Hint." );
1299 const xub_StrLen nIdx
= pPos
->nContent
.GetIndex();
1300 SwTxtAttr
* const pHnt
=
1301 pTxtNode
->GetTxtAttrForCharAt(
1302 nIdx
, RES_TXTATR_FLYCNT
);
1303 DBG_ASSERT( pHnt
&& pHnt
->Which() == RES_TXTATR_FLYCNT
,
1304 "Missing FlyInCnt-Hint." );
1305 DBG_ASSERT( pHnt
&& pHnt
->GetFlyCnt().GetFrmFmt() == pFmt
,
1306 "Wrong TxtFlyCnt-Hint." );
1307 const_cast<SwFmtFlyCnt
&>(pHnt
->GetFlyCnt())
1310 //The connection is removed now the attribute can be deleted.
1311 pTxtNode
->DeleteAttributes(
1312 RES_TXTATR_FLYCNT
, nIdx
);
1314 SwTxtNode
*pNd
= pInternalPam
->GetNode()->GetTxtNode();
1315 DBG_ASSERT( pNd
, "Cursor not at TxtNode." );
1316 SwFmtFlyCnt
aFmt( pFmt
);
1317 pNd
->InsertItem(aFmt
, pInternalPam
->GetPoint()
1318 ->nContent
.GetIndex(), 0 );
1322 aAnchor
.SetAnchor( pInternalPam
->GetPoint() );
1324 pFmt
->SetFmtAttr(aSet
);
1329 throw uno::RuntimeException();
1331 delete pInternalPam
;
1334 // --> OD 2004-08-06 #i28749#
1335 else if ( FN_SHAPE_POSITION_LAYOUT_DIR
== pEntry
->nWID
)
1337 sal_Int16 nPositionLayoutDir
= 0;
1338 aValue
>>= nPositionLayoutDir
;
1339 pFmt
->SetPositionLayoutDir( nPositionLayoutDir
);
1342 else if( pDoc
->GetRootFrm() )
1344 UnoActionContext
aCtx(pDoc
);
1345 if(RES_ANCHOR
== pEntry
->nWID
&& MID_ANCHOR_ANCHORTYPE
== pEntry
->nMemberId
)
1347 SdrObject
* pObj
= pFmt
->FindSdrObject();
1349 SdrMark
aMark(pObj
);
1350 aList
.InsertEntry(aMark
);
1351 sal_Int32 nAnchor
= 0;
1352 cppu::enum2int( nAnchor
, aValue
);
1353 pDoc
->ChgAnchor( aList
, (RndStdIds
)nAnchor
,
1354 sal_False
, sal_True
);
1358 m_pPropSet
->setPropertyValue(*pEntry
, aValue
, aSet
);
1359 pFmt
->SetFmtAttr(aSet
);
1364 m_pPropSet
->setPropertyValue( *pEntry
, aValue
, aSet
);
1366 if(RES_ANCHOR
== pEntry
->nWID
&& MID_ANCHOR_ANCHORTYPE
== pEntry
->nMemberId
)
1368 bool bSetAttr
= true;
1369 sal_Int32 eNewAnchor
= SWUnoHelper::GetEnumAsInt32( aValue
);
1371 //if old anchor was in_cntnt the related text attribute has to be removed
1372 const SwFmtAnchor
& rOldAnchor
= pFmt
->GetAnchor();
1373 RndStdIds eOldAnchorId
= rOldAnchor
.GetAnchorId();
1374 SdrObject
* pObj
= pFmt
->FindSdrObject();
1375 SwFrmFmt
*pFlyFmt
= FindFrmFmt( pObj
);
1377 if( text::TextContentAnchorType_AS_CHARACTER
!= eNewAnchor
&&
1378 FLY_IN_CNTNT
== eOldAnchorId
)
1380 //With AnchorAsCharacter the current TxtAttribute has to be deleted.
1381 //Tbis removes the frame format too.
1382 //To prevent this the connection between format and attribute has to be broken before.
1383 const SwPosition
*pPos
= rOldAnchor
.GetCntntAnchor();
1384 SwTxtNode
*pTxtNode
= pPos
->nNode
.GetNode().GetTxtNode();
1385 ASSERT( pTxtNode
->HasHints(), "Missing FlyInCnt-Hint." );
1386 const xub_StrLen nIdx
= pPos
->nContent
.GetIndex();
1387 SwTxtAttr
* const pHnt
=
1388 pTxtNode
->GetTxtAttrForCharAt(
1389 nIdx
, RES_TXTATR_FLYCNT
);
1390 DBG_ASSERT( pHnt
&& pHnt
->Which() == RES_TXTATR_FLYCNT
,
1391 "Missing FlyInCnt-Hint." );
1392 DBG_ASSERT( pHnt
&& pHnt
->GetFlyCnt().GetFrmFmt() == pFlyFmt
,
1393 "Wrong TxtFlyCnt-Hint." );
1394 const_cast<SwFmtFlyCnt
&>(pHnt
->GetFlyCnt())
1397 //The connection is removed now the attribute can be deleted.
1398 pTxtNode
->DeleteAttributes(RES_TXTATR_FLYCNT
, nIdx
);
1400 else if( text::TextContentAnchorType_AT_PAGE
!= eNewAnchor
&&
1401 FLY_PAGE
== eOldAnchorId
)
1403 SwFmtAnchor
aNewAnchor( dynamic_cast< const SwFmtAnchor
& >( aSet
.Get( RES_ANCHOR
) ) );
1404 //if the fly has been anchored at page then it needs to be connected
1405 //to the content position
1406 SwPaM
aPam(pDoc
->GetNodes().GetEndOfContent());
1407 if( pDoc
->GetRootFrm() )
1409 SwCrsrMoveState
aState( MV_SETONLYTEXT
);
1410 Point
aTmp( pObj
->GetSnapRect().TopLeft() );
1411 pDoc
->GetRootFrm()->GetCrsrOfst( aPam
.GetPoint(), aTmp
, &aState
);
1415 //without access to the layout the last node of the body will be used as anchor position
1416 aPam
.Move( fnMoveBackward
, fnGoDoc
);
1418 //anchor position has to be inserted after the text attribute has been inserted
1419 aNewAnchor
.SetAnchor( aPam
.GetPoint() );
1420 aSet
.Put( aNewAnchor
);
1421 pFmt
->SetFmtAttr(aSet
);
1423 if( text::TextContentAnchorType_AS_CHARACTER
== eNewAnchor
&&
1424 FLY_IN_CNTNT
!= eOldAnchorId
)
1426 //the RES_TXTATR_FLYCNT needs to be added now
1427 SwTxtNode
*pNd
= aPam
.GetNode()->GetTxtNode();
1428 DBG_ASSERT( pNd
, "Crsr is not in a TxtNode." );
1429 SwFmtFlyCnt
aFmt( pFlyFmt
);
1430 pNd
->InsertItem(aFmt
,
1431 aPam
.GetPoint()->nContent
.GetIndex(), 0 );
1432 //aPam.GetPoint()->nContent--;
1437 pFmt
->SetFmtAttr(aSet
);
1440 pFmt
->SetFmtAttr(aSet
);
1445 SfxPoolItem
* pItem
= 0;
1446 switch(pEntry
->nWID
)
1449 pItem
= pImpl
->GetAnchor(sal_True
);
1451 case RES_HORI_ORIENT
:
1452 pItem
= pImpl
->GetHOrient(sal_True
);
1454 case RES_VERT_ORIENT
:
1455 pItem
= pImpl
->GetVOrient(sal_True
);
1458 pItem
= pImpl
->GetLRSpace(sal_True
);
1461 pItem
= pImpl
->GetULSpace(sal_True
);
1464 pItem
= pImpl
->GetSurround(sal_True
);
1468 const uno::Type rTextRangeType
=
1469 ::getCppuType((uno::Reference
< text::XTextRange
>*)0);
1470 if(aValue
.getValueType() == rTextRangeType
)
1472 uno::Reference
< text::XTextRange
> & rRange
= pImpl
->GetTextRange();
1473 rRange
= *(uno::Reference
< text::XTextRange
> *)aValue
.getValue();
1478 pImpl
->SetOpaque(*(sal_Bool
*)aValue
.getValue());
1480 // OD 2004-04-22 #i26791#
1481 case RES_FOLLOW_TEXT_FLOW
:
1483 pItem
= pImpl
->GetFollowTextFlow( sal_True
);
1486 // OD 2004-05-05 #i28701#
1487 case RES_WRAP_INFLUENCE_ON_OBJPOS
:
1489 pItem
= pImpl
->GetWrapInfluenceOnObjPos( sal_True
);
1492 // --> OD 2004-08-06 #i28749#
1493 case FN_SHAPE_POSITION_LAYOUT_DIR
:
1495 sal_Int16 nPositionLayoutDir
= 0;
1496 aValue
>>= nPositionLayoutDir
;
1497 pImpl
->SetPositionLayoutDir( nPositionLayoutDir
);
1503 ((SfxPoolItem
*)pItem
)->PutValue(aValue
, pEntry
->nMemberId
);
1508 uno::Reference
< beans::XPropertySet
> xPrSet
;
1509 const uno::Type
& rPSetType
=
1510 ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
1511 uno::Any aPSet
= xShapeAgg
->queryAggregation(rPSetType
);
1512 if(aPSet
.getValueType() != rPSetType
|| !aPSet
.getValue())
1513 throw uno::RuntimeException();
1514 xPrSet
= *(uno::Reference
< beans::XPropertySet
>*)aPSet
.getValue();
1515 // --> OD 2004-08-05 #i31698# - setting the caption point of a
1516 // caption object doesn't have to change the object position.
1517 // Thus, keep the position, before the caption point is set and
1518 // restore it afterwards.
1519 awt::Point
aKeepedPosition( 0, 0 );
1520 if ( rPropertyName
.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CaptionPoint"))) &&
1521 getShapeType().equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CaptionShape"))) )
1523 aKeepedPosition
= getPosition();
1526 if( pFmt
&& pFmt
->GetDoc()->GetRootFrm() )
1528 UnoActionContext
aCtx(pFmt
->GetDoc());
1529 xPrSet
->setPropertyValue(rPropertyName
, aValue
);
1532 xPrSet
->setPropertyValue(rPropertyName
, aValue
);
1533 // --> OD 2004-11-11 #i35007# - adjustment of the position
1534 // attributes, if the transformation is set, causes wrong alignments
1535 // and is no longer needed.
1536 // The position attributes are set, if the drawing object is added
1537 // to the draw page - see <SwXDrawPage::add(..)> - and on its first
1538 // positioning - see <SwAnchoredDrawObject::MakeObjPos().
1539 // // --> OD 2004-07-28 #i31698# - additionally adjust the position
1540 // // properties of the shape, if the transformation is set and
1541 // // the shape isn't a group member.
1542 // if ( rPropertyName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation"))) &&
1543 // !_GetTopGroupObj() )
1545 // drawing::HomogenMatrix3 aMatrix;
1546 // aValue >>= aMatrix;
1547 // awt::Point aNewPos( basegfx::fround( aMatrix.Line1.Column3 ),
1548 // basegfx::fround( aMatrix.Line2.Column3 ) );
1549 // _AdjustPositionProperties( aNewPos );
1551 // --> OD 2004-08-05 #i31698# - restore object position, if caption
1553 if ( rPropertyName
.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CaptionPoint"))) &&
1554 getShapeType().equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CaptionShape"))) )
1556 setPosition( aKeepedPosition
);
1561 /*-- 22.01.99 11:42:27---------------------------------------------------
1563 -----------------------------------------------------------------------*/
1564 uno::Any
SwXShape::getPropertyValue(const rtl::OUString
& rPropertyName
)
1565 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
,
1566 uno::RuntimeException
)
1568 vos::OGuard
aGuard(Application::GetSolarMutex());
1570 SwFrmFmt
* pFmt
= GetFrmFmt();
1573 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName( rPropertyName
);
1578 if(RES_OPAQUE
== pEntry
->nWID
)
1580 SvxShape
* pSvxShape
= GetSvxShape();
1581 DBG_ASSERT(pSvxShape
, "No SvxShape found!");
1584 SdrObject
* pObj
= pSvxShape
->GetSdrObject();
1585 // OD 02.07.2003 #108784# - consider invisible layers
1587 ( pObj
->GetLayer() != pFmt
->GetDoc()->GetHellId() &&
1588 pObj
->GetLayer() != pFmt
->GetDoc()->GetInvisibleHellId() );
1589 aRet
.setValue(&bOpaque
, ::getBooleanCppuType());
1592 else if(FN_ANCHOR_POSITION
== pEntry
->nWID
)
1594 SvxShape
* pSvxShape
= GetSvxShape();
1595 DBG_ASSERT(pSvxShape
, "No SvxShape found!");
1598 SdrObject
* pObj
= pSvxShape
->GetSdrObject();
1599 Point aPt
= pObj
->GetAnchorPos();
1600 awt::Point
aPoint( TWIP_TO_MM100( aPt
.X() ),
1601 TWIP_TO_MM100( aPt
.Y() ) );
1602 aRet
.setValue(&aPoint
, ::getCppuType( (awt::Point
*)0 ));
1605 // OD 2004-04-22 #i26791# - special handling for FN_TEXT_RANGE
1606 else if ( FN_TEXT_RANGE
== pEntry
->nWID
)
1608 const SwFmtAnchor aAnchor
= pFmt
->GetAnchor();
1609 if ( aAnchor
.GetAnchorId() == FLY_PAGE
)
1611 // return nothing, because property <TextRange> isn't
1612 // valid for to-page anchored shapes
1618 if ( aAnchor
.GetCntntAnchor() )
1620 uno::Reference
< text::XTextRange
> xTextRange
=
1621 SwXTextRange::CreateTextRangeFromPosition(
1623 *aAnchor
.GetCntntAnchor(),
1625 aRet
.setValue(&xTextRange
, ::getCppuType((uno::Reference
<text::XTextRange
>*)0));
1635 // --> OD 2004-08-06 #i28749#
1636 else if ( FN_SHAPE_TRANSFORMATION_IN_HORI_L2R
== pEntry
->nWID
)
1638 // get property <::drawing::Shape::Transformation>
1639 // without conversion to layout direction as below
1640 aRet
= _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation")) );
1642 else if ( FN_SHAPE_POSITION_LAYOUT_DIR
== pEntry
->nWID
)
1644 aRet
<<= pFmt
->GetPositionLayoutDir();
1647 // --> OD 2004-10-28 #i36248#
1648 else if ( FN_SHAPE_STARTPOSITION_IN_HORI_L2R
== pEntry
->nWID
)
1650 // get property <::drawing::Shape::StartPosition>
1651 // without conversion to layout direction as below
1652 aRet
= _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")) );
1654 else if ( FN_SHAPE_ENDPOSITION_IN_HORI_L2R
== pEntry
->nWID
)
1656 // get property <::drawing::Shape::EndPosition>
1657 // without conversion to layout direction as below
1658 aRet
= _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")) );
1663 const SwAttrSet
& rSet
= pFmt
->GetAttrSet();
1664 m_pPropSet
->getPropertyValue(*pEntry
, rSet
, aRet
);
1669 SfxPoolItem
* pItem
= 0;
1670 switch(pEntry
->nWID
)
1673 pItem
= pImpl
->GetAnchor();
1675 case RES_HORI_ORIENT
:
1676 pItem
= pImpl
->GetHOrient();
1678 case RES_VERT_ORIENT
:
1679 pItem
= pImpl
->GetVOrient();
1682 pItem
= pImpl
->GetLRSpace();
1685 pItem
= pImpl
->GetULSpace();
1688 pItem
= pImpl
->GetSurround();
1690 case FN_TEXT_RANGE
:
1691 aRet
.setValue(&pImpl
->GetTextRange(), ::getCppuType((uno::Reference
<text::XTextRange
>*)0));
1694 aRet
.setValue(&pImpl
->GetOpaque(), ::getBooleanCppuType());
1696 case FN_ANCHOR_POSITION
:
1699 aRet
.setValue(&aPoint
, ::getCppuType( (awt::Point
*)0 ));
1702 // OD 2004-04-22 #i26791#
1703 case RES_FOLLOW_TEXT_FLOW
:
1705 pItem
= pImpl
->GetFollowTextFlow();
1708 // OD 2004-05-05 #i28701#
1709 case RES_WRAP_INFLUENCE_ON_OBJPOS
:
1711 pItem
= pImpl
->GetWrapInfluenceOnObjPos();
1714 // --> OD 2004-08-06 #i28749#
1715 case FN_SHAPE_TRANSFORMATION_IN_HORI_L2R
:
1717 // get property <::drawing::Shape::Transformation>
1718 // without conversion to layout direction as below
1719 aRet
= _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation")) );
1722 case FN_SHAPE_POSITION_LAYOUT_DIR
:
1724 aRet
<<= pImpl
->GetPositionLayoutDir();
1728 // --> OD 2004-08-06 #i36248#
1729 case FN_SHAPE_STARTPOSITION_IN_HORI_L2R
:
1731 // get property <::drawing::Shape::StartPosition>
1732 // without conversion to layout direction as below
1733 aRet
= _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")) );
1736 case FN_SHAPE_ENDPOSITION_IN_HORI_L2R
:
1738 // get property <::drawing::Shape::StartPosition>
1739 // without conversion to layout direction as below
1740 aRet
= _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")) );
1746 pItem
->QueryValue(aRet
, pEntry
->nMemberId
);
1751 aRet
= _getPropAtAggrObj( rPropertyName
);
1753 // --> OD 2004-07-28 #i31698# - convert the position (translation)
1754 // of the drawing object in the transformation
1755 if ( rPropertyName
.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation"))) )
1757 drawing::HomogenMatrix3 aMatrix
;
1759 aRet
<<= _ConvertTransformationToLayoutDir( aMatrix
);
1762 // --> OD 2004-10-28 #i36248#
1763 else if ( rPropertyName
.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition"))) )
1765 awt::Point aStartPos
;
1767 // --> OD 2009-01-12 #i59051#
1768 aRet
<<= _ConvertStartOrEndPosToLayoutDir( aStartPos
);
1771 else if ( rPropertyName
.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition"))) )
1775 // --> OD 2009-01-12 #i59051#
1776 aRet
<<= _ConvertStartOrEndPosToLayoutDir( aEndPos
);
1779 // --> OD 2009-01-16 #i59051#
1780 else if ( rPropertyName
.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier"))) )
1782 drawing::PolyPolygonBezierCoords aPath
;
1784 aRet
<<= _ConvertPolyPolygonBezierToLayoutDir( aPath
);
1793 /** method to get property from aggregation object
1795 OD 2004-10-28 #i36248#
1799 uno::Any
SwXShape::_getPropAtAggrObj( const ::rtl::OUString
& _rPropertyName
)
1800 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
,
1801 uno::RuntimeException
)
1805 uno::Reference
< beans::XPropertySet
> xPrSet
;
1806 const uno::Type
& rPSetType
=
1807 ::getCppuType((const uno::Reference
< beans::XPropertySet
>*)0);
1808 uno::Any aPSet
= xShapeAgg
->queryAggregation(rPSetType
);
1809 if ( aPSet
.getValueType() != rPSetType
|| !aPSet
.getValue() )
1811 throw uno::RuntimeException();
1813 xPrSet
= *(uno::Reference
< beans::XPropertySet
>*)aPSet
.getValue();
1814 aRet
= xPrSet
->getPropertyValue( _rPropertyName
);
1820 /* -----------------------------02.11.00 09:41--------------------------------
1822 ---------------------------------------------------------------------------*/
1823 beans::PropertyState
SwXShape::getPropertyState( const rtl::OUString
& rPropertyName
)
1824 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
1826 vos::OGuard
aGuard(Application::GetSolarMutex());
1827 uno::Sequence
< rtl::OUString
> aNames(1);
1828 rtl::OUString
* pStrings
= aNames
.getArray();
1829 pStrings
[0] = rPropertyName
;
1830 uno::Sequence
< beans::PropertyState
> aStates
= getPropertyStates(aNames
);
1831 return aStates
.getConstArray()[0];
1833 /* -----------------------------02.11.00 09:41--------------------------------
1835 ---------------------------------------------------------------------------*/
1836 uno::Sequence
< beans::PropertyState
> SwXShape::getPropertyStates(
1837 const uno::Sequence
< rtl::OUString
>& aPropertyNames
)
1838 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
1840 vos::OGuard
aGuard(Application::GetSolarMutex());
1841 SwFrmFmt
* pFmt
= GetFrmFmt();
1842 uno::Sequence
< beans::PropertyState
> aRet(aPropertyNames
.getLength());
1845 SvxShape
* pSvxShape
= GetSvxShape();
1846 sal_Bool bGroupMember
= sal_False
;
1847 sal_Bool bFormControl
= sal_False
;
1848 SdrObject
* pObject
= pSvxShape
->GetSdrObject();
1851 bGroupMember
= pObject
->GetUpGroup() != 0;
1852 bFormControl
= pObject
->GetObjInventor() == FmFormInventor
;
1854 const rtl::OUString
* pNames
= aPropertyNames
.getConstArray();
1855 beans::PropertyState
* pRet
= aRet
.getArray();
1856 uno::Reference
< XPropertyState
> xShapePrState
;
1857 for(sal_Int32 nProperty
= 0; nProperty
< aPropertyNames
.getLength(); nProperty
++)
1859 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName( pNames
[nProperty
] );
1862 if(RES_OPAQUE
== pEntry
->nWID
)
1863 pRet
[nProperty
] = bFormControl
?
1864 beans::PropertyState_DEFAULT_VALUE
: beans::PropertyState_DIRECT_VALUE
;
1865 else if(FN_ANCHOR_POSITION
== pEntry
->nWID
)
1866 pRet
[nProperty
] = beans::PropertyState_DIRECT_VALUE
;
1867 else if(FN_TEXT_RANGE
== pEntry
->nWID
)
1868 pRet
[nProperty
] = beans::PropertyState_DIRECT_VALUE
;
1869 else if(bGroupMember
)
1870 pRet
[nProperty
] = beans::PropertyState_DEFAULT_VALUE
;
1873 const SwAttrSet
& rSet
= pFmt
->GetAttrSet();
1874 SfxItemState eItemState
= rSet
.GetItemState(pEntry
->nWID
, FALSE
);
1876 if(SFX_ITEM_SET
== eItemState
)
1877 pRet
[nProperty
] = beans::PropertyState_DIRECT_VALUE
;
1878 else if(SFX_ITEM_DEFAULT
== eItemState
)
1879 pRet
[nProperty
] = beans::PropertyState_DEFAULT_VALUE
;
1881 pRet
[nProperty
] = beans::PropertyState_AMBIGUOUS_VALUE
;
1885 SfxPoolItem
* pItem
= 0;
1886 switch(pEntry
->nWID
)
1889 pItem
= pImpl
->GetAnchor();
1891 case RES_HORI_ORIENT
:
1892 pItem
= pImpl
->GetHOrient();
1894 case RES_VERT_ORIENT
:
1895 pItem
= pImpl
->GetVOrient();
1898 pItem
= pImpl
->GetLRSpace();
1901 pItem
= pImpl
->GetULSpace();
1904 pItem
= pImpl
->GetSurround();
1906 // OD 2004-05-05 #i28701#
1907 case RES_WRAP_INFLUENCE_ON_OBJPOS
:
1909 pItem
= pImpl
->GetWrapInfluenceOnObjPos();
1914 pRet
[nProperty
] = beans::PropertyState_DIRECT_VALUE
;
1916 pRet
[nProperty
] = beans::PropertyState_DEFAULT_VALUE
;
1921 if(!xShapePrState
.is())
1923 const uno::Type
& rPStateType
= ::getCppuType((uno::Reference
< XPropertyState
>*)0);
1924 uno::Any aPState
= xShapeAgg
->queryAggregation(rPStateType
);
1925 if(aPState
.getValueType() != rPStateType
|| !aPState
.getValue())
1926 throw uno::RuntimeException();
1927 xShapePrState
= *(uno::Reference
< XPropertyState
>*)aPState
.getValue();
1929 pRet
[nProperty
] = xShapePrState
->getPropertyState(pNames
[nProperty
]);
1934 throw uno::RuntimeException();
1937 /* -----------------------------02.11.00 09:41--------------------------------
1939 ---------------------------------------------------------------------------*/
1940 void SwXShape::setPropertyToDefault( const rtl::OUString
& rPropertyName
)
1941 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
1943 vos::OGuard
aGuard(Application::GetSolarMutex());
1944 SwFrmFmt
* pFmt
= GetFrmFmt();
1947 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName( rPropertyName
);
1950 if ( pEntry
->nFlags
& beans::PropertyAttribute::READONLY
)
1951 throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
1954 const SfxItemSet
& rSet
= pFmt
->GetAttrSet();
1955 SfxItemSet
aSet(pFmt
->GetDoc()->GetAttrPool(), pEntry
->nWID
, pEntry
->nWID
);
1956 aSet
.SetParent(&rSet
);
1957 aSet
.ClearItem(pEntry
->nWID
);
1958 pFmt
->GetDoc()->SetAttr(aSet
, *pFmt
);
1962 switch(pEntry
->nWID
)
1964 case RES_ANCHOR
: pImpl
->RemoveAnchor(); break;
1965 case RES_HORI_ORIENT
: pImpl
->RemoveHOrient(); break;
1966 case RES_VERT_ORIENT
: pImpl
->RemoveVOrient(); break;
1967 case RES_LR_SPACE
: pImpl
->RemoveLRSpace(); break;
1968 case RES_UL_SPACE
: pImpl
->RemoveULSpace(); break;
1969 case RES_SURROUND
: pImpl
->RemoveSurround();break;
1970 case RES_OPAQUE
: pImpl
->SetOpaque(sal_False
); break;
1971 case FN_TEXT_RANGE
:
1973 // OD 2004-04-22 #i26791#
1974 case RES_FOLLOW_TEXT_FLOW
:
1976 pImpl
->RemoveFollowTextFlow();
1979 // OD 2004-05-05 #i28701#
1980 case RES_WRAP_INFLUENCE_ON_OBJPOS
:
1982 pImpl
->RemoveWrapInfluenceOnObjPos();
1990 const uno::Type
& rPStateType
= ::getCppuType((uno::Reference
< XPropertyState
>*)0);
1991 uno::Any aPState
= xShapeAgg
->queryAggregation(rPStateType
);
1992 if(aPState
.getValueType() != rPStateType
|| !aPState
.getValue())
1993 throw uno::RuntimeException();
1994 uno::Reference
< XPropertyState
> xShapePrState
= *(uno::Reference
< XPropertyState
>*)aPState
.getValue();
1995 xShapePrState
->setPropertyToDefault( rPropertyName
);
1999 throw uno::RuntimeException();
2001 /* -----------------------------02.11.00 09:41--------------------------------
2003 ---------------------------------------------------------------------------*/
2004 uno::Any
SwXShape::getPropertyDefault( const rtl::OUString
& rPropertyName
)
2005 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
,
2006 uno::RuntimeException
)
2008 vos::OGuard
aGuard(Application::GetSolarMutex());
2009 SwFrmFmt
* pFmt
= GetFrmFmt();
2013 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName( rPropertyName
);
2016 if(pEntry
->nWID
< RES_FRMATR_END
&& pFmt
)
2018 const SfxPoolItem
& rDefItem
=
2019 pFmt
->GetDoc()->GetAttrPool().GetDefaultItem(pEntry
->nWID
);
2020 rDefItem
.QueryValue(aRet
, pEntry
->nMemberId
);
2023 throw uno::RuntimeException();
2027 const uno::Type
& rPStateType
= ::getCppuType((uno::Reference
< XPropertyState
>*)0);
2028 uno::Any aPState
= xShapeAgg
->queryAggregation(rPStateType
);
2029 if(aPState
.getValueType() != rPStateType
|| !aPState
.getValue())
2030 throw uno::RuntimeException();
2031 uno::Reference
< XPropertyState
> xShapePrState
= *(uno::Reference
< XPropertyState
>*)aPState
.getValue();
2032 xShapePrState
->getPropertyDefault( rPropertyName
);
2036 throw uno::RuntimeException();
2039 /*-- 22.01.99 11:42:27---------------------------------------------------
2041 -----------------------------------------------------------------------*/
2042 void SwXShape::addPropertyChangeListener(
2043 const rtl::OUString
& _propertyName
,
2044 const uno::Reference
< beans::XPropertyChangeListener
> & _listener
)
2045 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
,
2046 uno::RuntimeException
)
2048 if ( !xShapeAgg
.is() )
2049 throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "no shape aggregate" ) ), *this );
2051 // must be handled by the aggregate
2052 uno::Reference
< beans::XPropertySet
> xShapeProps
;
2053 if ( xShapeAgg
->queryAggregation( beans::XPropertySet::static_type() ) >>= xShapeProps
)
2054 xShapeProps
->addPropertyChangeListener( _propertyName
, _listener
);
2056 /*-- 22.01.99 11:42:27---------------------------------------------------
2058 -----------------------------------------------------------------------*/
2059 void SwXShape::removePropertyChangeListener(
2060 const rtl::OUString
& _propertyName
,
2061 const uno::Reference
< beans::XPropertyChangeListener
> & _listener
)
2062 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
,
2063 uno::RuntimeException
)
2065 if ( !xShapeAgg
.is() )
2066 throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "no shape aggregate" ) ), *this );
2068 // must be handled by the aggregate
2069 uno::Reference
< beans::XPropertySet
> xShapeProps
;
2070 if ( xShapeAgg
->queryAggregation( beans::XPropertySet::static_type() ) >>= xShapeProps
)
2071 xShapeProps
->removePropertyChangeListener( _propertyName
, _listener
);
2073 /*-- 22.01.99 11:42:28---------------------------------------------------
2075 -----------------------------------------------------------------------*/
2076 void SwXShape::addVetoableChangeListener(
2077 const rtl::OUString
& /*PropertyName*/,
2078 const uno::Reference
< beans::XVetoableChangeListener
> & /*aListener*/ )
2079 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
,
2080 uno::RuntimeException
)
2082 DBG_WARNING("not implemented");
2084 /*-- 22.01.99 11:42:28---------------------------------------------------
2086 -----------------------------------------------------------------------*/
2087 void SwXShape::removeVetoableChangeListener(
2088 const rtl::OUString
& /*PropertyName*/,
2089 const uno::Reference
< beans::XVetoableChangeListener
> & /*aListener*/)
2090 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
,
2091 uno::RuntimeException
)
2093 DBG_WARNING("not implemented");
2095 /*-- 22.01.99 11:42:28---------------------------------------------------
2097 -----------------------------------------------------------------------*/
2098 void SwXShape::Modify( SfxPoolItem
*pOld
, SfxPoolItem
*pNew
)
2100 ClientModify(this, pOld
, pNew
);
2102 /* -----------------14.04.99 13:02-------------------
2104 * --------------------------------------------------*/
2105 void SwXShape::attach(const uno::Reference
< text::XTextRange
> & xTextRange
)
2106 throw( lang::IllegalArgumentException
, uno::RuntimeException
)
2108 vos::OGuard
aGuard(Application::GetSolarMutex());
2110 // get access to SwDoc
2111 // (see also SwXTextRange::XTextRangeToSwPaM)
2113 uno::Reference
<lang::XUnoTunnel
> xRangeTunnel( xTextRange
, uno::UNO_QUERY
);
2114 if(xRangeTunnel
.is())
2116 SwXTextRange
* pRange
= 0;
2117 OTextCursorHelper
* pCursor
= 0;
2118 SwXTextPortion
* pPortion
= 0;
2120 SwXParagraph
* pParagraph
= 0;
2122 pRange
= reinterpret_cast< SwXTextRange
* >(
2123 sal::static_int_cast
< sal_IntPtr
>( xRangeTunnel
->getSomething( SwXTextRange::getUnoTunnelId()) ));
2124 pText
= reinterpret_cast< SwXText
* >(
2125 sal::static_int_cast
< sal_IntPtr
>( xRangeTunnel
->getSomething( SwXText::getUnoTunnelId()) ));
2126 pCursor
= reinterpret_cast< OTextCursorHelper
* >(
2127 sal::static_int_cast
< sal_IntPtr
>( xRangeTunnel
->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
2128 pPortion
= reinterpret_cast< SwXTextPortion
* >(
2129 sal::static_int_cast
< sal_IntPtr
>( xRangeTunnel
->getSomething( SwXTextPortion::getUnoTunnelId()) ));
2130 pParagraph
= reinterpret_cast< SwXParagraph
* >(
2131 sal::static_int_cast
< sal_IntPtr
>( xRangeTunnel
->getSomething( SwXParagraph::getUnoTunnelId( ) ) ) );
2134 pDoc
= pRange
->GetDoc();
2135 else if (!pDoc
&& pText
)
2136 pDoc
= pText
->GetDoc();
2137 else if (!pDoc
&& pCursor
)
2138 pDoc
= pCursor
->GetDoc();
2139 else if ( !pDoc
&& pPortion
&& pPortion
->GetCursor() )
2141 pDoc
= pPortion
->GetCursor()->GetDoc();
2143 else if ( !pDoc
&& pParagraph
&& pParagraph
->GetTxtNode( ) )
2144 pDoc
= pParagraph
->GetTxtNode( )->GetDoc( );
2149 throw uno::RuntimeException();
2150 SwDocShell
*pDocSh
= pDoc
->GetDocShell();
2153 uno::Reference
< frame::XModel
> xModel
;
2154 xModel
= pDocSh
->GetModel();
2155 uno::Reference
< drawing::XDrawPageSupplier
> xDPS(xModel
, uno::UNO_QUERY
);
2158 uno::Reference
< drawing::XDrawPage
> xDP( xDPS
->getDrawPage() );
2162 aPos
<<= xTextRange
;
2163 setPropertyValue(S2U("TextRange"), aPos
);
2164 uno::Reference
< drawing::XShape
> xTemp( (cppu::OWeakObject
*) this, uno::UNO_QUERY
);
2170 /* -----------------14.04.99 13:02-------------------
2172 * --------------------------------------------------*/
2173 uno::Reference
< text::XTextRange
> SwXShape::getAnchor(void) throw( uno::RuntimeException
)
2175 vos::OGuard
aGuard(Application::GetSolarMutex());
2176 uno::Reference
< text::XTextRange
> aRef
;
2177 SwFrmFmt
* pFmt
= GetFrmFmt();
2180 const SwFmtAnchor
& rAnchor
= pFmt
->GetAnchor();
2181 // return an anchor for non-page bound frames
2182 // and for page bound frames that have a page no == NULL and a content position
2183 if( rAnchor
.GetAnchorId() != FLY_PAGE
||
2184 (rAnchor
.GetCntntAnchor() && !rAnchor
.GetPageNum()))
2186 const SwPosition
&rPos
= *(pFmt
->GetAnchor().GetCntntAnchor());
2187 aRef
= SwXTextRange::CreateTextRangeFromPosition(pFmt
->GetDoc(), rPos
, 0);
2191 aRef
= pImpl
->GetTextRange();
2194 /* -----------------14.04.99 13:02-------------------
2196 * --------------------------------------------------*/
2197 void SwXShape::dispose(void) throw( uno::RuntimeException
)
2199 vos::OGuard
aGuard(Application::GetSolarMutex());
2200 SwFrmFmt
* pFmt
= GetFrmFmt();
2203 // OD 10.07.2003 #110742# - determine correct <SdrObject>
2204 //SdrObject* pObj = pFmt->FindSdrObject();
2205 SdrObject
* pObj
= GetSvxShape()->GetSdrObject();
2206 // OD 10.07.2003 #110742# - safety assertion:
2207 // <pObj> must be the same as <pFmt->FindSdrObject()>, if <pObj> isn't
2208 // a 'virtual' drawing object.
2209 // OD 25.08.2003 #111713# - refine assertion for safety reason.
2210 // --> OD 2005-02-02 #119236# - correct assertion and refine it.
2212 pObj
->ISA(SwDrawVirtObj
) ||
2213 pObj
->GetUpGroup() ||
2214 pObj
== pFmt
->FindSdrObject(),
2215 "<SwXShape::dispose(..) - different 'master' drawing objects!!" );
2217 // OD 10.07.2003 #110742# - perform delete of draw frame format *not*
2218 // for 'virtual' drawing objects.
2219 // --> OD 2005-02-02 #119236# - no delete of draw format for members
2222 !pObj
->ISA(SwDrawVirtObj
) &&
2223 !pObj
->GetUpGroup() &&
2224 pObj
->IsInserted() )
2227 if( pFmt
->GetAnchor().GetAnchorId() == FLY_IN_CNTNT
)
2229 const SwPosition
&rPos
= *(pFmt
->GetAnchor().GetCntntAnchor());
2230 SwTxtNode
*pTxtNode
= rPos
.nNode
.GetNode().GetTxtNode();
2231 const xub_StrLen nIdx
= rPos
.nContent
.GetIndex();
2232 pTxtNode
->DeleteAttributes( RES_TXTATR_FLYCNT
, nIdx
);
2235 pFmt
->GetDoc()->DelLayoutFmt( pFmt
);
2240 uno::Any
aAgg(xShapeAgg
->queryAggregation( ::getCppuType((uno::Reference
<XComponent
>*)0)));
2241 uno::Reference
<XComponent
> xComp
;
2247 /* -----------------14.04.99 13:02-------------------
2249 * --------------------------------------------------*/
2250 void SwXShape::addEventListener(
2251 const uno::Reference
< lang::XEventListener
> & aListener
)
2252 throw( uno::RuntimeException
)
2254 uno::Reference
< lang::XUnoTunnel
> xShapeTunnel(xShapeAgg
, uno::UNO_QUERY
);
2255 SvxShape
* pSvxShape
= GetSvxShape();
2257 pSvxShape
->addEventListener(aListener
);
2259 /* -----------------14.04.99 13:02-------------------
2261 * --------------------------------------------------*/
2262 void SwXShape::removeEventListener(
2263 const uno::Reference
< lang::XEventListener
> & aListener
)
2264 throw( uno::RuntimeException
)
2266 SvxShape
* pSvxShape
= GetSvxShape();
2268 pSvxShape
->removeEventListener(aListener
);
2270 /* -----------------03.06.99 08:53-------------------
2272 * --------------------------------------------------*/
2273 rtl::OUString
SwXShape::getImplementationName(void) throw( uno::RuntimeException
)
2275 return C2U("SwXShape");
2277 /* -----------------03.06.99 08:53-------------------
2279 * --------------------------------------------------*/
2280 sal_Bool
SwXShape::supportsService(const rtl::OUString
& rServiceName
) throw( uno::RuntimeException
)
2282 sal_Bool bRet
= sal_False
;
2283 if(COMPARE_EQUAL
== rServiceName
.compareToAscii("com.sun.star.drawing.Shape"))
2285 else if(xShapeAgg
.is())
2287 uno::Reference
< lang::XUnoTunnel
> xShapeTunnel(xShapeAgg
, uno::UNO_QUERY
);
2288 SvxShape
* pSvxShape
= GetSvxShape();
2289 bRet
= pSvxShape
->supportsService(rServiceName
);
2293 /* -----------------03.06.99 08:53-------------------
2295 * --------------------------------------------------*/
2296 uno::Sequence
< rtl::OUString
> SwXShape::getSupportedServiceNames(void) throw( uno::RuntimeException
)
2298 uno::Sequence
< rtl::OUString
> aSeq
;
2301 uno::Reference
< lang::XUnoTunnel
> xShapeTunnel(xShapeAgg
, uno::UNO_QUERY
);
2302 SvxShape
* pSvxShape
= GetSvxShape();
2304 aSeq
= pSvxShape
->getSupportedServiceNames();
2309 aSeq
.getArray()[0] = C2U("com.sun.star.drawing.Shape");
2313 /* -----------------------------15.03.00 14:54--------------------------------
2315 ---------------------------------------------------------------------------*/
2316 SvxShape
* SwXShape::GetSvxShape()
2318 SvxShape
* pSvxShape
= 0;
2321 uno::Reference
< lang::XUnoTunnel
> xShapeTunnel(xShapeAgg
, uno::UNO_QUERY
);
2322 if(xShapeTunnel
.is())
2323 pSvxShape
= reinterpret_cast< SvxShape
* >(
2324 sal::static_int_cast
< sal_IntPtr
>( xShapeTunnel
->getSomething(SvxShape::getUnoTunnelId()) ));
2329 // --> OD 2004-07-22 #i31698# -
2330 // implementation of virtual methods from drawing::XShape
2331 awt::Point SAL_CALL
SwXShape::getPosition() throw ( uno::RuntimeException
)
2333 awt::Point
aPos( _GetAttrPosition() );
2335 // handle group members
2336 SvxShape
* pSvxShape
= GetSvxShape();
2339 SdrObject
* pTopGroupObj
= _GetTopGroupObj( pSvxShape
);
2342 // --> OD 2004-10-01 #i34750# - get attribute position of top group
2343 // shape and add offset between top group object and group member
2344 uno::Reference
< drawing::XShape
> xGroupShape
=
2345 uno::Reference
< drawing::XShape
>( pTopGroupObj
->getUnoShape(),
2347 aPos
= xGroupShape
->getPosition();
2348 // add offset between top group object and group member
2349 // to the determined attribute position
2350 // --> OD 2004-10-01 #i34750# - correction:
2351 // consider the layout direction
2352 const Rectangle aMemberObjRect
= GetSvxShape()->GetSdrObject()->GetSnapRect();
2353 const Rectangle aGroupObjRect
= pTopGroupObj
->GetSnapRect();
2354 // --> OD 2005-08-16 #i53320# - relative position of group member and
2355 // top group object is always given in horizontal left-to-right layout.
2356 // const SwFrmFmt::tLayoutDir eLayoutDir = GetFrmFmt()
2357 // ? GetFrmFmt()->GetLayoutDir()
2358 // : SwFrmFmt::HORI_L2R;
2359 awt::Point
aOffset( 0, 0 );
2360 // switch ( eLayoutDir )
2362 // case SwFrmFmt::HORI_L2R:
2364 aOffset
.X
= ( aMemberObjRect
.Left() - aGroupObjRect
.Left() );
2365 aOffset
.Y
= ( aMemberObjRect
.Top() - aGroupObjRect
.Top() );
2368 // case SwFrmFmt::HORI_R2L:
2370 // aOffset.X = ( aGroupObjRect.Right() - aMemberObjRect.Right() );
2371 // aOffset.Y = ( aMemberObjRect.Top() - aGroupObjRect.Top() );
2374 // case SwFrmFmt::VERT_R2L:
2376 // aOffset.X = ( aMemberObjRect.Top() - aGroupObjRect.Top() );
2377 // aOffset.Y = ( aGroupObjRect.Right() - aMemberObjRect.Right() );
2383 // "<SwXShape::getPosition()> - unsupported layout direction" );
2387 aOffset
.X
= TWIP_TO_MM100(aOffset
.X
);
2388 aOffset
.Y
= TWIP_TO_MM100(aOffset
.Y
);
2389 aPos
.X
+= aOffset
.X
;
2390 aPos
.Y
+= aOffset
.Y
;
2397 void SAL_CALL
SwXShape::setPosition( const awt::Point
& aPosition
)
2398 throw ( uno::RuntimeException
)
2400 SdrObject
* pTopGroupObj
= _GetTopGroupObj();
2401 if ( !pTopGroupObj
)
2403 // --> OD 2005-02-10 #i37877# - no adjustment of position attributes,
2404 // if the position also has to be applied at the drawing object and
2405 // a contact object is already registered at the drawing object.
2406 bool bApplyPosAtDrawObj(false);
2407 bool bNoAdjustOfPosProp(false);
2408 // --> OD 2004-10-19 #i35798# - apply position also to drawing object,
2409 // if drawing object has no anchor position set.
2412 SvxShape
* pSvxShape
= GetSvxShape();
2415 const SdrObject
* pObj
= pSvxShape
->GetSdrObject();
2417 pObj
->GetAnchorPos().X() == 0 &&
2418 pObj
->GetAnchorPos().Y() == 0 )
2420 bApplyPosAtDrawObj
= true;
2421 if ( pObj
->GetUserCall() &&
2422 pObj
->GetUserCall()->ISA(SwDrawContact
) )
2424 bNoAdjustOfPosProp
= true;
2430 // shape isn't a group member. Thus, set positioning attributes
2431 if ( !bNoAdjustOfPosProp
)
2433 _AdjustPositionProperties( aPosition
);
2435 if ( bApplyPosAtDrawObj
)
2437 mxShape
->setPosition( aPosition
);
2441 else if ( mxShape
.is() )
2443 // shape is a member of a group. Thus, set its position.
2444 awt::Point
aNewPos( aPosition
);
2445 // The given position is given in the according layout direction. Thus,
2446 // it has to be converted to a position in horizontal left-to-right
2448 // convert given absolute attribute position in layout direction into
2449 // position in horizontal left-to-right layout.
2451 aNewPos
= _ConvertPositionToHoriL2R( aNewPos
, getSize() );
2453 // Convert given absolute position in horizontal left-to-right
2454 // layout into relative position in horizontal left-to-right layout.
2455 uno::Reference
< drawing::XShape
> xGroupShape
=
2456 uno::Reference
< drawing::XShape
>( pTopGroupObj
->getUnoShape(),
2459 // --> OD 2004-09-29 #i34750# - correction:
2460 // use method <xGroupShape->getPosition()> to get the correct
2461 // position of the top group object.
2462 awt::Point
aAttrPosInHoriL2R(
2463 _ConvertPositionToHoriL2R( xGroupShape
->getPosition(),
2464 xGroupShape
->getSize() ) );
2466 aNewPos
.X
-= aAttrPosInHoriL2R
.X
;
2467 aNewPos
.Y
-= aAttrPosInHoriL2R
.Y
;
2469 // convert relative position in horizontal left-to-right layout into
2470 // absolute position in horizontal left-to-right layout
2472 // --> OD 2004-10-01 #i34750# - correction:
2473 // use method <SvxShape->getPosition()> to get the correct
2474 // 'Drawing layer' position of the top group shape.
2475 uno::Reference
< lang::XUnoTunnel
> xGrpShapeTunnel(
2476 pTopGroupObj
->getUnoShape(),
2478 SvxShape
* pSvxGroupShape
= reinterpret_cast< SvxShape
* >(
2479 sal::static_int_cast
< sal_IntPtr
>( xGrpShapeTunnel
->getSomething(SvxShape::getUnoTunnelId()) ));
2480 const awt::Point aGroupPos
= pSvxGroupShape
->getPosition();
2481 aNewPos
.X
+= aGroupPos
.X
;
2482 aNewPos
.Y
+= aGroupPos
.Y
;
2486 mxShape
->setPosition( aNewPos
);
2489 awt::Size SAL_CALL
SwXShape::getSize() throw ( uno::RuntimeException
)
2494 aSize
= mxShape
->getSize();
2498 void SAL_CALL
SwXShape::setSize( const awt::Size
& aSize
)
2499 throw ( beans::PropertyVetoException
,
2500 uno::RuntimeException
)
2504 mxShape
->setSize( aSize
);
2508 // --> OD 2004-07-22 #i31698# -
2509 // implementation of virtual methods from drawing::XShapeDescriptor
2510 ::rtl::OUString SAL_CALL
SwXShape::getShapeType() throw ( uno::RuntimeException
)
2512 ::rtl::OUString aType
;
2515 aType
= mxShape
->getShapeType();
2520 /** method to determine top group object
2522 OD 2004-08-03 #i31698#
2526 SdrObject
* SwXShape::_GetTopGroupObj( SvxShape
* _pSvxShape
)
2528 SdrObject
* pTopGroupObj( 0L );
2530 SvxShape
* pSvxShape
= _pSvxShape
? _pSvxShape
: GetSvxShape();
2533 SdrObject
* pSdrObj
= pSvxShape
->GetSdrObject();
2534 if ( pSdrObj
&& pSdrObj
->GetUpGroup() )
2536 pTopGroupObj
= pSdrObj
->GetUpGroup();
2537 while ( pTopGroupObj
->GetUpGroup() )
2539 pTopGroupObj
= pTopGroupObj
->GetUpGroup();
2544 return pTopGroupObj
;
2547 /** method to determine position according to the positioning attributes
2549 OD 2004-08-03 #i31698#
2553 awt::Point
SwXShape::_GetAttrPosition()
2555 awt::Point aAttrPos
;
2557 uno::Any
aHoriPos( getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")) ) );
2558 aHoriPos
>>= aAttrPos
.X
;
2559 uno::Any
aVertPos( getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition")) ) );
2560 aVertPos
>>= aAttrPos
.Y
;
2561 // --> OD 2004-10-19 #i35798# - fallback, if attribute position is (0,0)
2562 // and no anchor position is applied to the drawing object
2563 SvxShape
* pSvxShape
= GetSvxShape();
2566 const SdrObject
* pObj
= pSvxShape
->GetSdrObject();
2568 pObj
->GetAnchorPos().X() == 0 &&
2569 pObj
->GetAnchorPos().Y() == 0 &&
2570 aAttrPos
.X
== 0 && aAttrPos
.Y
== 0 )
2572 const Rectangle aObjRect
= pObj
->GetSnapRect();
2573 aAttrPos
.X
= TWIP_TO_MM100(aObjRect
.Left());
2574 aAttrPos
.Y
= TWIP_TO_MM100(aObjRect
.Top());
2578 // --> OD 2004-11-10 #i35007# - If drawing object is anchored as-character,
2579 // it's x-position isn't sensible. Thus, return the x-position as zero in this case.
2580 text::TextContentAnchorType eTextAnchorType
=
2581 text::TextContentAnchorType_AT_PARAGRAPH
;
2583 rtl::OUString
sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) );
2584 uno::Any aAny
= getPropertyValue( sAnchorType
);
2585 aAny
>>= eTextAnchorType
;
2587 if ( eTextAnchorType
== text::TextContentAnchorType_AS_CHARACTER
)
2596 /** method to convert the position (translation) of the drawing object to
2597 the layout direction horizontal left-to-right.
2599 OD 2004-07-27 #i31698#
2603 awt::Point
SwXShape::_ConvertPositionToHoriL2R( const awt::Point _aObjPos
,
2604 const awt::Size _aObjSize
)
2606 awt::Point
aObjPosInHoriL2R( _aObjPos
);
2608 SwFrmFmt
* pFrmFmt
= GetFrmFmt();
2611 SwFrmFmt::tLayoutDir eLayoutDir
= pFrmFmt
->GetLayoutDir();
2612 switch ( eLayoutDir
)
2614 case SwFrmFmt::HORI_L2R
:
2619 case SwFrmFmt::HORI_R2L
:
2621 aObjPosInHoriL2R
.X
= -_aObjPos
.X
- _aObjSize
.Width
;
2624 case SwFrmFmt::VERT_R2L
:
2626 aObjPosInHoriL2R
.X
= -_aObjPos
.Y
- _aObjSize
.Width
;
2627 aObjPosInHoriL2R
.Y
= _aObjPos
.X
;
2633 "<SwXShape::_ConvertPositionToHoriL2R(..)> - unsupported layout direction" );
2638 return aObjPosInHoriL2R
;
2640 /** method to convert the transformation of the drawing object to the layout
2641 direction, the drawing object is in
2643 OD 2004-07-27 #i31698#
2647 drawing::HomogenMatrix3
SwXShape::_ConvertTransformationToLayoutDir(
2648 drawing::HomogenMatrix3 _aMatrixInHoriL2R
)
2650 drawing::HomogenMatrix3
aMatrix( _aMatrixInHoriL2R
);
2652 // --> OD 2005-03-10 #i44334#, #i44681# - direct manipulation of the
2653 // tranformation structure isn't valid, if it contains rotation.
2654 SvxShape
* pSvxShape
= GetSvxShape();
2656 "<SwXShape::_ConvertTransformationToLayoutDir(..)> - no SvxShape found!")
2659 const SdrObject
* pObj
= pSvxShape
->GetSdrObject();
2661 "<SwXShape::_ConvertTransformationToLayoutDir(..)> - no SdrObject found!")
2664 // get position of object in Writer coordinate system.
2665 awt::Point
aPos( getPosition() );
2666 // get position of object in Drawing layer coordinate system
2667 const Point
aTmpObjPos( pObj
->GetSnapRect().TopLeft() );
2668 const awt::Point
aObjPos(
2669 TWIP_TO_MM100( aTmpObjPos
.X() - pObj
->GetAnchorPos().X() ),
2670 TWIP_TO_MM100( aTmpObjPos
.Y() - pObj
->GetAnchorPos().Y() ) );
2671 // determine difference between these positions according to the
2672 // Writer coordinate system
2673 const awt::Point
aTranslateDiff( aPos
.X
- aObjPos
.X
,
2674 aPos
.Y
- aObjPos
.Y
);
2675 // apply translation difference to transformation matrix.
2676 if ( aTranslateDiff
.X
!= 0 || aTranslateDiff
.Y
!= 0 )
2678 // --> OD 2007-01-03 #i73079# - use correct matrix type
2679 ::basegfx::B2DHomMatrix aTempMatrix
;
2682 aTempMatrix
.set(0, 0, aMatrix
.Line1
.Column1
);
2683 aTempMatrix
.set(0, 1, aMatrix
.Line1
.Column2
);
2684 aTempMatrix
.set(0, 2, aMatrix
.Line1
.Column3
);
2685 aTempMatrix
.set(1, 0, aMatrix
.Line2
.Column1
);
2686 aTempMatrix
.set(1, 1, aMatrix
.Line2
.Column2
);
2687 aTempMatrix
.set(1, 2, aMatrix
.Line2
.Column3
);
2688 aTempMatrix
.set(2, 0, aMatrix
.Line3
.Column1
);
2689 aTempMatrix
.set(2, 1, aMatrix
.Line3
.Column2
);
2690 aTempMatrix
.set(2, 2, aMatrix
.Line3
.Column3
);
2692 // --> OD 2007-01-03 #i73079#
2693 aTempMatrix
.translate( aTranslateDiff
.X
, aTranslateDiff
.Y
);
2696 aMatrix
.Line1
.Column1
= aTempMatrix
.get(0, 0);
2697 aMatrix
.Line1
.Column2
= aTempMatrix
.get(0, 1);
2698 aMatrix
.Line1
.Column3
= aTempMatrix
.get(0, 2);
2699 aMatrix
.Line2
.Column1
= aTempMatrix
.get(1, 0);
2700 aMatrix
.Line2
.Column2
= aTempMatrix
.get(1, 1);
2701 aMatrix
.Line2
.Column3
= aTempMatrix
.get(1, 2);
2702 aMatrix
.Line3
.Column1
= aTempMatrix
.get(2, 0);
2703 aMatrix
.Line3
.Column2
= aTempMatrix
.get(2, 1);
2704 aMatrix
.Line3
.Column3
= aTempMatrix
.get(2, 2);
2713 /** method to adjust the positioning properties
2715 OD 2004-08-02 #i31698#
2719 void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition
)
2721 // handle x-position
2722 // --> OD 2004-11-10 #i35007# - no handling of x-position, if drawing
2723 // object is anchored as-character, because it doesn't make sense.
2724 text::TextContentAnchorType eTextAnchorType
=
2725 text::TextContentAnchorType_AT_PARAGRAPH
;
2727 rtl::OUString
sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) );
2728 uno::Any aAny
= getPropertyValue( sAnchorType
);
2729 aAny
>>= eTextAnchorType
;
2731 if ( eTextAnchorType
!= text::TextContentAnchorType_AS_CHARACTER
)
2734 // determine current x-postion
2735 rtl::OUString
aHoriPosPropStr( RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition") );
2736 uno::Any
aHoriPos( getPropertyValue( aHoriPosPropStr
) );
2737 sal_Int32 dCurrX
= 0;
2738 aHoriPos
>>= dCurrX
;
2739 // change x-position attribute, if needed
2740 if ( dCurrX
!= _aPosition
.X
)
2742 // adjust x-position orientation to text::HoriOrientation::NONE, if needed
2743 // Note: has to be done before setting x-position attribute
2744 rtl::OUString
aHoriOrientPropStr( RTL_CONSTASCII_USTRINGPARAM("HoriOrient") );
2745 uno::Any
aHoriOrient( getPropertyValue( aHoriOrientPropStr
) );
2746 sal_Int16 eHoriOrient
;
2747 aHoriOrient
>>= eHoriOrient
;
2748 if ( eHoriOrient
!= text::HoriOrientation::NONE
)
2750 eHoriOrient
= text::HoriOrientation::NONE
;
2751 aHoriOrient
<<= eHoriOrient
;
2752 setPropertyValue( aHoriOrientPropStr
, aHoriOrient
);
2754 // set x-position attribute
2755 aHoriPos
<<= _aPosition
.X
;
2756 setPropertyValue( aHoriPosPropStr
, aHoriPos
);
2760 // handle y-position
2762 // determine current y-postion
2763 rtl::OUString
aVertPosPropStr( RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition") );
2764 uno::Any
aVertPos( getPropertyValue( aVertPosPropStr
) );
2765 sal_Int32 dCurrY
= 0;
2766 aVertPos
>>= dCurrY
;
2767 // change y-position attribute, if needed
2768 if ( dCurrY
!= _aPosition
.Y
)
2770 // adjust y-position orientation to text::VertOrientation::NONE, if needed
2771 // Note: has to be done before setting y-position attribute
2772 rtl::OUString
aVertOrientPropStr( RTL_CONSTASCII_USTRINGPARAM("VertOrient") );
2773 uno::Any
aVertOrient( getPropertyValue( aVertOrientPropStr
) );
2774 sal_Int16 eVertOrient
;
2775 aVertOrient
>>= eVertOrient
;
2776 if ( eVertOrient
!= text::VertOrientation::NONE
)
2778 eVertOrient
= text::VertOrientation::NONE
;
2779 aVertOrient
<<= eVertOrient
;
2780 setPropertyValue( aVertOrientPropStr
, aVertOrient
);
2782 // set y-position attribute
2783 aVertPos
<<= _aPosition
.Y
;
2784 setPropertyValue( aVertPosPropStr
, aVertPos
);
2789 /** method to convert start or end position of the drawing object to the
2790 Writer specific position, which is the attribute position in layout direction
2792 OD 2009-01-12 #i59051#
2796 ::com::sun::star::awt::Point
SwXShape::_ConvertStartOrEndPosToLayoutDir(
2797 const ::com::sun::star::awt::Point
& aStartOrEndPos
)
2799 awt::Point
aConvertedPos( aStartOrEndPos
);
2801 SvxShape
* pSvxShape
= GetSvxShape();
2803 "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!")
2806 const SdrObject
* pObj
= pSvxShape
->GetSdrObject();
2808 "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!")
2811 // get position of object in Writer coordinate system.
2812 awt::Point
aPos( getPosition() );
2813 // get position of object in Drawing layer coordinate system
2814 const Point
aTmpObjPos( pObj
->GetSnapRect().TopLeft() );
2815 const awt::Point
aObjPos(
2816 TWIP_TO_MM100( aTmpObjPos
.X() - pObj
->GetAnchorPos().X() ),
2817 TWIP_TO_MM100( aTmpObjPos
.Y() - pObj
->GetAnchorPos().Y() ) );
2818 // determine difference between these positions according to the
2819 // Writer coordinate system
2820 const awt::Point
aTranslateDiff( aPos
.X
- aObjPos
.X
,
2821 aPos
.Y
- aObjPos
.Y
);
2822 // apply translation difference to transformation matrix.
2823 if ( aTranslateDiff
.X
!= 0 || aTranslateDiff
.Y
!= 0 )
2825 aConvertedPos
.X
= aConvertedPos
.X
+ aTranslateDiff
.X
;
2826 aConvertedPos
.Y
= aConvertedPos
.Y
+ aTranslateDiff
.Y
;
2831 return aConvertedPos
;
2834 ::com::sun::star::drawing::PolyPolygonBezierCoords
SwXShape::_ConvertPolyPolygonBezierToLayoutDir(
2835 const ::com::sun::star::drawing::PolyPolygonBezierCoords
& aPath
)
2837 drawing::PolyPolygonBezierCoords
aConvertedPath( aPath
);
2839 SvxShape
* pSvxShape
= GetSvxShape();
2841 "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!")
2844 const SdrObject
* pObj
= pSvxShape
->GetSdrObject();
2846 "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!")
2849 // get position of object in Writer coordinate system.
2850 awt::Point
aPos( getPosition() );
2851 // get position of object in Drawing layer coordinate system
2852 const Point
aTmpObjPos( pObj
->GetSnapRect().TopLeft() );
2853 const awt::Point
aObjPos(
2854 TWIP_TO_MM100( aTmpObjPos
.X() - pObj
->GetAnchorPos().X() ),
2855 TWIP_TO_MM100( aTmpObjPos
.Y() - pObj
->GetAnchorPos().Y() ) );
2856 // determine difference between these positions according to the
2857 // Writer coordinate system
2858 const awt::Point
aTranslateDiff( aPos
.X
- aObjPos
.X
,
2859 aPos
.Y
- aObjPos
.Y
);
2860 // apply translation difference to PolyPolygonBezier.
2861 if ( aTranslateDiff
.X
!= 0 || aTranslateDiff
.Y
!= 0 )
2863 basegfx::B2DHomMatrix aMatrix
;
2864 aMatrix
.translate( aTranslateDiff
.X
, aTranslateDiff
.Y
);
2866 const sal_Int32
nOuterSequenceCount(aConvertedPath
.Coordinates
.getLength());
2867 drawing::PointSequence
* pInnerSequence
= aConvertedPath
.Coordinates
.getArray();
2868 for(sal_Int32
a(0); a
< nOuterSequenceCount
; a
++)
2870 const sal_Int32
nInnerSequenceCount(pInnerSequence
->getLength());
2871 awt::Point
* pArray
= pInnerSequence
->getArray();
2873 for(sal_Int32
b(0); b
< nInnerSequenceCount
; b
++)
2875 basegfx::B2DPoint
aNewCoordinatePair(pArray
->X
, pArray
->Y
);
2876 aNewCoordinatePair
*= aMatrix
;
2877 pArray
->X
= basegfx::fround(aNewCoordinatePair
.getX());
2878 pArray
->Y
= basegfx::fround(aNewCoordinatePair
.getY());
2886 return aConvertedPath
;
2889 /*-- 31.05.01 09:59:19---------------------------------------------------
2891 -----------------------------------------------------------------------*/
2892 SwXGroupShape::SwXGroupShape(uno::Reference
< XInterface
> & xShape
) :
2896 uno::Reference
<XShapes
> xShapes(xShapeAgg
, uno::UNO_QUERY
);
2897 DBG_ASSERT(xShapes
.is(), "no SvxShape found or shape is not a group shape");
2901 /*-- 31.05.01 09:59:19---------------------------------------------------
2903 -----------------------------------------------------------------------*/
2904 SwXGroupShape::~SwXGroupShape()
2907 /*-- 31.05.01 09:59:19---------------------------------------------------
2909 -----------------------------------------------------------------------*/
2910 uno::Any
SwXGroupShape::queryInterface( const uno::Type
& rType
) throw(uno::RuntimeException
)
2913 if(rType
== ::getCppuType((uno::Reference
<XShapes
>*)0))
2914 aRet
<<= uno::Reference
<XShapes
>(this);
2916 aRet
= SwXShape::queryInterface(rType
);
2919 /*-- 31.05.01 09:59:19---------------------------------------------------
2921 -----------------------------------------------------------------------*/
2922 void SwXGroupShape::acquire( ) throw()
2924 SwXShape::acquire();
2926 /*-- 31.05.01 09:59:19---------------------------------------------------
2928 -----------------------------------------------------------------------*/
2929 void SwXGroupShape::release( ) throw()
2931 SwXShape::release();
2933 /*-- 31.05.01 09:59:19---------------------------------------------------
2935 -----------------------------------------------------------------------*/
2936 void SwXGroupShape::add( const uno::Reference
< XShape
>& xShape
) throw (uno::RuntimeException
)
2938 vos::OGuard
aGuard(Application::GetSolarMutex());
2939 SvxShape
* pSvxShape
= GetSvxShape();
2940 SwFrmFmt
* pFmt
= GetFrmFmt();
2941 if(pSvxShape
&& pFmt
)
2943 uno::Reference
<XShapes
> xShapes
;
2944 if( xShapeAgg
.is() )
2946 const uno::Type
& rType
= ::getCppuType((uno::Reference
<XShapes
>*)0 );
2947 uno::Any aAgg
= xShapeAgg
->queryAggregation( rType
);
2951 xShapes
->add(xShape
);
2953 throw uno::RuntimeException();
2955 uno::Reference
<lang::XUnoTunnel
> xTunnel(xShape
, uno::UNO_QUERY
);
2956 SwXShape
* pSwShape
= 0;
2958 pSwShape
= reinterpret_cast< SwXShape
* >(
2959 sal::static_int_cast
< sal_IntPtr
>( xTunnel
->getSomething(SwXShape::getUnoTunnelId()) ));
2960 if(pSwShape
&& pSwShape
->m_bDescriptor
)
2962 SvxShape
* pAddShape
= reinterpret_cast< SvxShape
* >(
2963 sal::static_int_cast
< sal_IntPtr
>( xTunnel
->getSomething(SvxShape::getUnoTunnelId()) ));
2966 SdrObject
* pObj
= pAddShape
->GetSdrObject();
2969 SwDoc
* pDoc
= pFmt
->GetDoc();
2970 // OD 25.06.2003 #108784# - set layer of new drawing
2971 // object to corresponding invisible layer.
2972 if( FmFormInventor
!= pObj
->GetObjInventor())
2974 pObj
->SetLayer( pSwShape
->pImpl
->GetOpaque()
2975 ? pDoc
->GetInvisibleHeavenId()
2976 : pDoc
->GetInvisibleHellId() );
2980 pObj
->SetLayer(pDoc
->GetInvisibleControlsId());
2984 pSwShape
->m_bDescriptor
= sal_False
;
2985 //add the group member to the format of the group
2986 SwFrmFmt
* pShapeFmt
= ::FindFrmFmt( pSvxShape
->GetSdrObject() );
2988 pFmt
->Add(pSwShape
);
2992 throw uno::RuntimeException();
2994 /*-- 31.05.01 09:59:20---------------------------------------------------
2996 -----------------------------------------------------------------------*/
2997 void SwXGroupShape::remove( const uno::Reference
< XShape
>& xShape
) throw (uno::RuntimeException
)
2999 vos::OGuard
aGuard(Application::GetSolarMutex());
3000 uno::Reference
<XShapes
> xShapes
;
3001 if( xShapeAgg
.is() )
3003 const uno::Type
& rType
= ::getCppuType((uno::Reference
<XShapes
>*)0 );
3004 uno::Any aAgg
= xShapeAgg
->queryAggregation( rType
);
3008 throw uno::RuntimeException();
3009 xShapes
->remove(xShape
);
3011 /*-- 31.05.01 09:59:20---------------------------------------------------
3013 -----------------------------------------------------------------------*/
3014 sal_Int32
SwXGroupShape::getCount(void) throw( uno::RuntimeException
)
3016 vos::OGuard
aGuard(Application::GetSolarMutex());
3017 uno::Reference
<XIndexAccess
> xAcc
;
3018 if( xShapeAgg
.is() )
3020 const uno::Type
& rType
= ::getCppuType((uno::Reference
<XIndexAccess
>*)0 );
3021 uno::Any aAgg
= xShapeAgg
->queryAggregation( rType
);
3025 throw uno::RuntimeException();
3026 return xAcc
->getCount();
3028 /*-- 31.05.01 09:59:20---------------------------------------------------
3030 -----------------------------------------------------------------------*/
3031 uno::Any
SwXGroupShape::getByIndex(sal_Int32 nIndex
)
3032 throw( lang::IndexOutOfBoundsException
, lang::WrappedTargetException
,
3033 uno::RuntimeException
)
3035 vos::OGuard
aGuard(Application::GetSolarMutex());
3036 uno::Reference
<XIndexAccess
> xAcc
;
3037 if( xShapeAgg
.is() )
3039 const uno::Type
& rType
= ::getCppuType((uno::Reference
<XIndexAccess
>*)0 );
3040 uno::Any aAgg
= xShapeAgg
->queryAggregation( rType
);
3044 throw uno::RuntimeException();
3045 return xAcc
->getByIndex(nIndex
);
3047 /*-- 31.05.01 09:59:20---------------------------------------------------
3049 -----------------------------------------------------------------------*/
3050 uno::Type
SwXGroupShape::getElementType( ) throw(uno::RuntimeException
)
3052 vos::OGuard
aGuard(Application::GetSolarMutex());
3053 uno::Reference
<XIndexAccess
> xAcc
;
3054 if( xShapeAgg
.is() )
3056 const uno::Type
& rType
= ::getCppuType((uno::Reference
<XIndexAccess
>*)0 );
3057 uno::Any aAgg
= xShapeAgg
->queryAggregation( rType
);
3061 throw uno::RuntimeException();
3062 return xAcc
->getElementType();
3064 /*-- 31.05.01 09:59:22---------------------------------------------------
3066 -----------------------------------------------------------------------*/
3067 sal_Bool
SwXGroupShape::hasElements( ) throw(uno::RuntimeException
)
3069 vos::OGuard
aGuard(Application::GetSolarMutex());
3070 uno::Reference
<XIndexAccess
> xAcc
;
3071 if( xShapeAgg
.is() )
3073 const uno::Type
& rType
= ::getCppuType((uno::Reference
<XIndexAccess
>*)0 );
3074 uno::Any aAgg
= xShapeAgg
->queryAggregation( rType
);
3078 throw uno::RuntimeException();
3079 return xAcc
->hasElements();