Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
31 : : #include <com/sun/star/container/XChild.hpp>
32 : : #include <com/sun/star/embed/XClassifiedObject.hpp>
33 : : #include <com/sun/star/embed/XVisualObject.hpp>
34 : : #include <com/sun/star/embed/XComponentSupplier.hpp>
35 : : #include <com/sun/star/embed/EmbedStates.hpp>
36 : : #include <com/sun/star/embed/Aspects.hpp>
37 : : #include <com/sun/star/graphic/XGraphicProvider.hpp>
38 : : #include <svx/svxids.hrc>
39 : : #include <editeng/memberids.hrc>
40 : :
41 : : #include <swtypes.hxx>
42 : : #include <cmdid.h>
43 : :
44 : : #include <memory>
45 : : #include <hints.hxx>
46 : : #include <doc.hxx>
47 : : #include <IDocumentUndoRedo.hxx>
48 : : #include <docsh.hxx>
49 : : #include <editsh.hxx>
50 : : #include <swcli.hxx>
51 : : #include <ndindex.hxx>
52 : : #include <pam.hxx>
53 : : #include <ndnotxt.hxx>
54 : : #include <svx/unomid.hxx>
55 : : #include <unocrsr.hxx>
56 : : #include <unocrsrhelper.hxx>
57 : : #include <docstyle.hxx>
58 : : #include <dcontact.hxx>
59 : : #include <fmtcnct.hxx>
60 : : #include <ndole.hxx>
61 : : #include <frmfmt.hxx>
62 : : #include <frame.hxx>
63 : : #include <unotextrange.hxx>
64 : : #include <unotextcursor.hxx>
65 : : #include <unoparagraph.hxx>
66 : : #include <unomap.hxx>
67 : : #include <unoprnms.hxx>
68 : : #include <unoevent.hxx>
69 : : #include <com/sun/star/util/XModifyBroadcaster.hpp>
70 : : #include <com/sun/star/table/ShadowFormat.hpp>
71 : : #include <com/sun/star/style/GraphicLocation.hpp>
72 : : #include <com/sun/star/text/GraphicCrop.hpp>
73 : : #include <com/sun/star/text/TextContentAnchorType.hpp>
74 : : #include <com/sun/star/text/XTextColumns.hpp>
75 : : #include <com/sun/star/text/WrapTextMode.hpp>
76 : : #include <com/sun/star/beans/PropertyAttribute.hpp>
77 : : #include <com/sun/star/drawing/PointSequenceSequence.hpp>
78 : : #include <com/sun/star/drawing/PointSequence.hpp>
79 : : #include <com/sun/star/drawing/ColorMode.hpp>
80 : : #include <tools/poly.hxx>
81 : : #include <swundo.hxx>
82 : : #include <unostyle.hxx>
83 : : #include <svx/svdmodel.hxx>
84 : : #include <svx/svdpage.hxx>
85 : : #include <editeng/brshitem.hxx>
86 : : #include <editeng/protitem.hxx>
87 : : #include <fmtornt.hxx>
88 : : #include <fmturl.hxx>
89 : : #include <editeng/lrspitem.hxx>
90 : : #include <editeng/ulspitem.hxx>
91 : : #include <editeng/boxitem.hxx>
92 : : #include <editeng/opaqitem.hxx>
93 : : #include <editeng/prntitem.hxx>
94 : : #include <editeng/shaditem.hxx>
95 : : #include <fmtsrnd.hxx>
96 : : #include <fmtfsize.hxx>
97 : : #include <grfatr.hxx>
98 : : #include <unoframe.hxx>
99 : : #include <fmtanchr.hxx>
100 : : #include <fmtclds.hxx>
101 : : #include <fmtcntnt.hxx>
102 : : #include <frmatr.hxx>
103 : : #include <ndtxt.hxx>
104 : : #include <ndgrf.hxx>
105 : : #include <osl/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 <editeng/frmdiritem.hxx>
114 : : #include <fmtfollowtextflow.hxx>
115 : : #include <fmtwrapinfluenceonobjpos.hxx>
116 : : #include <toolkit/helper/vclunohelper.hxx>
117 : : #include <switerator.hxx>
118 : : #include <comphelper/servicehelper.hxx>
119 : :
120 : : // from fefly1.cxx
121 : : extern sal_Bool lcl_ChkAndSetNewAnchor( const SwFlyFrm& rFly, SfxItemSet& rSet );
122 : :
123 : : using namespace ::com::sun::star;
124 : : using ::rtl::OUString;
125 : :
126 : : using ::com::sun::star::frame::XModel;
127 : : using ::com::sun::star::container::XNameAccess;
128 : : using ::com::sun::star::style::XStyleFamiliesSupplier;
129 : :
130 : : const sal_Char sPackageProtocol[] = "vnd.sun.star.Package:";
131 : : const sal_Char sGraphicObjectProtocol[] = "vnd.sun.star.GraphicObject:";
132 : :
133 : : /****************************************************************************
134 : : Rahmenbeschreibung
135 : : ****************************************************************************/
136 : 604 : class BaseFrameProperties_Impl
137 : : {
138 : : SwUnoCursorHelper::SwAnyMapHelper aAnyMap;
139 : :
140 : : public:
141 : : virtual ~BaseFrameProperties_Impl();
142 : :
143 : : void SetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any& rVal);
144 : : bool GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any*& pAny );
145 : : bool FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet &rFromSet, bool& rSizeFound);
146 : :
147 : : virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, bool& rSizeFound) = 0;
148 : :
149 : : };
150 : :
151 : 604 : BaseFrameProperties_Impl::~BaseFrameProperties_Impl()
152 : : {
153 [ - + ]: 604 : }
154 : :
155 : 3119 : void BaseFrameProperties_Impl::SetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any& rVal)
156 : : {
157 : 3119 : aAnyMap.SetValue( nWID, nMemberId, rVal );
158 : 3119 : }
159 : :
160 : 41786 : bool BaseFrameProperties_Impl::GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any*& rpAny)
161 : : {
162 : 41786 : return aAnyMap.FillValue( nWID, nMemberId, rpAny );
163 : : }
164 : :
165 : 590 : bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet& rFromSet, bool& rSizeFound)
166 : : {
167 : 590 : bool bRet = true;
168 : : //Anker kommt auf jeden Fall in den Set
169 [ + - ][ + - ]: 590 : SwFmtAnchor aAnchor ( static_cast < const SwFmtAnchor & > ( rFromSet.Get ( RES_ANCHOR ) ) );
170 : : {
171 : : const ::uno::Any* pAnchorPgNo;
172 [ + - ][ + + ]: 590 : if(GetProperty(RES_ANCHOR, MID_ANCHOR_PAGENUM, pAnchorPgNo))
173 [ + - ]: 2 : bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorPgNo, MID_ANCHOR_PAGENUM);
174 : : const ::uno::Any* pAnchorType;
175 [ + - ][ + + ]: 590 : if(GetProperty(RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, pAnchorType))
176 [ + - ]: 553 : bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorType, MID_ANCHOR_ANCHORTYPE);
177 : : }
178 [ + - ]: 590 : rToSet.Put(aAnchor);
179 : : {
180 : 590 : const ::uno::Any* pCol = 0;
181 [ + - ]: 590 : GetProperty(RES_BACKGROUND, MID_BACK_COLOR, pCol );
182 : 590 : const ::uno::Any* pRGBCol = 0;
183 [ + - ]: 590 : GetProperty(RES_BACKGROUND, MID_BACK_COLOR_R_G_B, pRGBCol );
184 : 590 : const ::uno::Any* pColTrans = 0;
185 [ + - ]: 590 : GetProperty(RES_BACKGROUND, MID_BACK_COLOR_TRANSPARENCY, pColTrans);
186 : 590 : const ::uno::Any* pTrans = 0;
187 [ + - ]: 590 : GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENT, pTrans );
188 : 590 : const ::uno::Any* pGrLoc = 0;
189 [ + - ]: 590 : GetProperty(RES_BACKGROUND, MID_GRAPHIC_POSITION, pGrLoc );
190 : 590 : const ::uno::Any* pGrURL = 0;
191 [ + - ]: 590 : GetProperty(RES_BACKGROUND, MID_GRAPHIC_URL, pGrURL );
192 : 590 : const ::uno::Any* pGrFilter = 0;
193 [ + - ]: 590 : GetProperty(RES_BACKGROUND, MID_GRAPHIC_FILTER, pGrFilter );
194 : 590 : const ::uno::Any* pGrTranparency = 0;
195 [ + - ]: 590 : GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENCY, pGrTranparency );
196 : :
197 [ + + ][ + - ]: 590 : if(pCol || pTrans || pGrURL || pGrFilter || pGrLoc ||
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ - + ]
198 : : pGrTranparency || pColTrans || pRGBCol)
199 : : {
200 [ + - ][ + - ]: 27 : SvxBrushItem aBrush ( static_cast < const :: SvxBrushItem & > ( rFromSet.Get ( RES_BACKGROUND ) ) );
201 [ + - ]: 27 : if(pCol )
202 [ + - ]: 27 : bRet &= ((SfxPoolItem&)aBrush).PutValue(*pCol,MID_BACK_COLOR );
203 [ - + ]: 27 : if(pColTrans)
204 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aBrush).PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY);
205 [ - + ]: 27 : if(pRGBCol)
206 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aBrush).PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B);
207 [ - + ]: 27 : if(pTrans)
208 : : {
209 : : // don't overwrite transparency with a non-transparence flag
210 [ # # ][ # # ]: 0 : if(!pColTrans || Any2Bool( *pTrans ))
[ # # ][ # # ]
211 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aBrush).PutValue(*pTrans, MID_GRAPHIC_TRANSPARENT);
212 : : }
213 [ - + ]: 27 : if(pGrURL)
214 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrURL, MID_GRAPHIC_URL);
215 [ - + ]: 27 : if(pGrFilter)
216 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrFilter, MID_GRAPHIC_FILTER);
217 [ - + ]: 27 : if(pGrLoc)
218 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrLoc, MID_GRAPHIC_POSITION);
219 [ - + ]: 27 : if(pGrTranparency)
220 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrTranparency, MID_GRAPHIC_TRANSPARENCY);
221 : :
222 [ + - ][ + - ]: 27 : rToSet.Put(aBrush);
223 : : }
224 : : }
225 : : {
226 : 590 : const ::uno::Any* pCont = 0;
227 [ + - ]: 590 : GetProperty(RES_PROTECT, MID_PROTECT_CONTENT, pCont );
228 : 590 : const ::uno::Any* pPos = 0;
229 [ + - ]: 590 : GetProperty(RES_PROTECT,MID_PROTECT_POSITION, pPos );
230 : 590 : const ::uno::Any* pName = 0;
231 [ + - ]: 590 : GetProperty(RES_PROTECT, MID_PROTECT_SIZE, pName );
232 [ + - ][ + - ]: 590 : if(pCont||pPos||pName)
[ - + ]
233 : : {
234 [ # # ][ # # ]: 0 : SvxProtectItem aProt ( static_cast < const :: SvxProtectItem & > ( rFromSet.Get ( RES_PROTECT ) ) );
235 [ # # ]: 0 : if(pCont)
236 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aProt).PutValue(*pCont, MID_PROTECT_CONTENT);
237 [ # # ]: 0 : if(pPos )
238 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aProt).PutValue(*pPos, MID_PROTECT_POSITION);
239 [ # # ]: 0 : if(pName)
240 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aProt).PutValue(*pName, MID_PROTECT_SIZE);
241 [ # # ][ # # ]: 0 : rToSet.Put(aProt);
242 : : }
243 : : }
244 : : {
245 : 590 : const ::uno::Any* pHori = 0;
246 [ + - ]: 590 : GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, pHori );
247 : 590 : const ::uno::Any* pHoriP = 0;
248 [ + - ]: 590 : GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_POSITION|CONVERT_TWIPS, pHoriP );
249 : 590 : const ::uno::Any* pHoriR = 0;
250 [ + - ]: 590 : GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_RELATION, pHoriR );
251 : 590 : const ::uno::Any* pPageT = 0;
252 [ + - ]: 590 : GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_PAGETOGGLE, pPageT);
253 [ + + ][ + - ]: 590 : if(pHori||pHoriP||pHoriR||pPageT)
[ + - ][ - + ]
254 : : {
255 [ + - ][ + - ]: 48 : SwFmtHoriOrient aOrient ( static_cast < const :: SwFmtHoriOrient & > ( rFromSet.Get ( RES_HORI_ORIENT ) ) );
256 [ + - ]: 48 : if(pHori )
257 [ + - ]: 48 : bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHori, MID_HORIORIENT_ORIENT);
258 [ + + ]: 48 : if(pHoriP)
259 [ + - ]: 44 : bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHoriP, MID_HORIORIENT_POSITION|CONVERT_TWIPS);
260 [ + + ]: 48 : if(pHoriR)
261 [ + - ]: 30 : bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHoriR, MID_HORIORIENT_RELATION);
262 [ + + ]: 48 : if(pPageT)
263 [ + - ]: 21 : bRet &= ((SfxPoolItem&)aOrient).PutValue(*pPageT, MID_HORIORIENT_PAGETOGGLE);
264 [ + - ][ + - ]: 48 : rToSet.Put(aOrient);
265 : : }
266 : : }
267 : :
268 : : {
269 : 590 : const ::uno::Any* pVert = 0;
270 [ + - ]: 590 : GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_ORIENT, pVert);
271 : 590 : const ::uno::Any* pVertP = 0;
272 [ + - ]: 590 : GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_POSITION|CONVERT_TWIPS, pVertP );
273 : 590 : const ::uno::Any* pVertR = 0;
274 [ + - ]: 590 : GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_RELATION, pVertR );
275 [ + + ][ + - ]: 590 : if(pVert||pVertP||pVertR)
[ - + ]
276 : : {
277 [ + - ][ + - ]: 46 : SwFmtVertOrient aOrient ( static_cast < const :: SwFmtVertOrient & > ( rFromSet.Get ( RES_VERT_ORIENT ) ) );
278 [ + - ]: 46 : if(pVert )
279 [ + - ]: 46 : bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVert, MID_VERTORIENT_ORIENT);
280 [ + + ]: 46 : if(pVertP)
281 [ + - ]: 44 : bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVertP, MID_VERTORIENT_POSITION|CONVERT_TWIPS);
282 [ + + ]: 46 : if(pVertR)
283 [ + - ]: 34 : bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVertR, MID_VERTORIENT_RELATION);
284 [ + - ][ + - ]: 46 : rToSet.Put(aOrient);
285 : : }
286 : : }
287 : : {
288 : 590 : const ::uno::Any* pURL = 0;
289 [ + - ]: 590 : GetProperty(RES_URL, MID_URL_URL, pURL );
290 : 590 : const ::uno::Any* pTarget = 0;
291 [ + - ]: 590 : GetProperty(RES_URL, MID_URL_TARGET, pTarget );
292 : 590 : const ::uno::Any* pHyLNm = 0;
293 [ + - ]: 590 : GetProperty(RES_URL, MID_URL_HYPERLINKNAME, pHyLNm );
294 : 590 : const ::uno::Any* pHySMp = 0;
295 [ + - ]: 590 : GetProperty(RES_URL, MID_URL_SERVERMAP, pHySMp );
296 [ + - ][ + - ]: 590 : if(pURL||pTarget||pHyLNm||pHySMp)
[ + - ][ - + ]
297 : : {
298 [ # # ][ # # ]: 0 : SwFmtURL aURL ( static_cast < const :: SwFmtURL & > ( rFromSet.Get ( RES_URL ) ) );
299 [ # # ]: 0 : if(pURL)
300 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aURL).PutValue(*pURL, MID_URL_URL);
301 [ # # ]: 0 : if(pTarget)
302 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aURL).PutValue(*pTarget, MID_URL_TARGET);
303 [ # # ]: 0 : if(pHyLNm)
304 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aURL).PutValue(*pHyLNm, MID_URL_HYPERLINKNAME );
305 [ # # ]: 0 : if(pHySMp)
306 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aURL).PutValue(*pHySMp, MID_URL_SERVERMAP);
307 [ # # ][ # # ]: 0 : rToSet.Put(aURL);
308 : : }
309 : : }
310 : 590 : const ::uno::Any* pL = 0;
311 [ + - ]: 590 : GetProperty(RES_LR_SPACE, MID_L_MARGIN|CONVERT_TWIPS, pL );
312 : 590 : const ::uno::Any* pR = 0;
313 [ + - ]: 590 : GetProperty(RES_LR_SPACE, MID_R_MARGIN|CONVERT_TWIPS, pR );
314 [ + + ][ - + ]: 590 : if(pL||pR)
315 : : {
316 [ + - ][ + - ]: 30 : SvxLRSpaceItem aLR ( static_cast < const :: SvxLRSpaceItem & > ( rFromSet.Get ( RES_LR_SPACE ) ) );
317 [ + - ]: 30 : if(pL)
318 [ + - ]: 30 : bRet &= ((SfxPoolItem&)aLR).PutValue(*pL, MID_L_MARGIN|CONVERT_TWIPS);
319 [ + - ]: 30 : if(pR)
320 [ + - ]: 30 : bRet &= ((SfxPoolItem&)aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS);
321 [ + - ][ + - ]: 30 : rToSet.Put(aLR);
322 : : }
323 : 590 : const ::uno::Any* pT = 0;
324 [ + - ]: 590 : GetProperty(RES_UL_SPACE, MID_UP_MARGIN|CONVERT_TWIPS, pT );
325 : 590 : const ::uno::Any* pB = 0;
326 [ + - ]: 590 : GetProperty(RES_UL_SPACE, MID_LO_MARGIN|CONVERT_TWIPS, pB );
327 [ + + ][ - + ]: 590 : if(pT||pB)
328 : : {
329 [ + - ][ + - ]: 30 : SvxULSpaceItem aTB ( static_cast < const :: SvxULSpaceItem &> ( rFromSet.Get ( RES_UL_SPACE ) ) );
330 [ + - ]: 30 : if(pT)
331 [ + - ]: 30 : bRet &= ((SfxPoolItem&)aTB).PutValue(*pT, MID_UP_MARGIN|CONVERT_TWIPS);
332 [ + - ]: 30 : if(pB)
333 [ + - ]: 30 : bRet &= ((SfxPoolItem&)aTB).PutValue(*pB, MID_LO_MARGIN|CONVERT_TWIPS);
334 [ + - ][ + - ]: 30 : rToSet.Put(aTB);
335 : : }
336 : : const ::uno::Any* pOp;
337 [ + - ][ + + ]: 590 : if(GetProperty(RES_OPAQUE, 0, pOp))
338 : : {
339 [ + - ][ + - ]: 12 : SvxOpaqueItem aOp ( static_cast < const :: SvxOpaqueItem& > ( rFromSet.Get ( RES_OPAQUE ) ) );
340 [ + - ]: 12 : bRet &= ((SfxPoolItem&)aOp).PutValue(*pOp, 0);
341 [ + - ][ + - ]: 12 : rToSet.Put(aOp);
342 : : }
343 : : const ::uno::Any* pPrt;
344 [ + - ][ - + ]: 590 : if(GetProperty(RES_PRINT, 0, pPrt))
345 : : {
346 [ # # ][ # # ]: 0 : SvxPrintItem aPrt ( static_cast < const :: SvxPrintItem & > ( rFromSet.Get ( RES_PRINT ) ) );
347 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aPrt).PutValue(*pPrt, 0);
348 [ # # ][ # # ]: 0 : rToSet.Put(aPrt);
349 : : }
350 : : const ::uno::Any* pSh;
351 [ + - ][ - + ]: 590 : if(GetProperty(RES_SHADOW, CONVERT_TWIPS, pSh))
352 : : {
353 [ # # ][ # # ]: 0 : SvxShadowItem aSh ( static_cast < const :: SvxShadowItem& > ( rFromSet.Get ( RES_SHADOW ) ) );
354 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aSh).PutValue(*pSh, CONVERT_TWIPS);
355 [ # # ][ # # ]: 0 : rToSet.Put(aSh);
356 : : }
357 : 590 : const ::uno::Any* pSur = 0;
358 [ + - ]: 590 : GetProperty(RES_SURROUND, MID_SURROUND_SURROUNDTYPE, pSur);
359 : 590 : const ::uno::Any* pSurAnch = 0;
360 [ + - ]: 590 : GetProperty(RES_SURROUND, MID_SURROUND_ANCHORONLY, pSurAnch);
361 [ + + ][ - + ]: 590 : if(pSur || pSurAnch)
362 : : {
363 [ + - ][ + - ]: 15 : SwFmtSurround aSrnd ( static_cast < const :: SwFmtSurround & > ( rFromSet.Get ( RES_SURROUND ) ) );
364 [ + - ]: 15 : if(pSur)
365 [ + - ]: 15 : bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE );
366 [ - + ]: 15 : if(pSurAnch)
367 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSurAnch, MID_SURROUND_ANCHORONLY);
368 [ + - ][ + - ]: 15 : rToSet.Put(aSrnd);
369 : : }
370 : 590 : const ::uno::Any* pLeft = 0;
371 [ + - ]: 590 : GetProperty(RES_BOX, LEFT_BORDER |CONVERT_TWIPS, pLeft );
372 : 590 : const ::uno::Any* pRight = 0;
373 [ + - ]: 590 : GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER , pRight );
374 : 590 : const ::uno::Any* pTop = 0;
375 [ + - ]: 590 : GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER , pTop );
376 : 590 : const ::uno::Any* pBottom = 0;
377 [ + - ]: 590 : GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER, pBottom);
378 : 590 : const ::uno::Any* pDistance = 0;
379 [ + - ]: 590 : GetProperty(RES_BOX, CONVERT_TWIPS|BORDER_DISTANCE, pDistance);
380 : 590 : const ::uno::Any* pLeftDistance = 0;
381 [ + - ]: 590 : GetProperty(RES_BOX, CONVERT_TWIPS|LEFT_BORDER_DISTANCE, pLeftDistance);
382 : 590 : const ::uno::Any* pRightDistance = 0;
383 [ + - ]: 590 : GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE, pRightDistance);
384 : 590 : const ::uno::Any* pTopDistance = 0;
385 [ + - ]: 590 : GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER_DISTANCE, pTopDistance);
386 : 590 : const ::uno::Any* pBottomDistance = 0;
387 [ + - ]: 590 : GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE, pBottomDistance);
388 : 590 : const ::uno::Any* pLineStyle = 0;
389 [ + - ]: 590 : GetProperty(RES_BOX, LINE_STYLE, pLineStyle);
390 : 590 : const ::uno::Any* pLineWidth = 0;
391 [ + - ]: 590 : GetProperty(RES_BOX, LINE_WIDTH, pLineWidth);
392 [ + + ][ + - ]: 590 : if( pLeft || pRight || pTop || pBottom || pDistance ||
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + + ]
[ - + ]
393 : : pLeftDistance || pRightDistance || pTopDistance || pBottomDistance ||
394 : : pLineStyle || pLineWidth )
395 : : {
396 [ + - ][ + - ]: 54 : SvxBoxItem aBox ( static_cast < const :: SvxBoxItem & > ( rFromSet.Get ( RES_BOX ) ) );
397 [ + + ]: 54 : if( pLeft )
398 [ + - ]: 42 : bRet &= ((SfxPoolItem&)aBox).PutValue(*pLeft, CONVERT_TWIPS|LEFT_BORDER );
399 [ + + ]: 54 : if( pRight )
400 [ + - ]: 42 : bRet &= ((SfxPoolItem&)aBox).PutValue(*pRight, CONVERT_TWIPS|RIGHT_BORDER );
401 [ + + ]: 54 : if( pTop )
402 [ + - ]: 42 : bRet &= ((SfxPoolItem&)aBox).PutValue(*pTop, CONVERT_TWIPS|TOP_BORDER);
403 [ + + ]: 54 : if( pBottom )
404 [ + - ]: 42 : bRet &= ((SfxPoolItem&)aBox).PutValue(*pBottom, CONVERT_TWIPS|BOTTOM_BORDER);
405 [ - + ]: 54 : if( pDistance )
406 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aBox).PutValue(*pDistance, CONVERT_TWIPS|BORDER_DISTANCE);
407 [ + + ]: 54 : if( pLeftDistance )
408 [ + - ]: 15 : bRet &= ((SfxPoolItem&)aBox).PutValue(*pLeftDistance, CONVERT_TWIPS|LEFT_BORDER_DISTANCE);
409 [ + + ]: 54 : if( pRightDistance )
410 [ + - ]: 15 : bRet &= ((SfxPoolItem&)aBox).PutValue(*pRightDistance, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE);
411 [ + + ]: 54 : if( pTopDistance )
412 [ + - ]: 15 : bRet &= ((SfxPoolItem&)aBox).PutValue(*pTopDistance, CONVERT_TWIPS|TOP_BORDER_DISTANCE);
413 [ + + ]: 54 : if( pBottomDistance )
414 [ + - ]: 15 : bRet &= ((SfxPoolItem&)aBox).PutValue(*pBottomDistance, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE);
415 [ + + ]: 54 : if( pLineStyle )
416 [ + - ]: 12 : bRet &= ((SfxPoolItem&)aBox).PutValue(*pLineStyle, LINE_STYLE);
417 [ - + ]: 54 : if( pLineWidth )
418 [ # # ]: 0 : bRet &= ((SfxPoolItem&)aBox).PutValue(*pLineWidth, LINE_WIDTH|CONVERT_TWIPS);
419 [ + - ][ + - ]: 54 : rToSet.Put(aBox);
420 : : }
421 : : {
422 : 590 : const ::uno::Any* pRelH = 0;
423 [ + - ]: 590 : GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_HEIGHT, pRelH);
424 : 590 : const ::uno::Any* pRelW = 0;
425 [ + - ]: 590 : GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_WIDTH, pRelW);
426 : 590 : const ::uno::Any* pSyncWidth = 0;
427 [ + - ]: 590 : GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT, pSyncWidth);
428 : 590 : const ::uno::Any* pSyncHeight = 0;
429 [ + - ]: 590 : GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH, pSyncHeight);
430 : 590 : const ::uno::Any* pWidth = 0;
431 [ + - ]: 590 : GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS, pWidth);
432 : 590 : const ::uno::Any* pHeight = 0;
433 [ + - ]: 590 : GetProperty(RES_FRM_SIZE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS, pHeight);
434 : 590 : const ::uno::Any* pSize = 0;
435 [ + - ]: 590 : GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE|CONVERT_TWIPS, pSize);
436 : 590 : const ::uno::Any* pSizeType = 0;
437 [ + - ]: 590 : GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE_TYPE, pSizeType);
438 : 590 : const ::uno::Any* pWidthType = 0;
439 [ + - ]: 590 : GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH_TYPE, pWidthType);
440 [ + + ][ + - ]: 590 : if( pWidth || pHeight ||pRelH || pRelW || pSize ||pSizeType ||
[ + - ][ + - ]
[ + + ][ + - ]
[ + - ][ + - ]
[ - + ]
441 : : pWidthType ||pSyncWidth || pSyncHeight )
442 : : {
443 : 504 : rSizeFound = true;
444 [ + - ][ + - ]: 504 : SwFmtFrmSize aFrmSz ( static_cast < const :: SwFmtFrmSize& > ( rFromSet.Get ( RES_FRM_SIZE ) ) );
445 [ + + ]: 504 : if(pWidth)
446 [ + - ]: 474 : bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH|CONVERT_TWIPS);
447 [ + + ]: 504 : if(pHeight)
448 [ + - ]: 474 : bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pHeight, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS);
449 [ + + ]: 504 : if(pRelH )
450 [ + - ]: 6 : bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pRelH, MID_FRMSIZE_REL_HEIGHT);
451 [ + + ]: 504 : if(pRelW )
452 [ + - ]: 6 : bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pRelW, MID_FRMSIZE_REL_WIDTH);
453 [ + + ]: 504 : if(pSyncWidth)
454 [ + - ]: 6 : bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSyncWidth, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT);
455 [ + + ]: 504 : if(pSyncHeight)
456 [ + - ]: 6 : bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSyncHeight, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH);
457 [ + + ]: 504 : if(pSize)
458 [ + - ]: 57 : bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSize, MID_FRMSIZE_SIZE|CONVERT_TWIPS);
459 [ + + ]: 504 : if(pSizeType)
460 [ + - ]: 31 : bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSizeType, MID_FRMSIZE_SIZE_TYPE);
461 [ + + ]: 504 : if(pWidthType)
462 [ + - ]: 19 : bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pWidthType, MID_FRMSIZE_WIDTH_TYPE);
463 [ - + ]: 504 : if(!aFrmSz.GetWidth())
464 : 0 : aFrmSz.SetWidth(MINFLY);
465 [ - + ]: 504 : if(!aFrmSz.GetHeight())
466 : 0 : aFrmSz.SetHeight(MINFLY);
467 [ + - ][ + - ]: 504 : rToSet.Put(aFrmSz);
468 : : }
469 : : else
470 : : {
471 : 86 : rSizeFound = false;
472 [ + - ]: 86 : SwFmtFrmSize aFrmSz;
473 : 86 : awt::Size aSize;
474 : 86 : aSize.Width = 2 * MM50;
475 : 86 : aSize.Height = 2 * MM50;
476 : 86 : ::uno::Any aSizeVal;
477 [ + - ]: 86 : aSizeVal <<= aSize;
478 [ + - ]: 86 : ((SfxPoolItem&)aFrmSz).PutValue(aSizeVal, MID_FRMSIZE_SIZE|CONVERT_TWIPS);
479 [ + - ][ + - ]: 86 : rToSet.Put(aFrmSz);
480 : : }
481 : : }
482 : 590 : const ::uno::Any* pFrameDirection = 0;
483 [ + - ]: 590 : GetProperty(RES_FRAMEDIR, 0, pFrameDirection);
484 [ - + ]: 590 : if(pFrameDirection)
485 : : {
486 [ # # ]: 0 : SvxFrameDirectionItem aAttr(FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR);
487 [ # # ]: 0 : aAttr.PutValue(*pFrameDirection, 0);
488 [ # # ][ # # ]: 0 : rToSet.Put(aAttr);
489 : : }
490 : 590 : const ::uno::Any* pUnknown = 0;
491 [ + - ]: 590 : GetProperty(RES_UNKNOWNATR_CONTAINER, 0, pUnknown);
492 [ - + ]: 590 : if(pUnknown)
493 : : {
494 [ # # ]: 0 : SvXMLAttrContainerItem aAttr(RES_UNKNOWNATR_CONTAINER);
495 [ # # ]: 0 : aAttr.PutValue(*pUnknown, 0);
496 [ # # ][ # # ]: 0 : rToSet.Put(aAttr);
497 : : }
498 : :
499 : : // #i18732#
500 : 590 : const ::uno::Any* pFollowTextFlow = 0;
501 [ + - ]: 590 : GetProperty(RES_FOLLOW_TEXT_FLOW, 0, pFollowTextFlow);
502 [ - + ]: 590 : if ( pFollowTextFlow )
503 : : {
504 [ # # ]: 0 : SwFmtFollowTextFlow aFmtFollowTextFlow;
505 [ # # ]: 0 : aFmtFollowTextFlow.PutValue(*pFollowTextFlow, 0);
506 [ # # ][ # # ]: 0 : rToSet.Put(aFmtFollowTextFlow);
507 : : }
508 : :
509 : : // #i28701# - RES_WRAP_INFLUENCE_ON_OBJPOS
510 : 590 : const ::uno::Any* pWrapInfluenceOnObjPos = 0;
511 [ + - ]: 590 : GetProperty(RES_WRAP_INFLUENCE_ON_OBJPOS, MID_WRAP_INFLUENCE, pWrapInfluenceOnObjPos);
512 [ - + ]: 590 : if ( pWrapInfluenceOnObjPos )
513 : : {
514 [ # # ]: 0 : SwFmtWrapInfluenceOnObjPos aFmtWrapInfluenceOnObjPos;
515 [ # # ]: 0 : aFmtWrapInfluenceOnObjPos.PutValue( *pWrapInfluenceOnObjPos, MID_WRAP_INFLUENCE );
516 [ # # ][ # # ]: 0 : rToSet.Put(aFmtWrapInfluenceOnObjPos);
517 : : }
518 : :
519 [ + - ]: 590 : return bRet;
520 : : }
521 : :
522 : : class SwFrameProperties_Impl : public BaseFrameProperties_Impl
523 : : {
524 : : public:
525 : : SwFrameProperties_Impl();
526 [ - + ]: 694 : virtual ~SwFrameProperties_Impl(){}
527 : :
528 : : bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, bool& rSizeFound);
529 : : };
530 : :
531 : 563 : SwFrameProperties_Impl::SwFrameProperties_Impl():
532 : 563 : BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME)*/ )
533 : : {
534 : 563 : }
535 : :
536 : 549 : inline void lcl_FillCol ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, const :: uno::Any *pAny)
537 : : {
538 [ - + ]: 549 : if ( pAny )
539 : : {
540 [ # # ][ # # ]: 0 : SwFmtCol aCol ( static_cast < const :: SwFmtCol & > ( rFromSet.Get ( RES_COL ) ) );
541 [ # # ]: 0 : ((SfxPoolItem&)aCol).PutValue( *pAny, MID_COLUMNS);
542 [ # # ][ # # ]: 0 : rToSet.Put(aCol);
543 : : }
544 : 549 : }
545 : :
546 : 549 : bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItemSet&, bool& rSizeFound)
547 : : {
548 : : //Properties fuer alle Frames
549 : : const ::uno::Any *pStyleName;
550 : 549 : SwDocStyleSheet* pStyle = NULL;
551 : : bool bRet;
552 : :
553 [ + - ][ + + ]: 549 : if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
554 : : {
555 : 4 : OUString sStyle;
556 : 4 : *pStyleName >>= sStyle;
557 [ + - ]: 4 : pStyle = (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle,
558 [ + - ][ + - ]: 4 : SFX_STYLE_FAMILY_FRAME);
[ + - ]
559 : : }
560 : :
561 : 549 : const ::uno::Any* pColumns = NULL;
562 [ + - ]: 549 : GetProperty (RES_COL, MID_COLUMNS, pColumns);
563 [ + + ]: 549 : if ( pStyle )
564 : : {
565 [ + - ]: 4 : rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *pStyle ) );
566 [ + - ]: 4 : const :: SfxItemSet *pItemSet = &xStyle->GetItemSet();
567 [ + - ]: 4 : bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
568 [ + - ]: 4 : lcl_FillCol ( rSet, *pItemSet, pColumns );
569 : : }
570 : : else
571 : : {
572 [ + - ]: 545 : const :: SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME )->GetAttrSet();
573 [ + - ]: 545 : bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
574 [ + - ]: 545 : lcl_FillCol ( rSet, *pItemSet, pColumns );
575 : : }
576 : : const ::uno::Any* pEdit;
577 [ + - ][ - + ]: 549 : if(GetProperty(RES_EDIT_IN_READONLY, 0, pEdit))
578 : : {
579 [ # # ]: 0 : SfxBoolItem aBool(RES_EDIT_IN_READONLY);
580 [ # # ]: 0 : ((SfxPoolItem&)aBool).PutValue(*pEdit, 0);
581 [ # # ][ # # ]: 0 : rSet.Put(aBool);
582 : : }
583 : 549 : return bRet;
584 : : }
585 : :
586 : : /****************************************************************************
587 : : Grafik-Descriptor
588 : : ****************************************************************************/
589 : : class SwGraphicProperties_Impl : public BaseFrameProperties_Impl
590 : : {
591 : : public:
592 : : SwGraphicProperties_Impl();
593 [ - + ]: 82 : virtual ~SwGraphicProperties_Impl(){}
594 : :
595 : : virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, bool& rSizeFound);
596 : : };
597 : :
598 : 41 : SwGraphicProperties_Impl::SwGraphicProperties_Impl( ) :
599 : 41 : BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC)*/ )
600 : : {
601 : 41 : }
602 : :
603 : 41 : inline void lcl_FillMirror ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, const ::uno::Any *pHEvenMirror, const ::uno::Any *pHOddMirror, const ::uno::Any *pVMirror, bool &rRet )
604 : : {
605 [ + + ][ + - ]: 41 : if(pHEvenMirror || pHOddMirror || pVMirror )
[ - + ]
606 : : {
607 [ + - ][ + - ]: 2 : SwMirrorGrf aMirror ( static_cast < const :: SwMirrorGrf& > ( rFromSet.Get ( RES_GRFATR_MIRRORGRF ) ) );
608 [ + - ]: 2 : if(pHEvenMirror)
609 [ + - ]: 2 : rRet &= ((SfxPoolItem&)aMirror).PutValue(*pHEvenMirror, MID_MIRROR_HORZ_EVEN_PAGES);
610 [ + - ]: 2 : if(pHOddMirror)
611 [ + - ]: 2 : rRet &= ((SfxPoolItem&)aMirror).PutValue(*pHOddMirror, MID_MIRROR_HORZ_ODD_PAGES);
612 [ + - ]: 2 : if(pVMirror)
613 [ + - ]: 2 : rRet &= ((SfxPoolItem&)aMirror).PutValue(*pVMirror, MID_MIRROR_VERT);
614 [ + - ][ + - ]: 2 : rToSet.Put(aMirror);
615 : : }
616 : 41 : }
617 : :
618 : 41 : bool SwGraphicProperties_Impl::AnyToItemSet(
619 : : SwDoc* pDoc,
620 : : SfxItemSet& rFrmSet,
621 : : SfxItemSet& rGrSet,
622 : : bool& rSizeFound)
623 : : {
624 : : //Properties fuer alle Frames
625 : : bool bRet;
626 : : const ::uno::Any *pStyleName;
627 : 41 : SwDocStyleSheet* pStyle = NULL;
628 : :
629 [ + - ][ + + ]: 41 : if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
630 : : {
631 : 2 : OUString sStyle;
632 : 2 : *pStyleName >>= sStyle;
633 [ + - ]: 2 : pStyle = (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle,
634 [ + - ][ + - ]: 2 : SFX_STYLE_FAMILY_FRAME);
[ + - ]
635 : : }
636 : :
637 : 41 : const ::uno::Any* pHEvenMirror = 0;
638 : 41 : const ::uno::Any* pHOddMirror = 0;
639 : 41 : const ::uno::Any* pVMirror = 0;
640 [ + - ]: 41 : GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_EVEN_PAGES, pHEvenMirror);
641 [ + - ]: 41 : GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_ODD_PAGES, pHOddMirror);
642 [ + - ]: 41 : GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_VERT, pVMirror);
643 : :
644 [ + + ]: 41 : if ( pStyle )
645 : : {
646 [ + - ]: 2 : rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet(*pStyle) );
647 [ + - ]: 2 : const :: SfxItemSet *pItemSet = &xStyle->GetItemSet();
648 [ + - ]: 2 : bRet = FillBaseProperties(rFrmSet, *pItemSet, rSizeFound);
649 [ + - ]: 2 : lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
650 : : }
651 : : else
652 : : {
653 [ + - ]: 39 : const :: SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC )->GetAttrSet();
654 [ + - ]: 39 : bRet = FillBaseProperties(rFrmSet, *pItemSet, rSizeFound);
655 [ + - ]: 39 : lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
656 : : }
657 : :
658 : :
659 : : static const :: sal_uInt16 nIDs[] =
660 : : {
661 : : RES_GRFATR_CROPGRF,
662 : : RES_GRFATR_ROTATION,
663 : : RES_GRFATR_LUMINANCE,
664 : : RES_GRFATR_CONTRAST,
665 : : RES_GRFATR_CHANNELR,
666 : : RES_GRFATR_CHANNELG,
667 : : RES_GRFATR_CHANNELB,
668 : : RES_GRFATR_GAMMA,
669 : : RES_GRFATR_INVERT,
670 : : RES_GRFATR_TRANSPARENCY,
671 : : RES_GRFATR_DRAWMODE,
672 : : 0
673 : : };
674 : : const ::uno::Any* pAny;
675 [ + + ]: 492 : for(sal_Int16 nIndex = 0; nIDs[nIndex]; nIndex++)
676 : : {
677 [ + + ]: 451 : sal_uInt8 nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0;
678 [ + - ][ + + ]: 451 : if(GetProperty(nIDs[nIndex], nMId, pAny ))
679 : : {
680 [ + - ][ + - ]: 52 : SfxPoolItem* pItem = ::GetDfltAttr( nIDs[nIndex] )->Clone();
681 [ + - ]: 52 : bRet &= pItem->PutValue(*pAny, nMId );
682 [ + - ]: 52 : rGrSet.Put(*pItem);
683 [ + - ][ + - ]: 52 : delete pItem;
684 : : }
685 : : }
686 : :
687 : 41 : return bRet;
688 : : }
689 : :
690 : : class SwOLEProperties_Impl : public SwFrameProperties_Impl
691 : : {
692 : : public:
693 : 432 : SwOLEProperties_Impl() :
694 : 432 : SwFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_EMBEDDED_OBJECT)*/ ){}
695 [ - + ]: 864 : virtual ~SwOLEProperties_Impl(){}
696 : :
697 : : virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, bool& rSizeFound);
698 : : };
699 : :
700 : 432 : bool SwOLEProperties_Impl::AnyToItemSet(
701 : : SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, bool& rSizeFound)
702 : : {
703 : : const ::uno::Any* pTemp;
704 [ + - ][ + + ]: 858 : if(!GetProperty(FN_UNO_CLSID, 0, pTemp) && !GetProperty(FN_UNO_STREAM_NAME, 0, pTemp)
[ + - ][ + - ]
[ - + ][ - + ]
705 [ + - ]: 426 : && !GetProperty(FN_EMBEDDED_OBJECT, 0, pTemp) )
706 : 0 : return sal_False;
707 [ + - ]: 432 : SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrmSet, rSet, rSizeFound);
708 : : //
709 : 432 : return sal_True;
710 : : }
711 : :
712 : : namespace
713 : : {
714 : : class theSwXFrameUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXFrameUnoTunnelId > {};
715 : : }
716 : :
717 : 3276 : const :: uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId()
718 : : {
719 : 3276 : return theSwXFrameUnoTunnelId::get().getSeq();
720 : : }
721 : :
722 : 3274 : sal_Int64 SAL_CALL SwXFrame::getSomething( const :: uno::Sequence< sal_Int8 >& rId )
723 : : throw(uno::RuntimeException)
724 : : {
725 [ + - - + ]: 6548 : if( rId.getLength() == 16
[ - + ]
726 : 3274 : && 0 == memcmp( getUnoTunnelId().getConstArray(),
727 : 3274 : rId.getConstArray(), 16 ) )
728 : : {
729 : 0 : return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
730 : : }
731 : 3274 : return 0;
732 : : }
733 : :
734 [ + + ][ + + ]: 4942 : TYPEINIT1(SwXFrame, SwClient);
735 : :
736 : 0 : OUString SwXFrame::getImplementationName(void) throw( uno::RuntimeException )
737 : : {
738 : 0 : return C2U("SwXFrame");
739 : : }
740 : :
741 : 24 : sal_Bool SwXFrame::supportsService(const :: OUString& rServiceName) throw( uno::RuntimeException )
742 : : {
743 : 24 : return !rServiceName.compareToAscii("com.sun.star.text.BaseFrame")||
744 : 18 : !rServiceName.compareToAscii("com.sun.star.text.TextContent") ||
745 [ - + ]: 42 : !rServiceName.compareToAscii("com.sun.star.document.LinkTarget");
[ + + + + ]
746 : : }
747 : :
748 : 6 : uno::Sequence< OUString > SwXFrame::getSupportedServiceNames(void) throw( uno::RuntimeException )
749 : : {
750 : 6 : uno::Sequence< OUString > aRet(3);
751 [ + - ]: 6 : OUString* pArray = aRet.getArray();
752 [ + - ]: 6 : pArray[0] = C2U("com.sun.star.text.BaseFrame");
753 [ + - ]: 6 : pArray[1] = C2U("com.sun.star.text.TextContent");
754 [ + - ]: 6 : pArray[2] = C2U("com.sun.star.document.LinkTarget");
755 : 6 : return aRet;
756 : : }
757 : :
758 : 604 : SwXFrame::SwXFrame(FlyCntType eSet, const :: SfxItemPropertySet* pSet, SwDoc *pDoc) :
759 : : aLstnrCntnr( (container::XNamed*)this),
760 : : m_pPropSet(pSet),
761 : : m_pDoc ( pDoc ),
762 : : eType(eSet),
763 : : bIsDescriptor(true),
764 [ + - ][ + - ]: 604 : m_pCopySource( 0 )
765 : : {
766 : : // Register ourselves as a listener to the document (via the page descriptor)
767 [ + - ][ + - ]: 604 : pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
768 : : // get the property set for the default style data
769 : : // First get the model
770 [ + - ]: 604 : uno::Reference < XModel > xModel = pDoc->GetDocShell()->GetBaseModel();
771 : : // Ask the model for it's family supplier interface
772 [ + - ]: 604 : uno::Reference < XStyleFamiliesSupplier > xFamilySupplier ( xModel, uno::UNO_QUERY );
773 : : // Get the style families
774 [ + - ][ + - ]: 604 : uno::Reference < XNameAccess > xFamilies = xFamilySupplier->getStyleFamilies();
775 : : // Get the Frame family (and keep it for later)
776 [ + - ][ + - ]: 604 : const ::uno::Any aAny = xFamilies->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "FrameStyles" ) ) );
[ + - ]
777 [ + - ]: 604 : aAny >>= mxStyleFamily;
778 : : // In the derived class, we'll ask mxStyleFamily for the relevant default style
779 : : // mxStyleFamily is initialised in the SwXFrame constructor
780 [ + + + - ]: 604 : switch(eType)
781 : : {
782 : : case FLYCNTTYPE_FRM:
783 : : {
784 [ + - ][ + - ]: 131 : uno::Any aAny2 = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Frame" ) ) );
[ + - ]
785 [ + - ]: 131 : aAny2 >>= mxStyleData;
786 [ + - ][ + - ]: 131 : pProps = new SwFrameProperties_Impl( );
787 : : }
788 : 131 : break;
789 : : case FLYCNTTYPE_GRF:
790 : : {
791 [ + - ][ + - ]: 41 : uno::Any aAny2 = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Graphics" ) ) );
[ + - ]
792 [ + - ]: 41 : aAny2 >>= mxStyleData;
793 [ + - ][ + - ]: 41 : pProps = new SwGraphicProperties_Impl( );
794 : : }
795 : 41 : break;
796 : : case FLYCNTTYPE_OLE:
797 : : {
798 [ + - ][ + - ]: 432 : uno::Any aAny2 = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "OLE" ) ) );
[ + - ]
799 [ + - ]: 432 : aAny2 >>= mxStyleData;
800 [ + - ][ + - ]: 432 : pProps = new SwOLEProperties_Impl( );
801 : : }
802 : 432 : break;
803 : :
804 : : default:
805 : : ;
806 : 604 : }
807 : 604 : }
808 : :
809 : 402 : SwXFrame::SwXFrame(SwFrmFmt& rFrmFmt, FlyCntType eSet, const :: SfxItemPropertySet* pSet) :
810 : : SwClient( &rFrmFmt ),
811 : : aLstnrCntnr( (container::XNamed*)this),
812 : : m_pPropSet(pSet),
813 : : m_pDoc( 0 ),
814 : : eType(eSet),
815 : : pProps(0),
816 : : bIsDescriptor(false),
817 [ + - ][ + - ]: 402 : m_pCopySource(0)
[ + - ]
818 : : {
819 : :
820 : 402 : }
821 : :
822 [ + - ][ + - ]: 1006 : SwXFrame::~SwXFrame()
[ + - ]
823 : : {
824 [ - + ][ # # ]: 1006 : delete m_pCopySource;
825 [ + + ][ + - ]: 1006 : delete pProps;
826 [ - + ]: 1006 : }
827 : :
828 : 110 : OUString SwXFrame::getName(void) throw( uno::RuntimeException )
829 : : {
830 [ + - ]: 110 : SolarMutexGuard aGuard;
831 [ + - ]: 110 : String sRet;
832 [ + - ]: 110 : SwFrmFmt* pFmt = GetFrmFmt();
833 [ + + ]: 110 : if(pFmt)
834 [ + - ]: 104 : sRet = pFmt->GetName();
835 [ + - ]: 6 : else if(bIsDescriptor)
836 [ + - ]: 6 : sRet = sName;
837 : : else
838 [ # # ]: 0 : throw uno::RuntimeException();
839 [ + - ][ + - ]: 110 : return sRet;
[ + - ]
840 : : }
841 : :
842 : 117 : void SwXFrame::setName(const :: OUString& rName) throw( uno::RuntimeException )
843 : : {
844 [ + - ]: 117 : SolarMutexGuard aGuard;
845 [ + - ]: 117 : SwFrmFmt* pFmt = GetFrmFmt();
846 [ + - ]: 117 : String sTmpName(rName);
847 [ + + ]: 117 : if(pFmt)
848 : : {
849 [ + - ]: 33 : pFmt->GetDoc()->SetFlyName((SwFlyFrmFmt&)*pFmt, sTmpName);
850 [ + - ][ - + ]: 33 : if(pFmt->GetName() != sTmpName)
851 : : {
852 [ # # ]: 0 : throw uno::RuntimeException();
853 : : }
854 : : }
855 [ + - ]: 84 : else if(bIsDescriptor)
856 [ + - ]: 84 : sName = sTmpName;
857 : : else
858 [ # # ][ + - ]: 117 : throw uno::RuntimeException();
[ + - ]
859 : 117 : }
860 : :
861 : 317 : uno::Reference< beans::XPropertySetInfo > SwXFrame::getPropertySetInfo(void) throw( uno::RuntimeException )
862 : : {
863 : 317 : uno::Reference< beans::XPropertySetInfo > xRef;
864 [ + - ][ + + ]: 317 : static uno::Reference< beans::XPropertySetInfo > xFrmRef;
865 [ + + ][ + - ]: 317 : static uno::Reference< beans::XPropertySetInfo > xGrfRef;
866 [ + + ][ + - ]: 317 : static uno::Reference< beans::XPropertySetInfo > xOLERef;
867 [ + + + - ]: 317 : switch(eType)
868 : : {
869 : : case FLYCNTTYPE_FRM:
870 [ + + ]: 189 : if( !xFrmRef.is() )
871 [ + - ][ + - ]: 7 : xFrmRef = m_pPropSet->getPropertySetInfo();
872 [ + - ]: 189 : xRef = xFrmRef;
873 : 189 : break;
874 : : case FLYCNTTYPE_GRF:
875 [ + + ]: 98 : if( !xGrfRef.is() )
876 [ + - ][ + - ]: 4 : xGrfRef = m_pPropSet->getPropertySetInfo();
877 [ + - ]: 98 : xRef = xGrfRef;
878 : 98 : break;
879 : : case FLYCNTTYPE_OLE:
880 [ + + ]: 30 : if( !xOLERef.is() )
881 [ + - ][ + - ]: 4 : xOLERef = m_pPropSet->getPropertySetInfo();
882 [ + - ]: 30 : xRef = xOLERef;
883 : 30 : break;
884 : : default:
885 : : ;
886 : : }
887 : 317 : return xRef;
888 : : }
889 : :
890 : 15 : void SwXFrame::SetSelection(SwPaM& rCopySource)
891 : : {
892 [ - + ]: 15 : delete m_pCopySource;
893 [ + - ]: 15 : m_pCopySource = new SwPaM( *rCopySource.Start() );
894 : 15 : m_pCopySource->SetMark();
895 : 15 : *m_pCopySource->GetMark() = *rCopySource.End();
896 : 15 : }
897 : :
898 : 241 : SdrObject *SwXFrame::GetOrCreateSdrObject( SwFlyFrmFmt *pFmt )
899 : : {
900 : 241 : SdrObject* pObject = pFmt->FindSdrObject();
901 [ + + ]: 241 : if( !pObject )
902 : : {
903 : 65 : SwDoc *pDoc = pFmt->GetDoc();
904 : : // #i52858# - method name changed
905 : 65 : SdrModel *pDrawModel = pDoc->GetOrCreateDrawModel();
906 : : SwFlyDrawContact* pContactObject
907 [ + - ]: 65 : = new SwFlyDrawContact( pFmt, pDrawModel );
908 : 65 : pObject = pContactObject->GetMaster();
909 : :
910 : 65 : const :: SwFmtSurround& rSurround = pFmt->GetSurround();
911 : : pObject->SetLayer(
912 : 65 : ( SURROUND_THROUGHT == rSurround.GetSurround() &&
913 : 3 : !pFmt->GetOpaque().GetValue() ) ? pDoc->GetHellId()
914 [ + + - + ]: 68 : : pDoc->GetHeavenId() );
915 : :
916 : 65 : pDrawModel->GetPage(0)->InsertObject( pObject );
917 : : }
918 : :
919 : 241 : return pObject;
920 : : }
921 : :
922 : 14 : SwFrmFmt *lcl_GetFrmFmt( const :: uno::Any& rValue, SwDoc *pDoc )
923 : : {
924 : 14 : SwFrmFmt *pRet = 0;
925 : 14 : SwDocShell* pDocSh = pDoc->GetDocShell();
926 [ + - ]: 14 : if(pDocSh)
927 : : {
928 : 14 : OUString uTemp;
929 : 14 : rValue >>= uTemp;
930 [ + - ]: 14 : String sStyle;
931 [ + - ][ + - ]: 14 : SwStyleNameMapper::FillUIName(String (uTemp), sStyle, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, true);
[ + - ]
932 : : SwDocStyleSheet* pStyle =
933 [ + - ]: 14 : (SwDocStyleSheet*)pDocSh->GetStyleSheetPool()->Find(sStyle,
934 [ + - ]: 14 : SFX_STYLE_FAMILY_FRAME);
935 [ + - ]: 14 : if(pStyle)
936 [ + - ][ + - ]: 14 : pRet = pStyle->GetFrmFmt();
937 : : }
938 : :
939 : 14 : return pRet;
940 : : }
941 : :
942 : 3446 : void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::Any& aValue)
943 : : throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
944 : : {
945 [ + - ]: 3446 : SolarMutexGuard aGuard;
946 [ + - ]: 3446 : SwFrmFmt* pFmt = GetFrmFmt();
947 [ + - ]: 3446 : const :: SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
948 : :
949 [ + + ]: 3446 : if (!pEntry)
950 [ + - ][ + - ]: 54 : throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
[ + - ]
951 : :
952 [ + + ]: 3392 : if(pFmt)
953 : : {
954 : 273 : bool bNextFrame = false;
955 [ + + ]: 273 : if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
956 [ + - ][ + - ]: 12 : throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
[ + - ]
957 : :
958 : 261 : SwDoc* pDoc = pFmt->GetDoc();
959 [ + + ][ + + ]: 261 : if ( ((eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID)) ||
[ + - ][ - + ]
[ + + ][ + + ]
960 : : (FN_PARAM_COUNTOUR_PP == pEntry->nWID) ||
961 : : (FN_UNO_IS_AUTOMATIC_CONTOUR == pEntry->nWID) ||
962 : : (FN_UNO_IS_PIXEL_CONTOUR == pEntry->nWID) )
963 : : {
964 [ + - ]: 41 : const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
965 [ + - ]: 41 : if(pIdx)
966 : : {
967 [ + - ]: 41 : SwNodeIndex aIdx(*pIdx, 1);
968 : 41 : SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
969 [ + + ]: 41 : if(pEntry->nWID == FN_PARAM_COUNTOUR_PP)
970 : : {
971 [ + - ]: 15 : drawing::PointSequenceSequence aParam;
972 [ + - ]: 15 : if(!aValue.hasValue())
973 [ + - ]: 15 : pNoTxt->SetContour(0);
974 [ # # ][ # # ]: 0 : else if(aValue >>= aParam)
975 : : {
976 [ # # ]: 0 : PolyPolygon aPoly((sal_uInt16)aParam.getLength());
977 [ # # ]: 0 : for(sal_Int32 i = 0; i < aParam.getLength(); i++)
978 : : {
979 : 0 : const :: drawing::PointSequence* pPointSeq = aParam.getConstArray();
980 : 0 : sal_Int32 nPoints = pPointSeq[i].getLength();
981 : 0 : const :: awt::Point* pPoints = pPointSeq[i].getConstArray();
982 [ # # ]: 0 : Polygon aSet( (sal_uInt16)nPoints );
983 [ # # ]: 0 : for(sal_Int32 j = 0; j < nPoints; j++)
984 : : {
985 : 0 : Point aPoint(pPoints[j].X, pPoints[j].Y);
986 [ # # ]: 0 : aSet.SetPoint(aPoint, (sal_uInt16)j);
987 : : }
988 : : // Close polygon if it isn't closed already.
989 [ # # ]: 0 : aSet.Optimize( POLY_OPTIMIZE_CLOSE );
990 [ # # ]: 0 : aPoly.Insert( aSet );
991 [ # # ]: 0 : }
992 [ # # ][ # # ]: 0 : pNoTxt->SetContourAPI( &aPoly );
993 : : }
994 : : else
995 [ # # ][ + - ]: 15 : throw lang::IllegalArgumentException();
996 : : }
997 [ - + ]: 26 : else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
998 : : {
999 : 0 : pNoTxt->SetAutomaticContour( *(sal_Bool *)aValue.getValue() );
1000 : : }
1001 [ - + ]: 26 : else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
1002 : : {
1003 : : // The IsPixelContour property can only be set if there
1004 : : // is no contour, or if the contour has been set by the
1005 : : // API itself (or in other words, if the contour isn't
1006 : : // used already).
1007 [ # # # # ]: 0 : if( !pNoTxt->_HasContour() ||
[ # # ]
1008 : 0 : !pNoTxt->IsContourMapModeValid() )
1009 : 0 : pNoTxt->SetPixelContour( *(sal_Bool *)aValue.getValue() );
1010 : : else
1011 [ # # ]: 0 : throw lang::IllegalArgumentException();
1012 : : }
1013 : : else
1014 : : {
1015 [ + - ][ + - ]: 26 : SfxItemSet aSet(pNoTxt->GetSwAttrSet());
1016 [ + - ]: 26 : m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
1017 [ + - ][ + - ]: 26 : pNoTxt->SetAttr(aSet);
1018 [ + - ]: 41 : }
1019 : : }
1020 : : }
1021 : : // #i73249#
1022 : : // Attribute AlternativeText was never published.
1023 : : // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
1024 : : // else if( FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID && eType != FLYCNTTYPE_FRM )
1025 : : // {
1026 : : // const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1027 : : // if(pIdx)
1028 : : // {
1029 : : // SwNodeIndex aIdx(*pIdx, 1);
1030 : : // SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1031 : : // OUString uTemp;
1032 : : // aValue >>= uTemp;
1033 : : // pNoTxt->SetAlternateText(uTemp);
1034 : : // }
1035 : : // }
1036 : : // New attribute Title
1037 [ + + ]: 220 : else if( FN_UNO_TITLE == pEntry->nWID )
1038 : : {
1039 [ - + ]: 27 : SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
1040 : : OSL_ENSURE( pFmt,
1041 : : "unexpected type of <pFmt> --> crash" );
1042 : 27 : OUString uTemp;
1043 : 27 : aValue >>= uTemp;
1044 [ + - ]: 27 : const String sTitle(uTemp);
1045 : : // assure that <SdrObject> instance exists.
1046 [ + - ]: 27 : GetOrCreateSdrObject( pFlyFmt );
1047 [ + - ][ + - ]: 27 : pFlyFmt->GetDoc()->SetFlyFrmTitle( *(pFlyFmt), sTitle );
1048 : : }
1049 : : // New attribute Description
1050 [ + + ]: 193 : else if( FN_UNO_DESCRIPTION == pEntry->nWID )
1051 : : {
1052 [ - + ]: 27 : SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
1053 : : OSL_ENSURE( pFmt,
1054 : : "unexpected type of <pFmt> --> crash" );
1055 : 27 : OUString uTemp;
1056 : 27 : aValue >>= uTemp;
1057 [ + - ]: 27 : const String sDescription(uTemp);
1058 : : // assure that <SdrObject> instance exists.
1059 [ + - ]: 27 : GetOrCreateSdrObject( pFlyFmt );
1060 [ + - ][ + - ]: 27 : pFlyFmt->GetDoc()->SetFlyFrmDescription( *(pFlyFmt), sDescription );
1061 : : }
1062 [ + + ]: 166 : else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
1063 : : {
1064 [ + - ]: 8 : SwFrmFmt *pFrmFmt = lcl_GetFrmFmt( aValue, pFmt->GetDoc() );
1065 [ + - ]: 8 : if( pFrmFmt )
1066 : : {
1067 [ + - ]: 8 : UnoActionContext aAction(pFmt->GetDoc());
1068 : :
1069 : 8 : SfxItemSet* pSet = 0;
1070 : : // #i31771#, #i25798# - No adjustment of
1071 : : // anchor ( no call of method <::lcl_ChkAndSetNewAnchor(..)> ),
1072 : : // if document is currently in reading mode.
1073 [ + + ]: 8 : if ( !pFmt->GetDoc()->IsInReading() )
1074 : : {
1075 : : // see SwFEShell::SetFrmFmt( SwFrmFmt *pNewFmt, sal_Bool bKeepOrient, Point* pDocPos )
1076 : 6 : SwFlyFrm *pFly = 0;
1077 : : {
1078 : 6 : const :: SwFrmFmt* pFmtXX = pFmt;
1079 [ + - ][ + - ]: 6 : if (PTR_CAST(SwFlyFrmFmt, pFmtXX))
[ + - ][ + - ]
[ + - ][ + - ]
1080 [ + - ]: 6 : pFly = ((SwFlyFrmFmt*)pFmtXX)->GetFrm();
1081 : : }
1082 [ + - ]: 6 : if ( pFly )
1083 : : {
1084 : : const :: SfxPoolItem* pItem;
1085 [ + - ][ + - ]: 6 : if( SFX_ITEM_SET == pFrmFmt->GetItemState( RES_ANCHOR, false, &pItem ))
1086 : : {
1087 [ + - ][ + - ]: 6 : pSet = new SfxItemSet( pDoc->GetAttrPool(), aFrmFmtSetRange );
1088 [ + - ]: 6 : pSet->Put( *pItem );
1089 [ + - ][ + + ]: 6 : if ( !::lcl_ChkAndSetNewAnchor( *pFly, *pSet ) )
1090 [ + - ][ + - ]: 6 : delete pSet, pSet = 0;
1091 : : }
1092 : : }
1093 : : }
1094 : :
1095 [ + - ]: 8 : pFmt->GetDoc()->SetFrmFmtToFly( *pFmt, *pFrmFmt, pSet, sal_False );
1096 [ + + ][ + - ]: 8 : delete pSet;
[ + - ]
1097 : : }
1098 : : else
1099 [ # # ]: 0 : throw lang::IllegalArgumentException();
1100 : : }
1101 [ + + ][ + + ]: 158 : else if( FN_UNO_GRAPHIC_U_R_L == pEntry->nWID ||
1102 : : FN_UNO_GRAPHIC_FILTER == pEntry->nWID)
1103 : : {
1104 [ + - ][ + - ]: 12 : String sGrfName, sFltName;
1105 : 12 : GraphicObject *pGrfObj = 0;
1106 [ + - ]: 12 : pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, &sGrfName, &sFltName );
1107 : 12 : OUString uTemp;
1108 : 12 : aValue >>= uTemp;
1109 [ + - ]: 12 : String sTmp(uTemp);
1110 [ + - ]: 12 : UnoActionContext aAction(pFmt->GetDoc());
1111 [ + + ]: 12 : if(FN_UNO_GRAPHIC_U_R_L == pEntry->nWID)
1112 : : {
1113 [ - + ]: 10 : if( sTmp.EqualsAscii( sPackageProtocol,
1114 [ + - ]: 10 : 0, sizeof( sPackageProtocol )-1 ) )
1115 : : {
1116 [ # # ][ # # ]: 0 : pGrfObj = new GraphicObject;
1117 [ # # ]: 0 : pGrfObj->SetUserData( sTmp );
1118 [ # # ]: 0 : pGrfObj->SetSwapState();
1119 [ # # ]: 0 : sGrfName.Erase();
1120 : : }
1121 [ - + ]: 10 : else if( sTmp.EqualsAscii( sGraphicObjectProtocol,
1122 [ + - ]: 10 : 0, sizeof(sGraphicObjectProtocol)-1 ) )
1123 : : {
1124 : : rtl::OString sId(rtl::OUStringToOString(
1125 : : sTmp.Copy(sizeof(sGraphicObjectProtocol)-1),
1126 [ # # ][ # # ]: 0 : RTL_TEXTENCODING_ASCII_US));
[ # # ][ # # ]
1127 [ # # ][ # # ]: 0 : pGrfObj = new GraphicObject( sId );
1128 [ # # ]: 0 : sGrfName.Erase();
1129 : : }
1130 : : else
1131 : : {
1132 [ + - ]: 10 : sGrfName = sTmp;
1133 : : }
1134 : : }
1135 : : else
1136 : : {
1137 [ + - ]: 2 : sFltName = sTmp;
1138 : : }
1139 : :
1140 [ + - ]: 12 : const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1141 [ + - ]: 12 : if(pIdx)
1142 : : {
1143 [ + - ]: 12 : SwNodeIndex aIdx(*pIdx, 1);
1144 : : // SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1145 : 12 : SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
1146 [ - + ]: 12 : if(!pGrfNode)
1147 : : {
1148 [ # # ][ # # ]: 0 : delete pGrfObj;
1149 [ # # ]: 0 : throw uno::RuntimeException();
1150 : : }
1151 [ + - ]: 12 : SwPaM aGrfPaM(*pGrfNode);
1152 : 12 : pFmt->GetDoc()->ReRead( aGrfPaM, sGrfName, sFltName, 0,
1153 [ + - ][ + - ]: 12 : pGrfObj );
[ + - ]
1154 : : }
1155 [ - + ][ # # ]: 12 : delete pGrfObj;
[ + - ][ + - ]
[ + - ][ + - ]
1156 : : }
1157 [ - + ]: 146 : else if( FN_UNO_GRAPHIC == pEntry->nWID )
1158 : : {
1159 : 0 : uno::Reference< graphic::XGraphic > xGraphic;
1160 [ # # ]: 0 : aValue >>= xGraphic;
1161 [ # # ]: 0 : if(xGraphic.is())
1162 : : {
1163 [ # # ]: 0 : const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1164 [ # # ]: 0 : if(pIdx)
1165 : : {
1166 [ # # ]: 0 : SwNodeIndex aIdx(*pIdx, 1);
1167 : 0 : SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
1168 [ # # ]: 0 : if(!pGrfNode)
1169 : : {
1170 [ # # ]: 0 : throw uno::RuntimeException();
1171 : : }
1172 [ # # ]: 0 : SwPaM aGrfPaM(*pGrfNode);
1173 [ # # ]: 0 : Graphic aGraphic( xGraphic );
1174 [ # # ][ # # ]: 0 : pFmt->GetDoc()->ReRead( aGrfPaM, String(), String(), &aGraphic, 0 );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1175 : : }
1176 : 0 : }
1177 : : }
1178 [ + + ][ - + ]: 146 : else if( FN_UNO_REPLACEMENT_GRAPHIC_URL == pEntry->nWID || FN_UNO_REPLACEMENT_GRAPHIC == pEntry->nWID )
1179 : : {
1180 : 2 : bool bURL = FN_UNO_REPLACEMENT_GRAPHIC_URL == pEntry->nWID;
1181 : 2 : bool bApply = false;
1182 [ + - ]: 2 : Graphic aGraphic;
1183 [ + - ]: 2 : if( bURL )
1184 : : {
1185 : 2 : GraphicObject *pGrfObj = 0;
1186 : 2 : OUString aGrfUrl;
1187 : 2 : aValue >>= aGrfUrl;
1188 : :
1189 : : // the package URL based graphics are handled in different way currently
1190 : : // TODO/LATER: actually this is the correct place to handle them
1191 [ + - ]: 2 : ::rtl::OUString aGraphicProtocol( RTL_CONSTASCII_USTRINGPARAM( sGraphicObjectProtocol ) );
1192 [ - + ]: 2 : if( aGrfUrl.compareTo( aGraphicProtocol, aGraphicProtocol.getLength() ) == 0 )
1193 : : {
1194 : : rtl::OString sId(rtl::OUStringToOString(
1195 : : aGrfUrl.copy(sizeof(sGraphicObjectProtocol)-1),
1196 [ # # ]: 0 : RTL_TEXTENCODING_ASCII_US));
1197 [ # # ][ # # ]: 0 : pGrfObj = new GraphicObject( sId );
1198 [ # # ][ # # ]: 0 : aGraphic = pGrfObj->GetGraphic();
1199 : 0 : bApply = true;
1200 : 2 : }
1201 : : }
1202 : : else
1203 : : {
1204 : 0 : uno::Reference< graphic::XGraphic > xGraphic;
1205 [ # # ]: 0 : aValue >>= xGraphic;
1206 [ # # ]: 0 : if( xGraphic.is() )
1207 : : {
1208 [ # # ][ # # ]: 0 : aGraphic = Graphic( xGraphic );
[ # # ]
1209 : 0 : bApply = true;
1210 : 0 : }
1211 : : }
1212 : :
1213 [ - + ]: 2 : if ( bApply )
1214 : : {
1215 [ # # ]: 0 : const :: SwFmtCntnt* pCnt = &pFmt->GetCntnt();
1216 [ # # ][ # # ]: 0 : if ( pCnt->GetCntntIdx() && pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ] )
[ # # ][ # # ]
[ # # ]
1217 : : {
1218 [ # # ][ # # ]: 0 : SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode();
1219 : :
1220 [ # # ]: 0 : if ( pOleNode )
1221 : : {
1222 [ # # ]: 0 : svt::EmbeddedObjectRef &rObj = pOleNode->GetOLEObj().GetObject();
1223 : :
1224 : 0 : ::rtl::OUString aMediaType;
1225 [ # # ]: 0 : rObj.SetGraphic( aGraphic, aMediaType );
1226 : : }
1227 : : }
1228 [ + - ]: 2 : }
1229 : : }
1230 [ + - ][ + - ]: 288 : else if(0 != (bNextFrame = (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_NEXT_NAME))))
[ + - - + ]
[ - + ]
1231 [ + - ][ + - ]: 144 : || rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_PREV_NAME)))
1232 : : {
1233 : 0 : OUString uTemp;
1234 : 0 : aValue >>= uTemp;
1235 [ # # ]: 0 : String sChainName(uTemp);
1236 [ # # ]: 0 : if(!sChainName.Len())
1237 : : {
1238 [ # # ]: 0 : if(bNextFrame)
1239 [ # # ]: 0 : pDoc->Unchain(*pFmt);
1240 : : else
1241 : : {
1242 [ # # ][ # # ]: 0 : SwFmtChain aChain( pFmt->GetChain() );
1243 : 0 : SwFrmFmt *pPrev = aChain.GetPrev();
1244 [ # # ]: 0 : if(pPrev)
1245 [ # # ][ # # ]: 0 : pDoc->Unchain(*pPrev);
1246 : : }
1247 : : }
1248 : : else
1249 : : {
1250 [ # # ]: 0 : sal_uInt16 nCount = pDoc->GetFlyCount(FLYCNTTYPE_FRM);
1251 : :
1252 : 0 : SwFrmFmt* pChain = 0;
1253 [ # # ]: 0 : for( sal_uInt16 i = 0; i < nCount; i++)
1254 : : {
1255 [ # # ]: 0 : SwFrmFmt* pFmt2 = pDoc->GetFlyNum(i, FLYCNTTYPE_FRM);
1256 [ # # ][ # # ]: 0 : if(sChainName == pFmt2->GetName() )
1257 : : {
1258 : 0 : pChain = pFmt2;
1259 : 0 : break;
1260 : : }
1261 : : }
1262 [ # # ]: 0 : if(pChain)
1263 : : {
1264 [ # # ]: 0 : SwFrmFmt* pSource = bNextFrame ? pFmt : pChain;
1265 [ # # ]: 0 : SwFrmFmt* pDest = bNextFrame ? pChain: pFmt;
1266 [ # # ]: 0 : pDoc->Chain(*pSource, *pDest);
1267 : : }
1268 [ # # ]: 0 : }
1269 : : }
1270 [ + + ]: 144 : else if(FN_UNO_Z_ORDER == pEntry->nWID)
1271 : : {
1272 : 12 : sal_Int32 nZOrder = - 1;
1273 : 12 : aValue >>= nZOrder;
1274 [ + - ]: 12 : if( nZOrder >= 0)
1275 : : {
1276 : : SdrObject* pObject =
1277 [ + - ]: 12 : GetOrCreateSdrObject( (SwFlyFrmFmt*)pFmt );
1278 [ + - ]: 12 : SdrModel *pDrawModel = pDoc->GetDrawModel();
1279 [ + - ]: 12 : pDrawModel->GetPage(0)->
1280 [ + - ][ + - ]: 12 : SetObjectOrdNum(pObject->GetOrdNum(), nZOrder);
1281 : : }
1282 : : }
1283 [ + + ][ - + ]: 132 : else if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORFRAME == pEntry->nMemberId)
1284 : : {
1285 : 0 : bool bDone = false;
1286 : 0 : uno::Reference<text::XTextFrame> xFrame;
1287 [ # # ][ # # ]: 0 : if(aValue >>= xFrame)
1288 : : {
1289 [ # # ]: 0 : uno::Reference<lang::XUnoTunnel> xTunnel(xFrame, uno::UNO_QUERY);
1290 : 0 : SwXFrame* pFrame = xTunnel.is() ?
1291 [ # # ][ # # ]: 0 : reinterpret_cast< SwXFrame * >( sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXFrame::getUnoTunnelId()) ))
[ # # ]
1292 [ # # ]: 0 : : 0;
1293 [ # # ][ # # ]: 0 : if(pFrame && this != pFrame && pFrame->GetFrmFmt() && pFrame->GetFrmFmt()->GetDoc() == pDoc)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1294 : : {
1295 : 0 : SfxItemSet aSet( pDoc->GetAttrPool(),
1296 [ # # ]: 0 : RES_FRMATR_BEGIN, RES_FRMATR_END - 1 );
1297 : 0 : aSet.SetParent(&pFmt->GetAttrSet());
1298 [ # # ][ # # ]: 0 : SwFmtAnchor aAnchor = (const :: SwFmtAnchor&)aSet.Get(pEntry->nWID);
1299 : :
1300 : :
1301 [ # # ][ # # ]: 0 : SwPosition aPos(*pFrame->GetFrmFmt()->GetCntnt().GetCntntIdx());
[ # # ]
1302 [ # # ]: 0 : aAnchor.SetAnchor(&aPos);
1303 : 0 : aAnchor.SetType(FLY_AT_FLY);
1304 [ # # ]: 0 : aSet.Put(aAnchor);
1305 [ # # ]: 0 : pDoc->SetFlyFrmAttr( *pFmt, aSet );
1306 [ # # ][ # # ]: 0 : bDone = true;
[ # # ]
1307 : 0 : }
1308 : : }
1309 [ # # ]: 0 : if(!bDone)
1310 [ # # ]: 0 : throw lang::IllegalArgumentException();
1311 : : }
1312 : : else
1313 : : {
1314 : 132 : SfxItemSet aSet( pDoc->GetAttrPool(),
1315 : : RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
1316 : : RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
1317 [ + - ]: 132 : 0L);
1318 : :
1319 : 132 : aSet.SetParent(&pFmt->GetAttrSet());
1320 [ + - ]: 132 : m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
1321 [ + + ][ + - ]: 132 : if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == pEntry->nMemberId)
1322 : : {
1323 [ + - ][ + - ]: 10 : SwFmtAnchor aAnchor = (const :: SwFmtAnchor&)aSet.Get(pEntry->nWID);
1324 [ - + ]: 10 : if(aAnchor.GetAnchorId() == FLY_AT_FLY)
1325 : : {
1326 [ # # ]: 0 : const :: SwPosition* pPosition = aAnchor.GetCntntAnchor();
1327 [ # # ][ # # ]: 0 : SwFrmFmt* pFlyFmt = pPosition ? pPosition->nNode.GetNode().GetFlyFmt() : 0;
1328 [ # # ][ # # ]: 0 : if(!pFlyFmt || pFlyFmt->Which() == RES_DRAWFRMFMT)
[ # # ]
1329 : : {
1330 [ # # ]: 0 : lang::IllegalArgumentException aExcept;
1331 [ # # ]: 0 : aExcept.Message = C2U("Anchor to frame: no frame found");
1332 [ # # ]: 0 : throw aExcept;
1333 : : }
1334 : : else
1335 : : {
1336 [ # # ]: 0 : SwPosition aPos = *pPosition;
1337 [ # # ][ # # ]: 0 : aPos.nNode = *pFlyFmt->GetCntnt().GetCntntIdx();
1338 [ # # ]: 0 : aAnchor.SetAnchor(&aPos);
1339 [ # # ][ # # ]: 0 : aSet.Put(aAnchor);
1340 : : }
1341 : : }
1342 [ + - ][ + + ]: 20 : else if ((aAnchor.GetAnchorId() != FLY_AT_PAGE) &&
[ + + ]
1343 [ + - ]: 10 : !aAnchor.GetCntntAnchor())
1344 : : {
1345 [ + - ]: 2 : SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
1346 [ + - ]: 2 : SwPaM aPam(rNode);
1347 [ + - ]: 2 : aPam.Move( fnMoveBackward, fnGoDoc );
1348 [ + - ][ + - ]: 2 : aAnchor.SetAnchor( aPam.Start() );
1349 [ + - ][ + - ]: 2 : aSet.Put(aAnchor);
1350 : : }
1351 : :
1352 : : // #i31771#, #i25798# - No adjustment of
1353 : : // anchor ( no call of method <::lcl_ChkAndSetNewAnchor(..)> ),
1354 : : // if document is currently in reading mode.
1355 [ + + ]: 10 : if ( !pFmt->GetDoc()->IsInReading() )
1356 : : {
1357 : : // see SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet )
1358 : 8 : SwFlyFrm *pFly = 0;
1359 [ + - ][ + - ]: 8 : if (PTR_CAST(SwFlyFrmFmt, pFmt))
[ + - ][ + - ]
[ + - ][ + - ]
1360 [ + - ]: 8 : pFly = ((SwFlyFrmFmt*)pFmt)->GetFrm();
1361 [ + - ]: 8 : if (pFly)
1362 : : {
1363 : : const :: SfxPoolItem* pItem;
1364 [ + - ][ + - ]: 8 : if( SFX_ITEM_SET == aSet.GetItemState( RES_ANCHOR, false, &pItem ))
1365 : : {
1366 [ + - ]: 8 : aSet.Put( *pItem );
1367 [ + - ]: 8 : ::lcl_ChkAndSetNewAnchor( *pFly, aSet );
1368 : : }
1369 : : }
1370 : : }
1371 : :
1372 [ + - ][ + - ]: 10 : pFmt->GetDoc()->SetFlyFrmAttr( *pFmt, aSet );
1373 : : }
1374 [ + - ][ + - ]: 122 : else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_STREAM_NAME == pEntry->nWID || FN_EMBEDDED_OBJECT == pEntry->nWID)
[ - + ]
1375 : : {
1376 [ # # ]: 0 : throw lang::IllegalArgumentException();
1377 : : }
1378 : : else
1379 [ + - ][ + - ]: 261 : pFmt->SetFmtAttr(aSet);
1380 : : }
1381 : : }
1382 [ + - ]: 3119 : else if(IsDescriptor())
1383 : : {
1384 [ + - ]: 3119 : pProps->SetProperty(pEntry->nWID, pEntry->nMemberId, aValue);
1385 [ + + ]: 3119 : if( FN_UNO_FRAME_STYLE_NAME == pEntry->nWID )
1386 : : {
1387 : 6 : OUString sStyleName;
1388 : 6 : aValue >>= sStyleName;
1389 : : try
1390 : : {
1391 [ + - ][ + - ]: 6 : uno::Any aAny = mxStyleFamily->getByName ( sStyleName );
1392 [ + - ]: 6 : aAny >>= mxStyleData;
[ # # # # ]
1393 : : }
1394 [ # # ]: 0 : catch ( container::NoSuchElementException const & )
1395 : : {
1396 : : }
1397 [ # # ]: 0 : catch ( lang::WrappedTargetException const & )
1398 : : {
1399 : : }
1400 [ # # ]: 0 : catch ( uno::RuntimeException const & )
1401 : : {
1402 : 6 : }
1403 : : }
1404 : : }
1405 : : else
1406 [ # # ][ + - ]: 3446 : throw uno::RuntimeException();
1407 : 3380 : }
1408 : :
1409 : 717 : uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
1410 : : throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1411 : : {
1412 [ + - ]: 717 : SolarMutexGuard aGuard;
1413 : 717 : uno::Any aAny;
1414 [ + - ]: 717 : SwFrmFmt* pFmt = GetFrmFmt();
1415 [ + - ]: 717 : const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
1416 [ - + ]: 717 : if (!pEntry)
1417 [ # # ][ # # ]: 0 : throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
[ # # ]
1418 : :
1419 [ + + ]: 717 : if(FN_UNO_ANCHOR_TYPES == pEntry->nWID)
1420 : : {
1421 [ + - ]: 12 : uno::Sequence<text::TextContentAnchorType> aTypes(5);
1422 [ + - ]: 12 : text::TextContentAnchorType* pArray = aTypes.getArray();
1423 : 12 : pArray[0] = text::TextContentAnchorType_AT_PARAGRAPH;
1424 : 12 : pArray[1] = text::TextContentAnchorType_AS_CHARACTER;
1425 : 12 : pArray[2] = text::TextContentAnchorType_AT_PAGE;
1426 : 12 : pArray[3] = text::TextContentAnchorType_AT_FRAME;
1427 : 12 : pArray[4] = text::TextContentAnchorType_AT_CHARACTER;
1428 [ + - ][ + - ]: 12 : aAny.setValue(&aTypes, ::getCppuType(static_cast<uno::Sequence<text::TextContentAnchorType>*>(0)));
1429 : : }
1430 [ + + ]: 705 : else if(pFmt)
1431 : : {
1432 [ + + ][ + + ]: 1154 : if( ((eType == FLYCNTTYPE_GRF) || (eType == FLYCNTTYPE_OLE)) &&
[ + - + + ]
[ + + ][ + - ]
[ - + ][ + + ]
1433 : : pEntry &&
1434 : 497 : (isGRFATR(pEntry->nWID) ||
1435 : : pEntry->nWID == FN_PARAM_COUNTOUR_PP ||
1436 : : pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ||
1437 : : pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR ))
1438 : : {
1439 [ + - ]: 54 : const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1440 [ + - ]: 54 : if(pIdx)
1441 : : {
1442 [ + - ]: 54 : SwNodeIndex aIdx(*pIdx, 1);
1443 : 54 : SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1444 [ + + ]: 54 : if(pEntry->nWID == FN_PARAM_COUNTOUR_PP)
1445 : : {
1446 [ + - ]: 2 : PolyPolygon aContour;
1447 [ + - ][ - + ]: 2 : if( pNoTxt->GetContourAPI( aContour ) )
1448 : : {
1449 [ # # ][ # # ]: 0 : drawing::PointSequenceSequence aPtSeq(aContour.Count());
1450 [ # # ]: 0 : drawing::PointSequence* pPSeq = aPtSeq.getArray();
1451 [ # # ][ # # ]: 0 : for(sal_uInt16 i = 0; i < aContour.Count(); i++)
1452 : : {
1453 [ # # ]: 0 : const Polygon& rPoly = aContour.GetObject(i);
1454 [ # # ][ # # ]: 0 : pPSeq[i].realloc(rPoly.GetSize());
1455 [ # # ]: 0 : awt::Point* pPoints = pPSeq[i].getArray();
1456 [ # # ][ # # ]: 0 : for(sal_uInt16 j = 0; j < rPoly.GetSize(); j++)
1457 : : {
1458 [ # # ]: 0 : const Point& rPoint = rPoly.GetPoint(j);
1459 : 0 : pPoints[j].X = rPoint.X();
1460 : 0 : pPoints[j].Y = rPoint.Y();
1461 : : }
1462 : : }
1463 [ # # ][ # # ]: 0 : aAny <<= aPtSeq;
1464 [ + - ]: 2 : }
1465 : : }
1466 [ - + ]: 52 : else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
1467 : : {
1468 : 0 : sal_Bool bValue = pNoTxt->HasAutomaticContour();
1469 [ # # ]: 0 : aAny.setValue( &bValue, ::getBooleanCppuType() );
1470 : : }
1471 [ - + ]: 52 : else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
1472 : : {
1473 [ # # ]: 0 : sal_Bool bValue = pNoTxt->IsPixelContour();
1474 [ # # ]: 0 : aAny.setValue( &bValue, ::getBooleanCppuType() );
1475 : : }
1476 : : else
1477 : : {
1478 [ + - ][ + - ]: 52 : SfxItemSet aSet(pNoTxt->GetSwAttrSet());
1479 [ + - ][ + - ]: 52 : m_pPropSet->getPropertyValue(*pEntry, aSet, aAny);
1480 [ + - ]: 54 : }
1481 : : }
1482 : : }
1483 [ + + ]: 603 : else if( FN_UNO_GRAPHIC_U_R_L == pEntry->nWID)
1484 : : {
1485 [ + - ]: 4 : String sGrfName;
1486 [ + - ]: 4 : const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1487 [ + - ]: 4 : if(pIdx)
1488 : : {
1489 [ + - ]: 4 : SwNodeIndex aIdx(*pIdx, 1);
1490 : : // SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1491 : 4 : SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
1492 [ - + ]: 4 : if(!pGrfNode)
1493 [ # # ]: 0 : throw uno::RuntimeException();
1494 [ + - ]: 4 : if( pGrfNode->IsGrfLink() )
1495 : : {
1496 [ + - ]: 4 : pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, &sGrfName, 0 );
1497 : : }
1498 : : else
1499 : : {
1500 [ # # ]: 0 : rtl::OUString sPrefix( RTL_CONSTASCII_USTRINGPARAM(sGraphicObjectProtocol) );
1501 : : rtl::OUString sId(rtl::OStringToOUString(
1502 : 0 : pGrfNode->GetGrfObj().GetUniqueID(),
1503 [ # # ][ # # ]: 0 : RTL_TEXTENCODING_ASCII_US));
1504 [ # # ]: 0 : sGrfName = sPrefix + sId;
1505 [ + - ]: 4 : }
1506 : : }
1507 [ + - ][ + - ]: 4 : aAny <<= OUString(sGrfName);
[ + - ]
1508 : : }
1509 [ + + ]: 599 : else if( FN_UNO_GRAPHIC_FILTER == pEntry->nWID )
1510 : : {
1511 [ + - ]: 4 : String sFltName;
1512 [ + - ]: 4 : pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, 0, &sFltName );
1513 [ + - ][ + - ]: 4 : aAny <<= OUString(sFltName);
[ + - ]
1514 : : }
1515 [ - + ]: 595 : else if( FN_UNO_GRAPHIC == pEntry->nWID )
1516 : : {
1517 [ # # ]: 0 : const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1518 [ # # ]: 0 : if(pIdx)
1519 : : {
1520 [ # # ]: 0 : SwNodeIndex aIdx(*pIdx, 1);
1521 : 0 : SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
1522 [ # # ]: 0 : if(!pGrfNode)
1523 [ # # ]: 0 : throw uno::RuntimeException();
1524 [ # # ][ # # ]: 0 : aAny <<= pGrfNode->GetGrf().GetXGraphic();
[ # # ][ # # ]
1525 : : }
1526 : : }
1527 [ + + ]: 595 : else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
1528 : : {
1529 [ + - ][ + - ]: 12 : aAny <<= OUString(SwStyleNameMapper::GetProgName(pFmt->DerivedFrom()->GetName(), nsSwGetPoolIdFromName::GET_POOLID_FRMFMT ) );
[ + - ]
1530 : : }
1531 : : // #i73249#
1532 : : // Attribute AlternativeText was never published.
1533 : : // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
1534 : : // else if(eType != FLYCNTTYPE_FRM &&
1535 : : // FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
1536 : : // {
1537 : : // const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1538 : : // if(pIdx)
1539 : : // {
1540 : : // SwNodeIndex aIdx(*pIdx, 1);
1541 : : // SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1542 : : // aAny <<= OUString(pNoTxt->GetAlternateText());
1543 : : // }
1544 : : // }
1545 [ - + ]: 583 : else if( FN_UNO_TITLE == pEntry->nWID )
1546 : : {
1547 [ # # ]: 0 : SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
1548 : : OSL_ENSURE( pFmt,
1549 : : "unexpected type of <pFmt> --> crash" );
1550 : : // assure that <SdrObject> instance exists.
1551 [ # # ]: 0 : GetOrCreateSdrObject( pFlyFmt );
1552 [ # # ][ # # ]: 0 : aAny <<= OUString(pFlyFmt->GetObjTitle());
[ # # ][ # # ]
1553 : : }
1554 : : // New attribute Description
1555 [ + + ]: 583 : else if( FN_UNO_DESCRIPTION == pEntry->nWID )
1556 : : {
1557 [ - + ]: 12 : SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
1558 : : OSL_ENSURE( pFmt,
1559 : : "unexpected type of <pFmt> --> crash" );
1560 : : // assure that <SdrObject> instance exists.
1561 [ + - ]: 12 : GetOrCreateSdrObject( pFlyFmt );
1562 [ + - ][ + - ]: 12 : aAny <<= OUString(pFlyFmt->GetObjDescription());
[ + - ][ + - ]
1563 : : }
1564 [ + + + + ]: 628 : else if(eType == FLYCNTTYPE_GRF &&
[ + + ]
1565 [ + - ][ + - ]: 57 : (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ACTUAL_SIZE))))
1566 : : {
1567 [ + - ]: 4 : const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1568 [ + - ]: 4 : if(pIdx)
1569 : : {
1570 [ + - ]: 4 : SwNodeIndex aIdx(*pIdx, 1);
1571 : : // --> OD #i85105#
1572 : : // SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1573 : : // Size aActSize = ((SwGrfNode*)pNoTxt)->GetTwipSize();
1574 : 4 : Size aActSize;
1575 : : {
1576 [ - + ]: 4 : SwGrfNode* pGrfNode = dynamic_cast<SwGrfNode*>(aIdx.GetNode().GetNoTxtNode());
1577 [ + - ]: 4 : if ( pGrfNode )
1578 : : {
1579 [ + - ]: 4 : aActSize = pGrfNode->GetTwipSize();
1580 [ + - ]: 8 : if ( aActSize.Width() == 0 && aActSize.Height() == 0 &&
[ + - + - ]
[ + - ]
1581 : 4 : pGrfNode->IsLinkedFile() )
1582 : : {
1583 [ + - ]: 4 : pGrfNode->SwapIn( sal_True );
1584 [ + - ]: 4 : aActSize = pGrfNode->GetTwipSize();
1585 : : }
1586 : : }
1587 : : }
1588 : : // <--
1589 : 4 : awt::Size aTmp;
1590 [ + - ]: 4 : aTmp.Width = TWIP_TO_MM100(aActSize.Width());
1591 [ + - ]: 4 : aTmp.Height = TWIP_TO_MM100(aActSize.Height());
1592 [ + - ][ + - ]: 4 : aAny.setValue(&aTmp, ::getCppuType(static_cast<const awt::Size*>(0)));
1593 : : }
1594 : : }
1595 [ - + ]: 567 : else if(FN_PARAM_LINK_DISPLAY_NAME == pEntry->nWID)
1596 : : {
1597 [ # # ][ # # ]: 0 : aAny <<= OUString(pFmt->GetName());
1598 : : }
1599 [ + + ]: 567 : else if(FN_UNO_Z_ORDER == pEntry->nWID)
1600 : : {
1601 [ + - ]: 15 : const SdrObject* pObj = pFmt->FindRealSdrObject();
1602 [ + + ]: 15 : if( pObj == NULL )
1603 [ + - ]: 6 : pObj = pFmt->FindSdrObject();
1604 [ + - ]: 15 : if( pObj )
1605 : : {
1606 [ + - ][ + - ]: 15 : aAny <<= (sal_Int32)pObj->GetOrdNum();
1607 : : }
1608 : : }
1609 [ + + ][ + + ]: 552 : else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_MODEL == pEntry->nWID||
[ + + ][ + - ]
[ + + ]
1610 : : FN_UNO_COMPONENT == pEntry->nWID ||FN_UNO_STREAM_NAME == pEntry->nWID||
1611 : : FN_EMBEDDED_OBJECT == pEntry->nWID)
1612 : : {
1613 : 347 : SwDoc* pDoc = pFmt->GetDoc();
1614 [ + - ]: 347 : const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
1615 : : OSL_ENSURE( pCnt->GetCntntIdx() &&
1616 : : pDoc->GetNodes()[ pCnt->GetCntntIdx()->
1617 : : GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
1618 : :
1619 [ + - ]: 347 : SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetCntntIdx()
1620 [ + - ]: 694 : ->GetIndex() + 1 ]->GetOLENode();
1621 [ + - ]: 347 : uno::Reference < embed::XEmbeddedObject > xIP = pOleNode->GetOLEObj().GetOleRef();
1622 : 347 : OUString aHexCLSID;
1623 : : {
1624 [ + - ][ + - ]: 347 : SvGlobalName aClassName( xIP->getClassID() );
[ + - ][ + - ]
1625 [ + - ][ + - ]: 347 : aHexCLSID = aClassName.GetHexName();
[ + - ]
1626 [ + + ]: 347 : if(FN_UNO_CLSID != pEntry->nWID)
1627 : : {
1628 [ + - ][ + - ]: 345 : if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
1629 : : {
1630 [ + - ][ + - ]: 345 : uno::Reference < lang::XComponent > xComp( xIP->getComponent(), uno::UNO_QUERY );
[ + - ]
1631 [ + - ]: 345 : uno::Reference < frame::XModel > xModel( xComp, uno::UNO_QUERY );
1632 [ + + ]: 345 : if ( FN_EMBEDDED_OBJECT == pEntry->nWID )
1633 : : {
1634 : : // ensure the
1635 : : OSL_ENSURE( pDoc->GetDocShell(), "no doc shell => no client site" );
1636 [ + - ]: 2 : if ( pDoc->GetDocShell() )
1637 [ + - ][ + - ]: 2 : pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xIP, embed::Aspects::MSOLE_CONTENT ) );
[ + - ]
1638 [ + - ]: 2 : aAny <<= xIP;
1639 : : }
1640 [ + - ]: 343 : else if ( xModel.is() )
1641 [ + - ]: 343 : aAny <<= xModel;
1642 [ # # ]: 0 : else if ( FN_UNO_COMPONENT == pEntry->nWID )
1643 [ # # ]: 345 : aAny <<= xComp;
1644 : : }
1645 [ + - ]: 347 : }
1646 : : }
1647 : :
1648 [ + + ]: 347 : if(FN_UNO_CLSID == pEntry->nWID)
1649 [ + - ]: 2 : aAny <<= aHexCLSID;
1650 [ - + ]: 345 : else if(FN_UNO_STREAM_NAME == pEntry->nWID)
1651 : : {
1652 [ # # ][ # # ]: 0 : aAny <<= ::rtl::OUString(pOleNode->GetOLEObj().GetCurrentPersistName());
1653 : : }
1654 [ + + ]: 345 : else if(FN_EMBEDDED_OBJECT == pEntry->nWID)
1655 : : {
1656 [ + - ][ + - ]: 2 : aAny <<= pOleNode->GetOLEObj().GetOleRef();
1657 : 347 : }
1658 : : }
1659 [ - + ]: 205 : else if(WID_LAYOUT_SIZE == pEntry->nWID)
1660 : : {
1661 : : // format document completely in order to get correct value
1662 [ # # ][ # # ]: 0 : pFmt->GetDoc()->GetEditShell()->CalcLayout();
1663 : :
1664 [ # # ]: 0 : SwFrm* pTmpFrm = SwIterator<SwFrm,SwFmt>::FirstElement( *pFmt );
1665 [ # # ]: 0 : if ( pTmpFrm )
1666 : : {
1667 : : OSL_ENSURE( pTmpFrm->IsValid(), "frame not valid" );
1668 : 0 : const SwRect &rRect = pTmpFrm->Frm();
1669 : : Size aMM100Size = OutputDevice::LogicToLogic(
1670 : : Size( rRect.Width(), rRect.Height() ),
1671 [ # # ][ # # ]: 0 : MapMode( MAP_TWIP ), MapMode( MAP_100TH_MM ));
[ # # ][ # # ]
[ # # ]
1672 [ # # ]: 0 : aAny <<= awt::Size( aMM100Size.Width(), aMM100Size.Height() );
1673 : : }
1674 : : }
1675 : : else
1676 : : {
1677 : 205 : const SwAttrSet& rSet = pFmt->GetAttrSet();
1678 [ + - ]: 657 : m_pPropSet->getPropertyValue(*pEntry, rSet, aAny);
1679 : : }
1680 : : }
1681 [ + - ]: 48 : else if(IsDescriptor())
1682 : : {
1683 [ - + ]: 48 : if ( ! m_pDoc )
1684 [ # # ]: 0 : throw uno::RuntimeException();
1685 [ + - ]: 48 : if(WID_LAYOUT_SIZE != pEntry->nWID) // there is no LayoutSize in a descriptor
1686 : : {
1687 : 48 : const uno::Any* pAny = 0;
1688 [ + - ][ + + ]: 48 : if( !pProps->GetProperty( pEntry->nWID, pEntry->nMemberId, pAny ) )
1689 [ + - ][ + - ]: 2 : aAny = mxStyleData->getPropertyValue( rPropertyName );
1690 [ + - ]: 46 : else if ( pAny )
1691 : 48 : aAny = *pAny;
1692 : : }
1693 : : }
1694 : : else
1695 [ # # ]: 0 : throw uno::RuntimeException();
1696 [ + - ]: 717 : return aAny;
1697 : : }
1698 : :
1699 : 0 : void SwXFrame::addPropertyChangeListener(const OUString& /*PropertyName*/,
1700 : : const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
1701 : : throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1702 : : {
1703 : : OSL_FAIL("not implemented");
1704 : 0 : }
1705 : :
1706 : 0 : void SwXFrame::removePropertyChangeListener(const OUString& /*PropertyName*/,
1707 : : const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
1708 : : throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1709 : : {
1710 : : OSL_FAIL("not implemented");
1711 : 0 : }
1712 : :
1713 : 0 : void SwXFrame::addVetoableChangeListener(const OUString& /*PropertyName*/,
1714 : : const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
1715 : : throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1716 : : {
1717 : : OSL_FAIL("not implemented");
1718 : 0 : }
1719 : :
1720 : 0 : void SwXFrame::removeVetoableChangeListener(
1721 : : const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
1722 : : throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1723 : : {
1724 : : OSL_FAIL("not implemented");
1725 : 0 : }
1726 : :
1727 : 0 : beans::PropertyState SwXFrame::getPropertyState( const OUString& rPropertyName )
1728 : : throw(beans::UnknownPropertyException, uno::RuntimeException)
1729 : : {
1730 [ # # ]: 0 : SolarMutexGuard aGuard;
1731 [ # # ]: 0 : uno::Sequence< OUString > aPropertyNames(1);
1732 [ # # ]: 0 : OUString* pNames = aPropertyNames.getArray();
1733 : 0 : pNames[0] = rPropertyName;
1734 [ # # ]: 0 : uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aPropertyNames);
1735 [ # # ][ # # ]: 0 : return aStates.getConstArray()[0];
[ # # ]
1736 : : }
1737 : :
1738 : 0 : uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
1739 : : const uno::Sequence< OUString >& aPropertyNames )
1740 : : throw(beans::UnknownPropertyException, uno::RuntimeException)
1741 : : {
1742 [ # # ]: 0 : SolarMutexGuard aGuard;
1743 [ # # ]: 0 : uno::Sequence< beans::PropertyState > aStates(aPropertyNames.getLength());
1744 [ # # ]: 0 : beans::PropertyState* pStates = aStates.getArray();
1745 [ # # ]: 0 : SwFrmFmt* pFmt = GetFrmFmt();
1746 [ # # ]: 0 : if(pFmt)
1747 : : {
1748 : 0 : const OUString* pNames = aPropertyNames.getConstArray();
1749 : 0 : const SwAttrSet& rFmtSet = pFmt->GetAttrSet();
1750 [ # # ]: 0 : for(int i = 0; i < aPropertyNames.getLength(); i++)
1751 : : {
1752 [ # # ]: 0 : const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(pNames[i]);
1753 [ # # ]: 0 : if (!pEntry)
1754 [ # # ][ # # ]: 0 : throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
[ # # ]
1755 : :
1756 [ # # ][ # # ]: 0 : if(pEntry->nWID == FN_UNO_ANCHOR_TYPES||
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1757 : : pEntry->nWID == FN_PARAM_LINK_DISPLAY_NAME||
1758 : : FN_UNO_FRAME_STYLE_NAME == pEntry->nWID||
1759 : : FN_UNO_GRAPHIC_U_R_L == pEntry->nWID||
1760 : : FN_UNO_GRAPHIC_FILTER == pEntry->nWID||
1761 : : FN_UNO_ACTUAL_SIZE == pEntry->nWID||
1762 : : FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
1763 : : {
1764 : 0 : pStates[i] = beans::PropertyState_DIRECT_VALUE;
1765 : : }
1766 : : else
1767 : : {
1768 [ # # ]: 0 : if ((eType == FLYCNTTYPE_GRF) &&
[ # # # # ]
[ # # ]
1769 : 0 : pEntry && isGRFATR(pEntry->nWID))
1770 : : {
1771 [ # # ]: 0 : const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1772 [ # # ]: 0 : if(pIdx)
1773 : : {
1774 [ # # ]: 0 : SwNodeIndex aIdx(*pIdx, 1);
1775 : 0 : SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1776 [ # # ][ # # ]: 0 : SfxItemSet aSet(pNoTxt->GetSwAttrSet());
1777 [ # # ]: 0 : aSet.GetItemState(pEntry->nWID);
1778 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == aSet.GetItemState( pEntry->nWID, sal_False ))
1779 [ # # ][ # # ]: 0 : pStates[i] = beans::PropertyState_DIRECT_VALUE;
1780 : : }
1781 : : }
1782 : : else
1783 : : {
1784 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == rFmtSet.GetItemState( pEntry->nWID, sal_False ))
1785 : 0 : pStates[i] = beans::PropertyState_DIRECT_VALUE;
1786 : : else
1787 : 0 : pStates[i] = beans::PropertyState_DEFAULT_VALUE;
1788 : : }
1789 : : }
1790 : : }
1791 : : }
1792 [ # # ]: 0 : else if(IsDescriptor())
1793 : : {
1794 [ # # ]: 0 : for(int i = 0; i < aPropertyNames.getLength(); i++)
1795 : 0 : pStates[i] = beans::PropertyState_DIRECT_VALUE;
1796 : : }
1797 : : else
1798 [ # # ]: 0 : throw uno::RuntimeException();
1799 [ # # ]: 0 : return aStates;
1800 : : }
1801 : :
1802 : 0 : void SwXFrame::setPropertyToDefault( const OUString& rPropertyName )
1803 : : throw(beans::UnknownPropertyException, uno::RuntimeException)
1804 : : {
1805 [ # # ]: 0 : SolarMutexGuard aGuard;
1806 [ # # ]: 0 : SwFrmFmt* pFmt = GetFrmFmt();
1807 [ # # ]: 0 : if(pFmt)
1808 : : {
1809 [ # # ]: 0 : const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
1810 [ # # ]: 0 : if (!pEntry)
1811 [ # # ][ # # ]: 0 : throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
[ # # ]
1812 [ # # ]: 0 : if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
1813 [ # # ][ # # ]: 0 : throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertyToDefault: property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
[ # # ]
1814 : :
1815 : : bool bNextFrame;
1816 [ # # ][ # # ]: 0 : if( pEntry->nWID &&
[ # # ]
1817 : : pEntry->nWID != FN_UNO_ANCHOR_TYPES &&
1818 : : pEntry->nWID != FN_PARAM_LINK_DISPLAY_NAME)
1819 : : {
1820 [ # # ][ # # ]: 0 : if ( (eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID) )
[ # # ]
1821 : : {
1822 [ # # ]: 0 : const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1823 [ # # ]: 0 : if(pIdx)
1824 : : {
1825 [ # # ]: 0 : SwNodeIndex aIdx(*pIdx, 1);
1826 : 0 : SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1827 : : {
1828 [ # # ][ # # ]: 0 : SfxItemSet aSet(pNoTxt->GetSwAttrSet());
1829 [ # # ]: 0 : aSet.ClearItem(pEntry->nWID);
1830 [ # # ][ # # ]: 0 : pNoTxt->SetAttr(aSet);
1831 [ # # ]: 0 : }
1832 : : }
1833 : : }
1834 : : // #i73249#
1835 : : // Attribute AlternativeText was never published.
1836 : : // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
1837 : : // else if( eType != FLYCNTTYPE_FRM && FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID )
1838 : : // {
1839 : : // const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1840 : : // if(pIdx)
1841 : : // {
1842 : : // SwNodeIndex aIdx(*pIdx, 1);
1843 : : // SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1844 : : // pNoTxt->SetAlternateText(aEmptyStr);
1845 : : // }
1846 : : // }
1847 : : // New attribute Title
1848 [ # # ]: 0 : else if( FN_UNO_TITLE == pEntry->nWID )
1849 : : {
1850 [ # # ]: 0 : SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
1851 : : OSL_ENSURE( pFmt,
1852 : : "unexpected type of <pFmt> --> crash" );
1853 : : // assure that <SdrObject> instance exists.
1854 [ # # ]: 0 : GetOrCreateSdrObject( pFlyFmt );
1855 [ # # ]: 0 : pFlyFmt->GetDoc()->SetFlyFrmTitle( *(pFlyFmt), aEmptyStr );
1856 : : }
1857 : : // New attribute Description
1858 [ # # ]: 0 : else if( FN_UNO_DESCRIPTION == pEntry->nWID )
1859 : : {
1860 [ # # ]: 0 : SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
1861 : : OSL_ENSURE( pFmt,
1862 : : "unexpected type of <pFmt> --> crash" );
1863 : : // assure that <SdrObject> instance exists.
1864 [ # # ]: 0 : GetOrCreateSdrObject( pFlyFmt );
1865 [ # # ]: 0 : pFlyFmt->GetDoc()->SetFlyFrmDescription( *(pFlyFmt), aEmptyStr );
1866 : : }
1867 : : else
1868 : : {
1869 : 0 : SwDoc* pDoc = pFmt->GetDoc();
1870 : 0 : SfxItemSet aSet( pDoc->GetAttrPool(),
1871 [ # # ]: 0 : RES_FRMATR_BEGIN, RES_FRMATR_END - 1 );
1872 : 0 : aSet.SetParent(&pFmt->GetAttrSet());
1873 [ # # ]: 0 : aSet.ClearItem(pEntry->nWID);
1874 [ # # ][ # # ]: 0 : if(!rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPE)))
[ # # ]
1875 [ # # ][ # # ]: 0 : pFmt->SetFmtAttr(aSet);
1876 : 0 : }
1877 : : }
1878 [ # # ][ # # ]: 0 : else if(0 != (bNextFrame = (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_NEXT_NAME))))
[ # # # # ]
[ # # ]
1879 [ # # ][ # # ]: 0 : || rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_PREV_NAME)))
1880 : : {
1881 : 0 : SwDoc* pDoc = pFmt->GetDoc();
1882 [ # # ]: 0 : if(bNextFrame)
1883 [ # # ]: 0 : pDoc->Unchain(*pFmt);
1884 : : else
1885 : : {
1886 [ # # ][ # # ]: 0 : SwFmtChain aChain( pFmt->GetChain() );
1887 : 0 : SwFrmFmt *pPrev = aChain.GetPrev();
1888 [ # # ]: 0 : if(pPrev)
1889 [ # # ][ # # ]: 0 : pDoc->Unchain(*pPrev);
1890 : : }
1891 : : }
1892 : : }
1893 [ # # ]: 0 : else if(!IsDescriptor())
1894 [ # # ][ # # ]: 0 : throw uno::RuntimeException();
1895 : :
1896 : 0 : }
1897 : :
1898 : 0 : uno::Any SwXFrame::getPropertyDefault( const OUString& rPropertyName )
1899 : : throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1900 : : {
1901 [ # # ]: 0 : SolarMutexGuard aGuard;
1902 : 0 : uno::Any aRet;
1903 [ # # ]: 0 : SwFrmFmt* pFmt = GetFrmFmt();
1904 [ # # ]: 0 : if(pFmt)
1905 : : {
1906 [ # # ]: 0 : const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
1907 [ # # ]: 0 : if(pEntry)
1908 : : {
1909 [ # # ]: 0 : if ( pEntry->nWID < RES_FRMATR_END )
1910 : : {
1911 : : const SfxPoolItem& rDefItem =
1912 [ # # ]: 0 : pFmt->GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
1913 [ # # ]: 0 : rDefItem.QueryValue(aRet, pEntry->nMemberId);
1914 : : }
1915 : : }
1916 : : else
1917 [ # # ][ # # ]: 0 : throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
[ # # ]
1918 : : }
1919 [ # # ]: 0 : else if(!IsDescriptor())
1920 [ # # ]: 0 : throw uno::RuntimeException();
1921 [ # # ]: 0 : return aRet;
1922 : : }
1923 : :
1924 : 12 : void SwXFrame::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
1925 : : {
1926 [ - + ]: 12 : if(!GetRegisteredIn())
1927 [ # # ]: 0 : throw uno::RuntimeException();
1928 : 12 : aLstnrCntnr.AddListener(aListener);
1929 : 12 : }
1930 : :
1931 : 6 : void SwXFrame::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
1932 : : {
1933 [ + - ][ - + ]: 6 : if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
[ - + ]
1934 [ # # ]: 0 : throw uno::RuntimeException();
1935 : 6 : }
1936 : :
1937 : 381 : void SwXFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
1938 : : {
1939 : 381 : ClientModify(this, pOld, pNew);
1940 [ + + ]: 381 : if(!GetRegisteredIn())
1941 : : {
1942 : 114 : mxStyleData.clear();
1943 : 114 : mxStyleFamily.clear();
1944 : 114 : m_pDoc = 0;
1945 : 114 : aLstnrCntnr.Disposing();
1946 : : }
1947 : 381 : }
1948 : :
1949 : 8 : void SwXFrame::dispose(void) throw( uno::RuntimeException )
1950 : : {
1951 [ + - ]: 8 : SolarMutexGuard aGuard;
1952 [ + - ]: 8 : SwFrmFmt* pFmt = GetFrmFmt();
1953 [ + - ]: 8 : if ( pFmt )
1954 : : {
1955 [ + - ]: 8 : SdrObject* pObj = pFmt->FindSdrObject();
1956 : : // OD 11.09.2003 #112039# - add condition to perform delete of
1957 : : // format/anchor sign, not only if the object is inserted, but also
1958 : : // if a contact object is registered, which isn't in the destruction.
1959 [ + - ][ + - ]: 32 : if ( pObj &&
[ + - ][ + - ]
[ + - ]
1960 [ + - ]: 8 : ( pObj->IsInserted() ||
1961 [ + - ]: 8 : ( pObj->GetUserCall() &&
1962 [ + - ][ + - ]: 8 : !static_cast<SwContact*>(pObj->GetUserCall())->IsInDTOR() ) ) )
1963 : : {
1964 [ + - ][ + + ]: 8 : if (pFmt->GetAnchor().GetAnchorId() == FLY_AS_CHAR)
1965 : : {
1966 [ + - ][ + - ]: 4 : const SwPosition &rPos = *(pFmt->GetAnchor().GetCntntAnchor());
1967 : 4 : SwTxtNode *pTxtNode = rPos.nNode.GetNode().GetTxtNode();
1968 : 4 : const xub_StrLen nIdx = rPos.nContent.GetIndex();
1969 [ + - ]: 4 : pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
1970 : : }
1971 : : else
1972 [ + - ]: 4 : pFmt->GetDoc()->DelLayoutFmt(pFmt);
1973 : : }
1974 [ + - ]: 8 : }
1975 : :
1976 : 8 : }
1977 : :
1978 : 12 : uno::Reference< text::XTextRange > SwXFrame::getAnchor(void) throw( uno::RuntimeException )
1979 : : {
1980 [ + - ]: 12 : SolarMutexGuard aGuard;
1981 : 12 : uno::Reference< text::XTextRange > aRef;
1982 [ + - ]: 12 : SwFrmFmt* pFmt = GetFrmFmt();
1983 [ + - ]: 12 : if(pFmt)
1984 : : {
1985 [ + - ]: 12 : const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
1986 : : // return an anchor for non-page bound frames
1987 : : // and for page bound frames that have a page no == NULL and a content position
1988 [ - + ]: 12 : if ((rAnchor.GetAnchorId() != FLY_AT_PAGE) ||
[ # # # # ]
[ + - ]
1989 [ # # ]: 0 : (rAnchor.GetCntntAnchor() && !rAnchor.GetPageNum()))
1990 : : {
1991 [ + - ]: 12 : const SwPosition &rPos = *(rAnchor.GetCntntAnchor());
1992 [ + - ][ + - ]: 12 : aRef = SwXTextRange::CreateXTextRange(*pFmt->GetDoc(), rPos, 0);
1993 : : }
1994 : : }
1995 : : else
1996 [ # # ]: 0 : throw uno::RuntimeException();
1997 [ + - ]: 12 : return aRef;
1998 : : }
1999 : :
2000 : 590 : void SwXFrame::ResetDescriptor()
2001 : : {
2002 : 590 : bIsDescriptor = false;
2003 : 590 : mxStyleData.clear();
2004 : 590 : mxStyleFamily.clear();
2005 [ + - ]: 590 : DELETEZ(pProps);
2006 : 590 : }
2007 : :
2008 : 590 : void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
2009 : : throw( lang::IllegalArgumentException, uno::RuntimeException )
2010 : : {
2011 [ + - ]: 590 : SolarMutexGuard aGuard;
2012 [ - + ]: 590 : if(!IsDescriptor())
2013 [ # # ]: 0 : throw uno::RuntimeException();
2014 [ + - ]: 590 : uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
2015 : 590 : SwXTextRange* pRange = 0;
2016 : 590 : OTextCursorHelper* pCursor = 0;
2017 [ + - ]: 590 : if(xRangeTunnel.is())
2018 : : {
2019 : : pRange = reinterpret_cast< SwXTextRange * >(
2020 [ + - ][ + - ]: 590 : sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
[ + - ]
2021 : : pCursor = reinterpret_cast< OTextCursorHelper * >(
2022 [ + - ][ + - ]: 590 : sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
[ + - ]
2023 : : }
2024 : :
2025 [ + + ][ + - ]: 590 : SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
[ + - ][ + - ]
2026 [ + - ]: 590 : if(pDoc)
2027 : : {
2028 [ + - ]: 590 : SwUnoInternalPaM aIntPam(*pDoc);
2029 : : //das muss jetzt true liefern
2030 [ + - ]: 590 : ::sw::XTextRangeToSwPaM(aIntPam, xTextRange);
2031 : :
2032 [ + - ]: 590 : SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
2033 [ + - ]: 590 : SwPaM aPam(rNode);
2034 [ + - ]: 590 : aPam.Move( fnMoveBackward, fnGoDoc );
2035 : : static sal_uInt16 const aFrmAttrRange[] =
2036 : : {
2037 : : RES_FRMATR_BEGIN, RES_FRMATR_END-1,
2038 : : SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
2039 : : RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
2040 : : 0
2041 : : };
2042 : : static sal_uInt16 const aGrAttrRange[] =
2043 : : {
2044 : : RES_GRFATR_BEGIN, RES_GRFATR_END-1,
2045 : : 0
2046 : : };
2047 [ + - ]: 590 : SfxItemSet aGrSet(pDoc->GetAttrPool(), aGrAttrRange );
2048 : :
2049 [ + - ]: 590 : SfxItemSet aFrmSet(pDoc->GetAttrPool(), aFrmAttrRange );
2050 : : //jetzt muessen die passenden Items in den Set
2051 : : bool bSizeFound;
2052 [ + - ][ - + ]: 590 : if(!pProps->AnyToItemSet( pDoc, aFrmSet, aGrSet, bSizeFound))
2053 [ # # ]: 0 : throw lang::IllegalArgumentException();
2054 : : //der TextRange wird einzeln behandelt
2055 [ + - ]: 590 : *aPam.GetPoint() = *aIntPam.GetPoint();
2056 [ + + ]: 590 : if(aIntPam.HasMark())
2057 : : {
2058 [ + - ]: 15 : aPam.SetMark();
2059 [ + - ]: 15 : *aPam.GetMark() = *aIntPam.GetMark();
2060 : : }
2061 : :
2062 : : const SfxPoolItem* pItem;
2063 : 590 : RndStdIds eAnchorId = FLY_AT_PARA;
2064 [ + - ][ + - ]: 590 : if(SFX_ITEM_SET == aFrmSet.GetItemState(RES_ANCHOR, false, &pItem) )
2065 : : {
2066 : 590 : eAnchorId = ((const SwFmtAnchor*)pItem)->GetAnchorId();
2067 [ # # ][ - + ]: 590 : if( FLY_AT_FLY == eAnchorId &&
[ - + ]
2068 [ # # ]: 0 : !aPam.GetNode()->FindFlyStartNode())
2069 : : {
2070 : : //rahmengebunden geht nur dort, wo ein Rahmen ist!
2071 [ # # ]: 0 : SwFmtAnchor aAnchor(FLY_AT_PARA);
2072 [ # # ][ # # ]: 0 : aFrmSet.Put(aAnchor);
2073 : : }
2074 [ + + + + ]: 606 : else if ((FLY_AT_PAGE == eAnchorId) &&
[ + + ]
2075 : 16 : 0 == ((const SwFmtAnchor*)pItem)->GetPageNum() )
2076 : : {
2077 [ + - ]: 14 : SwFmtAnchor aAnchor( *((const SwFmtAnchor*)pItem) );
2078 [ + - ]: 14 : aAnchor.SetAnchor( aPam.GetPoint() );
2079 [ + - ][ + - ]: 14 : aFrmSet.Put(aAnchor);
2080 : : }
2081 : : }
2082 : :
2083 : : const ::uno::Any* pStyle;
2084 : 590 : SwFrmFmt *pParentFrmFmt = 0;
2085 [ + - ][ + + ]: 590 : if(pProps->GetProperty(FN_UNO_FRAME_STYLE_NAME, 0, pStyle))
2086 [ + - ]: 6 : pParentFrmFmt = lcl_GetFrmFmt( *pStyle, pDoc );
2087 : :
2088 : 590 : SwFlyFrmFmt* pFmt = 0;
2089 [ + + ]: 590 : if( eType == FLYCNTTYPE_FRM)
2090 : : {
2091 [ + - ]: 117 : UnoActionContext aCont(pDoc);
2092 [ + + ]: 117 : if(m_pCopySource)
2093 : : {
2094 : 15 : SwFmtAnchor* pAnchorItem = 0;
2095 : : // the frame is inserted bound to page
2096 : : // to prevent conflicts if the to-be-anchored position is part of the to-be-copied text
2097 [ + - ]: 15 : if (eAnchorId != FLY_AT_PAGE)
2098 : : {
2099 [ + - ][ + - ]: 15 : pAnchorItem = static_cast<SwFmtAnchor*>(aFrmSet.Get(RES_ANCHOR).Clone());
2100 [ + - ][ + - ]: 15 : aFrmSet.Put( SwFmtAnchor( FLY_AT_PAGE, 1 ));
[ + - ]
2101 : : }
2102 : :
2103 [ + - ]: 15 : aPam.DeleteMark(); // mark position node will be deleted!
2104 [ + - ]: 15 : aIntPam.DeleteMark(); // mark position node will be deleted!
2105 : : pFmt = pDoc->MakeFlyAndMove( *m_pCopySource, aFrmSet,
2106 : : 0,
2107 [ + - ]: 15 : pParentFrmFmt );
2108 [ + - ][ + - ]: 15 : if(pAnchorItem && pFmt)
2109 : : {
2110 [ + - ]: 15 : pFmt->DelFrms();
2111 [ + - ][ + - ]: 15 : pAnchorItem->SetAnchor( m_pCopySource->Start() );
2112 [ + - ]: 15 : SfxItemSet aAnchorSet( pDoc->GetAttrPool(), RES_ANCHOR, RES_ANCHOR );
2113 [ + - ]: 15 : aAnchorSet.Put( *pAnchorItem );
2114 [ + - ]: 15 : pDoc->SetFlyFrmAttr( *pFmt, aAnchorSet );
2115 [ + - ][ + - ]: 15 : delete pAnchorItem;
[ + - ]
2116 : : }
2117 [ + - ][ + - ]: 15 : DELETEZ( m_pCopySource );
2118 : : }
2119 : : else
2120 : : {
2121 : 102 : pFmt = pDoc->MakeFlySection( FLY_AT_PARA, aPam.GetPoint(),
2122 [ + - ]: 102 : &aFrmSet, pParentFrmFmt );
2123 : : }
2124 [ + - ]: 117 : if(pFmt)
2125 : : {
2126 [ + - ]: 117 : pFmt->Add(this);
2127 [ + + ]: 117 : if(sName.Len())
2128 [ + - ]: 70 : pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt, sName);
2129 : : }
2130 : : //den SwXText wecken
2131 [ + - ][ # # ]: 117 : ((SwXTextFrame*)this)->SetDoc( bIsDescriptor ? m_pDoc : GetFrmFmt()->GetDoc() );
[ + - ][ + - ]
2132 : : }
2133 [ + + ]: 473 : else if( eType == FLYCNTTYPE_GRF)
2134 : : {
2135 [ + - ]: 41 : UnoActionContext aCont(pDoc);
2136 : : const ::uno::Any* pGraphicURL;
2137 [ + - ]: 41 : String sGraphicURL;
2138 : 41 : GraphicObject *pGrfObj = 0;
2139 [ + - ][ + + ]: 41 : if(pProps->GetProperty(FN_UNO_GRAPHIC_U_R_L, 0, pGraphicURL))
2140 : : {
2141 : 2 : OUString uTemp;
2142 : 2 : (*pGraphicURL) >>= uTemp;
2143 [ + - ][ + - ]: 2 : sGraphicURL = String(uTemp);
[ + - ]
2144 [ + - ]: 2 : if( sGraphicURL.EqualsAscii( sPackageProtocol,
2145 [ + - ]: 2 : 0, sizeof( sPackageProtocol )-1 ) )
2146 : : {
2147 [ + - ][ + - ]: 2 : pGrfObj = new GraphicObject;
2148 [ + - ]: 2 : pGrfObj->SetUserData( sGraphicURL );
2149 [ + - ]: 2 : pGrfObj->SetSwapState();
2150 [ + - ]: 2 : sGraphicURL.Erase();
2151 : : }
2152 [ # # ]: 0 : else if( sGraphicURL.EqualsAscii( sGraphicObjectProtocol,
2153 [ # # ]: 0 : 0, sizeof(sGraphicObjectProtocol)-1 ) )
2154 : : {
2155 : : rtl::OString sId(rtl::OUStringToOString(
2156 : : sGraphicURL.Copy( sizeof(sGraphicObjectProtocol)-1 ),
2157 [ # # ][ # # ]: 0 : RTL_TEXTENCODING_ASCII_US));
[ # # ][ # # ]
2158 [ # # ][ # # ]: 0 : pGrfObj = new GraphicObject( sId );
2159 [ # # ]: 0 : sGraphicURL.Erase();
2160 : 2 : }
2161 : : }
2162 [ + - ]: 41 : Graphic aGraphic;
2163 : : const ::uno::Any* pGraphic;
2164 [ + - ][ + + ]: 41 : if( pProps->GetProperty( FN_UNO_GRAPHIC, 0, pGraphic ))
2165 : : {
2166 : 27 : uno::Reference< graphic::XGraphic > xGraphic;
2167 [ + - ]: 27 : (*pGraphic) >>= xGraphic;
2168 [ + - ][ + - ]: 27 : aGraphic = Graphic( xGraphic );
[ + - ]
2169 : : }
2170 : :
2171 [ + - ]: 41 : String sFltName;
2172 : : const ::uno::Any* pFilter;
2173 [ + - ][ + + ]: 41 : if(pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0, pFilter))
2174 : : {
2175 : 2 : OUString uTemp;
2176 : 2 : (*pFilter) >>= uTemp;
2177 [ + - ][ + - ]: 2 : sFltName = String(uTemp);
[ + - ]
2178 : : }
2179 : :
2180 : : pFmt =
2181 : : pGrfObj ? pDoc->Insert( aPam, *pGrfObj, &aFrmSet, &aGrSet,
2182 : 2 : pParentFrmFmt )
2183 : : : pDoc->Insert( aPam, sGraphicURL, sFltName, &aGraphic,
2184 [ + + ][ + - ]: 41 : &aFrmSet, &aGrSet, pParentFrmFmt );
[ + - ]
2185 [ + + ][ + - ]: 41 : delete pGrfObj;
2186 [ + - ]: 41 : if(pFmt)
2187 : : {
2188 [ + - + - ]: 82 : SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFmt->GetCntnt().GetCntntIdx()
2189 [ + - ]: 82 : ->GetIndex()+1 ]->GetGrfNode();
2190 : 41 : pGrfNd->SetChgTwipSize( !bSizeFound );
2191 [ + - ]: 41 : pFmt->Add(this);
2192 [ + + ]: 41 : if(sName.Len())
2193 [ + - ]: 14 : pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt, sName);
2194 : :
2195 : : }
2196 : : const ::uno::Any* pSurroundContour;
2197 [ + - ][ + + ]: 41 : if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurroundContour))
2198 [ + - ][ + - ]: 15 : setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_SURROUND_CONTOUR)), *pSurroundContour);
2199 : : const ::uno::Any* pContourOutside;
2200 [ + - ][ + + ]: 41 : if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUROUTSIDE, pContourOutside))
2201 [ + - ][ + - ]: 15 : setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_CONTOUR_OUTSIDE)), *pContourOutside);
2202 : : const ::uno::Any* pContourPoly;
2203 [ + - ][ + + ]: 41 : if(pProps->GetProperty(FN_PARAM_COUNTOUR_PP, 0, pContourPoly))
2204 [ + - ][ + - ]: 15 : setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_CONTOUR_POLY_POLYGON)), *pContourPoly);
2205 : : const ::uno::Any* pPixelContour;
2206 [ + - ][ - + ]: 41 : if(pProps->GetProperty(FN_UNO_IS_PIXEL_CONTOUR, 0, pPixelContour))
2207 [ # # ][ # # ]: 0 : setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_IS_PIXEL_CONTOUR)), *pPixelContour);
2208 : : const ::uno::Any* pAutoContour;
2209 [ + - ][ - + ]: 41 : if(pProps->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR, 0, pAutoContour))
2210 [ # # ][ # # ]: 41 : setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_IS_AUTOMATIC_CONTOUR)), *pAutoContour);
[ + - ][ + - ]
[ + - ][ + - ]
2211 : : }
2212 : : else
2213 : : {
2214 : 432 : const ::uno::Any* pCLSID = 0;
2215 : 432 : const ::uno::Any* pStreamName = 0;
2216 : 432 : const ::uno::Any* pEmbeddedObject = 0;
2217 [ + - ][ + + ]: 1284 : if(!pProps->GetProperty(FN_UNO_CLSID, 0, pCLSID)
[ + - ][ - + ]
[ - + ]
2218 [ + - ]: 426 : && !pProps->GetProperty( FN_UNO_STREAM_NAME, 0, pStreamName )
2219 [ + - ]: 426 : && !pProps->GetProperty( FN_EMBEDDED_OBJECT, 0, pEmbeddedObject ))
2220 [ # # ]: 0 : throw uno::RuntimeException();
2221 [ + + ]: 432 : if(pCLSID)
2222 : : {
2223 : 6 : OUString aCLSID;
2224 [ + - ]: 6 : SvGlobalName aClassName;
2225 : 6 : uno::Reference < embed::XEmbeddedObject > xIPObj;
2226 : 6 : std::auto_ptr < comphelper::EmbeddedObjectContainer > pCnt;
2227 [ + - ]: 6 : if( (*pCLSID) >>= aCLSID )
2228 : : {
2229 [ + - ][ + - ]: 6 : if( !aClassName.MakeId( aCLSID ) )
[ + - ][ - + ]
2230 : : {
2231 [ # # ]: 0 : lang::IllegalArgumentException aExcept;
2232 [ # # ]: 0 : aExcept.Message = OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID invalid"));
2233 [ # # ]: 0 : throw aExcept;
2234 : : }
2235 : :
2236 [ + - ][ + - ]: 6 : pCnt.reset( new comphelper::EmbeddedObjectContainer );
2237 : 6 : ::rtl::OUString aName;
2238 [ + - ][ + - ]: 6 : xIPObj = pCnt->CreateEmbeddedObject( aClassName.GetByteSequence(), aName );
[ + - ][ + - ]
2239 : : }
2240 [ + - ]: 6 : if ( xIPObj.is() )
2241 : : {
2242 : : //TODO/LATER: MISCSTATUS_RESIZEONPRINTERCHANGE
2243 : : //if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xIPObj->GetMiscStatus() && pDoc->getPrinter( false ) )
2244 : : // xIPObj->OnDocumentPrinterChanged( pDoc->getPrinter( false ) );
2245 : :
2246 [ + - ]: 6 : UnoActionContext aAction(pDoc);
2247 [ + - ][ + - ]: 6 : pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
2248 [ + + ]: 6 : if(!bSizeFound)
2249 : : {
2250 : : //TODO/LATER: from where do I get a ViewAspect? And how do I transport it to the OLENode?
2251 : 4 : sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
2252 : :
2253 : : // TODO/LEAN: VisualArea still needs running state
2254 [ + - ]: 4 : svt::EmbeddedObjectRef::TryRunningState( xIPObj );
2255 : :
2256 : : // set parent to get correct VisArea(in case of object needing parent printer)
2257 [ + - ]: 4 : uno::Reference < container::XChild > xChild( xIPObj, uno::UNO_QUERY );
2258 [ + - ]: 4 : if ( xChild.is() )
2259 [ + - ][ + - ]: 4 : xChild->setParent( pDoc->GetDocShell()->GetModel() );
[ + - ][ # # ]
2260 : :
2261 : : //The Size should be suggested by the OLE server if not manually set
2262 [ + - ][ + - ]: 4 : MapUnit aRefMap = VCLUnoHelper::UnoEmbed2VCLMapUnit( xIPObj->getMapUnit( nAspect ) );
[ + - ]
2263 : 4 : awt::Size aSize;
2264 : : try
2265 : : {
2266 [ + - ][ + - ]: 4 : aSize = xIPObj->getVisualAreaSize( nAspect );
2267 : : }
2268 [ # # ]: 0 : catch ( embed::NoVisualAreaSizeException& )
2269 : : {
2270 : : // the default size will be set later
2271 : : }
2272 : :
2273 : 4 : Size aSz( aSize.Width, aSize.Height );
2274 [ - + ][ - + ]: 4 : if ( !aSz.Width() || !aSz.Height() )
[ + - ]
2275 : : {
2276 : 0 : aSz.Width() = aSz.Height() = 5000;
2277 : : aSz = OutputDevice::LogicToLogic
2278 [ # # ][ # # ]: 0 : ( aSz, MapMode( MAP_100TH_MM ), aRefMap );
[ # # ][ # # ]
[ # # ]
2279 : : }
2280 [ + - ]: 4 : MapMode aMyMap( MAP_TWIP );
2281 [ + - ][ + - ]: 4 : aSz = OutputDevice::LogicToLogic( aSz, aRefMap, aMyMap );
[ + - ]
2282 [ + - ]: 4 : SwFmtFrmSize aFrmSz;
2283 : 4 : aFrmSz.SetSize(aSz);
2284 [ + - ][ + - ]: 4 : aFrmSet.Put(aFrmSz);
[ + - ]
2285 : : }
2286 : 6 : SwFlyFrmFmt* pFmt2 = 0;
2287 : :
2288 : : // TODO/LATER: Is it the only possible aspect here?
2289 : 6 : sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
2290 [ + - ]: 6 : ::svt::EmbeddedObjectRef xObjRef( xIPObj, nAspect );
2291 [ + - ]: 6 : pFmt2 = pDoc->Insert(aPam, xObjRef, &aFrmSet, NULL, NULL );
2292 : : OSL_ENSURE( pFmt2, "Doc->Insert(notxt) failed." );
2293 : :
2294 [ + - ][ + - ]: 6 : pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
2295 [ + - ]: 6 : pFmt2->Add(this);
2296 [ - + ]: 6 : if(sName.Len())
2297 [ # # ][ + - ]: 6 : pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt2, sName);
[ + - ]
2298 [ + - ][ + - ]: 6 : }
2299 : : }
2300 [ - + ]: 426 : else if( pStreamName )
2301 : : {
2302 : 0 : ::rtl::OUString sStreamName;
2303 : 0 : (*pStreamName) >>= sStreamName;
2304 [ # # ][ # # ]: 0 : pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
2305 : :
2306 : 0 : SwFlyFrmFmt* pFrmFmt = 0;
2307 [ # # ][ # # ]: 0 : pFrmFmt = pDoc->InsertOLE( aPam, sStreamName, embed::Aspects::MSOLE_CONTENT, &aFrmSet, NULL, NULL );
[ # # ]
2308 [ # # ][ # # ]: 0 : pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
2309 [ # # ]: 0 : pFrmFmt->Add(this);
2310 [ # # ]: 0 : if(sName.Len())
2311 [ # # ]: 0 : pDoc->SetFlyName((SwFlyFrmFmt&)*pFrmFmt, sName);
2312 : : }
2313 [ - + ][ # # ]: 426 : else if( pEmbeddedObject || pStreamName )
2314 : : {
2315 : 426 : uno::Reference< embed::XEmbeddedObject > obj;
2316 [ + - ]: 426 : (*pEmbeddedObject) >>= obj;
2317 [ + - ]: 426 : svt::EmbeddedObjectRef xObj;
2318 [ + - ]: 426 : xObj.Assign( obj, embed::Aspects::MSOLE_CONTENT );
2319 : :
2320 [ + - ][ + - ]: 426 : pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
2321 : :
2322 : : // Not sure if these setParent() and InsertEmbeddedObject() calls are really
2323 : : // needed, it seems to work without, but logic from code elsewhere suggests
2324 : : // they should be done.
2325 [ + - ]: 426 : SfxObjectShell& mrPers = *pDoc->GetPersist();
2326 [ + - ]: 426 : uno::Reference < container::XChild > xChild( obj, uno::UNO_QUERY );
2327 [ + - ]: 426 : if ( xChild.is() )
2328 [ + - ][ + - ]: 426 : xChild->setParent( mrPers.GetModel() );
[ + - ]
2329 : 426 : ::rtl::OUString rName;
2330 [ + - ][ + - ]: 426 : mrPers.GetEmbeddedObjectContainer().InsertEmbeddedObject( obj, rName );
2331 : :
2332 : 426 : SwFlyFrmFmt* pFrmFmt = 0;
2333 [ + - ]: 426 : pFrmFmt = pDoc->Insert( aPam, xObj, &aFrmSet, NULL, NULL );
2334 [ + - ][ + - ]: 426 : pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
2335 [ + - ]: 426 : pFrmFmt->Add(this);
2336 [ - + ]: 426 : if(sName.Len())
2337 [ # # ][ + - ]: 432 : pDoc->SetFlyName((SwFlyFrmFmt&)*pFrmFmt, sName);
2338 : : }
2339 : : }
2340 [ + + ][ + - ]: 590 : if( pFmt && pDoc->GetDrawModel() )
[ + - ][ + + ]
2341 [ + - ]: 158 : GetOrCreateSdrObject( pFmt );
2342 : : const ::uno::Any* pOrder;
2343 [ + - ][ + + ]: 590 : if( pProps->GetProperty(FN_UNO_Z_ORDER, 0, pOrder) )
2344 [ + - ][ + - ]: 12 : setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_Z_ORDER)), *pOrder);
2345 : : const ::uno::Any* pReplacement;
2346 [ + - ][ - + ]: 590 : if( pProps->GetProperty(FN_UNO_REPLACEMENT_GRAPHIC, 0, pReplacement) )
2347 [ # # ][ # # ]: 0 : setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_GRAPHIC)), *pReplacement);
2348 : : // new attribute Title
2349 : : const ::uno::Any* pTitle;
2350 [ + - ][ + + ]: 590 : if ( pProps->GetProperty(FN_UNO_TITLE, 0, pTitle) )
2351 : : {
2352 [ + - ][ + - ]: 27 : setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_TITLE)), *pTitle);
2353 : : }
2354 : : // new attribute Description
2355 : : const ::uno::Any* pDescription;
2356 [ + - ][ + + ]: 590 : if ( pProps->GetProperty(FN_UNO_DESCRIPTION, 0, pDescription) )
2357 : : {
2358 [ + - ][ + - ]: 27 : setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_DESCRIPTION)), *pDescription);
2359 [ + - ][ + - ]: 590 : }
[ + - ][ + - ]
2360 : : }
2361 : : else
2362 [ # # ]: 0 : throw lang::IllegalArgumentException();
2363 : : //setzt das Flag zurueck und loescht den Descriptor-Pointer
2364 [ + - ][ + - ]: 590 : ResetDescriptor();
2365 : 590 : }
2366 : :
2367 : 604 : void SwXFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
2368 : : throw( lang::IllegalArgumentException, uno::RuntimeException )
2369 : : {
2370 : : SwFrmFmt* pFmt;
2371 [ + + ]: 604 : if(IsDescriptor())
2372 : 590 : attachToRange(xTextRange);
2373 [ + - ]: 14 : else if(0 != (pFmt = GetFrmFmt()))
2374 : : {
2375 [ + - ]: 14 : uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
2376 : 14 : SwDoc* pDoc = pFmt->GetDoc();
2377 [ + - ]: 14 : SwUnoInternalPaM aIntPam(*pDoc);
2378 [ + - ][ + + ]: 14 : if (::sw::XTextRangeToSwPaM(aIntPam, xTextRange))
2379 : : {
2380 [ + - ]: 12 : SfxItemSet aSet( pDoc->GetAttrPool(), RES_ANCHOR, RES_ANCHOR );
2381 : 12 : aSet.SetParent(&pFmt->GetAttrSet());
2382 [ + - ][ + - ]: 12 : SwFmtAnchor aAnchor = (const SwFmtAnchor&)aSet.Get(RES_ANCHOR);
2383 [ + - ][ + - ]: 12 : aAnchor.SetAnchor( aIntPam.Start() );
2384 [ + - ]: 12 : aSet.Put(aAnchor);
2385 [ + - ][ + - ]: 12 : pDoc->SetFlyFrmAttr( *pFmt, aSet );
[ + - ]
2386 : : }
2387 : : else
2388 [ + - ][ + - ]: 14 : throw lang::IllegalArgumentException();
2389 : : }
2390 : 602 : }
2391 : :
2392 : 12 : awt::Point SwXFrame::getPosition(void) throw( uno::RuntimeException )
2393 : : {
2394 [ + - ]: 12 : SolarMutexGuard aGuard;
2395 [ + - ]: 12 : uno::RuntimeException aRuntime;
2396 [ + - ]: 12 : aRuntime.Message = C2U("position cannot be determined with this method");
2397 [ + - ]: 12 : throw aRuntime;
2398 : : }
2399 : :
2400 : 0 : void SwXFrame::setPosition(const awt::Point& /*aPosition*/) throw( uno::RuntimeException )
2401 : : {
2402 [ # # ]: 0 : SolarMutexGuard aGuard;
2403 [ # # ]: 0 : uno::RuntimeException aRuntime;
2404 [ # # ]: 0 : aRuntime.Message = C2U("position cannot be changed with this method");
2405 [ # # ]: 0 : throw aRuntime;
2406 : : }
2407 : :
2408 : 21 : awt::Size SwXFrame::getSize(void) throw( uno::RuntimeException )
2409 : : {
2410 [ + - ][ + - ]: 21 : const ::uno::Any aVal = getPropertyValue(C2U("Size"));
2411 : 21 : awt::Size* pRet = (awt::Size*)aVal.getValue();
2412 : 21 : return *pRet;
2413 : : }
2414 : :
2415 : 44 : void SwXFrame::setSize(const awt::Size& aSize)
2416 : : throw( beans::PropertyVetoException, uno::RuntimeException )
2417 : : {
2418 [ + - ]: 44 : const ::uno::Any aVal(&aSize, ::getCppuType(static_cast<const awt::Size*>(0)));
2419 [ + - ][ + - ]: 44 : setPropertyValue(C2U("Size"), aVal);
2420 : 44 : }
2421 : :
2422 : 6 : OUString SwXFrame::getShapeType(void) throw( uno::RuntimeException )
2423 : : {
2424 : 6 : return C2U("FrameShape");
2425 : : }
2426 : :
2427 : : /******************************************************************
2428 : : * SwXTextFrame
2429 : : ******************************************************************/
2430 : 131 : SwXTextFrame::SwXTextFrame( SwDoc *_pDoc ) :
2431 : : SwXText(0, CURSOR_FRAME),
2432 [ + - ][ + - ]: 131 : SwXFrame(FLYCNTTYPE_FRM, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_FRAME), _pDoc )
[ + - ]
2433 : : {
2434 : 131 : }
2435 : :
2436 : 38 : SwXTextFrame::SwXTextFrame(SwFrmFmt& rFmt) :
2437 : : SwXText(rFmt.GetDoc(), CURSOR_FRAME),
2438 [ + - ][ + - ]: 38 : SwXFrame(rFmt, FLYCNTTYPE_FRM, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_FRAME))
[ + - ]
2439 : : {
2440 : :
2441 : 38 : }
2442 : :
2443 [ + - ][ + - ]: 169 : SwXTextFrame::~SwXTextFrame()
2444 : : {
2445 [ - + ]: 338 : }
2446 : :
2447 : 3773 : void SAL_CALL SwXTextFrame::acquire( )throw()
2448 : : {
2449 : 3773 : SwXFrame::acquire();
2450 : 3773 : }
2451 : :
2452 : 3773 : void SAL_CALL SwXTextFrame::release( )throw()
2453 : : {
2454 : 3773 : SwXFrame::release();
2455 : 3773 : }
2456 : :
2457 : 1344 : ::uno::Any SAL_CALL SwXTextFrame::queryInterface( const uno::Type& aType )
2458 : : throw (uno::RuntimeException)
2459 : : {
2460 : 1344 : ::uno::Any aRet = SwXFrame::queryInterface(aType);
2461 [ + + ][ + - ]: 1344 : if(aRet.getValueType() == ::getCppuVoidType())
2462 [ + - ]: 392 : aRet = SwXText::queryInterface(aType);
2463 [ + - ][ + + ]: 1344 : if(aRet.getValueType() == ::getCppuVoidType())
2464 [ + - ]: 374 : aRet = SwXTextFrameBaseClass::queryInterface(aType);
2465 : 1344 : return aRet;
2466 : : }
2467 : :
2468 : 0 : uno::Sequence< uno::Type > SAL_CALL SwXTextFrame::getTypes( ) throw(uno::RuntimeException)
2469 : : {
2470 [ # # ]: 0 : uno::Sequence< uno::Type > aTextFrameTypes = SwXTextFrameBaseClass::getTypes();
2471 [ # # ]: 0 : uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
2472 [ # # ]: 0 : uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
2473 : :
2474 : 0 : long nIndex = aTextFrameTypes.getLength();
2475 : : aTextFrameTypes.realloc(
2476 : 0 : aTextFrameTypes.getLength() +
2477 : 0 : aFrameTypes.getLength() +
2478 [ # # ]: 0 : aTextTypes.getLength());
2479 : :
2480 [ # # ]: 0 : uno::Type* pTextFrameTypes = aTextFrameTypes.getArray();
2481 : 0 : const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
2482 : : long nPos;
2483 [ # # ]: 0 : for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
2484 : 0 : pTextFrameTypes[nIndex++] = pFrameTypes[nPos];
2485 : :
2486 : 0 : const uno::Type* pTextTypes = aTextTypes.getConstArray();
2487 [ # # ]: 0 : for(nPos = 0; nPos <aTextTypes.getLength(); nPos++)
2488 : 0 : pTextFrameTypes[nIndex++] = pTextTypes[nPos];
2489 : :
2490 [ # # ][ # # ]: 0 : return aTextFrameTypes;
2491 : : }
2492 : :
2493 : : namespace
2494 : : {
2495 : : class theSwXTextFrameImplementationId : public rtl::Static< UnoTunnelIdInit, theSwXTextFrameImplementationId > {};
2496 : : }
2497 : :
2498 : 0 : uno::Sequence< sal_Int8 > SAL_CALL SwXTextFrame::getImplementationId( ) throw(uno::RuntimeException)
2499 : : {
2500 : 0 : return theSwXTextFrameImplementationId::get().getSeq();
2501 : : }
2502 : :
2503 : 18 : uno::Reference< text::XText > SwXTextFrame::getText(void) throw( uno::RuntimeException )
2504 : : {
2505 : 18 : return this;
2506 : : }
2507 : :
2508 : 40 : const SwStartNode *SwXTextFrame::GetStartNode() const
2509 : : {
2510 : 40 : const SwStartNode *pSttNd = 0;
2511 : :
2512 : 40 : SwFrmFmt* pFmt = GetFrmFmt();
2513 [ + - ]: 40 : if(pFmt)
2514 : : {
2515 : 40 : const SwFmtCntnt& rFlyCntnt = pFmt->GetCntnt();
2516 [ + - ]: 40 : if( rFlyCntnt.GetCntntIdx() )
2517 : 40 : pSttNd = rFlyCntnt.GetCntntIdx()->GetNode().GetStartNode();
2518 : : }
2519 : :
2520 : 40 : return pSttNd;
2521 : : }
2522 : :
2523 : : uno::Reference< text::XTextCursor >
2524 : 54 : SwXTextFrame::CreateCursor() throw (uno::RuntimeException)
2525 : : {
2526 : 54 : return createTextCursor();
2527 : : }
2528 : :
2529 : 112 : uno::Reference< text::XTextCursor > SwXTextFrame::createTextCursor(void) throw( uno::RuntimeException )
2530 : : {
2531 [ + - ]: 112 : SolarMutexGuard aGuard;
2532 : 112 : uno::Reference< text::XTextCursor > aRef;
2533 [ + - ]: 112 : SwFrmFmt* pFmt = GetFrmFmt();
2534 [ + - ]: 112 : if(pFmt)
2535 : : {
2536 : : //save current start node to be able to check if there is content after the table -
2537 : : //otherwise the cursor would be in the body text!
2538 [ + - ]: 112 : const SwNode& rNode = pFmt->GetCntnt().GetCntntIdx()->GetNode();
2539 [ + - ]: 112 : const SwStartNode* pOwnStartNode = rNode.FindSttNodeByType(SwFlyStartNode);
2540 : :
2541 [ + - ]: 112 : SwPaM aPam(rNode);
2542 [ + - ]: 112 : aPam.Move(fnMoveForward, fnGoNode);
2543 [ + - ]: 112 : SwTableNode* pTblNode = aPam.GetNode()->FindTableNode();
2544 : 112 : SwCntntNode* pCont = 0;
2545 [ - + ]: 112 : while( pTblNode )
2546 : : {
2547 [ # # ]: 0 : aPam.GetPoint()->nNode = *pTblNode->EndOfSectionNode();
2548 [ # # ][ # # ]: 0 : pCont = GetDoc()->GetNodes().GoNext(&aPam.GetPoint()->nNode);
[ # # ]
2549 [ # # ]: 0 : pTblNode = pCont->FindTableNode();
2550 : : }
2551 [ - + ]: 112 : if(pCont)
2552 [ # # ][ # # ]: 0 : aPam.GetPoint()->nContent.Assign(pCont, 0);
2553 : :
2554 : : const SwStartNode* pNewStartNode =
2555 [ + - ]: 112 : aPam.GetNode()->FindSttNodeByType(SwFlyStartNode);
2556 [ + - ][ - + ]: 112 : if(!pNewStartNode || pNewStartNode != pOwnStartNode)
2557 : : {
2558 [ # # ]: 0 : uno::RuntimeException aExcept;
2559 [ # # ]: 0 : aExcept.Message = S2U("no text available");
2560 [ # # ]: 0 : throw aExcept;
2561 : : }
2562 : :
2563 : : SwXTextCursor *const pXCursor = new SwXTextCursor(
2564 [ + - ][ + - ]: 112 : *pFmt->GetDoc(), this, CURSOR_FRAME, *aPam.GetPoint());
2565 [ + - ][ + - ]: 112 : aRef = static_cast<text::XWordCursor*>(pXCursor);
[ + - ]
2566 : : #if OSL_DEBUG_LEVEL > 1
2567 : : SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
2568 : : (void) pUnoCrsr;
2569 : : #endif
2570 : : }
2571 : : else
2572 [ # # ]: 112 : throw uno::RuntimeException();
2573 [ + - ]: 224 : return aRef;
2574 : : }
2575 : :
2576 : 6 : uno::Reference< text::XTextCursor > SwXTextFrame::createTextCursorByRange(const uno::Reference< text::XTextRange > & aTextPosition) throw( uno::RuntimeException )
2577 : : {
2578 [ + - ]: 6 : SolarMutexGuard aGuard;
2579 : 6 : uno::Reference< text::XTextCursor > aRef;
2580 [ + - ]: 6 : SwFrmFmt* pFmt = GetFrmFmt();
2581 [ + - ][ + - ]: 6 : SwUnoInternalPaM aPam(*GetDoc());
2582 [ + - ][ + - ]: 6 : if (pFmt && ::sw::XTextRangeToSwPaM(aPam, aTextPosition))
[ + - ][ + - ]
2583 : : {
2584 [ + - ]: 6 : SwNode& rNode = pFmt->GetCntnt().GetCntntIdx()->GetNode();
2585 : : #if OSL_DEBUG_LEVEL > 1
2586 : : const SwStartNode* p1 = aPam.GetNode()->FindFlyStartNode();
2587 : : const SwStartNode* p2 = rNode.FindFlyStartNode();
2588 : : (void)p1;
2589 : : (void)p2;
2590 : : #endif
2591 [ + - ][ + - ]: 6 : if(aPam.GetNode()->FindFlyStartNode() == rNode.FindFlyStartNode())
[ + - ]
2592 : : {
2593 : : aRef = static_cast<text::XWordCursor*>(
2594 : 6 : new SwXTextCursor(*pFmt->GetDoc(), this, CURSOR_FRAME,
2595 [ + - ][ + - ]: 6 : *aPam.GetPoint(), aPam.GetMark()));
[ + - ][ + - ]
2596 : : }
2597 : : }
2598 : : else
2599 [ # # ]: 0 : throw uno::RuntimeException();
2600 [ + - ][ + - ]: 6 : return aRef;
2601 : : }
2602 : :
2603 : 2 : uno::Reference< container::XEnumeration > SwXTextFrame::createEnumeration(void) throw( uno::RuntimeException )
2604 : : {
2605 [ + - ]: 2 : SolarMutexGuard aGuard;
2606 : 2 : uno::Reference< container::XEnumeration > aRef;
2607 [ + - ]: 2 : SwFrmFmt* pFmt = GetFrmFmt();
2608 [ + - ]: 2 : if(pFmt)
2609 : : {
2610 [ + - ][ + - ]: 2 : SwPosition aPos(pFmt->GetCntnt().GetCntntIdx()->GetNode());
2611 : : ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
2612 [ + - ][ + - ]: 2 : GetDoc()->CreateUnoCrsr(aPos, false));
2613 [ + - ]: 2 : pUnoCursor->Move(fnMoveForward, fnGoNode);
2614 : : // // no Cursor in protected sections
2615 : : // SwCrsrSaveState aSave( *pUnoCrsr );
2616 : : // if(pUnoCrsr->IsInProtectTable(true) ||
2617 : : // pUnoCrsr->IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS ))
2618 : : // throw uno::RuntimeException() );
2619 [ + - ][ + - ]: 2 : aRef = new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_FRAME);
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
2620 : : }
2621 [ + - ]: 2 : return aRef;
2622 : : }
2623 : :
2624 : 2 : uno::Type SwXTextFrame::getElementType(void) throw( uno::RuntimeException )
2625 : : {
2626 : 2 : return ::getCppuType(static_cast<uno::Reference<text::XTextRange>*>(0));
2627 : : }
2628 : :
2629 : 2 : sal_Bool SwXTextFrame::hasElements(void) throw( uno::RuntimeException )
2630 : : {
2631 : 2 : return sal_True;
2632 : : }
2633 : :
2634 : 129 : void SwXTextFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
2635 : : throw( lang::IllegalArgumentException, uno::RuntimeException )
2636 : : {
2637 : 129 : SwXFrame::attach(xTextRange);
2638 : 129 : }
2639 : :
2640 : 8 : uno::Reference< text::XTextRange > SwXTextFrame::getAnchor(void) throw( uno::RuntimeException )
2641 : : {
2642 [ + - ]: 8 : SolarMutexGuard aGuard;
2643 [ + - ][ + - ]: 8 : return SwXFrame::getAnchor();
2644 : : }
2645 : :
2646 : 4 : void SwXTextFrame::dispose(void) throw( uno::RuntimeException )
2647 : : {
2648 [ + - ]: 4 : SolarMutexGuard aGuard;
2649 [ + - ][ + - ]: 4 : SwXFrame::dispose();
2650 : 4 : }
2651 : :
2652 : 4 : void SwXTextFrame::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
2653 : : {
2654 : 4 : SwXFrame::addEventListener(aListener);
2655 : 4 : }
2656 : :
2657 : 2 : void SwXTextFrame::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
2658 : : {
2659 : 2 : SwXFrame::removeEventListener(aListener);
2660 : 2 : }
2661 : :
2662 : 0 : OUString SwXTextFrame::getImplementationName(void) throw( uno::RuntimeException )
2663 : : {
2664 : 0 : return C2U("SwXTextFrame");
2665 : : }
2666 : :
2667 : 62 : sal_Bool SwXTextFrame::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
2668 : : {
2669 : 62 : return COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.Text")||
2670 : 60 : COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextFrame")||
2671 [ + + ]: 122 : SwXFrame::supportsService(rServiceName);
[ + + + + ]
2672 : : }
2673 : :
2674 : 2 : uno::Sequence< OUString > SwXTextFrame::getSupportedServiceNames(void) throw( uno::RuntimeException )
2675 : : {
2676 : 2 : uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
2677 [ + - ]: 2 : aRet.realloc(aRet.getLength() + 2);
2678 [ + - ]: 2 : OUString* pArray = aRet.getArray();
2679 [ + - ]: 2 : pArray[aRet.getLength() - 2] = C2U("com.sun.star.text.TextFrame");
2680 [ + - ]: 2 : pArray[aRet.getLength() - 1] = C2U("com.sun.star.text.Text");
2681 : 2 : return aRet;
2682 : : }
2683 : :
2684 : 169 : void * SAL_CALL SwXTextFrame::operator new( size_t t) throw()
2685 : : {
2686 : 169 : return SwXTextFrameBaseClass::operator new( t);
2687 : : }
2688 : :
2689 : 169 : void SAL_CALL SwXTextFrame::operator delete( void * p) throw()
2690 : : {
2691 : 169 : SwXTextFrameBaseClass::operator delete(p);
2692 : 169 : }
2693 : :
2694 : 0 : uno::Reference<container::XNameReplace > SAL_CALL SwXTextFrame::getEvents()
2695 : : throw(uno::RuntimeException)
2696 : : {
2697 [ # # ][ # # ]: 0 : return new SwFrameEventDescriptor( *this );
2698 : : }
2699 : :
2700 : 304 : sal_Int64 SAL_CALL SwXTextFrame::getSomething( const uno::Sequence< sal_Int8 >& rId )
2701 : : throw(uno::RuntimeException)
2702 : : {
2703 : 304 : sal_Int64 nRet = SwXFrame::getSomething( rId );
2704 [ + - ]: 304 : if( !nRet )
2705 : 304 : nRet = SwXText::getSomething( rId );
2706 : :
2707 : 304 : return nRet;
2708 : : }
2709 : :
2710 : 212 : ::uno::Any SwXTextFrame::getPropertyValue(const OUString& rPropertyName)
2711 : : throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
2712 : : {
2713 [ + - ]: 212 : SolarMutexGuard aGuard;
2714 : 212 : ::uno::Any aRet;
2715 [ + - ]: 422 : if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_START_REDLINE))||
[ + + + + ]
[ + + ][ + - ]
2716 [ + - ][ + - ]: 210 : rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_END_REDLINE)))
2717 : : {
2718 : : //redline can only be returned if it's a living object
2719 [ + - ]: 4 : if(!IsDescriptor())
2720 [ + - ]: 4 : aRet = SwXText::getPropertyValue(rPropertyName);
2721 : : }
2722 : : else
2723 [ + - ]: 208 : aRet = SwXFrame::getPropertyValue(rPropertyName);
2724 [ + - ]: 212 : return aRet;
2725 : : }
2726 : :
2727 : : /******************************************************************
2728 : : * SwXTextGraphicObject
2729 : : ******************************************************************/
2730 : 41 : SwXTextGraphicObject::SwXTextGraphicObject( SwDoc *pDoc ) :
2731 [ + - ][ + - ]: 41 : SwXFrame(FLYCNTTYPE_GRF, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC), pDoc)
2732 : : {
2733 : 41 : }
2734 : :
2735 : 25 : SwXTextGraphicObject::SwXTextGraphicObject(SwFrmFmt& rFmt) :
2736 [ + - ][ + - ]: 25 : SwXFrame(rFmt, FLYCNTTYPE_GRF, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC))
2737 : : {
2738 : :
2739 : 25 : }
2740 : :
2741 [ + - ]: 66 : SwXTextGraphicObject::~SwXTextGraphicObject()
2742 : : {
2743 : :
2744 [ - + ]: 132 : }
2745 : :
2746 : 804 : void SAL_CALL SwXTextGraphicObject::acquire( )throw()
2747 : : {
2748 : 804 : SwXFrame::acquire();
2749 : 804 : }
2750 : :
2751 : 804 : void SAL_CALL SwXTextGraphicObject::release( )throw()
2752 : : {
2753 : 804 : SwXFrame::release();
2754 : 804 : }
2755 : :
2756 : 311 : ::uno::Any SAL_CALL SwXTextGraphicObject::queryInterface( const uno::Type& aType )
2757 : : throw(uno::RuntimeException)
2758 : : {
2759 : 311 : ::uno::Any aRet = SwXFrame::queryInterface(aType);
2760 [ + + ][ + - ]: 311 : if(aRet.getValueType() == ::getCppuVoidType())
2761 [ + - ]: 45 : aRet = SwXTextGraphicObjectBaseClass::queryInterface(aType);
2762 : 311 : return aRet;
2763 : : }
2764 : :
2765 : : uno::Sequence< uno::Type > SAL_CALL
2766 : 0 : SwXTextGraphicObject::getTypes( ) throw(uno::RuntimeException)
2767 : : {
2768 [ # # ]: 0 : uno::Sequence< uno::Type > aGraphicTypes = SwXTextGraphicObjectBaseClass::getTypes();
2769 [ # # ]: 0 : uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
2770 : :
2771 : 0 : long nIndex = aGraphicTypes.getLength();
2772 : : aGraphicTypes.realloc(
2773 : 0 : aGraphicTypes.getLength() +
2774 [ # # ]: 0 : aFrameTypes.getLength());
2775 : :
2776 [ # # ]: 0 : uno::Type* pGraphicTypes = aGraphicTypes.getArray();
2777 : 0 : const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
2778 : : long nPos;
2779 [ # # ]: 0 : for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
2780 : 0 : pGraphicTypes[nIndex++] = pFrameTypes[nPos];
2781 : :
2782 [ # # ]: 0 : return aGraphicTypes;
2783 : : }
2784 : :
2785 : : namespace
2786 : : {
2787 : : class theSwXTextGraphicObjectImplementationId : public rtl::Static< UnoTunnelIdInit, theSwXTextGraphicObjectImplementationId > {};
2788 : : }
2789 : :
2790 : 0 : uno::Sequence< sal_Int8 > SAL_CALL SwXTextGraphicObject::getImplementationId( ) throw(uno::RuntimeException)
2791 : : {
2792 : 0 : return theSwXTextGraphicObjectImplementationId::get().getSeq();
2793 : : }
2794 : :
2795 : 41 : void SwXTextGraphicObject::attach(const uno::Reference< text::XTextRange > & xTextRange) throw( lang::IllegalArgumentException, uno::RuntimeException )
2796 : : {
2797 : 41 : SwXFrame::attach(xTextRange);
2798 : 41 : }
2799 : :
2800 : 2 : uno::Reference< text::XTextRange > SwXTextGraphicObject::getAnchor(void) throw( uno::RuntimeException )
2801 : : {
2802 [ + - ]: 2 : SolarMutexGuard aGuard;
2803 [ + - ][ + - ]: 2 : return SwXFrame::getAnchor();
2804 : : }
2805 : :
2806 : 2 : void SwXTextGraphicObject::dispose(void) throw( uno::RuntimeException )
2807 : : {
2808 [ + - ]: 2 : SolarMutexGuard aGuard;
2809 [ + - ][ + - ]: 2 : SwXFrame::dispose();
2810 : 2 : }
2811 : :
2812 : 4 : void SwXTextGraphicObject::addEventListener(const uno::Reference< lang::XEventListener > & aListener)
2813 : : throw( uno::RuntimeException )
2814 : : {
2815 : 4 : SwXFrame::addEventListener(aListener);
2816 : 4 : }
2817 : :
2818 : 2 : void SwXTextGraphicObject::removeEventListener(const uno::Reference< lang::XEventListener > & aListener)
2819 : : throw( uno::RuntimeException )
2820 : : {
2821 : 2 : SwXFrame::removeEventListener(aListener);
2822 : 2 : }
2823 : :
2824 : 0 : OUString SwXTextGraphicObject::getImplementationName(void) throw( uno::RuntimeException )
2825 : : {
2826 : 0 : return C2U("SwXTextGraphicObject");
2827 : : }
2828 : :
2829 : 6 : sal_Bool SwXTextGraphicObject::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
2830 : : {
2831 : 6 : return COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextGraphicObject") ||
2832 [ + - ][ + + ]: 6 : SwXFrame::supportsService(rServiceName);
2833 : : }
2834 : :
2835 : 2 : uno::Sequence< OUString > SwXTextGraphicObject::getSupportedServiceNames(void)
2836 : : throw( uno::RuntimeException )
2837 : : {
2838 : 2 : uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
2839 [ + - ]: 2 : aRet.realloc(aRet.getLength() + 1);
2840 [ + - ]: 2 : OUString* pArray = aRet.getArray();
2841 [ + - ]: 2 : pArray[aRet.getLength() - 1] = C2U("com.sun.star.text.TextGraphicObject");
2842 : 2 : return aRet;
2843 : : }
2844 : :
2845 : 66 : void * SAL_CALL SwXTextGraphicObject::operator new( size_t t) throw()
2846 : : {
2847 : 66 : return SwXTextGraphicObjectBaseClass::operator new(t);
2848 : : }
2849 : :
2850 : 66 : void SAL_CALL SwXTextGraphicObject::operator delete( void * p) throw()
2851 : : {
2852 : 66 : SwXTextGraphicObjectBaseClass::operator delete(p);
2853 : 66 : }
2854 : :
2855 : : uno::Reference<container::XNameReplace> SAL_CALL
2856 : 0 : SwXTextGraphicObject::getEvents()
2857 : : throw(uno::RuntimeException)
2858 : : {
2859 [ # # ][ # # ]: 0 : return new SwFrameEventDescriptor( *this );
2860 : : }
2861 : :
2862 : 432 : SwXTextEmbeddedObject::SwXTextEmbeddedObject( SwDoc *pDoc ) :
2863 [ + - ][ + - ]: 432 : SwXFrame(FLYCNTTYPE_OLE, aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT), pDoc)
2864 : : {
2865 : 432 : }
2866 : :
2867 : 339 : SwXTextEmbeddedObject::SwXTextEmbeddedObject(SwFrmFmt& rFmt) :
2868 [ + - ][ + - ]: 339 : SwXFrame(rFmt, FLYCNTTYPE_OLE, aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT))
2869 : : {
2870 : :
2871 : 339 : }
2872 : :
2873 [ + - ]: 771 : SwXTextEmbeddedObject::~SwXTextEmbeddedObject()
2874 : : {
2875 : :
2876 [ - + ]: 1542 : }
2877 : 5417 : void SAL_CALL SwXTextEmbeddedObject::acquire()throw()
2878 : : {
2879 : 5417 : SwXFrame::acquire();
2880 : 5417 : }
2881 : :
2882 : 5417 : void SAL_CALL SwXTextEmbeddedObject::release()throw()
2883 : : {
2884 : 5417 : SwXFrame::release();
2885 : 5417 : }
2886 : :
2887 : 2475 : ::uno::Any SAL_CALL SwXTextEmbeddedObject::queryInterface( const uno::Type& aType )
2888 : : throw( uno::RuntimeException)
2889 : : {
2890 : 2475 : ::uno::Any aRet = SwXFrame::queryInterface(aType);;
2891 [ + + ][ + - ]: 2475 : if(aRet.getValueType() == ::getCppuVoidType())
2892 [ + - ]: 643 : aRet = SwXTextEmbeddedObjectBaseClass::queryInterface(aType);
2893 : 2475 : return aRet;
2894 : : }
2895 : :
2896 : 0 : uno::Sequence< uno::Type > SAL_CALL SwXTextEmbeddedObject::getTypes( ) throw(uno::RuntimeException)
2897 : : {
2898 [ # # ]: 0 : uno::Sequence< uno::Type > aTextEmbeddedTypes = SwXTextEmbeddedObjectBaseClass::getTypes();
2899 [ # # ]: 0 : uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
2900 : :
2901 : 0 : long nIndex = aTextEmbeddedTypes.getLength();
2902 : : aTextEmbeddedTypes.realloc(
2903 : 0 : aTextEmbeddedTypes.getLength() +
2904 [ # # ]: 0 : aFrameTypes.getLength());
2905 : :
2906 [ # # ]: 0 : uno::Type* pTextEmbeddedTypes = aTextEmbeddedTypes.getArray();
2907 : :
2908 : 0 : const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
2909 : : long nPos;
2910 [ # # ]: 0 : for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
2911 : 0 : pTextEmbeddedTypes[nIndex++] = pFrameTypes[nPos];
2912 : :
2913 [ # # ]: 0 : return aTextEmbeddedTypes;
2914 : : }
2915 : :
2916 : : namespace
2917 : : {
2918 : : class theSwXTextEmbeddedObjectImplementationId : public rtl::Static< UnoTunnelIdInit, theSwXTextEmbeddedObjectImplementationId > {};
2919 : : }
2920 : :
2921 : 0 : uno::Sequence< sal_Int8 > SAL_CALL SwXTextEmbeddedObject::getImplementationId( ) throw(uno::RuntimeException)
2922 : : {
2923 : 0 : return theSwXTextEmbeddedObjectImplementationId::get().getSeq();
2924 : : }
2925 : :
2926 : 434 : void SwXTextEmbeddedObject::attach(const uno::Reference< text::XTextRange > & xTextRange) throw( lang::IllegalArgumentException, uno::RuntimeException )
2927 : : {
2928 : 434 : SwXFrame::attach(xTextRange);
2929 : 432 : }
2930 : :
2931 : 2 : uno::Reference< text::XTextRange > SwXTextEmbeddedObject::getAnchor(void) throw( uno::RuntimeException )
2932 : : {
2933 [ + - ]: 2 : SolarMutexGuard aGuard;
2934 [ + - ][ + - ]: 2 : return SwXFrame::getAnchor();
2935 : : }
2936 : :
2937 : 2 : void SwXTextEmbeddedObject::dispose(void) throw( uno::RuntimeException )
2938 : : {
2939 [ + - ]: 2 : SolarMutexGuard aGuard;
2940 [ + - ][ + - ]: 2 : SwXFrame::dispose();
2941 : 2 : }
2942 : :
2943 : 4 : void SwXTextEmbeddedObject::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
2944 : : {
2945 : 4 : SwXFrame::addEventListener(aListener);
2946 : 4 : }
2947 : :
2948 : 2 : void SwXTextEmbeddedObject::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
2949 : : {
2950 : 2 : SwXFrame::removeEventListener(aListener);
2951 : 2 : }
2952 : :
2953 : 0 : uno::Reference< lang::XComponent > SwXTextEmbeddedObject::getEmbeddedObject(void) throw( uno::RuntimeException )
2954 : : {
2955 : 0 : uno::Reference< lang::XComponent > xRet;
2956 [ # # ]: 0 : SwFrmFmt* pFmt = GetFrmFmt();
2957 [ # # ]: 0 : if(pFmt)
2958 : : {
2959 : 0 : SwDoc* pDoc = pFmt->GetDoc();
2960 [ # # ]: 0 : const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
2961 : : OSL_ENSURE( pCnt->GetCntntIdx() &&
2962 : : pDoc->GetNodes()[ pCnt->GetCntntIdx()->
2963 : : GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
2964 : :
2965 [ # # ]: 0 : SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetCntntIdx()
2966 [ # # ]: 0 : ->GetIndex() + 1 ]->GetOLENode();
2967 [ # # ]: 0 : uno::Reference < embed::XEmbeddedObject > xIP = pOleNode->GetOLEObj().GetOleRef();
2968 [ # # ][ # # ]: 0 : if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
2969 : : {
2970 : : // TODO/LATER: the listener registered after client creation should be able to handle scaling, after that the client is not necessary here
2971 [ # # ]: 0 : if ( pDoc->GetDocShell() )
2972 [ # # ][ # # ]: 0 : pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xIP, embed::Aspects::MSOLE_CONTENT ) );
[ # # ]
2973 : :
2974 [ # # ][ # # ]: 0 : xRet = uno::Reference < lang::XComponent >( xIP->getComponent(), uno::UNO_QUERY );
[ # # ][ # # ]
2975 [ # # ]: 0 : uno::Reference< util::XModifyBroadcaster > xBrdcst( xRet, uno::UNO_QUERY);
2976 [ # # ]: 0 : uno::Reference< frame::XModel > xModel( xRet, uno::UNO_QUERY);
2977 [ # # ][ # # ]: 0 : if( xBrdcst.is() && xModel.is() )
[ # # ]
2978 : : {
2979 [ # # ]: 0 : SwXOLEListener* pListener = SwIterator<SwXOLEListener,SwFmt>::FirstElement( *pFmt );
2980 : : //create a new one if the OLE object doesn't have one already
2981 [ # # ]: 0 : if( !pListener )
2982 : : {
2983 [ # # ][ # # ]: 0 : uno::Reference< util::XModifyListener > xOLEListener = new SwXOLEListener(*pFmt, xModel);
[ # # ]
2984 [ # # ][ # # ]: 0 : xBrdcst->addModifyListener( xOLEListener );
2985 : : }
2986 : 0 : }
2987 : 0 : }
2988 : : }
2989 : 0 : return xRet;
2990 : : }
2991 : :
2992 : 0 : uno::Reference< embed::XEmbeddedObject > SAL_CALL SwXTextEmbeddedObject::getExtendedControlOverEmbeddedObject()
2993 : : throw( uno::RuntimeException )
2994 : : {
2995 : 0 : uno::Reference< embed::XEmbeddedObject > xResult;
2996 [ # # ]: 0 : SwFrmFmt* pFmt = GetFrmFmt();
2997 [ # # ]: 0 : if(pFmt)
2998 : : {
2999 : 0 : SwDoc* pDoc = pFmt->GetDoc();
3000 [ # # ]: 0 : const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
3001 : : OSL_ENSURE( pCnt->GetCntntIdx() &&
3002 : : pDoc->GetNodes()[ pCnt->GetCntntIdx()->
3003 : : GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3004 : :
3005 [ # # ]: 0 : SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetCntntIdx()
3006 [ # # ]: 0 : ->GetIndex() + 1 ]->GetOLENode();
3007 [ # # ][ # # ]: 0 : xResult = pOleNode->GetOLEObj().GetOleRef();
3008 [ # # ][ # # ]: 0 : if ( svt::EmbeddedObjectRef::TryRunningState( xResult ) )
3009 : : {
3010 : : // TODO/LATER: the listener registered after client creation should be able to handle scaling, after that the client is not necessary here
3011 [ # # ]: 0 : if ( pDoc->GetDocShell() )
3012 [ # # ][ # # ]: 0 : pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xResult, embed::Aspects::MSOLE_CONTENT ) );
[ # # ]
3013 : :
3014 [ # # ][ # # ]: 0 : uno::Reference < lang::XComponent > xComp( xResult->getComponent(), uno::UNO_QUERY );
[ # # ]
3015 [ # # ]: 0 : uno::Reference< util::XModifyBroadcaster > xBrdcst( xComp, uno::UNO_QUERY);
3016 [ # # ]: 0 : uno::Reference< frame::XModel > xModel( xComp, uno::UNO_QUERY);
3017 [ # # ][ # # ]: 0 : if( xBrdcst.is() && xModel.is() )
[ # # ]
3018 : : {
3019 [ # # ]: 0 : SwXOLEListener* pListener = SwIterator<SwXOLEListener,SwFmt>::FirstElement( *pFmt );
3020 : : //create a new one if the OLE object doesn't have one already
3021 [ # # ]: 0 : if( !pListener )
3022 : : {
3023 [ # # ][ # # ]: 0 : uno::Reference< util::XModifyListener > xOLEListener = new SwXOLEListener(*pFmt, xModel);
[ # # ]
3024 [ # # ][ # # ]: 0 : xBrdcst->addModifyListener( xOLEListener );
3025 : : }
3026 : 0 : }
3027 : : }
3028 : : }
3029 : 0 : return xResult;
3030 : : }
3031 : :
3032 : 0 : sal_Int64 SAL_CALL SwXTextEmbeddedObject::getAspect() throw (uno::RuntimeException)
3033 : : {
3034 : 0 : SwFrmFmt* pFmt = GetFrmFmt();
3035 [ # # ]: 0 : if(pFmt)
3036 : : {
3037 : 0 : SwDoc* pDoc = pFmt->GetDoc();
3038 : 0 : const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
3039 : : OSL_ENSURE( pCnt->GetCntntIdx() &&
3040 : : pDoc->GetNodes()[ pCnt->GetCntntIdx()->
3041 : : GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3042 : :
3043 : 0 : return pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->GetAspect();
3044 : : }
3045 : :
3046 : 0 : return embed::Aspects::MSOLE_CONTENT; // return the default value
3047 : : }
3048 : :
3049 : 0 : void SAL_CALL SwXTextEmbeddedObject::setAspect( sal_Int64 nAspect ) throw (uno::RuntimeException)
3050 : : {
3051 : 0 : SwFrmFmt* pFmt = GetFrmFmt();
3052 [ # # ]: 0 : if(pFmt)
3053 : : {
3054 : 0 : SwDoc* pDoc = pFmt->GetDoc();
3055 : 0 : const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
3056 : : OSL_ENSURE( pCnt->GetCntntIdx() &&
3057 : : pDoc->GetNodes()[ pCnt->GetCntntIdx()->
3058 : : GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3059 : :
3060 : 0 : pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->SetAspect( nAspect );
3061 : : }
3062 : 0 : }
3063 : :
3064 : 0 : uno::Reference< graphic::XGraphic > SAL_CALL SwXTextEmbeddedObject::getReplacementGraphic() throw (uno::RuntimeException)
3065 : : {
3066 : 0 : SwFrmFmt* pFmt = GetFrmFmt();
3067 [ # # ]: 0 : if(pFmt)
3068 : : {
3069 : 0 : SwDoc* pDoc = pFmt->GetDoc();
3070 : 0 : const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
3071 : : OSL_ENSURE( pCnt->GetCntntIdx() &&
3072 : : pDoc->GetNodes()[ pCnt->GetCntntIdx()->
3073 : : GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3074 : :
3075 : 0 : Graphic* pGraphic = pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->GetGraphic();
3076 [ # # ]: 0 : if ( pGraphic )
3077 : 0 : return pGraphic->GetXGraphic();
3078 : : }
3079 : :
3080 : 0 : return uno::Reference< graphic::XGraphic >();
3081 : : }
3082 : :
3083 : :
3084 : 0 : OUString SwXTextEmbeddedObject::getImplementationName(void) throw( uno::RuntimeException )
3085 : :
3086 : : {
3087 : 0 : return C2U("SwXTextEmbeddedObject");
3088 : : }
3089 : :
3090 : 6 : sal_Bool SwXTextEmbeddedObject::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
3091 : : {
3092 : 6 : return COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextEmbeddedObject")||
3093 [ + - ][ + + ]: 6 : SwXFrame::supportsService(rServiceName);
3094 : : }
3095 : :
3096 : 2 : uno::Sequence< OUString > SwXTextEmbeddedObject::getSupportedServiceNames(void)
3097 : : throw( uno::RuntimeException )
3098 : : {
3099 : 2 : uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
3100 [ + - ]: 2 : aRet.realloc(aRet.getLength() + 1);
3101 [ + - ]: 2 : OUString* pArray = aRet.getArray();
3102 [ + - ]: 2 : pArray[aRet.getLength() - 1] = C2U("com.sun.star.text.TextEmbeddedObject");
3103 : 2 : return aRet;
3104 : : }
3105 : :
3106 : 771 : void * SAL_CALL SwXTextEmbeddedObject::operator new( size_t t) throw()
3107 : : {
3108 : 771 : return SwXTextEmbeddedObjectBaseClass::operator new(t);
3109 : : }
3110 : :
3111 : 771 : void SAL_CALL SwXTextEmbeddedObject::operator delete( void * p) throw()
3112 : : {
3113 : 771 : SwXTextEmbeddedObjectBaseClass::operator delete(p);
3114 : 771 : }
3115 : :
3116 : : uno::Reference<container::XNameReplace> SAL_CALL
3117 : 0 : SwXTextEmbeddedObject::getEvents()
3118 : : throw(uno::RuntimeException)
3119 : : {
3120 [ # # ][ # # ]: 0 : return new SwFrameEventDescriptor( *this );
3121 : : }
3122 : :
3123 [ # # ][ # # ]: 0 : TYPEINIT1(SwXOLEListener, SwClient);
3124 : :
3125 : 0 : SwXOLEListener::SwXOLEListener( SwFmt& rOLEFmt, uno::Reference< XModel > xOLE) :
3126 : : SwClient(&rOLEFmt),
3127 [ # # ]: 0 : xOLEModel(xOLE)
3128 : : {
3129 : 0 : }
3130 : :
3131 [ # # ]: 0 : SwXOLEListener::~SwXOLEListener()
3132 [ # # ]: 0 : {}
3133 : :
3134 : 0 : void SwXOLEListener::modified( const lang::EventObject& /*rEvent*/ )
3135 : : throw( uno::RuntimeException )
3136 : : {
3137 [ # # ]: 0 : SolarMutexGuard aGuard;
3138 : :
3139 : 0 : SwOLENode* pNd = 0;
3140 : 0 : SwFmt* pFmt = GetFmt();
3141 [ # # ]: 0 : if(pFmt)
3142 [ # # ]: 0 : {const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
3143 [ # # ]: 0 : if(pIdx)
3144 : : {
3145 [ # # ]: 0 : SwNodeIndex aIdx(*pIdx, 1);
3146 : 0 : SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
3147 [ # # ]: 0 : pNd = pNoTxt->GetOLENode();
3148 : : }
3149 : : }
3150 [ # # ]: 0 : if(!pNd)
3151 [ # # ]: 0 : throw uno::RuntimeException();
3152 : :
3153 [ # # ]: 0 : uno::Reference < embed::XEmbeddedObject > xIP = pNd->GetOLEObj().GetOleRef();
3154 [ # # ]: 0 : if ( xIP.is() )
3155 : : {
3156 [ # # ][ # # ]: 0 : sal_Int32 nState = xIP->getCurrentState();
3157 [ # # ][ # # ]: 0 : if ( nState == embed::EmbedStates::INPLACE_ACTIVE || nState == embed::EmbedStates::UI_ACTIVE )
3158 : 0 : return;
3159 : : }
3160 : :
3161 : : // if the OLE-Node is UI-Active do nothing
3162 : 0 : pNd->SetOLESizeInvalid(true);
3163 [ # # ][ # # ]: 0 : pNd->GetDoc()->SetOLEObjModified();
[ # # ][ # # ]
3164 : : }
3165 : :
3166 : 0 : void SwXOLEListener::disposing( const lang::EventObject& rEvent )
3167 : : throw( uno::RuntimeException )
3168 : : {
3169 [ # # ]: 0 : SolarMutexGuard aGuard;
3170 : :
3171 [ # # ]: 0 : uno::Reference< util::XModifyListener > xListener( this );
3172 : :
3173 : :
3174 [ # # ]: 0 : uno::Reference< frame::XModel > xModel( rEvent.Source, uno::UNO_QUERY );
3175 [ # # ]: 0 : uno::Reference< util::XModifyBroadcaster > xBrdcst(xModel, uno::UNO_QUERY);
3176 : :
3177 : : try
3178 : : {
3179 [ # # ]: 0 : if( xBrdcst.is() )
3180 [ # # ][ # # ]: 0 : xBrdcst->removeModifyListener( xListener );
3181 : : }
3182 [ # # ]: 0 : catch(uno::Exception const &)
3183 : : {
3184 : : OSL_FAIL("OLE Listener couldn't be removed");
3185 [ # # ]: 0 : }
3186 [ # # ]: 0 : }
3187 : :
3188 : 0 : void SwXOLEListener::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
3189 : : {
3190 : 0 : ClientModify(this, pOld, pNew);
3191 [ # # ]: 0 : if(!GetRegisteredIn())
3192 : 0 : xOLEModel = 0;
3193 : 0 : }
3194 : :
3195 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|