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