xref: /trunk/main/sw/source/core/unocore/unoframe.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5efeef26fSAndrew Rist  * distributed with this work for additional information
6efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17efeef26fSAndrew Rist  * specific language governing permissions and limitations
18efeef26fSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20efeef26fSAndrew Rist  *************************************************************/
21efeef26fSAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_sw.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
26cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp>
27cdf0e10cSrcweir #include <com/sun/star/embed/XClassifiedObject.hpp>
28cdf0e10cSrcweir #include <com/sun/star/embed/XVisualObject.hpp>
29cdf0e10cSrcweir #include <com/sun/star/embed/XComponentSupplier.hpp>
30cdf0e10cSrcweir #include <com/sun/star/embed/EmbedStates.hpp>
31cdf0e10cSrcweir #include <com/sun/star/embed/Aspects.hpp>
32cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphicProvider.hpp>
333f09c2ceSJürgen Schmidt #include <com/sun/star/drawing/BitmapMode.hpp>
34cdf0e10cSrcweir #include <svx/svxids.hrc>
353f09c2ceSJürgen Schmidt #include <svx/xflclit.hxx>
363f09c2ceSJürgen Schmidt #include <svx/xflhtit.hxx>
373f09c2ceSJürgen Schmidt #include <svx/xfltrit.hxx>
38cdf0e10cSrcweir #include <editeng/memberids.hrc>
39cdf0e10cSrcweir #include <swtypes.hxx>
40cdf0e10cSrcweir #include <cmdid.h>
41cdf0e10cSrcweir #include <memory>
42cdf0e10cSrcweir #include <hints.hxx>
43cdf0e10cSrcweir #include <doc.hxx>
44cdf0e10cSrcweir #include <IDocumentUndoRedo.hxx>
45cdf0e10cSrcweir #include <docsh.hxx>
46cdf0e10cSrcweir #include <editsh.hxx>
47cdf0e10cSrcweir #include <swcli.hxx>
48cdf0e10cSrcweir #include <ndindex.hxx>
49cdf0e10cSrcweir #include <pam.hxx>
50cdf0e10cSrcweir #include <ndnotxt.hxx>
51cdf0e10cSrcweir #include <svx/unomid.hxx>
52cdf0e10cSrcweir #include <unocrsr.hxx>
53cdf0e10cSrcweir #include <unocrsrhelper.hxx>
54cdf0e10cSrcweir #include <docstyle.hxx>
55cdf0e10cSrcweir #include <dcontact.hxx>
56cdf0e10cSrcweir #include <fmtcnct.hxx>
57cdf0e10cSrcweir #include <ndole.hxx>
58cdf0e10cSrcweir #include <frmfmt.hxx>
59cdf0e10cSrcweir #include <frame.hxx>
60cdf0e10cSrcweir #include <unotextrange.hxx>
61cdf0e10cSrcweir #include <unotextcursor.hxx>
62cdf0e10cSrcweir #include <unoparagraph.hxx>
63cdf0e10cSrcweir #include <unomap.hxx>
64cdf0e10cSrcweir #include <unoprnms.hxx>
65cdf0e10cSrcweir #include <unoevent.hxx>
66cdf0e10cSrcweir #include <com/sun/star/table/BorderLine.hpp>
67cdf0e10cSrcweir #include <com/sun/star/util/XModifyBroadcaster.hpp>
68cdf0e10cSrcweir #include <com/sun/star/table/ShadowFormat.hpp>
69cdf0e10cSrcweir #include <com/sun/star/style/GraphicLocation.hpp>
70cdf0e10cSrcweir #include <com/sun/star/text/GraphicCrop.hpp>
71cdf0e10cSrcweir #include <com/sun/star/text/TextContentAnchorType.hpp>
72cdf0e10cSrcweir #include <com/sun/star/text/XTextColumns.hpp>
73cdf0e10cSrcweir #include <com/sun/star/text/WrapTextMode.hpp>
74cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
75cdf0e10cSrcweir #include <com/sun/star/drawing/PointSequenceSequence.hpp>
76cdf0e10cSrcweir #include <com/sun/star/drawing/PointSequence.hpp>
77cdf0e10cSrcweir #include <com/sun/star/drawing/ColorMode.hpp>
78cdf0e10cSrcweir #include <tools/poly.hxx>
79cdf0e10cSrcweir #include <swundo.hxx>
80cdf0e10cSrcweir #include <unostyle.hxx>
81cdf0e10cSrcweir #include <svx/svdmodel.hxx>
82cdf0e10cSrcweir #include <svx/svdpage.hxx>
83cdf0e10cSrcweir #include <editeng/brshitem.hxx>
84cdf0e10cSrcweir #include <editeng/protitem.hxx>
85cdf0e10cSrcweir #include <fmtornt.hxx>
86cdf0e10cSrcweir #include <fmturl.hxx>
87cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
88cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
89cdf0e10cSrcweir #include <editeng/boxitem.hxx>
90cdf0e10cSrcweir #include <editeng/opaqitem.hxx>
91cdf0e10cSrcweir #include <editeng/prntitem.hxx>
92cdf0e10cSrcweir #include <editeng/shaditem.hxx>
93cdf0e10cSrcweir #include <fmtsrnd.hxx>
94cdf0e10cSrcweir #include <fmtfsize.hxx>
95cdf0e10cSrcweir #include <grfatr.hxx>
96cdf0e10cSrcweir #include <unoframe.hxx>
97cdf0e10cSrcweir #include <fmtanchr.hxx>
98cdf0e10cSrcweir #include <fmtclds.hxx>
99cdf0e10cSrcweir #include <fmtcntnt.hxx>
100cdf0e10cSrcweir #include <frmatr.hxx>
101cdf0e10cSrcweir #include <ndtxt.hxx>
102cdf0e10cSrcweir #include <ndgrf.hxx>
103cdf0e10cSrcweir #include <vos/mutex.hxx>
104cdf0e10cSrcweir #include <vcl/svapp.hxx>
105cdf0e10cSrcweir #include <sfx2/printer.hxx>
106e800f12eSJian Hong Cheng #include <sfx2/docfile.hxx>
107e800f12eSJian Hong Cheng #include <sfx2/docfilt.hxx>
108cdf0e10cSrcweir #include <SwStyleNameMapper.hxx>
109cdf0e10cSrcweir #include <xmloff/xmlcnitm.hxx>
110cdf0e10cSrcweir #include <poolfmt.hxx>
111cdf0e10cSrcweir #include <pagedesc.hxx>
112cdf0e10cSrcweir #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
113cdf0e10cSrcweir #include <tools/urlobj.hxx>
114cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
115cdf0e10cSrcweir #include <fmtfollowtextflow.hxx>
116cdf0e10cSrcweir #include <fmtwrapinfluenceonobjpos.hxx>
117cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
118cdf0e10cSrcweir #include <switerator.hxx>
11956b35d86SArmin Le Grand #include <svx/unobrushitemhelper.hxx>
12064b14621SArmin Le Grand #include <svx/xfillit0.hxx>
12164b14621SArmin Le Grand #include <svx/xbtmpit.hxx>
12264b14621SArmin Le Grand #include <svx/xgrscit.hxx>
12364b14621SArmin Le Grand #include <svx/xflbmtit.hxx>
12464b14621SArmin Le Grand #include <svx/xflbmpit.hxx>
12564b14621SArmin Le Grand #include <svx/xflbmsxy.hxx>
12664b14621SArmin Le Grand #include <svx/xflbmsxy.hxx>
12764b14621SArmin Le Grand #include <svx/xflftrit.hxx>
12864b14621SArmin Le Grand #include <svx/xsflclit.hxx>
12964b14621SArmin Le Grand #include <svx/xflbmsli.hxx>
13064b14621SArmin Le Grand #include <svx/xflbtoxy.hxx>
13164b14621SArmin Le Grand #include <svx/xflbstit.hxx>
13264b14621SArmin Le Grand #include <svx/xflboxy.hxx>
13364b14621SArmin Le Grand #include <svx/xflbckit.hxx>
13464b14621SArmin Le Grand #include <svx/unoshape.hxx>
13556b35d86SArmin Le Grand #include <swunohelper.hxx>
13626ea3662SArmin Le Grand #include <drawdoc.hxx>
13764b14621SArmin Le Grand 
138cdf0e10cSrcweir // from fefly1.cxx
13969a74367SOliver-Rainer Wittmann extern sal_Bool lcl_ChkAndSetNewAnchor( SwEditShell& rEditShell, const SwFlyFrm& rFly, SfxItemSet& rSet );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir using namespace ::com::sun::star;
142cdf0e10cSrcweir using ::rtl::OUString;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir using ::com::sun::star::frame::XModel;
145cdf0e10cSrcweir using ::com::sun::star::container::XNameAccess;
146cdf0e10cSrcweir using ::com::sun::star::style::XStyleFamiliesSupplier;
147cdf0e10cSrcweir 
148cdf0e10cSrcweir const sal_Char __FAR_DATA sPackageProtocol[] = "vnd.sun.star.Package:";
149cdf0e10cSrcweir const sal_Char __FAR_DATA sGraphicObjectProtocol[] = "vnd.sun.star.GraphicObject:";
150cdf0e10cSrcweir 
151cdf0e10cSrcweir /****************************************************************************
152cdf0e10cSrcweir     Rahmenbeschreibung
153cdf0e10cSrcweir ****************************************************************************/
154cdf0e10cSrcweir class BaseFrameProperties_Impl
155cdf0e10cSrcweir {
156cdf0e10cSrcweir     SwUnoCursorHelper::SwAnyMapHelper aAnyMap;
157cdf0e10cSrcweir 
158cdf0e10cSrcweir public:
159cdf0e10cSrcweir     virtual ~BaseFrameProperties_Impl();
160cdf0e10cSrcweir 
161cdf0e10cSrcweir     void            SetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any& rVal);
162cdf0e10cSrcweir     sal_Bool        GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any*& pAny );
163cdf0e10cSrcweir //    void          GetProperty(const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any& rAny );
164cdf0e10cSrcweir 
165cdf0e10cSrcweir //    const SfxItemPropertyMap*       GetMap() const {return _pMap;}
166e800f12eSJian Hong Cheng     //Begin Bug 119922:Graphic in header and footer can not be displayed correctly.
167e800f12eSJian Hong Cheng     //Set default value for "Follow text flow" to false if a previous version didn't support "Follow text flow".
168e800f12eSJian Hong Cheng     sal_Bool                        FillBaseProperties(SfxItemSet& rToSet,
169e800f12eSJian Hong Cheng                                                         const SfxItemSet &rFromSet,
170e800f12eSJian Hong Cheng                                                         sal_Bool& rSizeFound,
171e800f12eSJian Hong Cheng                                                         const sal_Bool bOasis = sal_False );
172e800f12eSJian Hong Cheng     //End Bug 119922
173cdf0e10cSrcweir 
174cdf0e10cSrcweir     virtual sal_Bool                AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound) = 0;
175cdf0e10cSrcweir };
176cdf0e10cSrcweir 
~BaseFrameProperties_Impl()177cdf0e10cSrcweir BaseFrameProperties_Impl::~BaseFrameProperties_Impl()
178cdf0e10cSrcweir {
179cdf0e10cSrcweir }
180cdf0e10cSrcweir 
SetProperty(sal_uInt16 nWID,sal_uInt8 nMemberId,const uno::Any & rVal)181cdf0e10cSrcweir void BaseFrameProperties_Impl::SetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any& rVal)
182cdf0e10cSrcweir {
183cdf0e10cSrcweir     aAnyMap.SetValue( nWID, nMemberId, rVal );
184cdf0e10cSrcweir }
185cdf0e10cSrcweir 
GetProperty(sal_uInt16 nWID,sal_uInt8 nMemberId,const uno::Any * & rpAny)186cdf0e10cSrcweir sal_Bool BaseFrameProperties_Impl::GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any*& rpAny)
187cdf0e10cSrcweir {
188cdf0e10cSrcweir     return aAnyMap.FillValue( nWID, nMemberId, rpAny );
189cdf0e10cSrcweir }
190cdf0e10cSrcweir 
191e800f12eSJian Hong Cheng //Begin Bug 119922:Graphic in header and footer can not be displayed correctly.
192e800f12eSJian Hong Cheng //Set default value for "Follow text flow" to false if a previous version didn't support "Follow text flow".
FillBaseProperties(SfxItemSet & rToSet,const SfxItemSet & rFromSet,sal_Bool & rSizeFound,const sal_Bool bOasis)193e800f12eSJian Hong Cheng sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet,
194e800f12eSJian Hong Cheng                                                       const SfxItemSet& rFromSet,
195e800f12eSJian Hong Cheng                                                       sal_Bool& rSizeFound,
196e800f12eSJian Hong Cheng                                                       const sal_Bool bOasis /*sal_False*/ )
197e800f12eSJian Hong Cheng //End Bug 119922
198cdf0e10cSrcweir {
19956b35d86SArmin Le Grand     //UUUU assert when the target SfxItemSet has no parent. It *should* have the pDfltFrmFmt
20056b35d86SArmin Le Grand     // from SwDoc set as parent (or similar) to have the necessary XFILL_NONE in the ItemSet
20156b35d86SArmin Le Grand     if(!rToSet.GetParent())
20256b35d86SArmin Le Grand     {
20356b35d86SArmin Le Grand         OSL_ENSURE(false, "OOps, target SfxItemSet *should* have a parent which contains XFILL_NONE as XFillStyleItem (!)");
20456b35d86SArmin Le Grand     }
20556b35d86SArmin Le Grand 
206cdf0e10cSrcweir     sal_Bool bRet = sal_True;
207cdf0e10cSrcweir     //Anker kommt auf jeden Fall in den Set
208cdf0e10cSrcweir     SwFmtAnchor aAnchor ( static_cast < const SwFmtAnchor & > ( rFromSet.Get ( RES_ANCHOR ) ) );
209cdf0e10cSrcweir     {
210cdf0e10cSrcweir         const ::uno::Any* pAnchorPgNo;
211cdf0e10cSrcweir         if(GetProperty(RES_ANCHOR, MID_ANCHOR_PAGENUM, pAnchorPgNo))
212cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorPgNo, MID_ANCHOR_PAGENUM);
213cdf0e10cSrcweir         const ::uno::Any* pAnchorType;
214cdf0e10cSrcweir         if(GetProperty(RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, pAnchorType))
215cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorType, MID_ANCHOR_ANCHORTYPE);
216cdf0e10cSrcweir     }
217cdf0e10cSrcweir 
21864b14621SArmin Le Grand     rToSet.Put(aAnchor);
21964b14621SArmin Le Grand 
22064b14621SArmin Le Grand     //UUUU check for SvxBrushItem (RES_BACKGROUND) properties
22164b14621SArmin Le Grand     const ::uno::Any* pCol = 0; GetProperty(RES_BACKGROUND, MID_BACK_COLOR, pCol );
22264b14621SArmin Le Grand     const ::uno::Any* pRGBCol = 0; GetProperty(RES_BACKGROUND, MID_BACK_COLOR_R_G_B, pRGBCol );
22364b14621SArmin Le Grand     const ::uno::Any* pColTrans = 0; GetProperty(RES_BACKGROUND, MID_BACK_COLOR_TRANSPARENCY, pColTrans);
22464b14621SArmin Le Grand     const ::uno::Any* pTrans = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENT, pTrans );
22564b14621SArmin Le Grand     const ::uno::Any* pGrLoc = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_POSITION, pGrLoc );
22664b14621SArmin Le Grand     const ::uno::Any* pGrURL = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_URL, pGrURL     );
22764b14621SArmin Le Grand     const ::uno::Any* pGrFilter = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_FILTER, pGrFilter     );
22864b14621SArmin Le Grand     const ::uno::Any* pGrTranparency = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENCY, pGrTranparency     );
22964b14621SArmin Le Grand     const bool bSvxBrushItemPropertiesUsed(
23064b14621SArmin Le Grand         pCol ||
23164b14621SArmin Le Grand         pTrans ||
23264b14621SArmin Le Grand         pGrURL ||
23364b14621SArmin Le Grand         pGrFilter ||
23464b14621SArmin Le Grand         pGrLoc ||
23564b14621SArmin Le Grand         pGrTranparency ||
23664b14621SArmin Le Grand         pColTrans ||
23764b14621SArmin Le Grand         pRGBCol);
23864b14621SArmin Le Grand 
23964b14621SArmin Le Grand     //UUUU check for FillStyle properties in the range XATTR_FILL_FIRST, XATTR_FILL_LAST
24064b14621SArmin Le Grand     const uno::Any* pXFillStyleItem = 0; GetProperty(XATTR_FILLSTYLE, 0, pXFillStyleItem);
24164b14621SArmin Le Grand     const uno::Any* pXFillColorItem = 0; GetProperty(XATTR_FILLCOLOR, 0, pXFillColorItem);
24264b14621SArmin Le Grand 
24364b14621SArmin Le Grand     // XFillGradientItem: two possible slots supported in UNO API
24464b14621SArmin Le Grand     const uno::Any* pXFillGradientItem = 0; GetProperty(XATTR_FILLGRADIENT, MID_FILLGRADIENT, pXFillGradientItem);
24564b14621SArmin Le Grand     const uno::Any* pXFillGradientNameItem = 0; GetProperty(XATTR_FILLGRADIENT, MID_NAME, pXFillGradientNameItem);
24664b14621SArmin Le Grand 
24764b14621SArmin Le Grand     // XFillHatchItem: two possible slots supported in UNO API
24864b14621SArmin Le Grand     const uno::Any* pXFillHatchItem = 0; GetProperty(XATTR_FILLHATCH, MID_FILLHATCH, pXFillHatchItem);
24964b14621SArmin Le Grand     const uno::Any* pXFillHatchNameItem = 0; GetProperty(XATTR_FILLHATCH, MID_NAME, pXFillHatchNameItem);
25064b14621SArmin Le Grand 
25164b14621SArmin Le Grand     // XFillBitmapItem: three possible slots supported in UNO API
25264b14621SArmin Le Grand     const uno::Any* pXFillBitmapItem = 0; GetProperty(XATTR_FILLBITMAP, MID_BITMAP, pXFillBitmapItem);
25364b14621SArmin Le Grand     const uno::Any* pXFillBitmapNameItem = 0; GetProperty(XATTR_FILLBITMAP, MID_NAME, pXFillBitmapNameItem);
25464b14621SArmin Le Grand     const uno::Any* pXFillBitmapURLItem = 0; GetProperty(XATTR_FILLBITMAP, MID_GRAFURL, pXFillBitmapURLItem);
25564b14621SArmin Le Grand 
25664b14621SArmin Le Grand     const uno::Any* pXFillTransparenceItem = 0; GetProperty(XATTR_FILLTRANSPARENCE, 0, pXFillTransparenceItem);
25764b14621SArmin Le Grand     const uno::Any* pXGradientStepCountItem = 0; GetProperty(XATTR_GRADIENTSTEPCOUNT, 0, pXGradientStepCountItem);
25864b14621SArmin Le Grand     const uno::Any* pXFillBmpPosItem = 0; GetProperty(XATTR_FILLBMP_POS, 0, pXFillBmpPosItem);
25964b14621SArmin Le Grand     const uno::Any* pXFillBmpSizeXItem = 0; GetProperty(XATTR_FILLBMP_SIZEX, 0, pXFillBmpSizeXItem);
26064b14621SArmin Le Grand     const uno::Any* pXFillBmpSizeYItem = 0; GetProperty(XATTR_FILLBMP_SIZEY, 0, pXFillBmpSizeYItem);
26164b14621SArmin Le Grand 
26264b14621SArmin Le Grand     // XFillFloatTransparenceItem: two possible slots supported in UNO API
26364b14621SArmin Le Grand     const uno::Any* pXFillFloatTransparenceItem = 0; GetProperty(XATTR_FILLFLOATTRANSPARENCE, MID_FILLGRADIENT, pXFillFloatTransparenceItem);
26464b14621SArmin Le Grand     const uno::Any* pXFillFloatTransparenceNameItem = 0; GetProperty(XATTR_FILLFLOATTRANSPARENCE, MID_NAME, pXFillFloatTransparenceNameItem);
26564b14621SArmin Le Grand 
26664b14621SArmin Le Grand     const uno::Any* pXSecondaryFillColorItem = 0; GetProperty(XATTR_SECONDARYFILLCOLOR, 0, pXSecondaryFillColorItem);
26764b14621SArmin Le Grand     const uno::Any* pXFillBmpSizeLogItem = 0; GetProperty(XATTR_FILLBMP_SIZELOG, 0, pXFillBmpSizeLogItem);
26864b14621SArmin Le Grand     const uno::Any* pXFillBmpTileOffsetXItem = 0; GetProperty(XATTR_FILLBMP_TILEOFFSETX, 0, pXFillBmpTileOffsetXItem);
26964b14621SArmin Le Grand     const uno::Any* pXFillBmpTileOffsetYItem = 0; GetProperty(XATTR_FILLBMP_TILEOFFSETY, 0, pXFillBmpTileOffsetYItem);
27064b14621SArmin Le Grand     const uno::Any* pXFillBmpPosOffsetXItem = 0; GetProperty(XATTR_FILLBMP_POSOFFSETX, 0, pXFillBmpPosOffsetXItem);
27164b14621SArmin Le Grand     const uno::Any* pXFillBmpPosOffsetYItem = 0; GetProperty(XATTR_FILLBMP_POSOFFSETY, 0, pXFillBmpPosOffsetYItem);
27264b14621SArmin Le Grand     const uno::Any* pXFillBackgroundItem = 0; GetProperty(XATTR_FILLBACKGROUND, 0, pXFillBackgroundItem);
27364b14621SArmin Le Grand     const uno::Any* pOwnAttrFillBmpItem = 0; GetProperty(OWN_ATTR_FILLBMP_MODE, 0, pOwnAttrFillBmpItem);
27464b14621SArmin Le Grand 
27564b14621SArmin Le Grand     const bool bXFillStyleItemUsed(
27664b14621SArmin Le Grand         pXFillStyleItem ||
27764b14621SArmin Le Grand         pXFillColorItem ||
27864b14621SArmin Le Grand         pXFillGradientItem || pXFillGradientNameItem ||
27964b14621SArmin Le Grand         pXFillHatchItem || pXFillHatchNameItem ||
28064b14621SArmin Le Grand         pXFillBitmapItem || pXFillBitmapNameItem || pXFillBitmapURLItem ||
28164b14621SArmin Le Grand         pXFillTransparenceItem ||
28264b14621SArmin Le Grand         pXGradientStepCountItem ||
28364b14621SArmin Le Grand         pXFillBmpPosItem ||
28464b14621SArmin Le Grand         pXFillBmpSizeXItem ||
28564b14621SArmin Le Grand         pXFillBmpSizeYItem ||
28664b14621SArmin Le Grand         pXFillFloatTransparenceItem || pXFillFloatTransparenceNameItem ||
28764b14621SArmin Le Grand         pXSecondaryFillColorItem ||
28864b14621SArmin Le Grand         pXFillBmpSizeLogItem ||
28964b14621SArmin Le Grand         pXFillBmpTileOffsetXItem ||
29064b14621SArmin Le Grand         pXFillBmpTileOffsetYItem ||
29164b14621SArmin Le Grand         pXFillBmpPosOffsetXItem ||
29264b14621SArmin Le Grand         pXFillBmpPosOffsetYItem ||
29364b14621SArmin Le Grand         pXFillBackgroundItem ||
29464b14621SArmin Le Grand         pOwnAttrFillBmpItem);
29564b14621SArmin Le Grand 
29664b14621SArmin Le Grand     // use brush items, but *only* if no FillStyle properties are used; if both are used and when applying both
29764b14621SArmin Le Grand     // in the obvious order some attributes may be wrong since they are set by the 1st set, but not
29864b14621SArmin Le Grand     // redefined as needed by the 2nd set when they are default (and thus no tset) in the 2nd set. If
29964b14621SArmin Le Grand     // it is necessary for any reason to set both (it should not) a in-between step will be needed
30056b35d86SArmin Le Grand     // that resets the items for FillAttributes in rToSet to default.
30156b35d86SArmin Le Grand     // Note: There are other mechanisms in XMLOFF to pre-sort this relationship already, but this version
30256b35d86SArmin Le Grand     // was used initially, is tested and works. Keep it to be able to react when another feed adds attributes
30356b35d86SArmin Le Grand     // from both sets.
30464b14621SArmin Le Grand     if(bSvxBrushItemPropertiesUsed && !bXFillStyleItemUsed)
305cdf0e10cSrcweir     {
30664b14621SArmin Le Grand         //UUUU create a temporary SvxBrushItem, fill the attributes to it and use it to set
30764b14621SArmin Le Grand         // the corresponding FillAttributes
30864b14621SArmin Le Grand         SvxBrushItem aBrush(RES_BACKGROUND);
30964b14621SArmin Le Grand 
310cdf0e10cSrcweir         if(pCol)
31164b14621SArmin Le Grand         {
312cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pCol,MID_BACK_COLOR    );
31364b14621SArmin Le Grand         }
31464b14621SArmin Le Grand 
315cdf0e10cSrcweir         if(pColTrans)
31664b14621SArmin Le Grand         {
317cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY);
31864b14621SArmin Le Grand         }
31964b14621SArmin Le Grand 
320cdf0e10cSrcweir         if(pRGBCol)
32164b14621SArmin Le Grand         {
322cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B);
32364b14621SArmin Le Grand         }
32464b14621SArmin Le Grand 
325cdf0e10cSrcweir         if(pTrans)
326cdf0e10cSrcweir         {
327cdf0e10cSrcweir             // don't overwrite transparency with a non-transparence flag
328cdf0e10cSrcweir             if(!pColTrans || Any2Bool( *pTrans ))
329cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aBrush).PutValue(*pTrans, MID_GRAPHIC_TRANSPARENT);
330cdf0e10cSrcweir         }
331cdf0e10cSrcweir 
33264b14621SArmin Le Grand         if(pGrURL)
33364b14621SArmin Le Grand         {
33464b14621SArmin Le Grand             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrURL, MID_GRAPHIC_URL);
33564b14621SArmin Le Grand         }
33664b14621SArmin Le Grand 
33764b14621SArmin Le Grand         if(pGrFilter)
33864b14621SArmin Le Grand         {
33964b14621SArmin Le Grand             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrFilter, MID_GRAPHIC_FILTER);
34064b14621SArmin Le Grand         }
34164b14621SArmin Le Grand 
34264b14621SArmin Le Grand         if(pGrLoc)
34364b14621SArmin Le Grand         {
34464b14621SArmin Le Grand             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrLoc, MID_GRAPHIC_POSITION);
34564b14621SArmin Le Grand         }
34664b14621SArmin Le Grand 
34764b14621SArmin Le Grand         if(pGrTranparency)
34864b14621SArmin Le Grand         {
34964b14621SArmin Le Grand             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrTranparency, MID_GRAPHIC_TRANSPARENCY);
35064b14621SArmin Le Grand         }
35164b14621SArmin Le Grand 
35264b14621SArmin Le Grand         setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
35364b14621SArmin Le Grand     }
35464b14621SArmin Le Grand 
35564b14621SArmin Le Grand     if(bXFillStyleItemUsed)
35664b14621SArmin Le Grand     {
35764b14621SArmin Le Grand         if(pXFillStyleItem)
35864b14621SArmin Le Grand         {
35964b14621SArmin Le Grand             XFillStyleItem aXFillStyleItem;
36064b14621SArmin Le Grand 
36164b14621SArmin Le Grand             aXFillStyleItem.PutValue(*pXFillStyleItem);
36264b14621SArmin Le Grand             rToSet.Put(aXFillStyleItem);
36364b14621SArmin Le Grand         }
36464b14621SArmin Le Grand 
36564b14621SArmin Le Grand         if(pXFillColorItem)
36664b14621SArmin Le Grand         {
36764b14621SArmin Le Grand             const XubString aNullStr;
36864b14621SArmin Le Grand             const Color aNullCol(COL_DEFAULT_SHAPE_FILLING);
36964b14621SArmin Le Grand             XFillColorItem aXFillColorItem(aNullStr, aNullCol);
37064b14621SArmin Le Grand 
37164b14621SArmin Le Grand             aXFillColorItem.PutValue(*pXFillColorItem);
37264b14621SArmin Le Grand             rToSet.Put(aXFillColorItem);
37364b14621SArmin Le Grand         }
37464b14621SArmin Le Grand 
37564b14621SArmin Le Grand         if(pXFillGradientItem || pXFillGradientNameItem)
37664b14621SArmin Le Grand         {
37764b14621SArmin Le Grand             if(pXFillGradientItem)
37864b14621SArmin Le Grand             {
37964b14621SArmin Le Grand                 const XGradient aNullGrad(RGB_Color(COL_BLACK), RGB_Color(COL_WHITE));
38064b14621SArmin Le Grand                 XFillGradientItem aXFillGradientItem(rToSet.GetPool(), aNullGrad);
38164b14621SArmin Le Grand 
38264b14621SArmin Le Grand                 aXFillGradientItem.PutValue(*pXFillGradientItem, MID_FILLGRADIENT);
38364b14621SArmin Le Grand                 rToSet.Put(aXFillGradientItem);
38464b14621SArmin Le Grand             }
38564b14621SArmin Le Grand 
38664b14621SArmin Le Grand             if(pXFillGradientNameItem)
38764b14621SArmin Le Grand             {
38864b14621SArmin Le Grand                 OUString aTempName;
38964b14621SArmin Le Grand 
39064b14621SArmin Le Grand                 if(!(*pXFillGradientNameItem >>= aTempName ))
39164b14621SArmin Le Grand                 {
39264b14621SArmin Le Grand                     throw lang::IllegalArgumentException();
39364b14621SArmin Le Grand                 }
39464b14621SArmin Le Grand 
39564b14621SArmin Le Grand                 bRet &= SvxShape::SetFillAttribute(XATTR_FILLGRADIENT, aTempName, rToSet);
39664b14621SArmin Le Grand             }
39764b14621SArmin Le Grand         }
39864b14621SArmin Le Grand 
39964b14621SArmin Le Grand         if(pXFillHatchItem || pXFillHatchNameItem)
40064b14621SArmin Le Grand         {
40164b14621SArmin Le Grand             if(pXFillHatchItem)
40264b14621SArmin Le Grand             {
40364b14621SArmin Le Grand                 const Color aNullCol(COL_DEFAULT_SHAPE_STROKE);
40464b14621SArmin Le Grand                 const XHatch aNullHatch(aNullCol);
40564b14621SArmin Le Grand                 XFillHatchItem aXFillHatchItem(rToSet.GetPool(), aNullHatch);
40664b14621SArmin Le Grand 
40764b14621SArmin Le Grand                 aXFillHatchItem.PutValue(*pXFillHatchItem, MID_FILLHATCH);
40864b14621SArmin Le Grand                 rToSet.Put(aXFillHatchItem);
40964b14621SArmin Le Grand             }
41064b14621SArmin Le Grand 
41164b14621SArmin Le Grand             if(pXFillHatchNameItem)
41264b14621SArmin Le Grand             {
41364b14621SArmin Le Grand                 OUString aTempName;
41464b14621SArmin Le Grand 
41564b14621SArmin Le Grand                 if(!(*pXFillHatchNameItem >>= aTempName ))
41664b14621SArmin Le Grand                 {
41764b14621SArmin Le Grand                     throw lang::IllegalArgumentException();
41864b14621SArmin Le Grand                 }
41964b14621SArmin Le Grand 
42064b14621SArmin Le Grand                 bRet &= SvxShape::SetFillAttribute(XATTR_FILLHATCH, aTempName, rToSet);
42164b14621SArmin Le Grand             }
42264b14621SArmin Le Grand         }
42364b14621SArmin Le Grand 
42464b14621SArmin Le Grand         if(pXFillBitmapItem || pXFillBitmapNameItem || pXFillBitmapURLItem)
42564b14621SArmin Le Grand         {
42664b14621SArmin Le Grand             if(pXFillBitmapItem)
42764b14621SArmin Le Grand             {
42864b14621SArmin Le Grand                 const Graphic aNullGraphic;
42964b14621SArmin Le Grand                 XFillBitmapItem aXFillBitmapItem(rToSet.GetPool(), aNullGraphic);
43064b14621SArmin Le Grand 
43164b14621SArmin Le Grand                 aXFillBitmapItem.PutValue(*pXFillBitmapItem, MID_BITMAP);
43264b14621SArmin Le Grand                 rToSet.Put(aXFillBitmapItem);
43364b14621SArmin Le Grand             }
43464b14621SArmin Le Grand 
43564b14621SArmin Le Grand             if(pXFillBitmapNameItem)
43664b14621SArmin Le Grand             {
43764b14621SArmin Le Grand                 OUString aTempName;
43864b14621SArmin Le Grand 
43964b14621SArmin Le Grand                 if(!(*pXFillBitmapNameItem >>= aTempName ))
44064b14621SArmin Le Grand                 {
44164b14621SArmin Le Grand                     throw lang::IllegalArgumentException();
44264b14621SArmin Le Grand                 }
44364b14621SArmin Le Grand 
44464b14621SArmin Le Grand                 bRet &= SvxShape::SetFillAttribute(XATTR_FILLBITMAP, aTempName, rToSet);
44564b14621SArmin Le Grand             }
44664b14621SArmin Le Grand 
44764b14621SArmin Le Grand             if(pXFillBitmapURLItem)
44864b14621SArmin Le Grand             {
44964b14621SArmin Le Grand                 const Graphic aNullGraphic;
45064b14621SArmin Le Grand                 XFillBitmapItem aXFillBitmapItem(rToSet.GetPool(), aNullGraphic);
45164b14621SArmin Le Grand 
45264b14621SArmin Le Grand                 aXFillBitmapItem.PutValue(*pXFillBitmapURLItem, MID_GRAFURL);
45364b14621SArmin Le Grand                 rToSet.Put(aXFillBitmapItem);
45464b14621SArmin Le Grand             }
45564b14621SArmin Le Grand         }
45664b14621SArmin Le Grand 
45764b14621SArmin Le Grand         if(pXFillTransparenceItem)
45864b14621SArmin Le Grand         {
45964b14621SArmin Le Grand             const XGradient aNullGrad(RGB_Color(COL_BLACK), RGB_Color(COL_WHITE));
46064b14621SArmin Le Grand             XFillTransparenceItem aXFillTransparenceItem;
46164b14621SArmin Le Grand 
46264b14621SArmin Le Grand             aXFillTransparenceItem.PutValue(*pXFillTransparenceItem);
46364b14621SArmin Le Grand             rToSet.Put(aXFillTransparenceItem);
46464b14621SArmin Le Grand         }
46564b14621SArmin Le Grand 
46664b14621SArmin Le Grand         if(pXGradientStepCountItem)
46764b14621SArmin Le Grand         {
46864b14621SArmin Le Grand             XGradientStepCountItem aXGradientStepCountItem;
46964b14621SArmin Le Grand 
47064b14621SArmin Le Grand             aXGradientStepCountItem.PutValue(*pXGradientStepCountItem);
47164b14621SArmin Le Grand             rToSet.Put(aXGradientStepCountItem);
47264b14621SArmin Le Grand         }
47364b14621SArmin Le Grand 
47464b14621SArmin Le Grand         if(pXFillBmpPosItem)
47564b14621SArmin Le Grand         {
47664b14621SArmin Le Grand             XFillBmpPosItem aXFillBmpPosItem;
47764b14621SArmin Le Grand 
47864b14621SArmin Le Grand             aXFillBmpPosItem.PutValue(*pXFillBmpPosItem);
47964b14621SArmin Le Grand             rToSet.Put(aXFillBmpPosItem);
48064b14621SArmin Le Grand         }
48164b14621SArmin Le Grand 
48264b14621SArmin Le Grand         if(pXFillBmpSizeXItem)
48364b14621SArmin Le Grand         {
48464b14621SArmin Le Grand             XFillBmpSizeXItem aXFillBmpSizeXItem;
48564b14621SArmin Le Grand 
48664b14621SArmin Le Grand             aXFillBmpSizeXItem.PutValue(*pXFillBmpSizeXItem);
48764b14621SArmin Le Grand             rToSet.Put(aXFillBmpSizeXItem);
48864b14621SArmin Le Grand         }
48964b14621SArmin Le Grand 
49064b14621SArmin Le Grand         if(pXFillBmpSizeYItem)
49164b14621SArmin Le Grand         {
49264b14621SArmin Le Grand             XFillBmpSizeYItem aXFillBmpSizeYItem;
49364b14621SArmin Le Grand 
49464b14621SArmin Le Grand             aXFillBmpSizeYItem.PutValue(*pXFillBmpSizeYItem);
49564b14621SArmin Le Grand             rToSet.Put(aXFillBmpSizeYItem);
49664b14621SArmin Le Grand         }
49764b14621SArmin Le Grand 
49864b14621SArmin Le Grand         if(pXFillFloatTransparenceItem || pXFillFloatTransparenceNameItem)
49964b14621SArmin Le Grand         {
50064b14621SArmin Le Grand             if(pXFillFloatTransparenceItem)
50164b14621SArmin Le Grand             {
50264b14621SArmin Le Grand                 const XGradient aNullGrad(RGB_Color(COL_BLACK), RGB_Color(COL_WHITE));
50364b14621SArmin Le Grand                 XFillFloatTransparenceItem aXFillFloatTransparenceItem(rToSet.GetPool(), aNullGrad, false);
50464b14621SArmin Le Grand 
50564b14621SArmin Le Grand                 aXFillFloatTransparenceItem.PutValue(*pXFillFloatTransparenceItem, MID_FILLGRADIENT);
50664b14621SArmin Le Grand                 rToSet.Put(aXFillFloatTransparenceItem);
50764b14621SArmin Le Grand             }
50864b14621SArmin Le Grand 
50964b14621SArmin Le Grand             if(pXFillFloatTransparenceNameItem)
51064b14621SArmin Le Grand             {
51164b14621SArmin Le Grand                 OUString aTempName;
51264b14621SArmin Le Grand 
51364b14621SArmin Le Grand                 if(!(*pXFillFloatTransparenceNameItem >>= aTempName ))
51464b14621SArmin Le Grand                 {
51564b14621SArmin Le Grand                     throw lang::IllegalArgumentException();
51664b14621SArmin Le Grand                 }
51764b14621SArmin Le Grand 
51864b14621SArmin Le Grand                 bRet &= SvxShape::SetFillAttribute(XATTR_FILLFLOATTRANSPARENCE, aTempName, rToSet);
51964b14621SArmin Le Grand             }
52064b14621SArmin Le Grand         }
52164b14621SArmin Le Grand 
52264b14621SArmin Le Grand         if(pXSecondaryFillColorItem)
52364b14621SArmin Le Grand         {
52464b14621SArmin Le Grand             const XubString aNullStr;
52564b14621SArmin Le Grand             const Color aNullCol(COL_DEFAULT_SHAPE_FILLING);
52664b14621SArmin Le Grand             XSecondaryFillColorItem aXSecondaryFillColorItem(aNullStr, aNullCol);
52764b14621SArmin Le Grand 
52864b14621SArmin Le Grand             aXSecondaryFillColorItem.PutValue(*pXSecondaryFillColorItem);
52964b14621SArmin Le Grand             rToSet.Put(aXSecondaryFillColorItem);
53064b14621SArmin Le Grand         }
53164b14621SArmin Le Grand 
53264b14621SArmin Le Grand         if(pXFillBmpSizeLogItem)
53364b14621SArmin Le Grand         {
53464b14621SArmin Le Grand             XFillBmpSizeLogItem aXFillBmpSizeLogItem;
53564b14621SArmin Le Grand 
53664b14621SArmin Le Grand             aXFillBmpSizeLogItem.PutValue(*pXFillBmpSizeLogItem);
53764b14621SArmin Le Grand             rToSet.Put(aXFillBmpSizeLogItem);
53864b14621SArmin Le Grand         }
53964b14621SArmin Le Grand 
54064b14621SArmin Le Grand         if(pXFillBmpTileOffsetXItem)
54164b14621SArmin Le Grand         {
54264b14621SArmin Le Grand             XFillBmpTileOffsetXItem aXFillBmpTileOffsetXItem;
54364b14621SArmin Le Grand 
54464b14621SArmin Le Grand             aXFillBmpTileOffsetXItem.PutValue(*pXFillBmpTileOffsetXItem);
54564b14621SArmin Le Grand             rToSet.Put(aXFillBmpTileOffsetXItem);
54664b14621SArmin Le Grand         }
54764b14621SArmin Le Grand 
54864b14621SArmin Le Grand         if(pXFillBmpTileOffsetYItem)
54964b14621SArmin Le Grand         {
55064b14621SArmin Le Grand             XFillBmpTileOffsetYItem aXFillBmpTileOffsetYItem;
55164b14621SArmin Le Grand 
55264b14621SArmin Le Grand             aXFillBmpTileOffsetYItem.PutValue(*pXFillBmpTileOffsetYItem);
55364b14621SArmin Le Grand             rToSet.Put(aXFillBmpTileOffsetYItem);
55464b14621SArmin Le Grand         }
55564b14621SArmin Le Grand 
55664b14621SArmin Le Grand         if(pXFillBmpPosOffsetXItem)
55764b14621SArmin Le Grand         {
55864b14621SArmin Le Grand             XFillBmpPosOffsetXItem aXFillBmpPosOffsetXItem;
55964b14621SArmin Le Grand 
56064b14621SArmin Le Grand             aXFillBmpPosOffsetXItem.PutValue(*pXFillBmpPosOffsetXItem);
56164b14621SArmin Le Grand             rToSet.Put(aXFillBmpPosOffsetXItem);
56264b14621SArmin Le Grand         }
56364b14621SArmin Le Grand 
56464b14621SArmin Le Grand         if(pXFillBmpPosOffsetYItem)
56564b14621SArmin Le Grand         {
56664b14621SArmin Le Grand             XFillBmpPosOffsetYItem aXFillBmpPosOffsetYItem;
56764b14621SArmin Le Grand 
56864b14621SArmin Le Grand             aXFillBmpPosOffsetYItem.PutValue(*pXFillBmpPosOffsetYItem);
56964b14621SArmin Le Grand             rToSet.Put(aXFillBmpPosOffsetYItem);
57064b14621SArmin Le Grand         }
57164b14621SArmin Le Grand 
57264b14621SArmin Le Grand         if(pXFillBackgroundItem)
57364b14621SArmin Le Grand         {
57464b14621SArmin Le Grand             XFillBackgroundItem aXFillBackgroundItem;
57564b14621SArmin Le Grand 
57664b14621SArmin Le Grand             aXFillBackgroundItem.PutValue(*pXFillBackgroundItem);
57764b14621SArmin Le Grand             rToSet.Put(aXFillBackgroundItem);
57864b14621SArmin Le Grand         }
57964b14621SArmin Le Grand 
58064b14621SArmin Le Grand         if(pOwnAttrFillBmpItem)
58164b14621SArmin Le Grand         {
58264b14621SArmin Le Grand             drawing::BitmapMode eMode;
58364b14621SArmin Le Grand 
58464b14621SArmin Le Grand             if(!(*pOwnAttrFillBmpItem >>= eMode))
58564b14621SArmin Le Grand             {
58664b14621SArmin Le Grand                 sal_Int32 nMode = 0;
58764b14621SArmin Le Grand 
58864b14621SArmin Le Grand                 if(!(*pOwnAttrFillBmpItem >>= nMode))
58964b14621SArmin Le Grand                 {
59064b14621SArmin Le Grand                     throw lang::IllegalArgumentException();
59164b14621SArmin Le Grand                 }
59264b14621SArmin Le Grand 
59364b14621SArmin Le Grand                 eMode = (drawing::BitmapMode)nMode;
59464b14621SArmin Le Grand             }
59564b14621SArmin Le Grand 
59664b14621SArmin Le Grand             rToSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode));
59764b14621SArmin Le Grand             rToSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode));
598cdf0e10cSrcweir         }
599cdf0e10cSrcweir     }
600cdf0e10cSrcweir     {
601cdf0e10cSrcweir         const ::uno::Any* pCont = 0;
602cdf0e10cSrcweir         GetProperty(RES_PROTECT, MID_PROTECT_CONTENT, pCont );
603cdf0e10cSrcweir         const ::uno::Any* pPos = 0;
604cdf0e10cSrcweir         GetProperty(RES_PROTECT,MID_PROTECT_POSITION, pPos );
605cdf0e10cSrcweir         const ::uno::Any* pName = 0;
606cdf0e10cSrcweir         GetProperty(RES_PROTECT, MID_PROTECT_SIZE, pName );
607cdf0e10cSrcweir         if(pCont||pPos||pName)
608cdf0e10cSrcweir         {
609cdf0e10cSrcweir             SvxProtectItem aProt ( static_cast < const :: SvxProtectItem & > ( rFromSet.Get ( RES_PROTECT ) ) );
610cdf0e10cSrcweir             if(pCont)
611cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aProt).PutValue(*pCont, MID_PROTECT_CONTENT);
612cdf0e10cSrcweir             if(pPos )
613cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aProt).PutValue(*pPos, MID_PROTECT_POSITION);
614cdf0e10cSrcweir             if(pName)
615cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aProt).PutValue(*pName, MID_PROTECT_SIZE);
616cdf0e10cSrcweir             rToSet.Put(aProt);
617cdf0e10cSrcweir         }
618cdf0e10cSrcweir     }
619cdf0e10cSrcweir     {
620cdf0e10cSrcweir         const ::uno::Any* pHori  = 0;
621cdf0e10cSrcweir         GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, pHori );
622cdf0e10cSrcweir         const ::uno::Any* pHoriP = 0;
623cdf0e10cSrcweir         GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_POSITION|CONVERT_TWIPS, pHoriP );
624cdf0e10cSrcweir         const ::uno::Any* pHoriR = 0;
625cdf0e10cSrcweir         GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_RELATION, pHoriR );
626cdf0e10cSrcweir         const ::uno::Any* pPageT = 0;
627cdf0e10cSrcweir         GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_PAGETOGGLE, pPageT);
628cdf0e10cSrcweir         if(pHori||pHoriP||pHoriR||pPageT)
629cdf0e10cSrcweir         {
630cdf0e10cSrcweir             SwFmtHoriOrient aOrient ( static_cast < const :: SwFmtHoriOrient & > ( rFromSet.Get ( RES_HORI_ORIENT ) ) );
631cdf0e10cSrcweir             if(pHori )
632cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHori, MID_HORIORIENT_ORIENT);
633cdf0e10cSrcweir             if(pHoriP)
634cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHoriP, MID_HORIORIENT_POSITION|CONVERT_TWIPS);
635cdf0e10cSrcweir             if(pHoriR)
636cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHoriR, MID_HORIORIENT_RELATION);
637cdf0e10cSrcweir             if(pPageT)
638cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pPageT, MID_HORIORIENT_PAGETOGGLE);
639cdf0e10cSrcweir             rToSet.Put(aOrient);
640cdf0e10cSrcweir         }
641cdf0e10cSrcweir     }
642cdf0e10cSrcweir 
643cdf0e10cSrcweir     {
644cdf0e10cSrcweir         const ::uno::Any* pVert  = 0;
645cdf0e10cSrcweir         GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_ORIENT, pVert);
646cdf0e10cSrcweir         const ::uno::Any* pVertP = 0;
647cdf0e10cSrcweir         GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_POSITION|CONVERT_TWIPS, pVertP );
648cdf0e10cSrcweir         const ::uno::Any* pVertR = 0;
649cdf0e10cSrcweir         GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_RELATION, pVertR );
650cdf0e10cSrcweir         if(pVert||pVertP||pVertR)
651cdf0e10cSrcweir         {
652cdf0e10cSrcweir             SwFmtVertOrient aOrient ( static_cast < const :: SwFmtVertOrient & > ( rFromSet.Get ( RES_VERT_ORIENT ) ) );
653cdf0e10cSrcweir             if(pVert )
654cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVert, MID_VERTORIENT_ORIENT);
655cdf0e10cSrcweir             if(pVertP)
656cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVertP, MID_VERTORIENT_POSITION|CONVERT_TWIPS);
657cdf0e10cSrcweir             if(pVertR)
658cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVertR, MID_VERTORIENT_RELATION);
659cdf0e10cSrcweir             rToSet.Put(aOrient);
660cdf0e10cSrcweir         }
661cdf0e10cSrcweir     }
662cdf0e10cSrcweir     {
663cdf0e10cSrcweir         const ::uno::Any* pURL = 0;
664cdf0e10cSrcweir         GetProperty(RES_URL, MID_URL_URL, pURL );
665cdf0e10cSrcweir         const ::uno::Any* pTarget = 0;
666cdf0e10cSrcweir         GetProperty(RES_URL, MID_URL_TARGET, pTarget );
667cdf0e10cSrcweir         const ::uno::Any* pHyLNm = 0;
668cdf0e10cSrcweir         GetProperty(RES_URL, MID_URL_HYPERLINKNAME, pHyLNm );
669cdf0e10cSrcweir         const ::uno::Any* pHySMp = 0;
670cdf0e10cSrcweir         GetProperty(RES_URL, MID_URL_SERVERMAP, pHySMp );
671cdf0e10cSrcweir         if(pURL||pTarget||pHyLNm||pHySMp)
672cdf0e10cSrcweir         {
673cdf0e10cSrcweir             SwFmtURL aURL ( static_cast < const :: SwFmtURL & > ( rFromSet.Get ( RES_URL ) ) );
674cdf0e10cSrcweir             if(pURL)
675cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aURL).PutValue(*pURL, MID_URL_URL);
676cdf0e10cSrcweir             if(pTarget)
677cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aURL).PutValue(*pTarget, MID_URL_TARGET);
678cdf0e10cSrcweir             if(pHyLNm)
679cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aURL).PutValue(*pHyLNm, MID_URL_HYPERLINKNAME  );
680cdf0e10cSrcweir             if(pHySMp)
681cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aURL).PutValue(*pHySMp, MID_URL_SERVERMAP);
682cdf0e10cSrcweir             rToSet.Put(aURL);
683cdf0e10cSrcweir         }
684cdf0e10cSrcweir     }
685cdf0e10cSrcweir     const ::uno::Any* pL = 0;
686cdf0e10cSrcweir     GetProperty(RES_LR_SPACE, MID_L_MARGIN|CONVERT_TWIPS, pL );
687cdf0e10cSrcweir     const ::uno::Any* pR = 0;
688cdf0e10cSrcweir     GetProperty(RES_LR_SPACE, MID_R_MARGIN|CONVERT_TWIPS, pR );
689cdf0e10cSrcweir     if(pL||pR)
690cdf0e10cSrcweir     {
691cdf0e10cSrcweir         SvxLRSpaceItem aLR ( static_cast < const :: SvxLRSpaceItem & > ( rFromSet.Get ( RES_LR_SPACE ) ) );
692cdf0e10cSrcweir         if(pL)
693cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aLR).PutValue(*pL, MID_L_MARGIN|CONVERT_TWIPS);
694cdf0e10cSrcweir         if(pR)
695cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS);
696cdf0e10cSrcweir         rToSet.Put(aLR);
697cdf0e10cSrcweir     }
698cdf0e10cSrcweir     const ::uno::Any* pT = 0;
699cdf0e10cSrcweir     GetProperty(RES_UL_SPACE, MID_UP_MARGIN|CONVERT_TWIPS, pT );
700cdf0e10cSrcweir     const ::uno::Any* pB = 0;
701cdf0e10cSrcweir     GetProperty(RES_UL_SPACE, MID_LO_MARGIN|CONVERT_TWIPS, pB );
702cdf0e10cSrcweir     if(pT||pB)
703cdf0e10cSrcweir     {
704cdf0e10cSrcweir         SvxULSpaceItem aTB ( static_cast < const :: SvxULSpaceItem &> ( rFromSet.Get ( RES_UL_SPACE ) ) );
705cdf0e10cSrcweir         if(pT)
706cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aTB).PutValue(*pT, MID_UP_MARGIN|CONVERT_TWIPS);
707cdf0e10cSrcweir         if(pB)
708cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aTB).PutValue(*pB, MID_LO_MARGIN|CONVERT_TWIPS);
709cdf0e10cSrcweir         rToSet.Put(aTB);
710cdf0e10cSrcweir     }
711cdf0e10cSrcweir     const ::uno::Any* pOp;
712cdf0e10cSrcweir     if(GetProperty(RES_OPAQUE, 0, pOp))
713cdf0e10cSrcweir     {
714cdf0e10cSrcweir         SvxOpaqueItem aOp ( static_cast < const :: SvxOpaqueItem& > ( rFromSet.Get ( RES_OPAQUE ) ) );
715cdf0e10cSrcweir         bRet &= ((SfxPoolItem&)aOp).PutValue(*pOp, 0);
716cdf0e10cSrcweir         rToSet.Put(aOp);
717cdf0e10cSrcweir     }
718cdf0e10cSrcweir     const ::uno::Any* pPrt;
719cdf0e10cSrcweir     if(GetProperty(RES_PRINT, 0, pPrt))
720cdf0e10cSrcweir     {
721cdf0e10cSrcweir         SvxPrintItem aPrt ( static_cast < const :: SvxPrintItem & > ( rFromSet.Get ( RES_PRINT ) ) );
722cdf0e10cSrcweir         bRet &= ((SfxPoolItem&)aPrt).PutValue(*pPrt, 0);
723cdf0e10cSrcweir         rToSet.Put(aPrt);
724cdf0e10cSrcweir     }
725cdf0e10cSrcweir     const ::uno::Any* pSh;
726cdf0e10cSrcweir     if(GetProperty(RES_SHADOW, CONVERT_TWIPS, pSh))
727cdf0e10cSrcweir     {
728cdf0e10cSrcweir         SvxShadowItem aSh ( static_cast < const :: SvxShadowItem& > ( rFromSet.Get ( RES_SHADOW ) ) );
729cdf0e10cSrcweir         bRet &= ((SfxPoolItem&)aSh).PutValue(*pSh, CONVERT_TWIPS);
730cdf0e10cSrcweir         rToSet.Put(aSh);
731cdf0e10cSrcweir     }
732cdf0e10cSrcweir     const ::uno::Any* pSur      = 0;
733cdf0e10cSrcweir     GetProperty(RES_SURROUND, MID_SURROUND_SURROUNDTYPE, pSur);
734cdf0e10cSrcweir     const ::uno::Any* pSurAnch = 0;
735cdf0e10cSrcweir     GetProperty(RES_SURROUND, MID_SURROUND_ANCHORONLY, pSurAnch);
736cdf0e10cSrcweir     if(pSur || pSurAnch)
737cdf0e10cSrcweir     {
738cdf0e10cSrcweir         SwFmtSurround aSrnd ( static_cast < const :: SwFmtSurround & > ( rFromSet.Get ( RES_SURROUND ) ) );
739cdf0e10cSrcweir         if(pSur)
740cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE );
741cdf0e10cSrcweir         if(pSurAnch)
742cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSurAnch, MID_SURROUND_ANCHORONLY);
743cdf0e10cSrcweir         rToSet.Put(aSrnd);
744cdf0e10cSrcweir     }
745cdf0e10cSrcweir     const ::uno::Any* pLeft        = 0;
746cdf0e10cSrcweir     GetProperty(RES_BOX, LEFT_BORDER  |CONVERT_TWIPS,    pLeft  );
747cdf0e10cSrcweir     const ::uno::Any* pRight       = 0;
748cdf0e10cSrcweir     GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER ,    pRight );
749cdf0e10cSrcweir     const ::uno::Any* pTop         = 0;
750cdf0e10cSrcweir     GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER     , pTop   );
751cdf0e10cSrcweir     const ::uno::Any* pBottom  = 0;
752cdf0e10cSrcweir     GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER,    pBottom);
753cdf0e10cSrcweir     const ::uno::Any* pDistance    = 0;
754cdf0e10cSrcweir     GetProperty(RES_BOX, CONVERT_TWIPS|BORDER_DISTANCE,  pDistance);
755cdf0e10cSrcweir     const ::uno::Any* pLeftDistance    = 0;
756cdf0e10cSrcweir     GetProperty(RES_BOX, CONVERT_TWIPS|LEFT_BORDER_DISTANCE, pLeftDistance);
757cdf0e10cSrcweir     const ::uno::Any* pRightDistance   = 0;
758cdf0e10cSrcweir     GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE,    pRightDistance);
759cdf0e10cSrcweir     const ::uno::Any* pTopDistance     = 0;
760cdf0e10cSrcweir     GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER_DISTANCE,  pTopDistance);
761cdf0e10cSrcweir     const ::uno::Any* pBottomDistance  = 0;
762cdf0e10cSrcweir     GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE,   pBottomDistance);
763cdf0e10cSrcweir     if( pLeft || pRight || pTop ||  pBottom || pDistance ||
764cdf0e10cSrcweir         pLeftDistance  || pRightDistance || pTopDistance || pBottomDistance )
765cdf0e10cSrcweir     {
766cdf0e10cSrcweir         SvxBoxItem aBox ( static_cast < const :: SvxBoxItem & > ( rFromSet.Get ( RES_BOX ) ) );
767cdf0e10cSrcweir         if( pLeft )
768cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aBox).PutValue(*pLeft, CONVERT_TWIPS|LEFT_BORDER );
769cdf0e10cSrcweir         if( pRight )
770cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aBox).PutValue(*pRight, CONVERT_TWIPS|RIGHT_BORDER );
771cdf0e10cSrcweir         if( pTop )
772cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aBox).PutValue(*pTop, CONVERT_TWIPS|TOP_BORDER);
773cdf0e10cSrcweir         if( pBottom )
774cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aBox).PutValue(*pBottom, CONVERT_TWIPS|BOTTOM_BORDER);
775cdf0e10cSrcweir         if( pDistance )
776cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aBox).PutValue(*pDistance, CONVERT_TWIPS|BORDER_DISTANCE);
777cdf0e10cSrcweir         if( pLeftDistance )
778cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aBox).PutValue(*pLeftDistance, CONVERT_TWIPS|LEFT_BORDER_DISTANCE);
779cdf0e10cSrcweir         if( pRightDistance )
780cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aBox).PutValue(*pRightDistance, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE);
781cdf0e10cSrcweir         if( pTopDistance )
782cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aBox).PutValue(*pTopDistance, CONVERT_TWIPS|TOP_BORDER_DISTANCE);
783cdf0e10cSrcweir         if( pBottomDistance )
784cdf0e10cSrcweir             bRet &= ((SfxPoolItem&)aBox).PutValue(*pBottomDistance, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE);
785cdf0e10cSrcweir         rToSet.Put(aBox);
786cdf0e10cSrcweir     }
787cdf0e10cSrcweir     {
788cdf0e10cSrcweir         const ::uno::Any* pRelH = 0;
789cdf0e10cSrcweir         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_HEIGHT, pRelH);
790cdf0e10cSrcweir         const ::uno::Any* pRelW = 0;
791cdf0e10cSrcweir         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_WIDTH, pRelW);
792cdf0e10cSrcweir         const ::uno::Any* pSyncWidth = 0;
793cdf0e10cSrcweir         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT, pSyncWidth);
794cdf0e10cSrcweir         const ::uno::Any* pSyncHeight = 0;
795cdf0e10cSrcweir         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH, pSyncHeight);
796cdf0e10cSrcweir         const ::uno::Any* pWidth = 0;
797cdf0e10cSrcweir         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS, pWidth);
798cdf0e10cSrcweir         const ::uno::Any* pHeight = 0;
799cdf0e10cSrcweir         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS, pHeight);
800cdf0e10cSrcweir         const ::uno::Any* pSize = 0;
801cdf0e10cSrcweir         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE|CONVERT_TWIPS, pSize);
802cdf0e10cSrcweir         const ::uno::Any* pSizeType = 0;
803cdf0e10cSrcweir         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE_TYPE, pSizeType);
804cdf0e10cSrcweir         const ::uno::Any* pWidthType = 0;
805cdf0e10cSrcweir         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH_TYPE, pWidthType);
806cdf0e10cSrcweir         if( pWidth || pHeight ||pRelH || pRelW || pSize ||pSizeType ||
807cdf0e10cSrcweir             pWidthType ||pSyncWidth || pSyncHeight )
808cdf0e10cSrcweir         {
809cdf0e10cSrcweir             rSizeFound = sal_True;
810cdf0e10cSrcweir             SwFmtFrmSize aFrmSz ( static_cast < const :: SwFmtFrmSize& > ( rFromSet.Get ( RES_FRM_SIZE ) ) );
811cdf0e10cSrcweir             if(pWidth)
812cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH|CONVERT_TWIPS);
813cdf0e10cSrcweir             if(pHeight)
814cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pHeight, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS);
815cdf0e10cSrcweir             if(pRelH )
816cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pRelH, MID_FRMSIZE_REL_HEIGHT);
817cdf0e10cSrcweir             if(pRelW )
818cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pRelW, MID_FRMSIZE_REL_WIDTH);
819cdf0e10cSrcweir             if(pSyncWidth)
820cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSyncWidth, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT);
821cdf0e10cSrcweir             if(pSyncHeight)
822cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSyncHeight, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH);
823cdf0e10cSrcweir             if(pSize)
824cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSize, MID_FRMSIZE_SIZE|CONVERT_TWIPS);
825cdf0e10cSrcweir             if(pSizeType)
826cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSizeType, MID_FRMSIZE_SIZE_TYPE);
827cdf0e10cSrcweir             if(pWidthType)
828cdf0e10cSrcweir                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pWidthType, MID_FRMSIZE_WIDTH_TYPE);
829cdf0e10cSrcweir             if(!aFrmSz.GetWidth())
830cdf0e10cSrcweir                 aFrmSz.SetWidth(MINFLY);
831cdf0e10cSrcweir             if(!aFrmSz.GetHeight())
832cdf0e10cSrcweir                 aFrmSz.SetHeight(MINFLY);
833cdf0e10cSrcweir             rToSet.Put(aFrmSz);
834cdf0e10cSrcweir         }
835cdf0e10cSrcweir         else
836cdf0e10cSrcweir         {
837cdf0e10cSrcweir             rSizeFound = sal_False;
838cdf0e10cSrcweir             SwFmtFrmSize aFrmSz;
839cdf0e10cSrcweir             awt::Size aSize;
840cdf0e10cSrcweir             aSize.Width = 2 * MM50;
841cdf0e10cSrcweir             aSize.Height = 2 * MM50;
842cdf0e10cSrcweir             ::uno::Any aSizeVal;
843cdf0e10cSrcweir             aSizeVal <<= aSize;
844cdf0e10cSrcweir             ((SfxPoolItem&)aFrmSz).PutValue(aSizeVal, MID_FRMSIZE_SIZE|CONVERT_TWIPS);
845cdf0e10cSrcweir             rToSet.Put(aFrmSz);
846cdf0e10cSrcweir         }
847cdf0e10cSrcweir     }
848cdf0e10cSrcweir     const ::uno::Any* pFrameDirection = 0;
849cdf0e10cSrcweir     GetProperty(RES_FRAMEDIR, 0, pFrameDirection);
850cdf0e10cSrcweir     if(pFrameDirection)
851cdf0e10cSrcweir     {
852cdf0e10cSrcweir         SvxFrameDirectionItem aAttr(FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR);
853cdf0e10cSrcweir         aAttr.PutValue(*pFrameDirection, 0);
854cdf0e10cSrcweir         rToSet.Put(aAttr);
855cdf0e10cSrcweir     }
856cdf0e10cSrcweir     const ::uno::Any* pUnknown = 0;
857cdf0e10cSrcweir     GetProperty(RES_UNKNOWNATR_CONTAINER, 0, pUnknown);
858cdf0e10cSrcweir     if(pUnknown)
859cdf0e10cSrcweir     {
860cdf0e10cSrcweir         SvXMLAttrContainerItem aAttr(RES_UNKNOWNATR_CONTAINER);
861cdf0e10cSrcweir         aAttr.PutValue(*pUnknown, 0);
862cdf0e10cSrcweir         rToSet.Put(aAttr);
863cdf0e10cSrcweir     }
864cdf0e10cSrcweir 
865cdf0e10cSrcweir     // DVO, OD 01.10.2003 #i18732#
866cdf0e10cSrcweir     const ::uno::Any* pFollowTextFlow = 0;
867cdf0e10cSrcweir     GetProperty(RES_FOLLOW_TEXT_FLOW, 0, pFollowTextFlow);
868cdf0e10cSrcweir     if ( pFollowTextFlow )
869cdf0e10cSrcweir     {
870cdf0e10cSrcweir         SwFmtFollowTextFlow aFmtFollowTextFlow;
871cdf0e10cSrcweir         aFmtFollowTextFlow.PutValue(*pFollowTextFlow, 0);
872cdf0e10cSrcweir         rToSet.Put(aFmtFollowTextFlow);
873cdf0e10cSrcweir     }
874e800f12eSJian Hong Cheng     //Begin Bug 119922
875e800f12eSJian Hong Cheng     else if ( bOasis )
876e800f12eSJian Hong Cheng         rToSet.Put( SwFmtFollowTextFlow() );
877e800f12eSJian Hong Cheng     //End Bug 119922
878cdf0e10cSrcweir 
879cdf0e10cSrcweir     // OD 2004-05-04 #i28701# - RES_WRAP_INFLUENCE_ON_OBJPOS
880cdf0e10cSrcweir     const ::uno::Any* pWrapInfluenceOnObjPos = 0;
881cdf0e10cSrcweir     GetProperty(RES_WRAP_INFLUENCE_ON_OBJPOS, MID_WRAP_INFLUENCE, pWrapInfluenceOnObjPos);
882cdf0e10cSrcweir     if ( pWrapInfluenceOnObjPos )
883cdf0e10cSrcweir     {
884cdf0e10cSrcweir         SwFmtWrapInfluenceOnObjPos aFmtWrapInfluenceOnObjPos;
885cdf0e10cSrcweir         aFmtWrapInfluenceOnObjPos.PutValue( *pWrapInfluenceOnObjPos, MID_WRAP_INFLUENCE );
886cdf0e10cSrcweir         rToSet.Put(aFmtWrapInfluenceOnObjPos);
887cdf0e10cSrcweir     }
888cdf0e10cSrcweir 
889cdf0e10cSrcweir     return bRet;
890cdf0e10cSrcweir }
891cdf0e10cSrcweir 
892cdf0e10cSrcweir class SwFrameProperties_Impl : public BaseFrameProperties_Impl
893cdf0e10cSrcweir {
894cdf0e10cSrcweir public:
895cdf0e10cSrcweir     SwFrameProperties_Impl();
~SwFrameProperties_Impl()896cdf0e10cSrcweir     virtual ~SwFrameProperties_Impl(){}
897cdf0e10cSrcweir 
898cdf0e10cSrcweir     virtual sal_Bool        AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound);
899cdf0e10cSrcweir };
900cdf0e10cSrcweir 
SwFrameProperties_Impl()901cdf0e10cSrcweir SwFrameProperties_Impl::SwFrameProperties_Impl():
902cdf0e10cSrcweir     BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME)*/ )
903cdf0e10cSrcweir {
904cdf0e10cSrcweir }
905cdf0e10cSrcweir 
lcl_FillCol(SfxItemSet & rToSet,const::SfxItemSet & rFromSet,const::uno::Any * pAny)906cdf0e10cSrcweir inline void lcl_FillCol ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, const :: uno::Any *pAny)
907cdf0e10cSrcweir {
908cdf0e10cSrcweir     if ( pAny )
909cdf0e10cSrcweir     {
910cdf0e10cSrcweir         SwFmtCol aCol ( static_cast < const :: SwFmtCol & > ( rFromSet.Get ( RES_COL ) ) );
911cdf0e10cSrcweir         ((SfxPoolItem&)aCol).PutValue( *pAny, MID_COLUMNS);
912cdf0e10cSrcweir         rToSet.Put(aCol);
913cdf0e10cSrcweir     }
914cdf0e10cSrcweir }
AnyToItemSet(SwDoc * pDoc,SfxItemSet & rSet,SfxItemSet &,sal_Bool & rSizeFound)91551786248SOliver-Rainer Wittmann sal_Bool SwFrameProperties_Impl::AnyToItemSet(
91651786248SOliver-Rainer Wittmann     SwDoc *pDoc,
91751786248SOliver-Rainer Wittmann     SfxItemSet& rSet,
91851786248SOliver-Rainer Wittmann     SfxItemSet&,
91951786248SOliver-Rainer Wittmann     sal_Bool& rSizeFound )
920cdf0e10cSrcweir {
92151786248SOliver-Rainer Wittmann     sal_Bool bRet = sal_False;
922cdf0e10cSrcweir 
92351786248SOliver-Rainer Wittmann     SwDocStyleSheet* pStyle = NULL;
92451786248SOliver-Rainer Wittmann     const ::uno::Any *pStyleName;
925cdf0e10cSrcweir     if ( GetProperty( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
926cdf0e10cSrcweir     {
92751786248SOliver-Rainer Wittmann         OUString sTmpStylename;
92851786248SOliver-Rainer Wittmann         *pStyleName >>= sTmpStylename;
92951786248SOliver-Rainer Wittmann         String sStylename;
93051786248SOliver-Rainer Wittmann         SwStyleNameMapper::FillUIName( String(sTmpStylename), sStylename, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, sal_True );
93151786248SOliver-Rainer Wittmann         pStyle =
93251786248SOliver-Rainer Wittmann             (SwDocStyleSheet*) pDoc->GetDocShell()->GetStyleSheetPool()->Find( sStylename, SFX_STYLE_FAMILY_FRAME );
933cdf0e10cSrcweir     }
934cdf0e10cSrcweir 
935cdf0e10cSrcweir     const ::uno::Any* pColumns = NULL;
936cdf0e10cSrcweir     GetProperty( RES_COL, MID_COLUMNS, pColumns );
93751786248SOliver-Rainer Wittmann     if ( pStyle != NULL )
938cdf0e10cSrcweir     {
939cdf0e10cSrcweir         rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *pStyle ) );
940cdf0e10cSrcweir         const ::SfxItemSet *pItemSet = &xStyle->GetItemSet();
941cdf0e10cSrcweir         bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
942cdf0e10cSrcweir         lcl_FillCol( rSet, *pItemSet, pColumns );
943cdf0e10cSrcweir     }
944cdf0e10cSrcweir     else
945cdf0e10cSrcweir     {
946cdf0e10cSrcweir         const ::SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME )->GetAttrSet();
947cdf0e10cSrcweir         bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
948cdf0e10cSrcweir         lcl_FillCol( rSet, *pItemSet, pColumns );
949cdf0e10cSrcweir     }
95051786248SOliver-Rainer Wittmann 
951cdf0e10cSrcweir     const ::uno::Any* pEdit;
952cdf0e10cSrcweir     if ( GetProperty( RES_EDIT_IN_READONLY, 0, pEdit ) )
953cdf0e10cSrcweir     {
954cdf0e10cSrcweir         SfxBoolItem aBool( RES_EDIT_IN_READONLY );
955cdf0e10cSrcweir         ( (SfxPoolItem&) aBool ).PutValue( *pEdit, 0 );
956cdf0e10cSrcweir         rSet.Put( aBool );
957cdf0e10cSrcweir     }
95851786248SOliver-Rainer Wittmann 
959cdf0e10cSrcweir     return bRet;
960cdf0e10cSrcweir }
961cdf0e10cSrcweir /****************************************************************************
962cdf0e10cSrcweir     Grafik-Descriptor
963cdf0e10cSrcweir ****************************************************************************/
964cdf0e10cSrcweir class SwGraphicProperties_Impl : public BaseFrameProperties_Impl
965cdf0e10cSrcweir {
966cdf0e10cSrcweir public:
967cdf0e10cSrcweir     SwGraphicProperties_Impl();
~SwGraphicProperties_Impl()968cdf0e10cSrcweir     virtual ~SwGraphicProperties_Impl(){}
969cdf0e10cSrcweir 
970cdf0e10cSrcweir     virtual sal_Bool                AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound);
971cdf0e10cSrcweir };
972cdf0e10cSrcweir 
SwGraphicProperties_Impl()973cdf0e10cSrcweir SwGraphicProperties_Impl::SwGraphicProperties_Impl( ) :
974cdf0e10cSrcweir     BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC)*/ )
975cdf0e10cSrcweir {
976cdf0e10cSrcweir }
977cdf0e10cSrcweir 
978cdf0e10cSrcweir 
lcl_FillMirror(SfxItemSet & rToSet,const::SfxItemSet & rFromSet,const::uno::Any * pHEvenMirror,const::uno::Any * pHOddMirror,const::uno::Any * pVMirror,sal_Bool & rRet)979cdf0e10cSrcweir inline void lcl_FillMirror ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, const ::uno::Any *pHEvenMirror, const ::uno::Any *pHOddMirror, const ::uno::Any *pVMirror, sal_Bool &rRet )
980cdf0e10cSrcweir {
981cdf0e10cSrcweir     if(pHEvenMirror || pHOddMirror || pVMirror )
982cdf0e10cSrcweir     {
983cdf0e10cSrcweir         SwMirrorGrf aMirror ( static_cast < const :: SwMirrorGrf& > ( rFromSet.Get ( RES_GRFATR_MIRRORGRF ) ) );
984cdf0e10cSrcweir         if(pHEvenMirror)
985cdf0e10cSrcweir             rRet &= ((SfxPoolItem&)aMirror).PutValue(*pHEvenMirror, MID_MIRROR_HORZ_EVEN_PAGES);
986cdf0e10cSrcweir         if(pHOddMirror)
987cdf0e10cSrcweir             rRet &= ((SfxPoolItem&)aMirror).PutValue(*pHOddMirror, MID_MIRROR_HORZ_ODD_PAGES);
988cdf0e10cSrcweir         if(pVMirror)
989cdf0e10cSrcweir             rRet &= ((SfxPoolItem&)aMirror).PutValue(*pVMirror, MID_MIRROR_VERT);
990cdf0e10cSrcweir         rToSet.Put(aMirror);
991cdf0e10cSrcweir     }
992cdf0e10cSrcweir }
993cdf0e10cSrcweir 
AnyToItemSet(SwDoc * pDoc,SfxItemSet & rFrmSet,SfxItemSet & rGrSet,sal_Bool & rSizeFound)994cdf0e10cSrcweir sal_Bool SwGraphicProperties_Impl::AnyToItemSet(
995cdf0e10cSrcweir     SwDoc* pDoc,
996cdf0e10cSrcweir     SfxItemSet& rFrmSet,
997cdf0e10cSrcweir     SfxItemSet& rGrSet,
998cdf0e10cSrcweir     sal_Bool& rSizeFound )
999cdf0e10cSrcweir {
10006b7f75f9SOliver-Rainer Wittmann     sal_Bool bRet = sal_False;
1001cdf0e10cSrcweir 
10026b7f75f9SOliver-Rainer Wittmann     SwDocStyleSheet* pStyle = NULL;
10036b7f75f9SOliver-Rainer Wittmann     const ::uno::Any *pStyleName;
1004cdf0e10cSrcweir     if ( GetProperty( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
1005cdf0e10cSrcweir     {
10066b7f75f9SOliver-Rainer Wittmann         OUString sTmpStylename;
10076b7f75f9SOliver-Rainer Wittmann         *pStyleName >>= sTmpStylename;
10086b7f75f9SOliver-Rainer Wittmann         String sStylename;
10096b7f75f9SOliver-Rainer Wittmann         SwStyleNameMapper::FillUIName( String(sTmpStylename), sStylename, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, sal_True );
10106b7f75f9SOliver-Rainer Wittmann         pStyle =
10116b7f75f9SOliver-Rainer Wittmann             (SwDocStyleSheet*) pDoc->GetDocShell()->GetStyleSheetPool()->Find( sStylename, SFX_STYLE_FAMILY_FRAME );
1012cdf0e10cSrcweir     }
1013cdf0e10cSrcweir 
1014cdf0e10cSrcweir     const ::uno::Any* pHEvenMirror = 0;
1015cdf0e10cSrcweir     const ::uno::Any* pHOddMirror = 0;
1016cdf0e10cSrcweir     const ::uno::Any* pVMirror = 0;
1017cdf0e10cSrcweir     GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_EVEN_PAGES, pHEvenMirror);
1018cdf0e10cSrcweir     GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_ODD_PAGES, pHOddMirror);
1019cdf0e10cSrcweir     GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_VERT, pVMirror);
1020cdf0e10cSrcweir 
10216b7f75f9SOliver-Rainer Wittmann     if ( pStyle != NULL )
1022cdf0e10cSrcweir     {
1023cdf0e10cSrcweir         rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet(*pStyle) );
1024cdf0e10cSrcweir         const :: SfxItemSet *pItemSet = &xStyle->GetItemSet();
1025e800f12eSJian Hong Cheng         sal_Bool bOasis = sal_False;
1026d4302b39SOliver-Rainer Wittmann         {
1027d4302b39SOliver-Rainer Wittmann             const SfxMedium* pMedium = pDoc->GetDocShell()->GetMedium();
10286b7f75f9SOliver-Rainer Wittmann             const SfxFilter * pFilter = pMedium != NULL
1029d4302b39SOliver-Rainer Wittmann                                         ? pMedium->GetFilter()
1030d4302b39SOliver-Rainer Wittmann                                         : NULL;
10316b7f75f9SOliver-Rainer Wittmann             if ( pFilter != NULL )
1032d4302b39SOliver-Rainer Wittmann             {
1033e800f12eSJian Hong Cheng                 bOasis = pFilter->GetVersion() > SOFFICE_FILEFORMAT_60;
1034d4302b39SOliver-Rainer Wittmann             }
1035d4302b39SOliver-Rainer Wittmann         }
1036e800f12eSJian Hong Cheng         bRet = FillBaseProperties( rFrmSet, *pItemSet, rSizeFound, bOasis );
1037cdf0e10cSrcweir         lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
1038cdf0e10cSrcweir     }
1039cdf0e10cSrcweir     else
1040cdf0e10cSrcweir     {
1041cdf0e10cSrcweir         const :: SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC )->GetAttrSet();
1042cdf0e10cSrcweir         bRet = FillBaseProperties(rFrmSet, *pItemSet, rSizeFound);
1043cdf0e10cSrcweir         lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
1044cdf0e10cSrcweir     }
1045cdf0e10cSrcweir 
1046cdf0e10cSrcweir     static const ::sal_uInt16 nIDs[] =
1047cdf0e10cSrcweir     {
1048cdf0e10cSrcweir         RES_GRFATR_CROPGRF,
1049cdf0e10cSrcweir         RES_GRFATR_ROTATION,
1050cdf0e10cSrcweir         RES_GRFATR_LUMINANCE,
1051cdf0e10cSrcweir         RES_GRFATR_CONTRAST,
1052cdf0e10cSrcweir         RES_GRFATR_CHANNELR,
1053cdf0e10cSrcweir         RES_GRFATR_CHANNELG,
1054cdf0e10cSrcweir         RES_GRFATR_CHANNELB,
1055cdf0e10cSrcweir         RES_GRFATR_GAMMA,
1056cdf0e10cSrcweir         RES_GRFATR_INVERT,
1057cdf0e10cSrcweir         RES_GRFATR_TRANSPARENCY,
1058cdf0e10cSrcweir         RES_GRFATR_DRAWMODE,
1059cdf0e10cSrcweir         0
1060cdf0e10cSrcweir     };
1061cdf0e10cSrcweir     const ::uno::Any* pAny;
1062cdf0e10cSrcweir     for ( sal_Int16 nIndex = 0; nIDs[nIndex]; nIndex++ )
1063cdf0e10cSrcweir     {
10646b7f75f9SOliver-Rainer Wittmann         const sal_uInt8 nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0;
1065cdf0e10cSrcweir         if ( GetProperty( nIDs[nIndex], nMId, pAny ) )
1066cdf0e10cSrcweir         {
1067cdf0e10cSrcweir             SfxPoolItem* pItem = ::GetDfltAttr( nIDs[nIndex] )->Clone();
1068cdf0e10cSrcweir             bRet &= pItem->PutValue( *pAny, nMId );
1069cdf0e10cSrcweir             rGrSet.Put( *pItem );
1070cdf0e10cSrcweir             delete pItem;
1071cdf0e10cSrcweir         }
1072cdf0e10cSrcweir     }
1073cdf0e10cSrcweir 
1074cdf0e10cSrcweir     return bRet;
1075cdf0e10cSrcweir }
1076cdf0e10cSrcweir 
10776b7f75f9SOliver-Rainer Wittmann 
1078cdf0e10cSrcweir class SwOLEProperties_Impl : public SwFrameProperties_Impl
1079cdf0e10cSrcweir {
1080cdf0e10cSrcweir public:
SwOLEProperties_Impl()1081cdf0e10cSrcweir     SwOLEProperties_Impl() :
1082cdf0e10cSrcweir         SwFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_EMBEDDED_OBJECT)*/ ){}
~SwOLEProperties_Impl()1083cdf0e10cSrcweir     virtual ~SwOLEProperties_Impl(){}
1084cdf0e10cSrcweir 
1085cdf0e10cSrcweir     virtual sal_Bool        AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound);
1086cdf0e10cSrcweir };
1087cdf0e10cSrcweir 
10886b7f75f9SOliver-Rainer Wittmann 
AnyToItemSet(SwDoc * pDoc,SfxItemSet & rFrmSet,SfxItemSet & rSet,sal_Bool & rSizeFound)1089cdf0e10cSrcweir sal_Bool SwOLEProperties_Impl::AnyToItemSet(
10906b7f75f9SOliver-Rainer Wittmann     SwDoc* pDoc,
10916b7f75f9SOliver-Rainer Wittmann     SfxItemSet& rFrmSet,
10926b7f75f9SOliver-Rainer Wittmann     SfxItemSet& rSet,
10936b7f75f9SOliver-Rainer Wittmann     sal_Bool& rSizeFound )
1094cdf0e10cSrcweir {
1095cdf0e10cSrcweir     const ::uno::Any* pTemp;
1096cdf0e10cSrcweir     if ( !GetProperty( FN_UNO_CLSID, 0, pTemp ) && !GetProperty( FN_UNO_STREAM_NAME, 0, pTemp ) )
1097cdf0e10cSrcweir         return sal_False;
1098cdf0e10cSrcweir     SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrmSet, rSet, rSizeFound );
10996b7f75f9SOliver-Rainer Wittmann 
1100cdf0e10cSrcweir     return sal_True;
1101cdf0e10cSrcweir }
1102cdf0e10cSrcweir 
11036b7f75f9SOliver-Rainer Wittmann 
1104cdf0e10cSrcweir /******************************************************************
1105cdf0e10cSrcweir  *  SwXFrame
1106cdf0e10cSrcweir  ******************************************************************/
1107cdf0e10cSrcweir 
getUnoTunnelId()1108cdf0e10cSrcweir const :: uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId()
1109cdf0e10cSrcweir {
1110cdf0e10cSrcweir     static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
1111cdf0e10cSrcweir     return aSeq;
1112cdf0e10cSrcweir }
1113cdf0e10cSrcweir 
getSomething(const::uno::Sequence<sal_Int8> & rId)1114cdf0e10cSrcweir sal_Int64 SAL_CALL SwXFrame::getSomething( const :: uno::Sequence< sal_Int8 >& rId )
1115cdf0e10cSrcweir     throw(uno::RuntimeException)
1116cdf0e10cSrcweir {
1117cdf0e10cSrcweir     if( rId.getLength() == 16
1118cdf0e10cSrcweir         && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
1119cdf0e10cSrcweir                                         rId.getConstArray(), 16 ) )
1120cdf0e10cSrcweir     {
1121cdf0e10cSrcweir         return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
1122cdf0e10cSrcweir     }
1123cdf0e10cSrcweir     return 0;
1124cdf0e10cSrcweir }
1125cdf0e10cSrcweir 
1126cdf0e10cSrcweir TYPEINIT1(SwXFrame, SwClient);
1127cdf0e10cSrcweir 
getImplementationName(void)1128cdf0e10cSrcweir OUString SwXFrame::getImplementationName(void) throw( uno::RuntimeException )
1129cdf0e10cSrcweir {
1130cdf0e10cSrcweir     return C2U("SwXFrame");
1131cdf0e10cSrcweir }
1132cdf0e10cSrcweir 
supportsService(const::OUString & rServiceName)1133cdf0e10cSrcweir sal_Bool SwXFrame::supportsService(const :: OUString& rServiceName) throw( uno::RuntimeException )
1134cdf0e10cSrcweir {
1135cdf0e10cSrcweir     return !rServiceName.compareToAscii("com.sun.star.text.BaseFrame")||
1136cdf0e10cSrcweir                 !rServiceName.compareToAscii("com.sun.star.text.TextContent") ||
1137cdf0e10cSrcweir                     !rServiceName.compareToAscii("com.sun.star.document.LinkTarget");
1138cdf0e10cSrcweir }
1139cdf0e10cSrcweir 
getSupportedServiceNames(void)1140cdf0e10cSrcweir uno::Sequence< OUString > SwXFrame::getSupportedServiceNames(void) throw( uno::RuntimeException )
1141cdf0e10cSrcweir {
1142cdf0e10cSrcweir     uno::Sequence< OUString > aRet(3);
1143cdf0e10cSrcweir     OUString* pArray = aRet.getArray();
1144cdf0e10cSrcweir     pArray[0] = C2U("com.sun.star.text.BaseFrame");
1145cdf0e10cSrcweir     pArray[1] = C2U("com.sun.star.text.TextContent");
1146cdf0e10cSrcweir     pArray[2] = C2U("com.sun.star.document.LinkTarget");
1147cdf0e10cSrcweir     return aRet;
1148cdf0e10cSrcweir }
1149cdf0e10cSrcweir 
1150cdf0e10cSrcweir 
SwXFrame(FlyCntType eSet,const::SfxItemPropertySet * pSet,SwDoc * pDoc)1151cdf0e10cSrcweir SwXFrame::SwXFrame(FlyCntType eSet, const :: SfxItemPropertySet* pSet, SwDoc *pDoc) :
1152cdf0e10cSrcweir     aLstnrCntnr( (container::XNamed*)this),
1153cdf0e10cSrcweir     m_pPropSet(pSet),
1154cdf0e10cSrcweir     m_pDoc ( pDoc ),
1155cdf0e10cSrcweir     eType(eSet),
1156cdf0e10cSrcweir     bIsDescriptor(sal_True),
1157cdf0e10cSrcweir     m_pCopySource( 0 )
1158cdf0e10cSrcweir {
1159cdf0e10cSrcweir     // Register ourselves as a listener to the document (via the page descriptor)
1160cdf0e10cSrcweir     pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
1161cdf0e10cSrcweir     // get the property set for the default style data
1162cdf0e10cSrcweir     // First get the model
1163cdf0e10cSrcweir     uno::Reference < XModel > xModel = pDoc->GetDocShell()->GetBaseModel();
1164cdf0e10cSrcweir     // Ask the model for it's family supplier interface
1165cdf0e10cSrcweir     uno::Reference < XStyleFamiliesSupplier > xFamilySupplier ( xModel, uno::UNO_QUERY );
1166cdf0e10cSrcweir     // Get the style families
1167cdf0e10cSrcweir     uno::Reference < XNameAccess > xFamilies = xFamilySupplier->getStyleFamilies();
1168cdf0e10cSrcweir     // Get the Frame family (and keep it for later)
1169cdf0e10cSrcweir     const ::uno::Any aAny = xFamilies->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "FrameStyles" ) ) );
1170cdf0e10cSrcweir     aAny >>= mxStyleFamily;
1171cdf0e10cSrcweir     // In the derived class, we'll ask mxStyleFamily for the relevant default style
1172cdf0e10cSrcweir     // mxStyleFamily is initialised in the SwXFrame constructor
1173cdf0e10cSrcweir     switch(eType)
1174cdf0e10cSrcweir     {
1175cdf0e10cSrcweir         case FLYCNTTYPE_FRM:
1176cdf0e10cSrcweir         {
1177cdf0e10cSrcweir             uno::Any aAny2 = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Frame" ) ) );
1178cdf0e10cSrcweir             aAny2 >>= mxStyleData;
1179cdf0e10cSrcweir             pProps = new SwFrameProperties_Impl( );
1180cdf0e10cSrcweir         }
1181cdf0e10cSrcweir         break;
1182cdf0e10cSrcweir         case FLYCNTTYPE_GRF:
1183cdf0e10cSrcweir         {
1184cdf0e10cSrcweir             uno::Any aAny2 = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Graphics" ) ) );
1185cdf0e10cSrcweir             aAny2 >>= mxStyleData;
1186cdf0e10cSrcweir             pProps = new SwGraphicProperties_Impl( );
1187cdf0e10cSrcweir         }
1188cdf0e10cSrcweir         break;
1189cdf0e10cSrcweir         case FLYCNTTYPE_OLE:
1190cdf0e10cSrcweir         {
1191cdf0e10cSrcweir             uno::Any aAny2 = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "OLE" ) ) );
1192cdf0e10cSrcweir             aAny2 >>= mxStyleData;
1193cdf0e10cSrcweir             pProps = new SwOLEProperties_Impl( );
1194cdf0e10cSrcweir         }
1195cdf0e10cSrcweir         break;
1196cdf0e10cSrcweir 
1197cdf0e10cSrcweir         default:
1198cdf0e10cSrcweir             ;
1199cdf0e10cSrcweir     }
1200cdf0e10cSrcweir }
1201cdf0e10cSrcweir 
1202cdf0e10cSrcweir 
SwXFrame(SwFrmFmt & rFrmFmt,FlyCntType eSet,const::SfxItemPropertySet * pSet)1203cdf0e10cSrcweir SwXFrame::SwXFrame(SwFrmFmt& rFrmFmt, FlyCntType eSet, const :: SfxItemPropertySet* pSet) :
1204cdf0e10cSrcweir     SwClient( &rFrmFmt ),
1205cdf0e10cSrcweir     aLstnrCntnr( (container::XNamed*)this),
1206cdf0e10cSrcweir     m_pPropSet(pSet),
1207cdf0e10cSrcweir     m_pDoc( 0 ),
1208cdf0e10cSrcweir     eType(eSet),
1209cdf0e10cSrcweir     pProps(0),
1210cdf0e10cSrcweir     bIsDescriptor(sal_False),
1211cdf0e10cSrcweir     m_pCopySource(0)
1212cdf0e10cSrcweir {
1213cdf0e10cSrcweir 
1214cdf0e10cSrcweir }
1215cdf0e10cSrcweir 
~SwXFrame()1216cdf0e10cSrcweir SwXFrame::~SwXFrame()
1217cdf0e10cSrcweir {
1218cdf0e10cSrcweir     delete m_pCopySource;
1219cdf0e10cSrcweir     delete pProps;
1220cdf0e10cSrcweir }
1221cdf0e10cSrcweir 
getName(void)1222cdf0e10cSrcweir OUString SwXFrame::getName(void) throw( uno::RuntimeException )
1223cdf0e10cSrcweir {
1224cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
1225cdf0e10cSrcweir     String sRet;
1226cdf0e10cSrcweir     SwFrmFmt* pFmt = GetFrmFmt();
1227cdf0e10cSrcweir     if(pFmt)
1228cdf0e10cSrcweir         sRet = pFmt->GetName();
1229cdf0e10cSrcweir     else if(bIsDescriptor)
1230cdf0e10cSrcweir         sRet = sName;
1231cdf0e10cSrcweir     else
1232cdf0e10cSrcweir         throw uno::RuntimeException();
1233cdf0e10cSrcweir     return sRet;
1234cdf0e10cSrcweir }
1235cdf0e10cSrcweir 
setName(const::OUString & rName)1236cdf0e10cSrcweir void SwXFrame::setName(const :: OUString& rName) throw( uno::RuntimeException )
1237cdf0e10cSrcweir {
1238cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
1239cdf0e10cSrcweir     SwFrmFmt* pFmt = GetFrmFmt();
1240cdf0e10cSrcweir     String sTmpName(rName);
1241cdf0e10cSrcweir     if(pFmt)
1242cdf0e10cSrcweir     {
1243cdf0e10cSrcweir         pFmt->GetDoc()->SetFlyName((SwFlyFrmFmt&)*pFmt, sTmpName);
1244cdf0e10cSrcweir         if(pFmt->GetName() != sTmpName)
1245cdf0e10cSrcweir         {
1246cdf0e10cSrcweir             throw uno::RuntimeException();
1247cdf0e10cSrcweir         }
1248cdf0e10cSrcweir     }
1249cdf0e10cSrcweir     else if(bIsDescriptor)
1250cdf0e10cSrcweir         sName = sTmpName;
1251cdf0e10cSrcweir     else
1252cdf0e10cSrcweir         throw uno::RuntimeException();
1253cdf0e10cSrcweir }
1254cdf0e10cSrcweir 
getPropertySetInfo(void)1255cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo >  SwXFrame::getPropertySetInfo(void) throw( uno::RuntimeException )
1256cdf0e10cSrcweir {
1257cdf0e10cSrcweir     uno::Reference< beans::XPropertySetInfo >  xRef;
1258cdf0e10cSrcweir     static uno::Reference< beans::XPropertySetInfo >  xFrmRef;
1259cdf0e10cSrcweir     static uno::Reference< beans::XPropertySetInfo >  xGrfRef;
1260cdf0e10cSrcweir     static uno::Reference< beans::XPropertySetInfo >  xOLERef;
1261cdf0e10cSrcweir     switch(eType)
1262cdf0e10cSrcweir     {
1263cdf0e10cSrcweir     case FLYCNTTYPE_FRM:
1264cdf0e10cSrcweir         if( !xFrmRef.is() )
1265cdf0e10cSrcweir             xFrmRef = m_pPropSet->getPropertySetInfo();
1266cdf0e10cSrcweir         xRef = xFrmRef;
1267cdf0e10cSrcweir         break;
1268cdf0e10cSrcweir     case FLYCNTTYPE_GRF:
1269cdf0e10cSrcweir         if( !xGrfRef.is() )
1270cdf0e10cSrcweir             xGrfRef = m_pPropSet->getPropertySetInfo();
1271cdf0e10cSrcweir         xRef = xGrfRef;
1272cdf0e10cSrcweir         break;
1273cdf0e10cSrcweir     case FLYCNTTYPE_OLE:
1274cdf0e10cSrcweir         if( !xOLERef.is() )
1275cdf0e10cSrcweir             xOLERef = m_pPropSet->getPropertySetInfo();
1276cdf0e10cSrcweir         xRef = xOLERef;
1277cdf0e10cSrcweir         break;
1278cdf0e10cSrcweir     default:
1279cdf0e10cSrcweir         ;
1280cdf0e10cSrcweir     }
1281cdf0e10cSrcweir     return xRef;
1282cdf0e10cSrcweir }
1283cdf0e10cSrcweir 
SetSelection(SwPaM & rCopySource)1284cdf0e10cSrcweir void SwXFrame::SetSelection(SwPaM& rCopySource)
1285cdf0e10cSrcweir {
1286cdf0e10cSrcweir     if(m_pCopySource)
1287cdf0e10cSrcweir         delete m_pCopySource;
1288cdf0e10cSrcweir     m_pCopySource = new SwPaM( *rCopySource.Start() );
1289cdf0e10cSrcweir     m_pCopySource->SetMark();
1290cdf0e10cSrcweir     *m_pCopySource->GetMark() = *rCopySource.End();
1291cdf0e10cSrcweir }
1292cdf0e10cSrcweir 
GetOrCreateSdrObject(SwFlyFrmFmt * pFmt)1293cdf0e10cSrcweir SdrObject *SwXFrame::GetOrCreateSdrObject( SwFlyFrmFmt *pFmt )
1294cdf0e10cSrcweir {
1295cdf0e10cSrcweir     SdrObject* pObject = pFmt->FindSdrObject();
1296cdf0e10cSrcweir     if( !pObject )
1297cdf0e10cSrcweir     {
1298cdf0e10cSrcweir         SwDoc *pDoc = pFmt->GetDoc();
1299cdf0e10cSrcweir         // --> OD 2005-08-08 #i52858# - method name changed
130026ea3662SArmin Le Grand         SwDrawModel* pDrawModel = pDoc->GetOrCreateDrawModel();
1301cdf0e10cSrcweir         // <--
1302cdf0e10cSrcweir         SwFlyDrawContact* pContactObject
1303cdf0e10cSrcweir                     = new SwFlyDrawContact( pFmt, pDrawModel );
1304cdf0e10cSrcweir         pObject = pContactObject->GetMaster();
1305cdf0e10cSrcweir 
1306cdf0e10cSrcweir         const :: SwFmtSurround& rSurround = pFmt->GetSurround();
1307cdf0e10cSrcweir         pObject->SetLayer(
1308cdf0e10cSrcweir             ( SURROUND_THROUGHT == rSurround.GetSurround() &&
1309cdf0e10cSrcweir               !pFmt->GetOpaque().GetValue() ) ? pDoc->GetHellId()
1310cdf0e10cSrcweir                                              : pDoc->GetHeavenId() );
1311cdf0e10cSrcweir 
1312cdf0e10cSrcweir         pDrawModel->GetPage(0)->InsertObject( pObject );
1313cdf0e10cSrcweir     }
1314cdf0e10cSrcweir 
1315cdf0e10cSrcweir     return pObject;
1316cdf0e10cSrcweir }
1317cdf0e10cSrcweir 
lcl_GetFrmFmt(const::uno::Any & rValue,SwDoc * pDoc)1318cdf0e10cSrcweir SwFrmFmt *lcl_GetFrmFmt( const :: uno::Any& rValue, SwDoc *pDoc )
1319cdf0e10cSrcweir {
1320cdf0e10cSrcweir     SwFrmFmt *pRet = 0;
1321cdf0e10cSrcweir     SwDocShell* pDocSh = pDoc->GetDocShell();
1322cdf0e10cSrcweir     if(pDocSh)
1323cdf0e10cSrcweir     {
1324cdf0e10cSrcweir         OUString uTemp;
1325cdf0e10cSrcweir         rValue >>= uTemp;
1326cdf0e10cSrcweir         String sStyle;
1327cdf0e10cSrcweir         SwStyleNameMapper::FillUIName(String (uTemp), sStyle, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, sal_True );
1328cdf0e10cSrcweir         SwDocStyleSheet* pStyle =
1329cdf0e10cSrcweir                 (SwDocStyleSheet*)pDocSh->GetStyleSheetPool()->Find(sStyle,
1330cdf0e10cSrcweir                                                     SFX_STYLE_FAMILY_FRAME);
1331cdf0e10cSrcweir         if(pStyle)
1332cdf0e10cSrcweir             pRet = pStyle->GetFrmFmt();
1333cdf0e10cSrcweir     }
1334cdf0e10cSrcweir 
1335cdf0e10cSrcweir     return pRet;
1336cdf0e10cSrcweir }
1337cdf0e10cSrcweir 
setPropertyValue(const::OUString & rPropertyName,const::uno::Any & _rValue)133864b14621SArmin Le Grand void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::Any& _rValue)
1339cdf0e10cSrcweir     throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
1340cdf0e10cSrcweir {
1341cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
1342cdf0e10cSrcweir     SwFrmFmt* pFmt = GetFrmFmt();
1343cdf0e10cSrcweir     const :: SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
1344cdf0e10cSrcweir 
1345cdf0e10cSrcweir     if (!pEntry)
1346cdf0e10cSrcweir         throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1347cdf0e10cSrcweir 
134864b14621SArmin Le Grand     //UUUU
134964b14621SArmin Le Grand     const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM));
135064b14621SArmin Le Grand     uno::Any aValue(_rValue);
135164b14621SArmin Le Grand 
135264b14621SArmin Le Grand     //UUUU check for needed metric translation
135364b14621SArmin Le Grand     if(pEntry->nMemberId & SFX_METRIC_ITEM)
135464b14621SArmin Le Grand     {
135564b14621SArmin Le Grand         bool bDoIt(true);
135664b14621SArmin Le Grand 
135764b14621SArmin Le Grand         if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID)
135864b14621SArmin Le Grand         {
135964b14621SArmin Le Grand             // exception: If these ItemTypes are used, do not convert when these are negative
136064b14621SArmin Le Grand             // since this means they are intended as percent values
136164b14621SArmin Le Grand             sal_Int32 nValue = 0;
136264b14621SArmin Le Grand 
136364b14621SArmin Le Grand             if(aValue >>= nValue)
136464b14621SArmin Le Grand             {
136564b14621SArmin Le Grand                 bDoIt = nValue > 0;
136664b14621SArmin Le Grand             }
136764b14621SArmin Le Grand         }
136864b14621SArmin Le Grand 
136964b14621SArmin Le Grand         if(bDoIt)
137064b14621SArmin Le Grand         {
137164b14621SArmin Le Grand             const SwDoc* pDoc = (IsDescriptor() ? m_pDoc : GetFrmFmt()->GetDoc());
137264b14621SArmin Le Grand             const SfxItemPool& rPool = pDoc->GetAttrPool();
137364b14621SArmin Le Grand             const SfxMapUnit eMapUnit(rPool.GetMetric(pEntry->nWID));
137464b14621SArmin Le Grand 
137564b14621SArmin Le Grand             if(eMapUnit != SFX_MAPUNIT_100TH_MM)
137664b14621SArmin Le Grand             {
137764b14621SArmin Le Grand                 SvxUnoConvertFromMM(eMapUnit, aValue);
137864b14621SArmin Le Grand             }
137964b14621SArmin Le Grand         }
138064b14621SArmin Le Grand     }
138164b14621SArmin Le Grand 
1382cdf0e10cSrcweir     if(pFmt)
1383cdf0e10cSrcweir     {
1384cdf0e10cSrcweir         sal_Bool bNextFrame = sal_False;
1385cdf0e10cSrcweir         if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
1386cdf0e10cSrcweir             throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1387cdf0e10cSrcweir 
1388cdf0e10cSrcweir         SwDoc* pDoc = pFmt->GetDoc();
1389cdf0e10cSrcweir         if ((eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID) ||
1390cdf0e10cSrcweir             (FN_PARAM_COUNTOUR_PP        == pEntry->nWID) ||
1391cdf0e10cSrcweir             (FN_UNO_IS_AUTOMATIC_CONTOUR == pEntry->nWID) ||
1392cdf0e10cSrcweir             (FN_UNO_IS_PIXEL_CONTOUR     == pEntry->nWID) )
1393cdf0e10cSrcweir         {
1394cdf0e10cSrcweir             const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1395cdf0e10cSrcweir             if(pIdx)
1396cdf0e10cSrcweir             {
1397cdf0e10cSrcweir                 SwNodeIndex aIdx(*pIdx, 1);
1398cdf0e10cSrcweir                 SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1399cdf0e10cSrcweir                 if(pEntry->nWID == FN_PARAM_COUNTOUR_PP)
1400cdf0e10cSrcweir                 {
1401cdf0e10cSrcweir                     drawing::PointSequenceSequence aParam;
1402cdf0e10cSrcweir                     if(!aValue.hasValue())
1403cdf0e10cSrcweir                         pNoTxt->SetContour(0);
1404cdf0e10cSrcweir                     else if(aValue >>= aParam)
1405cdf0e10cSrcweir                     {
1406cdf0e10cSrcweir                         PolyPolygon aPoly((sal_uInt16)aParam.getLength());
1407cdf0e10cSrcweir                         for(sal_Int32 i = 0; i < aParam.getLength(); i++)
1408cdf0e10cSrcweir                         {
1409cdf0e10cSrcweir                             const :: drawing::PointSequence* pPointSeq = aParam.getConstArray();
1410cdf0e10cSrcweir                             sal_Int32 nPoints = pPointSeq[i].getLength();
1411cdf0e10cSrcweir                             const :: awt::Point* pPoints = pPointSeq[i].getConstArray();
1412cdf0e10cSrcweir                             Polygon aSet( (sal_uInt16)nPoints );
1413cdf0e10cSrcweir                             for(sal_Int32 j = 0; j < nPoints; j++)
1414cdf0e10cSrcweir                             {
1415cdf0e10cSrcweir                                 Point aPoint(pPoints[j].X, pPoints[j].Y);
1416cdf0e10cSrcweir                                 aSet.SetPoint(aPoint, (sal_uInt16)j);
1417cdf0e10cSrcweir                             }
1418cdf0e10cSrcweir                             // Close polygon if it isn't closed already.
1419cdf0e10cSrcweir                             aSet.Optimize( POLY_OPTIMIZE_CLOSE );
1420cdf0e10cSrcweir                             aPoly.Insert( aSet );
1421cdf0e10cSrcweir                         }
1422cdf0e10cSrcweir                         pNoTxt->SetContourAPI( &aPoly );
1423cdf0e10cSrcweir                     }
1424cdf0e10cSrcweir                     else
1425cdf0e10cSrcweir                         throw lang::IllegalArgumentException();
1426cdf0e10cSrcweir                 }
1427cdf0e10cSrcweir                 else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
1428cdf0e10cSrcweir                 {
1429cdf0e10cSrcweir                     pNoTxt->SetAutomaticContour( *(sal_Bool *)aValue.getValue() );
1430cdf0e10cSrcweir                 }
1431cdf0e10cSrcweir                 else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
1432cdf0e10cSrcweir                 {
1433cdf0e10cSrcweir                     // The IsPixelContour property can only be set if there
1434cdf0e10cSrcweir                     // is no contour, or if the contour has been set by the
1435cdf0e10cSrcweir                     // API itself (or in other words, if the contour isn't
1436cdf0e10cSrcweir                     // used already).
1437cdf0e10cSrcweir                     if( !pNoTxt->_HasContour() ||
1438cdf0e10cSrcweir                         !pNoTxt->IsContourMapModeValid() )
1439cdf0e10cSrcweir                         pNoTxt->SetPixelContour( *(sal_Bool *)aValue.getValue() );
1440cdf0e10cSrcweir                     else
1441cdf0e10cSrcweir                         throw lang::IllegalArgumentException();
1442cdf0e10cSrcweir                 }
1443cdf0e10cSrcweir                 else
1444cdf0e10cSrcweir                 {
1445cdf0e10cSrcweir                     SfxItemSet aSet(pNoTxt->GetSwAttrSet());
1446cdf0e10cSrcweir                     m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
1447cdf0e10cSrcweir                     pNoTxt->SetAttr(aSet);
1448cdf0e10cSrcweir                 }
1449cdf0e10cSrcweir             }
1450cdf0e10cSrcweir         }
1451cdf0e10cSrcweir         // New attribute Title
1452cdf0e10cSrcweir         else if( FN_UNO_TITLE == pEntry->nWID )
1453cdf0e10cSrcweir         {
1454cdf0e10cSrcweir             SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
1455cdf0e10cSrcweir             ASSERT( pFmt,
1456cdf0e10cSrcweir                     "unexpected type of <pFmt> --> crash" );
1457cdf0e10cSrcweir             OUString uTemp;
1458cdf0e10cSrcweir             aValue >>= uTemp;
1459cdf0e10cSrcweir             const String sTitle(uTemp);
1460cdf0e10cSrcweir             // assure that <SdrObject> instance exists.
1461cdf0e10cSrcweir             GetOrCreateSdrObject( pFlyFmt );
1462cdf0e10cSrcweir             pFlyFmt->GetDoc()->SetFlyFrmTitle( *(pFlyFmt), sTitle );
1463cdf0e10cSrcweir         }
1464cdf0e10cSrcweir         // New attribute Description
1465cdf0e10cSrcweir         else if( FN_UNO_DESCRIPTION == pEntry->nWID )
1466cdf0e10cSrcweir         {
1467cdf0e10cSrcweir             SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
1468cdf0e10cSrcweir             ASSERT( pFmt,
1469cdf0e10cSrcweir                     "unexpected type of <pFmt> --> crash" );
1470cdf0e10cSrcweir             OUString uTemp;
1471cdf0e10cSrcweir             aValue >>= uTemp;
1472cdf0e10cSrcweir             const String sDescription(uTemp);
1473cdf0e10cSrcweir             // assure that <SdrObject> instance exists.
1474cdf0e10cSrcweir             GetOrCreateSdrObject( pFlyFmt );
1475cdf0e10cSrcweir             pFlyFmt->GetDoc()->SetFlyFrmDescription( *(pFlyFmt), sDescription );
1476cdf0e10cSrcweir         }
1477cdf0e10cSrcweir         // <--
1478cdf0e10cSrcweir         else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
1479cdf0e10cSrcweir         {
1480cdf0e10cSrcweir             SwFrmFmt *pFrmFmt = lcl_GetFrmFmt( aValue, pFmt->GetDoc() );
1481cdf0e10cSrcweir             if( pFrmFmt )
1482cdf0e10cSrcweir             {
1483cdf0e10cSrcweir                 UnoActionContext aAction(pFmt->GetDoc());
1484cdf0e10cSrcweir 
1485cdf0e10cSrcweir                 SfxItemSet* pSet = 0;
1486cdf0e10cSrcweir                 // --> OD 2004-08-13 #i31771#, #i25798# - No adjustment of
1487cdf0e10cSrcweir                 // anchor ( no call of method <::lcl_ChkAndSetNewAnchor(..)> ),
1488cdf0e10cSrcweir                 // if document is currently in reading mode.
1489cdf0e10cSrcweir                 if ( !pFmt->GetDoc()->IsInReading() )
1490cdf0e10cSrcweir                 {
1491cdf0e10cSrcweir                     // see SwFEShell::SetFrmFmt( SwFrmFmt *pNewFmt, sal_Bool bKeepOrient, Point* pDocPos )
1492cdf0e10cSrcweir                     SwFlyFrm *pFly = 0;
1493cdf0e10cSrcweir                     {
1494cdf0e10cSrcweir                         const :: SwFrmFmt* pFmtXX = pFmt;
1495cdf0e10cSrcweir                         if (PTR_CAST(SwFlyFrmFmt, pFmtXX))
1496cdf0e10cSrcweir                             pFly = ((SwFlyFrmFmt*)pFmtXX)->GetFrm();
1497cdf0e10cSrcweir                     }
1498cdf0e10cSrcweir                     if ( pFly )
1499cdf0e10cSrcweir                     {
1500cdf0e10cSrcweir                         const :: SfxPoolItem* pItem;
1501cdf0e10cSrcweir                         if( SFX_ITEM_SET == pFrmFmt->GetItemState( RES_ANCHOR, sal_False, &pItem ))
1502cdf0e10cSrcweir                         {
1503cdf0e10cSrcweir                             pSet = new SfxItemSet( pDoc->GetAttrPool(), aFrmFmtSetRange );
1504cdf0e10cSrcweir                             pSet->Put( *pItem );
150569a74367SOliver-Rainer Wittmann                             if ( pFmt->GetDoc()->GetEditShell() != NULL
150669a74367SOliver-Rainer Wittmann                                  && !::lcl_ChkAndSetNewAnchor( *(pFmt->GetDoc()->GetEditShell()), *pFly, *pSet ) )
1507cdf0e10cSrcweir                                 delete pSet, pSet = 0;
1508cdf0e10cSrcweir                         }
1509cdf0e10cSrcweir                     }
1510cdf0e10cSrcweir                 }
1511cdf0e10cSrcweir                 // <--
1512cdf0e10cSrcweir 
1513cdf0e10cSrcweir                 pFmt->GetDoc()->SetFrmFmtToFly( *pFmt, *pFrmFmt, pSet, sal_False );
1514cdf0e10cSrcweir                 delete pSet;
1515cdf0e10cSrcweir             }
1516cdf0e10cSrcweir             else
1517cdf0e10cSrcweir                 throw lang::IllegalArgumentException();
1518cdf0e10cSrcweir         }
1519cdf0e10cSrcweir         else if( FN_UNO_GRAPHIC_U_R_L == pEntry->nWID ||
1520cdf0e10cSrcweir                 FN_UNO_GRAPHIC_FILTER == pEntry->nWID)
1521cdf0e10cSrcweir         {
1522cdf0e10cSrcweir             String sGrfName, sFltName;
1523cdf0e10cSrcweir             GraphicObject *pGrfObj = 0;
1524cdf0e10cSrcweir             pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, &sGrfName, &sFltName );
1525cdf0e10cSrcweir             OUString uTemp;
1526cdf0e10cSrcweir             aValue >>= uTemp;
1527cdf0e10cSrcweir             String sTmp(uTemp);
1528cdf0e10cSrcweir             UnoActionContext aAction(pFmt->GetDoc());
1529cdf0e10cSrcweir             if(FN_UNO_GRAPHIC_U_R_L == pEntry->nWID)
1530cdf0e10cSrcweir             {
1531cdf0e10cSrcweir                 if( sTmp.EqualsAscii( sPackageProtocol,
1532cdf0e10cSrcweir                                       0, sizeof( sPackageProtocol )-1 ) )
1533cdf0e10cSrcweir                 {
1534cdf0e10cSrcweir                     pGrfObj = new GraphicObject;
1535cdf0e10cSrcweir                     pGrfObj->SetUserData( sTmp );
1536cdf0e10cSrcweir                     pGrfObj->SetSwapState();
1537cdf0e10cSrcweir                     sGrfName.Erase();
1538cdf0e10cSrcweir                 }
1539cdf0e10cSrcweir                 else if( sTmp.EqualsAscii( sGraphicObjectProtocol,
1540cdf0e10cSrcweir                                            0, sizeof(sGraphicObjectProtocol)-1 ) )
1541cdf0e10cSrcweir                 {
1542cdf0e10cSrcweir                     ByteString sId( sTmp.Copy(sizeof(sGraphicObjectProtocol)-1),
1543cdf0e10cSrcweir                                     RTL_TEXTENCODING_ASCII_US );
1544cdf0e10cSrcweir                     pGrfObj = new GraphicObject( sId );
1545cdf0e10cSrcweir                     sGrfName.Erase();
1546cdf0e10cSrcweir                 }
1547cdf0e10cSrcweir                 else
1548cdf0e10cSrcweir                 {
1549cdf0e10cSrcweir                     sGrfName = sTmp;
1550cdf0e10cSrcweir                 }
1551cdf0e10cSrcweir             }
1552cdf0e10cSrcweir             else
1553cdf0e10cSrcweir             {
1554cdf0e10cSrcweir                 sFltName = sTmp;
1555cdf0e10cSrcweir             }
1556cdf0e10cSrcweir 
1557cdf0e10cSrcweir             const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1558cdf0e10cSrcweir             if(pIdx)
1559cdf0e10cSrcweir             {
1560cdf0e10cSrcweir                 SwNodeIndex aIdx(*pIdx, 1);
1561cdf0e10cSrcweir //              SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1562cdf0e10cSrcweir                 SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
1563cdf0e10cSrcweir                 if(!pGrfNode)
1564cdf0e10cSrcweir                 {
1565cdf0e10cSrcweir                     delete pGrfObj;
1566cdf0e10cSrcweir                     throw uno::RuntimeException();
1567cdf0e10cSrcweir                 }
1568cdf0e10cSrcweir                 SwPaM aGrfPaM(*pGrfNode);
1569cdf0e10cSrcweir                 pFmt->GetDoc()->ReRead( aGrfPaM, sGrfName, sFltName, 0,
1570cdf0e10cSrcweir                                         pGrfObj );
1571cdf0e10cSrcweir             }
1572cdf0e10cSrcweir             delete pGrfObj;
1573cdf0e10cSrcweir         }
1574cdf0e10cSrcweir         else if( FN_UNO_GRAPHIC == pEntry->nWID )
1575cdf0e10cSrcweir         {
1576cdf0e10cSrcweir             uno::Reference< graphic::XGraphic > xGraphic;
1577cdf0e10cSrcweir             aValue >>= xGraphic;
1578cdf0e10cSrcweir             if(xGraphic.is())
1579cdf0e10cSrcweir             {
1580cdf0e10cSrcweir                 const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1581cdf0e10cSrcweir                 if(pIdx)
1582cdf0e10cSrcweir                 {
1583cdf0e10cSrcweir                     SwNodeIndex aIdx(*pIdx, 1);
1584cdf0e10cSrcweir                     SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
1585cdf0e10cSrcweir                     if(!pGrfNode)
1586cdf0e10cSrcweir                     {
1587cdf0e10cSrcweir                         throw uno::RuntimeException();
1588cdf0e10cSrcweir                     }
1589cdf0e10cSrcweir                     SwPaM aGrfPaM(*pGrfNode);
1590cdf0e10cSrcweir                     Graphic aGraphic( xGraphic );
1591cdf0e10cSrcweir                     pFmt->GetDoc()->ReRead( aGrfPaM, String(), String(), &aGraphic, 0 );
1592cdf0e10cSrcweir                 }
1593cdf0e10cSrcweir             }
1594cdf0e10cSrcweir         }
1595cdf0e10cSrcweir         else if( FN_UNO_REPLACEMENT_GRAPHIC_URL == pEntry->nWID || FN_UNO_REPLACEMENT_GRAPHIC == pEntry->nWID )
1596cdf0e10cSrcweir         {
1597cdf0e10cSrcweir             bool bURL = FN_UNO_REPLACEMENT_GRAPHIC_URL == pEntry->nWID;
1598cdf0e10cSrcweir             bool bApply = false;
1599cdf0e10cSrcweir             Graphic aGraphic;
1600cdf0e10cSrcweir             if( bURL )
1601cdf0e10cSrcweir             {
1602cdf0e10cSrcweir                 GraphicObject *pGrfObj = 0;
1603cdf0e10cSrcweir                 OUString aGrfUrl;
1604cdf0e10cSrcweir                 aValue >>= aGrfUrl;
1605cdf0e10cSrcweir 
1606cdf0e10cSrcweir                 // the package URL based graphics are handled in different way currently
1607cdf0e10cSrcweir                 // TODO/LATER: actually this is the correct place to handle them
1608cdf0e10cSrcweir                 ::rtl::OUString aGraphicProtocol( RTL_CONSTASCII_USTRINGPARAM( sGraphicObjectProtocol ) );
1609cdf0e10cSrcweir                 if( aGrfUrl.compareTo( aGraphicProtocol, aGraphicProtocol.getLength() ) == 0 )
1610cdf0e10cSrcweir                 {
1611cdf0e10cSrcweir                     ByteString sId( aGrfUrl.copy(sizeof(sGraphicObjectProtocol)-1).getStr(), RTL_TEXTENCODING_ASCII_US );
1612cdf0e10cSrcweir                     pGrfObj = new GraphicObject( sId );
1613cdf0e10cSrcweir                     aGraphic = pGrfObj->GetGraphic();
1614cdf0e10cSrcweir                     bApply = true;
1615cdf0e10cSrcweir                 }
1616cdf0e10cSrcweir             }
1617cdf0e10cSrcweir             else
1618cdf0e10cSrcweir             {
1619cdf0e10cSrcweir                 uno::Reference< graphic::XGraphic > xGraphic;
1620cdf0e10cSrcweir                 aValue >>= xGraphic;
1621cdf0e10cSrcweir                 if( xGraphic.is() )
1622cdf0e10cSrcweir                 {
1623cdf0e10cSrcweir                     aGraphic = Graphic( xGraphic );
1624cdf0e10cSrcweir                     bApply = true;
1625cdf0e10cSrcweir                 }
1626cdf0e10cSrcweir             }
1627cdf0e10cSrcweir 
1628cdf0e10cSrcweir             if ( bApply )
1629cdf0e10cSrcweir             {
1630cdf0e10cSrcweir                 const :: SwFmtCntnt* pCnt = &pFmt->GetCntnt();
1631cdf0e10cSrcweir                 if ( pCnt->GetCntntIdx() && pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ] )
1632cdf0e10cSrcweir                 {
1633cdf0e10cSrcweir                     SwOLENode* pOleNode =  pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode();
1634cdf0e10cSrcweir 
1635cdf0e10cSrcweir                     if ( pOleNode )
1636cdf0e10cSrcweir                     {
1637cdf0e10cSrcweir                         svt::EmbeddedObjectRef xObj = pOleNode->GetOLEObj().GetObject();
1638cdf0e10cSrcweir 
1639cdf0e10cSrcweir                         ::rtl::OUString aMediaType;
1640cdf0e10cSrcweir                         xObj.SetGraphic( aGraphic, aMediaType );
1641cdf0e10cSrcweir                     }
1642cdf0e10cSrcweir                 }
1643cdf0e10cSrcweir             }
1644cdf0e10cSrcweir         }
1645cdf0e10cSrcweir         else if(0 != (bNextFrame = (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_NEXT_NAME))))
1646cdf0e10cSrcweir             || rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_PREV_NAME)))
1647cdf0e10cSrcweir         {
1648cdf0e10cSrcweir             OUString uTemp;
1649cdf0e10cSrcweir             aValue >>= uTemp;
1650cdf0e10cSrcweir             String sChainName(uTemp);
1651cdf0e10cSrcweir             if(!sChainName.Len())
1652cdf0e10cSrcweir             {
1653cdf0e10cSrcweir                 if(bNextFrame)
1654cdf0e10cSrcweir                     pDoc->Unchain(*pFmt);
1655cdf0e10cSrcweir                 else
1656cdf0e10cSrcweir                 {
1657cdf0e10cSrcweir                     SwFmtChain aChain( pFmt->GetChain() );
1658cdf0e10cSrcweir                     SwFrmFmt *pPrev = aChain.GetPrev();
1659cdf0e10cSrcweir                     if(pPrev)
1660cdf0e10cSrcweir                         pDoc->Unchain(*pPrev);
1661cdf0e10cSrcweir                 }
1662cdf0e10cSrcweir             }
1663cdf0e10cSrcweir             else
1664cdf0e10cSrcweir             {
1665cdf0e10cSrcweir                 sal_uInt16 nCount = pDoc->GetFlyCount(FLYCNTTYPE_FRM);
1666cdf0e10cSrcweir 
1667cdf0e10cSrcweir                 SwFrmFmt* pChain = 0;
1668cdf0e10cSrcweir                 for( sal_uInt16 i = 0; i < nCount; i++)
1669cdf0e10cSrcweir                 {
1670cdf0e10cSrcweir                     SwFrmFmt* pFmt2 = pDoc->GetFlyNum(i, FLYCNTTYPE_FRM);
1671cdf0e10cSrcweir                     if(sChainName == pFmt2->GetName() )
1672cdf0e10cSrcweir                     {
1673cdf0e10cSrcweir                         pChain = pFmt2;
1674cdf0e10cSrcweir                         break;
1675cdf0e10cSrcweir                     }
1676cdf0e10cSrcweir                 }
1677cdf0e10cSrcweir                 if(pChain)
1678cdf0e10cSrcweir                 {
1679cdf0e10cSrcweir                     SwFrmFmt* pSource = bNextFrame ? pFmt : pChain;
1680cdf0e10cSrcweir                     SwFrmFmt* pDest = bNextFrame ? pChain: pFmt;
1681cdf0e10cSrcweir                     pDoc->Chain(*pSource, *pDest);
1682cdf0e10cSrcweir                 }
1683cdf0e10cSrcweir             }
1684cdf0e10cSrcweir         }
1685cdf0e10cSrcweir         else if(FN_UNO_Z_ORDER == pEntry->nWID)
1686cdf0e10cSrcweir         {
1687cdf0e10cSrcweir             sal_Int32 nZOrder = - 1;
1688cdf0e10cSrcweir             aValue >>= nZOrder;
1689cdf0e10cSrcweir             if( nZOrder >= 0)
1690cdf0e10cSrcweir             {
1691cdf0e10cSrcweir                 SdrObject* pObject =
1692cdf0e10cSrcweir                     GetOrCreateSdrObject( (SwFlyFrmFmt*)pFmt );
169326ea3662SArmin Le Grand                 SwDrawModel* pDrawModel = pDoc->GetDrawModel();
1694cdf0e10cSrcweir                 pDrawModel->GetPage(0)->
1695cdf0e10cSrcweir                             SetObjectOrdNum(pObject->GetOrdNum(), nZOrder);
1696cdf0e10cSrcweir             }
1697cdf0e10cSrcweir         }
169864b14621SArmin Le Grand         else if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORFRAME == nMemberId)
1699cdf0e10cSrcweir         {
1700cdf0e10cSrcweir             sal_Bool bDone = sal_False;
1701cdf0e10cSrcweir             uno::Reference<text::XTextFrame> xFrame;
1702cdf0e10cSrcweir             if(aValue >>= xFrame)
1703cdf0e10cSrcweir             {
1704cdf0e10cSrcweir                 uno::Reference<lang::XUnoTunnel> xTunnel(xFrame, uno::UNO_QUERY);
1705cdf0e10cSrcweir                 SwXFrame* pFrame = xTunnel.is() ?
1706cdf0e10cSrcweir                         reinterpret_cast< SwXFrame * >( sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXFrame::getUnoTunnelId()) ))
1707cdf0e10cSrcweir                         : 0;
1708cdf0e10cSrcweir                 if(pFrame && this != pFrame && pFrame->GetFrmFmt() && pFrame->GetFrmFmt()->GetDoc() == pDoc)
1709cdf0e10cSrcweir                 {
1710cdf0e10cSrcweir                     SfxItemSet aSet( pDoc->GetAttrPool(),
1711cdf0e10cSrcweir                                 RES_FRMATR_BEGIN, RES_FRMATR_END - 1 );
1712cdf0e10cSrcweir                     aSet.SetParent(&pFmt->GetAttrSet());
1713cdf0e10cSrcweir                     SwFmtAnchor aAnchor = (const :: SwFmtAnchor&)aSet.Get(pEntry->nWID);
1714cdf0e10cSrcweir 
1715cdf0e10cSrcweir 
1716cdf0e10cSrcweir                     SwPosition aPos(*pFrame->GetFrmFmt()->GetCntnt().GetCntntIdx());
1717cdf0e10cSrcweir                     aAnchor.SetAnchor(&aPos);
1718cdf0e10cSrcweir                     aAnchor.SetType(FLY_AT_FLY);
1719cdf0e10cSrcweir                     aSet.Put(aAnchor);
1720cdf0e10cSrcweir                     pDoc->SetFlyFrmAttr( *pFmt, aSet );
1721cdf0e10cSrcweir                     bDone = sal_True;
1722cdf0e10cSrcweir                 }
1723cdf0e10cSrcweir             }
1724cdf0e10cSrcweir             if(!bDone)
1725cdf0e10cSrcweir                 throw lang::IllegalArgumentException();
1726cdf0e10cSrcweir         }
1727cdf0e10cSrcweir         else
172864b14621SArmin Le Grand         {   //UUUU
172964b14621SArmin Le Grand             // standard UNO API write attributes
173064b14621SArmin Le Grand             // adapt former attr from SvxBrushItem::PutValue to new items XATTR_FILL_FIRST, XATTR_FILL_LAST
1731cdf0e10cSrcweir             SfxItemSet aSet( pDoc->GetAttrPool(),
1732cdf0e10cSrcweir                 RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
1733cdf0e10cSrcweir                 RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
173464b14621SArmin Le Grand 
173564b14621SArmin Le Grand                 //UUUU FillAttribute support
173664b14621SArmin Le Grand                 XATTR_FILL_FIRST, XATTR_FILL_LAST,
173764b14621SArmin Le Grand 
1738cdf0e10cSrcweir                 0L);
173964b14621SArmin Le Grand             bool bDone(false);
1740cdf0e10cSrcweir 
1741cdf0e10cSrcweir             aSet.SetParent(&pFmt->GetAttrSet());
174264b14621SArmin Le Grand 
174364b14621SArmin Le Grand             if(RES_BACKGROUND == pEntry->nWID)
174464b14621SArmin Le Grand             {
174564b14621SArmin Le Grand                 const SwAttrSet& rSet = pFmt->GetAttrSet();
174656b35d86SArmin Le Grand                 const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
174764b14621SArmin Le Grand                 SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
174864b14621SArmin Le Grand 
174964b14621SArmin Le Grand                 aChangedBrushItem.PutValue(aValue, nMemberId);
175064b14621SArmin Le Grand 
175164b14621SArmin Le Grand                 if(!(aChangedBrushItem == aOriginalBrushItem))
175264b14621SArmin Le Grand                 {
175364b14621SArmin Le Grand                     setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet);
175464b14621SArmin Le Grand                     pFmt->GetDoc()->SetFlyFrmAttr( *pFmt, aSet );
175564b14621SArmin Le Grand                 }
175664b14621SArmin Le Grand 
175764b14621SArmin Le Grand                 bDone = true;
175864b14621SArmin Le Grand             }
175964b14621SArmin Le Grand             else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
176064b14621SArmin Le Grand             {
176164b14621SArmin Le Grand                 //UUUU
176264b14621SArmin Le Grand                 drawing::BitmapMode eMode;
176364b14621SArmin Le Grand 
176464b14621SArmin Le Grand                 if(!(aValue >>= eMode))
176564b14621SArmin Le Grand                 {
176664b14621SArmin Le Grand                     sal_Int32 nMode = 0;
176764b14621SArmin Le Grand 
176864b14621SArmin Le Grand                     if(!(aValue >>= nMode))
176964b14621SArmin Le Grand                     {
177064b14621SArmin Le Grand                         throw lang::IllegalArgumentException();
177164b14621SArmin Le Grand                     }
177264b14621SArmin Le Grand 
177364b14621SArmin Le Grand                     eMode = (drawing::BitmapMode)nMode;
177464b14621SArmin Le Grand                 }
177564b14621SArmin Le Grand 
177664b14621SArmin Le Grand                 aSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode));
177764b14621SArmin Le Grand                 aSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode));
177864b14621SArmin Le Grand                 pFmt->GetDoc()->SetFlyFrmAttr( *pFmt, aSet );
177964b14621SArmin Le Grand                 bDone = true;
178064b14621SArmin Le Grand             }
178164b14621SArmin Le Grand 
1782b740b198SArmin Le Grand             switch(nMemberId)
1783b740b198SArmin Le Grand             {
1784b740b198SArmin Le Grand                 case MID_NAME:
1785b740b198SArmin Le Grand                 {
1786b740b198SArmin Le Grand                     //UUUU when named items get set, replace these with the NameOrIndex items
1787b740b198SArmin Le Grand                     // which exist already in the pool
1788b740b198SArmin Le Grand                     switch(pEntry->nWID)
1789b740b198SArmin Le Grand                     {
1790b740b198SArmin Le Grand                         case XATTR_FILLGRADIENT:
1791b740b198SArmin Le Grand                         case XATTR_FILLHATCH:
1792b740b198SArmin Le Grand                         case XATTR_FILLBITMAP:
1793b740b198SArmin Le Grand                         case XATTR_FILLFLOATTRANSPARENCE:
1794b740b198SArmin Le Grand                         {
1795b740b198SArmin Le Grand                             OUString aTempName;
1796b740b198SArmin Le Grand 
1797b740b198SArmin Le Grand                             if(!(aValue >>= aTempName ))
1798b740b198SArmin Le Grand                             {
1799b740b198SArmin Le Grand                                 throw lang::IllegalArgumentException();
1800b740b198SArmin Le Grand                             }
1801b740b198SArmin Le Grand 
1802b740b198SArmin Le Grand                             bDone = SvxShape::SetFillAttribute(pEntry->nWID, aTempName, aSet);
1803b740b198SArmin Le Grand                             break;
1804b740b198SArmin Le Grand                         }
1805b740b198SArmin Le Grand                         default:
1806b740b198SArmin Le Grand                         {
1807b740b198SArmin Le Grand                             break;
1808b740b198SArmin Le Grand                         }
1809b740b198SArmin Le Grand                     }
1810b740b198SArmin Le Grand                     break;
1811b740b198SArmin Le Grand                 }
1812b740b198SArmin Le Grand                 case MID_GRAFURL:
1813b740b198SArmin Le Grand                 {
1814b740b198SArmin Le Grand                     //UUUU Bitmap also has the MID_GRAFURL mode where a Bitmap URL is used
1815b740b198SArmin Le Grand                     switch(pEntry->nWID)
1816b740b198SArmin Le Grand                     {
1817b740b198SArmin Le Grand                         case XATTR_FILLBITMAP:
1818b740b198SArmin Le Grand                         {
1819b740b198SArmin Le Grand                             const Graphic aNullGraphic;
1820b740b198SArmin Le Grand                             XFillBitmapItem aXFillBitmapItem(aSet.GetPool(), aNullGraphic);
1821b740b198SArmin Le Grand 
1822b740b198SArmin Le Grand                             aXFillBitmapItem.PutValue(aValue, nMemberId);
1823b740b198SArmin Le Grand                             aSet.Put(aXFillBitmapItem);
1824b740b198SArmin Le Grand                             bDone = true;
1825b740b198SArmin Le Grand                             break;
1826b740b198SArmin Le Grand                         }
1827b740b198SArmin Le Grand                         default:
1828b740b198SArmin Le Grand                         {
1829b740b198SArmin Le Grand                             break;
1830b740b198SArmin Le Grand                         }
1831b740b198SArmin Le Grand                     }
1832b740b198SArmin Le Grand                     break;
1833b740b198SArmin Le Grand                 }
1834b740b198SArmin Le Grand                 default:
1835b740b198SArmin Le Grand                 {
1836b740b198SArmin Le Grand                     break;
1837b740b198SArmin Le Grand                 }
1838b740b198SArmin Le Grand             }
1839b740b198SArmin Le Grand 
184064b14621SArmin Le Grand             if(!bDone)
184164b14621SArmin Le Grand             {
1842cdf0e10cSrcweir                 m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
184364b14621SArmin Le Grand             }
184464b14621SArmin Le Grand 
184564b14621SArmin Le Grand             if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == nMemberId)
1846cdf0e10cSrcweir             {
1847cdf0e10cSrcweir                 SwFmtAnchor aAnchor = (const :: SwFmtAnchor&)aSet.Get(pEntry->nWID);
1848cdf0e10cSrcweir                 if(aAnchor.GetAnchorId() == FLY_AT_FLY)
1849cdf0e10cSrcweir                 {
1850cdf0e10cSrcweir                     const :: SwPosition* pPosition = aAnchor.GetCntntAnchor();
1851cdf0e10cSrcweir                     SwFrmFmt* pFlyFmt = pPosition ? pPosition->nNode.GetNode().GetFlyFmt() : 0;
1852cdf0e10cSrcweir                     if(!pFlyFmt || pFlyFmt->Which() == RES_DRAWFRMFMT)
1853cdf0e10cSrcweir                     {
1854cdf0e10cSrcweir                         lang::IllegalArgumentException aExcept;
1855cdf0e10cSrcweir                         aExcept.Message = C2U("Anchor to frame: no frame found");
1856cdf0e10cSrcweir                         throw aExcept;
1857cdf0e10cSrcweir                     }
1858cdf0e10cSrcweir                     else
1859cdf0e10cSrcweir                     {
1860cdf0e10cSrcweir                         SwPosition aPos = *pPosition;
1861cdf0e10cSrcweir                         aPos.nNode = *pFlyFmt->GetCntnt().GetCntntIdx();
1862cdf0e10cSrcweir                         aAnchor.SetAnchor(&aPos);
1863cdf0e10cSrcweir                         aSet.Put(aAnchor);
1864cdf0e10cSrcweir                     }
1865cdf0e10cSrcweir                 }
1866cdf0e10cSrcweir                 else if ((aAnchor.GetAnchorId() != FLY_AT_PAGE) &&
1867cdf0e10cSrcweir                          !aAnchor.GetCntntAnchor())
1868cdf0e10cSrcweir                 {
1869cdf0e10cSrcweir                     SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
1870cdf0e10cSrcweir                     SwPaM aPam(rNode);
1871cdf0e10cSrcweir                     aPam.Move( fnMoveBackward, fnGoDoc );
1872cdf0e10cSrcweir                     aAnchor.SetAnchor( aPam.Start() );
1873cdf0e10cSrcweir                     aSet.Put(aAnchor);
1874cdf0e10cSrcweir                 }
1875cdf0e10cSrcweir 
1876cdf0e10cSrcweir                 // --> OD 2004-08-13 #i31771#, #i25798# - No adjustment of
1877cdf0e10cSrcweir                 // anchor ( no call of method <::lcl_ChkAndSetNewAnchor(..)> ),
1878cdf0e10cSrcweir                 // if document is currently in reading mode.
1879cdf0e10cSrcweir                 if ( !pFmt->GetDoc()->IsInReading() )
1880cdf0e10cSrcweir                 {
1881cdf0e10cSrcweir                     // see SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet )
1882cdf0e10cSrcweir                     SwFlyFrm *pFly = 0;
1883cdf0e10cSrcweir                     if (PTR_CAST(SwFlyFrmFmt, pFmt))
1884cdf0e10cSrcweir                         pFly = ((SwFlyFrmFmt*)pFmt)->GetFrm();
1885cdf0e10cSrcweir                     if (pFly)
1886cdf0e10cSrcweir                     {
1887cdf0e10cSrcweir                         const :: SfxPoolItem* pItem;
1888cdf0e10cSrcweir                         if( SFX_ITEM_SET == aSet.GetItemState( RES_ANCHOR, sal_False, &pItem ))
1889cdf0e10cSrcweir                         {
1890cdf0e10cSrcweir                             aSet.Put( *pItem );
189169a74367SOliver-Rainer Wittmann                             if ( pFmt->GetDoc()->GetEditShell() != NULL )
189269a74367SOliver-Rainer Wittmann                             {
189369a74367SOliver-Rainer Wittmann                                 ::lcl_ChkAndSetNewAnchor( *(pFmt->GetDoc()->GetEditShell()), *pFly, aSet );
189469a74367SOliver-Rainer Wittmann                             }
1895cdf0e10cSrcweir                         }
1896cdf0e10cSrcweir                     }
1897cdf0e10cSrcweir                 }
1898cdf0e10cSrcweir                 // <--
1899cdf0e10cSrcweir 
1900cdf0e10cSrcweir                 pFmt->GetDoc()->SetFlyFrmAttr( *pFmt, aSet );
1901cdf0e10cSrcweir             }
1902cdf0e10cSrcweir             else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_STREAM_NAME == pEntry->nWID)
1903cdf0e10cSrcweir             {
1904cdf0e10cSrcweir                 throw lang::IllegalArgumentException();
1905cdf0e10cSrcweir             }
1906cdf0e10cSrcweir             else
1907b740b198SArmin Le Grand             {
1908cdf0e10cSrcweir                 pFmt->SetFmtAttr(aSet);
1909cdf0e10cSrcweir             }
1910cdf0e10cSrcweir         }
1911b740b198SArmin Le Grand     }
1912cdf0e10cSrcweir     else if(IsDescriptor())
1913cdf0e10cSrcweir     {
191464b14621SArmin Le Grand         pProps->SetProperty(pEntry->nWID, nMemberId, aValue);
1915cdf0e10cSrcweir         if( FN_UNO_FRAME_STYLE_NAME == pEntry->nWID )
1916cdf0e10cSrcweir         {
1917cdf0e10cSrcweir             OUString sStyleName;
1918cdf0e10cSrcweir             aValue >>= sStyleName;
1919cdf0e10cSrcweir             try
1920cdf0e10cSrcweir             {
1921cdf0e10cSrcweir                 uno::Any aAny = mxStyleFamily->getByName ( sStyleName );
1922cdf0e10cSrcweir                 aAny >>= mxStyleData;
1923cdf0e10cSrcweir             }
1924cdf0e10cSrcweir             catch ( container::NoSuchElementException const & )
1925cdf0e10cSrcweir             {
1926cdf0e10cSrcweir             }
1927cdf0e10cSrcweir             catch ( lang::WrappedTargetException const  & )
1928cdf0e10cSrcweir             {
1929cdf0e10cSrcweir             }
1930cdf0e10cSrcweir             catch ( uno::RuntimeException const & )
1931cdf0e10cSrcweir             {
1932cdf0e10cSrcweir             }
1933cdf0e10cSrcweir         }
1934cdf0e10cSrcweir     }
1935cdf0e10cSrcweir     else
1936cdf0e10cSrcweir         throw uno::RuntimeException();
1937cdf0e10cSrcweir }
1938cdf0e10cSrcweir 
getPropertyValue(const OUString & rPropertyName)1939cdf0e10cSrcweir uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
1940cdf0e10cSrcweir     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1941cdf0e10cSrcweir {
1942cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
1943cdf0e10cSrcweir     uno::Any aAny;
1944cdf0e10cSrcweir     SwFrmFmt* pFmt = GetFrmFmt();
1945cdf0e10cSrcweir     const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
1946cdf0e10cSrcweir     if (!pEntry)
1947cdf0e10cSrcweir         throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1948cdf0e10cSrcweir 
194964b14621SArmin Le Grand     //UUUU
195064b14621SArmin Le Grand     const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM));
195164b14621SArmin Le Grand 
1952cdf0e10cSrcweir     if(FN_UNO_ANCHOR_TYPES == pEntry->nWID)
1953cdf0e10cSrcweir     {
1954cdf0e10cSrcweir         uno::Sequence<text::TextContentAnchorType> aTypes(5);
1955cdf0e10cSrcweir         text::TextContentAnchorType* pArray = aTypes.getArray();
1956cdf0e10cSrcweir         pArray[0] = text::TextContentAnchorType_AT_PARAGRAPH;
1957cdf0e10cSrcweir         pArray[1] = text::TextContentAnchorType_AS_CHARACTER;
1958cdf0e10cSrcweir         pArray[2] = text::TextContentAnchorType_AT_PAGE;
1959cdf0e10cSrcweir         pArray[3] = text::TextContentAnchorType_AT_FRAME;
1960cdf0e10cSrcweir         pArray[4] = text::TextContentAnchorType_AT_CHARACTER;
1961cdf0e10cSrcweir         aAny.setValue(&aTypes, ::getCppuType(static_cast<uno::Sequence<text::TextContentAnchorType>*>(0)));
1962cdf0e10cSrcweir     }
1963cdf0e10cSrcweir     else if(pFmt)
1964cdf0e10cSrcweir     {
1965cdf0e10cSrcweir         if( ((eType == FLYCNTTYPE_GRF) || (eType == FLYCNTTYPE_OLE)) &&
1966cdf0e10cSrcweir                 pEntry &&
1967cdf0e10cSrcweir                 (isGRFATR(pEntry->nWID) ||
1968cdf0e10cSrcweir                         pEntry->nWID == FN_PARAM_COUNTOUR_PP ||
1969cdf0e10cSrcweir                         pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ||
1970cdf0e10cSrcweir                         pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR ))
1971cdf0e10cSrcweir         {
1972cdf0e10cSrcweir             const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
1973cdf0e10cSrcweir             if(pIdx)
1974cdf0e10cSrcweir             {
1975cdf0e10cSrcweir                 SwNodeIndex aIdx(*pIdx, 1);
1976cdf0e10cSrcweir                 SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
1977cdf0e10cSrcweir                 if(pEntry->nWID == FN_PARAM_COUNTOUR_PP)
1978cdf0e10cSrcweir                 {
1979cdf0e10cSrcweir                     PolyPolygon aContour;
1980cdf0e10cSrcweir                     if( pNoTxt->GetContourAPI( aContour ) )
1981cdf0e10cSrcweir                     {
1982cdf0e10cSrcweir                         drawing::PointSequenceSequence aPtSeq(aContour.Count());
1983cdf0e10cSrcweir                         drawing::PointSequence* pPSeq = aPtSeq.getArray();
1984cdf0e10cSrcweir                         for(sal_uInt16 i = 0; i < aContour.Count(); i++)
1985cdf0e10cSrcweir                         {
1986cdf0e10cSrcweir                             const Polygon& rPoly = aContour.GetObject(i);
1987cdf0e10cSrcweir                             pPSeq[i].realloc(rPoly.GetSize());
1988cdf0e10cSrcweir                             awt::Point* pPoints = pPSeq[i].getArray();
1989cdf0e10cSrcweir                             for(sal_uInt16 j = 0; j < rPoly.GetSize(); j++)
1990cdf0e10cSrcweir                             {
1991cdf0e10cSrcweir                                 const Point& rPoint = rPoly.GetPoint(j);
1992cdf0e10cSrcweir                                 pPoints[j].X = rPoint.X();
1993cdf0e10cSrcweir                                 pPoints[j].Y = rPoint.Y();
1994cdf0e10cSrcweir                             }
1995cdf0e10cSrcweir                         }
1996cdf0e10cSrcweir                         aAny <<= aPtSeq;
1997cdf0e10cSrcweir                     }
1998cdf0e10cSrcweir                 }
1999cdf0e10cSrcweir                 else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
2000cdf0e10cSrcweir                 {
2001cdf0e10cSrcweir                     sal_Bool bValue = pNoTxt->HasAutomaticContour();
2002cdf0e10cSrcweir                     aAny.setValue( &bValue, ::getBooleanCppuType() );
2003cdf0e10cSrcweir                 }
2004cdf0e10cSrcweir                 else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
2005cdf0e10cSrcweir                 {
2006cdf0e10cSrcweir                     sal_Bool bValue = pNoTxt->IsPixelContour();
2007cdf0e10cSrcweir                     aAny.setValue( &bValue, ::getBooleanCppuType() );
2008cdf0e10cSrcweir                 }
2009cdf0e10cSrcweir                 else
2010cdf0e10cSrcweir                 {
2011cdf0e10cSrcweir                     SfxItemSet aSet(pNoTxt->GetSwAttrSet());
2012cdf0e10cSrcweir                     m_pPropSet->getPropertyValue(*pEntry, aSet, aAny);
2013cdf0e10cSrcweir                 }
2014cdf0e10cSrcweir             }
2015cdf0e10cSrcweir         }
2016cdf0e10cSrcweir         else if( FN_UNO_GRAPHIC_U_R_L == pEntry->nWID)
2017cdf0e10cSrcweir         {
2018cdf0e10cSrcweir             String sGrfName;
2019cdf0e10cSrcweir             const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
2020cdf0e10cSrcweir             if ( pIdx )
2021cdf0e10cSrcweir             {
2022cdf0e10cSrcweir                 SwNodeIndex aIdx( *pIdx, 1 );
2023cdf0e10cSrcweir                 SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
2024cdf0e10cSrcweir                 if ( !pGrfNode )
2025cdf0e10cSrcweir                     throw uno::RuntimeException();
2026cdf0e10cSrcweir                 if ( pGrfNode->IsGrfLink() )
2027cdf0e10cSrcweir                 {
2028cdf0e10cSrcweir                     pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*) pFmt, &sGrfName, 0 );
2029cdf0e10cSrcweir                 }
2030cdf0e10cSrcweir                 else
2031cdf0e10cSrcweir                 {
2032cdf0e10cSrcweir                     String sPrefix( RTL_CONSTASCII_STRINGPARAM( sGraphicObjectProtocol ) );
2033cdf0e10cSrcweir                     String sId( pGrfNode->GetGrfObj().GetUniqueID(),
2034cdf0e10cSrcweir                     RTL_TEXTENCODING_ASCII_US );
2035cdf0e10cSrcweir                     ( sGrfName = sPrefix ) += sId;
2036cdf0e10cSrcweir                 }
2037cdf0e10cSrcweir             }
2038cdf0e10cSrcweir             aAny <<= OUString( sGrfName );
2039cdf0e10cSrcweir         }
2040ddde725dSArmin Le Grand         else if( FN_UNO_REPLACEMENT_GRAPHIC_U_R_L == pEntry->nWID)
2041ddde725dSArmin Le Grand         {
2042ddde725dSArmin Le Grand             String sGrfName;
2043ddde725dSArmin Le Grand             const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
2044ddde725dSArmin Le Grand 
2045ddde725dSArmin Le Grand             if(pIdx)
2046ddde725dSArmin Le Grand             {
2047ddde725dSArmin Le Grand                 SwNodeIndex aIdx(*pIdx, 1);
2048ddde725dSArmin Le Grand                 SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
2049ddde725dSArmin Le Grand                 if(!pGrfNode)
2050ddde725dSArmin Le Grand                     throw uno::RuntimeException();
2051ddde725dSArmin Le Grand 
2052ddde725dSArmin Le Grand                 const GraphicObject* pGraphicObject = pGrfNode->GetReplacementGrfObj();
2053ddde725dSArmin Le Grand 
2054ddde725dSArmin Le Grand                 if(pGraphicObject)
2055ddde725dSArmin Le Grand                 {
2056ddde725dSArmin Le Grand                     String sPrefix( RTL_CONSTASCII_STRINGPARAM(sGraphicObjectProtocol) );
2057ddde725dSArmin Le Grand                     String sId( pGraphicObject->GetUniqueID(), RTL_TEXTENCODING_ASCII_US );
2058ddde725dSArmin Le Grand                     (sGrfName = sPrefix) += sId;
2059ddde725dSArmin Le Grand                 }
2060ddde725dSArmin Le Grand             }
2061ddde725dSArmin Le Grand 
2062ddde725dSArmin Le Grand             aAny <<= OUString(sGrfName);
2063ddde725dSArmin Le Grand         }
2064cdf0e10cSrcweir         else if( FN_UNO_GRAPHIC_FILTER == pEntry->nWID )
2065cdf0e10cSrcweir         {
2066cdf0e10cSrcweir             String sFltName;
2067cdf0e10cSrcweir             pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, 0, &sFltName );
2068cdf0e10cSrcweir                 aAny <<= OUString(sFltName);
2069cdf0e10cSrcweir         }
2070cdf0e10cSrcweir         else if( FN_UNO_GRAPHIC == pEntry->nWID )
2071cdf0e10cSrcweir         {
2072cdf0e10cSrcweir             const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
2073cdf0e10cSrcweir             if(pIdx)
2074cdf0e10cSrcweir             {
2075cdf0e10cSrcweir                 SwNodeIndex aIdx(*pIdx, 1);
2076cdf0e10cSrcweir                 SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
2077cdf0e10cSrcweir                 if(!pGrfNode)
2078cdf0e10cSrcweir                     throw uno::RuntimeException();
2079cdf0e10cSrcweir                 aAny <<= pGrfNode->GetGrf().GetXGraphic();
2080cdf0e10cSrcweir             }
2081cdf0e10cSrcweir         }
2082cdf0e10cSrcweir         else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
2083cdf0e10cSrcweir         {
2084cdf0e10cSrcweir             aAny <<= OUString(SwStyleNameMapper::GetProgName(pFmt->DerivedFrom()->GetName(), nsSwGetPoolIdFromName::GET_POOLID_FRMFMT ) );
2085cdf0e10cSrcweir         }
2086cdf0e10cSrcweir         // --> OD 2009-07-13 #i73249#
2087cdf0e10cSrcweir         // Attribute AlternativeText was never published.
2088cdf0e10cSrcweir         // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
2089cdf0e10cSrcweir //        else if(eType != FLYCNTTYPE_FRM &&
2090cdf0e10cSrcweir //                FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
2091cdf0e10cSrcweir //        {
2092cdf0e10cSrcweir //            const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
2093cdf0e10cSrcweir //            if(pIdx)
2094cdf0e10cSrcweir //            {
2095cdf0e10cSrcweir //                SwNodeIndex aIdx(*pIdx, 1);
2096cdf0e10cSrcweir //                SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
2097cdf0e10cSrcweir //                aAny <<= OUString(pNoTxt->GetAlternateText());
2098cdf0e10cSrcweir //            }
2099cdf0e10cSrcweir //        }
2100cdf0e10cSrcweir         else if( FN_UNO_TITLE == pEntry->nWID )
2101cdf0e10cSrcweir         {
2102cdf0e10cSrcweir             SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
2103cdf0e10cSrcweir             ASSERT( pFmt,
2104cdf0e10cSrcweir                     "unexpected type of <pFmt> --> crash" );
2105cdf0e10cSrcweir             // assure that <SdrObject> instance exists.
2106cdf0e10cSrcweir             GetOrCreateSdrObject( pFlyFmt );
2107cdf0e10cSrcweir             aAny <<= OUString(pFlyFmt->GetObjTitle());
2108cdf0e10cSrcweir         }
2109cdf0e10cSrcweir         // New attribute Description
2110cdf0e10cSrcweir         else if( FN_UNO_DESCRIPTION == pEntry->nWID )
2111cdf0e10cSrcweir         {
2112cdf0e10cSrcweir             SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
2113cdf0e10cSrcweir             ASSERT( pFmt,
2114cdf0e10cSrcweir                     "unexpected type of <pFmt> --> crash" );
2115cdf0e10cSrcweir             // assure that <SdrObject> instance exists.
2116cdf0e10cSrcweir             GetOrCreateSdrObject( pFlyFmt );
2117cdf0e10cSrcweir             aAny <<= OUString(pFlyFmt->GetObjDescription());
2118cdf0e10cSrcweir         }
2119cdf0e10cSrcweir         // <--
2120cdf0e10cSrcweir         else if(eType == FLYCNTTYPE_GRF &&
2121cdf0e10cSrcweir                 (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ACTUAL_SIZE))))
2122cdf0e10cSrcweir         {
2123cdf0e10cSrcweir             const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
2124cdf0e10cSrcweir             if(pIdx)
2125cdf0e10cSrcweir             {
2126cdf0e10cSrcweir                 SwNodeIndex aIdx(*pIdx, 1);
2127cdf0e10cSrcweir                 // --> OD #i85105#
2128cdf0e10cSrcweir //                SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
2129cdf0e10cSrcweir //                Size aActSize = ((SwGrfNode*)pNoTxt)->GetTwipSize();
2130cdf0e10cSrcweir                 Size aActSize;
2131cdf0e10cSrcweir                 {
2132cdf0e10cSrcweir                     SwGrfNode* pGrfNode = dynamic_cast<SwGrfNode*>(aIdx.GetNode().GetNoTxtNode());
2133cdf0e10cSrcweir                     if ( pGrfNode )
2134cdf0e10cSrcweir                     {
2135cdf0e10cSrcweir                         aActSize = pGrfNode->GetTwipSize();
2136cdf0e10cSrcweir                         if ( aActSize.Width() == 0 && aActSize.Height() == 0 &&
2137cdf0e10cSrcweir                              pGrfNode->IsLinkedFile() )
2138cdf0e10cSrcweir                         {
2139cdf0e10cSrcweir                             pGrfNode->SwapIn( sal_True );
2140cdf0e10cSrcweir                             aActSize = pGrfNode->GetTwipSize();
2141cdf0e10cSrcweir                         }
2142cdf0e10cSrcweir                     }
2143cdf0e10cSrcweir                 }
2144cdf0e10cSrcweir                 // <--
2145cdf0e10cSrcweir                 awt::Size aTmp;
2146cdf0e10cSrcweir                 aTmp.Width = TWIP_TO_MM100(aActSize.Width());
2147cdf0e10cSrcweir                 aTmp.Height = TWIP_TO_MM100(aActSize.Height());
2148cdf0e10cSrcweir                 aAny.setValue(&aTmp, ::getCppuType(static_cast<const awt::Size*>(0)));
2149cdf0e10cSrcweir             }
2150cdf0e10cSrcweir         }
2151cdf0e10cSrcweir         else if(FN_PARAM_LINK_DISPLAY_NAME == pEntry->nWID)
2152cdf0e10cSrcweir         {
2153cdf0e10cSrcweir             aAny <<= OUString(pFmt->GetName());
2154cdf0e10cSrcweir         }
2155cdf0e10cSrcweir         else if(FN_UNO_Z_ORDER == pEntry->nWID)
2156cdf0e10cSrcweir         {
2157cdf0e10cSrcweir             const SdrObject* pObj = pFmt->FindRealSdrObject();
2158cdf0e10cSrcweir             if( pObj )
2159cdf0e10cSrcweir             {
2160cdf0e10cSrcweir                 aAny <<= (sal_Int32)pObj->GetOrdNum();
2161cdf0e10cSrcweir             }
2162cdf0e10cSrcweir         }
2163cdf0e10cSrcweir         else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_MODEL == pEntry->nWID||
2164cdf0e10cSrcweir                 FN_UNO_COMPONENT == pEntry->nWID ||FN_UNO_STREAM_NAME == pEntry->nWID||
2165cdf0e10cSrcweir                 FN_EMBEDDED_OBJECT == pEntry->nWID)
2166cdf0e10cSrcweir         {
2167cdf0e10cSrcweir             SwDoc* pDoc = pFmt->GetDoc();
2168cdf0e10cSrcweir             const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
2169cdf0e10cSrcweir             DBG_ASSERT( pCnt->GetCntntIdx() &&
2170cdf0e10cSrcweir                            pDoc->GetNodes()[ pCnt->GetCntntIdx()->
2171cdf0e10cSrcweir                                             GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
2172cdf0e10cSrcweir 
2173cdf0e10cSrcweir             SwOLENode* pOleNode =  pDoc->GetNodes()[ pCnt->GetCntntIdx()
2174cdf0e10cSrcweir                                             ->GetIndex() + 1 ]->GetOLENode();
2175cdf0e10cSrcweir             uno::Reference < embed::XEmbeddedObject > xIP = pOleNode->GetOLEObj().GetOleRef();
2176cdf0e10cSrcweir             OUString aHexCLSID;
2177cdf0e10cSrcweir             {
2178cdf0e10cSrcweir                 SvGlobalName aClassName( xIP->getClassID() );
2179cdf0e10cSrcweir                 aHexCLSID = aClassName.GetHexName();
2180cdf0e10cSrcweir                 if(FN_UNO_CLSID != pEntry->nWID)
2181cdf0e10cSrcweir                 {
2182cdf0e10cSrcweir                     if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
2183cdf0e10cSrcweir                     {
2184cdf0e10cSrcweir                         uno::Reference < lang::XComponent > xComp( xIP->getComponent(), uno::UNO_QUERY );
2185cdf0e10cSrcweir                         uno::Reference < frame::XModel > xModel( xComp, uno::UNO_QUERY );
2186cdf0e10cSrcweir                         if ( FN_EMBEDDED_OBJECT == pEntry->nWID )
2187cdf0e10cSrcweir                         {
2188cdf0e10cSrcweir                             // ensure the
2189cdf0e10cSrcweir                             ASSERT( pDoc->GetDocShell(), "no doc shell => no client site" );
2190cdf0e10cSrcweir                             if ( pDoc->GetDocShell() )
2191cdf0e10cSrcweir                                 pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xIP, embed::Aspects::MSOLE_CONTENT ) );
2192cdf0e10cSrcweir                             aAny <<= xIP;
2193cdf0e10cSrcweir                         }
2194cdf0e10cSrcweir                         else if ( xModel.is() )
2195cdf0e10cSrcweir                             aAny <<= xModel;
2196cdf0e10cSrcweir                         else if ( FN_UNO_COMPONENT == pEntry->nWID )
2197cdf0e10cSrcweir                             aAny <<= xComp;
2198cdf0e10cSrcweir                     }
2199cdf0e10cSrcweir                 }
2200cdf0e10cSrcweir             }
2201cdf0e10cSrcweir 
2202cdf0e10cSrcweir             if(FN_UNO_CLSID == pEntry->nWID)
2203cdf0e10cSrcweir                 aAny <<= aHexCLSID;
2204cdf0e10cSrcweir             else if(FN_UNO_STREAM_NAME == pEntry->nWID)
2205cdf0e10cSrcweir             {
2206cdf0e10cSrcweir                 aAny <<= ::rtl::OUString(pOleNode->GetOLEObj().GetCurrentPersistName());
2207cdf0e10cSrcweir             }
2208cdf0e10cSrcweir         }
2209cdf0e10cSrcweir         else if(WID_LAYOUT_SIZE == pEntry->nWID)
2210cdf0e10cSrcweir         {
2211cdf0e10cSrcweir             // format document completely in order to get correct value
2212cdf0e10cSrcweir             pFmt->GetDoc()->GetEditShell()->CalcLayout();
2213cdf0e10cSrcweir 
2214cdf0e10cSrcweir             SwFrm* pTmpFrm = SwIterator<SwFrm,SwFmt>::FirstElement( *pFmt );
2215cdf0e10cSrcweir             if ( pTmpFrm )
2216cdf0e10cSrcweir             {
2217cdf0e10cSrcweir                 DBG_ASSERT( pTmpFrm->IsValid(), "frame not valid" );
2218cdf0e10cSrcweir                 const SwRect &rRect = pTmpFrm->Frm();
2219cdf0e10cSrcweir                 Size aMM100Size = OutputDevice::LogicToLogic(
2220cdf0e10cSrcweir                         Size( rRect.Width(), rRect.Height() ),
2221cdf0e10cSrcweir                         MapMode( MAP_TWIP ), MapMode( MAP_100TH_MM ));
2222cdf0e10cSrcweir                 aAny <<= awt::Size( aMM100Size.Width(), aMM100Size.Height() );
2223cdf0e10cSrcweir             }
2224cdf0e10cSrcweir         }
2225cdf0e10cSrcweir         else
222664b14621SArmin Le Grand         {   //UUUU
222764b14621SArmin Le Grand             // standard UNO API read attributes
222864b14621SArmin Le Grand             // adapt former attr from SvxBrushItem::PutValue to new items XATTR_FILL_FIRST, XATTR_FILL_LAST
2229cdf0e10cSrcweir             const SwAttrSet& rSet = pFmt->GetAttrSet();
223064b14621SArmin Le Grand             bool bDone(false);
223164b14621SArmin Le Grand 
223264b14621SArmin Le Grand             if(RES_BACKGROUND == pEntry->nWID)
223364b14621SArmin Le Grand             {
223464b14621SArmin Le Grand                 //UUUU
223556b35d86SArmin Le Grand                 const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
223664b14621SArmin Le Grand 
223764b14621SArmin Le Grand                 if(!aOriginalBrushItem.QueryValue(aAny, nMemberId))
223864b14621SArmin Le Grand                 {
223964b14621SArmin Le Grand                     OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
224064b14621SArmin Le Grand                 }
224164b14621SArmin Le Grand 
224264b14621SArmin Le Grand                 bDone = true;
224364b14621SArmin Le Grand             }
224464b14621SArmin Le Grand             else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
224564b14621SArmin Le Grand             {
224664b14621SArmin Le Grand                 //UUUU
224764b14621SArmin Le Grand                 const XFillBmpStretchItem* pStretchItem = dynamic_cast< const XFillBmpStretchItem* >(&rSet.Get(XATTR_FILLBMP_STRETCH));
224864b14621SArmin Le Grand                 const XFillBmpTileItem* pTileItem = dynamic_cast< const XFillBmpTileItem* >(&rSet.Get(XATTR_FILLBMP_TILE));
224964b14621SArmin Le Grand 
225064b14621SArmin Le Grand                 if( pTileItem && pTileItem->GetValue() )
225164b14621SArmin Le Grand                 {
225264b14621SArmin Le Grand                     aAny <<= drawing::BitmapMode_REPEAT;
225364b14621SArmin Le Grand                 }
225464b14621SArmin Le Grand                 else if( pStretchItem && pStretchItem->GetValue() )
225564b14621SArmin Le Grand                 {
225664b14621SArmin Le Grand                     aAny <<= drawing::BitmapMode_STRETCH;
225764b14621SArmin Le Grand                 }
225864b14621SArmin Le Grand                 else
225964b14621SArmin Le Grand                 {
226064b14621SArmin Le Grand                     aAny <<= drawing::BitmapMode_NO_REPEAT;
226164b14621SArmin Le Grand                 }
226264b14621SArmin Le Grand 
226364b14621SArmin Le Grand                 bDone = true;
226464b14621SArmin Le Grand             }
226564b14621SArmin Le Grand 
226664b14621SArmin Le Grand             if(!bDone)
226764b14621SArmin Le Grand             {
2268cdf0e10cSrcweir                 m_pPropSet->getPropertyValue(*pEntry, rSet, aAny);
2269cdf0e10cSrcweir             }
2270cdf0e10cSrcweir         }
227164b14621SArmin Le Grand     }
2272cdf0e10cSrcweir     else if(IsDescriptor())
2273cdf0e10cSrcweir     {
2274cdf0e10cSrcweir         if ( ! m_pDoc )
2275cdf0e10cSrcweir             throw uno::RuntimeException();
2276cdf0e10cSrcweir         if(WID_LAYOUT_SIZE != pEntry->nWID)  // there is no LayoutSize in a descriptor
2277cdf0e10cSrcweir         {
2278cdf0e10cSrcweir             const uno::Any* pAny = 0;
227964b14621SArmin Le Grand             if( !pProps->GetProperty( pEntry->nWID, nMemberId, pAny ) )
2280cdf0e10cSrcweir                 aAny = mxStyleData->getPropertyValue( rPropertyName );
2281cdf0e10cSrcweir             else if ( pAny )
2282cdf0e10cSrcweir                 aAny = *pAny;
2283cdf0e10cSrcweir         }
2284cdf0e10cSrcweir     }
2285cdf0e10cSrcweir     else
2286cdf0e10cSrcweir         throw uno::RuntimeException();
228764b14621SArmin Le Grand 
228864b14621SArmin Le Grand     //UUUU
228964b14621SArmin Le Grand     if(pEntry && pEntry->pType && *(pEntry->pType) == ::getCppuType((const sal_Int16*)0) && *(pEntry->pType) != aAny.getValueType())
229064b14621SArmin Le Grand     {
229164b14621SArmin Le Grand         // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
229264b14621SArmin Le Grand         sal_Int32 nValue = 0;
229364b14621SArmin Le Grand         aAny >>= nValue;
229464b14621SArmin Le Grand         aAny <<= (sal_Int16)nValue;
229564b14621SArmin Le Grand     }
229664b14621SArmin Le Grand 
229764b14621SArmin Le Grand     //UUUU check for needed metric translation
229864b14621SArmin Le Grand     if(pEntry->nMemberId & SFX_METRIC_ITEM)
229964b14621SArmin Le Grand     {
230064b14621SArmin Le Grand         bool bDoIt(true);
230164b14621SArmin Le Grand 
230264b14621SArmin Le Grand         if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID)
230364b14621SArmin Le Grand         {
230464b14621SArmin Le Grand             // exception: If these ItemTypes are used, do not convert when these are negative
230564b14621SArmin Le Grand             // since this means they are intended as percent values
230664b14621SArmin Le Grand             sal_Int32 nValue = 0;
230764b14621SArmin Le Grand 
230864b14621SArmin Le Grand             if(aAny >>= nValue)
230964b14621SArmin Le Grand             {
231064b14621SArmin Le Grand                 bDoIt = nValue > 0;
231164b14621SArmin Le Grand             }
231264b14621SArmin Le Grand         }
231364b14621SArmin Le Grand 
231464b14621SArmin Le Grand         if(bDoIt)
231564b14621SArmin Le Grand         {
231664b14621SArmin Le Grand             const SwDoc* pDoc = (IsDescriptor() ? m_pDoc : GetFrmFmt()->GetDoc());
231764b14621SArmin Le Grand             const SfxItemPool& rPool = pDoc->GetAttrPool();
231864b14621SArmin Le Grand             const SfxMapUnit eMapUnit(rPool.GetMetric(pEntry->nWID));
231964b14621SArmin Le Grand 
232064b14621SArmin Le Grand             if(eMapUnit != SFX_MAPUNIT_100TH_MM)
232164b14621SArmin Le Grand             {
232264b14621SArmin Le Grand                 SvxUnoConvertToMM(eMapUnit, aAny);
232364b14621SArmin Le Grand             }
232464b14621SArmin Le Grand         }
232564b14621SArmin Le Grand     }
232664b14621SArmin Le Grand 
2327cdf0e10cSrcweir     return aAny;
2328cdf0e10cSrcweir }
2329cdf0e10cSrcweir 
addPropertyChangeListener(const OUString &,const uno::Reference<beans::XPropertyChangeListener> &)2330cdf0e10cSrcweir void SwXFrame::addPropertyChangeListener(const OUString& /*PropertyName*/,
2331cdf0e10cSrcweir     const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
2332cdf0e10cSrcweir     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
2333cdf0e10cSrcweir {
2334cdf0e10cSrcweir     DBG_WARNING("not implemented");
2335cdf0e10cSrcweir }
2336cdf0e10cSrcweir 
removePropertyChangeListener(const OUString &,const uno::Reference<beans::XPropertyChangeListener> &)2337cdf0e10cSrcweir void SwXFrame::removePropertyChangeListener(const OUString& /*PropertyName*/,
2338cdf0e10cSrcweir     const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
2339cdf0e10cSrcweir     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
2340cdf0e10cSrcweir {
2341cdf0e10cSrcweir     DBG_WARNING("not implemented");
2342cdf0e10cSrcweir }
2343cdf0e10cSrcweir 
addVetoableChangeListener(const OUString &,const uno::Reference<beans::XVetoableChangeListener> &)2344cdf0e10cSrcweir void SwXFrame::addVetoableChangeListener(const OUString& /*PropertyName*/,
2345cdf0e10cSrcweir                                 const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
2346cdf0e10cSrcweir     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
2347cdf0e10cSrcweir {
2348cdf0e10cSrcweir     DBG_WARNING("not implemented");
2349cdf0e10cSrcweir }
2350cdf0e10cSrcweir 
removeVetoableChangeListener(const OUString &,const uno::Reference<beans::XVetoableChangeListener> &)2351cdf0e10cSrcweir void SwXFrame::removeVetoableChangeListener(
2352cdf0e10cSrcweir     const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
2353cdf0e10cSrcweir         throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
2354cdf0e10cSrcweir {
2355cdf0e10cSrcweir     DBG_WARNING("not implemented");
2356cdf0e10cSrcweir }
2357cdf0e10cSrcweir 
getPropertyState(const OUString & rPropertyName)2358cdf0e10cSrcweir beans::PropertyState SwXFrame::getPropertyState( const OUString& rPropertyName )
2359cdf0e10cSrcweir     throw(beans::UnknownPropertyException, uno::RuntimeException)
2360cdf0e10cSrcweir {
2361cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
2362cdf0e10cSrcweir     uno::Sequence< OUString > aPropertyNames(1);
2363cdf0e10cSrcweir     OUString* pNames = aPropertyNames.getArray();
2364cdf0e10cSrcweir     pNames[0] = rPropertyName;
2365cdf0e10cSrcweir     uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aPropertyNames);
2366cdf0e10cSrcweir     return aStates.getConstArray()[0];
2367cdf0e10cSrcweir }
2368cdf0e10cSrcweir 
getPropertyStates(const uno::Sequence<OUString> & aPropertyNames)2369cdf0e10cSrcweir uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
2370cdf0e10cSrcweir     const uno::Sequence< OUString >& aPropertyNames )
2371cdf0e10cSrcweir         throw(beans::UnknownPropertyException, uno::RuntimeException)
2372cdf0e10cSrcweir {
2373cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
2374cdf0e10cSrcweir     uno::Sequence< beans::PropertyState > aStates(aPropertyNames.getLength());
2375cdf0e10cSrcweir     beans::PropertyState* pStates = aStates.getArray();
2376cdf0e10cSrcweir     SwFrmFmt* pFmt = GetFrmFmt();
2377cdf0e10cSrcweir     if(pFmt)
2378cdf0e10cSrcweir     {
2379cdf0e10cSrcweir         const OUString* pNames = aPropertyNames.getConstArray();
2380cdf0e10cSrcweir         const SwAttrSet& rFmtSet = pFmt->GetAttrSet();
2381cdf0e10cSrcweir         for(int i = 0; i < aPropertyNames.getLength(); i++)
2382cdf0e10cSrcweir         {
2383cdf0e10cSrcweir             const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(pNames[i]);
2384cdf0e10cSrcweir             if (!pEntry)
2385cdf0e10cSrcweir                 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
2386cdf0e10cSrcweir 
2387cdf0e10cSrcweir             if(pEntry->nWID == FN_UNO_ANCHOR_TYPES||
2388cdf0e10cSrcweir                 pEntry->nWID == FN_PARAM_LINK_DISPLAY_NAME||
2389cdf0e10cSrcweir                 FN_UNO_FRAME_STYLE_NAME == pEntry->nWID||
2390cdf0e10cSrcweir                 FN_UNO_GRAPHIC_U_R_L == pEntry->nWID||
2391cdf0e10cSrcweir                 FN_UNO_GRAPHIC_FILTER     == pEntry->nWID||
2392cdf0e10cSrcweir                 FN_UNO_ACTUAL_SIZE == pEntry->nWID||
2393cdf0e10cSrcweir                 FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
2394cdf0e10cSrcweir             {
2395cdf0e10cSrcweir                 pStates[i] = beans::PropertyState_DIRECT_VALUE;
2396cdf0e10cSrcweir             }
239764b14621SArmin Le Grand             else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
239864b14621SArmin Le Grand             {
239964b14621SArmin Le Grand                 //UUUU
240064b14621SArmin Le Grand                 if(SFX_ITEM_SET == rFmtSet.GetItemState(XATTR_FILLBMP_STRETCH, false)
240164b14621SArmin Le Grand                     || SFX_ITEM_SET == rFmtSet.GetItemState(XATTR_FILLBMP_TILE, false))
240264b14621SArmin Le Grand                 {
240364b14621SArmin Le Grand                     pStates[i] = beans::PropertyState_DIRECT_VALUE;
240464b14621SArmin Le Grand                 }
240564b14621SArmin Le Grand                 else
240664b14621SArmin Le Grand                 {
240764b14621SArmin Le Grand                     pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE;
240864b14621SArmin Le Grand                 }
240964b14621SArmin Le Grand             }
241064b14621SArmin Le Grand             //UUUU for FlyFrames we need to mark all properties from type RES_BACKGROUND
241164b14621SArmin Le Grand             // as beans::PropertyState_DIRECT_VALUE to let users of this property call
241264b14621SArmin Le Grand             // getPropertyValue where the member properties will be mapped from the
241364b14621SArmin Le Grand             // fill attributes to the according SvxBrushItem entries
241456b35d86SArmin Le Grand             else if(RES_BACKGROUND == pEntry->nWID && SWUnoHelper::needToMapFillItemsToSvxBrushItemTypes(rFmtSet))
241564b14621SArmin Le Grand             {
241664b14621SArmin Le Grand                 pStates[i] = beans::PropertyState_DIRECT_VALUE;
241764b14621SArmin Le Grand             }
2418cdf0e10cSrcweir             else
2419cdf0e10cSrcweir             {
2420cdf0e10cSrcweir                 if ((eType == FLYCNTTYPE_GRF) &&
2421cdf0e10cSrcweir                         pEntry && isGRFATR(pEntry->nWID))
2422cdf0e10cSrcweir                 {
2423cdf0e10cSrcweir                     const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
2424cdf0e10cSrcweir                     if(pIdx)
2425cdf0e10cSrcweir                     {
2426cdf0e10cSrcweir                         SwNodeIndex aIdx(*pIdx, 1);
2427cdf0e10cSrcweir                         SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
2428cdf0e10cSrcweir                         SfxItemSet aSet(pNoTxt->GetSwAttrSet());
2429cdf0e10cSrcweir                         aSet.GetItemState(pEntry->nWID);
2430cdf0e10cSrcweir                         if(SFX_ITEM_SET == aSet.GetItemState( pEntry->nWID, sal_False ))
2431cdf0e10cSrcweir                             pStates[i] = beans::PropertyState_DIRECT_VALUE;
2432cdf0e10cSrcweir                     }
2433cdf0e10cSrcweir                 }
2434cdf0e10cSrcweir                 else
2435cdf0e10cSrcweir                 {
2436cdf0e10cSrcweir                     if(SFX_ITEM_SET == rFmtSet.GetItemState( pEntry->nWID, sal_False ))
2437cdf0e10cSrcweir                         pStates[i] = beans::PropertyState_DIRECT_VALUE;
2438cdf0e10cSrcweir                     else
2439cdf0e10cSrcweir                         pStates[i] = beans::PropertyState_DEFAULT_VALUE;
2440cdf0e10cSrcweir                 }
2441cdf0e10cSrcweir             }
2442cdf0e10cSrcweir         }
2443cdf0e10cSrcweir     }
2444cdf0e10cSrcweir     else if(IsDescriptor())
2445cdf0e10cSrcweir     {
2446cdf0e10cSrcweir         for(int i = 0; i < aPropertyNames.getLength(); i++)
2447cdf0e10cSrcweir             pStates[i] = beans::PropertyState_DIRECT_VALUE;
2448cdf0e10cSrcweir     }
2449cdf0e10cSrcweir     else
2450cdf0e10cSrcweir         throw uno::RuntimeException();
2451cdf0e10cSrcweir     return aStates;
2452cdf0e10cSrcweir }
2453cdf0e10cSrcweir 
setPropertyToDefault(const OUString & rPropertyName)2454cdf0e10cSrcweir void SwXFrame::setPropertyToDefault( const OUString& rPropertyName )
2455cdf0e10cSrcweir     throw(beans::UnknownPropertyException, uno::RuntimeException)
2456cdf0e10cSrcweir {
2457cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
2458cdf0e10cSrcweir     SwFrmFmt* pFmt = GetFrmFmt();
2459cdf0e10cSrcweir     if(pFmt)
2460cdf0e10cSrcweir     {
2461cdf0e10cSrcweir         const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
2462cdf0e10cSrcweir         if (!pEntry)
2463cdf0e10cSrcweir             throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2464cdf0e10cSrcweir         if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
2465cdf0e10cSrcweir             throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertyToDefault: property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2466cdf0e10cSrcweir 
2467cdf0e10cSrcweir         sal_Bool bNextFrame;
246864b14621SArmin Le Grand 
246964b14621SArmin Le Grand         if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
247064b14621SArmin Le Grand         {
247164b14621SArmin Le Grand             //UUUU
247264b14621SArmin Le Grand             SwDoc* pDoc = pFmt->GetDoc();
247364b14621SArmin Le Grand             SfxItemSet aSet(pDoc->GetAttrPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
247464b14621SArmin Le Grand             aSet.SetParent(&pFmt->GetAttrSet());
247564b14621SArmin Le Grand 
247664b14621SArmin Le Grand             aSet.ClearItem(XATTR_FILLBMP_STRETCH);
247764b14621SArmin Le Grand             aSet.ClearItem(XATTR_FILLBMP_TILE);
247864b14621SArmin Le Grand 
247964b14621SArmin Le Grand             pFmt->SetFmtAttr(aSet);
248064b14621SArmin Le Grand         }
248164b14621SArmin Le Grand         else if( pEntry->nWID &&
2482cdf0e10cSrcweir             pEntry->nWID != FN_UNO_ANCHOR_TYPES &&
2483cdf0e10cSrcweir             pEntry->nWID != FN_PARAM_LINK_DISPLAY_NAME)
2484cdf0e10cSrcweir         {
2485cdf0e10cSrcweir             if ( (eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID) )
2486cdf0e10cSrcweir             {
2487cdf0e10cSrcweir                 const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
2488cdf0e10cSrcweir                 if(pIdx)
2489cdf0e10cSrcweir                 {
2490cdf0e10cSrcweir                     SwNodeIndex aIdx(*pIdx, 1);
2491cdf0e10cSrcweir                     SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
2492cdf0e10cSrcweir                     {
2493cdf0e10cSrcweir                         SfxItemSet aSet(pNoTxt->GetSwAttrSet());
2494cdf0e10cSrcweir                         aSet.ClearItem(pEntry->nWID);
2495cdf0e10cSrcweir                         pNoTxt->SetAttr(aSet);
2496cdf0e10cSrcweir                     }
2497cdf0e10cSrcweir                 }
2498cdf0e10cSrcweir             }
2499cdf0e10cSrcweir             // --> OD 2009-07-13 #i73249#
2500cdf0e10cSrcweir             // Attribute AlternativeText was never published.
2501cdf0e10cSrcweir             // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
2502cdf0e10cSrcweir //            else if( eType != FLYCNTTYPE_FRM && FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID )
2503cdf0e10cSrcweir //            {
2504cdf0e10cSrcweir //                const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
2505cdf0e10cSrcweir //                if(pIdx)
2506cdf0e10cSrcweir //                {
2507cdf0e10cSrcweir //                    SwNodeIndex aIdx(*pIdx, 1);
2508cdf0e10cSrcweir //                    SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
2509cdf0e10cSrcweir //                    pNoTxt->SetAlternateText(aEmptyStr);
2510cdf0e10cSrcweir //                }
2511cdf0e10cSrcweir //            }
2512cdf0e10cSrcweir             // New attribute Title
2513cdf0e10cSrcweir             else if( FN_UNO_TITLE == pEntry->nWID )
2514cdf0e10cSrcweir             {
2515cdf0e10cSrcweir                 SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
2516cdf0e10cSrcweir                 ASSERT( pFmt,
2517cdf0e10cSrcweir                         "unexpected type of <pFmt> --> crash" );
2518cdf0e10cSrcweir                 // assure that <SdrObject> instance exists.
2519cdf0e10cSrcweir                 GetOrCreateSdrObject( pFlyFmt );
2520cdf0e10cSrcweir                 pFlyFmt->GetDoc()->SetFlyFrmTitle( *(pFlyFmt), aEmptyStr );
2521cdf0e10cSrcweir             }
2522cdf0e10cSrcweir             // New attribute Description
2523cdf0e10cSrcweir             else if( FN_UNO_DESCRIPTION == pEntry->nWID )
2524cdf0e10cSrcweir             {
2525cdf0e10cSrcweir                 SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
2526cdf0e10cSrcweir                 ASSERT( pFmt,
2527cdf0e10cSrcweir                         "unexpected type of <pFmt> --> crash" );
2528cdf0e10cSrcweir                 // assure that <SdrObject> instance exists.
2529cdf0e10cSrcweir                 GetOrCreateSdrObject( pFlyFmt );
2530cdf0e10cSrcweir                 pFlyFmt->GetDoc()->SetFlyFrmDescription( *(pFlyFmt), aEmptyStr );
2531cdf0e10cSrcweir             }
2532cdf0e10cSrcweir             // <--
2533cdf0e10cSrcweir             else
2534cdf0e10cSrcweir             {
2535cdf0e10cSrcweir                 SwDoc* pDoc = pFmt->GetDoc();
2536cdf0e10cSrcweir                 SfxItemSet aSet( pDoc->GetAttrPool(),
2537cdf0e10cSrcweir                     RES_FRMATR_BEGIN, RES_FRMATR_END - 1 );
2538cdf0e10cSrcweir                 aSet.SetParent(&pFmt->GetAttrSet());
2539cdf0e10cSrcweir                 aSet.ClearItem(pEntry->nWID);
2540cdf0e10cSrcweir                 if(!rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPE)))
2541cdf0e10cSrcweir                     pFmt->SetFmtAttr(aSet);
2542cdf0e10cSrcweir             }
2543cdf0e10cSrcweir         }
2544cdf0e10cSrcweir         else if(0 != (bNextFrame = (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_NEXT_NAME))))
2545cdf0e10cSrcweir                 || rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_PREV_NAME)))
2546cdf0e10cSrcweir         {
2547cdf0e10cSrcweir             SwDoc* pDoc = pFmt->GetDoc();
2548cdf0e10cSrcweir             if(bNextFrame)
2549cdf0e10cSrcweir                 pDoc->Unchain(*pFmt);
2550cdf0e10cSrcweir             else
2551cdf0e10cSrcweir             {
2552cdf0e10cSrcweir                 SwFmtChain aChain( pFmt->GetChain() );
2553cdf0e10cSrcweir                 SwFrmFmt *pPrev = aChain.GetPrev();
2554cdf0e10cSrcweir                 if(pPrev)
2555cdf0e10cSrcweir                     pDoc->Unchain(*pPrev);
2556cdf0e10cSrcweir             }
2557cdf0e10cSrcweir         }
2558cdf0e10cSrcweir     }
2559cdf0e10cSrcweir     else if(!IsDescriptor())
2560cdf0e10cSrcweir         throw uno::RuntimeException();
2561cdf0e10cSrcweir 
2562cdf0e10cSrcweir }
2563cdf0e10cSrcweir 
getPropertyDefault(const OUString & rPropertyName)2564cdf0e10cSrcweir uno::Any SwXFrame::getPropertyDefault( const OUString& rPropertyName )
2565cdf0e10cSrcweir     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
2566cdf0e10cSrcweir {
2567cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
2568cdf0e10cSrcweir     uno::Any aRet;
2569cdf0e10cSrcweir     SwFrmFmt* pFmt = GetFrmFmt();
2570cdf0e10cSrcweir     if(pFmt)
2571cdf0e10cSrcweir     {
2572cdf0e10cSrcweir         const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
2573cdf0e10cSrcweir         if(pEntry)
2574cdf0e10cSrcweir         {
2575cdf0e10cSrcweir             if ( pEntry->nWID < RES_FRMATR_END )
2576cdf0e10cSrcweir             {
2577cdf0e10cSrcweir                 const SfxPoolItem& rDefItem =
2578cdf0e10cSrcweir                     pFmt->GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
257964b14621SArmin Le Grand                 //UUUU
258064b14621SArmin Le Grand                 const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM));
258164b14621SArmin Le Grand 
258264b14621SArmin Le Grand                 rDefItem.QueryValue(aRet, nMemberId);
2583cdf0e10cSrcweir             }
2584cdf0e10cSrcweir         }
2585cdf0e10cSrcweir         else
2586cdf0e10cSrcweir             throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2587cdf0e10cSrcweir     }
2588cdf0e10cSrcweir     else if(!IsDescriptor())
2589cdf0e10cSrcweir         throw uno::RuntimeException();
2590cdf0e10cSrcweir     return aRet;
2591cdf0e10cSrcweir }
2592cdf0e10cSrcweir 
addEventListener(const uno::Reference<lang::XEventListener> & aListener)2593cdf0e10cSrcweir void SwXFrame::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
2594cdf0e10cSrcweir {
2595cdf0e10cSrcweir     if(!GetRegisteredIn())
2596cdf0e10cSrcweir         throw uno::RuntimeException();
2597cdf0e10cSrcweir     aLstnrCntnr.AddListener(aListener);
2598cdf0e10cSrcweir }
2599cdf0e10cSrcweir 
removeEventListener(const uno::Reference<lang::XEventListener> & aListener)2600cdf0e10cSrcweir void SwXFrame::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
2601cdf0e10cSrcweir {
2602cdf0e10cSrcweir     if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
2603cdf0e10cSrcweir         throw uno::RuntimeException();
2604cdf0e10cSrcweir }
2605cdf0e10cSrcweir 
Modify(const SfxPoolItem * pOld,const SfxPoolItem * pNew)2606cdf0e10cSrcweir void    SwXFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
2607cdf0e10cSrcweir {
2608cdf0e10cSrcweir     ClientModify(this, pOld, pNew);
2609cdf0e10cSrcweir     if(!GetRegisteredIn())
2610cdf0e10cSrcweir     {
2611cdf0e10cSrcweir         mxStyleData.clear();
2612cdf0e10cSrcweir         mxStyleFamily.clear();
2613cdf0e10cSrcweir         m_pDoc = 0;
2614cdf0e10cSrcweir         aLstnrCntnr.Disposing();
2615cdf0e10cSrcweir     }
2616cdf0e10cSrcweir }
2617cdf0e10cSrcweir 
2618cdf0e10cSrcweir 
dispose(void)2619cdf0e10cSrcweir void SwXFrame::dispose(void) throw( uno::RuntimeException )
2620cdf0e10cSrcweir {
2621cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
2622cdf0e10cSrcweir     SwFrmFmt* pFmt = GetFrmFmt();
2623cdf0e10cSrcweir     if ( pFmt )
2624cdf0e10cSrcweir     {
2625cdf0e10cSrcweir         SdrObject* pObj = pFmt->FindSdrObject();
2626cdf0e10cSrcweir         // OD 11.09.2003 #112039# - add condition to perform delete of
2627cdf0e10cSrcweir         // format/anchor sign, not only if the object is inserted, but also
2628cdf0e10cSrcweir         // if a contact object is registered, which isn't in the destruction.
2629cdf0e10cSrcweir         if ( pObj &&
2630cdf0e10cSrcweir              ( pObj->IsInserted() ||
2631cdf0e10cSrcweir                ( pObj->GetUserCall() &&
2632cdf0e10cSrcweir                  !static_cast<SwContact*>(pObj->GetUserCall())->IsInDTOR() ) ) )
2633cdf0e10cSrcweir         {
2634cdf0e10cSrcweir             if (pFmt->GetAnchor().GetAnchorId() == FLY_AS_CHAR)
2635cdf0e10cSrcweir             {
2636cdf0e10cSrcweir                 const SwPosition &rPos = *(pFmt->GetAnchor().GetCntntAnchor());
2637cdf0e10cSrcweir                 SwTxtNode *pTxtNode = rPos.nNode.GetNode().GetTxtNode();
2638cdf0e10cSrcweir                 const xub_StrLen nIdx = rPos.nContent.GetIndex();
2639cdf0e10cSrcweir                 pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
2640cdf0e10cSrcweir             }
2641cdf0e10cSrcweir             else
2642cdf0e10cSrcweir                 pFmt->GetDoc()->DelLayoutFmt(pFmt);
2643cdf0e10cSrcweir         }
2644cdf0e10cSrcweir     }
2645cdf0e10cSrcweir 
2646cdf0e10cSrcweir }
2647cdf0e10cSrcweir 
getAnchor(void)2648cdf0e10cSrcweir uno::Reference< text::XTextRange >  SwXFrame::getAnchor(void) throw( uno::RuntimeException )
2649cdf0e10cSrcweir {
2650cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
2651cdf0e10cSrcweir     uno::Reference< text::XTextRange >  aRef;
2652cdf0e10cSrcweir     SwFrmFmt* pFmt = GetFrmFmt();
2653cdf0e10cSrcweir     if(pFmt)
2654cdf0e10cSrcweir     {
2655cdf0e10cSrcweir         const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
2656cdf0e10cSrcweir         // return an anchor for non-page bound frames
2657cdf0e10cSrcweir         // and for page bound frames that have a page no == NULL and a content position
2658cdf0e10cSrcweir         if ((rAnchor.GetAnchorId() != FLY_AT_PAGE) ||
2659cdf0e10cSrcweir             (rAnchor.GetCntntAnchor() && !rAnchor.GetPageNum()))
2660cdf0e10cSrcweir         {
2661cdf0e10cSrcweir             const SwPosition &rPos = *(rAnchor.GetCntntAnchor());
2662cdf0e10cSrcweir             aRef = SwXTextRange::CreateXTextRange(*pFmt->GetDoc(), rPos, 0);
2663cdf0e10cSrcweir         }
2664cdf0e10cSrcweir     }
2665cdf0e10cSrcweir     else
2666cdf0e10cSrcweir         throw uno::RuntimeException();
2667cdf0e10cSrcweir     return aRef;
2668cdf0e10cSrcweir }
2669cdf0e10cSrcweir 
ResetDescriptor()2670cdf0e10cSrcweir void SwXFrame::ResetDescriptor()
2671cdf0e10cSrcweir {
2672cdf0e10cSrcweir     bIsDescriptor = sal_False;
2673cdf0e10cSrcweir     mxStyleData.clear();
2674cdf0e10cSrcweir     mxStyleFamily.clear();
2675cdf0e10cSrcweir     DELETEZ(pProps);
2676cdf0e10cSrcweir }
2677cdf0e10cSrcweir 
attachToRange(const uno::Reference<text::XTextRange> & xTextRange)2678cdf0e10cSrcweir void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
2679cdf0e10cSrcweir             throw( lang::IllegalArgumentException, uno::RuntimeException )
2680cdf0e10cSrcweir {
2681cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
2682cdf0e10cSrcweir     if(!IsDescriptor())
2683cdf0e10cSrcweir         throw uno::RuntimeException();
2684cdf0e10cSrcweir     uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
2685cdf0e10cSrcweir     SwXTextRange* pRange = 0;
2686cdf0e10cSrcweir     OTextCursorHelper* pCursor = 0;
2687cdf0e10cSrcweir     if(xRangeTunnel.is())
2688cdf0e10cSrcweir     {
2689cdf0e10cSrcweir         pRange  = reinterpret_cast< SwXTextRange * >(
2690cdf0e10cSrcweir                 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
2691cdf0e10cSrcweir         pCursor = reinterpret_cast< OTextCursorHelper * >(
2692cdf0e10cSrcweir                 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
2693cdf0e10cSrcweir     }
2694cdf0e10cSrcweir 
2695cdf0e10cSrcweir     SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
2696cdf0e10cSrcweir     if(pDoc)
2697cdf0e10cSrcweir     {
2698cdf0e10cSrcweir         SwUnoInternalPaM aIntPam(*pDoc);
2699cdf0e10cSrcweir         //das muss jetzt sal_True liefern
2700cdf0e10cSrcweir         ::sw::XTextRangeToSwPaM(aIntPam, xTextRange);
2701cdf0e10cSrcweir 
2702cdf0e10cSrcweir         SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
2703cdf0e10cSrcweir         SwPaM aPam(rNode);
2704cdf0e10cSrcweir         aPam.Move( fnMoveBackward, fnGoDoc );
2705cdf0e10cSrcweir         static sal_uInt16 __READONLY_DATA aFrmAttrRange[] =
2706cdf0e10cSrcweir         {
2707cdf0e10cSrcweir             RES_FRMATR_BEGIN,       RES_FRMATR_END-1,
2708cdf0e10cSrcweir             RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
270964b14621SArmin Le Grand 
271064b14621SArmin Le Grand             //UUUU FillAttribute support
271164b14621SArmin Le Grand             XATTR_FILL_FIRST, XATTR_FILL_LAST,
271264b14621SArmin Le Grand 
271364b14621SArmin Le Grand             SID_ATTR_BORDER_INNER,  SID_ATTR_BORDER_INNER,
2714cdf0e10cSrcweir             0
2715cdf0e10cSrcweir         };
2716cdf0e10cSrcweir         static sal_uInt16 __READONLY_DATA aGrAttrRange[] =
2717cdf0e10cSrcweir         {
2718cdf0e10cSrcweir             RES_GRFATR_BEGIN,       RES_GRFATR_END-1,
2719cdf0e10cSrcweir             0
2720cdf0e10cSrcweir         };
2721cdf0e10cSrcweir         SfxItemSet aGrSet(pDoc->GetAttrPool(), aGrAttrRange );
2722cdf0e10cSrcweir 
2723cdf0e10cSrcweir         SfxItemSet aFrmSet(pDoc->GetAttrPool(), aFrmAttrRange );
272456b35d86SArmin Le Grand 
272556b35d86SArmin Le Grand         //UUUU set correct parent to get the XFILL_NONE FillStyle as needed
272656b35d86SArmin Le Grand         aFrmSet.SetParent(&pDoc->GetDfltFrmFmt()->GetAttrSet());
272756b35d86SArmin Le Grand 
2728cdf0e10cSrcweir         //jetzt muessen die passenden Items in den Set
2729cdf0e10cSrcweir         sal_Bool bSizeFound;
2730cdf0e10cSrcweir         if(!pProps->AnyToItemSet( pDoc, aFrmSet, aGrSet, bSizeFound))
2731cdf0e10cSrcweir             throw lang::IllegalArgumentException();
2732cdf0e10cSrcweir         //der TextRange wird einzeln behandelt
2733cdf0e10cSrcweir         *aPam.GetPoint() = *aIntPam.GetPoint();
2734cdf0e10cSrcweir         if(aIntPam.HasMark())
2735cdf0e10cSrcweir         {
2736cdf0e10cSrcweir             aPam.SetMark();
2737cdf0e10cSrcweir             *aPam.GetMark() = *aIntPam.GetMark();
2738cdf0e10cSrcweir         }
2739cdf0e10cSrcweir 
2740cdf0e10cSrcweir         const SfxPoolItem* pItem;
2741cdf0e10cSrcweir         RndStdIds eAnchorId = FLY_AT_PARA;
2742cdf0e10cSrcweir         if(SFX_ITEM_SET == aFrmSet.GetItemState(RES_ANCHOR, sal_False, &pItem) )
2743cdf0e10cSrcweir         {
2744cdf0e10cSrcweir             eAnchorId = ((const SwFmtAnchor*)pItem)->GetAnchorId();
2745cdf0e10cSrcweir             if( FLY_AT_FLY == eAnchorId &&
2746cdf0e10cSrcweir                 !aPam.GetNode()->FindFlyStartNode())
2747cdf0e10cSrcweir             {
2748cdf0e10cSrcweir                 //rahmengebunden geht nur dort, wo ein Rahmen ist!
2749cdf0e10cSrcweir                 SwFmtAnchor aAnchor(FLY_AT_PARA);
2750cdf0e10cSrcweir                 aFrmSet.Put(aAnchor);
2751cdf0e10cSrcweir             }
2752cdf0e10cSrcweir             else if ((FLY_AT_PAGE == eAnchorId) &&
2753cdf0e10cSrcweir                      0 == ((const SwFmtAnchor*)pItem)->GetPageNum() )
2754cdf0e10cSrcweir             {
2755cdf0e10cSrcweir                 SwFmtAnchor aAnchor( *((const SwFmtAnchor*)pItem) );
2756cdf0e10cSrcweir                 aAnchor.SetAnchor( aPam.GetPoint() );
2757cdf0e10cSrcweir                 aFrmSet.Put(aAnchor);
2758cdf0e10cSrcweir             }
2759cdf0e10cSrcweir         }
2760cdf0e10cSrcweir 
2761cdf0e10cSrcweir         const ::uno::Any* pStyle;
2762cdf0e10cSrcweir         SwFrmFmt *pParentFrmFmt = 0;
2763cdf0e10cSrcweir         if(pProps->GetProperty(FN_UNO_FRAME_STYLE_NAME, 0, pStyle))
2764cdf0e10cSrcweir             pParentFrmFmt = lcl_GetFrmFmt( *pStyle, pDoc );
2765cdf0e10cSrcweir 
2766cdf0e10cSrcweir         SwFlyFrmFmt* pFmt = 0;
2767cdf0e10cSrcweir         if( eType == FLYCNTTYPE_FRM)
2768cdf0e10cSrcweir         {
2769cdf0e10cSrcweir             UnoActionContext aCont(pDoc);
2770cdf0e10cSrcweir             if(m_pCopySource)
2771cdf0e10cSrcweir             {
2772cdf0e10cSrcweir                 SwFmtAnchor* pAnchorItem = 0;
2773cdf0e10cSrcweir                 // the frame is inserted bound to page
2774cdf0e10cSrcweir                 // to prevent conflicts if the to-be-anchored position is part of the to-be-copied text
2775cdf0e10cSrcweir                 if (eAnchorId != FLY_AT_PAGE)
2776cdf0e10cSrcweir                 {
2777cdf0e10cSrcweir                     pAnchorItem = static_cast<SwFmtAnchor*>(aFrmSet.Get(RES_ANCHOR).Clone());
2778cdf0e10cSrcweir                     aFrmSet.Put( SwFmtAnchor( FLY_AT_PAGE, 1 ));
2779cdf0e10cSrcweir                 }
2780cdf0e10cSrcweir 
2781cdf0e10cSrcweir                 aPam.DeleteMark(); // mark position node will be deleted!
2782cdf0e10cSrcweir                 aIntPam.DeleteMark(); // mark position node will be deleted!
2783cdf0e10cSrcweir                 pFmt = pDoc->MakeFlyAndMove( *m_pCopySource, aFrmSet,
2784cdf0e10cSrcweir                                0,
2785cdf0e10cSrcweir                                pParentFrmFmt );
2786cdf0e10cSrcweir                 if(pAnchorItem && pFmt)
2787cdf0e10cSrcweir                 {
2788cdf0e10cSrcweir                     pFmt->DelFrms();
2789cdf0e10cSrcweir                     pAnchorItem->SetAnchor( m_pCopySource->Start() );
2790cdf0e10cSrcweir                     SfxItemSet aAnchorSet( pDoc->GetAttrPool(), RES_ANCHOR, RES_ANCHOR );
2791cdf0e10cSrcweir                     aAnchorSet.Put( *pAnchorItem );
2792cdf0e10cSrcweir                     pDoc->SetFlyFrmAttr( *pFmt, aAnchorSet );
2793cdf0e10cSrcweir                     delete pAnchorItem;
2794cdf0e10cSrcweir                 }
2795cdf0e10cSrcweir                 DELETEZ( m_pCopySource );
2796cdf0e10cSrcweir             }
2797cdf0e10cSrcweir             else
2798cdf0e10cSrcweir             {
2799cdf0e10cSrcweir                 pFmt = pDoc->MakeFlySection( FLY_AT_PARA, aPam.GetPoint(),
2800cdf0e10cSrcweir                                          &aFrmSet, pParentFrmFmt );
2801cdf0e10cSrcweir             }
2802cdf0e10cSrcweir             if(pFmt)
2803cdf0e10cSrcweir             {
2804cdf0e10cSrcweir                 pFmt->Add(this);
2805cdf0e10cSrcweir                 if(sName.Len())
2806cdf0e10cSrcweir                     pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt, sName);
2807cdf0e10cSrcweir             }
2808cdf0e10cSrcweir             //den SwXText wecken
2809cdf0e10cSrcweir             ((SwXTextFrame*)this)->SetDoc( bIsDescriptor ? m_pDoc : GetFrmFmt()->GetDoc() );
2810cdf0e10cSrcweir         }
2811cdf0e10cSrcweir         else if( eType == FLYCNTTYPE_GRF)
2812cdf0e10cSrcweir         {
2813cdf0e10cSrcweir             UnoActionContext aCont(pDoc);
2814cdf0e10cSrcweir             const ::uno::Any* pGraphicURL;
2815cdf0e10cSrcweir             String sGraphicURL;
2816cdf0e10cSrcweir             GraphicObject *pGrfObj = 0;
2817cdf0e10cSrcweir             if(pProps->GetProperty(FN_UNO_GRAPHIC_U_R_L, 0, pGraphicURL))
2818cdf0e10cSrcweir             {
2819cdf0e10cSrcweir                 OUString uTemp;
2820cdf0e10cSrcweir                 (*pGraphicURL) >>= uTemp;
2821cdf0e10cSrcweir                 sGraphicURL = String(uTemp);
2822cdf0e10cSrcweir                 if( sGraphicURL.EqualsAscii( sPackageProtocol,
2823cdf0e10cSrcweir                                              0, sizeof( sPackageProtocol )-1 ) )
2824cdf0e10cSrcweir                 {
2825cdf0e10cSrcweir                     pGrfObj = new GraphicObject;
2826cdf0e10cSrcweir                     pGrfObj->SetUserData( sGraphicURL );
2827cdf0e10cSrcweir                     pGrfObj->SetSwapState();
2828cdf0e10cSrcweir                     sGraphicURL.Erase();
2829cdf0e10cSrcweir                 }
2830cdf0e10cSrcweir                 else if( sGraphicURL.EqualsAscii( sGraphicObjectProtocol,
2831cdf0e10cSrcweir                                        0, sizeof(sGraphicObjectProtocol)-1 ) )
2832cdf0e10cSrcweir                 {
2833cdf0e10cSrcweir                     ByteString sId( sGraphicURL.Copy( sizeof(sGraphicObjectProtocol)-1 ),
2834cdf0e10cSrcweir                                     RTL_TEXTENCODING_ASCII_US );
2835cdf0e10cSrcweir                     pGrfObj = new GraphicObject( sId );
2836cdf0e10cSrcweir                     sGraphicURL.Erase();
2837cdf0e10cSrcweir                 }
2838cdf0e10cSrcweir             }
2839cdf0e10cSrcweir             Graphic aGraphic;
2840cdf0e10cSrcweir             const ::uno::Any* pGraphic;
2841cdf0e10cSrcweir             if( pProps->GetProperty( FN_UNO_GRAPHIC, 0, pGraphic ))
2842cdf0e10cSrcweir             {
2843cdf0e10cSrcweir                 uno::Reference< graphic::XGraphic > xGraphic;
2844cdf0e10cSrcweir                 (*pGraphic) >>= xGraphic;
2845cdf0e10cSrcweir                 aGraphic = Graphic( xGraphic );
2846cdf0e10cSrcweir             }
2847cdf0e10cSrcweir 
2848cdf0e10cSrcweir             String sFltName;
2849cdf0e10cSrcweir             const ::uno::Any* pFilter;
2850cdf0e10cSrcweir             if(pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0, pFilter))
2851cdf0e10cSrcweir             {
2852cdf0e10cSrcweir                 OUString uTemp;
2853cdf0e10cSrcweir                 (*pFilter) >>= uTemp;
2854cdf0e10cSrcweir                 sFltName = String(uTemp);
2855cdf0e10cSrcweir             }
2856cdf0e10cSrcweir 
2857cdf0e10cSrcweir             pFmt =
2858cdf0e10cSrcweir                 pGrfObj ? pDoc->Insert( aPam, *pGrfObj, &aFrmSet, &aGrSet,
2859cdf0e10cSrcweir                                         pParentFrmFmt )
2860cdf0e10cSrcweir                         : pDoc->Insert( aPam, sGraphicURL, sFltName, &aGraphic,
2861cdf0e10cSrcweir                                         &aFrmSet, &aGrSet, pParentFrmFmt  );
2862cdf0e10cSrcweir             delete pGrfObj;
2863cdf0e10cSrcweir             if(pFmt)
2864cdf0e10cSrcweir             {
2865cdf0e10cSrcweir                 SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFmt->GetCntnt().GetCntntIdx()
2866cdf0e10cSrcweir                                             ->GetIndex()+1 ]->GetGrfNode();
2867cdf0e10cSrcweir                 pGrfNd->SetChgTwipSize( !bSizeFound );
2868cdf0e10cSrcweir                 pFmt->Add(this);
2869cdf0e10cSrcweir                 if(sName.Len())
2870cdf0e10cSrcweir                     pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt, sName);
2871cdf0e10cSrcweir 
2872cdf0e10cSrcweir             }
2873cdf0e10cSrcweir             const ::uno::Any* pSurroundContour;
2874cdf0e10cSrcweir             if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurroundContour))
2875cdf0e10cSrcweir                 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SURROUND_CONTOUR)), *pSurroundContour);
2876cdf0e10cSrcweir             const ::uno::Any* pContourOutside;
2877cdf0e10cSrcweir             if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUROUTSIDE, pContourOutside))
2878cdf0e10cSrcweir                 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_CONTOUR_OUTSIDE)), *pContourOutside);
2879cdf0e10cSrcweir             const ::uno::Any* pContourPoly;
2880cdf0e10cSrcweir             if(pProps->GetProperty(FN_PARAM_COUNTOUR_PP, 0, pContourPoly))
2881cdf0e10cSrcweir                 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_CONTOUR_POLY_POLYGON)), *pContourPoly);
2882cdf0e10cSrcweir             const ::uno::Any* pPixelContour;
2883cdf0e10cSrcweir             if(pProps->GetProperty(FN_UNO_IS_PIXEL_CONTOUR, 0, pPixelContour))
2884cdf0e10cSrcweir                 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_PIXEL_CONTOUR)), *pPixelContour);
2885cdf0e10cSrcweir             const ::uno::Any* pAutoContour;
2886cdf0e10cSrcweir             if(pProps->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR, 0, pAutoContour))
2887cdf0e10cSrcweir                 setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_AUTOMATIC_CONTOUR)), *pAutoContour);
2888cdf0e10cSrcweir //            const ::uno::Any* pAltText;
2889cdf0e10cSrcweir //            if(pProps->GetProperty(FN_UNO_ALTERNATIVE_TEXT, 0, pAltText))
2890cdf0e10cSrcweir //                setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ALTERNATIVE_TEXT)), *pAltText);
2891cdf0e10cSrcweir         }
2892cdf0e10cSrcweir         else
2893cdf0e10cSrcweir         {
2894cdf0e10cSrcweir             const ::uno::Any* pCLSID = 0;
2895cdf0e10cSrcweir             const ::uno::Any* pStreamName = 0;
2896cdf0e10cSrcweir             if(!pProps->GetProperty(FN_UNO_CLSID, 0, pCLSID) && !pProps->GetProperty( FN_UNO_STREAM_NAME, 0, pStreamName ))
2897cdf0e10cSrcweir                 throw uno::RuntimeException();
2898cdf0e10cSrcweir             if(pCLSID)
2899cdf0e10cSrcweir             {
2900cdf0e10cSrcweir                 OUString aCLSID;
2901cdf0e10cSrcweir                 SvGlobalName aClassName;
2902cdf0e10cSrcweir                 uno::Reference < embed::XEmbeddedObject > xIPObj;
2903cdf0e10cSrcweir                 std::auto_ptr < comphelper::EmbeddedObjectContainer > pCnt;
2904cdf0e10cSrcweir                 if( (*pCLSID) >>= aCLSID )
2905cdf0e10cSrcweir                 {
2906cdf0e10cSrcweir                     if( !aClassName.MakeId( aCLSID ) )
2907cdf0e10cSrcweir                     {
2908cdf0e10cSrcweir                         lang::IllegalArgumentException aExcept;
2909cdf0e10cSrcweir                         aExcept.Message = OUString::createFromAscii("CLSID invalid");
2910cdf0e10cSrcweir                         throw aExcept;
2911cdf0e10cSrcweir                     }
2912cdf0e10cSrcweir 
2913cdf0e10cSrcweir                     pCnt.reset( new comphelper::EmbeddedObjectContainer );
2914cdf0e10cSrcweir                     ::rtl::OUString aName;
2915cdf0e10cSrcweir                     xIPObj = pCnt->CreateEmbeddedObject( aClassName.GetByteSequence(), aName );
2916cdf0e10cSrcweir                 }
2917cdf0e10cSrcweir                 if ( xIPObj.is() )
2918cdf0e10cSrcweir                 {
2919cdf0e10cSrcweir                     //TODO/LATER: MISCSTATUS_RESIZEONPRINTERCHANGE
2920cdf0e10cSrcweir                     //if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xIPObj->GetMiscStatus() && pDoc->getPrinter( false ) )
2921cdf0e10cSrcweir                     //    xIPObj->OnDocumentPrinterChanged( pDoc->getPrinter( false ) );
2922cdf0e10cSrcweir 
2923cdf0e10cSrcweir                     UnoActionContext aAction(pDoc);
2924cdf0e10cSrcweir                     pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
2925cdf0e10cSrcweir                     if(!bSizeFound)
2926cdf0e10cSrcweir                     {
2927cdf0e10cSrcweir                         //TODO/LATER: from where do I get a ViewAspect? And how do I transport it to the OLENode?
2928cdf0e10cSrcweir                         sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
2929cdf0e10cSrcweir 
2930cdf0e10cSrcweir                         // TODO/LEAN: VisualArea still needs running state
2931cdf0e10cSrcweir                         svt::EmbeddedObjectRef::TryRunningState( xIPObj );
2932cdf0e10cSrcweir 
2933cdf0e10cSrcweir                         // set parent to get correct VisArea(in case of object needing parent printer)
2934cdf0e10cSrcweir                         uno::Reference < container::XChild > xChild( xIPObj, uno::UNO_QUERY );
2935cdf0e10cSrcweir                         if ( xChild.is() )
2936cdf0e10cSrcweir                             xChild->setParent( pDoc->GetDocShell()->GetModel() );
2937cdf0e10cSrcweir 
2938cdf0e10cSrcweir                         //The Size should be suggested by the OLE server if not manually set
2939cdf0e10cSrcweir                         MapUnit aRefMap = VCLUnoHelper::UnoEmbed2VCLMapUnit( xIPObj->getMapUnit( nAspect ) );
2940cdf0e10cSrcweir                         awt::Size aSize;
2941cdf0e10cSrcweir                         try
2942cdf0e10cSrcweir                         {
2943cdf0e10cSrcweir                             aSize = xIPObj->getVisualAreaSize( nAspect );
2944cdf0e10cSrcweir                         }
2945cdf0e10cSrcweir                         catch ( embed::NoVisualAreaSizeException& )
2946cdf0e10cSrcweir                         {
2947cdf0e10cSrcweir                             // the default size will be set later
2948cdf0e10cSrcweir                         }
2949cdf0e10cSrcweir 
2950cdf0e10cSrcweir                         Size aSz( aSize.Width, aSize.Height );
2951cdf0e10cSrcweir                         if ( !aSz.Width() || !aSz.Height() )
2952cdf0e10cSrcweir                         {
2953cdf0e10cSrcweir                             aSz.Width() = aSz.Height() = 5000;
2954cdf0e10cSrcweir                             aSz = OutputDevice::LogicToLogic
2955cdf0e10cSrcweir                                                     ( aSz, MapMode( MAP_100TH_MM ), aRefMap );
2956cdf0e10cSrcweir                         }
2957cdf0e10cSrcweir                         MapMode aMyMap( MAP_TWIP );
2958cdf0e10cSrcweir                         aSz = OutputDevice::LogicToLogic( aSz, aRefMap, aMyMap );
2959cdf0e10cSrcweir                         SwFmtFrmSize aFrmSz;
2960cdf0e10cSrcweir                         aFrmSz.SetSize(aSz);
2961cdf0e10cSrcweir                         aFrmSet.Put(aFrmSz);
2962cdf0e10cSrcweir                     }
2963cdf0e10cSrcweir                     SwFlyFrmFmt* pFmt2 = 0;
2964cdf0e10cSrcweir 
2965cdf0e10cSrcweir                     // TODO/LATER: Is it the only possible aspect here?
2966cdf0e10cSrcweir                     sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
2967cdf0e10cSrcweir                     ::svt::EmbeddedObjectRef xObjRef( xIPObj, nAspect );
2968cdf0e10cSrcweir                     pFmt2 = pDoc->Insert(aPam, xObjRef, &aFrmSet, NULL, NULL );
2969cdf0e10cSrcweir                     ASSERT( pFmt2, "Doc->Insert(notxt) failed." );
2970cdf0e10cSrcweir 
2971cdf0e10cSrcweir                     pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
2972cdf0e10cSrcweir                     pFmt2->Add(this);
2973cdf0e10cSrcweir                     if(sName.Len())
2974cdf0e10cSrcweir                         pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt2, sName);
2975cdf0e10cSrcweir                 }
2976cdf0e10cSrcweir             }
2977cdf0e10cSrcweir             else if( pStreamName )
2978cdf0e10cSrcweir             {
2979cdf0e10cSrcweir                 ::rtl::OUString sStreamName;
2980cdf0e10cSrcweir                 (*pStreamName) >>= sStreamName;
2981cdf0e10cSrcweir                 pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
2982cdf0e10cSrcweir 
2983cdf0e10cSrcweir                 SwFlyFrmFmt* pFrmFmt = 0;
2984cdf0e10cSrcweir                 pFrmFmt = pDoc->InsertOLE( aPam, sStreamName, embed::Aspects::MSOLE_CONTENT, &aFrmSet, NULL, NULL );
2985cdf0e10cSrcweir                 pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
2986cdf0e10cSrcweir                 pFrmFmt->Add(this);
2987cdf0e10cSrcweir                 if(sName.Len())
2988cdf0e10cSrcweir                     pDoc->SetFlyName((SwFlyFrmFmt&)*pFrmFmt, sName);
2989cdf0e10cSrcweir             }
2990cdf0e10cSrcweir         }
2991cdf0e10cSrcweir         if( pFmt && pDoc->GetDrawModel() )
2992cdf0e10cSrcweir             GetOrCreateSdrObject( pFmt );
2993cdf0e10cSrcweir         const ::uno::Any* pOrder;
2994cdf0e10cSrcweir         if( pProps->GetProperty(FN_UNO_Z_ORDER, 0, pOrder) )
2995cdf0e10cSrcweir             setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_Z_ORDER)), *pOrder);
2996cdf0e10cSrcweir         const ::uno::Any* pReplacement;
2997cdf0e10cSrcweir         if( pProps->GetProperty(FN_UNO_REPLACEMENT_GRAPHIC, 0, pReplacement) )
2998cdf0e10cSrcweir             setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_GRAPHIC)), *pReplacement);
2999cdf0e10cSrcweir         // --> OD 2009-07-13 #i73249#
3000cdf0e10cSrcweir         // new attribute Title
3001cdf0e10cSrcweir         const ::uno::Any* pTitle;
3002cdf0e10cSrcweir         if ( pProps->GetProperty(FN_UNO_TITLE, 0, pTitle) )
3003cdf0e10cSrcweir         {
3004cdf0e10cSrcweir             setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_TITLE)), *pTitle);
3005cdf0e10cSrcweir         }
3006cdf0e10cSrcweir         // new attribute Description
3007cdf0e10cSrcweir         const ::uno::Any* pDescription;
3008cdf0e10cSrcweir         if ( pProps->GetProperty(FN_UNO_DESCRIPTION, 0, pDescription) )
3009cdf0e10cSrcweir         {
3010cdf0e10cSrcweir             setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_DESCRIPTION)), *pDescription);
3011cdf0e10cSrcweir         }
3012cdf0e10cSrcweir         // <--
3013cdf0e10cSrcweir     }
3014cdf0e10cSrcweir     else
3015cdf0e10cSrcweir         throw lang::IllegalArgumentException();
3016cdf0e10cSrcweir     //setzt das Flag zurueck und loescht den Descriptor-Pointer
3017cdf0e10cSrcweir     ResetDescriptor();
3018cdf0e10cSrcweir }
3019cdf0e10cSrcweir 
attach(const uno::Reference<text::XTextRange> & xTextRange)3020cdf0e10cSrcweir void SwXFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
3021cdf0e10cSrcweir     throw( lang::IllegalArgumentException, uno::RuntimeException )
3022cdf0e10cSrcweir {
3023cdf0e10cSrcweir     SwFrmFmt* pFmt;
3024cdf0e10cSrcweir     if(IsDescriptor())
3025cdf0e10cSrcweir         attachToRange(xTextRange);
3026cdf0e10cSrcweir     else if(0 != (pFmt = GetFrmFmt()))
3027cdf0e10cSrcweir     {
3028cdf0e10cSrcweir         uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
3029cdf0e10cSrcweir         SwXTextRange* pRange = 0;
3030cdf0e10cSrcweir         OTextCursorHelper* pCursor = 0;
3031cdf0e10cSrcweir         if(xRangeTunnel.is())
3032cdf0e10cSrcweir         {
3033cdf0e10cSrcweir             pRange  = reinterpret_cast< SwXTextRange * >(
3034cdf0e10cSrcweir                     sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
3035cdf0e10cSrcweir             pCursor = reinterpret_cast< OTextCursorHelper * >(
3036cdf0e10cSrcweir                     sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
3037cdf0e10cSrcweir         }
3038cdf0e10cSrcweir         SwDoc* pDoc = pFmt->GetDoc();
3039cdf0e10cSrcweir         SwUnoInternalPaM aIntPam(*pDoc);
3040cdf0e10cSrcweir         if (::sw::XTextRangeToSwPaM(aIntPam, xTextRange))
3041cdf0e10cSrcweir         {
3042cdf0e10cSrcweir             SfxItemSet aSet( pDoc->GetAttrPool(),
3043cdf0e10cSrcweir                         RES_ANCHOR, RES_ANCHOR );
3044cdf0e10cSrcweir             aSet.SetParent(&pFmt->GetAttrSet());
3045cdf0e10cSrcweir             SwFmtAnchor aAnchor = (const SwFmtAnchor&)aSet.Get(RES_ANCHOR);
3046cdf0e10cSrcweir             aAnchor.SetAnchor( aIntPam.Start() );
3047cdf0e10cSrcweir             aSet.Put(aAnchor);
3048cdf0e10cSrcweir             pDoc->SetFlyFrmAttr( *pFmt, aSet );
3049cdf0e10cSrcweir         }
3050cdf0e10cSrcweir         else
3051cdf0e10cSrcweir             throw lang::IllegalArgumentException();
3052cdf0e10cSrcweir     }
3053cdf0e10cSrcweir }
3054cdf0e10cSrcweir 
getPosition(void)3055cdf0e10cSrcweir awt::Point SwXFrame::getPosition(void) throw( uno::RuntimeException )
3056cdf0e10cSrcweir {
3057cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3058cdf0e10cSrcweir     uno::RuntimeException aRuntime;
3059cdf0e10cSrcweir     aRuntime.Message = C2U("position cannot be determined with this method");
3060cdf0e10cSrcweir     throw aRuntime;
3061cdf0e10cSrcweir }
3062cdf0e10cSrcweir 
setPosition(const awt::Point &)3063cdf0e10cSrcweir void SwXFrame::setPosition(const awt::Point& /*aPosition*/) throw( uno::RuntimeException )
3064cdf0e10cSrcweir {
3065cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3066cdf0e10cSrcweir     uno::RuntimeException aRuntime;
3067cdf0e10cSrcweir     aRuntime.Message = C2U("position cannot be changed with this method");
3068cdf0e10cSrcweir     throw aRuntime;
3069cdf0e10cSrcweir }
3070cdf0e10cSrcweir 
getSize(void)3071cdf0e10cSrcweir awt::Size SwXFrame::getSize(void) throw( uno::RuntimeException )
3072cdf0e10cSrcweir {
3073cdf0e10cSrcweir     const ::uno::Any aVal = getPropertyValue(C2U("Size"));
3074cdf0e10cSrcweir     awt::Size* pRet =  (awt::Size*)aVal.getValue();
3075cdf0e10cSrcweir     return *pRet;
3076cdf0e10cSrcweir }
3077cdf0e10cSrcweir 
setSize(const awt::Size & aSize)3078cdf0e10cSrcweir void SwXFrame::setSize(const awt::Size& aSize)
3079cdf0e10cSrcweir     throw( beans::PropertyVetoException, uno::RuntimeException )
3080cdf0e10cSrcweir {
3081cdf0e10cSrcweir     const ::uno::Any aVal(&aSize, ::getCppuType(static_cast<const awt::Size*>(0)));
3082cdf0e10cSrcweir     setPropertyValue(C2U("Size"), aVal);
3083cdf0e10cSrcweir }
3084cdf0e10cSrcweir 
getShapeType(void)3085cdf0e10cSrcweir OUString SwXFrame::getShapeType(void) throw( uno::RuntimeException )
3086cdf0e10cSrcweir {
3087cdf0e10cSrcweir     return C2U("FrameShape");
3088cdf0e10cSrcweir }
3089cdf0e10cSrcweir 
3090cdf0e10cSrcweir 
3091cdf0e10cSrcweir /******************************************************************
3092cdf0e10cSrcweir  *  SwXTextFrame
3093cdf0e10cSrcweir  ******************************************************************/
3094cdf0e10cSrcweir 
SwXTextFrame(SwDoc * _pDoc)3095cdf0e10cSrcweir SwXTextFrame::SwXTextFrame( SwDoc *_pDoc ) :
3096cdf0e10cSrcweir     SwXText(0, CURSOR_FRAME),
3097cdf0e10cSrcweir     SwXFrame(FLYCNTTYPE_FRM, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_FRAME), _pDoc )
3098cdf0e10cSrcweir {
3099cdf0e10cSrcweir }
3100cdf0e10cSrcweir 
SwXTextFrame(SwFrmFmt & rFmt)3101cdf0e10cSrcweir SwXTextFrame::SwXTextFrame(SwFrmFmt& rFmt) :
3102cdf0e10cSrcweir     SwXText(rFmt.GetDoc(), CURSOR_FRAME),
3103cdf0e10cSrcweir     SwXFrame(rFmt, FLYCNTTYPE_FRM, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_FRAME))
3104cdf0e10cSrcweir {
3105cdf0e10cSrcweir 
3106cdf0e10cSrcweir }
3107cdf0e10cSrcweir 
~SwXTextFrame()3108cdf0e10cSrcweir SwXTextFrame::~SwXTextFrame()
3109cdf0e10cSrcweir {
3110cdf0e10cSrcweir }
3111cdf0e10cSrcweir 
acquire()3112cdf0e10cSrcweir void SAL_CALL SwXTextFrame::acquire(  )throw()
3113cdf0e10cSrcweir {
3114cdf0e10cSrcweir     SwXFrame::acquire();
3115cdf0e10cSrcweir }
3116cdf0e10cSrcweir 
release()3117cdf0e10cSrcweir void SAL_CALL SwXTextFrame::release(  )throw()
3118cdf0e10cSrcweir {
3119cdf0e10cSrcweir     SwXFrame::release();
3120cdf0e10cSrcweir }
3121cdf0e10cSrcweir 
queryInterface(const uno::Type & aType)3122cdf0e10cSrcweir ::uno::Any SAL_CALL SwXTextFrame::queryInterface( const uno::Type& aType )
3123cdf0e10cSrcweir     throw (uno::RuntimeException)
3124cdf0e10cSrcweir {
3125cdf0e10cSrcweir     ::uno::Any aRet = SwXFrame::queryInterface(aType);
3126cdf0e10cSrcweir     if(aRet.getValueType() == ::getCppuVoidType())
3127cdf0e10cSrcweir         aRet = SwXText::queryInterface(aType);
3128cdf0e10cSrcweir     if(aRet.getValueType() == ::getCppuVoidType())
3129cdf0e10cSrcweir         aRet = SwXTextFrameBaseClass::queryInterface(aType);
3130cdf0e10cSrcweir     return aRet;
3131cdf0e10cSrcweir }
3132cdf0e10cSrcweir 
getTypes()3133cdf0e10cSrcweir uno::Sequence< uno::Type > SAL_CALL SwXTextFrame::getTypes(  ) throw(uno::RuntimeException)
3134cdf0e10cSrcweir {
3135cdf0e10cSrcweir     uno::Sequence< uno::Type > aTextFrameTypes = SwXTextFrameBaseClass::getTypes();
3136cdf0e10cSrcweir     uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
3137cdf0e10cSrcweir     uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
3138cdf0e10cSrcweir 
3139cdf0e10cSrcweir     long nIndex = aTextFrameTypes.getLength();
3140cdf0e10cSrcweir     aTextFrameTypes.realloc(
3141cdf0e10cSrcweir         aTextFrameTypes.getLength() +
3142cdf0e10cSrcweir         aFrameTypes.getLength() +
3143cdf0e10cSrcweir         aTextTypes.getLength());
3144cdf0e10cSrcweir 
3145cdf0e10cSrcweir     uno::Type* pTextFrameTypes = aTextFrameTypes.getArray();
3146cdf0e10cSrcweir     const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
3147cdf0e10cSrcweir     long nPos;
3148cdf0e10cSrcweir     for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
3149cdf0e10cSrcweir         pTextFrameTypes[nIndex++] = pFrameTypes[nPos];
3150cdf0e10cSrcweir 
3151cdf0e10cSrcweir     const uno::Type* pTextTypes = aTextTypes.getConstArray();
3152cdf0e10cSrcweir     for(nPos = 0; nPos <aTextTypes.getLength(); nPos++)
3153cdf0e10cSrcweir         pTextFrameTypes[nIndex++] = pTextTypes[nPos];
3154cdf0e10cSrcweir 
3155cdf0e10cSrcweir     return aTextFrameTypes;
3156cdf0e10cSrcweir }
3157cdf0e10cSrcweir 
getImplementationId()3158cdf0e10cSrcweir uno::Sequence< sal_Int8 > SAL_CALL SwXTextFrame::getImplementationId(  ) throw(uno::RuntimeException)
3159cdf0e10cSrcweir {
3160cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3161cdf0e10cSrcweir     static uno::Sequence< sal_Int8 > aId( 16 );
3162cdf0e10cSrcweir     static sal_Bool bInit = sal_False;
3163cdf0e10cSrcweir     if(!bInit)
3164cdf0e10cSrcweir     {
3165cdf0e10cSrcweir         rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
3166cdf0e10cSrcweir         bInit = sal_True;
3167cdf0e10cSrcweir     }
3168cdf0e10cSrcweir     return aId;
3169cdf0e10cSrcweir }
3170cdf0e10cSrcweir 
getText(void)3171cdf0e10cSrcweir uno::Reference< text::XText >  SwXTextFrame::getText(void) throw( uno::RuntimeException )
3172cdf0e10cSrcweir {
3173cdf0e10cSrcweir     return this;
3174cdf0e10cSrcweir }
3175cdf0e10cSrcweir 
GetStartNode() const3176cdf0e10cSrcweir const SwStartNode *SwXTextFrame::GetStartNode() const
3177cdf0e10cSrcweir {
3178cdf0e10cSrcweir     const SwStartNode *pSttNd = 0;
3179cdf0e10cSrcweir 
3180cdf0e10cSrcweir     SwFrmFmt* pFmt = GetFrmFmt();
3181cdf0e10cSrcweir     if(pFmt)
3182cdf0e10cSrcweir     {
3183cdf0e10cSrcweir         const SwFmtCntnt& rFlyCntnt = pFmt->GetCntnt();
3184cdf0e10cSrcweir         if( rFlyCntnt.GetCntntIdx() )
3185cdf0e10cSrcweir             pSttNd = rFlyCntnt.GetCntntIdx()->GetNode().GetStartNode();
3186cdf0e10cSrcweir     }
3187cdf0e10cSrcweir 
3188cdf0e10cSrcweir     return pSttNd;
3189cdf0e10cSrcweir }
3190cdf0e10cSrcweir 
3191cdf0e10cSrcweir uno::Reference< text::XTextCursor >
CreateCursor()3192cdf0e10cSrcweir SwXTextFrame::CreateCursor() throw (uno::RuntimeException)
3193cdf0e10cSrcweir {
3194cdf0e10cSrcweir     return createTextCursor();
3195cdf0e10cSrcweir }
3196cdf0e10cSrcweir 
createTextCursor(void)3197cdf0e10cSrcweir uno::Reference< text::XTextCursor >  SwXTextFrame::createTextCursor(void) throw( uno::RuntimeException )
3198cdf0e10cSrcweir {
3199cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3200cdf0e10cSrcweir     uno::Reference< text::XTextCursor >  aRef;
3201cdf0e10cSrcweir     SwFrmFmt* pFmt = GetFrmFmt();
3202cdf0e10cSrcweir     if(pFmt)
3203cdf0e10cSrcweir     {
3204cdf0e10cSrcweir         //save current start node to be able to check if there is content after the table -
3205cdf0e10cSrcweir         //otherwise the cursor would be in the body text!
3206cdf0e10cSrcweir         const SwNode& rNode = pFmt->GetCntnt().GetCntntIdx()->GetNode();
3207cdf0e10cSrcweir         const SwStartNode* pOwnStartNode = rNode.FindSttNodeByType(SwFlyStartNode);
3208cdf0e10cSrcweir 
3209cdf0e10cSrcweir         SwPaM aPam(rNode);
3210cdf0e10cSrcweir         aPam.Move(fnMoveForward, fnGoNode);
3211cdf0e10cSrcweir         SwTableNode* pTblNode = aPam.GetNode()->FindTableNode();
3212cdf0e10cSrcweir         SwCntntNode* pCont = 0;
3213cdf0e10cSrcweir         while( pTblNode )
3214cdf0e10cSrcweir         {
3215cdf0e10cSrcweir             aPam.GetPoint()->nNode = *pTblNode->EndOfSectionNode();
3216cdf0e10cSrcweir             pCont = GetDoc()->GetNodes().GoNext(&aPam.GetPoint()->nNode);
3217cdf0e10cSrcweir             pTblNode = pCont->FindTableNode();
3218cdf0e10cSrcweir         }
3219cdf0e10cSrcweir         if(pCont)
3220cdf0e10cSrcweir             aPam.GetPoint()->nContent.Assign(pCont, 0);
3221cdf0e10cSrcweir 
3222cdf0e10cSrcweir         const SwStartNode* pNewStartNode =
3223cdf0e10cSrcweir             aPam.GetNode()->FindSttNodeByType(SwFlyStartNode);
3224cdf0e10cSrcweir         if(!pNewStartNode || pNewStartNode != pOwnStartNode)
3225cdf0e10cSrcweir         {
3226cdf0e10cSrcweir             uno::RuntimeException aExcept;
322724c56ab9SHerbert Dürr             aExcept.Message = C2U("no text available");
3228cdf0e10cSrcweir             throw aExcept;
3229cdf0e10cSrcweir         }
3230cdf0e10cSrcweir 
3231cdf0e10cSrcweir         SwXTextCursor *const pXCursor = new SwXTextCursor(
3232cdf0e10cSrcweir                  *pFmt->GetDoc(), this, CURSOR_FRAME, *aPam.GetPoint());
3233cdf0e10cSrcweir         aRef =  static_cast<text::XWordCursor*>(pXCursor);
3234cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
3235cdf0e10cSrcweir         SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
3236cdf0e10cSrcweir         (void) pUnoCrsr;
3237cdf0e10cSrcweir #endif
3238cdf0e10cSrcweir     }
3239cdf0e10cSrcweir     else
3240cdf0e10cSrcweir         throw uno::RuntimeException();
3241cdf0e10cSrcweir     return aRef;
3242cdf0e10cSrcweir }
3243cdf0e10cSrcweir 
createTextCursorByRange(const uno::Reference<text::XTextRange> & aTextPosition)3244cdf0e10cSrcweir uno::Reference< text::XTextCursor >  SwXTextFrame::createTextCursorByRange(const uno::Reference< text::XTextRange > & aTextPosition) throw( uno::RuntimeException )
3245cdf0e10cSrcweir {
3246cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3247cdf0e10cSrcweir     uno::Reference< text::XTextCursor >  aRef;
3248cdf0e10cSrcweir     SwFrmFmt* pFmt = GetFrmFmt();
3249cdf0e10cSrcweir     SwUnoInternalPaM aPam(*GetDoc());
3250cdf0e10cSrcweir     if (pFmt && ::sw::XTextRangeToSwPaM(aPam, aTextPosition))
3251cdf0e10cSrcweir     {
3252cdf0e10cSrcweir         SwNode& rNode = pFmt->GetCntnt().GetCntntIdx()->GetNode();
3253cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
3254cdf0e10cSrcweir         const SwStartNode* p1 = aPam.GetNode()->FindFlyStartNode();
3255cdf0e10cSrcweir         const SwStartNode* p2 = rNode.FindFlyStartNode();
3256cdf0e10cSrcweir         (void)p1;
3257cdf0e10cSrcweir         (void)p2;
3258cdf0e10cSrcweir #endif
3259cdf0e10cSrcweir         if(aPam.GetNode()->FindFlyStartNode() == rNode.FindFlyStartNode())
3260cdf0e10cSrcweir         {
3261cdf0e10cSrcweir             aRef = static_cast<text::XWordCursor*>(
3262cdf0e10cSrcweir                     new SwXTextCursor(*pFmt->GetDoc(), this, CURSOR_FRAME,
3263cdf0e10cSrcweir                         *aPam.GetPoint(), aPam.GetMark()));
3264cdf0e10cSrcweir         }
3265cdf0e10cSrcweir     }
3266cdf0e10cSrcweir     else
3267cdf0e10cSrcweir         throw uno::RuntimeException();
3268cdf0e10cSrcweir     return aRef;
3269cdf0e10cSrcweir }
3270cdf0e10cSrcweir 
createEnumeration(void)3271cdf0e10cSrcweir uno::Reference< container::XEnumeration >  SwXTextFrame::createEnumeration(void) throw( uno::RuntimeException )
3272cdf0e10cSrcweir {
3273cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3274cdf0e10cSrcweir     uno::Reference< container::XEnumeration >  aRef;
3275cdf0e10cSrcweir     SwFrmFmt* pFmt = GetFrmFmt();
3276cdf0e10cSrcweir     if(pFmt)
3277cdf0e10cSrcweir     {
3278cdf0e10cSrcweir         SwPosition aPos(pFmt->GetCntnt().GetCntntIdx()->GetNode());
3279cdf0e10cSrcweir         ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
3280cdf0e10cSrcweir                 GetDoc()->CreateUnoCrsr(aPos, sal_False));
3281cdf0e10cSrcweir         pUnoCursor->Move(fnMoveForward, fnGoNode);
3282cdf0e10cSrcweir //      // no Cursor in protected sections
3283cdf0e10cSrcweir //      SwCrsrSaveState aSave( *pUnoCrsr );
3284cdf0e10cSrcweir //      if(pUnoCrsr->IsInProtectTable( sal_True ) ||
3285cdf0e10cSrcweir //          pUnoCrsr->IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS ))
3286cdf0e10cSrcweir //          throw  uno::RuntimeException() );
3287cdf0e10cSrcweir         aRef = new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_FRAME);
3288cdf0e10cSrcweir     }
3289cdf0e10cSrcweir     return aRef;
3290cdf0e10cSrcweir }
3291cdf0e10cSrcweir 
getElementType(void)3292cdf0e10cSrcweir uno::Type  SwXTextFrame::getElementType(void) throw( uno::RuntimeException )
3293cdf0e10cSrcweir {
3294cdf0e10cSrcweir     return ::getCppuType(static_cast<uno::Reference<text::XTextRange>*>(0));
3295cdf0e10cSrcweir }
3296cdf0e10cSrcweir 
hasElements(void)3297cdf0e10cSrcweir sal_Bool SwXTextFrame::hasElements(void) throw( uno::RuntimeException )
3298cdf0e10cSrcweir {
3299cdf0e10cSrcweir     return sal_True;
3300cdf0e10cSrcweir }
3301cdf0e10cSrcweir 
attach(const uno::Reference<text::XTextRange> & xTextRange)3302cdf0e10cSrcweir void SwXTextFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
3303cdf0e10cSrcweir     throw( lang::IllegalArgumentException, uno::RuntimeException )
3304cdf0e10cSrcweir {
3305cdf0e10cSrcweir     SwXFrame::attach(xTextRange);
3306cdf0e10cSrcweir }
3307cdf0e10cSrcweir 
getAnchor(void)3308cdf0e10cSrcweir uno::Reference< text::XTextRange >  SwXTextFrame::getAnchor(void) throw( uno::RuntimeException )
3309cdf0e10cSrcweir {
3310cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3311cdf0e10cSrcweir     return SwXFrame::getAnchor();
3312cdf0e10cSrcweir }
3313cdf0e10cSrcweir 
dispose(void)3314cdf0e10cSrcweir void SwXTextFrame::dispose(void) throw( uno::RuntimeException )
3315cdf0e10cSrcweir {
3316cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3317cdf0e10cSrcweir     SwXFrame::dispose();
3318cdf0e10cSrcweir }
3319cdf0e10cSrcweir 
addEventListener(const uno::Reference<lang::XEventListener> & aListener)3320cdf0e10cSrcweir void SwXTextFrame::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
3321cdf0e10cSrcweir {
3322cdf0e10cSrcweir     SwXFrame::addEventListener(aListener);
3323cdf0e10cSrcweir }
3324cdf0e10cSrcweir 
removeEventListener(const uno::Reference<lang::XEventListener> & aListener)3325cdf0e10cSrcweir void SwXTextFrame::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
3326cdf0e10cSrcweir {
3327cdf0e10cSrcweir     SwXFrame::removeEventListener(aListener);
3328cdf0e10cSrcweir }
3329cdf0e10cSrcweir 
getImplementationName(void)3330cdf0e10cSrcweir OUString SwXTextFrame::getImplementationName(void) throw( uno::RuntimeException )
3331cdf0e10cSrcweir {
3332cdf0e10cSrcweir     return C2U("SwXTextFrame");
3333cdf0e10cSrcweir }
3334cdf0e10cSrcweir 
supportsService(const OUString & rServiceName)3335cdf0e10cSrcweir sal_Bool SwXTextFrame::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
3336cdf0e10cSrcweir {
3337cdf0e10cSrcweir     return COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.Text")||
3338cdf0e10cSrcweir             COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextFrame")||
3339cdf0e10cSrcweir                     SwXFrame::supportsService(rServiceName);
3340cdf0e10cSrcweir }
3341cdf0e10cSrcweir 
getSupportedServiceNames(void)3342cdf0e10cSrcweir uno::Sequence< OUString > SwXTextFrame::getSupportedServiceNames(void) throw( uno::RuntimeException )
3343cdf0e10cSrcweir {
3344cdf0e10cSrcweir     uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
3345cdf0e10cSrcweir     aRet.realloc(aRet.getLength() + 2);
3346cdf0e10cSrcweir     OUString* pArray = aRet.getArray();
3347cdf0e10cSrcweir     pArray[aRet.getLength() - 2] = C2U("com.sun.star.text.TextFrame");
3348cdf0e10cSrcweir     pArray[aRet.getLength() - 1] = C2U("com.sun.star.text.Text");
3349cdf0e10cSrcweir     return aRet;
3350cdf0e10cSrcweir }
3351cdf0e10cSrcweir 
operator new(size_t t)3352cdf0e10cSrcweir void * SAL_CALL SwXTextFrame::operator new( size_t t) throw()
3353cdf0e10cSrcweir {
3354cdf0e10cSrcweir     return SwXTextFrameBaseClass::operator new( t);
3355cdf0e10cSrcweir }
3356cdf0e10cSrcweir 
operator delete(void * p)3357cdf0e10cSrcweir void SAL_CALL SwXTextFrame::operator delete( void * p) throw()
3358cdf0e10cSrcweir {
3359cdf0e10cSrcweir     SwXTextFrameBaseClass::operator delete(p);
3360cdf0e10cSrcweir }
3361cdf0e10cSrcweir 
getEvents()3362cdf0e10cSrcweir uno::Reference<container::XNameReplace > SAL_CALL SwXTextFrame::getEvents()
3363cdf0e10cSrcweir     throw(uno::RuntimeException)
3364cdf0e10cSrcweir {
3365cdf0e10cSrcweir     return new SwFrameEventDescriptor( *this );
3366cdf0e10cSrcweir }
3367cdf0e10cSrcweir 
getSomething(const uno::Sequence<sal_Int8> & rId)3368cdf0e10cSrcweir sal_Int64 SAL_CALL SwXTextFrame::getSomething( const uno::Sequence< sal_Int8 >& rId )
3369cdf0e10cSrcweir     throw(uno::RuntimeException)
3370cdf0e10cSrcweir {
3371cdf0e10cSrcweir     sal_Int64 nRet = SwXFrame::getSomething( rId );
3372cdf0e10cSrcweir     if( !nRet )
3373cdf0e10cSrcweir         nRet = SwXText::getSomething( rId );
3374cdf0e10cSrcweir 
3375cdf0e10cSrcweir     return nRet;
3376cdf0e10cSrcweir }
3377cdf0e10cSrcweir 
getPropertyValue(const OUString & rPropertyName)3378cdf0e10cSrcweir ::uno::Any SwXTextFrame::getPropertyValue(const OUString& rPropertyName)
3379cdf0e10cSrcweir     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
3380cdf0e10cSrcweir {
3381cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3382cdf0e10cSrcweir     ::uno::Any aRet;
3383cdf0e10cSrcweir     if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_START_REDLINE))||
3384cdf0e10cSrcweir             rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_END_REDLINE)))
3385cdf0e10cSrcweir     {
3386cdf0e10cSrcweir         //redline can only be returned if it's a living object
3387cdf0e10cSrcweir         if(!IsDescriptor())
3388cdf0e10cSrcweir             aRet = SwXText::getPropertyValue(rPropertyName);
3389cdf0e10cSrcweir     }
3390cdf0e10cSrcweir     else
3391cdf0e10cSrcweir         aRet = SwXFrame::getPropertyValue(rPropertyName);
3392cdf0e10cSrcweir     return aRet;
3393cdf0e10cSrcweir }
3394cdf0e10cSrcweir /******************************************************************
3395cdf0e10cSrcweir  *  SwXTextGraphicObject
3396cdf0e10cSrcweir  ******************************************************************/
3397cdf0e10cSrcweir 
SwXTextGraphicObject(SwDoc * pDoc)3398cdf0e10cSrcweir SwXTextGraphicObject::SwXTextGraphicObject( SwDoc *pDoc ) :
3399cdf0e10cSrcweir     SwXFrame(FLYCNTTYPE_GRF, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC), pDoc)
3400cdf0e10cSrcweir {
3401cdf0e10cSrcweir }
3402cdf0e10cSrcweir 
SwXTextGraphicObject(SwFrmFmt & rFmt)3403cdf0e10cSrcweir SwXTextGraphicObject::SwXTextGraphicObject(SwFrmFmt& rFmt) :
3404cdf0e10cSrcweir     SwXFrame(rFmt, FLYCNTTYPE_GRF, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC))
3405cdf0e10cSrcweir {
3406cdf0e10cSrcweir 
3407cdf0e10cSrcweir }
3408cdf0e10cSrcweir 
~SwXTextGraphicObject()3409cdf0e10cSrcweir SwXTextGraphicObject::~SwXTextGraphicObject()
3410cdf0e10cSrcweir {
3411cdf0e10cSrcweir 
3412cdf0e10cSrcweir }
3413cdf0e10cSrcweir 
acquire()3414cdf0e10cSrcweir void SAL_CALL SwXTextGraphicObject::acquire(  )throw()
3415cdf0e10cSrcweir {
3416cdf0e10cSrcweir     SwXFrame::acquire();
3417cdf0e10cSrcweir }
3418cdf0e10cSrcweir 
release()3419cdf0e10cSrcweir void SAL_CALL SwXTextGraphicObject::release(  )throw()
3420cdf0e10cSrcweir {
3421cdf0e10cSrcweir     SwXFrame::release();
3422cdf0e10cSrcweir }
3423cdf0e10cSrcweir 
queryInterface(const uno::Type & aType)3424cdf0e10cSrcweir ::uno::Any SAL_CALL SwXTextGraphicObject::queryInterface( const uno::Type& aType )
3425cdf0e10cSrcweir     throw(uno::RuntimeException)
3426cdf0e10cSrcweir {
3427cdf0e10cSrcweir     ::uno::Any aRet = SwXFrame::queryInterface(aType);
3428cdf0e10cSrcweir     if(aRet.getValueType() == ::getCppuVoidType())
3429cdf0e10cSrcweir         aRet = SwXTextGraphicObjectBaseClass::queryInterface(aType);
3430cdf0e10cSrcweir     return aRet;
3431cdf0e10cSrcweir }
3432cdf0e10cSrcweir 
3433cdf0e10cSrcweir uno::Sequence< uno::Type > SAL_CALL
getTypes()3434cdf0e10cSrcweir     SwXTextGraphicObject::getTypes(  ) throw(uno::RuntimeException)
3435cdf0e10cSrcweir {
3436cdf0e10cSrcweir     uno::Sequence< uno::Type > aGraphicTypes = SwXTextGraphicObjectBaseClass::getTypes();
3437cdf0e10cSrcweir     uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
3438cdf0e10cSrcweir 
3439cdf0e10cSrcweir     long nIndex = aGraphicTypes.getLength();
3440cdf0e10cSrcweir     aGraphicTypes.realloc(
3441cdf0e10cSrcweir         aGraphicTypes.getLength() +
3442cdf0e10cSrcweir         aFrameTypes.getLength());
3443cdf0e10cSrcweir 
3444cdf0e10cSrcweir     uno::Type* pGraphicTypes = aGraphicTypes.getArray();
3445cdf0e10cSrcweir     const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
3446cdf0e10cSrcweir     long nPos;
3447cdf0e10cSrcweir     for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
3448cdf0e10cSrcweir         pGraphicTypes[nIndex++] = pFrameTypes[nPos];
3449cdf0e10cSrcweir 
3450cdf0e10cSrcweir     return aGraphicTypes;
3451cdf0e10cSrcweir }
3452cdf0e10cSrcweir 
getImplementationId()3453cdf0e10cSrcweir uno::Sequence< sal_Int8 > SAL_CALL SwXTextGraphicObject::getImplementationId(  ) throw(uno::RuntimeException)
3454cdf0e10cSrcweir {
3455cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3456cdf0e10cSrcweir     static uno::Sequence< sal_Int8 > aId( 16 );
3457cdf0e10cSrcweir     static sal_Bool bInit = sal_False;
3458cdf0e10cSrcweir     if(!bInit)
3459cdf0e10cSrcweir     {
3460cdf0e10cSrcweir         rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
3461cdf0e10cSrcweir         bInit = sal_True;
3462cdf0e10cSrcweir     }
3463cdf0e10cSrcweir     return aId;
3464cdf0e10cSrcweir }
3465cdf0e10cSrcweir 
attach(const uno::Reference<text::XTextRange> & xTextRange)3466cdf0e10cSrcweir void SwXTextGraphicObject::attach(const uno::Reference< text::XTextRange > & xTextRange) throw( lang::IllegalArgumentException, uno::RuntimeException )
3467cdf0e10cSrcweir {
3468cdf0e10cSrcweir     SwXFrame::attach(xTextRange);
3469cdf0e10cSrcweir }
3470cdf0e10cSrcweir 
getAnchor(void)3471cdf0e10cSrcweir uno::Reference< text::XTextRange >  SwXTextGraphicObject::getAnchor(void) throw( uno::RuntimeException )
3472cdf0e10cSrcweir {
3473cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3474cdf0e10cSrcweir     return SwXFrame::getAnchor();
3475cdf0e10cSrcweir }
3476cdf0e10cSrcweir 
dispose(void)3477cdf0e10cSrcweir void SwXTextGraphicObject::dispose(void) throw( uno::RuntimeException )
3478cdf0e10cSrcweir {
3479cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3480cdf0e10cSrcweir     SwXFrame::dispose();
3481cdf0e10cSrcweir }
3482cdf0e10cSrcweir 
addEventListener(const uno::Reference<lang::XEventListener> & aListener)3483cdf0e10cSrcweir void SwXTextGraphicObject::addEventListener(const uno::Reference< lang::XEventListener > & aListener)
3484cdf0e10cSrcweir                                                     throw( uno::RuntimeException )
3485cdf0e10cSrcweir {
3486cdf0e10cSrcweir     SwXFrame::addEventListener(aListener);
3487cdf0e10cSrcweir }
3488cdf0e10cSrcweir 
removeEventListener(const uno::Reference<lang::XEventListener> & aListener)3489cdf0e10cSrcweir void SwXTextGraphicObject::removeEventListener(const uno::Reference< lang::XEventListener > & aListener)
3490cdf0e10cSrcweir                                                     throw( uno::RuntimeException )
3491cdf0e10cSrcweir {
3492cdf0e10cSrcweir     SwXFrame::removeEventListener(aListener);
3493cdf0e10cSrcweir }
3494cdf0e10cSrcweir 
getImplementationName(void)3495cdf0e10cSrcweir OUString SwXTextGraphicObject::getImplementationName(void) throw( uno::RuntimeException )
3496cdf0e10cSrcweir {
3497cdf0e10cSrcweir     return C2U("SwXTextGraphicObject");
3498cdf0e10cSrcweir }
3499cdf0e10cSrcweir 
supportsService(const OUString & rServiceName)3500cdf0e10cSrcweir sal_Bool SwXTextGraphicObject::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
3501cdf0e10cSrcweir {
3502cdf0e10cSrcweir     return COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextGraphicObject") ||
3503cdf0e10cSrcweir                     SwXFrame::supportsService(rServiceName);
3504cdf0e10cSrcweir }
3505cdf0e10cSrcweir 
getSupportedServiceNames(void)3506cdf0e10cSrcweir uno::Sequence< OUString > SwXTextGraphicObject::getSupportedServiceNames(void)
3507cdf0e10cSrcweir         throw( uno::RuntimeException )
3508cdf0e10cSrcweir {
3509cdf0e10cSrcweir     uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
3510cdf0e10cSrcweir     aRet.realloc(aRet.getLength() + 1);
3511cdf0e10cSrcweir     OUString* pArray = aRet.getArray();
3512cdf0e10cSrcweir     pArray[aRet.getLength() - 1] = C2U("com.sun.star.text.TextGraphicObject");
3513cdf0e10cSrcweir     return aRet;
3514cdf0e10cSrcweir }
3515cdf0e10cSrcweir 
operator new(size_t t)3516cdf0e10cSrcweir void * SAL_CALL SwXTextGraphicObject::operator new( size_t t) throw()
3517cdf0e10cSrcweir {
3518cdf0e10cSrcweir     return SwXTextGraphicObjectBaseClass::operator new(t);
3519cdf0e10cSrcweir }
3520cdf0e10cSrcweir 
operator delete(void * p)3521cdf0e10cSrcweir void SAL_CALL SwXTextGraphicObject::operator delete( void * p) throw()
3522cdf0e10cSrcweir {
3523cdf0e10cSrcweir     SwXTextGraphicObjectBaseClass::operator delete(p);
3524cdf0e10cSrcweir }
3525cdf0e10cSrcweir 
3526cdf0e10cSrcweir uno::Reference<container::XNameReplace> SAL_CALL
getEvents()3527cdf0e10cSrcweir     SwXTextGraphicObject::getEvents()
3528cdf0e10cSrcweir         throw(uno::RuntimeException)
3529cdf0e10cSrcweir {
3530cdf0e10cSrcweir     return new SwFrameEventDescriptor( *this );
3531cdf0e10cSrcweir }
3532cdf0e10cSrcweir 
3533cdf0e10cSrcweir /******************************************************************
3534cdf0e10cSrcweir  *
3535cdf0e10cSrcweir  ******************************************************************/
3536cdf0e10cSrcweir 
SwXTextEmbeddedObject(SwDoc * pDoc)3537cdf0e10cSrcweir SwXTextEmbeddedObject::SwXTextEmbeddedObject( SwDoc *pDoc ) :
3538cdf0e10cSrcweir     SwXFrame(FLYCNTTYPE_OLE, aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT), pDoc)
3539cdf0e10cSrcweir {
3540cdf0e10cSrcweir }
3541cdf0e10cSrcweir 
SwXTextEmbeddedObject(SwFrmFmt & rFmt)3542cdf0e10cSrcweir SwXTextEmbeddedObject::SwXTextEmbeddedObject(SwFrmFmt& rFmt) :
3543cdf0e10cSrcweir     SwXFrame(rFmt, FLYCNTTYPE_OLE, aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT))
3544cdf0e10cSrcweir {
3545cdf0e10cSrcweir 
3546cdf0e10cSrcweir }
3547cdf0e10cSrcweir 
~SwXTextEmbeddedObject()3548cdf0e10cSrcweir SwXTextEmbeddedObject::~SwXTextEmbeddedObject()
3549cdf0e10cSrcweir {
3550cdf0e10cSrcweir 
3551cdf0e10cSrcweir }
3552cdf0e10cSrcweir 
acquire()3553cdf0e10cSrcweir void SAL_CALL SwXTextEmbeddedObject::acquire()throw()
3554cdf0e10cSrcweir {
3555cdf0e10cSrcweir     SwXFrame::acquire();
3556cdf0e10cSrcweir }
3557cdf0e10cSrcweir 
release()3558cdf0e10cSrcweir void SAL_CALL SwXTextEmbeddedObject::release()throw()
3559cdf0e10cSrcweir {
3560cdf0e10cSrcweir     SwXFrame::release();
3561cdf0e10cSrcweir }
3562cdf0e10cSrcweir 
queryInterface(const uno::Type & aType)3563cdf0e10cSrcweir ::uno::Any SAL_CALL SwXTextEmbeddedObject::queryInterface( const uno::Type& aType )
3564cdf0e10cSrcweir     throw( uno::RuntimeException)
3565cdf0e10cSrcweir {
3566*be099857Smseidel     ::uno::Any aRet = SwXFrame::queryInterface(aType);
3567cdf0e10cSrcweir     if(aRet.getValueType() == ::getCppuVoidType())
3568cdf0e10cSrcweir         aRet = SwXTextEmbeddedObjectBaseClass::queryInterface(aType);
3569cdf0e10cSrcweir     return aRet;
3570cdf0e10cSrcweir }
3571cdf0e10cSrcweir 
getTypes()3572cdf0e10cSrcweir uno::Sequence< uno::Type > SAL_CALL SwXTextEmbeddedObject::getTypes(  ) throw(uno::RuntimeException)
3573cdf0e10cSrcweir {
3574cdf0e10cSrcweir     uno::Sequence< uno::Type > aTextEmbeddedTypes = SwXTextEmbeddedObjectBaseClass::getTypes();
3575cdf0e10cSrcweir     uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
3576cdf0e10cSrcweir 
3577cdf0e10cSrcweir     long nIndex = aTextEmbeddedTypes.getLength();
3578cdf0e10cSrcweir     aTextEmbeddedTypes.realloc(
3579cdf0e10cSrcweir         aTextEmbeddedTypes.getLength() +
3580cdf0e10cSrcweir         aFrameTypes.getLength());
3581cdf0e10cSrcweir 
3582cdf0e10cSrcweir     uno::Type* pTextEmbeddedTypes = aTextEmbeddedTypes.getArray();
3583cdf0e10cSrcweir 
3584cdf0e10cSrcweir     const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
3585cdf0e10cSrcweir     long nPos;
3586cdf0e10cSrcweir     for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
3587cdf0e10cSrcweir         pTextEmbeddedTypes[nIndex++] = pFrameTypes[nPos];
3588cdf0e10cSrcweir 
3589cdf0e10cSrcweir     return aTextEmbeddedTypes;
3590cdf0e10cSrcweir }
3591cdf0e10cSrcweir 
getImplementationId()3592cdf0e10cSrcweir uno::Sequence< sal_Int8 > SAL_CALL SwXTextEmbeddedObject::getImplementationId(  ) throw(uno::RuntimeException)
3593cdf0e10cSrcweir {
3594cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3595cdf0e10cSrcweir     static uno::Sequence< sal_Int8 > aId( 16 );
3596cdf0e10cSrcweir     static sal_Bool bInit = sal_False;
3597cdf0e10cSrcweir     if(!bInit)
3598cdf0e10cSrcweir     {
3599cdf0e10cSrcweir         rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
3600cdf0e10cSrcweir         bInit = sal_True;
3601cdf0e10cSrcweir     }
3602cdf0e10cSrcweir     return aId;
3603cdf0e10cSrcweir }
3604cdf0e10cSrcweir 
attach(const uno::Reference<text::XTextRange> & xTextRange)3605cdf0e10cSrcweir void SwXTextEmbeddedObject::attach(const uno::Reference< text::XTextRange > & xTextRange) throw( lang::IllegalArgumentException, uno::RuntimeException )
3606cdf0e10cSrcweir {
3607cdf0e10cSrcweir     SwXFrame::attach(xTextRange);
3608cdf0e10cSrcweir }
3609cdf0e10cSrcweir 
getAnchor(void)3610cdf0e10cSrcweir uno::Reference< text::XTextRange >  SwXTextEmbeddedObject::getAnchor(void) throw( uno::RuntimeException )
3611cdf0e10cSrcweir {
3612cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3613cdf0e10cSrcweir     return SwXFrame::getAnchor();
3614cdf0e10cSrcweir }
3615cdf0e10cSrcweir 
dispose(void)3616cdf0e10cSrcweir void SwXTextEmbeddedObject::dispose(void) throw( uno::RuntimeException )
3617cdf0e10cSrcweir {
3618cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3619cdf0e10cSrcweir     SwXFrame::dispose();
3620cdf0e10cSrcweir }
3621cdf0e10cSrcweir 
addEventListener(const uno::Reference<lang::XEventListener> & aListener)3622cdf0e10cSrcweir void SwXTextEmbeddedObject::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
3623cdf0e10cSrcweir {
3624cdf0e10cSrcweir     SwXFrame::addEventListener(aListener);
3625cdf0e10cSrcweir }
3626cdf0e10cSrcweir 
removeEventListener(const uno::Reference<lang::XEventListener> & aListener)3627cdf0e10cSrcweir void SwXTextEmbeddedObject::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
3628cdf0e10cSrcweir {
3629cdf0e10cSrcweir     SwXFrame::removeEventListener(aListener);
3630cdf0e10cSrcweir }
3631cdf0e10cSrcweir 
getEmbeddedObject(void)3632cdf0e10cSrcweir uno::Reference< lang::XComponent >  SwXTextEmbeddedObject::getEmbeddedObject(void) throw( uno::RuntimeException )
3633cdf0e10cSrcweir {
3634cdf0e10cSrcweir     uno::Reference< lang::XComponent >  xRet;
3635cdf0e10cSrcweir     SwFrmFmt*   pFmt = GetFrmFmt();
3636cdf0e10cSrcweir     if(pFmt)
3637cdf0e10cSrcweir     {
3638cdf0e10cSrcweir         SwDoc* pDoc = pFmt->GetDoc();
3639cdf0e10cSrcweir         const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
3640cdf0e10cSrcweir         DBG_ASSERT( pCnt->GetCntntIdx() &&
3641cdf0e10cSrcweir                        pDoc->GetNodes()[ pCnt->GetCntntIdx()->
3642cdf0e10cSrcweir                                         GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3643cdf0e10cSrcweir 
3644cdf0e10cSrcweir         SwOLENode* pOleNode =  pDoc->GetNodes()[ pCnt->GetCntntIdx()
3645cdf0e10cSrcweir                                         ->GetIndex() + 1 ]->GetOLENode();
3646cdf0e10cSrcweir         uno::Reference < embed::XEmbeddedObject > xIP = pOleNode->GetOLEObj().GetOleRef();
3647cdf0e10cSrcweir         if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
3648cdf0e10cSrcweir         {
3649cdf0e10cSrcweir             // TODO/LATER: the listener registered after client creation should be able to handle scaling, after that the client is not necessary here
3650cdf0e10cSrcweir             if ( pDoc->GetDocShell() )
3651cdf0e10cSrcweir                 pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xIP, embed::Aspects::MSOLE_CONTENT ) );
3652cdf0e10cSrcweir 
3653cdf0e10cSrcweir             xRet = uno::Reference < lang::XComponent >( xIP->getComponent(), uno::UNO_QUERY );
3654cdf0e10cSrcweir             uno::Reference< util::XModifyBroadcaster >  xBrdcst( xRet, uno::UNO_QUERY);
3655cdf0e10cSrcweir             uno::Reference< frame::XModel > xModel( xRet, uno::UNO_QUERY);
3656cdf0e10cSrcweir             if( xBrdcst.is() && xModel.is() )
3657cdf0e10cSrcweir             {
3658cdf0e10cSrcweir                 SwXOLEListener* pListener = SwIterator<SwXOLEListener,SwFmt>::FirstElement( *pFmt );
3659cdf0e10cSrcweir                 //create a new one if the OLE object doesn't have one already
3660cdf0e10cSrcweir                 if( !pListener )
3661cdf0e10cSrcweir                 {
3662cdf0e10cSrcweir                     uno::Reference< util::XModifyListener > xOLEListener = new SwXOLEListener(*pFmt, xModel);
3663cdf0e10cSrcweir                     xBrdcst->addModifyListener( xOLEListener );
3664cdf0e10cSrcweir                 }
3665cdf0e10cSrcweir             }
3666cdf0e10cSrcweir         }
3667cdf0e10cSrcweir     }
3668cdf0e10cSrcweir     return xRet;
3669cdf0e10cSrcweir }
3670cdf0e10cSrcweir 
getExtendedControlOverEmbeddedObject()3671cdf0e10cSrcweir uno::Reference< embed::XEmbeddedObject > SAL_CALL SwXTextEmbeddedObject::getExtendedControlOverEmbeddedObject()
3672cdf0e10cSrcweir         throw( uno::RuntimeException )
3673cdf0e10cSrcweir {
3674cdf0e10cSrcweir     uno::Reference< embed::XEmbeddedObject > xResult;
3675cdf0e10cSrcweir     SwFrmFmt*   pFmt = GetFrmFmt();
3676cdf0e10cSrcweir     if(pFmt)
3677cdf0e10cSrcweir     {
3678cdf0e10cSrcweir         SwDoc* pDoc = pFmt->GetDoc();
3679cdf0e10cSrcweir         const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
3680cdf0e10cSrcweir         DBG_ASSERT( pCnt->GetCntntIdx() &&
3681cdf0e10cSrcweir                        pDoc->GetNodes()[ pCnt->GetCntntIdx()->
3682cdf0e10cSrcweir                                         GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3683cdf0e10cSrcweir 
3684cdf0e10cSrcweir         SwOLENode* pOleNode =  pDoc->GetNodes()[ pCnt->GetCntntIdx()
3685cdf0e10cSrcweir                                         ->GetIndex() + 1 ]->GetOLENode();
3686cdf0e10cSrcweir         xResult = pOleNode->GetOLEObj().GetOleRef();
3687cdf0e10cSrcweir         if ( svt::EmbeddedObjectRef::TryRunningState( xResult ) )
3688cdf0e10cSrcweir         {
3689cdf0e10cSrcweir             // TODO/LATER: the listener registered after client creation should be able to handle scaling, after that the client is not necessary here
3690cdf0e10cSrcweir             if ( pDoc->GetDocShell() )
3691cdf0e10cSrcweir                 pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xResult, embed::Aspects::MSOLE_CONTENT ) );
3692cdf0e10cSrcweir 
3693cdf0e10cSrcweir             uno::Reference < lang::XComponent > xComp( xResult->getComponent(), uno::UNO_QUERY );
3694cdf0e10cSrcweir             uno::Reference< util::XModifyBroadcaster >  xBrdcst( xComp, uno::UNO_QUERY);
3695cdf0e10cSrcweir             uno::Reference< frame::XModel > xModel( xComp, uno::UNO_QUERY);
3696cdf0e10cSrcweir             if( xBrdcst.is() && xModel.is() )
3697cdf0e10cSrcweir             {
3698cdf0e10cSrcweir                 SwXOLEListener* pListener = SwIterator<SwXOLEListener,SwFmt>::FirstElement( *pFmt );
3699cdf0e10cSrcweir                 //create a new one if the OLE object doesn't have one already
3700cdf0e10cSrcweir                 if( !pListener )
3701cdf0e10cSrcweir                 {
3702cdf0e10cSrcweir                     uno::Reference< util::XModifyListener > xOLEListener = new SwXOLEListener(*pFmt, xModel);
3703cdf0e10cSrcweir                     xBrdcst->addModifyListener( xOLEListener );
3704cdf0e10cSrcweir                 }
3705cdf0e10cSrcweir             }
3706cdf0e10cSrcweir         }
3707cdf0e10cSrcweir     }
3708cdf0e10cSrcweir     return xResult;
3709cdf0e10cSrcweir }
3710cdf0e10cSrcweir 
getAspect()3711cdf0e10cSrcweir sal_Int64 SAL_CALL SwXTextEmbeddedObject::getAspect() throw (uno::RuntimeException)
3712cdf0e10cSrcweir {
3713cdf0e10cSrcweir     SwFrmFmt*   pFmt = GetFrmFmt();
3714cdf0e10cSrcweir     if(pFmt)
3715cdf0e10cSrcweir     {
3716cdf0e10cSrcweir         SwDoc* pDoc = pFmt->GetDoc();
3717cdf0e10cSrcweir         const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
3718cdf0e10cSrcweir         DBG_ASSERT( pCnt->GetCntntIdx() &&
3719cdf0e10cSrcweir                        pDoc->GetNodes()[ pCnt->GetCntntIdx()->
3720cdf0e10cSrcweir                                         GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3721cdf0e10cSrcweir 
3722cdf0e10cSrcweir         return pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->GetAspect();
3723cdf0e10cSrcweir     }
3724cdf0e10cSrcweir 
3725cdf0e10cSrcweir     return embed::Aspects::MSOLE_CONTENT; // return the default value
3726cdf0e10cSrcweir }
3727cdf0e10cSrcweir 
setAspect(sal_Int64 nAspect)3728cdf0e10cSrcweir void SAL_CALL SwXTextEmbeddedObject::setAspect( sal_Int64 nAspect ) throw (uno::RuntimeException)
3729cdf0e10cSrcweir {
3730cdf0e10cSrcweir     SwFrmFmt*   pFmt = GetFrmFmt();
3731cdf0e10cSrcweir     if(pFmt)
3732cdf0e10cSrcweir     {
3733cdf0e10cSrcweir         SwDoc* pDoc = pFmt->GetDoc();
3734cdf0e10cSrcweir         const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
3735cdf0e10cSrcweir         DBG_ASSERT( pCnt->GetCntntIdx() &&
3736cdf0e10cSrcweir                        pDoc->GetNodes()[ pCnt->GetCntntIdx()->
3737cdf0e10cSrcweir                                         GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3738cdf0e10cSrcweir 
3739cdf0e10cSrcweir         pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->SetAspect( nAspect );
3740cdf0e10cSrcweir     }
3741cdf0e10cSrcweir }
3742cdf0e10cSrcweir 
getReplacementGraphic()3743cdf0e10cSrcweir uno::Reference< graphic::XGraphic > SAL_CALL SwXTextEmbeddedObject::getReplacementGraphic() throw (uno::RuntimeException)
3744cdf0e10cSrcweir {
3745cdf0e10cSrcweir     SwFrmFmt*   pFmt = GetFrmFmt();
3746cdf0e10cSrcweir     if(pFmt)
3747cdf0e10cSrcweir     {
3748cdf0e10cSrcweir         SwDoc* pDoc = pFmt->GetDoc();
3749cdf0e10cSrcweir         const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
3750cdf0e10cSrcweir         DBG_ASSERT( pCnt->GetCntntIdx() &&
3751cdf0e10cSrcweir                        pDoc->GetNodes()[ pCnt->GetCntntIdx()->
3752cdf0e10cSrcweir                                         GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
3753cdf0e10cSrcweir 
3754cdf0e10cSrcweir         Graphic* pGraphic = pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->GetGraphic();
3755cdf0e10cSrcweir         if ( pGraphic )
3756cdf0e10cSrcweir             return pGraphic->GetXGraphic();
3757cdf0e10cSrcweir     }
3758cdf0e10cSrcweir 
3759cdf0e10cSrcweir     return uno::Reference< graphic::XGraphic >();
3760cdf0e10cSrcweir }
3761cdf0e10cSrcweir 
3762cdf0e10cSrcweir 
getImplementationName(void)3763cdf0e10cSrcweir OUString SwXTextEmbeddedObject::getImplementationName(void) throw( uno::RuntimeException )
3764cdf0e10cSrcweir 
3765cdf0e10cSrcweir {
3766cdf0e10cSrcweir     return C2U("SwXTextEmbeddedObject");
3767cdf0e10cSrcweir }
3768cdf0e10cSrcweir 
supportsService(const OUString & rServiceName)3769cdf0e10cSrcweir sal_Bool SwXTextEmbeddedObject::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
3770cdf0e10cSrcweir {
3771cdf0e10cSrcweir     return  COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextEmbeddedObject")||
3772cdf0e10cSrcweir                     SwXFrame::supportsService(rServiceName);
3773cdf0e10cSrcweir }
3774cdf0e10cSrcweir 
getSupportedServiceNames(void)3775cdf0e10cSrcweir uno::Sequence< OUString > SwXTextEmbeddedObject::getSupportedServiceNames(void)
3776cdf0e10cSrcweir         throw( uno::RuntimeException )
3777cdf0e10cSrcweir {
3778cdf0e10cSrcweir     uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
3779cdf0e10cSrcweir     aRet.realloc(aRet.getLength() + 1);
3780cdf0e10cSrcweir     OUString* pArray = aRet.getArray();
3781cdf0e10cSrcweir     pArray[aRet.getLength() - 1] = C2U("com.sun.star.text.TextEmbeddedObject");
3782cdf0e10cSrcweir     return aRet;
3783cdf0e10cSrcweir }
3784cdf0e10cSrcweir 
operator new(size_t t)3785cdf0e10cSrcweir void * SAL_CALL SwXTextEmbeddedObject::operator new( size_t t) throw()
3786cdf0e10cSrcweir {
3787cdf0e10cSrcweir     return SwXTextEmbeddedObjectBaseClass::operator new(t);
3788cdf0e10cSrcweir }
3789cdf0e10cSrcweir 
operator delete(void * p)3790cdf0e10cSrcweir void SAL_CALL SwXTextEmbeddedObject::operator delete( void * p) throw()
3791cdf0e10cSrcweir {
3792cdf0e10cSrcweir     SwXTextEmbeddedObjectBaseClass::operator delete(p);
3793cdf0e10cSrcweir }
3794cdf0e10cSrcweir 
3795cdf0e10cSrcweir uno::Reference<container::XNameReplace> SAL_CALL
getEvents()3796cdf0e10cSrcweir     SwXTextEmbeddedObject::getEvents()
3797cdf0e10cSrcweir         throw(uno::RuntimeException)
3798cdf0e10cSrcweir {
3799cdf0e10cSrcweir     return new SwFrameEventDescriptor( *this );
3800cdf0e10cSrcweir }
3801cdf0e10cSrcweir 
3802cdf0e10cSrcweir 
3803cdf0e10cSrcweir /******************************************************************
3804cdf0e10cSrcweir  *
3805cdf0e10cSrcweir  ******************************************************************/
3806cdf0e10cSrcweir TYPEINIT1(SwXOLEListener, SwClient);
3807cdf0e10cSrcweir 
SwXOLEListener(SwFmt & rOLEFmt,uno::Reference<XModel> xOLE)3808cdf0e10cSrcweir SwXOLEListener::SwXOLEListener( SwFmt& rOLEFmt, uno::Reference< XModel > xOLE) :
3809cdf0e10cSrcweir     SwClient(&rOLEFmt),
3810cdf0e10cSrcweir     xOLEModel(xOLE)
3811cdf0e10cSrcweir {
3812cdf0e10cSrcweir }
3813cdf0e10cSrcweir 
~SwXOLEListener()3814cdf0e10cSrcweir SwXOLEListener::~SwXOLEListener()
3815cdf0e10cSrcweir {}
3816cdf0e10cSrcweir 
modified(const lang::EventObject &)3817cdf0e10cSrcweir void SwXOLEListener::modified( const lang::EventObject& /*rEvent*/ )
3818cdf0e10cSrcweir                                         throw( uno::RuntimeException )
3819cdf0e10cSrcweir {
3820cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3821cdf0e10cSrcweir 
3822cdf0e10cSrcweir     SwOLENode* pNd = 0;
3823cdf0e10cSrcweir     SwFmt* pFmt = GetFmt();
3824cdf0e10cSrcweir     if(pFmt)
3825cdf0e10cSrcweir     {const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
3826cdf0e10cSrcweir         if(pIdx)
3827cdf0e10cSrcweir         {
3828cdf0e10cSrcweir             SwNodeIndex aIdx(*pIdx, 1);
3829cdf0e10cSrcweir             SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
3830cdf0e10cSrcweir             pNd = pNoTxt->GetOLENode();
3831cdf0e10cSrcweir         }
3832cdf0e10cSrcweir     }
3833cdf0e10cSrcweir     if(!pNd)
3834cdf0e10cSrcweir         throw uno::RuntimeException();
3835cdf0e10cSrcweir 
3836cdf0e10cSrcweir     uno::Reference < embed::XEmbeddedObject > xIP = pNd->GetOLEObj().GetOleRef();
3837cdf0e10cSrcweir     if ( xIP.is() )
3838cdf0e10cSrcweir     {
3839cdf0e10cSrcweir         sal_Int32 nState = xIP->getCurrentState();
3840cdf0e10cSrcweir         if ( nState == embed::EmbedStates::INPLACE_ACTIVE || nState == embed::EmbedStates::UI_ACTIVE )
3841cdf0e10cSrcweir             return;
3842cdf0e10cSrcweir     }
3843cdf0e10cSrcweir 
3844cdf0e10cSrcweir     // if the OLE-Node is UI-Active do nothing
3845cdf0e10cSrcweir     pNd->SetOLESizeInvalid( sal_True );
3846cdf0e10cSrcweir     pNd->GetDoc()->SetOLEObjModified();
3847cdf0e10cSrcweir }
3848cdf0e10cSrcweir 
3849cdf0e10cSrcweir /* ---------------------------------------------------------------------------
3850cdf0e10cSrcweir 
3851cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
disposing(const lang::EventObject & rEvent)3852cdf0e10cSrcweir void SwXOLEListener::disposing( const lang::EventObject& rEvent )
3853cdf0e10cSrcweir                         throw( uno::RuntimeException )
3854cdf0e10cSrcweir {
3855cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
3856cdf0e10cSrcweir 
3857cdf0e10cSrcweir     uno::Reference< util::XModifyListener >  xListener( this );
3858cdf0e10cSrcweir 
3859cdf0e10cSrcweir 
3860cdf0e10cSrcweir     uno::Reference< frame::XModel >  xModel( rEvent.Source, uno::UNO_QUERY );
3861cdf0e10cSrcweir     uno::Reference< util::XModifyBroadcaster >  xBrdcst(xModel, uno::UNO_QUERY);
3862cdf0e10cSrcweir 
3863cdf0e10cSrcweir     try
3864cdf0e10cSrcweir     {
3865cdf0e10cSrcweir         if( xBrdcst.is() )
3866cdf0e10cSrcweir             xBrdcst->removeModifyListener( xListener );
3867cdf0e10cSrcweir     }
3868cdf0e10cSrcweir     catch(uno::Exception const &)
3869cdf0e10cSrcweir     {
3870cdf0e10cSrcweir         DBG_ERROR("OLE Listener couldn't be removed");
3871cdf0e10cSrcweir     }
3872cdf0e10cSrcweir }
3873cdf0e10cSrcweir /* ---------------------------------------------------------------------------
3874cdf0e10cSrcweir 
3875cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
Modify(const SfxPoolItem * pOld,const SfxPoolItem * pNew)3876cdf0e10cSrcweir void SwXOLEListener::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
3877cdf0e10cSrcweir {
3878cdf0e10cSrcweir     ClientModify(this, pOld, pNew);
3879cdf0e10cSrcweir     if(!GetRegisteredIn())
3880cdf0e10cSrcweir         xOLEModel = 0;
3881cdf0e10cSrcweir }
3882