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
10efeef26fSAndrew Rist *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist *
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.
19efeef26fSAndrew Rist *
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 <sot/clsids.hxx>
28cdf0e10cSrcweir #include <com/sun/star/embed/XEmbedObjectCreator.hpp>
29cdf0e10cSrcweir #include <com/sun/star/embed/XEmbeddedObject.hpp>
30cdf0e10cSrcweir #include <com/sun/star/embed/XLinkageSupport.hpp>
31cdf0e10cSrcweir #include <com/sun/star/embed/EmbedStates.hpp>
32cdf0e10cSrcweir #include <com/sun/star/embed/XClassifiedObject.hpp>
33cdf0e10cSrcweir #include <com/sun/star/embed/Aspects.hpp>
34cdf0e10cSrcweir #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
35cdf0e10cSrcweir #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
36cdf0e10cSrcweir #include <xmloff/families.hxx>
37cdf0e10cSrcweir #include <xmloff/xmlnmspe.hxx>
38cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
39cdf0e10cSrcweir #include <xmloff/txtprmap.hxx>
40cdf0e10cSrcweir
41cdf0e10cSrcweir #include <svx/svdobj.hxx>
42cdf0e10cSrcweir #include <doc.hxx>
43cdf0e10cSrcweir #include <ndole.hxx>
44cdf0e10cSrcweir #include <fmtcntnt.hxx>
45cdf0e10cSrcweir #include <unostyle.hxx>
46cdf0e10cSrcweir #include <unoframe.hxx>
47cdf0e10cSrcweir #include <ndgrf.hxx>
48cdf0e10cSrcweir #include "xmlexp.hxx"
49cdf0e10cSrcweir #include "xmltexte.hxx"
50cdf0e10cSrcweir #include <tools/urlobj.hxx>
51cdf0e10cSrcweir #include <SwAppletImpl.hxx>
52cdf0e10cSrcweir
53cdf0e10cSrcweir #define _SVSTDARR_ULONGS
54cdf0e10cSrcweir #include <svl/svstdarr.hxx>
55cdf0e10cSrcweir #include "svl/urihelper.hxx"
56cdf0e10cSrcweir #include <sfx2/frmdescr.hxx>
57cdf0e10cSrcweir #include <SwStyleNameMapper.hxx>
58cdf0e10cSrcweir
59cdf0e10cSrcweir
60cdf0e10cSrcweir using ::rtl::OUString;
61cdf0e10cSrcweir using ::rtl::OUStringBuffer;
62cdf0e10cSrcweir using namespace ::com::sun::star;
63cdf0e10cSrcweir using namespace ::com::sun::star::uno;
64cdf0e10cSrcweir using namespace ::com::sun::star::style;
65cdf0e10cSrcweir using namespace ::com::sun::star::beans;
66cdf0e10cSrcweir using namespace ::com::sun::star::lang;
67cdf0e10cSrcweir using namespace ::com::sun::star::document;
68cdf0e10cSrcweir using namespace ::com::sun::star::io;
69cdf0e10cSrcweir using namespace ::xmloff::token;
70cdf0e10cSrcweir
71cdf0e10cSrcweir enum SvEmbeddedObjectTypes
72cdf0e10cSrcweir {
73cdf0e10cSrcweir SV_EMBEDDED_OWN,
74cdf0e10cSrcweir SV_EMBEDDED_OUTPLACE,
75cdf0e10cSrcweir SV_EMBEDDED_APPLET,
76cdf0e10cSrcweir SV_EMBEDDED_PLUGIN,
77cdf0e10cSrcweir SV_EMBEDDED_FRAME
78cdf0e10cSrcweir };
79cdf0e10cSrcweir
80cdf0e10cSrcweir const sal_Char sObjectReplacements[] = "ObjectReplacements/";
81cdf0e10cSrcweir
82cdf0e10cSrcweir // ---------------------------------------------------------------------
83cdf0e10cSrcweir
GetNoTxtNode(const Reference<XPropertySet> & rPropSet) const84cdf0e10cSrcweir SwNoTxtNode *SwXMLTextParagraphExport::GetNoTxtNode(
85cdf0e10cSrcweir const Reference < XPropertySet >& rPropSet ) const
86cdf0e10cSrcweir {
87cdf0e10cSrcweir Reference<XUnoTunnel> xCrsrTunnel( rPropSet, UNO_QUERY );
88cdf0e10cSrcweir ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for embedded" );
89cdf0e10cSrcweir SwXFrame *pFrame = reinterpret_cast< SwXFrame * >(
90cdf0e10cSrcweir sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( SwXFrame::getUnoTunnelId() )));
91cdf0e10cSrcweir ASSERT( pFrame, "SwXFrame missing" );
92cdf0e10cSrcweir SwFrmFmt *pFrmFmt = pFrame->GetFrmFmt();
93cdf0e10cSrcweir const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt();
94cdf0e10cSrcweir const SwNodeIndex *pNdIdx = rCntnt.GetCntntIdx();
95cdf0e10cSrcweir return pNdIdx->GetNodes()[pNdIdx->GetIndex() + 1]->GetNoTxtNode();
96cdf0e10cSrcweir }
97cdf0e10cSrcweir
exportStyleContent(const Reference<XStyle> & rStyle)98cdf0e10cSrcweir void SwXMLTextParagraphExport::exportStyleContent(
99cdf0e10cSrcweir const Reference< XStyle > & rStyle )
100cdf0e10cSrcweir {
101cdf0e10cSrcweir
102cdf0e10cSrcweir const SwXStyle* pStyle = 0;
103cdf0e10cSrcweir Reference<XUnoTunnel> xStyleTunnel( rStyle, UNO_QUERY);
104cdf0e10cSrcweir if( xStyleTunnel.is() )
105cdf0e10cSrcweir {
106cdf0e10cSrcweir pStyle = reinterpret_cast< SwXStyle * >(
107cdf0e10cSrcweir sal::static_int_cast< sal_IntPtr >( xStyleTunnel->getSomething( SwXStyle::getUnoTunnelId() )));
108cdf0e10cSrcweir }
109cdf0e10cSrcweir if( pStyle && SFX_STYLE_FAMILY_PARA == pStyle->GetFamily() )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir const SwDoc *pDoc = pStyle->GetDoc();
112cdf0e10cSrcweir const SwTxtFmtColl *pColl =
113cdf0e10cSrcweir pDoc->FindTxtFmtCollByName( pStyle->GetStyleName() );
114cdf0e10cSrcweir ASSERT( pColl, "There is the text collection?" );
115cdf0e10cSrcweir if( pColl && RES_CONDTXTFMTCOLL == pColl->Which() )
116cdf0e10cSrcweir {
117cdf0e10cSrcweir const SwFmtCollConditions& rConditions =
118cdf0e10cSrcweir ((const SwConditionTxtFmtColl *)pColl)->GetCondColls();
119cdf0e10cSrcweir for( sal_uInt16 i=0; i < rConditions.Count(); i++ )
120cdf0e10cSrcweir {
121cdf0e10cSrcweir const SwCollCondition& rCond = *rConditions[i];
122cdf0e10cSrcweir
123cdf0e10cSrcweir enum XMLTokenEnum eFunc = XML_TOKEN_INVALID;
124cdf0e10cSrcweir OUStringBuffer sBuffer( 20 );
125cdf0e10cSrcweir switch( rCond.GetCondition() )
126cdf0e10cSrcweir {
127cdf0e10cSrcweir case PARA_IN_LIST:
128cdf0e10cSrcweir eFunc = XML_LIST_LEVEL;
129cdf0e10cSrcweir sBuffer.append( (sal_Int32)(rCond.GetSubCondition()+1) );
130cdf0e10cSrcweir break;
131cdf0e10cSrcweir case PARA_IN_OUTLINE:
132cdf0e10cSrcweir eFunc = XML_OUTLINE_LEVEL;
133cdf0e10cSrcweir sBuffer.append( (sal_Int32)(rCond.GetSubCondition()+1) );
134cdf0e10cSrcweir break;
135cdf0e10cSrcweir case PARA_IN_FRAME:
136cdf0e10cSrcweir eFunc = XML_TEXT_BOX;
137cdf0e10cSrcweir break;
138cdf0e10cSrcweir case PARA_IN_TABLEHEAD:
139cdf0e10cSrcweir eFunc = XML_TABLE_HEADER;
140cdf0e10cSrcweir break;
141cdf0e10cSrcweir case PARA_IN_TABLEBODY:
142cdf0e10cSrcweir eFunc = XML_TABLE;
143cdf0e10cSrcweir break;
144cdf0e10cSrcweir case PARA_IN_SECTION:
145cdf0e10cSrcweir eFunc = XML_SECTION;
146cdf0e10cSrcweir break;
147cdf0e10cSrcweir case PARA_IN_FOOTENOTE:
148cdf0e10cSrcweir eFunc = XML_FOOTNOTE;
149cdf0e10cSrcweir break;
150cdf0e10cSrcweir case PARA_IN_FOOTER:
151cdf0e10cSrcweir eFunc = XML_FOOTER;
152cdf0e10cSrcweir break;
153cdf0e10cSrcweir case PARA_IN_HEADER:
154cdf0e10cSrcweir eFunc = XML_HEADER;
155cdf0e10cSrcweir break;
156cdf0e10cSrcweir case PARA_IN_ENDNOTE:
157cdf0e10cSrcweir eFunc = XML_ENDNOTE;
158cdf0e10cSrcweir break;
159cdf0e10cSrcweir }
160cdf0e10cSrcweir OUString sVal( sBuffer.makeStringAndClear() );
161cdf0e10cSrcweir
162cdf0e10cSrcweir DBG_ASSERT( eFunc != XML_TOKEN_INVALID,
163cdf0e10cSrcweir "SwXMLExport::ExportFmt: unknown condition" );
164cdf0e10cSrcweir if( eFunc != XML_TOKEN_INVALID )
165cdf0e10cSrcweir {
166cdf0e10cSrcweir sBuffer.append( GetXMLToken(eFunc) );
167cdf0e10cSrcweir sBuffer.append( (sal_Unicode)'(' );
168cdf0e10cSrcweir sBuffer.append( (sal_Unicode)')' );
169cdf0e10cSrcweir if( sVal.getLength() )
170cdf0e10cSrcweir {
171cdf0e10cSrcweir sBuffer.append( (sal_Unicode)'=' );
172cdf0e10cSrcweir sBuffer.append( sVal );
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
175cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_STYLE,
176cdf0e10cSrcweir XML_CONDITION,
177cdf0e10cSrcweir sBuffer.makeStringAndClear() );
178cdf0e10cSrcweir String aString;
179cdf0e10cSrcweir SwStyleNameMapper::FillProgName(
180cdf0e10cSrcweir rCond.GetTxtFmtColl()->GetName(),
181cdf0e10cSrcweir aString,
182cdf0e10cSrcweir nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
183cdf0e10cSrcweir sal_True);
184cdf0e10cSrcweir aString = GetExport().EncodeStyleName( aString );
185cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_STYLE,
186cdf0e10cSrcweir XML_APPLY_STYLE_NAME, aString );
187cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
188cdf0e10cSrcweir XML_MAP, sal_True, sal_True );
189cdf0e10cSrcweir }
190cdf0e10cSrcweir }
191cdf0e10cSrcweir }
192cdf0e10cSrcweir }
193cdf0e10cSrcweir }
194cdf0e10cSrcweir
SwXMLTextParagraphExport(SwXMLExport & rExp,SvXMLAutoStylePoolP & _rAutoStylePool)195cdf0e10cSrcweir SwXMLTextParagraphExport::SwXMLTextParagraphExport(
196cdf0e10cSrcweir SwXMLExport& rExp,
197cdf0e10cSrcweir SvXMLAutoStylePoolP& _rAutoStylePool ) :
198cdf0e10cSrcweir XMLTextParagraphExport( rExp, _rAutoStylePool ),
199cdf0e10cSrcweir sTextTable( RTL_CONSTASCII_USTRINGPARAM( "TextTable" ) ),
200cdf0e10cSrcweir sEmbeddedObjectProtocol( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" ) ),
201cdf0e10cSrcweir sGraphicObjectProtocol( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ),
202cdf0e10cSrcweir aAppletClassId( SO3_APPLET_CLASSID ),
203cdf0e10cSrcweir aPluginClassId( SO3_PLUGIN_CLASSID ),
204cdf0e10cSrcweir aIFrameClassId( SO3_IFRAME_CLASSID ),
205cdf0e10cSrcweir aOutplaceClassId( SO3_OUT_CLASSID )
206cdf0e10cSrcweir {
207cdf0e10cSrcweir }
208cdf0e10cSrcweir
~SwXMLTextParagraphExport()209cdf0e10cSrcweir SwXMLTextParagraphExport::~SwXMLTextParagraphExport()
210cdf0e10cSrcweir {
211cdf0e10cSrcweir }
212cdf0e10cSrcweir
setTextEmbeddedGraphicURL(const Reference<XPropertySet> & rPropSet,OUString & rURL) const213cdf0e10cSrcweir void SwXMLTextParagraphExport::setTextEmbeddedGraphicURL(
214*0b19465bSOliver-Rainer Wittmann const Reference< XPropertySet >& rPropSet,
215*0b19465bSOliver-Rainer Wittmann OUString& rURL ) const
216*0b19465bSOliver-Rainer Wittmann {
217*0b19465bSOliver-Rainer Wittmann if ( !rURL.getLength() )
218*0b19465bSOliver-Rainer Wittmann return;
219cdf0e10cSrcweir
220*0b19465bSOliver-Rainer Wittmann SwGrfNode *pGrfNd = GetNoTxtNode( rPropSet )->GetGrfNode();
221*0b19465bSOliver-Rainer Wittmann if ( !pGrfNd->IsGrfLink() )
222*0b19465bSOliver-Rainer Wittmann {
223*0b19465bSOliver-Rainer Wittmann // Apply new embedded stream name, only if graphic node already has one.
224*0b19465bSOliver-Rainer Wittmann // - The saving of recovery information triggers this method, but for a newly created
225*0b19465bSOliver-Rainer Wittmann // document the new embedded stream name shall not be applied.
226*0b19465bSOliver-Rainer Wittmann // - The saving of a newly created document to own format (ODF) triggers this method,
227*0b19465bSOliver-Rainer Wittmann // but the embedded stream name is not needed as its original inserted data is still in use.
228*0b19465bSOliver-Rainer Wittmann if ( pGrfNd->HasEmbeddedStreamName() )
229*0b19465bSOliver-Rainer Wittmann {
230*0b19465bSOliver-Rainer Wittmann String aNewURL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.Package:" ) );
231*0b19465bSOliver-Rainer Wittmann aNewURL += String( rURL );
232*0b19465bSOliver-Rainer Wittmann pGrfNd->ApplyNewEmbeddedStreamName( aNewURL );
233*0b19465bSOliver-Rainer Wittmann }
234cdf0e10cSrcweir
235cdf0e10cSrcweir // #i15411# save-as will swap all graphics in; we need to swap
236cdf0e10cSrcweir // them out again, to prevent excessive memory use
237cdf0e10cSrcweir pGrfNd->SwapOut();
238*0b19465bSOliver-Rainer Wittmann }
239cdf0e10cSrcweir }
240*0b19465bSOliver-Rainer Wittmann
241cdf0e10cSrcweir
lcl_addURL(SvXMLExport & rExport,const String & rURL,sal_Bool bToRel=sal_True)242cdf0e10cSrcweir static void lcl_addURL ( SvXMLExport &rExport, const String &rURL,
243cdf0e10cSrcweir sal_Bool bToRel = sal_True )
244cdf0e10cSrcweir {
245cdf0e10cSrcweir String sRelURL;
246cdf0e10cSrcweir
247cdf0e10cSrcweir if( bToRel && (rURL.Len() > 0) )
248cdf0e10cSrcweir sRelURL = URIHelper::simpleNormalizedMakeRelative(rExport.GetOrigFileName(),
249cdf0e10cSrcweir rURL);
250cdf0e10cSrcweir else
251cdf0e10cSrcweir sRelURL = rURL;
252cdf0e10cSrcweir
253cdf0e10cSrcweir if (sRelURL.Len())
254cdf0e10cSrcweir {
255cdf0e10cSrcweir rExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, sRelURL );
256cdf0e10cSrcweir rExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
257cdf0e10cSrcweir rExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
258cdf0e10cSrcweir rExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
259cdf0e10cSrcweir }
260cdf0e10cSrcweir }
261cdf0e10cSrcweir
lcl_addAspect(const svt::EmbeddedObjectRef & rObj,const XMLPropertyState ** pStates,const UniReference<XMLPropertySetMapper> & rMapper)262cdf0e10cSrcweir void lcl_addAspect(
263cdf0e10cSrcweir const svt::EmbeddedObjectRef& rObj,
264cdf0e10cSrcweir const XMLPropertyState **pStates,
265cdf0e10cSrcweir const UniReference < XMLPropertySetMapper >& rMapper )
266cdf0e10cSrcweir {
267cdf0e10cSrcweir {
268cdf0e10cSrcweir sal_Int64 nAspect = rObj.GetViewAspect();
269cdf0e10cSrcweir
270cdf0e10cSrcweir if ( nAspect )
271cdf0e10cSrcweir {
272cdf0e10cSrcweir *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_DRAW_ASPECT ), uno::makeAny( nAspect ) );
273cdf0e10cSrcweir pStates++;
274cdf0e10cSrcweir }
275cdf0e10cSrcweir }
276cdf0e10cSrcweir }
277cdf0e10cSrcweir
lcl_addOutplaceProperties(const svt::EmbeddedObjectRef & rObj,const XMLPropertyState ** pStates,const UniReference<XMLPropertySetMapper> & rMapper)278cdf0e10cSrcweir void lcl_addOutplaceProperties(
279cdf0e10cSrcweir const svt::EmbeddedObjectRef& rObj,
280cdf0e10cSrcweir const XMLPropertyState **pStates,
281cdf0e10cSrcweir const UniReference < XMLPropertySetMapper >& rMapper )
282cdf0e10cSrcweir {
283cdf0e10cSrcweir {
284cdf0e10cSrcweir MapMode aMode( MAP_100TH_MM ); // the API expects this map mode for the embedded objects
285cdf0e10cSrcweir Size aSize = rObj.GetSize( &aMode ); // get the size in the requested map mode
286cdf0e10cSrcweir
287cdf0e10cSrcweir if( aSize.Width() && aSize.Height() )
288cdf0e10cSrcweir {
289cdf0e10cSrcweir Any aAny;
290cdf0e10cSrcweir //aAny <<= (sal_Int32)rVisArea.Left();
291cdf0e10cSrcweir aAny <<= 0L;
292cdf0e10cSrcweir *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_LEFT ), aAny );
293cdf0e10cSrcweir pStates++;
294cdf0e10cSrcweir
295cdf0e10cSrcweir //aAny <<= (sal_Int32)rVisArea.Top();
296cdf0e10cSrcweir aAny <<= 0L;
297cdf0e10cSrcweir *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_TOP ), aAny );
298cdf0e10cSrcweir pStates++;
299cdf0e10cSrcweir
300cdf0e10cSrcweir //aAny <<= (sal_Int32)rVisArea.GetWidth();
301cdf0e10cSrcweir aAny <<= (sal_Int32)aSize.Width();
302cdf0e10cSrcweir *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_WIDTH ), aAny );
303cdf0e10cSrcweir pStates++;
304cdf0e10cSrcweir
305cdf0e10cSrcweir //aAny <<= (sal_Int32)rVisArea.GetHeight();
306cdf0e10cSrcweir aAny <<= (sal_Int32)aSize.Height();
307cdf0e10cSrcweir *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_HEIGHT ), aAny );
308cdf0e10cSrcweir pStates++;
309cdf0e10cSrcweir }
310cdf0e10cSrcweir }
311cdf0e10cSrcweir }
312cdf0e10cSrcweir
lcl_addFrameProperties(const uno::Reference<embed::XEmbeddedObject> & xObj,const XMLPropertyState ** pStates,const UniReference<XMLPropertySetMapper> & rMapper)313cdf0e10cSrcweir void lcl_addFrameProperties(
314cdf0e10cSrcweir const uno::Reference < embed::XEmbeddedObject >& xObj,
315cdf0e10cSrcweir const XMLPropertyState **pStates,
316cdf0e10cSrcweir const UniReference < XMLPropertySetMapper >& rMapper )
317cdf0e10cSrcweir {
318cdf0e10cSrcweir if ( !::svt::EmbeddedObjectRef::TryRunningState( xObj ) )
319cdf0e10cSrcweir return;
320cdf0e10cSrcweir
321cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
322cdf0e10cSrcweir if ( !xSet.is() )
323cdf0e10cSrcweir return;
324cdf0e10cSrcweir
325cdf0e10cSrcweir ::rtl::OUString aURL;
326cdf0e10cSrcweir Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameURL") );
327cdf0e10cSrcweir aAny >>= aURL;
328cdf0e10cSrcweir
329cdf0e10cSrcweir ::rtl::OUString aName;
330cdf0e10cSrcweir aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameName") );
331cdf0e10cSrcweir aAny >>= aName;
332cdf0e10cSrcweir
333cdf0e10cSrcweir sal_Bool bIsAutoScroll = sal_False, bIsScrollingMode;
334cdf0e10cSrcweir aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoScroll") );
335cdf0e10cSrcweir aAny >>= bIsAutoScroll;
336cdf0e10cSrcweir if ( !bIsAutoScroll )
337cdf0e10cSrcweir {
338cdf0e10cSrcweir aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsScrollingMode") );
339cdf0e10cSrcweir aAny >>= bIsScrollingMode;
340cdf0e10cSrcweir }
341cdf0e10cSrcweir
342cdf0e10cSrcweir sal_Bool bIsBorderSet, bIsAutoBorder = sal_False;
343cdf0e10cSrcweir aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoBorder") );
344cdf0e10cSrcweir aAny >>= bIsAutoBorder;
345cdf0e10cSrcweir if ( !bIsAutoBorder )
346cdf0e10cSrcweir {
347cdf0e10cSrcweir aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameIsBorder") );
348cdf0e10cSrcweir aAny >>= bIsBorderSet;
349cdf0e10cSrcweir }
350cdf0e10cSrcweir
351cdf0e10cSrcweir sal_Int32 nWidth, nHeight;
352cdf0e10cSrcweir aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginWidth") );
353cdf0e10cSrcweir aAny >>= nWidth;
354cdf0e10cSrcweir aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginHeight") );
355cdf0e10cSrcweir aAny >>= nHeight;
356cdf0e10cSrcweir
357cdf0e10cSrcweir if( !bIsAutoScroll )
358cdf0e10cSrcweir {
359cdf0e10cSrcweir Any aAny2( &bIsScrollingMode, ::getBooleanCppuType() );
360cdf0e10cSrcweir *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_FRAME_DISPLAY_SCROLLBAR ), aAny2 );
361cdf0e10cSrcweir pStates++;
362cdf0e10cSrcweir }
363cdf0e10cSrcweir if( !bIsAutoBorder )
364cdf0e10cSrcweir {
365cdf0e10cSrcweir Any aAny2( &bIsBorderSet, ::getBooleanCppuType() );
366cdf0e10cSrcweir *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_FRAME_DISPLAY_BORDER ), aAny2 );
367cdf0e10cSrcweir pStates++;
368cdf0e10cSrcweir }
369cdf0e10cSrcweir if( SIZE_NOT_SET != nWidth )
370cdf0e10cSrcweir {
371cdf0e10cSrcweir Any aAny2;
372cdf0e10cSrcweir aAny <<= nWidth;
373cdf0e10cSrcweir *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_FRAME_MARGIN_HORI ), aAny2 );
374cdf0e10cSrcweir pStates++;
375cdf0e10cSrcweir }
376cdf0e10cSrcweir if( SIZE_NOT_SET != nHeight )
377cdf0e10cSrcweir {
378cdf0e10cSrcweir Any aAny2;
379cdf0e10cSrcweir aAny <<= nHeight;
380cdf0e10cSrcweir *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_FRAME_MARGIN_VERT ), aAny2 );
381cdf0e10cSrcweir pStates++;
382cdf0e10cSrcweir }
383cdf0e10cSrcweir }
384cdf0e10cSrcweir
_collectTextEmbeddedAutoStyles(const Reference<XPropertySet> & rPropSet)385cdf0e10cSrcweir void SwXMLTextParagraphExport::_collectTextEmbeddedAutoStyles(
386cdf0e10cSrcweir const Reference < XPropertySet > & rPropSet )
387cdf0e10cSrcweir {
388cdf0e10cSrcweir SwOLENode *pOLENd = GetNoTxtNode( rPropSet )->GetOLENode();
389cdf0e10cSrcweir svt::EmbeddedObjectRef& rObjRef = pOLENd->GetOLEObj().GetObject();
390cdf0e10cSrcweir if( !rObjRef.is() )
391cdf0e10cSrcweir return;
392cdf0e10cSrcweir
393cdf0e10cSrcweir const XMLPropertyState *aStates[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
394cdf0e10cSrcweir SvGlobalName aClassId( rObjRef->getClassID() );
395cdf0e10cSrcweir
396cdf0e10cSrcweir if( aIFrameClassId == aClassId )
397cdf0e10cSrcweir {
398cdf0e10cSrcweir lcl_addFrameProperties( rObjRef.GetObject(), aStates,
399cdf0e10cSrcweir GetAutoFramePropMapper()->getPropertySetMapper() );
400cdf0e10cSrcweir }
401cdf0e10cSrcweir else if ( !SotExchange::IsInternal( aClassId ) )
402cdf0e10cSrcweir {
403cdf0e10cSrcweir lcl_addOutplaceProperties( rObjRef, aStates,
404cdf0e10cSrcweir GetAutoFramePropMapper()->getPropertySetMapper() );
405cdf0e10cSrcweir }
406cdf0e10cSrcweir
407cdf0e10cSrcweir lcl_addAspect( rObjRef, aStates,
408cdf0e10cSrcweir GetAutoFramePropMapper()->getPropertySetMapper() );
409cdf0e10cSrcweir
410cdf0e10cSrcweir Add( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, aStates );
411cdf0e10cSrcweir
412cdf0e10cSrcweir const XMLPropertyState **pStates = aStates;
413cdf0e10cSrcweir while( *pStates )
414cdf0e10cSrcweir {
415cdf0e10cSrcweir delete *pStates;
416cdf0e10cSrcweir pStates++;
417cdf0e10cSrcweir }
418cdf0e10cSrcweir }
419cdf0e10cSrcweir
_exportTextEmbedded(const Reference<XPropertySet> & rPropSet,const Reference<XPropertySetInfo> & rPropSetInfo)420cdf0e10cSrcweir void SwXMLTextParagraphExport::_exportTextEmbedded(
421cdf0e10cSrcweir const Reference < XPropertySet > & rPropSet,
422cdf0e10cSrcweir const Reference < XPropertySetInfo > & rPropSetInfo )
423cdf0e10cSrcweir {
424cdf0e10cSrcweir SwOLENode *pOLENd = GetNoTxtNode( rPropSet )->GetOLENode();
425cdf0e10cSrcweir SwOLEObj& rOLEObj = pOLENd->GetOLEObj();
426cdf0e10cSrcweir svt::EmbeddedObjectRef& rObjRef = rOLEObj.GetObject();
427cdf0e10cSrcweir if( !rObjRef.is() )
428cdf0e10cSrcweir return;
429cdf0e10cSrcweir
430cdf0e10cSrcweir SvGlobalName aClassId( rObjRef->getClassID() );
431cdf0e10cSrcweir
432cdf0e10cSrcweir SvEmbeddedObjectTypes nType = SV_EMBEDDED_OWN;
433cdf0e10cSrcweir if( aPluginClassId == aClassId )
434cdf0e10cSrcweir {
435cdf0e10cSrcweir nType = SV_EMBEDDED_PLUGIN;
436cdf0e10cSrcweir }
437cdf0e10cSrcweir else if( aAppletClassId == aClassId )
438cdf0e10cSrcweir {
439cdf0e10cSrcweir nType = SV_EMBEDDED_APPLET;
440cdf0e10cSrcweir }
441cdf0e10cSrcweir else if( aIFrameClassId == aClassId )
442cdf0e10cSrcweir {
443cdf0e10cSrcweir nType = SV_EMBEDDED_FRAME;
444cdf0e10cSrcweir }
445cdf0e10cSrcweir else if ( !SotExchange::IsInternal( aClassId ) )
446cdf0e10cSrcweir {
447cdf0e10cSrcweir nType = SV_EMBEDDED_OUTPLACE;
448cdf0e10cSrcweir }
449cdf0e10cSrcweir
450cdf0e10cSrcweir enum XMLTokenEnum eElementName = XML__UNKNOWN_;
451cdf0e10cSrcweir SvXMLExport &rXMLExport = GetExport();
452cdf0e10cSrcweir
453cdf0e10cSrcweir // First the stuff common to each of Applet/Plugin/Floating Frame
454cdf0e10cSrcweir OUString sStyle;
455cdf0e10cSrcweir Any aAny;
456cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sFrameStyleName ) )
457cdf0e10cSrcweir {
458cdf0e10cSrcweir aAny = rPropSet->getPropertyValue( sFrameStyleName );
459cdf0e10cSrcweir aAny >>= sStyle;
460cdf0e10cSrcweir }
461cdf0e10cSrcweir
462cdf0e10cSrcweir const XMLPropertyState *aStates[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
463cdf0e10cSrcweir switch( nType )
464cdf0e10cSrcweir {
465cdf0e10cSrcweir case SV_EMBEDDED_FRAME:
466cdf0e10cSrcweir lcl_addFrameProperties( rObjRef.GetObject(), aStates,
467cdf0e10cSrcweir GetAutoFramePropMapper()->getPropertySetMapper() );
468cdf0e10cSrcweir break;
469cdf0e10cSrcweir case SV_EMBEDDED_OUTPLACE:
470cdf0e10cSrcweir lcl_addOutplaceProperties( rObjRef, aStates,
471cdf0e10cSrcweir GetAutoFramePropMapper()->getPropertySetMapper() );
472cdf0e10cSrcweir break;
473cdf0e10cSrcweir default:
474cdf0e10cSrcweir ;
475cdf0e10cSrcweir }
476cdf0e10cSrcweir
477cdf0e10cSrcweir lcl_addAspect( rObjRef, aStates,
478cdf0e10cSrcweir GetAutoFramePropMapper()->getPropertySetMapper() );
479cdf0e10cSrcweir
480cdf0e10cSrcweir OUString sAutoStyle( sStyle );
481cdf0e10cSrcweir sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, sStyle,
482cdf0e10cSrcweir aStates );
483cdf0e10cSrcweir const XMLPropertyState **pStates = aStates;
484cdf0e10cSrcweir while( *pStates )
485cdf0e10cSrcweir {
486cdf0e10cSrcweir delete *pStates;
487cdf0e10cSrcweir pStates++;
488cdf0e10cSrcweir }
489cdf0e10cSrcweir
490cdf0e10cSrcweir if( sAutoStyle.getLength() )
491cdf0e10cSrcweir rXMLExport.AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE_NAME, sAutoStyle );
492cdf0e10cSrcweir addTextFrameAttributes( rPropSet, sal_False );
493cdf0e10cSrcweir
494cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW,
495cdf0e10cSrcweir XML_FRAME, sal_False, sal_True );
496cdf0e10cSrcweir
497cdf0e10cSrcweir switch (nType)
498cdf0e10cSrcweir {
499cdf0e10cSrcweir case SV_EMBEDDED_OUTPLACE:
500cdf0e10cSrcweir case SV_EMBEDDED_OWN:
501cdf0e10cSrcweir if( (rXMLExport.getExportFlags() & EXPORT_EMBEDDED) == 0 )
502cdf0e10cSrcweir {
503cdf0e10cSrcweir OUString sURL;
504cdf0e10cSrcweir
505cdf0e10cSrcweir sal_Bool bIsOwnLink = sal_False;
506cdf0e10cSrcweir if( SV_EMBEDDED_OWN == nType )
507cdf0e10cSrcweir {
508cdf0e10cSrcweir try
509cdf0e10cSrcweir {
510cdf0e10cSrcweir uno::Reference< embed::XLinkageSupport > xLinkage( rObjRef.GetObject(), uno::UNO_QUERY );
511cdf0e10cSrcweir bIsOwnLink = xLinkage.is() && xLinkage->isLink();
512cdf0e10cSrcweir if ( bIsOwnLink )
513cdf0e10cSrcweir sURL = xLinkage->getLinkURL();
514cdf0e10cSrcweir }
515cdf0e10cSrcweir catch( uno::Exception )
516cdf0e10cSrcweir {
517cdf0e10cSrcweir // TODO/LATER: error handling
518cdf0e10cSrcweir DBG_ERROR( "Link detection or retrieving of the URL of OOo link is failed!\n" );
519cdf0e10cSrcweir }
520cdf0e10cSrcweir }
521cdf0e10cSrcweir
522cdf0e10cSrcweir if ( !bIsOwnLink )
523cdf0e10cSrcweir {
524cdf0e10cSrcweir sURL = OUString( sEmbeddedObjectProtocol );
525cdf0e10cSrcweir sURL += rOLEObj.GetCurrentPersistName();
526cdf0e10cSrcweir }
527cdf0e10cSrcweir
528cdf0e10cSrcweir sURL = GetExport().AddEmbeddedObject( sURL );
529cdf0e10cSrcweir lcl_addURL( rXMLExport, sURL, sal_False );
530cdf0e10cSrcweir }
531cdf0e10cSrcweir if( SV_EMBEDDED_OWN == nType && pOLENd->GetChartTblName().Len() )
532cdf0e10cSrcweir {
533cdf0e10cSrcweir OUString sRange( pOLENd->GetChartTblName() );
534cdf0e10cSrcweir OUStringBuffer aBuffer( sRange.getLength() + 2 );
535cdf0e10cSrcweir for( sal_Int32 i=0; i < sRange.getLength(); i++ )
536cdf0e10cSrcweir {
537cdf0e10cSrcweir sal_Unicode c = sRange[i];
538cdf0e10cSrcweir switch( c )
539cdf0e10cSrcweir {
540cdf0e10cSrcweir case ' ':
541cdf0e10cSrcweir case '.':
542cdf0e10cSrcweir case '\'':
543cdf0e10cSrcweir case '\\':
544cdf0e10cSrcweir if( !aBuffer.getLength() )
545cdf0e10cSrcweir {
546cdf0e10cSrcweir aBuffer.append( (sal_Unicode)'\'' );
547cdf0e10cSrcweir aBuffer.append( sRange.copy( 0, i ) );
548cdf0e10cSrcweir }
549cdf0e10cSrcweir if( '\'' == c || '\\' == c )
550cdf0e10cSrcweir aBuffer.append( (sal_Unicode)'\\' );
551cdf0e10cSrcweir // no break!
552cdf0e10cSrcweir default:
553cdf0e10cSrcweir if( aBuffer.getLength() )
554cdf0e10cSrcweir aBuffer.append( c );
555cdf0e10cSrcweir }
556cdf0e10cSrcweir }
557cdf0e10cSrcweir if( aBuffer.getLength() )
558cdf0e10cSrcweir {
559cdf0e10cSrcweir aBuffer.append( (sal_Unicode)'\'' );
560cdf0e10cSrcweir sRange = aBuffer.makeStringAndClear();
561cdf0e10cSrcweir }
562cdf0e10cSrcweir
563cdf0e10cSrcweir rXMLExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NOTIFY_ON_UPDATE_OF_RANGES,
564cdf0e10cSrcweir sRange );
565cdf0e10cSrcweir }
566cdf0e10cSrcweir eElementName = SV_EMBEDDED_OUTPLACE==nType ? XML_OBJECT_OLE
567cdf0e10cSrcweir : XML_OBJECT;
568cdf0e10cSrcweir break;
569cdf0e10cSrcweir case SV_EMBEDDED_APPLET:
570cdf0e10cSrcweir {
571cdf0e10cSrcweir // It's an applet!
572cdf0e10cSrcweir if( svt::EmbeddedObjectRef::TryRunningState( rObjRef.GetObject() ) )
573cdf0e10cSrcweir {
574cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xSet( rObjRef->getComponent(), uno::UNO_QUERY );
575cdf0e10cSrcweir ::rtl::OUString aStr;
576cdf0e10cSrcweir Any aAny2 = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCodeBase") );
577cdf0e10cSrcweir aAny2 >>= aStr;
578cdf0e10cSrcweir if (aStr.getLength() )
579cdf0e10cSrcweir lcl_addURL(rXMLExport, aStr);
580cdf0e10cSrcweir
581cdf0e10cSrcweir aAny2 = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletName") );
582cdf0e10cSrcweir aAny2 >>= aStr;
583cdf0e10cSrcweir if (aStr.getLength())
584cdf0e10cSrcweir rXMLExport.AddAttribute( XML_NAMESPACE_DRAW, XML_APPLET_NAME, aStr );
585cdf0e10cSrcweir
586cdf0e10cSrcweir aAny2 = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCode") );
587cdf0e10cSrcweir aAny2 >>= aStr;
588cdf0e10cSrcweir rXMLExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CODE, aStr );
589cdf0e10cSrcweir
590cdf0e10cSrcweir sal_Bool bScript = sal_False;
591cdf0e10cSrcweir aAny2 = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletIsScript") );
592cdf0e10cSrcweir aAny2 >>= bScript;
593cdf0e10cSrcweir rXMLExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MAY_SCRIPT, bScript ? XML_TRUE : XML_FALSE );
594cdf0e10cSrcweir
595cdf0e10cSrcweir uno::Sequence < beans::PropertyValue > aProps;
596cdf0e10cSrcweir aAny2 = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCommands") );
597cdf0e10cSrcweir aAny2 >>= aProps;
598cdf0e10cSrcweir
599cdf0e10cSrcweir sal_Int32 i = aProps.getLength();
600cdf0e10cSrcweir while ( i > 0 )
601cdf0e10cSrcweir {
602cdf0e10cSrcweir beans::PropertyValue& aProp = aProps[--i];
603cdf0e10cSrcweir sal_uInt16 nType2 = SwApplet_Impl::GetOptionType( aProp.Name, sal_True );
604cdf0e10cSrcweir if ( nType2 == SWHTML_OPTTYPE_TAG)
605cdf0e10cSrcweir {
606cdf0e10cSrcweir ::rtl::OUString aStr2;
607cdf0e10cSrcweir aProp.Value >>= aStr2;
608cdf0e10cSrcweir rXMLExport.AddAttribute( XML_NAMESPACE_DRAW, aProp.Name, aStr2);
609cdf0e10cSrcweir }
610cdf0e10cSrcweir }
611cdf0e10cSrcweir
612cdf0e10cSrcweir eElementName = XML_APPLET;
613cdf0e10cSrcweir }
614cdf0e10cSrcweir }
615cdf0e10cSrcweir break;
616cdf0e10cSrcweir case SV_EMBEDDED_PLUGIN:
617cdf0e10cSrcweir {
618cdf0e10cSrcweir // It's a plugin!
619cdf0e10cSrcweir if ( svt::EmbeddedObjectRef::TryRunningState( rObjRef.GetObject() ) )
620cdf0e10cSrcweir {
621cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xSet( rObjRef->getComponent(), uno::UNO_QUERY );
622cdf0e10cSrcweir ::rtl::OUString aStr;
623cdf0e10cSrcweir Any aAny2 = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("PluginURL") );
624cdf0e10cSrcweir aAny2 >>= aStr;
625cdf0e10cSrcweir lcl_addURL( rXMLExport, aStr );
626cdf0e10cSrcweir
627cdf0e10cSrcweir aAny2 = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("PluginMimeType") );
628cdf0e10cSrcweir aAny2 >>= aStr;
629cdf0e10cSrcweir if (aStr.getLength())
630cdf0e10cSrcweir rXMLExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, aStr );
631cdf0e10cSrcweir eElementName = XML_PLUGIN;
632cdf0e10cSrcweir }
633cdf0e10cSrcweir }
634cdf0e10cSrcweir break;
635cdf0e10cSrcweir case SV_EMBEDDED_FRAME:
636cdf0e10cSrcweir {
637cdf0e10cSrcweir // It's a floating frame!
638cdf0e10cSrcweir if ( svt::EmbeddedObjectRef::TryRunningState( rObjRef.GetObject() ) )
639cdf0e10cSrcweir {
640cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xSet( rObjRef->getComponent(), uno::UNO_QUERY );
641cdf0e10cSrcweir ::rtl::OUString aStr;
642cdf0e10cSrcweir Any aAny2 = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameURL") );
643cdf0e10cSrcweir aAny2 >>= aStr;
644cdf0e10cSrcweir
645cdf0e10cSrcweir lcl_addURL( rXMLExport, aStr );
646cdf0e10cSrcweir
647cdf0e10cSrcweir aAny2 = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("FrameName") );
648cdf0e10cSrcweir aAny2 >>= aStr;
649cdf0e10cSrcweir
650cdf0e10cSrcweir if (aStr.getLength())
651cdf0e10cSrcweir rXMLExport.AddAttribute( XML_NAMESPACE_DRAW, XML_FRAME_NAME, aStr );
652cdf0e10cSrcweir eElementName = XML_FLOATING_FRAME;
653cdf0e10cSrcweir }
654cdf0e10cSrcweir }
655cdf0e10cSrcweir break;
656cdf0e10cSrcweir default:
657cdf0e10cSrcweir ASSERT( !this, "unknown object type! Base class should have been called!" );
658cdf0e10cSrcweir }
659cdf0e10cSrcweir
660cdf0e10cSrcweir {
661cdf0e10cSrcweir SvXMLElementExport aElementExport( rXMLExport, XML_NAMESPACE_DRAW, eElementName,
662cdf0e10cSrcweir sal_False, sal_True );
663cdf0e10cSrcweir switch( nType )
664cdf0e10cSrcweir {
665cdf0e10cSrcweir case SV_EMBEDDED_OWN:
666cdf0e10cSrcweir if( (rXMLExport.getExportFlags() & EXPORT_EMBEDDED) != 0 )
667cdf0e10cSrcweir {
668cdf0e10cSrcweir Reference < XEmbeddedObjectSupplier > xEOS( rPropSet, UNO_QUERY );
669cdf0e10cSrcweir ASSERT( xEOS.is(), "no embedded object supplier for own object" );
670cdf0e10cSrcweir Reference < XComponent > xComp = xEOS->getEmbeddedObject();
671cdf0e10cSrcweir rXMLExport.ExportEmbeddedOwnObject( xComp );
672cdf0e10cSrcweir }
673cdf0e10cSrcweir break;
674cdf0e10cSrcweir case SV_EMBEDDED_OUTPLACE:
675cdf0e10cSrcweir if( (rXMLExport.getExportFlags() & EXPORT_EMBEDDED) != 0 )
676cdf0e10cSrcweir {
677cdf0e10cSrcweir OUString sURL( sEmbeddedObjectProtocol );
678cdf0e10cSrcweir sURL += rOLEObj.GetCurrentPersistName();
679cdf0e10cSrcweir
680cdf0e10cSrcweir if ( ( rXMLExport.getExportFlags() & EXPORT_OASIS ) == 0 )
681cdf0e10cSrcweir sURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "?oasis=false" ) );
682cdf0e10cSrcweir
683cdf0e10cSrcweir rXMLExport.AddEmbeddedObjectAsBase64( sURL );
684cdf0e10cSrcweir }
685cdf0e10cSrcweir break;
686cdf0e10cSrcweir case SV_EMBEDDED_APPLET:
687cdf0e10cSrcweir {
688cdf0e10cSrcweir if ( svt::EmbeddedObjectRef::TryRunningState( rObjRef.GetObject() ) )
689cdf0e10cSrcweir {
690cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xSet( rObjRef->getComponent(), uno::UNO_QUERY );
691cdf0e10cSrcweir uno::Sequence < beans::PropertyValue > aProps;
692cdf0e10cSrcweir aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCommands") );
693cdf0e10cSrcweir aAny >>= aProps;
694cdf0e10cSrcweir
695cdf0e10cSrcweir sal_Int32 i = aProps.getLength();
696cdf0e10cSrcweir while ( i > 0 )
697cdf0e10cSrcweir {
698cdf0e10cSrcweir beans::PropertyValue& aProp = aProps[--i];
699cdf0e10cSrcweir sal_uInt16 nType2 = SwApplet_Impl::GetOptionType( aProp.Name, sal_True );
700cdf0e10cSrcweir if (SWHTML_OPTTYPE_PARAM == nType2 || SWHTML_OPTTYPE_SIZE == nType2 )
701cdf0e10cSrcweir {
702cdf0e10cSrcweir ::rtl::OUString aStr;
703cdf0e10cSrcweir aProp.Value >>= aStr;
704cdf0e10cSrcweir rXMLExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aProp.Name );
705cdf0e10cSrcweir rXMLExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
706cdf0e10cSrcweir SvXMLElementExport aElementExport2( rXMLExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True );
707cdf0e10cSrcweir }
708cdf0e10cSrcweir }
709cdf0e10cSrcweir }
710cdf0e10cSrcweir }
711cdf0e10cSrcweir break;
712cdf0e10cSrcweir case SV_EMBEDDED_PLUGIN:
713cdf0e10cSrcweir {
714cdf0e10cSrcweir if ( svt::EmbeddedObjectRef::TryRunningState( rObjRef.GetObject() ) )
715cdf0e10cSrcweir {
716cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xSet( rObjRef->getComponent(), uno::UNO_QUERY );
717cdf0e10cSrcweir uno::Sequence < beans::PropertyValue > aProps;
718cdf0e10cSrcweir aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("PluginCommands") );
719cdf0e10cSrcweir aAny >>= aProps;
720cdf0e10cSrcweir
721cdf0e10cSrcweir sal_Int32 i = aProps.getLength();
722cdf0e10cSrcweir while ( i > 0 )
723cdf0e10cSrcweir {
724cdf0e10cSrcweir beans::PropertyValue& aProp = aProps[--i];
725cdf0e10cSrcweir sal_uInt16 nType2 = SwApplet_Impl::GetOptionType( aProp.Name, sal_False );
726cdf0e10cSrcweir if ( nType2 == SWHTML_OPTTYPE_TAG)
727cdf0e10cSrcweir {
728cdf0e10cSrcweir ::rtl::OUString aStr;
729cdf0e10cSrcweir aProp.Value >>= aStr;
730cdf0e10cSrcweir rXMLExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aProp.Name );
731cdf0e10cSrcweir rXMLExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
732cdf0e10cSrcweir SvXMLElementExport aElementExport2( rXMLExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True );
733cdf0e10cSrcweir }
734cdf0e10cSrcweir }
735cdf0e10cSrcweir }
736cdf0e10cSrcweir }
737cdf0e10cSrcweir break;
738cdf0e10cSrcweir default:
739cdf0e10cSrcweir break;
740cdf0e10cSrcweir }
741cdf0e10cSrcweir }
742cdf0e10cSrcweir if( SV_EMBEDDED_OUTPLACE==nType || SV_EMBEDDED_OWN==nType )
743cdf0e10cSrcweir {
744cdf0e10cSrcweir OUString sURL( sGraphicObjectProtocol );
745cdf0e10cSrcweir sURL += rOLEObj.GetCurrentPersistName();
746cdf0e10cSrcweir if( (rXMLExport.getExportFlags() & EXPORT_EMBEDDED) == 0 )
747cdf0e10cSrcweir {
748cdf0e10cSrcweir sURL = GetExport().AddEmbeddedObject( sURL );
749cdf0e10cSrcweir lcl_addURL( rXMLExport, sURL, sal_False );
750cdf0e10cSrcweir }
751cdf0e10cSrcweir
752cdf0e10cSrcweir SvXMLElementExport aElementExport( GetExport(), XML_NAMESPACE_DRAW,
753cdf0e10cSrcweir XML_IMAGE, sal_False, sal_True );
754cdf0e10cSrcweir
755cdf0e10cSrcweir if( (rXMLExport.getExportFlags() & EXPORT_EMBEDDED) != 0 )
756cdf0e10cSrcweir GetExport().AddEmbeddedObjectAsBase64( sURL );
757cdf0e10cSrcweir }
758cdf0e10cSrcweir
759cdf0e10cSrcweir // Lastly the stuff common to each of Applet/Plugin/Floating Frame
760cdf0e10cSrcweir exportEvents( rPropSet );
761cdf0e10cSrcweir // --> OD 2009-07-22 #i73249#
762cdf0e10cSrcweir exportTitleAndDescription( rPropSet, rPropSetInfo );
763cdf0e10cSrcweir // <--
764cdf0e10cSrcweir exportContour( rPropSet, rPropSetInfo );
765cdf0e10cSrcweir }
766