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: unoframe.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"
33 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
34 #include <com/sun/star/container/XChild.hpp>
35 #include <com/sun/star/embed/XClassifiedObject.hpp>
36 #include <com/sun/star/embed/XVisualObject.hpp>
37 #include <com/sun/star/embed/XComponentSupplier.hpp>
38 #include <com/sun/star/embed/EmbedStates.hpp>
39 #include <com/sun/star/embed/Aspects.hpp>
40 #include <com/sun/star/graphic/XGraphicProvider.hpp>
42 #include <swtypes.hxx>
48 #ifndef _DOCSH_HXX //autogen
53 #include <ndindex.hxx>
55 #include <ndnotxt.hxx>
56 #include <svx/unomid.hxx>
57 #include <unocrsr.hxx>
58 #include <unocrsrhelper.hxx>
59 #include <docstyle.hxx>
60 #include <dcontact.hxx>
61 #include <fmtcnct.hxx>
67 #include <unoprnms.hxx>
68 #include <unoevent.hxx>
69 #include <com/sun/star/table/BorderLine.hpp>
70 #include <com/sun/star/util/XModifyBroadcaster.hpp>
71 #include <com/sun/star/table/ShadowFormat.hpp>
72 #include <com/sun/star/style/GraphicLocation.hpp>
73 #include <com/sun/star/text/GraphicCrop.hpp>
74 #include <com/sun/star/text/TextContentAnchorType.hpp>
75 #include <com/sun/star/text/XTextColumns.hpp>
76 #include <com/sun/star/text/WrapTextMode.hpp>
77 #include <com/sun/star/beans/PropertyAttribute.hpp>
78 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
79 #include <com/sun/star/drawing/PointSequence.hpp>
80 #include <com/sun/star/drawing/ColorMode.hpp>
81 #include <tools/poly.hxx>
83 #include <unostyle.hxx>
84 #include <svx/svdmodel.hxx>
85 #include <svx/svdpage.hxx>
86 #include <svx/brshitem.hxx>
87 #include <svx/protitem.hxx>
88 #include <fmtornt.hxx>
90 #include <svx/lrspitem.hxx>
91 #include <svx/ulspitem.hxx>
92 #include <svx/boxitem.hxx>
93 #include <svx/opaqitem.hxx>
94 #include <svx/prntitem.hxx>
95 #include <svx/shaditem.hxx>
96 #include <fmtsrnd.hxx>
97 #include <fmtfsize.hxx>
99 #include <unoframe.hxx>
100 #include <fmtanchr.hxx>
101 #include <fmtclds.hxx>
102 #include <frmatr.hxx>
105 #include <vos/mutex.hxx>
106 #include <vcl/svapp.hxx>
107 #include <sfx2/printer.hxx>
108 #include <SwStyleNameMapper.hxx>
109 #include <xmloff/xmlcnitm.hxx>
110 #include <poolfmt.hxx>
111 #include <pagedesc.hxx>
112 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
113 #include <tools/urlobj.hxx>
114 #include <svx/frmdiritem.hxx>
115 // DVO, OD 01.10.2003 #i18732#
116 #include <fmtfollowtextflow.hxx>
117 // OD 2004-05-05 #i28701#
118 #include <fmtwrapinfluenceonobjpos.hxx>
120 #include <toolkit/helper/vclunohelper.hxx>
123 extern sal_Bool
lcl_ChkAndSetNewAnchor( const SwFlyFrm
& rFly
, SfxItemSet
& rSet
);
125 using namespace ::com::sun::star
;
126 using ::rtl::OUString
;
128 using ::com::sun::star::frame::XModel
;
129 using ::com::sun::star::container::XNameAccess
;
130 using ::com::sun::star::style::XStyleFamiliesSupplier
;
132 const sal_Char __FAR_DATA sPackageProtocol
[] = "vnd.sun.star.Package:";
133 const sal_Char __FAR_DATA sGraphicObjectProtocol
[] = "vnd.sun.star.GraphicObject:";
135 /****************************************************************************
137 ****************************************************************************/
138 class BaseFrameProperties_Impl
140 SwUnoCursorHelper::SwAnyMapHelper aAnyMap
;
143 virtual ~BaseFrameProperties_Impl();
145 void SetProperty(USHORT nWID
, BYTE nMemberId
, const uno::Any
& rVal
);
146 sal_Bool
GetProperty(USHORT nWID
, BYTE nMemberId
, const uno::Any
*& pAny
);
147 // void GetProperty(const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any& rAny );
149 // const SfxItemPropertyMap* GetMap() const {return _pMap;}
150 sal_Bool
FillBaseProperties(SfxItemSet
& rToSet
, const SfxItemSet
&rFromSet
, sal_Bool
& rSizeFound
);
152 virtual sal_Bool
AnyToItemSet( SwDoc
* pDoc
, SfxItemSet
& rFrmSet
, SfxItemSet
& rSet
, sal_Bool
& rSizeFound
) = 0;
155 /* -----------------------------12.06.01 15:46--------------------------------
157 ---------------------------------------------------------------------------*/
158 BaseFrameProperties_Impl::~BaseFrameProperties_Impl()
161 /* -----------------------------12.06.01 15:43--------------------------------
163 ---------------------------------------------------------------------------*/
164 void BaseFrameProperties_Impl::SetProperty(USHORT nWID
, BYTE nMemberId
, const uno::Any
& rVal
)
166 aAnyMap
.SetValue( nWID
, nMemberId
, rVal
);
168 /* -----------------------------12.06.01 15:43--------------------------------
170 ---------------------------------------------------------------------------*/
171 sal_Bool
BaseFrameProperties_Impl::GetProperty(USHORT nWID
, BYTE nMemberId
, const uno::Any
*& rpAny
)
173 return aAnyMap
.FillValue( nWID
, nMemberId
, rpAny
);
175 //void BaseFrameProperties_Impl::GetProperty( const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any & rAny )
177 // rAny = rxPropertySet->getPropertyValue( rPropertyName );
179 /* -----------------29.06.98 09:55-------------------
181 * --------------------------------------------------*/
182 sal_Bool
BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet
& rToSet
, const SfxItemSet
& rFromSet
, sal_Bool
& rSizeFound
)
184 sal_Bool bRet
= sal_True
;
185 //Anker kommt auf jeden Fall in den Set
186 SwFmtAnchor
aAnchor ( static_cast < const SwFmtAnchor
& > ( rFromSet
.Get ( RES_ANCHOR
) ) );
188 const ::uno::Any
* pAnchorPgNo
;
189 if(GetProperty(RES_ANCHOR
, MID_ANCHOR_PAGENUM
, pAnchorPgNo
))
190 bRet
&= ((SfxPoolItem
&)aAnchor
).PutValue(*pAnchorPgNo
, MID_ANCHOR_PAGENUM
);
191 const ::uno::Any
* pAnchorType
;
192 if(GetProperty(RES_ANCHOR
, MID_ANCHOR_ANCHORTYPE
, pAnchorType
))
193 bRet
&= ((SfxPoolItem
&)aAnchor
).PutValue(*pAnchorType
, MID_ANCHOR_ANCHORTYPE
);
197 const ::uno::Any
* pCol
= 0;
198 GetProperty(RES_BACKGROUND
, MID_BACK_COLOR
, pCol
);
199 const ::uno::Any
* pRGBCol
= 0;
200 GetProperty(RES_BACKGROUND
, MID_BACK_COLOR_R_G_B
, pRGBCol
);
201 const ::uno::Any
* pColTrans
= 0;
202 GetProperty(RES_BACKGROUND
, MID_BACK_COLOR_TRANSPARENCY
, pColTrans
);
203 const ::uno::Any
* pTrans
= 0;
204 GetProperty(RES_BACKGROUND
, MID_GRAPHIC_TRANSPARENT
, pTrans
);
205 const ::uno::Any
* pGrLoc
= 0;
206 GetProperty(RES_BACKGROUND
, MID_GRAPHIC_POSITION
, pGrLoc
);
207 const ::uno::Any
* pGrURL
= 0;
208 GetProperty(RES_BACKGROUND
, MID_GRAPHIC_URL
, pGrURL
);
209 const ::uno::Any
* pGrFilter
= 0;
210 GetProperty(RES_BACKGROUND
, MID_GRAPHIC_FILTER
, pGrFilter
);
211 const ::uno::Any
* pGrTranparency
= 0;
212 GetProperty(RES_BACKGROUND
, MID_GRAPHIC_TRANSPARENCY
, pGrTranparency
);
214 if(pCol
|| pTrans
|| pGrURL
|| pGrFilter
|| pGrLoc
||
215 pGrTranparency
|| pColTrans
|| pRGBCol
)
217 SvxBrushItem
aBrush ( static_cast < const :: SvxBrushItem
& > ( rFromSet
.Get ( RES_BACKGROUND
) ) );
219 bRet
&= ((SfxPoolItem
&)aBrush
).PutValue(*pCol
,MID_BACK_COLOR
);
221 bRet
&= ((SfxPoolItem
&)aBrush
).PutValue(*pColTrans
, MID_BACK_COLOR_TRANSPARENCY
);
223 bRet
&= ((SfxPoolItem
&)aBrush
).PutValue(*pRGBCol
, MID_BACK_COLOR_R_G_B
);
226 // don't overwrite transparency with a non-transparence flag
227 if(!pColTrans
|| Any2Bool( *pTrans
))
228 bRet
&= ((SfxPoolItem
&)aBrush
).PutValue(*pTrans
, MID_GRAPHIC_TRANSPARENT
);
231 bRet
&= ((SfxPoolItem
&)aBrush
).PutValue(*pGrURL
, MID_GRAPHIC_URL
);
233 bRet
&= ((SfxPoolItem
&)aBrush
).PutValue(*pGrFilter
, MID_GRAPHIC_FILTER
);
235 bRet
&= ((SfxPoolItem
&)aBrush
).PutValue(*pGrLoc
, MID_GRAPHIC_POSITION
);
237 bRet
&= ((SfxPoolItem
&)aBrush
).PutValue(*pGrTranparency
, MID_GRAPHIC_TRANSPARENCY
);
243 const ::uno::Any
* pCont
= 0;
244 GetProperty(RES_PROTECT
, MID_PROTECT_CONTENT
, pCont
);
245 const ::uno::Any
* pPos
= 0;
246 GetProperty(RES_PROTECT
,MID_PROTECT_POSITION
, pPos
);
247 const ::uno::Any
* pName
= 0;
248 GetProperty(RES_PROTECT
, MID_PROTECT_SIZE
, pName
);
249 if(pCont
||pPos
||pName
)
251 SvxProtectItem
aProt ( static_cast < const :: SvxProtectItem
& > ( rFromSet
.Get ( RES_PROTECT
) ) );
253 bRet
&= ((SfxPoolItem
&)aProt
).PutValue(*pCont
, MID_PROTECT_CONTENT
);
255 bRet
&= ((SfxPoolItem
&)aProt
).PutValue(*pPos
, MID_PROTECT_POSITION
);
257 bRet
&= ((SfxPoolItem
&)aProt
).PutValue(*pName
, MID_PROTECT_SIZE
);
262 const ::uno::Any
* pHori
= 0;
263 GetProperty(RES_HORI_ORIENT
, MID_HORIORIENT_ORIENT
, pHori
);
264 const ::uno::Any
* pHoriP
= 0;
265 GetProperty(RES_HORI_ORIENT
, MID_HORIORIENT_POSITION
|CONVERT_TWIPS
, pHoriP
);
266 const ::uno::Any
* pHoriR
= 0;
267 GetProperty(RES_HORI_ORIENT
, MID_HORIORIENT_RELATION
, pHoriR
);
268 const ::uno::Any
* pPageT
= 0;
269 GetProperty(RES_HORI_ORIENT
, MID_HORIORIENT_PAGETOGGLE
, pPageT
);
270 if(pHori
||pHoriP
||pHoriR
||pPageT
)
272 SwFmtHoriOrient
aOrient ( static_cast < const :: SwFmtHoriOrient
& > ( rFromSet
.Get ( RES_HORI_ORIENT
) ) );
274 bRet
&= ((SfxPoolItem
&)aOrient
).PutValue(*pHori
, MID_HORIORIENT_ORIENT
);
276 bRet
&= ((SfxPoolItem
&)aOrient
).PutValue(*pHoriP
, MID_HORIORIENT_POSITION
|CONVERT_TWIPS
);
278 bRet
&= ((SfxPoolItem
&)aOrient
).PutValue(*pHoriR
, MID_HORIORIENT_RELATION
);
280 bRet
&= ((SfxPoolItem
&)aOrient
).PutValue(*pPageT
, MID_HORIORIENT_PAGETOGGLE
);
286 const ::uno::Any
* pVert
= 0;
287 GetProperty(RES_VERT_ORIENT
, MID_VERTORIENT_ORIENT
, pVert
);
288 const ::uno::Any
* pVertP
= 0;
289 GetProperty(RES_VERT_ORIENT
, MID_VERTORIENT_POSITION
|CONVERT_TWIPS
, pVertP
);
290 const ::uno::Any
* pVertR
= 0;
291 GetProperty(RES_VERT_ORIENT
, MID_VERTORIENT_RELATION
, pVertR
);
292 if(pVert
||pVertP
||pVertR
)
294 SwFmtVertOrient
aOrient ( static_cast < const :: SwFmtVertOrient
& > ( rFromSet
.Get ( RES_VERT_ORIENT
) ) );
296 bRet
&= ((SfxPoolItem
&)aOrient
).PutValue(*pVert
, MID_VERTORIENT_ORIENT
);
298 bRet
&= ((SfxPoolItem
&)aOrient
).PutValue(*pVertP
, MID_VERTORIENT_POSITION
|CONVERT_TWIPS
);
300 bRet
&= ((SfxPoolItem
&)aOrient
).PutValue(*pVertR
, MID_VERTORIENT_RELATION
);
305 const ::uno::Any
* pURL
= 0;
306 GetProperty(RES_URL
, MID_URL_URL
, pURL
);
307 const ::uno::Any
* pTarget
= 0;
308 GetProperty(RES_URL
, MID_URL_TARGET
, pTarget
);
309 const ::uno::Any
* pHyLNm
= 0;
310 GetProperty(RES_URL
, MID_URL_HYPERLINKNAME
, pHyLNm
);
311 const ::uno::Any
* pHySMp
= 0;
312 GetProperty(RES_URL
, MID_URL_SERVERMAP
, pHySMp
);
313 if(pURL
||pTarget
||pHyLNm
||pHySMp
)
315 SwFmtURL
aURL ( static_cast < const :: SwFmtURL
& > ( rFromSet
.Get ( RES_URL
) ) );
317 bRet
&= ((SfxPoolItem
&)aURL
).PutValue(*pURL
, MID_URL_URL
);
319 bRet
&= ((SfxPoolItem
&)aURL
).PutValue(*pTarget
, MID_URL_TARGET
);
321 bRet
&= ((SfxPoolItem
&)aURL
).PutValue(*pHyLNm
, MID_URL_HYPERLINKNAME
);
323 bRet
&= ((SfxPoolItem
&)aURL
).PutValue(*pHySMp
, MID_URL_SERVERMAP
);
327 const ::uno::Any
* pL
= 0;
328 GetProperty(RES_LR_SPACE
, MID_L_MARGIN
|CONVERT_TWIPS
, pL
);
329 const ::uno::Any
* pR
= 0;
330 GetProperty(RES_LR_SPACE
, MID_R_MARGIN
|CONVERT_TWIPS
, pR
);
333 SvxLRSpaceItem
aLR ( static_cast < const :: SvxLRSpaceItem
& > ( rFromSet
.Get ( RES_LR_SPACE
) ) );
335 bRet
&= ((SfxPoolItem
&)aLR
).PutValue(*pL
, MID_L_MARGIN
|CONVERT_TWIPS
);
337 bRet
&= ((SfxPoolItem
&)aLR
).PutValue(*pR
, MID_R_MARGIN
|CONVERT_TWIPS
);
340 const ::uno::Any
* pT
= 0;
341 GetProperty(RES_UL_SPACE
, MID_UP_MARGIN
|CONVERT_TWIPS
, pT
);
342 const ::uno::Any
* pB
= 0;
343 GetProperty(RES_UL_SPACE
, MID_LO_MARGIN
|CONVERT_TWIPS
, pB
);
346 SvxULSpaceItem
aTB ( static_cast < const :: SvxULSpaceItem
&> ( rFromSet
.Get ( RES_UL_SPACE
) ) );
348 bRet
&= ((SfxPoolItem
&)aTB
).PutValue(*pT
, MID_UP_MARGIN
|CONVERT_TWIPS
);
350 bRet
&= ((SfxPoolItem
&)aTB
).PutValue(*pB
, MID_LO_MARGIN
|CONVERT_TWIPS
);
353 const ::uno::Any
* pOp
;
354 if(GetProperty(RES_OPAQUE
, 0, pOp
))
356 SvxOpaqueItem
aOp ( static_cast < const :: SvxOpaqueItem
& > ( rFromSet
.Get ( RES_OPAQUE
) ) );
357 bRet
&= ((SfxPoolItem
&)aOp
).PutValue(*pOp
, 0);
360 const ::uno::Any
* pPrt
;
361 if(GetProperty(RES_PRINT
, 0, pPrt
))
363 SvxPrintItem
aPrt ( static_cast < const :: SvxPrintItem
& > ( rFromSet
.Get ( RES_PRINT
) ) );
364 bRet
&= ((SfxPoolItem
&)aPrt
).PutValue(*pPrt
, 0);
367 const ::uno::Any
* pSh
;
368 if(GetProperty(RES_SHADOW
, CONVERT_TWIPS
, pSh
))
370 SvxShadowItem
aSh ( static_cast < const :: SvxShadowItem
& > ( rFromSet
.Get ( RES_SHADOW
) ) );
371 bRet
&= ((SfxPoolItem
&)aSh
).PutValue(*pSh
, CONVERT_TWIPS
);
374 const ::uno::Any
* pSur
= 0;
375 GetProperty(RES_SURROUND
, MID_SURROUND_SURROUNDTYPE
, pSur
);
376 const ::uno::Any
* pSurAnch
= 0;
377 GetProperty(RES_SURROUND
, MID_SURROUND_ANCHORONLY
, pSurAnch
);
380 SwFmtSurround
aSrnd ( static_cast < const :: SwFmtSurround
& > ( rFromSet
.Get ( RES_SURROUND
) ) );
382 bRet
&= ((SfxPoolItem
&)aSrnd
).PutValue(*pSur
, MID_SURROUND_SURROUNDTYPE
);
384 bRet
&= ((SfxPoolItem
&)aSrnd
).PutValue(*pSurAnch
, MID_SURROUND_ANCHORONLY
);
387 const ::uno::Any
* pLeft
= 0;
388 GetProperty(RES_BOX
, LEFT_BORDER
|CONVERT_TWIPS
, pLeft
);
389 const ::uno::Any
* pRight
= 0;
390 GetProperty(RES_BOX
, CONVERT_TWIPS
|RIGHT_BORDER
, pRight
);
391 const ::uno::Any
* pTop
= 0;
392 GetProperty(RES_BOX
, CONVERT_TWIPS
|TOP_BORDER
, pTop
);
393 const ::uno::Any
* pBottom
= 0;
394 GetProperty(RES_BOX
, CONVERT_TWIPS
|BOTTOM_BORDER
, pBottom
);
395 const ::uno::Any
* pDistance
= 0;
396 GetProperty(RES_BOX
, CONVERT_TWIPS
|BORDER_DISTANCE
, pDistance
);
397 const ::uno::Any
* pLeftDistance
= 0;
398 GetProperty(RES_BOX
, CONVERT_TWIPS
|LEFT_BORDER_DISTANCE
, pLeftDistance
);
399 const ::uno::Any
* pRightDistance
= 0;
400 GetProperty(RES_BOX
, CONVERT_TWIPS
|RIGHT_BORDER_DISTANCE
, pRightDistance
);
401 const ::uno::Any
* pTopDistance
= 0;
402 GetProperty(RES_BOX
, CONVERT_TWIPS
|TOP_BORDER_DISTANCE
, pTopDistance
);
403 const ::uno::Any
* pBottomDistance
= 0;
404 GetProperty(RES_BOX
, CONVERT_TWIPS
|BOTTOM_BORDER_DISTANCE
, pBottomDistance
);
405 if( pLeft
|| pRight
|| pTop
|| pBottom
|| pDistance
||
406 pLeftDistance
|| pRightDistance
|| pTopDistance
|| pBottomDistance
)
408 SvxBoxItem
aBox ( static_cast < const :: SvxBoxItem
& > ( rFromSet
.Get ( RES_BOX
) ) );
410 bRet
&= ((SfxPoolItem
&)aBox
).PutValue(*pLeft
, CONVERT_TWIPS
|LEFT_BORDER
);
412 bRet
&= ((SfxPoolItem
&)aBox
).PutValue(*pRight
, CONVERT_TWIPS
|RIGHT_BORDER
);
414 bRet
&= ((SfxPoolItem
&)aBox
).PutValue(*pTop
, CONVERT_TWIPS
|TOP_BORDER
);
416 bRet
&= ((SfxPoolItem
&)aBox
).PutValue(*pBottom
, CONVERT_TWIPS
|BOTTOM_BORDER
);
418 bRet
&= ((SfxPoolItem
&)aBox
).PutValue(*pDistance
, CONVERT_TWIPS
|BORDER_DISTANCE
);
420 bRet
&= ((SfxPoolItem
&)aBox
).PutValue(*pLeftDistance
, CONVERT_TWIPS
|LEFT_BORDER_DISTANCE
);
422 bRet
&= ((SfxPoolItem
&)aBox
).PutValue(*pRightDistance
, CONVERT_TWIPS
|RIGHT_BORDER_DISTANCE
);
424 bRet
&= ((SfxPoolItem
&)aBox
).PutValue(*pTopDistance
, CONVERT_TWIPS
|TOP_BORDER_DISTANCE
);
425 if( pBottomDistance
)
426 bRet
&= ((SfxPoolItem
&)aBox
).PutValue(*pBottomDistance
, CONVERT_TWIPS
|BOTTOM_BORDER_DISTANCE
);
430 const ::uno::Any
* pRelH
= 0;
431 GetProperty(RES_FRM_SIZE
, MID_FRMSIZE_REL_HEIGHT
, pRelH
);
432 const ::uno::Any
* pRelW
= 0;
433 GetProperty(RES_FRM_SIZE
, MID_FRMSIZE_REL_WIDTH
, pRelW
);
434 const ::uno::Any
* pSyncWidth
= 0;
435 GetProperty(RES_FRM_SIZE
, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT
, pSyncWidth
);
436 const ::uno::Any
* pSyncHeight
= 0;
437 GetProperty(RES_FRM_SIZE
, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH
, pSyncHeight
);
438 const ::uno::Any
* pWidth
= 0;
439 GetProperty(RES_FRM_SIZE
, MID_FRMSIZE_WIDTH
|CONVERT_TWIPS
, pWidth
);
440 const ::uno::Any
* pHeight
= 0;
441 GetProperty(RES_FRM_SIZE
, MID_FRMSIZE_HEIGHT
|CONVERT_TWIPS
, pHeight
);
442 const ::uno::Any
* pSize
= 0;
443 GetProperty(RES_FRM_SIZE
, MID_FRMSIZE_SIZE
|CONVERT_TWIPS
, pSize
);
444 const ::uno::Any
* pSizeType
= 0;
445 GetProperty(RES_FRM_SIZE
, MID_FRMSIZE_SIZE_TYPE
, pSizeType
);
446 const ::uno::Any
* pWidthType
= 0;
447 GetProperty(RES_FRM_SIZE
, MID_FRMSIZE_WIDTH_TYPE
, pWidthType
);
448 if( pWidth
|| pHeight
||pRelH
|| pRelW
|| pSize
||pSizeType
||
449 pWidthType
||pSyncWidth
|| pSyncHeight
)
451 rSizeFound
= sal_True
;
452 SwFmtFrmSize
aFrmSz ( static_cast < const :: SwFmtFrmSize
& > ( rFromSet
.Get ( RES_FRM_SIZE
) ) );
454 bRet
&= ((SfxPoolItem
&)aFrmSz
).PutValue(*pWidth
, MID_FRMSIZE_WIDTH
|CONVERT_TWIPS
);
456 bRet
&= ((SfxPoolItem
&)aFrmSz
).PutValue(*pHeight
, MID_FRMSIZE_HEIGHT
|CONVERT_TWIPS
);
458 bRet
&= ((SfxPoolItem
&)aFrmSz
).PutValue(*pRelH
, MID_FRMSIZE_REL_HEIGHT
);
460 bRet
&= ((SfxPoolItem
&)aFrmSz
).PutValue(*pRelW
, MID_FRMSIZE_REL_WIDTH
);
462 bRet
&= ((SfxPoolItem
&)aFrmSz
).PutValue(*pSyncWidth
, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT
);
464 bRet
&= ((SfxPoolItem
&)aFrmSz
).PutValue(*pSyncHeight
, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH
);
466 bRet
&= ((SfxPoolItem
&)aFrmSz
).PutValue(*pSize
, MID_FRMSIZE_SIZE
|CONVERT_TWIPS
);
468 bRet
&= ((SfxPoolItem
&)aFrmSz
).PutValue(*pSizeType
, MID_FRMSIZE_SIZE_TYPE
);
470 bRet
&= ((SfxPoolItem
&)aFrmSz
).PutValue(*pWidthType
, MID_FRMSIZE_WIDTH_TYPE
);
471 if(!aFrmSz
.GetWidth())
472 aFrmSz
.SetWidth(MINFLY
);
473 if(!aFrmSz
.GetHeight())
474 aFrmSz
.SetHeight(MINFLY
);
479 rSizeFound
= sal_False
;
482 aSize
.Width
= 2 * MM50
;
483 aSize
.Height
= 2 * MM50
;
486 ((SfxPoolItem
&)aFrmSz
).PutValue(aSizeVal
, MID_FRMSIZE_SIZE
|CONVERT_TWIPS
);
490 const ::uno::Any
* pFrameDirection
= 0;
491 GetProperty(RES_FRAMEDIR
, 0, pFrameDirection
);
494 SvxFrameDirectionItem
aAttr(FRMDIR_HORI_LEFT_TOP
, RES_FRAMEDIR
);
495 aAttr
.PutValue(*pFrameDirection
, 0);
498 const ::uno::Any
* pUnknown
= 0;
499 GetProperty(RES_UNKNOWNATR_CONTAINER
, 0, pUnknown
);
502 SvXMLAttrContainerItem
aAttr(RES_UNKNOWNATR_CONTAINER
);
503 aAttr
.PutValue(*pUnknown
, 0);
507 // DVO, OD 01.10.2003 #i18732#
508 const ::uno::Any
* pFollowTextFlow
= 0;
509 GetProperty(RES_FOLLOW_TEXT_FLOW
, 0, pFollowTextFlow
);
510 if ( pFollowTextFlow
)
512 SwFmtFollowTextFlow aFmtFollowTextFlow
;
513 aFmtFollowTextFlow
.PutValue(*pFollowTextFlow
, 0);
514 rToSet
.Put(aFmtFollowTextFlow
);
517 // OD 2004-05-04 #i28701# - RES_WRAP_INFLUENCE_ON_OBJPOS
518 const ::uno::Any
* pWrapInfluenceOnObjPos
= 0;
519 GetProperty(RES_WRAP_INFLUENCE_ON_OBJPOS
, MID_WRAP_INFLUENCE
, pWrapInfluenceOnObjPos
);
520 if ( pWrapInfluenceOnObjPos
)
522 SwFmtWrapInfluenceOnObjPos aFmtWrapInfluenceOnObjPos
;
523 aFmtWrapInfluenceOnObjPos
.PutValue( *pWrapInfluenceOnObjPos
, MID_WRAP_INFLUENCE
);
524 rToSet
.Put(aFmtWrapInfluenceOnObjPos
);
529 /* -----------------22.06.98 09:17-------------------
531 * --------------------------------------------------*/
533 class SwFrameProperties_Impl
: public BaseFrameProperties_Impl
536 // SwFrameProperties_Impl(/*const :: SfxItemPropertyMap* pMap*/) :
537 // BaseFrameProperties_Impl(/*pMap*/){}
539 SwFrameProperties_Impl();
540 virtual ~SwFrameProperties_Impl(){}
542 virtual sal_Bool
AnyToItemSet( SwDoc
* pDoc
, SfxItemSet
& rFrmSet
, SfxItemSet
& rSet
, sal_Bool
& rSizeFound
);
544 /* -----------------22.06.98 09:17-------------------
546 * --------------------------------------------------*/
547 SwFrameProperties_Impl::SwFrameProperties_Impl():
548 BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME)*/ )
551 /* -----------------22.06.98 11:27-------------------
553 * --------------------------------------------------*/
554 inline void lcl_FillCol ( SfxItemSet
&rToSet
, const :: SfxItemSet
&rFromSet
, const :: uno::Any
*pAny
)
558 SwFmtCol
aCol ( static_cast < const :: SwFmtCol
& > ( rFromSet
.Get ( RES_COL
) ) );
559 ((SfxPoolItem
&)aCol
).PutValue( *pAny
, MID_COLUMNS
);
563 sal_Bool
SwFrameProperties_Impl::AnyToItemSet(SwDoc
*pDoc
, SfxItemSet
& rSet
, SfxItemSet
&, sal_Bool
& rSizeFound
)
565 //Properties fuer alle Frames
566 const ::uno::Any
*pStyleName
;
567 SwDocStyleSheet
* pStyle
= NULL
;
570 if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME
, 0, pStyleName
) )
573 *pStyleName
>>= sStyle
;
574 pStyle
= (SwDocStyleSheet
*)pDoc
->GetDocShell()->GetStyleSheetPool()->Find(sStyle
,
575 SFX_STYLE_FAMILY_FRAME
);
578 const ::uno::Any
* pColumns
= NULL
;
579 GetProperty (RES_COL
, MID_COLUMNS
, pColumns
);
582 rtl::Reference
< SwDocStyleSheet
> xStyle( new SwDocStyleSheet( *pStyle
) );
583 const :: SfxItemSet
*pItemSet
= &xStyle
->GetItemSet();
584 bRet
= FillBaseProperties( rSet
, *pItemSet
, rSizeFound
);
585 lcl_FillCol ( rSet
, *pItemSet
, pColumns
);
589 const :: SfxItemSet
*pItemSet
= &pDoc
->GetFrmFmtFromPool( RES_POOLFRM_FRAME
)->GetAttrSet();
590 bRet
= FillBaseProperties( rSet
, *pItemSet
, rSizeFound
);
591 lcl_FillCol ( rSet
, *pItemSet
, pColumns
);
593 const ::uno::Any
* pEdit
;
594 if(GetProperty(RES_EDIT_IN_READONLY
, 0, pEdit
))
596 SfxBoolItem
aBool(RES_EDIT_IN_READONLY
);
597 ((SfxPoolItem
&)aBool
).PutValue(*pEdit
, 0);
602 /****************************************************************************
604 ****************************************************************************/
605 class SwGraphicProperties_Impl
: public BaseFrameProperties_Impl
608 SwGraphicProperties_Impl();
609 virtual ~SwGraphicProperties_Impl(){}
611 virtual sal_Bool
AnyToItemSet( SwDoc
* pDoc
, SfxItemSet
& rFrmSet
, SfxItemSet
& rSet
, sal_Bool
& rSizeFound
);
613 /* -----------------27.06.98 14:53-------------------
615 * --------------------------------------------------*/
616 SwGraphicProperties_Impl::SwGraphicProperties_Impl( ) :
617 BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC)*/ )
621 /* -----------------27.06.98 14:40-------------------
623 * --------------------------------------------------*/
624 inline void lcl_FillMirror ( SfxItemSet
&rToSet
, const :: SfxItemSet
&rFromSet
, const ::uno::Any
*pHEvenMirror
, const ::uno::Any
*pHOddMirror
, const ::uno::Any
*pVMirror
, sal_Bool
&rRet
)
626 if(pHEvenMirror
|| pHOddMirror
|| pVMirror
)
628 SwMirrorGrf
aMirror ( static_cast < const :: SwMirrorGrf
& > ( rFromSet
.Get ( RES_GRFATR_MIRRORGRF
) ) );
630 rRet
&= ((SfxPoolItem
&)aMirror
).PutValue(*pHEvenMirror
, MID_MIRROR_HORZ_EVEN_PAGES
);
632 rRet
&= ((SfxPoolItem
&)aMirror
).PutValue(*pHOddMirror
, MID_MIRROR_HORZ_ODD_PAGES
);
634 rRet
&= ((SfxPoolItem
&)aMirror
).PutValue(*pVMirror
, MID_MIRROR_VERT
);
639 sal_Bool
SwGraphicProperties_Impl::AnyToItemSet(
643 sal_Bool
& rSizeFound
)
645 //Properties fuer alle Frames
647 const ::uno::Any
*pStyleName
;
648 SwDocStyleSheet
* pStyle
= NULL
;
650 if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME
, 0, pStyleName
) )
653 *pStyleName
>>= sStyle
;
654 pStyle
= (SwDocStyleSheet
*)pDoc
->GetDocShell()->GetStyleSheetPool()->Find(sStyle
,
655 SFX_STYLE_FAMILY_FRAME
);
658 const ::uno::Any
* pHEvenMirror
= 0;
659 const ::uno::Any
* pHOddMirror
= 0;
660 const ::uno::Any
* pVMirror
= 0;
661 GetProperty(RES_GRFATR_MIRRORGRF
, MID_MIRROR_HORZ_EVEN_PAGES
, pHEvenMirror
);
662 GetProperty(RES_GRFATR_MIRRORGRF
, MID_MIRROR_HORZ_ODD_PAGES
, pHOddMirror
);
663 GetProperty(RES_GRFATR_MIRRORGRF
, MID_MIRROR_VERT
, pVMirror
);
667 rtl::Reference
< SwDocStyleSheet
> xStyle( new SwDocStyleSheet(*pStyle
) );
668 const :: SfxItemSet
*pItemSet
= &xStyle
->GetItemSet();
669 bRet
= FillBaseProperties(rFrmSet
, *pItemSet
, rSizeFound
);
670 lcl_FillMirror ( rGrSet
, *pItemSet
, pHEvenMirror
, pHOddMirror
, pVMirror
, bRet
);
674 const :: SfxItemSet
*pItemSet
= &pDoc
->GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC
)->GetAttrSet();
675 bRet
= FillBaseProperties(rFrmSet
, *pItemSet
, rSizeFound
);
676 lcl_FillMirror ( rGrSet
, *pItemSet
, pHEvenMirror
, pHOddMirror
, pVMirror
, bRet
);
680 static const :: USHORT nIDs
[] =
684 RES_GRFATR_LUMINANCE
,
691 RES_GRFATR_TRANSPARENCY
,
695 const ::uno::Any
* pAny
;
696 for(sal_Int16 nIndex
= 0; nIDs
[nIndex
]; nIndex
++)
698 BYTE nMId
= RES_GRFATR_CROPGRF
== nIDs
[nIndex
] ? CONVERT_TWIPS
: 0;
699 if(GetProperty(nIDs
[nIndex
], nMId
, pAny
))
701 SfxPoolItem
* pItem
= ::GetDfltAttr( nIDs
[nIndex
] )->Clone();
702 bRet
&= pItem
->PutValue(*pAny
, nMId
);
710 /* -----------------4/1/2003 13:54-------------------
712 --------------------------------------------------*/
714 class SwOLEProperties_Impl
: public SwFrameProperties_Impl
717 SwOLEProperties_Impl() :
718 SwFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_EMBEDDED_OBJECT)*/ ){}
719 virtual ~SwOLEProperties_Impl(){}
721 virtual sal_Bool
AnyToItemSet( SwDoc
* pDoc
, SfxItemSet
& rFrmSet
, SfxItemSet
& rSet
, sal_Bool
& rSizeFound
);
723 /* -----------------4/1/2003 15:32-------------------
725 --------------------------------------------------*/
727 sal_Bool
SwOLEProperties_Impl::AnyToItemSet(
728 SwDoc
* pDoc
, SfxItemSet
& rFrmSet
, SfxItemSet
& rSet
, sal_Bool
& rSizeFound
)
730 const ::uno::Any
* pTemp
;
731 if(!GetProperty(FN_UNO_CLSID
, 0, pTemp
) && !GetProperty(FN_UNO_STREAM_NAME
, 0, pTemp
) )
733 SwFrameProperties_Impl::AnyToItemSet( pDoc
, rFrmSet
, rSet
, rSizeFound
);
738 /******************************************************************
740 ******************************************************************/
741 /* -----------------------------10.03.00 18:02--------------------------------
743 ---------------------------------------------------------------------------*/
744 const :: uno::Sequence
< sal_Int8
> & SwXFrame::getUnoTunnelId()
746 static uno::Sequence
< sal_Int8
> aSeq
= ::CreateUnoTunnelId();
749 /* -----------------------------10.03.00 18:04--------------------------------
751 ---------------------------------------------------------------------------*/
752 sal_Int64 SAL_CALL
SwXFrame::getSomething( const :: uno::Sequence
< sal_Int8
>& rId
)
753 throw(uno::RuntimeException
)
755 if( rId
.getLength() == 16
756 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
757 rId
.getConstArray(), 16 ) )
759 return sal::static_int_cast
< sal_Int64
>( reinterpret_cast< sal_IntPtr
>(this) );
763 /*-----------------24.03.98 14:49-------------------
765 --------------------------------------------------*/
767 TYPEINIT1(SwXFrame
, SwClient
);
768 /* -----------------------------06.04.00 14:20--------------------------------
770 ---------------------------------------------------------------------------*/
771 OUString
SwXFrame::getImplementationName(void) throw( uno::RuntimeException
)
773 return C2U("SwXFrame");
775 /* -----------------------------06.04.00 14:20--------------------------------
777 ---------------------------------------------------------------------------*/
778 BOOL
SwXFrame::supportsService(const :: OUString
& rServiceName
) throw( uno::RuntimeException
)
780 return !rServiceName
.compareToAscii("com.sun.star.text.BaseFrame")||
781 !rServiceName
.compareToAscii("com.sun.star.text.TextContent") ||
782 !rServiceName
.compareToAscii("com.sun.star.document.LinkTarget");
784 /* -----------------------------06.04.00 14:20--------------------------------
786 ---------------------------------------------------------------------------*/
787 uno::Sequence
< OUString
> SwXFrame::getSupportedServiceNames(void) throw( uno::RuntimeException
)
789 uno::Sequence
< OUString
> aRet(3);
790 OUString
* pArray
= aRet
.getArray();
791 pArray
[0] = C2U("com.sun.star.text.BaseFrame");
792 pArray
[1] = C2U("com.sun.star.text.TextContent");
793 pArray
[2] = C2U("com.sun.star.document.LinkTarget");
798 /*-- 14.01.99 11:31:52---------------------------------------------------
799 Dieser CTor legt den Frame als Descriptor an
800 -----------------------------------------------------------------------*/
801 SwXFrame::SwXFrame(FlyCntType eSet
, const :: SfxItemPropertySet
* pSet
, SwDoc
*pDoc
) :
802 aLstnrCntnr( (container::XNamed
*)this),
806 bIsDescriptor(sal_True
),
809 // Register ourselves as a listener to the document (via the page descriptor)
810 pDoc
->GetPageDescFromPool(RES_POOLPAGE_STANDARD
)->Add(this);
811 // get the property set for the default style data
812 // First get the model
813 uno::Reference
< XModel
> xModel
= pDoc
->GetDocShell()->GetBaseModel();
814 // Ask the model for it's family supplier interface
815 uno::Reference
< XStyleFamiliesSupplier
> xFamilySupplier ( xModel
, uno::UNO_QUERY
);
816 // Get the style families
817 uno::Reference
< XNameAccess
> xFamilies
= xFamilySupplier
->getStyleFamilies();
818 // Get the Frame family (and keep it for later)
819 const ::uno::Any aAny
= xFamilies
->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "FrameStyles" ) ) );
820 aAny
>>= mxStyleFamily
;
821 // In the derived class, we'll ask mxStyleFamily for the relevant default style
822 // mxStyleFamily is initialised in the SwXFrame constructor
827 uno::Any aAny2
= mxStyleFamily
->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Frame" ) ) );
828 aAny2
>>= mxStyleData
;
829 pProps
= new SwFrameProperties_Impl( );
834 uno::Any aAny2
= mxStyleFamily
->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Graphics" ) ) );
835 aAny2
>>= mxStyleData
;
836 pProps
= new SwGraphicProperties_Impl( );
841 uno::Any aAny2
= mxStyleFamily
->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "OLE" ) ) );
842 aAny2
>>= mxStyleData
;
843 pProps
= new SwOLEProperties_Impl( );
852 /*-- 11.12.98 15:05:01---------------------------------------------------
854 -----------------------------------------------------------------------*/
855 SwXFrame::SwXFrame(SwFrmFmt
& rFrmFmt
, FlyCntType eSet
, const :: SfxItemPropertySet
* pSet
) :
856 SwClient( &rFrmFmt
),
857 aLstnrCntnr( (container::XNamed
*)this),
862 bIsDescriptor(sal_False
),
867 /*-- 11.12.98 15:05:02---------------------------------------------------
869 -----------------------------------------------------------------------*/
870 SwXFrame::~SwXFrame()
872 delete m_pCopySource
;
875 /*-- 11.12.98 15:05:03---------------------------------------------------
877 -----------------------------------------------------------------------*/
878 /*-- 11.12.98 15:05:03---------------------------------------------------
880 -----------------------------------------------------------------------*/
881 OUString
SwXFrame::getName(void) throw( uno::RuntimeException
)
883 vos::OGuard
aGuard(Application::GetSolarMutex());
885 SwFrmFmt
* pFmt
= GetFrmFmt();
887 sRet
= pFmt
->GetName();
888 else if(bIsDescriptor
)
891 throw uno::RuntimeException();
894 /*-- 11.12.98 15:05:03---------------------------------------------------
896 -----------------------------------------------------------------------*/
897 void SwXFrame::setName(const :: OUString
& rName
) throw( uno::RuntimeException
)
899 vos::OGuard
aGuard(Application::GetSolarMutex());
900 SwFrmFmt
* pFmt
= GetFrmFmt();
901 String
sTmpName(rName
);
904 pFmt
->GetDoc()->SetFlyName((SwFlyFrmFmt
&)*pFmt
, sTmpName
);
905 if(pFmt
->GetName() != sTmpName
)
907 throw uno::RuntimeException();
910 else if(bIsDescriptor
)
913 throw uno::RuntimeException();
915 /*-- 11.12.98 15:05:03---------------------------------------------------
917 -----------------------------------------------------------------------*/
918 uno::Reference
< beans::XPropertySetInfo
> SwXFrame::getPropertySetInfo(void) throw( uno::RuntimeException
)
920 uno::Reference
< beans::XPropertySetInfo
> xRef
;
921 static uno::Reference
< beans::XPropertySetInfo
> xFrmRef
;
922 static uno::Reference
< beans::XPropertySetInfo
> xGrfRef
;
923 static uno::Reference
< beans::XPropertySetInfo
> xOLERef
;
928 xFrmRef
= m_pPropSet
->getPropertySetInfo();
933 xGrfRef
= m_pPropSet
->getPropertySetInfo();
938 xOLERef
= m_pPropSet
->getPropertySetInfo();
946 /*-- 15.05.06 12:21:43---------------------------------------------------
948 -----------------------------------------------------------------------*/
949 void SwXFrame::SetSelection(SwPaM
& rCopySource
)
952 delete m_pCopySource
;
953 m_pCopySource
= new SwPaM( *rCopySource
.Start() );
954 m_pCopySource
->SetMark();
955 *m_pCopySource
->GetMark() = *rCopySource
.End();
957 /*-- 11.12.98 15:05:04---------------------------------------------------
959 -----------------------------------------------------------------------*/
961 SdrObject
*SwXFrame::GetOrCreateSdrObject( SwFlyFrmFmt
*pFmt
)
963 SdrObject
* pObject
= pFmt
->FindSdrObject();
966 SwDoc
*pDoc
= pFmt
->GetDoc();
967 // --> OD 2005-08-08 #i52858# - method name changed
968 SdrModel
*pDrawModel
= pDoc
->GetOrCreateDrawModel();
970 SwFlyDrawContact
* pContactObject
971 = new SwFlyDrawContact( pFmt
, pDrawModel
);
972 pObject
= pContactObject
->GetMaster();
974 const :: SwFmtSurround
& rSurround
= pFmt
->GetSurround();
976 ( SURROUND_THROUGHT
== rSurround
.GetSurround() &&
977 !pFmt
->GetOpaque().GetValue() ) ? pDoc
->GetHellId()
978 : pDoc
->GetHeavenId() );
980 pDrawModel
->GetPage(0)->InsertObject( pObject
);
986 SwFrmFmt
*lcl_GetFrmFmt( const :: uno::Any
& rValue
, SwDoc
*pDoc
)
989 SwDocShell
* pDocSh
= pDoc
->GetDocShell();
995 SwStyleNameMapper::FillUIName(String (uTemp
), sStyle
, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT
, sal_True
);
996 SwDocStyleSheet
* pStyle
=
997 (SwDocStyleSheet
*)pDocSh
->GetStyleSheetPool()->Find(sStyle
,
998 SFX_STYLE_FAMILY_FRAME
);
1000 pRet
= pStyle
->GetFrmFmt();
1006 void SwXFrame::setPropertyValue(const :: OUString
& rPropertyName
, const :: uno::Any
& aValue
)
1007 throw( beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
1009 vos::OGuard
aGuard(Application::GetSolarMutex());
1010 SwFrmFmt
* pFmt
= GetFrmFmt();
1011 const :: SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName(rPropertyName
);
1014 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
1018 sal_Bool bNextFrame
= sal_False
;
1019 if ( pEntry
->nFlags
& beans::PropertyAttribute::READONLY
)
1020 throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
1022 SwDoc
* pDoc
= pFmt
->GetDoc();
1023 if ((eType
== FLYCNTTYPE_GRF
) && isGRFATR(pEntry
->nWID
) ||
1024 (FN_PARAM_COUNTOUR_PP
== pEntry
->nWID
) ||
1025 (FN_UNO_IS_AUTOMATIC_CONTOUR
== pEntry
->nWID
) ||
1026 (FN_UNO_IS_PIXEL_CONTOUR
== pEntry
->nWID
) )
1028 const :: SwNodeIndex
* pIdx
= pFmt
->GetCntnt().GetCntntIdx();
1031 SwNodeIndex
aIdx(*pIdx
, 1);
1032 SwNoTxtNode
* pNoTxt
= aIdx
.GetNode().GetNoTxtNode();
1033 if(pEntry
->nWID
== FN_PARAM_COUNTOUR_PP
)
1035 drawing::PointSequenceSequence aParam
;
1036 if(!aValue
.hasValue())
1037 pNoTxt
->SetContour(0);
1038 else if(aValue
>>= aParam
)
1040 PolyPolygon
aPoly((USHORT
)aParam
.getLength());
1041 for(sal_Int32 i
= 0; i
< aParam
.getLength(); i
++)
1043 const :: drawing::PointSequence
* pPointSeq
= aParam
.getConstArray();
1044 sal_Int32 nPoints
= pPointSeq
[i
].getLength();
1045 const :: awt::Point
* pPoints
= pPointSeq
[i
].getConstArray();
1046 Polygon
aSet( (USHORT
)nPoints
);
1047 for(sal_Int32 j
= 0; j
< nPoints
; j
++)
1049 Point
aPoint(pPoints
[j
].X
, pPoints
[j
].Y
);
1050 aSet
.SetPoint(aPoint
, (USHORT
)j
);
1052 // Close polygon if it isn't closed already.
1053 aSet
.Optimize( POLY_OPTIMIZE_CLOSE
);
1054 aPoly
.Insert( aSet
);
1056 pNoTxt
->SetContourAPI( &aPoly
);
1059 throw lang::IllegalArgumentException();
1061 else if(pEntry
->nWID
== FN_UNO_IS_AUTOMATIC_CONTOUR
)
1063 pNoTxt
->SetAutomaticContour( *(sal_Bool
*)aValue
.getValue() );
1065 else if(pEntry
->nWID
== FN_UNO_IS_PIXEL_CONTOUR
)
1067 // The IsPixelContour property can only be set if there
1068 // is no contour, or if the contour has been set by the
1069 // API itself (or in other words, if the contour isn't
1071 if( !pNoTxt
->_HasContour() ||
1072 !pNoTxt
->IsContourMapModeValid() )
1073 pNoTxt
->SetPixelContour( *(sal_Bool
*)aValue
.getValue() );
1075 throw lang::IllegalArgumentException();
1079 SfxItemSet
aSet(pNoTxt
->GetSwAttrSet());
1080 m_pPropSet
->setPropertyValue(*pEntry
, aValue
, aSet
);
1081 pNoTxt
->SetAttr(aSet
);
1085 // --> OD 2009-07-13 #i73249#
1086 // Attribute AlternativeText was never published.
1087 // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
1088 // else if( FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID && eType != FLYCNTTYPE_FRM )
1090 // const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1093 // SwNodeIndex aIdx(*pIdx, 1);
1094 // SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1096 // aValue >>= uTemp;
1097 // pNoTxt->SetAlternateText(uTemp);
1100 // New attribute Title
1101 else if( FN_UNO_TITLE
== pEntry
->nWID
)
1103 SwFlyFrmFmt
* pFlyFmt
= dynamic_cast<SwFlyFrmFmt
*>(pFmt
);
1105 "unexpected type of <pFmt> --> crash" );
1108 const String
sTitle(uTemp
);
1109 // assure that <SdrObject> instance exists.
1110 GetOrCreateSdrObject( pFlyFmt
);
1111 pFlyFmt
->GetDoc()->SetFlyFrmTitle( *(pFlyFmt
), sTitle
);
1113 // New attribute Description
1114 else if( FN_UNO_DESCRIPTION
== pEntry
->nWID
)
1116 SwFlyFrmFmt
* pFlyFmt
= dynamic_cast<SwFlyFrmFmt
*>(pFmt
);
1118 "unexpected type of <pFmt> --> crash" );
1121 const String
sDescription(uTemp
);
1122 // assure that <SdrObject> instance exists.
1123 GetOrCreateSdrObject( pFlyFmt
);
1124 pFlyFmt
->GetDoc()->SetFlyFrmDescription( *(pFlyFmt
), sDescription
);
1127 else if(FN_UNO_FRAME_STYLE_NAME
== pEntry
->nWID
)
1129 SwFrmFmt
*pFrmFmt
= lcl_GetFrmFmt( aValue
, pFmt
->GetDoc() );
1132 UnoActionContext
aAction(pFmt
->GetDoc());
1134 SfxItemSet
* pSet
= 0;
1135 // --> OD 2004-08-13 #i31771#, #i25798# - No adjustment of
1136 // anchor ( no call of method <::lcl_ChkAndSetNewAnchor(..)> ),
1137 // if document is currently in reading mode.
1138 if ( !pFmt
->GetDoc()->IsInReading() )
1140 // see SwFEShell::SetFrmFmt( SwFrmFmt *pNewFmt, sal_Bool bKeepOrient, Point* pDocPos )
1143 const :: SwFrmFmt
* pFmtXX
= pFmt
;
1144 if (PTR_CAST(SwFlyFrmFmt
, pFmtXX
))
1145 pFly
= ((SwFlyFrmFmt
*)pFmtXX
)->GetFrm();
1149 const :: SfxPoolItem
* pItem
;
1150 if( SFX_ITEM_SET
== pFrmFmt
->GetItemState( RES_ANCHOR
, sal_False
, &pItem
))
1152 pSet
= new SfxItemSet( pDoc
->GetAttrPool(), aFrmFmtSetRange
);
1153 pSet
->Put( *pItem
);
1154 if ( !::lcl_ChkAndSetNewAnchor( *pFly
, *pSet
) )
1155 delete pSet
, pSet
= 0;
1161 pFmt
->GetDoc()->SetFrmFmtToFly( *pFmt
, *pFrmFmt
, pSet
, FALSE
);
1165 throw lang::IllegalArgumentException();
1167 else if( FN_UNO_GRAPHIC_U_R_L
== pEntry
->nWID
||
1168 FN_UNO_GRAPHIC_FILTER
== pEntry
->nWID
)
1170 String sGrfName
, sFltName
;
1171 GraphicObject
*pGrfObj
= 0;
1172 pFmt
->GetDoc()->GetGrfNms( *(SwFlyFrmFmt
*)pFmt
, &sGrfName
, &sFltName
);
1176 UnoActionContext
aAction(pFmt
->GetDoc());
1177 if(FN_UNO_GRAPHIC_U_R_L
== pEntry
->nWID
)
1179 if( sTmp
.EqualsAscii( sPackageProtocol
,
1180 0, sizeof( sPackageProtocol
)-1 ) )
1182 pGrfObj
= new GraphicObject
;
1183 pGrfObj
->SetUserData( sTmp
);
1184 pGrfObj
->SetSwapState();
1187 else if( sTmp
.EqualsAscii( sGraphicObjectProtocol
,
1188 0, sizeof(sGraphicObjectProtocol
)-1 ) )
1190 ByteString
sId( sTmp
.Copy(sizeof(sGraphicObjectProtocol
)-1),
1191 RTL_TEXTENCODING_ASCII_US
);
1192 pGrfObj
= new GraphicObject( sId
);
1205 const :: SwNodeIndex
* pIdx
= pFmt
->GetCntnt().GetCntntIdx();
1208 SwNodeIndex
aIdx(*pIdx
, 1);
1209 // SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1210 SwGrfNode
* pGrfNode
= aIdx
.GetNode().GetGrfNode();
1214 throw uno::RuntimeException();
1216 SwPaM
aGrfPaM(*pGrfNode
);
1217 pFmt
->GetDoc()->ReRead( aGrfPaM
, sGrfName
, sFltName
, 0,
1222 else if( FN_UNO_GRAPHIC
== pEntry
->nWID
)
1224 uno::Reference
< graphic::XGraphic
> xGraphic
;
1225 aValue
>>= xGraphic
;
1228 const :: SwNodeIndex
* pIdx
= pFmt
->GetCntnt().GetCntntIdx();
1231 SwNodeIndex
aIdx(*pIdx
, 1);
1232 SwGrfNode
* pGrfNode
= aIdx
.GetNode().GetGrfNode();
1235 throw uno::RuntimeException();
1237 SwPaM
aGrfPaM(*pGrfNode
);
1238 Graphic
aGraphic( xGraphic
);
1239 pFmt
->GetDoc()->ReRead( aGrfPaM
, String(), String(), &aGraphic
, 0 );
1243 else if( FN_UNO_REPLACEMENT_GRAPHIC_URL
== pEntry
->nWID
|| FN_UNO_REPLACEMENT_GRAPHIC
== pEntry
->nWID
)
1245 bool bURL
= FN_UNO_REPLACEMENT_GRAPHIC_URL
== pEntry
->nWID
;
1246 bool bApply
= false;
1250 GraphicObject
*pGrfObj
= 0;
1254 // the package URL based graphics are handled in different way currently
1255 // TODO/LATER: actually this is the correct place to handle them
1256 ::rtl::OUString
aGraphicProtocol( RTL_CONSTASCII_USTRINGPARAM( sGraphicObjectProtocol
) );
1257 if( aGrfUrl
.compareTo( aGraphicProtocol
, aGraphicProtocol
.getLength() ) == 0 )
1259 ByteString
sId( aGrfUrl
.copy(sizeof(sGraphicObjectProtocol
)-1).getStr(), RTL_TEXTENCODING_ASCII_US
);
1260 pGrfObj
= new GraphicObject( sId
);
1261 aGraphic
= pGrfObj
->GetGraphic();
1267 uno::Reference
< graphic::XGraphic
> xGraphic
;
1268 aValue
>>= xGraphic
;
1271 aGraphic
= Graphic( xGraphic
);
1278 const :: SwFmtCntnt
* pCnt
= &pFmt
->GetCntnt();
1279 if ( pCnt
->GetCntntIdx() && pDoc
->GetNodes()[ pCnt
->GetCntntIdx()->GetIndex() + 1 ] )
1281 SwOLENode
* pOleNode
= pDoc
->GetNodes()[ pCnt
->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode();
1285 svt::EmbeddedObjectRef xObj
= pOleNode
->GetOLEObj().GetObject();
1287 ::rtl::OUString aMediaType
;
1288 xObj
.SetGraphic( aGraphic
, aMediaType
);
1293 else if(0 != (bNextFrame
= (rPropertyName
.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_NEXT_NAME
))))
1294 || rPropertyName
.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_PREV_NAME
)))
1298 String
sChainName(uTemp
);
1299 if(!sChainName
.Len())
1302 pDoc
->Unchain(*pFmt
);
1305 SwFmtChain
aChain( pFmt
->GetChain() );
1306 SwFrmFmt
*pPrev
= aChain
.GetPrev();
1308 pDoc
->Unchain(*pPrev
);
1313 sal_uInt16 nCount
= pDoc
->GetFlyCount(FLYCNTTYPE_FRM
);
1315 SwFrmFmt
* pChain
= 0;
1316 for( sal_uInt16 i
= 0; i
< nCount
; i
++)
1318 SwFrmFmt
* pFmt2
= pDoc
->GetFlyNum(i
, FLYCNTTYPE_FRM
);
1319 if(sChainName
== pFmt2
->GetName() )
1327 SwFrmFmt
* pSource
= bNextFrame
? pFmt
: pChain
;
1328 SwFrmFmt
* pDest
= bNextFrame
? pChain
: pFmt
;
1329 pDoc
->Chain(*pSource
, *pDest
);
1333 else if(FN_UNO_Z_ORDER
== pEntry
->nWID
)
1335 sal_Int32 nZOrder
= - 1;
1339 SdrObject
* pObject
=
1340 GetOrCreateSdrObject( (SwFlyFrmFmt
*)pFmt
);
1341 SdrModel
*pDrawModel
= pDoc
->GetDrawModel();
1342 pDrawModel
->GetPage(0)->
1343 SetObjectOrdNum(pObject
->GetOrdNum(), nZOrder
);
1346 else if(RES_ANCHOR
== pEntry
->nWID
&& MID_ANCHOR_ANCHORFRAME
== pEntry
->nMemberId
)
1348 sal_Bool bDone
= sal_False
;
1349 uno::Reference
<text::XTextFrame
> xFrame
;
1350 if(aValue
>>= xFrame
)
1352 uno::Reference
<lang::XUnoTunnel
> xTunnel(xFrame
, uno::UNO_QUERY
);
1353 SwXFrame
* pFrame
= xTunnel
.is() ?
1354 reinterpret_cast< SwXFrame
* >( sal::static_int_cast
< sal_IntPtr
>( xTunnel
->getSomething(SwXFrame::getUnoTunnelId()) ))
1356 if(pFrame
&& this != pFrame
&& pFrame
->GetFrmFmt() && pFrame
->GetFrmFmt()->GetDoc() == pDoc
)
1358 SfxItemSet
aSet( pDoc
->GetAttrPool(),
1359 RES_FRMATR_BEGIN
, RES_FRMATR_END
- 1 );
1360 aSet
.SetParent(&pFmt
->GetAttrSet());
1361 SwFmtAnchor aAnchor
= (const :: SwFmtAnchor
&)aSet
.Get(pEntry
->nWID
);
1364 SwPosition
aPos(*pFrame
->GetFrmFmt()->GetCntnt().GetCntntIdx());
1365 aAnchor
.SetAnchor(&aPos
);
1366 aAnchor
.SetType(FLY_AT_FLY
);
1368 pDoc
->SetFlyFrmAttr( *pFmt
, aSet
);
1373 throw lang::IllegalArgumentException();
1377 SfxItemSet
aSet( pDoc
->GetAttrPool(),
1378 RES_FRMATR_BEGIN
, RES_FRMATR_END
- 1,
1379 RES_UNKNOWNATR_CONTAINER
, RES_UNKNOWNATR_CONTAINER
,
1382 aSet
.SetParent(&pFmt
->GetAttrSet());
1383 m_pPropSet
->setPropertyValue(*pEntry
, aValue
, aSet
);
1384 if(RES_ANCHOR
== pEntry
->nWID
&& MID_ANCHOR_ANCHORTYPE
== pEntry
->nMemberId
)
1386 SwFmtAnchor aAnchor
= (const :: SwFmtAnchor
&)aSet
.Get(pEntry
->nWID
);
1387 if(aAnchor
.GetAnchorId() == FLY_AT_FLY
)
1389 const :: SwPosition
* pPosition
= aAnchor
.GetCntntAnchor();
1390 SwFrmFmt
* pFlyFmt
= pPosition
? pPosition
->nNode
.GetNode().GetFlyFmt() : 0;
1391 if(!pFlyFmt
|| pFlyFmt
->Which() == RES_DRAWFRMFMT
)
1393 lang::IllegalArgumentException aExcept
;
1394 aExcept
.Message
= C2U("Anchor to frame: no frame found");
1399 SwPosition aPos
= *pPosition
;
1400 aPos
.nNode
= *pFlyFmt
->GetCntnt().GetCntntIdx();
1401 aAnchor
.SetAnchor(&aPos
);
1405 else if(aAnchor
.GetAnchorId() != FLY_PAGE
&& !aAnchor
.GetCntntAnchor())
1407 SwNode
& rNode
= pDoc
->GetNodes().GetEndOfContent();
1409 aPam
.Move( fnMoveBackward
, fnGoDoc
);
1410 aAnchor
.SetAnchor( aPam
.Start() );
1414 // --> OD 2004-08-13 #i31771#, #i25798# - No adjustment of
1415 // anchor ( no call of method <::lcl_ChkAndSetNewAnchor(..)> ),
1416 // if document is currently in reading mode.
1417 if ( !pFmt
->GetDoc()->IsInReading() )
1419 // see SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet )
1421 if (PTR_CAST(SwFlyFrmFmt
, pFmt
))
1422 pFly
= ((SwFlyFrmFmt
*)pFmt
)->GetFrm();
1425 const :: SfxPoolItem
* pItem
;
1426 if( SFX_ITEM_SET
== aSet
.GetItemState( RES_ANCHOR
, sal_False
, &pItem
))
1429 ::lcl_ChkAndSetNewAnchor( *pFly
, aSet
);
1435 pFmt
->GetDoc()->SetFlyFrmAttr( *pFmt
, aSet
);
1437 else if(FN_UNO_CLSID
== pEntry
->nWID
|| FN_UNO_STREAM_NAME
== pEntry
->nWID
)
1439 throw lang::IllegalArgumentException();
1442 pFmt
->SetFmtAttr(aSet
);
1445 else if(IsDescriptor())
1447 pProps
->SetProperty(pEntry
->nWID
, pEntry
->nMemberId
, aValue
);
1448 if( FN_UNO_FRAME_STYLE_NAME
== pEntry
->nWID
)
1450 OUString sStyleName
;
1451 aValue
>>= sStyleName
;
1454 uno::Any aAny
= mxStyleFamily
->getByName ( sStyleName
);
1455 aAny
>>= mxStyleData
;
1457 catch ( container::NoSuchElementException
const & )
1460 catch ( lang::WrappedTargetException
const & )
1463 catch ( uno::RuntimeException
const & )
1469 throw uno::RuntimeException();
1471 /*-- 11.12.98 15:05:04---------------------------------------------------
1473 -----------------------------------------------------------------------*/
1474 uno::Any
SwXFrame::getPropertyValue(const OUString
& rPropertyName
)
1475 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1477 vos::OGuard
aGuard(Application::GetSolarMutex());
1479 SwFrmFmt
* pFmt
= GetFrmFmt();
1480 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName(rPropertyName
);
1482 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
1484 if(FN_UNO_ANCHOR_TYPES
== pEntry
->nWID
)
1486 uno::Sequence
<text::TextContentAnchorType
> aTypes(5);
1487 text::TextContentAnchorType
* pArray
= aTypes
.getArray();
1488 pArray
[0] = text::TextContentAnchorType_AT_PARAGRAPH
;
1489 pArray
[1] = text::TextContentAnchorType_AS_CHARACTER
;
1490 pArray
[2] = text::TextContentAnchorType_AT_PAGE
;
1491 pArray
[3] = text::TextContentAnchorType_AT_FRAME
;
1492 pArray
[4] = text::TextContentAnchorType_AT_CHARACTER
;
1493 aAny
.setValue(&aTypes
, ::getCppuType(static_cast<uno::Sequence
<text::TextContentAnchorType
>*>(0)));
1497 if( ((eType
== FLYCNTTYPE_GRF
) || (eType
== FLYCNTTYPE_OLE
)) &&
1499 (isGRFATR(pEntry
->nWID
) ||
1500 pEntry
->nWID
== FN_PARAM_COUNTOUR_PP
||
1501 pEntry
->nWID
== FN_UNO_IS_AUTOMATIC_CONTOUR
||
1502 pEntry
->nWID
== FN_UNO_IS_PIXEL_CONTOUR
))
1504 const SwNodeIndex
* pIdx
= pFmt
->GetCntnt().GetCntntIdx();
1507 SwNodeIndex
aIdx(*pIdx
, 1);
1508 SwNoTxtNode
* pNoTxt
= aIdx
.GetNode().GetNoTxtNode();
1509 if(pEntry
->nWID
== FN_PARAM_COUNTOUR_PP
)
1511 PolyPolygon aContour
;
1512 if( pNoTxt
->GetContourAPI( aContour
) )
1514 drawing::PointSequenceSequence
aPtSeq(aContour
.Count());
1515 drawing::PointSequence
* pPSeq
= aPtSeq
.getArray();
1516 for(USHORT i
= 0; i
< aContour
.Count(); i
++)
1518 const Polygon
& rPoly
= aContour
.GetObject(i
);
1519 pPSeq
[i
].realloc(rPoly
.GetSize());
1520 awt::Point
* pPoints
= pPSeq
[i
].getArray();
1521 for(USHORT j
= 0; j
< rPoly
.GetSize(); j
++)
1523 const Point
& rPoint
= rPoly
.GetPoint(j
);
1524 pPoints
[j
].X
= rPoint
.X();
1525 pPoints
[j
].Y
= rPoint
.Y();
1531 else if(pEntry
->nWID
== FN_UNO_IS_AUTOMATIC_CONTOUR
)
1533 BOOL bValue
= pNoTxt
->HasAutomaticContour();
1534 aAny
.setValue( &bValue
, ::getBooleanCppuType() );
1536 else if(pEntry
->nWID
== FN_UNO_IS_PIXEL_CONTOUR
)
1538 BOOL bValue
= pNoTxt
->IsPixelContour();
1539 aAny
.setValue( &bValue
, ::getBooleanCppuType() );
1543 SfxItemSet
aSet(pNoTxt
->GetSwAttrSet());
1544 m_pPropSet
->getPropertyValue(*pEntry
, aSet
, aAny
);
1548 else if( FN_UNO_GRAPHIC_U_R_L
== pEntry
->nWID
)
1551 const SwNodeIndex
* pIdx
= pFmt
->GetCntnt().GetCntntIdx();
1554 SwNodeIndex
aIdx(*pIdx
, 1);
1555 // SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1556 SwGrfNode
* pGrfNode
= aIdx
.GetNode().GetGrfNode();
1558 throw uno::RuntimeException();
1559 if( pGrfNode
->IsGrfLink() )
1561 pFmt
->GetDoc()->GetGrfNms( *(SwFlyFrmFmt
*)pFmt
, &sGrfName
, 0 );
1565 String
sPrefix( RTL_CONSTASCII_STRINGPARAM(sGraphicObjectProtocol
) );
1566 String
sId( pGrfNode
->GetGrfObj().GetUniqueID(),
1567 RTL_TEXTENCODING_ASCII_US
);
1568 (sGrfName
= sPrefix
) += sId
;
1571 aAny
<<= OUString(sGrfName
);
1573 else if( FN_UNO_GRAPHIC_FILTER
== pEntry
->nWID
)
1576 pFmt
->GetDoc()->GetGrfNms( *(SwFlyFrmFmt
*)pFmt
, 0, &sFltName
);
1577 aAny
<<= OUString(sFltName
);
1579 else if( FN_UNO_GRAPHIC
== pEntry
->nWID
)
1581 const SwNodeIndex
* pIdx
= pFmt
->GetCntnt().GetCntntIdx();
1584 SwNodeIndex
aIdx(*pIdx
, 1);
1585 SwGrfNode
* pGrfNode
= aIdx
.GetNode().GetGrfNode();
1587 throw uno::RuntimeException();
1588 aAny
<<= pGrfNode
->GetGrf().GetXGraphic();
1591 else if(FN_UNO_FRAME_STYLE_NAME
== pEntry
->nWID
)
1593 aAny
<<= OUString(SwStyleNameMapper::GetProgName(pFmt
->DerivedFrom()->GetName(), nsSwGetPoolIdFromName::GET_POOLID_FRMFMT
) );
1595 // --> OD 2009-07-13 #i73249#
1596 // Attribute AlternativeText was never published.
1597 // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
1598 // else if(eType != FLYCNTTYPE_FRM &&
1599 // FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
1601 // const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1604 // SwNodeIndex aIdx(*pIdx, 1);
1605 // SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1606 // aAny <<= OUString(pNoTxt->GetAlternateText());
1609 else if( FN_UNO_TITLE
== pEntry
->nWID
)
1611 SwFlyFrmFmt
* pFlyFmt
= dynamic_cast<SwFlyFrmFmt
*>(pFmt
);
1613 "unexpected type of <pFmt> --> crash" );
1614 // assure that <SdrObject> instance exists.
1615 GetOrCreateSdrObject( pFlyFmt
);
1616 aAny
<<= OUString(pFlyFmt
->GetObjTitle());
1618 // New attribute Description
1619 else if( FN_UNO_DESCRIPTION
== pEntry
->nWID
)
1621 SwFlyFrmFmt
* pFlyFmt
= dynamic_cast<SwFlyFrmFmt
*>(pFmt
);
1623 "unexpected type of <pFmt> --> crash" );
1624 // assure that <SdrObject> instance exists.
1625 GetOrCreateSdrObject( pFlyFmt
);
1626 aAny
<<= OUString(pFlyFmt
->GetObjDescription());
1629 else if(eType
== FLYCNTTYPE_GRF
&&
1630 (rPropertyName
.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ACTUAL_SIZE
))))
1632 const SwNodeIndex
* pIdx
= pFmt
->GetCntnt().GetCntntIdx();
1635 SwNodeIndex
aIdx(*pIdx
, 1);
1636 SwNoTxtNode
* pNoTxt
= aIdx
.GetNode().GetNoTxtNode();
1637 Size aActSize
= ((SwGrfNode
*)pNoTxt
)->GetTwipSize();
1639 aTmp
.Width
= TWIP_TO_MM100(aActSize
.Width());
1640 aTmp
.Height
= TWIP_TO_MM100(aActSize
.Height());
1641 aAny
.setValue(&aTmp
, ::getCppuType(static_cast<const awt::Size
*>(0)));
1644 else if(FN_PARAM_LINK_DISPLAY_NAME
== pEntry
->nWID
)
1646 aAny
<<= OUString(pFmt
->GetName());
1648 else if(FN_UNO_Z_ORDER
== pEntry
->nWID
)
1650 const SdrObject
* pObj
= pFmt
->FindRealSdrObject();
1653 aAny
<<= (sal_Int32
)pObj
->GetOrdNum();
1656 else if(FN_UNO_CLSID
== pEntry
->nWID
|| FN_UNO_MODEL
== pEntry
->nWID
||
1657 FN_UNO_COMPONENT
== pEntry
->nWID
||FN_UNO_STREAM_NAME
== pEntry
->nWID
)
1659 SwDoc
* pDoc
= pFmt
->GetDoc();
1660 const SwFmtCntnt
* pCnt
= &pFmt
->GetCntnt();
1661 DBG_ASSERT( pCnt
->GetCntntIdx() &&
1662 pDoc
->GetNodes()[ pCnt
->GetCntntIdx()->
1663 GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
1665 SwOLENode
* pOleNode
= pDoc
->GetNodes()[ pCnt
->GetCntntIdx()
1666 ->GetIndex() + 1 ]->GetOLENode();
1667 uno::Reference
< embed::XEmbeddedObject
> xIP
= pOleNode
->GetOLEObj().GetOleRef();
1670 SvGlobalName
aClassName( xIP
->getClassID() );
1671 aHexCLSID
= aClassName
.GetHexName();
1672 if(FN_UNO_CLSID
!= pEntry
->nWID
)
1674 if ( svt::EmbeddedObjectRef::TryRunningState( xIP
) )
1676 uno::Reference
< lang::XComponent
> xComp( xIP
->getComponent(), uno::UNO_QUERY
);
1677 uno::Reference
< frame::XModel
> xModel( xComp
, uno::UNO_QUERY
);
1680 else if ( FN_UNO_COMPONENT
== pEntry
->nWID
)
1686 if(FN_UNO_CLSID
== pEntry
->nWID
)
1688 else if(FN_UNO_STREAM_NAME
== pEntry
->nWID
)
1690 aAny
<<= ::rtl::OUString(pOleNode
->GetOLEObj().GetCurrentPersistName());
1693 else if(WID_LAYOUT_SIZE
== pEntry
->nWID
)
1695 // format document completely in order to get correct value
1696 pFmt
->GetDoc()->GetEditShell()->CalcLayout();
1698 SwClientIter
aIter( *pFmt
);
1699 SwClient
* pC
= aIter
.First( TYPE( SwFrm
) );
1702 SwFrm
*pTmpFrm
= static_cast< SwFrm
* >(pC
);
1703 DBG_ASSERT( pTmpFrm
->IsValid(), "frame not valid" );
1704 const SwRect
&rRect
= pTmpFrm
->Frm();
1705 Size aMM100Size
= OutputDevice::LogicToLogic(
1706 Size( rRect
.Width(), rRect
.Height() ),
1707 MapMode( MAP_TWIP
), MapMode( MAP_100TH_MM
));
1708 aAny
<<= awt::Size( aMM100Size
.Width(), aMM100Size
.Height() );
1713 const SwAttrSet
& rSet
= pFmt
->GetAttrSet();
1714 m_pPropSet
->getPropertyValue(*pEntry
, rSet
, aAny
);
1717 else if(IsDescriptor())
1720 throw uno::RuntimeException();
1721 if(WID_LAYOUT_SIZE
!= pEntry
->nWID
) // there is no LayoutSize in a descriptor
1723 const uno::Any
* pAny
= 0;
1724 if( !pProps
->GetProperty( pEntry
->nWID
, pEntry
->nMemberId
, pAny
) )
1725 aAny
= mxStyleData
->getPropertyValue( rPropertyName
);
1731 throw uno::RuntimeException();
1734 /*-- 11.12.98 15:05:04---------------------------------------------------
1736 -----------------------------------------------------------------------*/
1737 void SwXFrame::addPropertyChangeListener(const OUString
& /*PropertyName*/,
1738 const uno::Reference
< beans::XPropertyChangeListener
> & /*aListener*/)
1739 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1741 DBG_WARNING("not implemented");
1743 /*-- 11.12.98 15:05:05---------------------------------------------------
1745 -----------------------------------------------------------------------*/
1746 void SwXFrame::removePropertyChangeListener(const OUString
& /*PropertyName*/,
1747 const uno::Reference
< beans::XPropertyChangeListener
> & /*aListener*/)
1748 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1750 DBG_WARNING("not implemented");
1752 /*-- 11.12.98 15:05:05---------------------------------------------------
1754 -----------------------------------------------------------------------*/
1755 void SwXFrame::addVetoableChangeListener(const OUString
& /*PropertyName*/,
1756 const uno::Reference
< beans::XVetoableChangeListener
> & /*aListener*/)
1757 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1759 DBG_WARNING("not implemented");
1761 /*-- 11.12.98 15:05:05---------------------------------------------------
1763 -----------------------------------------------------------------------*/
1764 void SwXFrame::removeVetoableChangeListener(
1765 const OUString
& /*PropertyName*/, const uno::Reference
< beans::XVetoableChangeListener
> & /*aListener*/)
1766 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1768 DBG_WARNING("not implemented");
1770 /*-- 12.09.00 14:04:53---------------------------------------------------
1772 -----------------------------------------------------------------------*/
1773 beans::PropertyState
SwXFrame::getPropertyState( const OUString
& rPropertyName
)
1774 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
1776 vos::OGuard
aGuard(Application::GetSolarMutex());
1777 uno::Sequence
< OUString
> aPropertyNames(1);
1778 OUString
* pNames
= aPropertyNames
.getArray();
1779 pNames
[0] = rPropertyName
;
1780 uno::Sequence
< beans::PropertyState
> aStates
= getPropertyStates(aPropertyNames
);
1781 return aStates
.getConstArray()[0];
1783 /*-- 12.09.00 14:04:54---------------------------------------------------
1785 -----------------------------------------------------------------------*/
1786 uno::Sequence
< beans::PropertyState
> SwXFrame::getPropertyStates(
1787 const uno::Sequence
< OUString
>& aPropertyNames
)
1788 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
1790 vos::OGuard
aGuard(Application::GetSolarMutex());
1791 uno::Sequence
< beans::PropertyState
> aStates(aPropertyNames
.getLength());
1792 beans::PropertyState
* pStates
= aStates
.getArray();
1793 SwFrmFmt
* pFmt
= GetFrmFmt();
1796 const OUString
* pNames
= aPropertyNames
.getConstArray();
1797 const SwAttrSet
& rFmtSet
= pFmt
->GetAttrSet();
1798 for(int i
= 0; i
< aPropertyNames
.getLength(); i
++)
1800 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName(pNames
[i
]);
1802 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames
[i
], static_cast < cppu::OWeakObject
* > ( this ) );
1804 if(pEntry
->nWID
== FN_UNO_ANCHOR_TYPES
||
1805 pEntry
->nWID
== FN_PARAM_LINK_DISPLAY_NAME
||
1806 FN_UNO_FRAME_STYLE_NAME
== pEntry
->nWID
||
1807 FN_UNO_GRAPHIC_U_R_L
== pEntry
->nWID
||
1808 FN_UNO_GRAPHIC_FILTER
== pEntry
->nWID
||
1809 FN_UNO_ACTUAL_SIZE
== pEntry
->nWID
||
1810 FN_UNO_ALTERNATIVE_TEXT
== pEntry
->nWID
)
1812 pStates
[i
] = beans::PropertyState_DIRECT_VALUE
;
1816 if ((eType
== FLYCNTTYPE_GRF
) &&
1817 pEntry
&& isGRFATR(pEntry
->nWID
))
1819 const SwNodeIndex
* pIdx
= pFmt
->GetCntnt().GetCntntIdx();
1822 SwNodeIndex
aIdx(*pIdx
, 1);
1823 SwNoTxtNode
* pNoTxt
= aIdx
.GetNode().GetNoTxtNode();
1824 SfxItemSet
aSet(pNoTxt
->GetSwAttrSet());
1825 aSet
.GetItemState(pEntry
->nWID
);
1826 if(SFX_ITEM_SET
== aSet
.GetItemState( pEntry
->nWID
, FALSE
))
1827 pStates
[i
] = beans::PropertyState_DIRECT_VALUE
;
1832 if(SFX_ITEM_SET
== rFmtSet
.GetItemState( pEntry
->nWID
, FALSE
))
1833 pStates
[i
] = beans::PropertyState_DIRECT_VALUE
;
1835 pStates
[i
] = beans::PropertyState_DEFAULT_VALUE
;
1840 else if(IsDescriptor())
1842 for(int i
= 0; i
< aPropertyNames
.getLength(); i
++)
1843 pStates
[i
] = beans::PropertyState_DIRECT_VALUE
;
1846 throw uno::RuntimeException();
1849 /*-- 12.09.00 14:04:54---------------------------------------------------
1851 -----------------------------------------------------------------------*/
1852 void SwXFrame::setPropertyToDefault( const OUString
& rPropertyName
)
1853 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
1855 vos::OGuard
aGuard(Application::GetSolarMutex());
1856 SwFrmFmt
* pFmt
= GetFrmFmt();
1859 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName(rPropertyName
);
1861 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
1862 if ( pEntry
->nFlags
& beans::PropertyAttribute::READONLY
)
1863 throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertyToDefault: property is read-only: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
1867 pEntry
->nWID
!= FN_UNO_ANCHOR_TYPES
&&
1868 pEntry
->nWID
!= FN_PARAM_LINK_DISPLAY_NAME
)
1870 if ( (eType
== FLYCNTTYPE_GRF
) && isGRFATR(pEntry
->nWID
) )
1872 const SwNodeIndex
* pIdx
= pFmt
->GetCntnt().GetCntntIdx();
1875 SwNodeIndex
aIdx(*pIdx
, 1);
1876 SwNoTxtNode
* pNoTxt
= aIdx
.GetNode().GetNoTxtNode();
1878 SfxItemSet
aSet(pNoTxt
->GetSwAttrSet());
1879 aSet
.ClearItem(pEntry
->nWID
);
1880 pNoTxt
->SetAttr(aSet
);
1884 // --> OD 2009-07-13 #i73249#
1885 // Attribute AlternativeText was never published.
1886 // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
1887 // else if( eType != FLYCNTTYPE_FRM && FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID )
1889 // const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1892 // SwNodeIndex aIdx(*pIdx, 1);
1893 // SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1894 // pNoTxt->SetAlternateText(aEmptyStr);
1897 // New attribute Title
1898 else if( FN_UNO_TITLE
== pEntry
->nWID
)
1900 SwFlyFrmFmt
* pFlyFmt
= dynamic_cast<SwFlyFrmFmt
*>(pFmt
);
1902 "unexpected type of <pFmt> --> crash" );
1903 // assure that <SdrObject> instance exists.
1904 GetOrCreateSdrObject( pFlyFmt
);
1905 pFlyFmt
->GetDoc()->SetFlyFrmTitle( *(pFlyFmt
), aEmptyStr
);
1907 // New attribute Description
1908 else if( FN_UNO_DESCRIPTION
== pEntry
->nWID
)
1910 SwFlyFrmFmt
* pFlyFmt
= dynamic_cast<SwFlyFrmFmt
*>(pFmt
);
1912 "unexpected type of <pFmt> --> crash" );
1913 // assure that <SdrObject> instance exists.
1914 GetOrCreateSdrObject( pFlyFmt
);
1915 pFlyFmt
->GetDoc()->SetFlyFrmDescription( *(pFlyFmt
), aEmptyStr
);
1920 SwDoc
* pDoc
= pFmt
->GetDoc();
1921 SfxItemSet
aSet( pDoc
->GetAttrPool(),
1922 RES_FRMATR_BEGIN
, RES_FRMATR_END
- 1 );
1923 aSet
.SetParent(&pFmt
->GetAttrSet());
1924 aSet
.ClearItem(pEntry
->nWID
);
1925 if(!rPropertyName
.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPE
)))
1926 pFmt
->SetFmtAttr(aSet
);
1929 else if(0 != (bNextFrame
= (rPropertyName
.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_NEXT_NAME
))))
1930 || rPropertyName
.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_PREV_NAME
)))
1932 SwDoc
* pDoc
= pFmt
->GetDoc();
1934 pDoc
->Unchain(*pFmt
);
1937 SwFmtChain
aChain( pFmt
->GetChain() );
1938 SwFrmFmt
*pPrev
= aChain
.GetPrev();
1940 pDoc
->Unchain(*pPrev
);
1944 else if(!IsDescriptor())
1945 throw uno::RuntimeException();
1948 /*-- 12.09.00 14:04:55---------------------------------------------------
1950 -----------------------------------------------------------------------*/
1951 uno::Any
SwXFrame::getPropertyDefault( const OUString
& rPropertyName
)
1952 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
1954 vos::OGuard
aGuard(Application::GetSolarMutex());
1956 SwFrmFmt
* pFmt
= GetFrmFmt();
1959 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName(rPropertyName
);
1962 if ( pEntry
->nWID
< RES_FRMATR_END
)
1964 const SfxPoolItem
& rDefItem
=
1965 pFmt
->GetDoc()->GetAttrPool().GetDefaultItem(pEntry
->nWID
);
1966 rDefItem
.QueryValue(aRet
, pEntry
->nMemberId
);
1970 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
1972 else if(!IsDescriptor())
1973 throw uno::RuntimeException();
1976 /* -----------------22.04.99 14:59-------------------
1978 * --------------------------------------------------*/
1979 void SwXFrame::addEventListener(const uno::Reference
< lang::XEventListener
> & aListener
) throw( uno::RuntimeException
)
1981 if(!GetRegisteredIn())
1982 throw uno::RuntimeException();
1983 aLstnrCntnr
.AddListener(aListener
);
1985 /* -----------------22.04.99 14:59-------------------
1987 * --------------------------------------------------*/
1988 void SwXFrame::removeEventListener(const uno::Reference
< lang::XEventListener
> & aListener
) throw( uno::RuntimeException
)
1990 if(!GetRegisteredIn() || !aLstnrCntnr
.RemoveListener(aListener
))
1991 throw uno::RuntimeException();
1993 /*-- 11.12.98 15:05:06---------------------------------------------------
1995 -----------------------------------------------------------------------*/
1996 void SwXFrame::Modify( SfxPoolItem
*pOld
, SfxPoolItem
*pNew
)
1998 ClientModify(this, pOld
, pNew
);
1999 if(!GetRegisteredIn())
2001 mxStyleData
.clear();
2002 mxStyleFamily
.clear();
2004 aLstnrCntnr
.Disposing();
2008 /*-- 11.12.98 15:23:05---------------------------------------------------
2010 -----------------------------------------------------------------------*/
2011 void SwXFrame::dispose(void) throw( uno::RuntimeException
)
2013 vos::OGuard
aGuard(Application::GetSolarMutex());
2014 SwFrmFmt
* pFmt
= GetFrmFmt();
2017 SdrObject
* pObj
= pFmt
->FindSdrObject();
2018 // OD 11.09.2003 #112039# - add condition to perform delete of
2019 // format/anchor sign, not only if the object is inserted, but also
2020 // if a contact object is registered, which isn't in the destruction.
2022 ( pObj
->IsInserted() ||
2023 ( pObj
->GetUserCall() &&
2024 !static_cast<SwContact
*>(pObj
->GetUserCall())->IsInDTOR() ) ) )
2026 if( pFmt
->GetAnchor().GetAnchorId() == FLY_IN_CNTNT
)
2028 const SwPosition
&rPos
= *(pFmt
->GetAnchor().GetCntntAnchor());
2029 SwTxtNode
*pTxtNode
= rPos
.nNode
.GetNode().GetTxtNode();
2030 const xub_StrLen nIdx
= rPos
.nContent
.GetIndex();
2031 pTxtNode
->Delete( RES_TXTATR_FLYCNT
, nIdx
, nIdx
);
2034 pFmt
->GetDoc()->DelLayoutFmt(pFmt
);
2039 /*-- 11.12.98 16:02:27---------------------------------------------------
2041 -----------------------------------------------------------------------*/
2042 uno::Reference
< text::XTextRange
> SwXFrame::getAnchor(void) throw( uno::RuntimeException
)
2044 vos::OGuard
aGuard(Application::GetSolarMutex());
2045 uno::Reference
< text::XTextRange
> aRef
;
2046 SwFrmFmt
* pFmt
= GetFrmFmt();
2049 const SwFmtAnchor
& rAnchor
= pFmt
->GetAnchor();
2050 // return an anchor for non-page bound frames
2051 // and for page bound frames that have a page no == NULL and a content position
2052 if( rAnchor
.GetAnchorId() != FLY_PAGE
||
2053 (rAnchor
.GetCntntAnchor() && !rAnchor
.GetPageNum()))
2055 const SwPosition
&rPos
= *(rAnchor
.GetCntntAnchor());
2056 aRef
= SwXTextRange::CreateTextRangeFromPosition(pFmt
->GetDoc(), rPos
, 0);
2060 throw uno::RuntimeException();
2063 /* -----------------14.01.99 12:02-------------------
2065 * --------------------------------------------------*/
2066 void SwXFrame::ResetDescriptor()
2068 bIsDescriptor
= sal_False
;
2069 mxStyleData
.clear();
2070 mxStyleFamily
.clear();
2073 /* -----------------18.02.99 13:34-------------------
2075 * --------------------------------------------------*/
2076 void SwXFrame::attachToRange(const uno::Reference
< text::XTextRange
> & xTextRange
)
2077 throw( lang::IllegalArgumentException
, uno::RuntimeException
)
2079 vos::OGuard
aGuard(Application::GetSolarMutex());
2081 throw uno::RuntimeException();
2082 uno::Reference
<lang::XUnoTunnel
> xRangeTunnel( xTextRange
, uno::UNO_QUERY
);
2083 SwXTextRange
* pRange
= 0;
2084 OTextCursorHelper
* pCursor
= 0;
2085 if(xRangeTunnel
.is())
2087 pRange
= reinterpret_cast< SwXTextRange
* >(
2088 sal::static_int_cast
< sal_IntPtr
>( xRangeTunnel
->getSomething( SwXTextRange::getUnoTunnelId()) ));
2089 pCursor
= reinterpret_cast< OTextCursorHelper
* >(
2090 sal::static_int_cast
< sal_IntPtr
>( xRangeTunnel
->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
2093 SwDoc
* pDoc
= pRange
? (SwDoc
*)pRange
->GetDoc() : pCursor
? (SwDoc
*)pCursor
->GetDoc() : 0;
2096 SwUnoInternalPaM
aIntPam(*pDoc
);
2097 //das muss jetzt sal_True liefern
2098 SwXTextRange::XTextRangeToSwPaM(aIntPam
, xTextRange
);
2100 SwNode
& rNode
= pDoc
->GetNodes().GetEndOfContent();
2102 aPam
.Move( fnMoveBackward
, fnGoDoc
);
2103 static sal_uInt16 __READONLY_DATA aFrmAttrRange
[] =
2105 RES_FRMATR_BEGIN
, RES_FRMATR_END
-1,
2106 SID_ATTR_BORDER_INNER
, SID_ATTR_BORDER_INNER
,
2107 RES_UNKNOWNATR_CONTAINER
, RES_UNKNOWNATR_CONTAINER
,
2110 static sal_uInt16 __READONLY_DATA aGrAttrRange
[] =
2112 RES_GRFATR_BEGIN
, RES_GRFATR_END
-1,
2115 SfxItemSet
aGrSet(pDoc
->GetAttrPool(), aGrAttrRange
);
2117 SfxItemSet
aFrmSet(pDoc
->GetAttrPool(), aFrmAttrRange
);
2118 //jetzt muessen die passenden Items in den Set
2119 sal_Bool bSizeFound
;
2120 if(!pProps
->AnyToItemSet( pDoc
, aFrmSet
, aGrSet
, bSizeFound
))
2121 throw lang::IllegalArgumentException();
2122 //der TextRange wird einzeln behandelt
2123 *aPam
.GetPoint() = *aIntPam
.GetPoint();
2124 if(aIntPam
.HasMark())
2127 *aPam
.GetMark() = *aIntPam
.GetMark();
2130 const SfxPoolItem
* pItem
;
2131 RndStdIds eAnchorId
= FLY_AT_CNTNT
;
2132 if(SFX_ITEM_SET
== aFrmSet
.GetItemState(RES_ANCHOR
, sal_False
, &pItem
) )
2134 eAnchorId
= ((const SwFmtAnchor
*)pItem
)->GetAnchorId();
2135 if( FLY_AT_FLY
== eAnchorId
&&
2136 !aPam
.GetNode()->FindFlyStartNode())
2138 //rahmengebunden geht nur dort, wo ein Rahmen ist!
2139 SwFmtAnchor
aAnchor(FLY_AT_CNTNT
);
2140 aFrmSet
.Put(aAnchor
);
2142 else if( FLY_PAGE
== eAnchorId
&&
2143 0 == ((const SwFmtAnchor
*)pItem
)->GetPageNum() )
2145 SwFmtAnchor
aAnchor( *((const SwFmtAnchor
*)pItem
) );
2146 aAnchor
.SetAnchor( aPam
.GetPoint() );
2147 aFrmSet
.Put(aAnchor
);
2151 const ::uno::Any
* pStyle
;
2152 SwFrmFmt
*pParentFrmFmt
= 0;
2153 if(pProps
->GetProperty(FN_UNO_FRAME_STYLE_NAME
, 0, pStyle
))
2154 pParentFrmFmt
= lcl_GetFrmFmt( *pStyle
, pDoc
);
2156 SwFlyFrmFmt
* pFmt
= 0;
2157 if( eType
== FLYCNTTYPE_FRM
)
2159 UnoActionContext
aCont(pDoc
);
2162 SwFmtAnchor
* pAnchorItem
= 0;
2163 // the frame is inserted bound to page
2164 // to prevent conflicts if the to-be-anchored position is part of the to-be-copied text
2165 if(eAnchorId
!= FLY_PAGE
)
2167 pAnchorItem
= static_cast<SwFmtAnchor
*>(aFrmSet
.Get(RES_ANCHOR
).Clone());
2168 aFrmSet
.Put( SwFmtAnchor( FLY_PAGE
, 1 ));
2171 pFmt
= pDoc
->MakeFlyAndMove( *m_pCopySource
, aFrmSet
,
2174 if(pAnchorItem
&& pFmt
)
2177 pAnchorItem
->SetAnchor( m_pCopySource
->Start() );
2178 SfxItemSet
aAnchorSet( pDoc
->GetAttrPool(), RES_ANCHOR
, RES_ANCHOR
);
2179 aAnchorSet
.Put( *pAnchorItem
);
2180 pDoc
->SetFlyFrmAttr( *pFmt
, aAnchorSet
);
2183 DELETEZ( m_pCopySource
);
2186 pFmt
= pDoc
->MakeFlySection( FLY_AT_CNTNT
, aPam
.GetPoint(),
2187 &aFrmSet
, pParentFrmFmt
);
2192 pDoc
->SetFlyName((SwFlyFrmFmt
&)*pFmt
, sName
);
2194 //den SwXText wecken
2195 ((SwXTextFrame
*)this)->SetDoc( bIsDescriptor
? m_pDoc
: GetFrmFmt()->GetDoc() );
2197 else if( eType
== FLYCNTTYPE_GRF
)
2199 UnoActionContext
aCont(pDoc
);
2200 const ::uno::Any
* pGraphicURL
;
2202 GraphicObject
*pGrfObj
= 0;
2203 if(pProps
->GetProperty(FN_UNO_GRAPHIC_U_R_L
, 0, pGraphicURL
))
2206 (*pGraphicURL
) >>= uTemp
;
2207 sGraphicURL
= String(uTemp
);
2208 if( sGraphicURL
.EqualsAscii( sPackageProtocol
,
2209 0, sizeof( sPackageProtocol
)-1 ) )
2211 pGrfObj
= new GraphicObject
;
2212 pGrfObj
->SetUserData( sGraphicURL
);
2213 pGrfObj
->SetSwapState();
2214 sGraphicURL
.Erase();
2216 else if( sGraphicURL
.EqualsAscii( sGraphicObjectProtocol
,
2217 0, sizeof(sGraphicObjectProtocol
)-1 ) )
2219 ByteString
sId( sGraphicURL
.Copy( sizeof(sGraphicObjectProtocol
)-1 ),
2220 RTL_TEXTENCODING_ASCII_US
);
2221 pGrfObj
= new GraphicObject( sId
);
2222 sGraphicURL
.Erase();
2226 const ::uno::Any
* pGraphic
;
2227 if( pProps
->GetProperty( FN_UNO_GRAPHIC
, 0, pGraphic
))
2229 uno::Reference
< graphic::XGraphic
> xGraphic
;
2230 (*pGraphic
) >>= xGraphic
;
2231 aGraphic
= Graphic( xGraphic
);
2235 const ::uno::Any
* pFilter
;
2236 if(pProps
->GetProperty(FN_UNO_GRAPHIC_FILTER
, 0, pFilter
))
2239 (*pFilter
) >>= uTemp
;
2240 sFltName
= String(uTemp
);
2244 pGrfObj
? pDoc
->Insert( aPam
, *pGrfObj
, &aFrmSet
, &aGrSet
,
2246 : pDoc
->Insert( aPam
, sGraphicURL
, sFltName
, &aGraphic
,
2247 &aFrmSet
, &aGrSet
, pParentFrmFmt
);
2251 SwGrfNode
*pGrfNd
= pDoc
->GetNodes()[ pFmt
->GetCntnt().GetCntntIdx()
2252 ->GetIndex()+1 ]->GetGrfNode();
2253 pGrfNd
->SetChgTwipSize( !bSizeFound
);
2256 pDoc
->SetFlyName((SwFlyFrmFmt
&)*pFmt
, sName
);
2259 const ::uno::Any
* pSurroundContour
;
2260 if(pProps
->GetProperty(RES_SURROUND
, MID_SURROUND_CONTOUR
, pSurroundContour
))
2261 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SURROUND_CONTOUR
)), *pSurroundContour
);
2262 const ::uno::Any
* pContourOutside
;
2263 if(pProps
->GetProperty(RES_SURROUND
, MID_SURROUND_CONTOUROUTSIDE
, pContourOutside
))
2264 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_CONTOUR_OUTSIDE
)), *pContourOutside
);
2265 const ::uno::Any
* pContourPoly
;
2266 if(pProps
->GetProperty(FN_PARAM_COUNTOUR_PP
, 0, pContourPoly
))
2267 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_CONTOUR_POLY_POLYGON
)), *pContourPoly
);
2268 const ::uno::Any
* pPixelContour
;
2269 if(pProps
->GetProperty(FN_UNO_IS_PIXEL_CONTOUR
, 0, pPixelContour
))
2270 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_PIXEL_CONTOUR
)), *pPixelContour
);
2271 const ::uno::Any
* pAutoContour
;
2272 if(pProps
->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR
, 0, pAutoContour
))
2273 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_AUTOMATIC_CONTOUR
)), *pAutoContour
);
2274 // const ::uno::Any* pAltText;
2275 // if(pProps->GetProperty(FN_UNO_ALTERNATIVE_TEXT, 0, pAltText))
2276 // setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ALTERNATIVE_TEXT)), *pAltText);
2280 const ::uno::Any
* pCLSID
= 0;
2281 const ::uno::Any
* pStreamName
= 0;
2282 if(!pProps
->GetProperty(FN_UNO_CLSID
, 0, pCLSID
) && !pProps
->GetProperty( FN_UNO_STREAM_NAME
, 0, pStreamName
))
2283 throw uno::RuntimeException();
2287 SvGlobalName aClassName
;
2288 uno::Reference
< embed::XEmbeddedObject
> xIPObj
;
2289 std::auto_ptr
< comphelper::EmbeddedObjectContainer
> pCnt
;
2290 if( (*pCLSID
) >>= aCLSID
)
2292 if( !aClassName
.MakeId( aCLSID
) )
2294 lang::IllegalArgumentException aExcept
;
2295 aExcept
.Message
= OUString::createFromAscii("CLSID invalid");
2299 pCnt
.reset( new comphelper::EmbeddedObjectContainer
);
2300 ::rtl::OUString aName
;
2301 xIPObj
= pCnt
->CreateEmbeddedObject( aClassName
.GetByteSequence(), aName
);
2305 //TODO/LATER: MISCSTATUS_RESIZEONPRINTERCHANGE
2306 //if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xIPObj->GetMiscStatus() && pDoc->getPrinter( false ) )
2307 // xIPObj->OnDocumentPrinterChanged( pDoc->getPrinter( false ) );
2309 UnoActionContext
aAction(pDoc
);
2310 pDoc
->StartUndo(UNDO_INSERT
, NULL
);
2313 //TODO/LATER: from where do I get a ViewAspect? And how do I transport it to the OLENode?
2314 sal_Int64 nAspect
= embed::Aspects::MSOLE_CONTENT
;
2316 // TODO/LEAN: VisualArea still needs running state
2317 svt::EmbeddedObjectRef::TryRunningState( xIPObj
);
2319 // set parent to get correct VisArea(in case of object needing parent printer)
2320 uno::Reference
< container::XChild
> xChild( xIPObj
, uno::UNO_QUERY
);
2322 xChild
->setParent( pDoc
->GetDocShell()->GetModel() );
2324 //The Size should be suggested by the OLE server if not manually set
2325 MapUnit aRefMap
= VCLUnoHelper::UnoEmbed2VCLMapUnit( xIPObj
->getMapUnit( nAspect
) );
2329 aSize
= xIPObj
->getVisualAreaSize( nAspect
);
2331 catch ( embed::NoVisualAreaSizeException
& )
2333 // the default size will be set later
2336 Size
aSz( aSize
.Width
, aSize
.Height
);
2337 if ( !aSz
.Width() || !aSz
.Height() )
2339 aSz
.Width() = aSz
.Height() = 5000;
2340 aSz
= OutputDevice::LogicToLogic
2341 ( aSz
, MapMode( MAP_100TH_MM
), aRefMap
);
2343 MapMode
aMyMap( MAP_TWIP
);
2344 aSz
= OutputDevice::LogicToLogic( aSz
, aRefMap
, aMyMap
);
2345 SwFmtFrmSize aFrmSz
;
2346 aFrmSz
.SetSize(aSz
);
2347 aFrmSet
.Put(aFrmSz
);
2349 SwFlyFrmFmt
* pFmt2
= 0;
2351 // TODO/LATER: Is it the only possible aspect here?
2352 sal_Int64 nAspect
= embed::Aspects::MSOLE_CONTENT
;
2353 ::svt::EmbeddedObjectRef
xObjRef( xIPObj
, nAspect
);
2354 pFmt2
= pDoc
->Insert(aPam
, xObjRef
, &aFrmSet
, NULL
, NULL
);
2355 ASSERT( pFmt2
, "Doc->Insert(notxt) failed." );
2357 pDoc
->EndUndo(UNDO_INSERT
, NULL
);
2360 pDoc
->SetFlyName((SwFlyFrmFmt
&)*pFmt2
, sName
);
2363 else if( pStreamName
)
2365 ::rtl::OUString sStreamName
;
2366 (*pStreamName
) >>= sStreamName
;
2367 pDoc
->StartUndo(UNDO_INSERT
, NULL
);
2369 SwFlyFrmFmt
* pFrmFmt
= 0;
2370 pFrmFmt
= pDoc
->InsertOLE( aPam
, sStreamName
, embed::Aspects::MSOLE_CONTENT
, &aFrmSet
, NULL
, NULL
);
2371 pDoc
->EndUndo(UNDO_INSERT
, NULL
);
2374 pDoc
->SetFlyName((SwFlyFrmFmt
&)*pFrmFmt
, sName
);
2377 if( pFmt
&& pDoc
->GetDrawModel() )
2378 GetOrCreateSdrObject( pFmt
);
2379 const ::uno::Any
* pOrder
;
2380 if( pProps
->GetProperty(FN_UNO_Z_ORDER
, 0, pOrder
) )
2381 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_Z_ORDER
)), *pOrder
);
2382 const ::uno::Any
* pReplacement
;
2383 if( pProps
->GetProperty(FN_UNO_REPLACEMENT_GRAPHIC
, 0, pReplacement
) )
2384 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_GRAPHIC
)), *pReplacement
);
2385 // --> OD 2009-07-13 #i73249#
2386 // new attribute Title
2387 const ::uno::Any
* pTitle
;
2388 if ( pProps
->GetProperty(FN_UNO_TITLE
, 0, pTitle
) )
2390 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_TITLE
)), *pTitle
);
2392 // new attribute Description
2393 const ::uno::Any
* pDescription
;
2394 if ( pProps
->GetProperty(FN_UNO_DESCRIPTION
, 0, pDescription
) )
2396 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_DESCRIPTION
)), *pDescription
);
2401 throw lang::IllegalArgumentException();
2402 //setzt das Flag zurueck und loescht den Descriptor-Pointer
2405 /* -----------------------------04.04.01 14:27--------------------------------
2407 ---------------------------------------------------------------------------*/
2408 void SwXFrame::attach(const uno::Reference
< text::XTextRange
> & xTextRange
)
2409 throw( lang::IllegalArgumentException
, uno::RuntimeException
)
2413 attachToRange(xTextRange
);
2414 else if(0 != (pFmt
= GetFrmFmt()))
2416 uno::Reference
<lang::XUnoTunnel
> xRangeTunnel( xTextRange
, uno::UNO_QUERY
);
2417 SwXTextRange
* pRange
= 0;
2418 OTextCursorHelper
* pCursor
= 0;
2419 if(xRangeTunnel
.is())
2421 pRange
= reinterpret_cast< SwXTextRange
* >(
2422 sal::static_int_cast
< sal_IntPtr
>( xRangeTunnel
->getSomething( SwXTextRange::getUnoTunnelId()) ));
2423 pCursor
= reinterpret_cast< OTextCursorHelper
* >(
2424 sal::static_int_cast
< sal_IntPtr
>( xRangeTunnel
->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
2426 SwDoc
* pDoc
= pFmt
->GetDoc();
2427 SwUnoInternalPaM
aIntPam(*pDoc
);
2428 if(SwXTextRange::XTextRangeToSwPaM(aIntPam
, xTextRange
))
2430 SfxItemSet
aSet( pDoc
->GetAttrPool(),
2431 RES_ANCHOR
, RES_ANCHOR
);
2432 aSet
.SetParent(&pFmt
->GetAttrSet());
2433 SwFmtAnchor aAnchor
= (const SwFmtAnchor
&)aSet
.Get(RES_ANCHOR
);
2434 aAnchor
.SetAnchor( aIntPam
.Start() );
2436 pDoc
->SetFlyFrmAttr( *pFmt
, aSet
);
2439 throw lang::IllegalArgumentException();
2442 /*-- 22.04.99 08:03:20---------------------------------------------------
2444 -----------------------------------------------------------------------*/
2445 awt::Point
SwXFrame::getPosition(void) throw( uno::RuntimeException
)
2447 vos::OGuard
aGuard(Application::GetSolarMutex());
2448 uno::RuntimeException aRuntime
;
2449 aRuntime
.Message
= C2U("position cannot be determined with this method");
2452 /*-- 22.04.99 08:03:21---------------------------------------------------
2454 -----------------------------------------------------------------------*/
2455 void SwXFrame::setPosition(const awt::Point
& /*aPosition*/) throw( uno::RuntimeException
)
2457 vos::OGuard
aGuard(Application::GetSolarMutex());
2458 uno::RuntimeException aRuntime
;
2459 aRuntime
.Message
= C2U("position cannot be changed with this method");
2462 /*-- 22.04.99 08:03:21---------------------------------------------------
2464 -----------------------------------------------------------------------*/
2465 awt::Size
SwXFrame::getSize(void) throw( uno::RuntimeException
)
2467 const ::uno::Any aVal
= getPropertyValue(C2U("Size"));
2468 awt::Size
* pRet
= (awt::Size
*)aVal
.getValue();
2471 /*-- 22.04.99 08:03:21---------------------------------------------------
2473 -----------------------------------------------------------------------*/
2474 void SwXFrame::setSize(const awt::Size
& aSize
)
2475 throw( beans::PropertyVetoException
, uno::RuntimeException
)
2477 const ::uno::Any
aVal(&aSize
, ::getCppuType(static_cast<const awt::Size
*>(0)));
2478 setPropertyValue(C2U("Size"), aVal
);
2480 /*-- 22.04.99 08:03:21---------------------------------------------------
2482 -----------------------------------------------------------------------*/
2483 OUString
SwXFrame::getShapeType(void) throw( uno::RuntimeException
)
2485 return C2U("FrameShape");
2489 /******************************************************************
2491 ******************************************************************/
2492 /*-- 14.01.99 11:27:51---------------------------------------------------
2494 -----------------------------------------------------------------------*/
2495 SwXTextFrame::SwXTextFrame( SwDoc
*_pDoc
) :
2496 SwXText(0, CURSOR_FRAME
),
2497 SwXFrame(FLYCNTTYPE_FRM
, aSwMapProvider
.GetPropertySet(PROPERTY_MAP_TEXT_FRAME
), _pDoc
)
2500 /*-- 11.12.98 15:23:01---------------------------------------------------
2502 -----------------------------------------------------------------------*/
2503 SwXTextFrame::SwXTextFrame(SwFrmFmt
& rFmt
) :
2504 SwXText(rFmt
.GetDoc(), CURSOR_FRAME
),
2505 SwXFrame(rFmt
, FLYCNTTYPE_FRM
, aSwMapProvider
.GetPropertySet(PROPERTY_MAP_TEXT_FRAME
))
2509 /*-- 11.12.98 15:23:02---------------------------------------------------
2511 -----------------------------------------------------------------------*/
2512 SwXTextFrame::~SwXTextFrame()
2515 /* -----------------------------15.03.00 16:30--------------------------------
2517 ---------------------------------------------------------------------------*/
2518 void SAL_CALL
SwXTextFrame::acquire( )throw()
2520 SwXFrame::acquire();
2522 /* -----------------------------15.03.00 16:30--------------------------------
2524 ---------------------------------------------------------------------------*/
2525 void SAL_CALL
SwXTextFrame::release( )throw()
2527 SwXFrame::release();
2529 /* -----------------------------15.03.00 16:30--------------------------------
2531 ---------------------------------------------------------------------------*/
2532 ::uno::Any SAL_CALL
SwXTextFrame::queryInterface( const uno::Type
& aType
)
2533 throw (uno::RuntimeException
)
2535 ::uno::Any aRet
= SwXFrame::queryInterface(aType
);
2536 if(aRet
.getValueType() == ::getCppuVoidType())
2537 aRet
= SwXText::queryInterface(aType
);
2538 if(aRet
.getValueType() == ::getCppuVoidType())
2539 aRet
= SwXTextFrameBaseClass::queryInterface(aType
);
2542 /* -----------------------------15.03.00 16:30--------------------------------
2544 ---------------------------------------------------------------------------*/
2545 uno::Sequence
< uno::Type
> SAL_CALL
SwXTextFrame::getTypes( ) throw(uno::RuntimeException
)
2547 uno::Sequence
< uno::Type
> aTextFrameTypes
= SwXTextFrameBaseClass::getTypes();
2548 uno::Sequence
< uno::Type
> aFrameTypes
= SwXFrame::getTypes();
2549 uno::Sequence
< uno::Type
> aTextTypes
= SwXText::getTypes();
2551 long nIndex
= aTextFrameTypes
.getLength();
2552 aTextFrameTypes
.realloc(
2553 aTextFrameTypes
.getLength() +
2554 aFrameTypes
.getLength() +
2555 aTextTypes
.getLength());
2557 uno::Type
* pTextFrameTypes
= aTextFrameTypes
.getArray();
2558 const uno::Type
* pFrameTypes
= aFrameTypes
.getConstArray();
2560 for(nPos
= 0; nPos
<aFrameTypes
.getLength(); nPos
++)
2561 pTextFrameTypes
[nIndex
++] = pFrameTypes
[nPos
];
2563 const uno::Type
* pTextTypes
= aTextTypes
.getConstArray();
2564 for(nPos
= 0; nPos
<aTextTypes
.getLength(); nPos
++)
2565 pTextFrameTypes
[nIndex
++] = pTextTypes
[nPos
];
2567 return aTextFrameTypes
;
2569 /* -----------------------------15.03.00 16:30--------------------------------
2571 ---------------------------------------------------------------------------*/
2572 uno::Sequence
< sal_Int8
> SAL_CALL
SwXTextFrame::getImplementationId( ) throw(uno::RuntimeException
)
2574 vos::OGuard
aGuard(Application::GetSolarMutex());
2575 static uno::Sequence
< sal_Int8
> aId( 16 );
2576 static sal_Bool bInit
= sal_False
;
2579 rtl_createUuid( (sal_uInt8
*)(aId
.getArray() ), 0, sal_True
);
2584 /*-- 11.12.98 15:23:03---------------------------------------------------
2586 -----------------------------------------------------------------------*/
2587 uno::Reference
< text::XText
> SwXTextFrame::getText(void) throw( uno::RuntimeException
)
2591 /*-- 11.12.98 15:23:03---------------------------------------------------
2593 -----------------------------------------------------------------------*/
2594 const SwStartNode
*SwXTextFrame::GetStartNode() const
2596 const SwStartNode
*pSttNd
= 0;
2598 SwFrmFmt
* pFmt
= GetFrmFmt();
2601 const SwFmtCntnt
& rFlyCntnt
= pFmt
->GetCntnt();
2602 if( rFlyCntnt
.GetCntntIdx() )
2603 pSttNd
= rFlyCntnt
.GetCntntIdx()->GetNode().GetStartNode();
2609 uno::Reference
< text::XTextCursor
> SwXTextFrame::createCursor() throw ( uno::RuntimeException
)
2611 return createTextCursor();
2613 /*-- 11.12.98 15:23:03---------------------------------------------------
2615 -----------------------------------------------------------------------*/
2616 uno::Reference
< text::XTextCursor
> SwXTextFrame::createTextCursor(void) throw( uno::RuntimeException
)
2618 vos::OGuard
aGuard(Application::GetSolarMutex());
2619 uno::Reference
< text::XTextCursor
> aRef
;
2620 SwFrmFmt
* pFmt
= GetFrmFmt();
2623 //save current start node to be able to check if there is content after the table -
2624 //otherwise the cursor would be in the body text!
2625 const SwNode
& rNode
= pFmt
->GetCntnt().GetCntntIdx()->GetNode();
2626 const SwStartNode
* pOwnStartNode
= rNode
.FindSttNodeByType(SwFlyStartNode
);
2629 aPam
.Move(fnMoveForward
, fnGoNode
);
2630 SwTableNode
* pTblNode
= aPam
.GetNode()->FindTableNode();
2631 SwCntntNode
* pCont
= 0;
2634 aPam
.GetPoint()->nNode
= *pTblNode
->EndOfSectionNode();
2635 pCont
= GetDoc()->GetNodes().GoNext(&aPam
.GetPoint()->nNode
);
2636 pTblNode
= pCont
->FindTableNode();
2639 aPam
.GetPoint()->nContent
.Assign(pCont
, 0);
2641 const SwStartNode
* pNewStartNode
=
2642 aPam
.GetNode()->FindSttNodeByType(SwFlyStartNode
);
2643 if(!pNewStartNode
|| pNewStartNode
!= pOwnStartNode
)
2645 uno::RuntimeException aExcept
;
2646 aExcept
.Message
= S2U("no text available");
2650 SwXTextCursor
* pXCrsr
= new SwXTextCursor(this, *aPam
.GetPoint(), CURSOR_FRAME
, pFmt
->GetDoc());
2651 aRef
= (text::XWordCursor
*)pXCrsr
;
2652 #if OSL_DEBUG_LEVEL > 1
2653 SwUnoCrsr
* pUnoCrsr
= pXCrsr
->GetCrsr();
2658 throw uno::RuntimeException();
2661 /*-- 11.12.98 15:23:03---------------------------------------------------
2663 -----------------------------------------------------------------------*/
2664 uno::Reference
< text::XTextCursor
> SwXTextFrame::createTextCursorByRange(const uno::Reference
< text::XTextRange
> & aTextPosition
) throw( uno::RuntimeException
)
2666 vos::OGuard
aGuard(Application::GetSolarMutex());
2667 uno::Reference
< text::XTextCursor
> aRef
;
2668 SwFrmFmt
* pFmt
= GetFrmFmt();
2669 SwUnoInternalPaM
aPam(*GetDoc());
2670 if(pFmt
&& SwXTextRange::XTextRangeToSwPaM(aPam
, aTextPosition
))
2672 SwNode
& rNode
= pFmt
->GetCntnt().GetCntntIdx()->GetNode();
2673 #if OSL_DEBUG_LEVEL > 1
2674 const SwStartNode
* p1
= aPam
.GetNode()->FindFlyStartNode();
2675 const SwStartNode
* p2
= rNode
.FindFlyStartNode();
2679 if(aPam
.GetNode()->FindFlyStartNode() == rNode
.FindFlyStartNode())
2680 aRef
= (text::XWordCursor
*)new SwXTextCursor(this ,
2681 *aPam
.GetPoint(), CURSOR_FRAME
, pFmt
->GetDoc(), aPam
.GetMark());
2684 throw uno::RuntimeException();
2687 /*-- 11.12.98 15:23:03---------------------------------------------------
2689 -----------------------------------------------------------------------*/
2690 uno::Reference
< container::XEnumeration
> SwXTextFrame::createEnumeration(void) throw( uno::RuntimeException
)
2692 vos::OGuard
aGuard(Application::GetSolarMutex());
2693 uno::Reference
< container::XEnumeration
> aRef
;
2694 SwFrmFmt
* pFmt
= GetFrmFmt();
2697 SwPosition
aPos(pFmt
->GetCntnt().GetCntntIdx()->GetNode());
2698 SwUnoCrsr
* pUnoCrsr
= GetDoc()->CreateUnoCrsr(aPos
, sal_False
);
2699 pUnoCrsr
->Move( fnMoveForward
, fnGoNode
);
2700 // // no Cursor in protected sections
2701 // SwCrsrSaveState aSave( *pUnoCrsr );
2702 // if(pUnoCrsr->IsInProtectTable( sal_True ) ||
2703 // pUnoCrsr->IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS ))
2704 // throw uno::RuntimeException() );
2705 aRef
= new SwXParagraphEnumeration(this, pUnoCrsr
, CURSOR_FRAME
);
2709 /*-- 11.12.98 15:23:04---------------------------------------------------
2711 -----------------------------------------------------------------------*/
2712 uno::Type
SwXTextFrame::getElementType(void) throw( uno::RuntimeException
)
2714 return ::getCppuType(static_cast<uno::Reference
<text::XTextRange
>*>(0));
2716 /*-- 11.12.98 15:23:04---------------------------------------------------
2718 -----------------------------------------------------------------------*/
2719 sal_Bool
SwXTextFrame::hasElements(void) throw( uno::RuntimeException
)
2723 /*-- 11.12.98 15:23:04---------------------------------------------------
2725 -----------------------------------------------------------------------*/
2726 void SwXTextFrame::attach(const uno::Reference
< text::XTextRange
> & xTextRange
)
2727 throw( lang::IllegalArgumentException
, uno::RuntimeException
)
2729 SwXFrame::attach(xTextRange
);
2731 /*-- 11.12.98 15:23:04---------------------------------------------------
2733 -----------------------------------------------------------------------*/
2734 uno::Reference
< text::XTextRange
> SwXTextFrame::getAnchor(void) throw( uno::RuntimeException
)
2736 vos::OGuard
aGuard(Application::GetSolarMutex());
2737 return SwXFrame::getAnchor();
2739 /*-- 11.12.98 15:23:05---------------------------------------------------
2741 -----------------------------------------------------------------------*/
2742 void SwXTextFrame::dispose(void) throw( uno::RuntimeException
)
2744 vos::OGuard
aGuard(Application::GetSolarMutex());
2745 SwXFrame::dispose();
2747 /*-- 11.12.98 15:23:05---------------------------------------------------
2749 -----------------------------------------------------------------------*/
2750 void SwXTextFrame::addEventListener(const uno::Reference
< lang::XEventListener
> & aListener
) throw( uno::RuntimeException
)
2752 SwXFrame::addEventListener(aListener
);
2754 /*-- 11.12.98 15:23:05---------------------------------------------------
2756 -----------------------------------------------------------------------*/
2757 void SwXTextFrame::removeEventListener(const uno::Reference
< lang::XEventListener
> & aListener
) throw( uno::RuntimeException
)
2759 SwXFrame::removeEventListener(aListener
);
2761 /* -----------------03.05.99 12:28-------------------
2763 * --------------------------------------------------*/
2764 OUString
SwXTextFrame::getImplementationName(void) throw( uno::RuntimeException
)
2766 return C2U("SwXTextFrame");
2768 /* -----------------03.05.99 12:28-------------------
2770 * --------------------------------------------------*/
2771 sal_Bool
SwXTextFrame::supportsService(const OUString
& rServiceName
) throw( uno::RuntimeException
)
2773 return COMPARE_EQUAL
== rServiceName
.compareToAscii("com.sun.star.text.Text")||
2774 COMPARE_EQUAL
== rServiceName
.compareToAscii("com.sun.star.text.TextFrame")||
2775 SwXFrame::supportsService(rServiceName
);
2777 /* -----------------03.05.99 12:28-------------------
2779 * --------------------------------------------------*/
2780 uno::Sequence
< OUString
> SwXTextFrame::getSupportedServiceNames(void) throw( uno::RuntimeException
)
2782 uno::Sequence
< OUString
> aRet
= SwXFrame::getSupportedServiceNames();
2783 aRet
.realloc(aRet
.getLength() + 2);
2784 OUString
* pArray
= aRet
.getArray();
2785 pArray
[aRet
.getLength() - 2] = C2U("com.sun.star.text.TextFrame");
2786 pArray
[aRet
.getLength() - 1] = C2U("com.sun.star.text.Text");
2789 /* -----------------------------20.06.00 10:02--------------------------------
2791 ---------------------------------------------------------------------------*/
2792 void * SAL_CALL
SwXTextFrame::operator new( size_t t
) throw()
2794 return SwXTextFrameBaseClass::operator new( t
);
2796 /* -----------------------------20.06.00 10:02--------------------------------
2798 ---------------------------------------------------------------------------*/
2799 void SAL_CALL
SwXTextFrame::operator delete( void * p
) throw()
2801 SwXTextFrameBaseClass::operator delete(p
);
2804 uno::Reference
<container::XNameReplace
> SAL_CALL
SwXTextFrame::getEvents()
2805 throw(uno::RuntimeException
)
2807 return new SwFrameEventDescriptor( *this );
2809 /* -----------------------------10.01.01 13:27--------------------------------
2811 ---------------------------------------------------------------------------*/
2812 sal_Int64 SAL_CALL
SwXTextFrame::getSomething( const uno::Sequence
< sal_Int8
>& rId
)
2813 throw(uno::RuntimeException
)
2815 sal_Int64 nRet
= SwXFrame::getSomething( rId
);
2817 nRet
= SwXText::getSomething( rId
);
2821 /* -----------------------------19.03.2002 16:43------------------------------
2823 ---------------------------------------------------------------------------*/
2824 ::uno::Any
SwXTextFrame::getPropertyValue(const OUString
& rPropertyName
)
2825 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
2827 vos::OGuard
aGuard(Application::GetSolarMutex());
2829 if(rPropertyName
.equalsAsciiL(SW_PROP_NAME(UNO_NAME_START_REDLINE
))||
2830 rPropertyName
.equalsAsciiL(SW_PROP_NAME(UNO_NAME_END_REDLINE
)))
2832 //redline can only be returned if it's a living object
2834 aRet
= SwXText::getPropertyValue(rPropertyName
);
2837 aRet
= SwXFrame::getPropertyValue(rPropertyName
);
2840 /******************************************************************
2841 * SwXTextGraphicObject
2842 ******************************************************************/
2843 /*-- 14.01.99 11:27:51---------------------------------------------------
2845 -----------------------------------------------------------------------*/
2846 SwXTextGraphicObject::SwXTextGraphicObject( SwDoc
*pDoc
) :
2847 SwXFrame(FLYCNTTYPE_GRF
, aSwMapProvider
.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC
), pDoc
)
2850 /*-- 11.12.98 16:02:25---------------------------------------------------
2852 -----------------------------------------------------------------------*/
2853 SwXTextGraphicObject::SwXTextGraphicObject(SwFrmFmt
& rFmt
) :
2854 SwXFrame(rFmt
, FLYCNTTYPE_GRF
, aSwMapProvider
.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC
))
2858 /*-- 11.12.98 16:02:26---------------------------------------------------
2860 -----------------------------------------------------------------------*/
2861 SwXTextGraphicObject::~SwXTextGraphicObject()
2865 /* -----------------------------15.03.00 16:30--------------------------------
2867 ---------------------------------------------------------------------------*/
2868 void SAL_CALL
SwXTextGraphicObject::acquire( )throw()
2870 SwXFrame::acquire();
2872 /* -----------------------------15.03.00 16:30--------------------------------
2874 ---------------------------------------------------------------------------*/
2875 void SAL_CALL
SwXTextGraphicObject::release( )throw()
2877 SwXFrame::release();
2879 /* -----------------------------15.03.00 16:30--------------------------------
2881 ---------------------------------------------------------------------------*/
2882 ::uno::Any SAL_CALL
SwXTextGraphicObject::queryInterface( const uno::Type
& aType
)
2883 throw(uno::RuntimeException
)
2885 ::uno::Any aRet
= SwXFrame::queryInterface(aType
);
2886 if(aRet
.getValueType() == ::getCppuVoidType())
2887 aRet
= SwXTextGraphicObjectBaseClass::queryInterface(aType
);
2890 /* -----------------------------15.03.00 16:30--------------------------------
2892 ---------------------------------------------------------------------------*/
2893 uno::Sequence
< uno::Type
> SAL_CALL
2894 SwXTextGraphicObject::getTypes( ) throw(uno::RuntimeException
)
2896 uno::Sequence
< uno::Type
> aGraphicTypes
= SwXTextGraphicObjectBaseClass::getTypes();
2897 uno::Sequence
< uno::Type
> aFrameTypes
= SwXFrame::getTypes();
2899 long nIndex
= aGraphicTypes
.getLength();
2900 aGraphicTypes
.realloc(
2901 aGraphicTypes
.getLength() +
2902 aFrameTypes
.getLength());
2904 uno::Type
* pGraphicTypes
= aGraphicTypes
.getArray();
2905 const uno::Type
* pFrameTypes
= aFrameTypes
.getConstArray();
2907 for(nPos
= 0; nPos
<aFrameTypes
.getLength(); nPos
++)
2908 pGraphicTypes
[nIndex
++] = pFrameTypes
[nPos
];
2910 return aGraphicTypes
;
2912 /* -----------------------------15.03.00 16:30--------------------------------
2914 ---------------------------------------------------------------------------*/
2915 uno::Sequence
< sal_Int8
> SAL_CALL
SwXTextGraphicObject::getImplementationId( ) throw(uno::RuntimeException
)
2917 vos::OGuard
aGuard(Application::GetSolarMutex());
2918 static uno::Sequence
< sal_Int8
> aId( 16 );
2919 static sal_Bool bInit
= sal_False
;
2922 rtl_createUuid( (sal_uInt8
*)(aId
.getArray() ), 0, sal_True
);
2927 /*-- 11.12.98 16:02:27---------------------------------------------------
2929 -----------------------------------------------------------------------*/
2930 void SwXTextGraphicObject::attach(const uno::Reference
< text::XTextRange
> & xTextRange
) throw( lang::IllegalArgumentException
, uno::RuntimeException
)
2932 SwXFrame::attach(xTextRange
);
2934 /*-- 11.12.98 16:02:27---------------------------------------------------
2936 -----------------------------------------------------------------------*/
2937 uno::Reference
< text::XTextRange
> SwXTextGraphicObject::getAnchor(void) throw( uno::RuntimeException
)
2939 vos::OGuard
aGuard(Application::GetSolarMutex());
2940 return SwXFrame::getAnchor();
2942 /*-- 11.12.98 16:02:28---------------------------------------------------
2944 -----------------------------------------------------------------------*/
2945 void SwXTextGraphicObject::dispose(void) throw( uno::RuntimeException
)
2947 vos::OGuard
aGuard(Application::GetSolarMutex());
2948 SwXFrame::dispose();
2950 /*-- 11.12.98 16:02:29---------------------------------------------------
2952 -----------------------------------------------------------------------*/
2953 void SwXTextGraphicObject::addEventListener(const uno::Reference
< lang::XEventListener
> & aListener
)
2954 throw( uno::RuntimeException
)
2956 SwXFrame::addEventListener(aListener
);
2958 /*-- 11.12.98 16:02:29---------------------------------------------------
2960 -----------------------------------------------------------------------*/
2961 void SwXTextGraphicObject::removeEventListener(const uno::Reference
< lang::XEventListener
> & aListener
)
2962 throw( uno::RuntimeException
)
2964 SwXFrame::removeEventListener(aListener
);
2966 /* -----------------03.05.99 12:28-------------------
2968 * --------------------------------------------------*/
2969 OUString
SwXTextGraphicObject::getImplementationName(void) throw( uno::RuntimeException
)
2971 return C2U("SwXTextGraphicObject");
2973 /* -----------------03.05.99 12:28-------------------
2975 * --------------------------------------------------*/
2976 sal_Bool
SwXTextGraphicObject::supportsService(const OUString
& rServiceName
) throw( uno::RuntimeException
)
2978 return COMPARE_EQUAL
== rServiceName
.compareToAscii("com.sun.star.text.TextGraphicObject") ||
2979 SwXFrame::supportsService(rServiceName
);
2981 /* -----------------03.05.99 12:28-------------------
2983 * --------------------------------------------------*/
2984 uno::Sequence
< OUString
> SwXTextGraphicObject::getSupportedServiceNames(void)
2985 throw( uno::RuntimeException
)
2987 uno::Sequence
< OUString
> aRet
= SwXFrame::getSupportedServiceNames();
2988 aRet
.realloc(aRet
.getLength() + 1);
2989 OUString
* pArray
= aRet
.getArray();
2990 pArray
[aRet
.getLength() - 1] = C2U("com.sun.star.text.TextGraphicObject");
2993 /* -----------------------------20.06.00 10:02--------------------------------
2995 ---------------------------------------------------------------------------*/
2996 void * SAL_CALL
SwXTextGraphicObject::operator new( size_t t
) throw()
2998 return SwXTextGraphicObjectBaseClass::operator new(t
);
3000 /* -----------------------------20.06.00 10:02--------------------------------
3002 ---------------------------------------------------------------------------*/
3003 void SAL_CALL
SwXTextGraphicObject::operator delete( void * p
) throw()
3005 SwXTextGraphicObjectBaseClass::operator delete(p
);
3007 /* -----------------------------15.12.00 12:45--------------------------------
3009 ---------------------------------------------------------------------------*/
3010 uno::Reference
<container::XNameReplace
> SAL_CALL
3011 SwXTextGraphicObject::getEvents()
3012 throw(uno::RuntimeException
)
3014 return new SwFrameEventDescriptor( *this );
3017 /******************************************************************
3019 ******************************************************************/
3020 /*-- 11.12.98 16:16:53---------------------------------------------------
3022 -----------------------------------------------------------------------*/
3023 SwXTextEmbeddedObject::SwXTextEmbeddedObject( SwDoc
*pDoc
) :
3024 SwXFrame(FLYCNTTYPE_OLE
, aSwMapProvider
.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT
), pDoc
)
3027 /*-- 11.12.98 16:16:53---------------------------------------------------
3029 -----------------------------------------------------------------------*/
3030 SwXTextEmbeddedObject::SwXTextEmbeddedObject(SwFrmFmt
& rFmt
) :
3031 SwXFrame(rFmt
, FLYCNTTYPE_OLE
, aSwMapProvider
.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT
))
3035 /*-- 11.12.98 16:16:54---------------------------------------------------
3037 -----------------------------------------------------------------------*/
3038 SwXTextEmbeddedObject::~SwXTextEmbeddedObject()
3042 /*-- 11.12.98 16:16:54---------------------------------------------------
3044 -----------------------------------------------------------------------*/
3045 /* -----------------------------15.03.00 16:32--------------------------------
3047 ---------------------------------------------------------------------------*/
3048 void SAL_CALL
SwXTextEmbeddedObject::acquire()throw()
3050 SwXFrame::acquire();
3052 /* -----------------------------15.03.00 16:32--------------------------------
3054 ---------------------------------------------------------------------------*/
3055 void SAL_CALL
SwXTextEmbeddedObject::release()throw()
3057 SwXFrame::release();
3059 /* -----------------------------15.03.00 16:32--------------------------------
3061 ---------------------------------------------------------------------------*/
3062 ::uno::Any SAL_CALL
SwXTextEmbeddedObject::queryInterface( const uno::Type
& aType
)
3063 throw( uno::RuntimeException
)
3065 ::uno::Any aRet
= SwXFrame::queryInterface(aType
);;
3066 if(aRet
.getValueType() == ::getCppuVoidType())
3067 aRet
= SwXTextEmbeddedObjectBaseClass::queryInterface(aType
);
3070 /* -----------------------------15.03.00 16:32--------------------------------
3072 ---------------------------------------------------------------------------*/
3073 uno::Sequence
< uno::Type
> SAL_CALL
SwXTextEmbeddedObject::getTypes( ) throw(uno::RuntimeException
)
3075 uno::Sequence
< uno::Type
> aTextEmbeddedTypes
= SwXTextEmbeddedObjectBaseClass::getTypes();
3076 uno::Sequence
< uno::Type
> aFrameTypes
= SwXFrame::getTypes();
3078 long nIndex
= aTextEmbeddedTypes
.getLength();
3079 aTextEmbeddedTypes
.realloc(
3080 aTextEmbeddedTypes
.getLength() +
3081 aFrameTypes
.getLength());
3083 uno::Type
* pTextEmbeddedTypes
= aTextEmbeddedTypes
.getArray();
3085 const uno::Type
* pFrameTypes
= aFrameTypes
.getConstArray();
3087 for(nPos
= 0; nPos
<aFrameTypes
.getLength(); nPos
++)
3088 pTextEmbeddedTypes
[nIndex
++] = pFrameTypes
[nPos
];
3090 return aTextEmbeddedTypes
;
3092 /* -----------------------------15.03.00 16:32--------------------------------
3094 ---------------------------------------------------------------------------*/
3095 uno::Sequence
< sal_Int8
> SAL_CALL
SwXTextEmbeddedObject::getImplementationId( ) throw(uno::RuntimeException
)
3097 vos::OGuard
aGuard(Application::GetSolarMutex());
3098 static uno::Sequence
< sal_Int8
> aId( 16 );
3099 static sal_Bool bInit
= sal_False
;
3102 rtl_createUuid( (sal_uInt8
*)(aId
.getArray() ), 0, sal_True
);
3107 /*-- 11.12.98 16:16:54---------------------------------------------------
3109 -----------------------------------------------------------------------*/
3110 void SwXTextEmbeddedObject::attach(const uno::Reference
< text::XTextRange
> & xTextRange
) throw( lang::IllegalArgumentException
, uno::RuntimeException
)
3112 SwXFrame::attach(xTextRange
);
3114 /*-- 11.12.98 16:16:54---------------------------------------------------
3116 -----------------------------------------------------------------------*/
3117 uno::Reference
< text::XTextRange
> SwXTextEmbeddedObject::getAnchor(void) throw( uno::RuntimeException
)
3119 vos::OGuard
aGuard(Application::GetSolarMutex());
3120 return SwXFrame::getAnchor();
3122 /*-- 11.12.98 16:16:54---------------------------------------------------
3124 -----------------------------------------------------------------------*/
3125 void SwXTextEmbeddedObject::dispose(void) throw( uno::RuntimeException
)
3127 vos::OGuard
aGuard(Application::GetSolarMutex());
3128 SwXFrame::dispose();
3130 /*-- 11.12.98 16:16:55---------------------------------------------------
3132 -----------------------------------------------------------------------*/
3133 void SwXTextEmbeddedObject::addEventListener(const uno::Reference
< lang::XEventListener
> & aListener
) throw( uno::RuntimeException
)
3135 SwXFrame::addEventListener(aListener
);
3137 /*-- 11.12.98 16:16:55---------------------------------------------------
3139 -----------------------------------------------------------------------*/
3140 void SwXTextEmbeddedObject::removeEventListener(const uno::Reference
< lang::XEventListener
> & aListener
) throw( uno::RuntimeException
)
3142 SwXFrame::removeEventListener(aListener
);
3144 /*-- 11.12.98 16:16:55---------------------------------------------------
3146 -----------------------------------------------------------------------*/
3148 uno::Reference
< lang::XComponent
> SwXTextEmbeddedObject::getEmbeddedObject(void) throw( uno::RuntimeException
)
3150 uno::Reference
< lang::XComponent
> xRet
;
3151 SwFrmFmt
* pFmt
= GetFrmFmt();
3154 SwDoc
* pDoc
= pFmt
->GetDoc();
3155 const SwFmtCntnt
* pCnt
= &pFmt
->GetCntnt();
3156 DBG_ASSERT( pCnt
->GetCntntIdx() &&
3157 pDoc
->GetNodes()[ pCnt
->GetCntntIdx()->
3158 GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3160 SwOLENode
* pOleNode
= pDoc
->GetNodes()[ pCnt
->GetCntntIdx()
3161 ->GetIndex() + 1 ]->GetOLENode();
3162 uno::Reference
< embed::XEmbeddedObject
> xIP
= pOleNode
->GetOLEObj().GetOleRef();
3163 if ( svt::EmbeddedObjectRef::TryRunningState( xIP
) )
3165 // TODO/LATER: the listener registered after client creation should be able to handle scaling, after that the client is not necessary here
3166 if ( pDoc
->GetDocShell() )
3167 pDoc
->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xIP
, embed::Aspects::MSOLE_CONTENT
) );
3169 xRet
= uno::Reference
< lang::XComponent
>( xIP
->getComponent(), uno::UNO_QUERY
);
3170 uno::Reference
< util::XModifyBroadcaster
> xBrdcst( xRet
, uno::UNO_QUERY
);
3171 uno::Reference
< frame::XModel
> xModel( xRet
, uno::UNO_QUERY
);
3172 if( xBrdcst
.is() && xModel
.is() )
3174 SwClientIter
aIter( *pFmt
);
3175 SwXOLEListener
* pListener
= (SwXOLEListener
*)aIter
.
3176 First( TYPE( SwXOLEListener
));
3177 //create a new one if the OLE object doesn't have one already
3180 uno::Reference
< util::XModifyListener
> xOLEListener
= new SwXOLEListener(*pFmt
, xModel
);
3181 xBrdcst
->addModifyListener( xOLEListener
);
3189 /* --18.05.2006 16:39---------------------------------------------------
3191 -----------------------------------------------------------------------*/
3194 uno::Reference
< embed::XEmbeddedObject
> SAL_CALL
SwXTextEmbeddedObject::getExtendedControlOverEmbeddedObject()
3195 throw( uno::RuntimeException
)
3197 uno::Reference
< embed::XEmbeddedObject
> xResult
;
3198 SwFrmFmt
* pFmt
= GetFrmFmt();
3201 SwDoc
* pDoc
= pFmt
->GetDoc();
3202 const SwFmtCntnt
* pCnt
= &pFmt
->GetCntnt();
3203 DBG_ASSERT( pCnt
->GetCntntIdx() &&
3204 pDoc
->GetNodes()[ pCnt
->GetCntntIdx()->
3205 GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3207 SwOLENode
* pOleNode
= pDoc
->GetNodes()[ pCnt
->GetCntntIdx()
3208 ->GetIndex() + 1 ]->GetOLENode();
3209 xResult
= pOleNode
->GetOLEObj().GetOleRef();
3210 if ( svt::EmbeddedObjectRef::TryRunningState( xResult
) )
3212 // TODO/LATER: the listener registered after client creation should be able to handle scaling, after that the client is not necessary here
3213 if ( pDoc
->GetDocShell() )
3214 pDoc
->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xResult
, embed::Aspects::MSOLE_CONTENT
) );
3216 uno::Reference
< lang::XComponent
> xComp( xResult
->getComponent(), uno::UNO_QUERY
);
3217 uno::Reference
< util::XModifyBroadcaster
> xBrdcst( xComp
, uno::UNO_QUERY
);
3218 uno::Reference
< frame::XModel
> xModel( xComp
, uno::UNO_QUERY
);
3219 if( xBrdcst
.is() && xModel
.is() )
3221 SwClientIter
aIter( *pFmt
);
3222 SwXOLEListener
* pListener
= (SwXOLEListener
*)aIter
.
3223 First( TYPE( SwXOLEListener
));
3224 //create a new one if the OLE object doesn't have one already
3227 uno::Reference
< util::XModifyListener
> xOLEListener
= new SwXOLEListener(*pFmt
, xModel
);
3228 xBrdcst
->addModifyListener( xOLEListener
);
3236 sal_Int64 SAL_CALL
SwXTextEmbeddedObject::getAspect() throw (uno::RuntimeException
)
3238 SwFrmFmt
* pFmt
= GetFrmFmt();
3241 SwDoc
* pDoc
= pFmt
->GetDoc();
3242 const SwFmtCntnt
* pCnt
= &pFmt
->GetCntnt();
3243 DBG_ASSERT( pCnt
->GetCntntIdx() &&
3244 pDoc
->GetNodes()[ pCnt
->GetCntntIdx()->
3245 GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3247 return pDoc
->GetNodes()[ pCnt
->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->GetAspect();
3250 return embed::Aspects::MSOLE_CONTENT
; // return the default value
3253 void SAL_CALL
SwXTextEmbeddedObject::setAspect( sal_Int64 nAspect
) throw (uno::RuntimeException
)
3255 SwFrmFmt
* pFmt
= GetFrmFmt();
3258 SwDoc
* pDoc
= pFmt
->GetDoc();
3259 const SwFmtCntnt
* pCnt
= &pFmt
->GetCntnt();
3260 DBG_ASSERT( pCnt
->GetCntntIdx() &&
3261 pDoc
->GetNodes()[ pCnt
->GetCntntIdx()->
3262 GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3264 pDoc
->GetNodes()[ pCnt
->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->SetAspect( nAspect
);
3268 uno::Reference
< graphic::XGraphic
> SAL_CALL
SwXTextEmbeddedObject::getReplacementGraphic() throw (uno::RuntimeException
)
3270 SwFrmFmt
* pFmt
= GetFrmFmt();
3273 SwDoc
* pDoc
= pFmt
->GetDoc();
3274 const SwFmtCntnt
* pCnt
= &pFmt
->GetCntnt();
3275 DBG_ASSERT( pCnt
->GetCntntIdx() &&
3276 pDoc
->GetNodes()[ pCnt
->GetCntntIdx()->
3277 GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3279 Graphic
* pGraphic
= pDoc
->GetNodes()[ pCnt
->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->GetGraphic();
3281 return pGraphic
->GetXGraphic();
3284 return uno::Reference
< graphic::XGraphic
>();
3287 /* -----------------03.05.99 12:28-------------------
3289 * --------------------------------------------------*/
3290 OUString
SwXTextEmbeddedObject::getImplementationName(void) throw( uno::RuntimeException
)
3293 return C2U("SwXTextEmbeddedObject");
3295 /* -----------------03.05.99 12:28-------------------
3297 * --------------------------------------------------*/
3298 sal_Bool
SwXTextEmbeddedObject::supportsService(const OUString
& rServiceName
) throw( uno::RuntimeException
)
3300 return COMPARE_EQUAL
== rServiceName
.compareToAscii("com.sun.star.text.TextEmbeddedObject")||
3301 SwXFrame::supportsService(rServiceName
);
3303 /* -----------------03.05.99 12:28-------------------
3305 * --------------------------------------------------*/
3306 uno::Sequence
< OUString
> SwXTextEmbeddedObject::getSupportedServiceNames(void)
3307 throw( uno::RuntimeException
)
3309 uno::Sequence
< OUString
> aRet
= SwXFrame::getSupportedServiceNames();
3310 aRet
.realloc(aRet
.getLength() + 1);
3311 OUString
* pArray
= aRet
.getArray();
3312 pArray
[aRet
.getLength() - 1] = C2U("com.sun.star.text.TextEmbeddedObject");
3315 /* -----------------------------20.06.00 10:02--------------------------------
3317 ---------------------------------------------------------------------------*/
3318 void * SAL_CALL
SwXTextEmbeddedObject::operator new( size_t t
) throw()
3320 return SwXTextEmbeddedObjectBaseClass::operator new(t
);
3322 /* -----------------------------20.06.00 10:02--------------------------------
3324 ---------------------------------------------------------------------------*/
3325 void SAL_CALL
SwXTextEmbeddedObject::operator delete( void * p
) throw()
3327 SwXTextEmbeddedObjectBaseClass::operator delete(p
);
3329 /* -----------------------------15.12.00 12:45--------------------------------
3331 ---------------------------------------------------------------------------*/
3332 uno::Reference
<container::XNameReplace
> SAL_CALL
3333 SwXTextEmbeddedObject::getEvents()
3334 throw(uno::RuntimeException
)
3336 return new SwFrameEventDescriptor( *this );
3340 /******************************************************************
3342 ******************************************************************/
3343 TYPEINIT1(SwXOLEListener
, SwClient
);
3344 /* -----------------------------18.01.2002 09:59------------------------------
3346 ---------------------------------------------------------------------------*/
3347 SwXOLEListener::SwXOLEListener( SwFmt
& rOLEFmt
, uno::Reference
< XModel
> xOLE
) :
3352 /* -----------------------------18.01.2002 09:59------------------------------
3354 ---------------------------------------------------------------------------*/
3355 SwXOLEListener::~SwXOLEListener()
3358 void SwXOLEListener::modified( const lang::EventObject
& /*rEvent*/ )
3359 throw( uno::RuntimeException
)
3361 vos::OGuard
aGuard(Application::GetSolarMutex());
3364 SwFmt
* pFmt
= GetFmt();
3366 {const SwNodeIndex
* pIdx
= pFmt
->GetCntnt().GetCntntIdx();
3369 SwNodeIndex
aIdx(*pIdx
, 1);
3370 SwNoTxtNode
* pNoTxt
= aIdx
.GetNode().GetNoTxtNode();
3371 pNd
= pNoTxt
->GetOLENode();
3375 throw uno::RuntimeException();
3377 uno::Reference
< embed::XEmbeddedObject
> xIP
= pNd
->GetOLEObj().GetOleRef();
3380 sal_Int32 nState
= xIP
->getCurrentState();
3381 if ( nState
== embed::EmbedStates::INPLACE_ACTIVE
|| nState
== embed::EmbedStates::UI_ACTIVE
)
3385 // if the OLE-Node is UI-Active do nothing
3386 pNd
->SetOLESizeInvalid( sal_True
);
3387 pNd
->GetDoc()->SetOLEObjModified();
3390 /* ---------------------------------------------------------------------------
3392 ---------------------------------------------------------------------------*/
3393 void SwXOLEListener::disposing( const lang::EventObject
& rEvent
)
3394 throw( uno::RuntimeException
)
3396 vos::OGuard
aGuard(Application::GetSolarMutex());
3398 uno::Reference
< util::XModifyListener
> xListener( this );
3401 uno::Reference
< frame::XModel
> xModel( rEvent
.Source
, uno::UNO_QUERY
);
3402 uno::Reference
< util::XModifyBroadcaster
> xBrdcst(xModel
, uno::UNO_QUERY
);
3407 xBrdcst
->removeModifyListener( xListener
);
3409 catch(uno::Exception
const &)
3411 DBG_ERROR("OLE Listener couldn't be removed");
3414 /* ---------------------------------------------------------------------------
3416 ---------------------------------------------------------------------------*/
3417 void SwXOLEListener::Modify( SfxPoolItem
* pOld
, SfxPoolItem
* pNew
)
3419 ClientModify(this, pOld
, pNew
);
3420 if(!GetRegisteredIn())