163bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
363bba73cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
463bba73cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
563bba73cSAndrew Rist  * distributed with this work for additional information
663bba73cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
763bba73cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
863bba73cSAndrew Rist  * "License"); you may not use this file except in compliance
963bba73cSAndrew Rist  * with the License.  You may obtain a copy of the License at
1063bba73cSAndrew Rist  *
1163bba73cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1263bba73cSAndrew Rist  *
1363bba73cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1463bba73cSAndrew Rist  * software distributed under the License is distributed on an
1563bba73cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1663bba73cSAndrew Rist  * KIND, either express or implied.  See the License for the
1763bba73cSAndrew Rist  * specific language governing permissions and limitations
1863bba73cSAndrew Rist  * under the License.
1963bba73cSAndrew Rist  *
2063bba73cSAndrew Rist  *************************************************************/
2163bba73cSAndrew Rist 
2263bba73cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
26cdf0e10cSrcweir #include <tools/debug.hxx>
27cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28cdf0e10cSrcweir #include <com/sun/star/text/TextContentAnchorType.hpp>
29cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
30cdf0e10cSrcweir #include <com/sun/star/text/XTextFrame.hpp>
31cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp>
32cdf0e10cSrcweir #include <com/sun/star/text/SizeType.hpp>
33cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp>
34cdf0e10cSrcweir #include <com/sun/star/document/XEventsSupplier.hpp>
35cdf0e10cSrcweir #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
36cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp>
37cdf0e10cSrcweir #include <com/sun/star/text/HoriOrientation.hpp>
38cdf0e10cSrcweir #include <com/sun/star/text/VertOrientation.hpp>
39cdf0e10cSrcweir #include <xmloff/xmlimp.hxx>
40cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
41cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
42cdf0e10cSrcweir #include <xmloff/nmspmap.hxx>
43cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
44cdf0e10cSrcweir #include "XMLAnchorTypePropHdl.hxx"
45cdf0e10cSrcweir #include "XMLEmbeddedObjectImportContext.hxx"
46cdf0e10cSrcweir #include <xmloff/XMLBase64ImportContext.hxx>
47cdf0e10cSrcweir #include "XMLReplacementImageContext.hxx"
48cdf0e10cSrcweir #include <xmloff/prstylei.hxx>
49cdf0e10cSrcweir #include "xmloff/i18nmap.hxx"
50cdf0e10cSrcweir #include "xexptran.hxx"
51cdf0e10cSrcweir #include <xmloff/shapeimport.hxx>
52cdf0e10cSrcweir #include <xmloff/XMLEventsImportContext.hxx>
53cdf0e10cSrcweir #include "XMLImageMapContext.hxx"
54cdf0e10cSrcweir #include "XMLTextFrameContext.hxx"
55cdf0e10cSrcweir 
56cdf0e10cSrcweir #include "XMLTextListBlockContext.hxx"
57cdf0e10cSrcweir #include "XMLTextListItemContext.hxx"
58cdf0e10cSrcweir #include <xmloff/attrlist.hxx>
59cdf0e10cSrcweir #include <comphelper/stl_types.hxx>
60cdf0e10cSrcweir 
61cdf0e10cSrcweir #include <map>
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 
64cdf0e10cSrcweir using ::rtl::OUString;
65cdf0e10cSrcweir using ::rtl::OUStringBuffer;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir using namespace ::com::sun::star;
68cdf0e10cSrcweir using namespace ::com::sun::star::uno;
69cdf0e10cSrcweir using namespace ::com::sun::star::text;
70cdf0e10cSrcweir using namespace ::com::sun::star::xml::sax;
71cdf0e10cSrcweir using namespace ::com::sun::star::beans;
72cdf0e10cSrcweir using namespace ::com::sun::star::lang;
73cdf0e10cSrcweir using namespace ::com::sun::star::container;
74cdf0e10cSrcweir using namespace ::com::sun::star::drawing;
75cdf0e10cSrcweir using namespace ::com::sun::star::document;
76cdf0e10cSrcweir using namespace ::xmloff::token;
77cdf0e10cSrcweir using ::com::sun::star::document::XEventsSupplier;
78cdf0e10cSrcweir 
79cdf0e10cSrcweir #define XML_TEXT_FRAME_TEXTBOX 1
80cdf0e10cSrcweir #define XML_TEXT_FRAME_GRAPHIC 2
81cdf0e10cSrcweir #define XML_TEXT_FRAME_OBJECT 3
82cdf0e10cSrcweir #define XML_TEXT_FRAME_OBJECT_OLE 4
83cdf0e10cSrcweir #define XML_TEXT_FRAME_APPLET 5
84cdf0e10cSrcweir #define XML_TEXT_FRAME_PLUGIN 6
85cdf0e10cSrcweir #define XML_TEXT_FRAME_FLOATING_FRAME 7
86cdf0e10cSrcweir 
87cdf0e10cSrcweir typedef ::std::map < const ::rtl::OUString, ::rtl::OUString, ::comphelper::UStringLess> ParamMap;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir class XMLTextFrameContextHyperlink_Impl
90cdf0e10cSrcweir {
91cdf0e10cSrcweir 	OUString sHRef;
92cdf0e10cSrcweir 	OUString sName;
93cdf0e10cSrcweir 	OUString sTargetFrameName;
94cdf0e10cSrcweir 	sal_Bool bMap;
95cdf0e10cSrcweir 
96cdf0e10cSrcweir public:
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	inline XMLTextFrameContextHyperlink_Impl( const OUString& rHRef,
99cdf0e10cSrcweir 					   const OUString& rName,
100cdf0e10cSrcweir 					   const OUString& rTargetFrameName,
101cdf0e10cSrcweir 					   sal_Bool bMap );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	const OUString& GetHRef() const { return sHRef; }
104cdf0e10cSrcweir 	const OUString& GetName() const { return sName; }
105cdf0e10cSrcweir 	const OUString& GetTargetFrameName() const { return sTargetFrameName; }
106cdf0e10cSrcweir 	sal_Bool GetMap() const { return bMap; }
107cdf0e10cSrcweir };
108cdf0e10cSrcweir 
109cdf0e10cSrcweir inline XMLTextFrameContextHyperlink_Impl::XMLTextFrameContextHyperlink_Impl(
110cdf0e10cSrcweir 	const OUString& rHRef, const OUString& rName,
111cdf0e10cSrcweir 	const OUString& rTargetFrameName, sal_Bool bM ) :
112cdf0e10cSrcweir 	sHRef( rHRef ),
113cdf0e10cSrcweir 	sName( rName ),
114cdf0e10cSrcweir 	sTargetFrameName( rTargetFrameName ),
115cdf0e10cSrcweir 	bMap( bM )
116cdf0e10cSrcweir {
117cdf0e10cSrcweir }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir // --> OD 2009-07-22 #i73249#
120cdf0e10cSrcweir class XMLTextFrameTitleOrDescContext_Impl : public SvXMLImportContext
121cdf0e10cSrcweir {
122cdf0e10cSrcweir     OUString&   mrTitleOrDesc;
123cdf0e10cSrcweir 
124cdf0e10cSrcweir public:
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	TYPEINFO();
127cdf0e10cSrcweir 
128cdf0e10cSrcweir     XMLTextFrameTitleOrDescContext_Impl( SvXMLImport& rImport,
129cdf0e10cSrcweir                                          sal_uInt16 nPrfx,
130cdf0e10cSrcweir                                          const ::rtl::OUString& rLName,
131cdf0e10cSrcweir                                          OUString& rTitleOrDesc );
132cdf0e10cSrcweir     virtual ~XMLTextFrameTitleOrDescContext_Impl();
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	virtual void Characters( const OUString& rText );
135cdf0e10cSrcweir };
136cdf0e10cSrcweir 
137cdf0e10cSrcweir TYPEINIT1( XMLTextFrameTitleOrDescContext_Impl, SvXMLImportContext );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir XMLTextFrameTitleOrDescContext_Impl::XMLTextFrameTitleOrDescContext_Impl(
140cdf0e10cSrcweir 		SvXMLImport& rImport,
141cdf0e10cSrcweir         sal_uInt16 nPrfx,
142cdf0e10cSrcweir         const OUString& rLName,
143cdf0e10cSrcweir         OUString& rTitleOrDesc )
144cdf0e10cSrcweir     : SvXMLImportContext( rImport, nPrfx, rLName )
145cdf0e10cSrcweir     , mrTitleOrDesc( rTitleOrDesc )
146cdf0e10cSrcweir {
147cdf0e10cSrcweir }
148cdf0e10cSrcweir 
149cdf0e10cSrcweir XMLTextFrameTitleOrDescContext_Impl::~XMLTextFrameTitleOrDescContext_Impl()
150cdf0e10cSrcweir {
151cdf0e10cSrcweir }
152cdf0e10cSrcweir 
153cdf0e10cSrcweir void XMLTextFrameTitleOrDescContext_Impl::Characters( const OUString& rText )
154cdf0e10cSrcweir {
155cdf0e10cSrcweir     mrTitleOrDesc += rText;
156cdf0e10cSrcweir }
157cdf0e10cSrcweir // <--
158cdf0e10cSrcweir 
159cdf0e10cSrcweir // ------------------------------------------------------------------------
160cdf0e10cSrcweir 
161cdf0e10cSrcweir class XMLTextFrameParam_Impl : public SvXMLImportContext
162cdf0e10cSrcweir {
163cdf0e10cSrcweir public:
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 	TYPEINFO();
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 	XMLTextFrameParam_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
168cdf0e10cSrcweir 								  const ::rtl::OUString& rLName,
169cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference<
170cdf0e10cSrcweir 				::com::sun::star::xml::sax::XAttributeList > & xAttrList,
171cdf0e10cSrcweir 			sal_uInt16 nType,
172cdf0e10cSrcweir             ParamMap &rParamMap);
173cdf0e10cSrcweir 	virtual ~XMLTextFrameParam_Impl();
174cdf0e10cSrcweir };
175cdf0e10cSrcweir 
176cdf0e10cSrcweir TYPEINIT1( XMLTextFrameParam_Impl, SvXMLImportContext );
177cdf0e10cSrcweir 
178cdf0e10cSrcweir XMLTextFrameParam_Impl::~XMLTextFrameParam_Impl()
179cdf0e10cSrcweir {
180cdf0e10cSrcweir }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir XMLTextFrameParam_Impl::XMLTextFrameParam_Impl(
183cdf0e10cSrcweir 		SvXMLImport& rImport, sal_uInt16 nPrfx,
184cdf0e10cSrcweir 	  	const ::rtl::OUString& rLName,
185cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference<
186cdf0e10cSrcweir 				::com::sun::star::xml::sax::XAttributeList > & xAttrList,
187cdf0e10cSrcweir 		sal_uInt16 /*nType*/,
188cdf0e10cSrcweir         ParamMap &rParamMap):
189cdf0e10cSrcweir 	SvXMLImportContext( rImport, nPrfx, rLName )
190cdf0e10cSrcweir {
191cdf0e10cSrcweir 	OUString sName, sValue;
192cdf0e10cSrcweir     sal_Bool bFoundValue = sal_False; // to allow empty values
193cdf0e10cSrcweir 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
194cdf0e10cSrcweir 	for( sal_Int16 i=0; i < nAttrCount; i++ )
195cdf0e10cSrcweir 	{
196cdf0e10cSrcweir 		const OUString& rAttrName = xAttrList->getNameByIndex( i );
197cdf0e10cSrcweir 		const OUString& rValue = xAttrList->getValueByIndex( i );
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 		OUString aLocalName;
200cdf0e10cSrcweir 		sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
201cdf0e10cSrcweir 		if ( XML_NAMESPACE_DRAW == nPrefix )
202cdf0e10cSrcweir 		{
203cdf0e10cSrcweir 		   	if( IsXMLToken(aLocalName, XML_VALUE) )
204cdf0e10cSrcweir 			{
205cdf0e10cSrcweir 				sValue = rValue;
206cdf0e10cSrcweir 				bFoundValue=sal_True;
207cdf0e10cSrcweir 			}
208cdf0e10cSrcweir 			else if( IsXMLToken(aLocalName, XML_NAME) )
209cdf0e10cSrcweir 			{
210cdf0e10cSrcweir 				sName = rValue;
211cdf0e10cSrcweir 			}
212cdf0e10cSrcweir 		}
213cdf0e10cSrcweir 	}
214cdf0e10cSrcweir 	if (sName.getLength() && bFoundValue )
215cdf0e10cSrcweir         rParamMap[sName] = sValue;
216cdf0e10cSrcweir }
217cdf0e10cSrcweir class XMLTextFrameContourContext_Impl : public SvXMLImportContext
218cdf0e10cSrcweir {
219cdf0e10cSrcweir 	Reference < XPropertySet > xPropSet;
220cdf0e10cSrcweir 
221cdf0e10cSrcweir public:
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 	TYPEINFO();
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 	XMLTextFrameContourContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
226cdf0e10cSrcweir 								  const ::rtl::OUString& rLName,
227cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference<
228cdf0e10cSrcweir 				::com::sun::star::xml::sax::XAttributeList > & xAttrList,
229cdf0e10cSrcweir 			const Reference < XPropertySet >& rPropSet,
230cdf0e10cSrcweir 			sal_Bool bPath );
231cdf0e10cSrcweir 	virtual ~XMLTextFrameContourContext_Impl();
232cdf0e10cSrcweir };
233cdf0e10cSrcweir 
234cdf0e10cSrcweir TYPEINIT1( XMLTextFrameContourContext_Impl, SvXMLImportContext );
235cdf0e10cSrcweir 
236cdf0e10cSrcweir XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl(
237cdf0e10cSrcweir 		SvXMLImport& rImport,
238cdf0e10cSrcweir 		sal_uInt16 nPrfx, const OUString& rLName,
239cdf0e10cSrcweir 		const Reference< XAttributeList > & xAttrList,
240cdf0e10cSrcweir 		const Reference < XPropertySet >& rPropSet,
241cdf0e10cSrcweir 	    sal_Bool bPath ) :
242cdf0e10cSrcweir 	SvXMLImportContext( rImport, nPrfx, rLName ),
243cdf0e10cSrcweir 	xPropSet( rPropSet )
244cdf0e10cSrcweir {
245cdf0e10cSrcweir 	OUString sD, sPoints, sViewBox;
246cdf0e10cSrcweir 	sal_Bool bPixelWidth = sal_False, bPixelHeight = sal_False;
247cdf0e10cSrcweir 	sal_Bool bAuto = sal_False;
248cdf0e10cSrcweir 	sal_Int32 nWidth = 0;
249cdf0e10cSrcweir 	sal_Int32 nHeight = 0;
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 	const SvXMLTokenMap& rTokenMap =
252cdf0e10cSrcweir 		GetImport().GetTextImport()->GetTextContourAttrTokenMap();
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
255cdf0e10cSrcweir 	for( sal_Int16 i=0; i < nAttrCount; i++ )
256cdf0e10cSrcweir 	{
257cdf0e10cSrcweir 		const OUString& rAttrName = xAttrList->getNameByIndex( i );
258cdf0e10cSrcweir 		const OUString& rValue = xAttrList->getValueByIndex( i );
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 		OUString aLocalName;
261cdf0e10cSrcweir 		sal_uInt16 nPrefix =
262cdf0e10cSrcweir 			GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
263cdf0e10cSrcweir 															&aLocalName );
264cdf0e10cSrcweir 		switch( rTokenMap.Get( nPrefix, aLocalName ) )
265cdf0e10cSrcweir 		{
266cdf0e10cSrcweir 		case XML_TOK_TEXT_CONTOUR_VIEWBOX:
267cdf0e10cSrcweir 			sViewBox = rValue;
268cdf0e10cSrcweir 			break;
269cdf0e10cSrcweir 		case XML_TOK_TEXT_CONTOUR_D:
270cdf0e10cSrcweir 			if( bPath )
271cdf0e10cSrcweir 				sD = rValue;
272cdf0e10cSrcweir 			break;
273cdf0e10cSrcweir 		case XML_TOK_TEXT_CONTOUR_POINTS:
274cdf0e10cSrcweir 			if( !bPath )
275cdf0e10cSrcweir 				sPoints = rValue;
276cdf0e10cSrcweir 			break;
277cdf0e10cSrcweir 		case XML_TOK_TEXT_CONTOUR_WIDTH:
278cdf0e10cSrcweir 			if( GetImport().GetMM100UnitConverter().convertMeasurePx( nWidth,
279cdf0e10cSrcweir 																	  rValue) )
280cdf0e10cSrcweir 				bPixelWidth = sal_True;
281cdf0e10cSrcweir 			else
282cdf0e10cSrcweir 				GetImport().GetMM100UnitConverter().convertMeasure( nWidth,
283cdf0e10cSrcweir 																rValue);
284cdf0e10cSrcweir 			break;
285cdf0e10cSrcweir 		case XML_TOK_TEXT_CONTOUR_HEIGHT:
286cdf0e10cSrcweir 			if( GetImport().GetMM100UnitConverter().convertMeasurePx( nHeight,
287cdf0e10cSrcweir 																rValue) )
288cdf0e10cSrcweir 				bPixelHeight = sal_True;
289cdf0e10cSrcweir 			else
290cdf0e10cSrcweir 				GetImport().GetMM100UnitConverter().convertMeasure( nHeight,
291cdf0e10cSrcweir 																	rValue);
292cdf0e10cSrcweir 			break;
293cdf0e10cSrcweir 		case XML_TOK_TEXT_CONTOUR_AUTO:
294cdf0e10cSrcweir 			bAuto = IsXMLToken(rValue, XML_TRUE);
295cdf0e10cSrcweir 			break;
296cdf0e10cSrcweir 		}
297cdf0e10cSrcweir 	}
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 	OUString sContourPolyPolygon(
300cdf0e10cSrcweir 			RTL_CONSTASCII_USTRINGPARAM("ContourPolyPolygon") );
301cdf0e10cSrcweir 	Reference < XPropertySetInfo > xPropSetInfo =
302cdf0e10cSrcweir 		rPropSet->getPropertySetInfo();
303cdf0e10cSrcweir 	if( xPropSetInfo->hasPropertyByName(
304cdf0e10cSrcweir 													sContourPolyPolygon ) &&
305cdf0e10cSrcweir 		nWidth > 0 && nHeight > 0 && bPixelWidth == bPixelHeight &&
306cdf0e10cSrcweir 		(bPath ? sD : sPoints).getLength() )
307cdf0e10cSrcweir 	{
308cdf0e10cSrcweir 		awt::Point aPoint( 0,  0 );
309cdf0e10cSrcweir 		awt::Size aSize( nWidth, nHeight );
310cdf0e10cSrcweir 		SdXMLImExViewBox aViewBox( sViewBox,
311cdf0e10cSrcweir 								   GetImport().GetMM100UnitConverter());
312cdf0e10cSrcweir 		Any aAny;
313cdf0e10cSrcweir 		if( bPath )
314cdf0e10cSrcweir 		{
315cdf0e10cSrcweir 			SdXMLImExSvgDElement aPoints( sD, aViewBox, aPoint, aSize,
316cdf0e10cSrcweir 										  GetImport().GetMM100UnitConverter() );
317cdf0e10cSrcweir 			aAny <<= aPoints.GetPointSequenceSequence();
318cdf0e10cSrcweir 		}
319cdf0e10cSrcweir 		else
320cdf0e10cSrcweir 		{
321cdf0e10cSrcweir 			SdXMLImExPointsElement aPoints( sPoints, aViewBox, aPoint, aSize,
322cdf0e10cSrcweir 										GetImport().GetMM100UnitConverter() );
323cdf0e10cSrcweir 			aAny <<= aPoints.GetPointSequenceSequence();
324cdf0e10cSrcweir 		}
325cdf0e10cSrcweir 
326cdf0e10cSrcweir 		OUString sIsPixelContour(
327cdf0e10cSrcweir 				RTL_CONSTASCII_USTRINGPARAM("IsPixelContour") );
328cdf0e10cSrcweir 		xPropSet->setPropertyValue( sContourPolyPolygon, aAny );
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 		if( xPropSetInfo->hasPropertyByName( sIsPixelContour ) )
331cdf0e10cSrcweir 		{
332cdf0e10cSrcweir 			aAny.setValue( &bPixelWidth, ::getBooleanCppuType() );
333cdf0e10cSrcweir 			xPropSet->setPropertyValue( sIsPixelContour, aAny );
334cdf0e10cSrcweir 		}
335cdf0e10cSrcweir 
336cdf0e10cSrcweir 		OUString sIsAutomaticContour(
337cdf0e10cSrcweir 				RTL_CONSTASCII_USTRINGPARAM("IsAutomaticContour") );
338cdf0e10cSrcweir 		if( xPropSetInfo->hasPropertyByName( sIsAutomaticContour ) )
339cdf0e10cSrcweir 		{
340cdf0e10cSrcweir 			aAny.setValue( &bAuto, ::getBooleanCppuType() );
341cdf0e10cSrcweir 			xPropSet->setPropertyValue( sIsAutomaticContour, aAny );
342cdf0e10cSrcweir 		}
343cdf0e10cSrcweir 	}
344cdf0e10cSrcweir }
345cdf0e10cSrcweir 
346cdf0e10cSrcweir XMLTextFrameContourContext_Impl::~XMLTextFrameContourContext_Impl()
347cdf0e10cSrcweir {
348cdf0e10cSrcweir }
349cdf0e10cSrcweir 
350cdf0e10cSrcweir // ------------------------------------------------------------------------
351cdf0e10cSrcweir 
352cdf0e10cSrcweir class XMLTextFrameContext_Impl : public SvXMLImportContext
353cdf0e10cSrcweir {
354cdf0e10cSrcweir 	::com::sun::star::uno::Reference <
355cdf0e10cSrcweir 		::com::sun::star::text::XTextCursor > xOldTextCursor;
356cdf0e10cSrcweir 	::com::sun::star::uno::Reference <
357cdf0e10cSrcweir 		::com::sun::star::beans::XPropertySet > xPropSet;
358cdf0e10cSrcweir 	::com::sun::star::uno::Reference <
359cdf0e10cSrcweir 		::com::sun::star::io::XOutputStream > xBase64Stream;
360cdf0e10cSrcweir 
361cdf0e10cSrcweir     /// old list item and block (#89891#)
362cdf0e10cSrcweir     bool mbListContextPushed;
363cdf0e10cSrcweir 
364cdf0e10cSrcweir 	const ::rtl::OUString sWidth;
365cdf0e10cSrcweir 	const ::rtl::OUString sWidthType;
366cdf0e10cSrcweir 	const ::rtl::OUString sRelativeWidth;
367cdf0e10cSrcweir 	const ::rtl::OUString sHeight;
368cdf0e10cSrcweir 	const ::rtl::OUString sRelativeHeight;
369cdf0e10cSrcweir 	const ::rtl::OUString sSizeType;
370cdf0e10cSrcweir 	const ::rtl::OUString sIsSyncWidthToHeight;
371cdf0e10cSrcweir 	const ::rtl::OUString sIsSyncHeightToWidth;
372cdf0e10cSrcweir 	const ::rtl::OUString sHoriOrient;
373cdf0e10cSrcweir 	const ::rtl::OUString sHoriOrientPosition;
374cdf0e10cSrcweir 	const ::rtl::OUString sVertOrient;
375cdf0e10cSrcweir 	const ::rtl::OUString sVertOrientPosition;
376cdf0e10cSrcweir 	const ::rtl::OUString sChainNextName;
377cdf0e10cSrcweir 	const ::rtl::OUString sAnchorType;
378cdf0e10cSrcweir 	const ::rtl::OUString sAnchorPageNo;
379cdf0e10cSrcweir 	const ::rtl::OUString sGraphicURL;
380cdf0e10cSrcweir 	const ::rtl::OUString sGraphicFilter;
381cdf0e10cSrcweir     // --> OD 2009-07-22 #i73249#
382cdf0e10cSrcweir //    const ::rtl::OUString sAlternativeText;
383cdf0e10cSrcweir     const ::rtl::OUString sTitle;
384cdf0e10cSrcweir     const ::rtl::OUString sDescription;
385cdf0e10cSrcweir     // <--
386cdf0e10cSrcweir 	const ::rtl::OUString sFrameStyleName;
387cdf0e10cSrcweir 	const ::rtl::OUString sGraphicRotation;
388cdf0e10cSrcweir 	const ::rtl::OUString sTextBoxServiceName;
389cdf0e10cSrcweir 	const ::rtl::OUString sGraphicServiceName;
390cdf0e10cSrcweir 
391cdf0e10cSrcweir 	::rtl::OUString	sName;
392cdf0e10cSrcweir 	::rtl::OUString	sStyleName;
393cdf0e10cSrcweir 	::rtl::OUString	sNextName;
394cdf0e10cSrcweir 	::rtl::OUString	sHRef;
395cdf0e10cSrcweir 	::rtl::OUString	sFilterName;
396cdf0e10cSrcweir 	::rtl::OUString	sCode;
397cdf0e10cSrcweir 	::rtl::OUString	sObject;
398cdf0e10cSrcweir 	::rtl::OUString	sArchive;
399cdf0e10cSrcweir 	::rtl::OUString	sMimeType;
400cdf0e10cSrcweir 	::rtl::OUString sFrameName;
401cdf0e10cSrcweir 	::rtl::OUString sAppletName;
402cdf0e10cSrcweir 	::rtl::OUString	sFilterService;
403cdf0e10cSrcweir 	::rtl::OUString sBase64CharsLeft;
404cdf0e10cSrcweir 	::rtl::OUString	sTblName;
405cdf0e10cSrcweir 
406cdf0e10cSrcweir     ParamMap aParamMap;
407cdf0e10cSrcweir 
408cdf0e10cSrcweir 	sal_Int32	nX;
409cdf0e10cSrcweir 	sal_Int32	nY;
410cdf0e10cSrcweir 	sal_Int32	nWidth;
411cdf0e10cSrcweir 	sal_Int32	nHeight;
412cdf0e10cSrcweir 	sal_Int32	nZIndex;
413cdf0e10cSrcweir 	sal_Int16	nPage;
414cdf0e10cSrcweir 	sal_Int16	nRotation;
415cdf0e10cSrcweir 	sal_Int16	nRelWidth;
416cdf0e10cSrcweir 	sal_Int16	nRelHeight;
417cdf0e10cSrcweir 
418cdf0e10cSrcweir 	sal_uInt16 nType;
419cdf0e10cSrcweir 	::com::sun::star::text::TextContentAnchorType 	eAnchorType;
420cdf0e10cSrcweir 
421cdf0e10cSrcweir 	sal_Bool	bMayScript : 1;
422cdf0e10cSrcweir 	sal_Bool	bMinWidth : 1;
423cdf0e10cSrcweir 	sal_Bool	bMinHeight : 1;
424cdf0e10cSrcweir 	sal_Bool	bSyncWidth : 1;
425cdf0e10cSrcweir 	sal_Bool	bSyncHeight : 1;
426cdf0e10cSrcweir 	sal_Bool	bCreateFailed : 1;
427cdf0e10cSrcweir 	sal_Bool	bOwnBase64Stream : 1;
428cdf0e10cSrcweir 
429cdf0e10cSrcweir 	void Create( sal_Bool bHRefOrBase64 );
430cdf0e10cSrcweir 
431cdf0e10cSrcweir public:
432cdf0e10cSrcweir 
433cdf0e10cSrcweir 	TYPEINFO();
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 	sal_Bool CreateIfNotThere();
436ddde725dSArmin Le Grand 	const OUString& GetHRef() const { return sHRef; }
437cdf0e10cSrcweir 
438cdf0e10cSrcweir 	XMLTextFrameContext_Impl( SvXMLImport& rImport,
439cdf0e10cSrcweir 			sal_uInt16 nPrfx,
440cdf0e10cSrcweir 			const ::rtl::OUString& rLName,
441cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference<
442cdf0e10cSrcweir 				::com::sun::star::xml::sax::XAttributeList > & rAttrList,
443cdf0e10cSrcweir 			::com::sun::star::text::TextContentAnchorType eAnchorType,
444cdf0e10cSrcweir 			sal_uInt16 nType,
445cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference<
446cdf0e10cSrcweir 				::com::sun::star::xml::sax::XAttributeList > & rFrameAttrList );
447cdf0e10cSrcweir 	virtual ~XMLTextFrameContext_Impl();
448cdf0e10cSrcweir 
449cdf0e10cSrcweir 	virtual void EndElement();
450cdf0e10cSrcweir 
451cdf0e10cSrcweir 	virtual void Characters( const ::rtl::OUString& rChars );
452cdf0e10cSrcweir 
453cdf0e10cSrcweir 	SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
454cdf0e10cSrcweir 				const ::rtl::OUString& rLocalName,
455cdf0e10cSrcweir 			 	const ::com::sun::star::uno::Reference<
456cdf0e10cSrcweir 					::com::sun::star::xml::sax::XAttributeList > & xAttrList );
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 	void SetHyperlink( const ::rtl::OUString& rHRef,
459cdf0e10cSrcweir 					   const ::rtl::OUString& rName,
460cdf0e10cSrcweir 					   const ::rtl::OUString& rTargetFrameName,
461cdf0e10cSrcweir 					   sal_Bool bMap );
462cdf0e10cSrcweir     // --> OD 2009-07-22 #i73249#
463cdf0e10cSrcweir     void SetTitle( const ::rtl::OUString& rTitle );
464cdf0e10cSrcweir     // <--
465cdf0e10cSrcweir     void SetDesc( const ::rtl::OUString& rDesc );
466cdf0e10cSrcweir 
467cdf0e10cSrcweir 	::com::sun::star::text::TextContentAnchorType GetAnchorType() const { return eAnchorType; }
468cdf0e10cSrcweir 
469cdf0e10cSrcweir 	const ::com::sun::star::uno::Reference <
470ddde725dSArmin Le Grand 		::com::sun::star::beans::XPropertySet >& GetPropSet() const { return xPropSet; }
471cdf0e10cSrcweir };
472cdf0e10cSrcweir 
473cdf0e10cSrcweir TYPEINIT1( XMLTextFrameContext_Impl, SvXMLImportContext );
474cdf0e10cSrcweir 
475cdf0e10cSrcweir void XMLTextFrameContext_Impl::Create( sal_Bool /*bHRefOrBase64*/ )
476cdf0e10cSrcweir {
477cdf0e10cSrcweir 	UniReference < XMLTextImportHelper > xTextImportHelper =
478cdf0e10cSrcweir 		GetImport().GetTextImport();
479cdf0e10cSrcweir 
480cdf0e10cSrcweir     switch ( nType)
481cdf0e10cSrcweir     {
482cdf0e10cSrcweir         case XML_TEXT_FRAME_OBJECT:
483cdf0e10cSrcweir         case XML_TEXT_FRAME_OBJECT_OLE:
484cdf0e10cSrcweir 			if( xBase64Stream.is() )
485cdf0e10cSrcweir 			{
486cdf0e10cSrcweir 				OUString sURL( GetImport().ResolveEmbeddedObjectURLFromBase64() );
487cdf0e10cSrcweir 				if( sURL.getLength() )
488cdf0e10cSrcweir 					xPropSet = GetImport().GetTextImport()
489cdf0e10cSrcweir 							->createAndInsertOLEObject( GetImport(), sURL,
490cdf0e10cSrcweir 														sStyleName,
491cdf0e10cSrcweir 														sTblName,
492cdf0e10cSrcweir 														nWidth, nHeight );
493cdf0e10cSrcweir 			}
494cdf0e10cSrcweir 			else if( sHRef.getLength() )
495cdf0e10cSrcweir 			{
496cdf0e10cSrcweir 				OUString sURL( GetImport().ResolveEmbeddedObjectURL( sHRef,
497cdf0e10cSrcweir 																OUString() ) );
498cdf0e10cSrcweir 
499cdf0e10cSrcweir 				if( GetImport().IsPackageURL( sHRef ) )
500cdf0e10cSrcweir 				{
501cdf0e10cSrcweir 					xPropSet = GetImport().GetTextImport()
502cdf0e10cSrcweir 							->createAndInsertOLEObject( GetImport(), sURL,
503cdf0e10cSrcweir 														sStyleName,
504cdf0e10cSrcweir 														sTblName,
505cdf0e10cSrcweir 														nWidth, nHeight );
506cdf0e10cSrcweir 				}
507cdf0e10cSrcweir 				else
508cdf0e10cSrcweir 				{
509cdf0e10cSrcweir 					// it should be an own OOo link that has no storage persistance
510cdf0e10cSrcweir 					xPropSet = GetImport().GetTextImport()
511cdf0e10cSrcweir 							->createAndInsertOOoLink( GetImport(),
512cdf0e10cSrcweir 														sURL,
513cdf0e10cSrcweir 														sStyleName,
514cdf0e10cSrcweir 														sTblName,
515cdf0e10cSrcweir 														nWidth, nHeight );
516cdf0e10cSrcweir 				}
517cdf0e10cSrcweir 			}
518cdf0e10cSrcweir 			else
519cdf0e10cSrcweir 			{
520cdf0e10cSrcweir 				OUString sURL( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.ServiceName:") );
521cdf0e10cSrcweir 				sURL += sFilterService;
522cdf0e10cSrcweir 				xPropSet = GetImport().GetTextImport()
523cdf0e10cSrcweir 							->createAndInsertOLEObject( GetImport(), sURL,
524cdf0e10cSrcweir 														sStyleName,
525cdf0e10cSrcweir 														sTblName,
526cdf0e10cSrcweir 														nWidth, nHeight );
527cdf0e10cSrcweir 
528cdf0e10cSrcweir 			}
529cdf0e10cSrcweir 			break;
530cdf0e10cSrcweir         case XML_TEXT_FRAME_APPLET:
531cdf0e10cSrcweir         {
532cdf0e10cSrcweir             xPropSet = GetImport().GetTextImport()
533cdf0e10cSrcweir 							->createAndInsertApplet( sAppletName, sCode,
534cdf0e10cSrcweir 													 bMayScript, sHRef,
535cdf0e10cSrcweir 													 nWidth, nHeight);
536cdf0e10cSrcweir             break;
537cdf0e10cSrcweir         }
538cdf0e10cSrcweir         case XML_TEXT_FRAME_PLUGIN:
539cdf0e10cSrcweir         {
540cdf0e10cSrcweir             if(sHRef.getLength())
541cdf0e10cSrcweir                 GetImport().GetAbsoluteReference(sHRef);
542cdf0e10cSrcweir             xPropSet = GetImport().GetTextImport()
543cdf0e10cSrcweir 							->createAndInsertPlugin( sMimeType, sHRef,
544cdf0e10cSrcweir 								   				 	 nWidth, nHeight);
545cdf0e10cSrcweir 
546cdf0e10cSrcweir             break;
547cdf0e10cSrcweir         }
548cdf0e10cSrcweir         case XML_TEXT_FRAME_FLOATING_FRAME:
549cdf0e10cSrcweir         {
550cdf0e10cSrcweir             xPropSet = GetImport().GetTextImport()
551cdf0e10cSrcweir 							->createAndInsertFloatingFrame( sFrameName, sHRef,
552cdf0e10cSrcweir 															sStyleName,
553cdf0e10cSrcweir 															nWidth, nHeight);
554cdf0e10cSrcweir             break;
555cdf0e10cSrcweir         }
556cdf0e10cSrcweir 	    default:
557cdf0e10cSrcweir         {
558cdf0e10cSrcweir             Reference<XMultiServiceFactory> xFactory( GetImport().GetModel(),
559cdf0e10cSrcweir                                                       UNO_QUERY );
560cdf0e10cSrcweir             if( xFactory.is() )
561cdf0e10cSrcweir             {
562cdf0e10cSrcweir                 OUString sServiceName;
563cdf0e10cSrcweir                 switch( nType )
564cdf0e10cSrcweir                 {
565cdf0e10cSrcweir                     case XML_TEXT_FRAME_TEXTBOX: sServiceName = sTextBoxServiceName; break;
566cdf0e10cSrcweir                     case XML_TEXT_FRAME_GRAPHIC: sServiceName = sGraphicServiceName; break;
567cdf0e10cSrcweir                 }
568cdf0e10cSrcweir                 Reference<XInterface> xIfc = xFactory->createInstance( sServiceName );
569cdf0e10cSrcweir                 DBG_ASSERT( xIfc.is(), "couldn't create frame" );
570cdf0e10cSrcweir                 if( xIfc.is() )
571cdf0e10cSrcweir                     xPropSet = Reference < XPropertySet >( xIfc, UNO_QUERY );
572cdf0e10cSrcweir             }
573cdf0e10cSrcweir         }
574cdf0e10cSrcweir     }
575cdf0e10cSrcweir 
576cdf0e10cSrcweir 	if( !xPropSet.is() )
577cdf0e10cSrcweir 	{
578cdf0e10cSrcweir 		bCreateFailed = sal_True;
579cdf0e10cSrcweir 		return;
580cdf0e10cSrcweir 	}
581cdf0e10cSrcweir 
582cdf0e10cSrcweir 	Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
583cdf0e10cSrcweir 
584cdf0e10cSrcweir 	// set name
585cdf0e10cSrcweir 	Reference < XNamed > xNamed( xPropSet, UNO_QUERY );
586cdf0e10cSrcweir 	if( xNamed.is() )
587cdf0e10cSrcweir 	{
588cdf0e10cSrcweir 		OUString sOrigName( xNamed->getName() );
589cdf0e10cSrcweir 		if( !sOrigName.getLength() ||
590cdf0e10cSrcweir 			(sName.getLength() && sOrigName != sName) )
591cdf0e10cSrcweir 		{
592cdf0e10cSrcweir 			OUString sOldName( sName );
593cdf0e10cSrcweir 			sal_Int32 i = 0;
594cdf0e10cSrcweir 			while( xTextImportHelper->HasFrameByName( sName ) )
595cdf0e10cSrcweir 			{
596cdf0e10cSrcweir 				sName = sOldName;
597cdf0e10cSrcweir 				sName += OUString::valueOf( ++i );
598cdf0e10cSrcweir 			}
599cdf0e10cSrcweir 			xNamed->setName( sName );
600cdf0e10cSrcweir 			if( sName != sOldName )
601cdf0e10cSrcweir 				xTextImportHelper->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_FRAME,
602cdf0e10cSrcweir 											 sOldName, sName );
603cdf0e10cSrcweir 		}
604cdf0e10cSrcweir 	}
605cdf0e10cSrcweir 
606cdf0e10cSrcweir 	// frame style
607cdf0e10cSrcweir 	XMLPropStyleContext *pStyle = 0;
608cdf0e10cSrcweir 	if( sStyleName.getLength() )
609cdf0e10cSrcweir 	{
610cdf0e10cSrcweir 		pStyle = xTextImportHelper->FindAutoFrameStyle( sStyleName );
611cdf0e10cSrcweir 		if( pStyle )
612cdf0e10cSrcweir             sStyleName = pStyle->GetParentName();
613cdf0e10cSrcweir 	}
614cdf0e10cSrcweir 
615cdf0e10cSrcweir 	Any aAny;
616cdf0e10cSrcweir 	if( sStyleName.getLength() )
617cdf0e10cSrcweir 	{
618cdf0e10cSrcweir 		OUString sDisplayStyleName( GetImport().GetStyleDisplayName(
619cdf0e10cSrcweir 							XML_STYLE_FAMILY_SD_GRAPHICS_ID, sStyleName ) );
620cdf0e10cSrcweir 		const Reference < XNameContainer > & rStyles =
621cdf0e10cSrcweir 			xTextImportHelper->GetFrameStyles();
622cdf0e10cSrcweir 		if( rStyles.is() &&
623cdf0e10cSrcweir 			rStyles->hasByName( sDisplayStyleName ) )
624cdf0e10cSrcweir 		{
625cdf0e10cSrcweir 			aAny <<= sDisplayStyleName;
626cdf0e10cSrcweir 			xPropSet->setPropertyValue( sFrameStyleName, aAny );
627cdf0e10cSrcweir 		}
628cdf0e10cSrcweir 	}
629cdf0e10cSrcweir 
630cdf0e10cSrcweir 	// anchor type (must be set before any other properties, because
631cdf0e10cSrcweir 	// otherwise some orientations cannot be set or will be changed
632cdf0e10cSrcweir 	// afterwards)
633cdf0e10cSrcweir 	aAny <<= eAnchorType;
634cdf0e10cSrcweir 	xPropSet->setPropertyValue( sAnchorType, aAny );
635cdf0e10cSrcweir 
636cdf0e10cSrcweir 	// hard properties
637cdf0e10cSrcweir 	if( pStyle )
638cdf0e10cSrcweir 		pStyle->FillPropertySet( xPropSet );
639cdf0e10cSrcweir 
640cdf0e10cSrcweir 
641cdf0e10cSrcweir 	// x and y
642cdf0e10cSrcweir 	sal_Int16 nHoriOrient =  HoriOrientation::NONE;
643cdf0e10cSrcweir 	aAny = xPropSet->getPropertyValue( sHoriOrient );
644cdf0e10cSrcweir 	aAny >>= nHoriOrient;
645cdf0e10cSrcweir 	if( HoriOrientation::NONE == nHoriOrient )
646cdf0e10cSrcweir 	{
647cdf0e10cSrcweir 		aAny <<= nX;
648cdf0e10cSrcweir 		xPropSet->setPropertyValue( sHoriOrientPosition, aAny );
649cdf0e10cSrcweir 	}
650cdf0e10cSrcweir 
651cdf0e10cSrcweir 	sal_Int16 nVertOrient =  VertOrientation::NONE;
652cdf0e10cSrcweir 	aAny = xPropSet->getPropertyValue( sVertOrient );
653cdf0e10cSrcweir 	aAny >>= nVertOrient;
654cdf0e10cSrcweir 	if( VertOrientation::NONE == nVertOrient )
655cdf0e10cSrcweir 	{
656cdf0e10cSrcweir 		aAny <<= nY;
657cdf0e10cSrcweir 		xPropSet->setPropertyValue( sVertOrientPosition, aAny );
658cdf0e10cSrcweir 	}
659cdf0e10cSrcweir 
660cdf0e10cSrcweir 	// width
661cdf0e10cSrcweir 	if( nWidth > 0 )
662cdf0e10cSrcweir 	{
663cdf0e10cSrcweir 		aAny <<= nWidth;
664cdf0e10cSrcweir 		xPropSet->setPropertyValue( sWidth, aAny );
665cdf0e10cSrcweir 	}
666cdf0e10cSrcweir 	if( nRelWidth > 0 || nWidth > 0 )
667cdf0e10cSrcweir 	{
668cdf0e10cSrcweir 		aAny <<= nRelWidth;
669cdf0e10cSrcweir 		xPropSet->setPropertyValue( sRelativeWidth, aAny );
670cdf0e10cSrcweir 	}
671cdf0e10cSrcweir 	if( bSyncWidth || nWidth > 0 )
672cdf0e10cSrcweir 	{
673cdf0e10cSrcweir 		sal_Bool bTmp = bSyncWidth;
674cdf0e10cSrcweir 		aAny.setValue( &bTmp, ::getBooleanCppuType() );
675cdf0e10cSrcweir 		xPropSet->setPropertyValue( sIsSyncWidthToHeight, aAny );
676cdf0e10cSrcweir 	}
677cdf0e10cSrcweir 	if( xPropSetInfo->hasPropertyByName( sWidthType ) &&
678cdf0e10cSrcweir 		(bMinWidth || nWidth > 0 || nRelWidth > 0 ) )
679cdf0e10cSrcweir 	{
680cdf0e10cSrcweir 		sal_Int16 nSizeType =
681cdf0e10cSrcweir 			(bMinWidth && XML_TEXT_FRAME_TEXTBOX == nType) ? SizeType::MIN
682cdf0e10cSrcweir                                                            : SizeType::FIX;
683cdf0e10cSrcweir 		aAny <<= nSizeType;
684cdf0e10cSrcweir 		xPropSet->setPropertyValue( sWidthType, aAny );
685cdf0e10cSrcweir 	}
686cdf0e10cSrcweir 
687cdf0e10cSrcweir 	if( nHeight > 0 )
688cdf0e10cSrcweir 	{
689cdf0e10cSrcweir 		aAny <<= nHeight;
690cdf0e10cSrcweir 		xPropSet->setPropertyValue( sHeight, aAny );
691cdf0e10cSrcweir 	}
692cdf0e10cSrcweir 	if( nRelHeight > 0 || nHeight > 0 )
693cdf0e10cSrcweir 	{
694cdf0e10cSrcweir 		aAny <<= nRelHeight;
695cdf0e10cSrcweir 		xPropSet->setPropertyValue( sRelativeHeight, aAny );
696cdf0e10cSrcweir 	}
697cdf0e10cSrcweir 	if( bSyncHeight || nHeight > 0 )
698cdf0e10cSrcweir 	{
699cdf0e10cSrcweir 		sal_Bool bTmp = bSyncHeight;
700cdf0e10cSrcweir 		aAny.setValue( &bTmp, ::getBooleanCppuType() );
701cdf0e10cSrcweir 		xPropSet->setPropertyValue( sIsSyncHeightToWidth, aAny );
702cdf0e10cSrcweir 	}
703cdf0e10cSrcweir 	if( xPropSetInfo->hasPropertyByName( sSizeType ) &&
704cdf0e10cSrcweir 		(bMinHeight || nHeight > 0 || nRelHeight > 0 ) )
705cdf0e10cSrcweir 	{
706cdf0e10cSrcweir 		sal_Int16 nSizeType =
707cdf0e10cSrcweir 			(bMinHeight && XML_TEXT_FRAME_TEXTBOX == nType) ? SizeType::MIN
708cdf0e10cSrcweir 															: SizeType::FIX;
709cdf0e10cSrcweir 		aAny <<= nSizeType;
710cdf0e10cSrcweir 		xPropSet->setPropertyValue( sSizeType, aAny );
711cdf0e10cSrcweir 	}
712cdf0e10cSrcweir 
713cdf0e10cSrcweir 	if( XML_TEXT_FRAME_GRAPHIC == nType )
714cdf0e10cSrcweir 	{
715cdf0e10cSrcweir 		// URL
716cdf0e10cSrcweir 		OSL_ENSURE( sHRef.getLength() > 0 || xBase64Stream.is(),
717cdf0e10cSrcweir 					"neither URL nor base64 image data given" );
718cdf0e10cSrcweir 		UniReference < XMLTextImportHelper > xTxtImport =
719cdf0e10cSrcweir 			GetImport().GetTextImport();
720cdf0e10cSrcweir 		if( sHRef.getLength() )
721cdf0e10cSrcweir 		{
722cdf0e10cSrcweir 			sal_Bool bForceLoad = xTxtImport->IsInsertMode() ||
723cdf0e10cSrcweir 								  xTxtImport->IsBlockMode() ||
724cdf0e10cSrcweir 								  xTxtImport->IsStylesOnlyMode() ||
725cdf0e10cSrcweir 								  xTxtImport->IsOrganizerMode();
726cdf0e10cSrcweir 			sHRef = GetImport().ResolveGraphicObjectURL( sHRef, !bForceLoad );
727cdf0e10cSrcweir 		}
728cdf0e10cSrcweir 		else if( xBase64Stream.is() )
729cdf0e10cSrcweir 		{
730cdf0e10cSrcweir 			sHRef = GetImport().ResolveGraphicObjectURLFromBase64( xBase64Stream );
731cdf0e10cSrcweir 			xBase64Stream = 0;
732cdf0e10cSrcweir 		}
733cdf0e10cSrcweir 		aAny <<= sHRef;
734cdf0e10cSrcweir 		xPropSet->setPropertyValue( sGraphicURL, aAny );
735cdf0e10cSrcweir 
736cdf0e10cSrcweir 		// filter name
737cdf0e10cSrcweir 		aAny <<=sFilterName;
738cdf0e10cSrcweir 		xPropSet->setPropertyValue( sGraphicFilter, aAny );
739cdf0e10cSrcweir 
740cdf0e10cSrcweir 		// rotation
741cdf0e10cSrcweir 		aAny <<= nRotation;
742cdf0e10cSrcweir 		xPropSet->setPropertyValue( sGraphicRotation, aAny );
743cdf0e10cSrcweir 	}
744cdf0e10cSrcweir 
745cdf0e10cSrcweir 	// page number (must be set after the frame is inserted, because it
746cdf0e10cSrcweir 	// will be overwritten then inserting the frame.
747cdf0e10cSrcweir 	if( TextContentAnchorType_AT_PAGE == eAnchorType && nPage > 0 )
748cdf0e10cSrcweir 	{
749cdf0e10cSrcweir 		aAny <<= nPage;
750cdf0e10cSrcweir 		xPropSet->setPropertyValue( sAnchorPageNo, aAny );
751cdf0e10cSrcweir 	}
752cdf0e10cSrcweir 
753cdf0e10cSrcweir 	if( XML_TEXT_FRAME_OBJECT != nType  &&
754cdf0e10cSrcweir 		XML_TEXT_FRAME_OBJECT_OLE != nType  &&
755cdf0e10cSrcweir 		XML_TEXT_FRAME_APPLET != nType &&
756cdf0e10cSrcweir 		XML_TEXT_FRAME_PLUGIN!= nType &&
757cdf0e10cSrcweir 		XML_TEXT_FRAME_FLOATING_FRAME != nType)
758cdf0e10cSrcweir 	{
759cdf0e10cSrcweir 		Reference < XTextContent > xTxtCntnt( xPropSet, UNO_QUERY );
760cdf0e10cSrcweir 		xTextImportHelper->InsertTextContent( xTxtCntnt );
761cdf0e10cSrcweir 	}
762cdf0e10cSrcweir 
763cdf0e10cSrcweir 	// #107848#
764cdf0e10cSrcweir 	// Make adding the shepe to Z-Ordering dependent from if we are
765cdf0e10cSrcweir 	// inside a inside_deleted_section (redlining). That is necessary
766cdf0e10cSrcweir 	// since the shape will be removed again later. It would lead to
767cdf0e10cSrcweir 	// errors if it would stay inside the Z-Ordering. Thus, the
768cdf0e10cSrcweir 	// easiest way to solve that conflict is to not add it here.
769cdf0e10cSrcweir 	if(!GetImport().HasTextImport()
770cdf0e10cSrcweir 		|| !GetImport().GetTextImport()->IsInsideDeleteContext())
771cdf0e10cSrcweir 	{
772ddde725dSArmin Le Grand     	Reference < XShape > xShape( xPropSet, UNO_QUERY );
773ddde725dSArmin Le Grand 
774ddde725dSArmin Le Grand         GetImport().GetShapeImport()->shapeWithZIndexAdded( xShape, nZIndex );
775cdf0e10cSrcweir 	}
776cdf0e10cSrcweir 
777cdf0e10cSrcweir 	if( XML_TEXT_FRAME_TEXTBOX == nType )
778cdf0e10cSrcweir 	{
779cdf0e10cSrcweir 		xTextImportHelper->ConnectFrameChains( sName, sNextName, xPropSet );
780cdf0e10cSrcweir 		Reference < XTextFrame > xTxtFrame( xPropSet, UNO_QUERY );
781cdf0e10cSrcweir 		Reference < XText > xTxt = xTxtFrame->getText();
782cdf0e10cSrcweir 		xOldTextCursor = xTextImportHelper->GetCursor();
783cdf0e10cSrcweir 		xTextImportHelper->SetCursor( xTxt->createTextCursor() );
784cdf0e10cSrcweir 
785cdf0e10cSrcweir         // remember old list item and block (#89892#) and reset them
786cdf0e10cSrcweir         // for the text frame
787cdf0e10cSrcweir         xTextImportHelper->PushListContext();
788cdf0e10cSrcweir         mbListContextPushed = true;
789cdf0e10cSrcweir 	}
790cdf0e10cSrcweir }
791cdf0e10cSrcweir 
792cdf0e10cSrcweir sal_Bool XMLTextFrameContext_Impl::CreateIfNotThere()
793cdf0e10cSrcweir {
794cdf0e10cSrcweir 	if( !xPropSet.is() &&
795cdf0e10cSrcweir 		( XML_TEXT_FRAME_OBJECT_OLE == nType ||
796cdf0e10cSrcweir 		  XML_TEXT_FRAME_GRAPHIC == nType ) &&
797cdf0e10cSrcweir 		xBase64Stream.is() && !bCreateFailed )
798cdf0e10cSrcweir 	{
799cdf0e10cSrcweir 		if( bOwnBase64Stream )
800cdf0e10cSrcweir 			xBase64Stream->closeOutput();
801cdf0e10cSrcweir 		Create( sal_True );
802cdf0e10cSrcweir 	}
803cdf0e10cSrcweir 
804cdf0e10cSrcweir 	return xPropSet.is();
805cdf0e10cSrcweir }
806cdf0e10cSrcweir 
807cdf0e10cSrcweir XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
808cdf0e10cSrcweir 		SvXMLImport& rImport,
809cdf0e10cSrcweir 		sal_uInt16 nPrfx, const OUString& rLName,
810cdf0e10cSrcweir 		const Reference< XAttributeList > & rAttrList,
811cdf0e10cSrcweir 		TextContentAnchorType eATyp,
812cdf0e10cSrcweir 		sal_uInt16 nNewType,
813cdf0e10cSrcweir 		const Reference< XAttributeList > & rFrameAttrList )
814cdf0e10cSrcweir :	SvXMLImportContext( rImport, nPrfx, rLName )
815cdf0e10cSrcweir ,   mbListContextPushed( false )
816cdf0e10cSrcweir ,	sWidth(RTL_CONSTASCII_USTRINGPARAM("Width"))
817cdf0e10cSrcweir ,	sWidthType(RTL_CONSTASCII_USTRINGPARAM("WidthType"))
818cdf0e10cSrcweir ,	sRelativeWidth(RTL_CONSTASCII_USTRINGPARAM("RelativeWidth"))
819cdf0e10cSrcweir ,	sHeight(RTL_CONSTASCII_USTRINGPARAM("Height"))
820cdf0e10cSrcweir ,	sRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("RelativeHeight"))
821cdf0e10cSrcweir ,	sSizeType(RTL_CONSTASCII_USTRINGPARAM("SizeType"))
822cdf0e10cSrcweir ,	sIsSyncWidthToHeight(RTL_CONSTASCII_USTRINGPARAM("IsSyncWidthToHeight"))
823cdf0e10cSrcweir ,	sIsSyncHeightToWidth(RTL_CONSTASCII_USTRINGPARAM("IsSyncHeightToWidth"))
824cdf0e10cSrcweir ,	sHoriOrient(RTL_CONSTASCII_USTRINGPARAM("HoriOrient"))
825cdf0e10cSrcweir ,	sHoriOrientPosition(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition"))
826cdf0e10cSrcweir ,	sVertOrient(RTL_CONSTASCII_USTRINGPARAM("VertOrient"))
827cdf0e10cSrcweir ,	sVertOrientPosition(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition"))
828cdf0e10cSrcweir ,	sChainNextName(RTL_CONSTASCII_USTRINGPARAM("ChainNextName"))
829cdf0e10cSrcweir ,	sAnchorType(RTL_CONSTASCII_USTRINGPARAM("AnchorType"))
830cdf0e10cSrcweir ,	sAnchorPageNo(RTL_CONSTASCII_USTRINGPARAM("AnchorPageNo"))
831cdf0e10cSrcweir ,	sGraphicURL(RTL_CONSTASCII_USTRINGPARAM("GraphicURL"))
832cdf0e10cSrcweir ,	sGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("GraphicFilter"))
833cdf0e10cSrcweir // --> OD 2009-07-22 #i73249#
834cdf0e10cSrcweir //,   sAlternativeText(RTL_CONSTASCII_USTRINGPARAM("AlternativeText"))
835cdf0e10cSrcweir ,   sTitle(RTL_CONSTASCII_USTRINGPARAM("Title"))
836cdf0e10cSrcweir ,   sDescription(RTL_CONSTASCII_USTRINGPARAM("Description"))
837cdf0e10cSrcweir // <--
838cdf0e10cSrcweir ,	sFrameStyleName(RTL_CONSTASCII_USTRINGPARAM("FrameStyleName"))
839cdf0e10cSrcweir ,	sGraphicRotation(RTL_CONSTASCII_USTRINGPARAM("GraphicRotation"))
840cdf0e10cSrcweir ,	sTextBoxServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame"))
841cdf0e10cSrcweir ,	sGraphicServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GraphicObject"))
842cdf0e10cSrcweir ,	nType( nNewType )
843cdf0e10cSrcweir ,	eAnchorType( eATyp )
844cdf0e10cSrcweir {
845cdf0e10cSrcweir 	nX = 0;
846cdf0e10cSrcweir 	nY = 0;
847cdf0e10cSrcweir 	nWidth = 0;
848cdf0e10cSrcweir 	nHeight = 0;
849cdf0e10cSrcweir 	nZIndex = -1;
850cdf0e10cSrcweir 	nPage = 0;
851cdf0e10cSrcweir 	nRotation = 0;
852cdf0e10cSrcweir 	nRelWidth = 0;
853cdf0e10cSrcweir 	nRelHeight = 0;
854cdf0e10cSrcweir 	bMayScript = sal_False;
855cdf0e10cSrcweir 
856cdf0e10cSrcweir 	bMinHeight = sal_False;
857cdf0e10cSrcweir 	bMinWidth = sal_False;
858cdf0e10cSrcweir 	bSyncWidth = sal_False;
859cdf0e10cSrcweir 	bSyncHeight = sal_False;
860cdf0e10cSrcweir 	bCreateFailed = sal_False;
861cdf0e10cSrcweir 	bOwnBase64Stream = sal_False;
862cdf0e10cSrcweir 
863cdf0e10cSrcweir 	UniReference < XMLTextImportHelper > xTxtImport =
864cdf0e10cSrcweir 		GetImport().GetTextImport();
865cdf0e10cSrcweir 	const SvXMLTokenMap& rTokenMap =
866cdf0e10cSrcweir 		xTxtImport->GetTextFrameAttrTokenMap();
867cdf0e10cSrcweir 
868cdf0e10cSrcweir 	sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0;
869cdf0e10cSrcweir 	sal_Int16 nTotalAttrCount = nAttrCount + (rFrameAttrList.is() ? rFrameAttrList->getLength() : 0);
870cdf0e10cSrcweir 	for( sal_Int16 i=0; i < nTotalAttrCount; i++ )
871cdf0e10cSrcweir 	{
872cdf0e10cSrcweir 		const OUString& rAttrName =
873cdf0e10cSrcweir 			i < nAttrCount ? rAttrList->getNameByIndex( i ) : rFrameAttrList->getNameByIndex( i-nAttrCount );
874cdf0e10cSrcweir 		const OUString& rValue =
875cdf0e10cSrcweir 			i < nAttrCount ? rAttrList->getValueByIndex( i ): rFrameAttrList->getValueByIndex( i-nAttrCount );
876cdf0e10cSrcweir 
877cdf0e10cSrcweir 		OUString aLocalName;
878cdf0e10cSrcweir 		sal_uInt16 nPrefix =
879cdf0e10cSrcweir 			GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
880cdf0e10cSrcweir 															&aLocalName );
881cdf0e10cSrcweir 		switch( rTokenMap.Get( nPrefix, aLocalName ) )
882cdf0e10cSrcweir 		{
883cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_STYLE_NAME:
884cdf0e10cSrcweir 			sStyleName = rValue;
885cdf0e10cSrcweir 			break;
886cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_NAME:
887cdf0e10cSrcweir 			sName = rValue;
888cdf0e10cSrcweir 			break;
889cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_FRAME_NAME:
890cdf0e10cSrcweir 			sFrameName = rValue;
891cdf0e10cSrcweir 			break;
892cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_APPLET_NAME:
893cdf0e10cSrcweir 			sAppletName = rValue;
894cdf0e10cSrcweir 			break;
895cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_ANCHOR_TYPE:
896cdf0e10cSrcweir 			if( TextContentAnchorType_AT_PARAGRAPH == eAnchorType ||
897cdf0e10cSrcweir 				TextContentAnchorType_AT_CHARACTER == eAnchorType ||
898cdf0e10cSrcweir 				TextContentAnchorType_AS_CHARACTER == eAnchorType )
899cdf0e10cSrcweir 			{
900cdf0e10cSrcweir 
901cdf0e10cSrcweir 				TextContentAnchorType eNew;
902cdf0e10cSrcweir 				if( XMLAnchorTypePropHdl::convert( rValue, eNew ) &&
903cdf0e10cSrcweir 					( TextContentAnchorType_AT_PARAGRAPH == eNew ||
904cdf0e10cSrcweir 					  TextContentAnchorType_AT_CHARACTER == eNew ||
905cdf0e10cSrcweir 					  TextContentAnchorType_AS_CHARACTER == eNew ||
906cdf0e10cSrcweir 					  TextContentAnchorType_AT_PAGE == eNew) )
907cdf0e10cSrcweir 					eAnchorType = eNew;
908cdf0e10cSrcweir 			}
909cdf0e10cSrcweir 			break;
910cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_ANCHOR_PAGE_NUMBER:
911cdf0e10cSrcweir 			{
912cdf0e10cSrcweir 				sal_Int32 nTmp;
913cdf0e10cSrcweir 			   	if( GetImport().GetMM100UnitConverter().
914cdf0e10cSrcweir 								convertNumber( nTmp, rValue, 1, SHRT_MAX ) )
915cdf0e10cSrcweir 					nPage = (sal_Int16)nTmp;
916cdf0e10cSrcweir 			}
917cdf0e10cSrcweir 			break;
918cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_X:
919cdf0e10cSrcweir 			GetImport().GetMM100UnitConverter().convertMeasure( nX, rValue );
920cdf0e10cSrcweir 			break;
921cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_Y:
922cdf0e10cSrcweir 			GetImport().GetMM100UnitConverter().convertMeasure( nY, rValue );
923cdf0e10cSrcweir 			break;
924cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_WIDTH:
925cdf0e10cSrcweir 			// relative widths are obsolete since SRC617. Remove them some day!
926cdf0e10cSrcweir 			if( rValue.indexOf( '%' ) != -1 )
927cdf0e10cSrcweir 			{
928cdf0e10cSrcweir 				sal_Int32 nTmp;
929cdf0e10cSrcweir 				GetImport().GetMM100UnitConverter().convertPercent( nTmp,
930cdf0e10cSrcweir 																	rValue );
931cdf0e10cSrcweir 				nRelWidth = (sal_Int16)nTmp;
932cdf0e10cSrcweir 			}
933cdf0e10cSrcweir 			else
934cdf0e10cSrcweir 			{
935cdf0e10cSrcweir 				GetImport().GetMM100UnitConverter().convertMeasure( nWidth,
936cdf0e10cSrcweir 																	rValue, 0 );
937cdf0e10cSrcweir 			}
938cdf0e10cSrcweir 			break;
939cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_REL_WIDTH:
940cdf0e10cSrcweir 			if( IsXMLToken(rValue, XML_SCALE) )
941cdf0e10cSrcweir 			{
942cdf0e10cSrcweir 				bSyncWidth = sal_True;
943cdf0e10cSrcweir 			}
944cdf0e10cSrcweir 			else
945cdf0e10cSrcweir 			{
946cdf0e10cSrcweir 				sal_Int32 nTmp;
947cdf0e10cSrcweir 				if( GetImport().GetMM100UnitConverter().
948cdf0e10cSrcweir 						convertPercent( nTmp, rValue ) )
949cdf0e10cSrcweir 					nRelWidth = (sal_Int16)nTmp;
950cdf0e10cSrcweir 			}
951cdf0e10cSrcweir 			break;
952cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_MIN_WIDTH:
953cdf0e10cSrcweir 			if( rValue.indexOf( '%' ) != -1 )
954cdf0e10cSrcweir 			{
955cdf0e10cSrcweir 				sal_Int32 nTmp;
956cdf0e10cSrcweir 				GetImport().GetMM100UnitConverter().convertPercent( nTmp,
957cdf0e10cSrcweir 																	rValue );
958cdf0e10cSrcweir 				nRelWidth = (sal_Int16)nTmp;
959cdf0e10cSrcweir 			}
960cdf0e10cSrcweir 			else
961cdf0e10cSrcweir 			{
962cdf0e10cSrcweir 				GetImport().GetMM100UnitConverter().convertMeasure( nWidth,
963cdf0e10cSrcweir 																	rValue, 0 );
964cdf0e10cSrcweir 			}
965cdf0e10cSrcweir 			bMinWidth = sal_True;
966cdf0e10cSrcweir 			break;
967cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_HEIGHT:
968cdf0e10cSrcweir 			// relative heights are obsolete since SRC617. Remove them some day!
969cdf0e10cSrcweir 			if( rValue.indexOf( '%' ) != -1 )
970cdf0e10cSrcweir 			{
971cdf0e10cSrcweir 				sal_Int32 nTmp;
972cdf0e10cSrcweir 				GetImport().GetMM100UnitConverter().convertPercent( nTmp,
973cdf0e10cSrcweir 																	rValue );
974cdf0e10cSrcweir 				nRelHeight = (sal_Int16)nTmp;
975cdf0e10cSrcweir 			}
976cdf0e10cSrcweir 			else
977cdf0e10cSrcweir 			{
978cdf0e10cSrcweir 				GetImport().GetMM100UnitConverter().convertMeasure( nHeight,
979cdf0e10cSrcweir 																	rValue, 0 );
980cdf0e10cSrcweir 			}
981cdf0e10cSrcweir 			break;
982cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_REL_HEIGHT:
983cdf0e10cSrcweir 			if( IsXMLToken( rValue, XML_SCALE ) )
984cdf0e10cSrcweir 			{
985cdf0e10cSrcweir 				bSyncHeight = sal_True;
986cdf0e10cSrcweir 			}
987cdf0e10cSrcweir 			else if( IsXMLToken( rValue, XML_SCALE_MIN ) )
988cdf0e10cSrcweir 			{
989cdf0e10cSrcweir 				bSyncHeight = sal_True;
990cdf0e10cSrcweir 				bMinHeight = sal_True;
991cdf0e10cSrcweir 			}
992cdf0e10cSrcweir 			else
993cdf0e10cSrcweir 			{
994cdf0e10cSrcweir 				sal_Int32 nTmp;
995cdf0e10cSrcweir 				if( GetImport().GetMM100UnitConverter().
996cdf0e10cSrcweir 						convertPercent( nTmp, rValue ) )
997cdf0e10cSrcweir 					nRelHeight = (sal_Int16)nTmp;
998cdf0e10cSrcweir 			}
999cdf0e10cSrcweir 			break;
1000cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_MIN_HEIGHT:
1001cdf0e10cSrcweir 			if( rValue.indexOf( '%' ) != -1 )
1002cdf0e10cSrcweir 			{
1003cdf0e10cSrcweir 				sal_Int32 nTmp;
1004cdf0e10cSrcweir 				GetImport().GetMM100UnitConverter().convertPercent( nTmp,
1005cdf0e10cSrcweir 																	rValue );
1006cdf0e10cSrcweir 				nRelHeight = (sal_Int16)nTmp;
1007cdf0e10cSrcweir 			}
1008cdf0e10cSrcweir 			else
1009cdf0e10cSrcweir 			{
1010cdf0e10cSrcweir 				GetImport().GetMM100UnitConverter().convertMeasure( nHeight,
1011cdf0e10cSrcweir 																	rValue, 0 );
1012cdf0e10cSrcweir 			}
1013cdf0e10cSrcweir 			bMinHeight = sal_True;
1014cdf0e10cSrcweir 			break;
1015cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_Z_INDEX:
1016cdf0e10cSrcweir 			GetImport().GetMM100UnitConverter().convertNumber( nZIndex, rValue, -1 );
1017cdf0e10cSrcweir 			break;
1018cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_NEXT_CHAIN_NAME:
1019cdf0e10cSrcweir 			sNextName = rValue;
1020cdf0e10cSrcweir 			break;
1021cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_HREF:
1022cdf0e10cSrcweir 			sHRef = rValue;
1023cdf0e10cSrcweir 			break;
1024cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_FILTER_NAME:
1025cdf0e10cSrcweir 			sFilterName = rValue;
1026cdf0e10cSrcweir 			break;
1027cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_TRANSFORM:
1028cdf0e10cSrcweir 			{
1029cdf0e10cSrcweir 				OUString sValue( rValue );
1030cdf0e10cSrcweir 				sValue.trim();
1031cdf0e10cSrcweir                 const OUString aRotate(GetXMLToken(XML_ROTATE));
1032cdf0e10cSrcweir 				const sal_Int32 nRotateLen(aRotate.getLength());
1033cdf0e10cSrcweir 				sal_Int32 nLen = sValue.getLength();
1034cdf0e10cSrcweir 				if( nLen >= nRotateLen+3 &&
1035cdf0e10cSrcweir 					0 == sValue.compareTo( aRotate, nRotateLen ) &&
1036cdf0e10cSrcweir 					'(' == sValue[nRotateLen] &&
1037cdf0e10cSrcweir 					')' == sValue[nLen-1] )
1038cdf0e10cSrcweir 				{
1039cdf0e10cSrcweir 					sValue = sValue.copy( nRotateLen+1, nLen-(nRotateLen+2) );
1040cdf0e10cSrcweir 					sValue.trim();
1041cdf0e10cSrcweir 					sal_Int32 nVal;
1042cdf0e10cSrcweir 					if( GetImport().GetMM100UnitConverter().convertNumber( nVal, sValue ) )
1043cdf0e10cSrcweir 						nRotation = (sal_Int16)(nVal % 360 );
1044cdf0e10cSrcweir 				}
1045cdf0e10cSrcweir 			}
1046cdf0e10cSrcweir 			break;
1047cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_CODE:
1048cdf0e10cSrcweir 			sCode = rValue;
1049cdf0e10cSrcweir 			break;
1050cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_OBJECT:
1051cdf0e10cSrcweir 			sObject = rValue;
1052cdf0e10cSrcweir 			break;
1053cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_ARCHIVE:
1054cdf0e10cSrcweir 			sArchive = rValue;
1055cdf0e10cSrcweir 			break;
1056cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_MAY_SCRIPT:
1057cdf0e10cSrcweir 			bMayScript = IsXMLToken( rValue, XML_TRUE );
1058cdf0e10cSrcweir 			break;
1059cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_MIME_TYPE:
1060cdf0e10cSrcweir 			sMimeType = rValue;
1061cdf0e10cSrcweir 			break;
1062cdf0e10cSrcweir 		case XML_TOK_TEXT_FRAME_NOTIFY_ON_UPDATE:
1063cdf0e10cSrcweir 			sTblName = rValue;
1064cdf0e10cSrcweir 			break;
1065cdf0e10cSrcweir 		}
1066cdf0e10cSrcweir 	}
1067cdf0e10cSrcweir 
1068cdf0e10cSrcweir 	if( ( (XML_TEXT_FRAME_GRAPHIC == nType ||
1069cdf0e10cSrcweir 		   XML_TEXT_FRAME_OBJECT == nType ||
1070cdf0e10cSrcweir 		   XML_TEXT_FRAME_OBJECT_OLE == nType) &&
1071cdf0e10cSrcweir 		  !sHRef.getLength() ) ||
1072cdf0e10cSrcweir 		( XML_TEXT_FRAME_APPLET  == nType && !sCode.getLength() ) ||
1073cdf0e10cSrcweir         ( XML_TEXT_FRAME_PLUGIN == nType &&
1074cdf0e10cSrcweir           sHRef.getLength() == 0 && sMimeType.getLength() == 0 ) )
1075cdf0e10cSrcweir 		return;	// no URL: no image or OLE object
1076cdf0e10cSrcweir 
1077cdf0e10cSrcweir 	Create( sal_True );
1078cdf0e10cSrcweir }
1079cdf0e10cSrcweir 
1080cdf0e10cSrcweir XMLTextFrameContext_Impl::~XMLTextFrameContext_Impl()
1081cdf0e10cSrcweir {
1082cdf0e10cSrcweir }
1083cdf0e10cSrcweir 
1084cdf0e10cSrcweir void XMLTextFrameContext_Impl::EndElement()
1085cdf0e10cSrcweir {
1086cdf0e10cSrcweir 	CreateIfNotThere();
1087cdf0e10cSrcweir 
1088cdf0e10cSrcweir 	if( xOldTextCursor.is() )
1089cdf0e10cSrcweir 	{
1090cdf0e10cSrcweir 		GetImport().GetTextImport()->DeleteParagraph();
1091cdf0e10cSrcweir 		GetImport().GetTextImport()->SetCursor( xOldTextCursor );
1092cdf0e10cSrcweir 	}
1093cdf0e10cSrcweir 
1094cdf0e10cSrcweir     // reinstall old list item (if necessary) #89892#
1095cdf0e10cSrcweir     if (mbListContextPushed) {
1096cdf0e10cSrcweir         GetImport().GetTextImport()->PopListContext();
1097cdf0e10cSrcweir     }
1098cdf0e10cSrcweir 
1099cdf0e10cSrcweir 	if (( nType == XML_TEXT_FRAME_APPLET || nType == XML_TEXT_FRAME_PLUGIN ) && xPropSet.is())
1100cdf0e10cSrcweir 		GetImport().GetTextImport()->endAppletOrPlugin( xPropSet, aParamMap);
1101cdf0e10cSrcweir }
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir SvXMLImportContext *XMLTextFrameContext_Impl::CreateChildContext(
1104cdf0e10cSrcweir 		sal_uInt16 nPrefix,
1105cdf0e10cSrcweir 		const OUString& rLocalName,
1106cdf0e10cSrcweir 		const Reference< XAttributeList > & xAttrList )
1107cdf0e10cSrcweir {
1108cdf0e10cSrcweir 	SvXMLImportContext *pContext = 0;
1109cdf0e10cSrcweir 
1110cdf0e10cSrcweir 	if( XML_NAMESPACE_DRAW == nPrefix )
1111cdf0e10cSrcweir 	{
1112cdf0e10cSrcweir 		if ( (nType == XML_TEXT_FRAME_APPLET || nType == XML_TEXT_FRAME_PLUGIN) &&
1113cdf0e10cSrcweir 			  IsXMLToken( rLocalName, XML_PARAM ) )
1114cdf0e10cSrcweir 		{
1115cdf0e10cSrcweir 			pContext = new XMLTextFrameParam_Impl( GetImport(),
1116cdf0e10cSrcweir 											  nPrefix, rLocalName,
1117cdf0e10cSrcweir 							 				  xAttrList, nType, aParamMap );
1118cdf0e10cSrcweir 		}
1119cdf0e10cSrcweir 	}
1120cdf0e10cSrcweir 	else if( (XML_NAMESPACE_OFFICE == nPrefix) )
1121cdf0e10cSrcweir 	{
1122cdf0e10cSrcweir 		if( IsXMLToken( rLocalName, XML_BINARY_DATA ) )
1123cdf0e10cSrcweir 		{
1124cdf0e10cSrcweir 			if( !xPropSet.is() && !xBase64Stream.is() && !bCreateFailed )
1125cdf0e10cSrcweir 			{
1126cdf0e10cSrcweir 				switch( nType )
1127cdf0e10cSrcweir 				{
1128cdf0e10cSrcweir 				case XML_TEXT_FRAME_GRAPHIC:
1129cdf0e10cSrcweir 					xBase64Stream =
1130cdf0e10cSrcweir 						GetImport().GetStreamForGraphicObjectURLFromBase64();
1131cdf0e10cSrcweir 					break;
1132cdf0e10cSrcweir 				case XML_TEXT_FRAME_OBJECT_OLE:
1133cdf0e10cSrcweir 					xBase64Stream =
1134cdf0e10cSrcweir 						GetImport().GetStreamForEmbeddedObjectURLFromBase64();
1135cdf0e10cSrcweir 					break;
1136cdf0e10cSrcweir 				}
1137cdf0e10cSrcweir 				if( xBase64Stream.is() )
1138cdf0e10cSrcweir 					pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
1139cdf0e10cSrcweir 													rLocalName, xAttrList,
1140cdf0e10cSrcweir 													xBase64Stream );
1141cdf0e10cSrcweir 			}
1142cdf0e10cSrcweir 		}
1143cdf0e10cSrcweir 	}
1144cdf0e10cSrcweir     // --> OD 2009-08-17 #i100480#
1145cdf0e10cSrcweir     // correction of condition which also avoids warnings.
1146cdf0e10cSrcweir     if( !pContext &&
1147cdf0e10cSrcweir         ( XML_TEXT_FRAME_OBJECT == nType &&
1148cdf0e10cSrcweir           ( ( XML_NAMESPACE_OFFICE == nPrefix &&
1149cdf0e10cSrcweir               IsXMLToken( rLocalName, XML_DOCUMENT ) ) ||
1150cdf0e10cSrcweir             ( XML_NAMESPACE_MATH == nPrefix &&
1151cdf0e10cSrcweir               IsXMLToken( rLocalName, XML_MATH ) ) ) ) )
1152cdf0e10cSrcweir     // <--
1153cdf0e10cSrcweir 	{
1154cdf0e10cSrcweir 		if( !xPropSet.is() && !bCreateFailed )
1155cdf0e10cSrcweir 		{
1156cdf0e10cSrcweir 			XMLEmbeddedObjectImportContext *pEContext =
1157cdf0e10cSrcweir 				new XMLEmbeddedObjectImportContext( GetImport(), nPrefix,
1158cdf0e10cSrcweir 													rLocalName, xAttrList );
1159cdf0e10cSrcweir 			sFilterService = pEContext->GetFilterServiceName();
1160cdf0e10cSrcweir 			if( sFilterService.getLength() != 0 )
1161cdf0e10cSrcweir 			{
1162cdf0e10cSrcweir 				Create( sal_False );
1163cdf0e10cSrcweir 				if( xPropSet.is() )
1164cdf0e10cSrcweir 				{
1165cdf0e10cSrcweir 					Reference < XEmbeddedObjectSupplier > xEOS( xPropSet,
1166cdf0e10cSrcweir 																UNO_QUERY );
1167cdf0e10cSrcweir 					OSL_ENSURE( xEOS.is(),
1168cdf0e10cSrcweir 							"no embedded object supplier for own object" );
1169cdf0e10cSrcweir                     Reference<com::sun::star::lang::XComponent> aXComponent(xEOS->getEmbeddedObject());
1170cdf0e10cSrcweir 					pEContext->SetComponent( aXComponent );
1171cdf0e10cSrcweir 				}
1172cdf0e10cSrcweir 			}
1173cdf0e10cSrcweir 			pContext = pEContext;
1174cdf0e10cSrcweir 		}
1175cdf0e10cSrcweir 	}
1176cdf0e10cSrcweir 	if( !pContext && xOldTextCursor.is() )	// text-box
1177cdf0e10cSrcweir 		pContext = GetImport().GetTextImport()->CreateTextChildContext(
1178cdf0e10cSrcweir 							GetImport(), nPrefix, rLocalName, xAttrList,
1179cdf0e10cSrcweir 							XML_TEXT_TYPE_TEXTBOX );
1180cdf0e10cSrcweir 
1181cdf0e10cSrcweir 	if( !pContext )
1182cdf0e10cSrcweir 		pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1183cdf0e10cSrcweir 
1184cdf0e10cSrcweir 	return pContext;
1185cdf0e10cSrcweir }
1186cdf0e10cSrcweir 
1187cdf0e10cSrcweir void XMLTextFrameContext_Impl::Characters( const OUString& rChars )
1188cdf0e10cSrcweir {
1189cdf0e10cSrcweir 	if( ( XML_TEXT_FRAME_OBJECT_OLE == nType ||
1190cdf0e10cSrcweir 		  XML_TEXT_FRAME_GRAPHIC == nType) &&
1191cdf0e10cSrcweir 		!xPropSet.is() && !bCreateFailed )
1192cdf0e10cSrcweir 	{
1193cdf0e10cSrcweir 		OUString sTrimmedChars( rChars. trim() );
1194cdf0e10cSrcweir 		if( sTrimmedChars.getLength() )
1195cdf0e10cSrcweir 		{
1196cdf0e10cSrcweir 			if( !xBase64Stream.is() )
1197cdf0e10cSrcweir 			{
1198cdf0e10cSrcweir 				if( XML_TEXT_FRAME_GRAPHIC == nType )
1199cdf0e10cSrcweir 				{
1200cdf0e10cSrcweir 					xBase64Stream =
1201cdf0e10cSrcweir 						GetImport().GetStreamForGraphicObjectURLFromBase64();
1202cdf0e10cSrcweir 				}
1203cdf0e10cSrcweir 				else
1204cdf0e10cSrcweir 				{
1205cdf0e10cSrcweir 					xBase64Stream =
1206cdf0e10cSrcweir 						GetImport().GetStreamForEmbeddedObjectURLFromBase64();
1207cdf0e10cSrcweir 				}
1208cdf0e10cSrcweir 				if( xBase64Stream.is() )
1209cdf0e10cSrcweir 					bOwnBase64Stream = sal_True;
1210cdf0e10cSrcweir 			}
1211cdf0e10cSrcweir 			if( bOwnBase64Stream && xBase64Stream.is() )
1212cdf0e10cSrcweir 			{
1213cdf0e10cSrcweir 				OUString sChars;
1214cdf0e10cSrcweir 				if( sBase64CharsLeft )
1215cdf0e10cSrcweir 				{
1216cdf0e10cSrcweir 					sChars = sBase64CharsLeft;
1217cdf0e10cSrcweir 					sChars += sTrimmedChars;
1218cdf0e10cSrcweir 					sBase64CharsLeft = OUString();
1219cdf0e10cSrcweir 				}
1220cdf0e10cSrcweir 				else
1221cdf0e10cSrcweir 				{
1222cdf0e10cSrcweir 					sChars = sTrimmedChars;
1223cdf0e10cSrcweir 				}
1224cdf0e10cSrcweir 				Sequence< sal_Int8 > aBuffer( (sChars.getLength() / 4) * 3 );
1225cdf0e10cSrcweir 				sal_Int32 nCharsDecoded =
1226cdf0e10cSrcweir 					GetImport().GetMM100UnitConverter().
1227cdf0e10cSrcweir 						decodeBase64SomeChars( aBuffer, sChars );
1228cdf0e10cSrcweir 				xBase64Stream->writeBytes( aBuffer );
1229cdf0e10cSrcweir 				if( nCharsDecoded != sChars.getLength() )
1230cdf0e10cSrcweir 					sBase64CharsLeft = sChars.copy( nCharsDecoded );
1231cdf0e10cSrcweir 			}
1232cdf0e10cSrcweir 		}
1233cdf0e10cSrcweir 	}
1234cdf0e10cSrcweir }
1235cdf0e10cSrcweir 
1236cdf0e10cSrcweir void XMLTextFrameContext_Impl::SetHyperlink( const OUString& rHRef,
1237cdf0e10cSrcweir 					   const OUString& rName,
1238cdf0e10cSrcweir 					   const OUString& rTargetFrameName,
1239cdf0e10cSrcweir 					   sal_Bool bMap )
1240cdf0e10cSrcweir {
1241cdf0e10cSrcweir     static ::rtl::OUString s_HyperLinkURL(
1242cdf0e10cSrcweir         RTL_CONSTASCII_USTRINGPARAM("HyperLinkURL"));
1243cdf0e10cSrcweir     static ::rtl::OUString s_HyperLinkName(
1244cdf0e10cSrcweir         RTL_CONSTASCII_USTRINGPARAM("HyperLinkName"));
1245cdf0e10cSrcweir     static ::rtl::OUString s_HyperLinkTarget(
1246cdf0e10cSrcweir         RTL_CONSTASCII_USTRINGPARAM("HyperLinkTarget"));
1247cdf0e10cSrcweir     static ::rtl::OUString s_ServerMap(
1248cdf0e10cSrcweir         RTL_CONSTASCII_USTRINGPARAM("ServerMap"));
1249cdf0e10cSrcweir 	if( !xPropSet.is() )
1250cdf0e10cSrcweir 		return;
1251cdf0e10cSrcweir 
1252cdf0e10cSrcweir 	UniReference< XMLTextImportHelper > xTxtImp = GetImport().GetTextImport();
1253cdf0e10cSrcweir 	Reference < XPropertySetInfo > xPropSetInfo =
1254cdf0e10cSrcweir 		xPropSet->getPropertySetInfo();
1255cdf0e10cSrcweir 	if( !xPropSetInfo.is() ||
1256cdf0e10cSrcweir         !xPropSetInfo->hasPropertyByName(s_HyperLinkURL))
1257cdf0e10cSrcweir 		return;
1258cdf0e10cSrcweir 
1259cdf0e10cSrcweir 	Any aAny;
1260cdf0e10cSrcweir 	aAny <<= rHRef;
1261cdf0e10cSrcweir     xPropSet->setPropertyValue( s_HyperLinkURL, aAny );
1262cdf0e10cSrcweir 
1263cdf0e10cSrcweir     if (xPropSetInfo->hasPropertyByName(s_HyperLinkName))
1264cdf0e10cSrcweir 	{
1265cdf0e10cSrcweir 		aAny <<= rName;
1266cdf0e10cSrcweir         xPropSet->setPropertyValue(s_HyperLinkName, aAny);
1267cdf0e10cSrcweir 	}
1268cdf0e10cSrcweir 
1269cdf0e10cSrcweir     if (xPropSetInfo->hasPropertyByName(s_HyperLinkTarget))
1270cdf0e10cSrcweir 	{
1271cdf0e10cSrcweir 		aAny <<= rTargetFrameName;
1272cdf0e10cSrcweir         xPropSet->setPropertyValue( s_HyperLinkTarget, aAny );
1273cdf0e10cSrcweir 	}
1274cdf0e10cSrcweir 
1275cdf0e10cSrcweir     if (xPropSetInfo->hasPropertyByName(s_ServerMap))
1276cdf0e10cSrcweir 	{
1277cdf0e10cSrcweir 		aAny.setValue( &bMap, ::getBooleanCppuType() );
1278cdf0e10cSrcweir         xPropSet->setPropertyValue(s_ServerMap, aAny);
1279cdf0e10cSrcweir 	}
1280cdf0e10cSrcweir }
1281cdf0e10cSrcweir 
1282cdf0e10cSrcweir // --> OD 2009-07-22 #i73249#
1283cdf0e10cSrcweir void XMLTextFrameContext_Impl::SetTitle( const OUString& rTitle )
1284cdf0e10cSrcweir {
1285cdf0e10cSrcweir     if ( xPropSet.is() )
1286cdf0e10cSrcweir     {
1287cdf0e10cSrcweir         Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1288cdf0e10cSrcweir         if( xPropSetInfo->hasPropertyByName( sTitle ) )
1289cdf0e10cSrcweir         {
1290cdf0e10cSrcweir             xPropSet->setPropertyValue( sTitle, makeAny( rTitle ) );
1291cdf0e10cSrcweir         }
1292cdf0e10cSrcweir     }
1293cdf0e10cSrcweir }
1294cdf0e10cSrcweir 
1295cdf0e10cSrcweir void XMLTextFrameContext_Impl::SetDesc( const OUString& rDesc )
1296cdf0e10cSrcweir {
1297cdf0e10cSrcweir 	if ( xPropSet.is() )
1298cdf0e10cSrcweir 	{
1299cdf0e10cSrcweir         Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1300cdf0e10cSrcweir         if( xPropSetInfo->hasPropertyByName( sDescription ) )
1301cdf0e10cSrcweir 		{
1302cdf0e10cSrcweir             xPropSet->setPropertyValue( sDescription, makeAny( rDesc ) );
1303cdf0e10cSrcweir 		}
1304cdf0e10cSrcweir 	}
1305cdf0e10cSrcweir }
1306cdf0e10cSrcweir // <--
1307cdf0e10cSrcweir 
1308cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------
1309cdf0e10cSrcweir 
1310cdf0e10cSrcweir TYPEINIT1( XMLTextFrameContext, SvXMLImportContext );
1311cdf0e10cSrcweir 
1312ddde725dSArmin Le Grand void XMLTextFrameContext::removeGraphicFromImportContext(const SvXMLImportContext& rContext) const
1313ddde725dSArmin Le Grand {
1314ddde725dSArmin Le Grand     const XMLTextFrameContext_Impl* pXMLTextFrameContext_Impl = dynamic_cast< const XMLTextFrameContext_Impl* >(&rContext);
1315ddde725dSArmin Le Grand 
1316ddde725dSArmin Le Grand     if(pXMLTextFrameContext_Impl)
1317ddde725dSArmin Le Grand     {
1318ddde725dSArmin Le Grand         try
1319ddde725dSArmin Le Grand         {
1320ddde725dSArmin Le Grand             // just dispose to delete
1321ddde725dSArmin Le Grand             uno::Reference< lang::XComponent > xComp(pXMLTextFrameContext_Impl->GetPropSet(), UNO_QUERY);
1322ddde725dSArmin Le Grand 
1323ddde725dSArmin Le Grand             if(xComp.is())
1324ddde725dSArmin Le Grand             {
1325ddde725dSArmin Le Grand                 xComp->dispose();
1326ddde725dSArmin Le Grand             }
1327ddde725dSArmin Le Grand         }
1328ddde725dSArmin Le Grand         catch( uno::Exception& )
1329ddde725dSArmin Le Grand         {
1330ddde725dSArmin Le Grand             DBG_ERROR( "Error in cleanup of multiple graphic object import (!)" );
1331ddde725dSArmin Le Grand         }
1332ddde725dSArmin Le Grand     }
1333ddde725dSArmin Le Grand }
1334ddde725dSArmin Le Grand 
1335ddde725dSArmin Le Grand rtl::OUString XMLTextFrameContext::getGraphicURLFromImportContext(const SvXMLImportContext& rContext) const
1336ddde725dSArmin Le Grand {
1337ddde725dSArmin Le Grand     rtl::OUString aRetval;
1338ddde725dSArmin Le Grand     const XMLTextFrameContext_Impl* pXMLTextFrameContext_Impl = dynamic_cast< const XMLTextFrameContext_Impl* >(&rContext);
1339ddde725dSArmin Le Grand 
1340ddde725dSArmin Le Grand     if(pXMLTextFrameContext_Impl)
1341ddde725dSArmin Le Grand     {
1342ddde725dSArmin Le Grand         return pXMLTextFrameContext_Impl->GetHRef();
1343ddde725dSArmin Le Grand     }
1344ddde725dSArmin Le Grand 
1345ddde725dSArmin Le Grand     return aRetval;
1346ddde725dSArmin Le Grand }
1347ddde725dSArmin Le Grand 
1348cdf0e10cSrcweir sal_Bool XMLTextFrameContext::CreateIfNotThere()
1349cdf0e10cSrcweir {
1350cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1351cdf0e10cSrcweir 	SvXMLImportContext *pContext = &m_xImplContext;
1352cdf0e10cSrcweir 	XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
1353cdf0e10cSrcweir 	if( pImpl )
1354cdf0e10cSrcweir 		bRet = pImpl->CreateIfNotThere();
1355cdf0e10cSrcweir 
1356cdf0e10cSrcweir 	return bRet;
1357cdf0e10cSrcweir }
1358cdf0e10cSrcweir 
1359cdf0e10cSrcweir sal_Bool XMLTextFrameContext::CreateIfNotThere( ::com::sun::star::uno::Reference <
1360cdf0e10cSrcweir 		::com::sun::star::beans::XPropertySet >& rPropSet )
1361cdf0e10cSrcweir {
1362cdf0e10cSrcweir 	SvXMLImportContext *pContext = &m_xImplContext;
1363cdf0e10cSrcweir 	XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
1364cdf0e10cSrcweir 	if( pImpl )
1365cdf0e10cSrcweir 	{
1366cdf0e10cSrcweir 		if( pImpl->CreateIfNotThere() )
1367cdf0e10cSrcweir 			rPropSet = pImpl->GetPropSet();
1368cdf0e10cSrcweir 	}
1369cdf0e10cSrcweir 
1370cdf0e10cSrcweir 	return rPropSet.is();
1371cdf0e10cSrcweir }
1372cdf0e10cSrcweir 
1373cdf0e10cSrcweir XMLTextFrameContext::XMLTextFrameContext(
1374cdf0e10cSrcweir 		SvXMLImport& rImport,
1375cdf0e10cSrcweir 		sal_uInt16 nPrfx, const OUString& rLName,
1376cdf0e10cSrcweir 		const Reference< XAttributeList > & xAttrList,
1377cdf0e10cSrcweir 		TextContentAnchorType eATyp )
1378cdf0e10cSrcweir :	SvXMLImportContext( rImport, nPrfx, rLName )
1379ddde725dSArmin Le Grand ,   multiImageImportHelper()
1380cdf0e10cSrcweir ,	m_xAttrList( new SvXMLAttributeList( xAttrList ) )
1381cdf0e10cSrcweir ,	m_pHyperlink( 0 )
1382cdf0e10cSrcweir // --> OD 2009-07-22 #i73249#
1383cdf0e10cSrcweir ,   m_sTitle()
1384cdf0e10cSrcweir ,   m_sDesc()
1385cdf0e10cSrcweir // <--
1386cdf0e10cSrcweir ,	m_eDefaultAnchorType( eATyp )
1387cdf0e10cSrcweir     // --> OD 2006-03-10 #i51726#
1388cdf0e10cSrcweir ,   m_HasAutomaticStyleWithoutParentStyle( sal_False )
1389cdf0e10cSrcweir     // <--
1390cdf0e10cSrcweir ,	m_bSupportsReplacement( sal_False )
1391cdf0e10cSrcweir {
1392cdf0e10cSrcweir 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
1393cdf0e10cSrcweir 	for( sal_Int16 i=0; i < nAttrCount; i++ )
1394cdf0e10cSrcweir 	{
1395cdf0e10cSrcweir 		const OUString& rAttrName = xAttrList->getNameByIndex( i );
1396cdf0e10cSrcweir 
1397cdf0e10cSrcweir 		OUString aLocalName;
1398cdf0e10cSrcweir 		sal_uInt16 nPrefix =
1399cdf0e10cSrcweir 			GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
1400cdf0e10cSrcweir         // --> OD 2006-03-10 #i51726#
1401cdf0e10cSrcweir         // New distinguish attribute between Writer objects and Draw objects is:
1402cdf0e10cSrcweir         // Draw objects have an automatic style without a parent style
1403cdf0e10cSrcweir         if ( XML_NAMESPACE_DRAW == nPrefix &&
1404cdf0e10cSrcweir              IsXMLToken( aLocalName, XML_STYLE_NAME ) )
1405cdf0e10cSrcweir 		{
1406cdf0e10cSrcweir             OUString aStyleName = xAttrList->getValueByIndex( i );
1407cdf0e10cSrcweir             if( aStyleName.getLength() )
1408cdf0e10cSrcweir             {
1409cdf0e10cSrcweir                 UniReference < XMLTextImportHelper > xTxtImport =
1410cdf0e10cSrcweir                                                     GetImport().GetTextImport();
1411cdf0e10cSrcweir                 XMLPropStyleContext* pStyle( 0L );
1412cdf0e10cSrcweir                 pStyle = xTxtImport->FindAutoFrameStyle( aStyleName );
1413cdf0e10cSrcweir                 if ( pStyle && !pStyle->GetParentName().getLength() )
1414cdf0e10cSrcweir                 {
1415cdf0e10cSrcweir                     m_HasAutomaticStyleWithoutParentStyle = sal_True;
1416cdf0e10cSrcweir                 }
1417cdf0e10cSrcweir             }
1418cdf0e10cSrcweir         }
1419cdf0e10cSrcweir         // <--
1420cdf0e10cSrcweir         else if ( XML_NAMESPACE_TEXT == nPrefix &&
1421cdf0e10cSrcweir                   IsXMLToken( aLocalName, XML_ANCHOR_TYPE ) )
1422cdf0e10cSrcweir 		{
1423cdf0e10cSrcweir 			TextContentAnchorType eNew;
1424cdf0e10cSrcweir 			if( XMLAnchorTypePropHdl::convert( xAttrList->getValueByIndex(i),
1425cdf0e10cSrcweir 						eNew ) &&
1426cdf0e10cSrcweir 				( TextContentAnchorType_AT_PARAGRAPH == eNew ||
1427cdf0e10cSrcweir 				  TextContentAnchorType_AT_CHARACTER == eNew ||
1428cdf0e10cSrcweir 				  TextContentAnchorType_AS_CHARACTER == eNew ||
1429cdf0e10cSrcweir 				  TextContentAnchorType_AT_PAGE == eNew) )
1430cdf0e10cSrcweir 				m_eDefaultAnchorType = eNew;
1431cdf0e10cSrcweir 		}
1432cdf0e10cSrcweir 	}
1433cdf0e10cSrcweir }
1434cdf0e10cSrcweir 
1435cdf0e10cSrcweir XMLTextFrameContext::~XMLTextFrameContext()
1436cdf0e10cSrcweir {
1437ddde725dSArmin Le Grand     delete m_pHyperlink;
1438cdf0e10cSrcweir }
1439cdf0e10cSrcweir 
1440cdf0e10cSrcweir void XMLTextFrameContext::EndElement()
1441cdf0e10cSrcweir {
1442ddde725dSArmin Le Grand     /// solve if multiple image child contexts were imported
1443*598d8f9fSArmin Le Grand     /// the winner is returned, if something has yet to be done with it
1444*598d8f9fSArmin Le Grand     /*const SvXMLImportContext* pWinner =*/ solveMultipleImages();
1445ddde725dSArmin Le Grand 
1446cdf0e10cSrcweir 	SvXMLImportContext *pContext = &m_xImplContext;
1447cdf0e10cSrcweir 	XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
1448cdf0e10cSrcweir 	if( pImpl )
1449cdf0e10cSrcweir 	{
1450cdf0e10cSrcweir 		pImpl->CreateIfNotThere();
1451cdf0e10cSrcweir 
1452cdf0e10cSrcweir         // --> OD 2009-07-22 #i73249#
1453cdf0e10cSrcweir //        // alternative text
1454cdf0e10cSrcweir //        if( m_sDesc.getLength() )
1455cdf0e10cSrcweir //            pImpl->SetDesc( m_sDesc );
1456cdf0e10cSrcweir         // svg:title
1457cdf0e10cSrcweir         if( m_sTitle.getLength() )
1458cdf0e10cSrcweir         {
1459cdf0e10cSrcweir             pImpl->SetTitle( m_sTitle );
1460cdf0e10cSrcweir         }
1461cdf0e10cSrcweir         if( m_sDesc.getLength() )
1462cdf0e10cSrcweir         {
1463cdf0e10cSrcweir             pImpl->SetDesc( m_sDesc );
1464cdf0e10cSrcweir         }
1465cdf0e10cSrcweir         // <--
1466cdf0e10cSrcweir 
1467cdf0e10cSrcweir 		if( m_pHyperlink )
1468cdf0e10cSrcweir 		{
1469cdf0e10cSrcweir 			pImpl->SetHyperlink( m_pHyperlink->GetHRef(), m_pHyperlink->GetName(),
1470cdf0e10cSrcweir 						  m_pHyperlink->GetTargetFrameName(), m_pHyperlink->GetMap() );
1471cdf0e10cSrcweir 			delete m_pHyperlink;
1472cdf0e10cSrcweir 			m_pHyperlink = 0;
1473cdf0e10cSrcweir 		}
1474cdf0e10cSrcweir 
1475cdf0e10cSrcweir 	}
1476cdf0e10cSrcweir }
1477cdf0e10cSrcweir 
1478cdf0e10cSrcweir SvXMLImportContext *XMLTextFrameContext::CreateChildContext(
1479cdf0e10cSrcweir 		sal_uInt16 p_nPrefix,
1480cdf0e10cSrcweir 		const OUString& rLocalName,
1481cdf0e10cSrcweir 		const Reference< XAttributeList > & xAttrList )
1482cdf0e10cSrcweir {
1483cdf0e10cSrcweir 	SvXMLImportContext *pContext = 0;
1484cdf0e10cSrcweir 
1485cdf0e10cSrcweir 	if( !m_xImplContext.Is() )
1486cdf0e10cSrcweir 	{
1487cdf0e10cSrcweir 		// no child exists
1488cdf0e10cSrcweir 		if( XML_NAMESPACE_DRAW == p_nPrefix )
1489cdf0e10cSrcweir 		{
1490cdf0e10cSrcweir 			sal_uInt16 nFrameType = USHRT_MAX;
1491cdf0e10cSrcweir 			if( IsXMLToken( rLocalName, XML_TEXT_BOX ) )
1492cdf0e10cSrcweir 				nFrameType = XML_TEXT_FRAME_TEXTBOX;
1493cdf0e10cSrcweir 			else if( IsXMLToken( rLocalName, XML_IMAGE ) )
1494cdf0e10cSrcweir 				nFrameType = XML_TEXT_FRAME_GRAPHIC;
1495cdf0e10cSrcweir 			else if( IsXMLToken( rLocalName, XML_OBJECT ) )
1496cdf0e10cSrcweir 				nFrameType = XML_TEXT_FRAME_OBJECT;
1497cdf0e10cSrcweir 			else if( IsXMLToken( rLocalName, XML_OBJECT_OLE ) )
1498cdf0e10cSrcweir 				nFrameType = XML_TEXT_FRAME_OBJECT_OLE;
1499cdf0e10cSrcweir 			else if( IsXMLToken( rLocalName, XML_APPLET) )
1500cdf0e10cSrcweir 				nFrameType = XML_TEXT_FRAME_APPLET;
1501cdf0e10cSrcweir 			else if( IsXMLToken( rLocalName, XML_PLUGIN ) )
1502cdf0e10cSrcweir 				nFrameType = XML_TEXT_FRAME_PLUGIN;
1503cdf0e10cSrcweir 			else if( IsXMLToken( rLocalName, XML_FLOATING_FRAME ) )
1504cdf0e10cSrcweir 				nFrameType = XML_TEXT_FRAME_FLOATING_FRAME;
1505cdf0e10cSrcweir 
1506cdf0e10cSrcweir 			if( USHRT_MAX != nFrameType )
1507cdf0e10cSrcweir 			{
1508cdf0e10cSrcweir                 // --> OD 2006-03-10 #i51726#
1509cdf0e10cSrcweir                 if ( ( XML_TEXT_FRAME_TEXTBOX == nFrameType ||
1510cdf0e10cSrcweir                        XML_TEXT_FRAME_GRAPHIC == nFrameType ) &&
1511cdf0e10cSrcweir                      m_HasAutomaticStyleWithoutParentStyle )
1512cdf0e10cSrcweir                 // <--
1513cdf0e10cSrcweir 				{
1514cdf0e10cSrcweir 					Reference < XShapes > xShapes;
1515cdf0e10cSrcweir 					pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
1516cdf0e10cSrcweir 									GetImport(), p_nPrefix, rLocalName, xAttrList, xShapes, m_xAttrList );
1517cdf0e10cSrcweir 				}
1518cdf0e10cSrcweir 				else if( XML_TEXT_FRAME_PLUGIN == nFrameType )
1519cdf0e10cSrcweir 				{
1520cdf0e10cSrcweir 				    bool bMedia = false;
1521cdf0e10cSrcweir 
1522cdf0e10cSrcweir 				    // check, if we have a media object
1523cdf0e10cSrcweir 	                for( sal_Int16 n = 0, nAttrCount = ( xAttrList.is() ? xAttrList->getLength() : 0 ); n < nAttrCount; ++n )
1524cdf0e10cSrcweir 	                {
1525cdf0e10cSrcweir 		                OUString 	aLocalName;
1526cdf0e10cSrcweir 		                sal_uInt16 	nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( n ), &aLocalName );
1527cdf0e10cSrcweir 
1528cdf0e10cSrcweir 		                if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( aLocalName, XML_MIME_TYPE ) )
1529cdf0e10cSrcweir 		                {
1530cdf0e10cSrcweir 			                if( 0 == xAttrList->getValueByIndex( n ).compareToAscii( "application/vnd.sun.star.media" ) )
1531cdf0e10cSrcweir 				                bMedia = true;
1532cdf0e10cSrcweir 
1533cdf0e10cSrcweir 			                // leave this loop
1534cdf0e10cSrcweir 			                n = nAttrCount - 1;
1535cdf0e10cSrcweir 		                }
1536cdf0e10cSrcweir 	                }
1537cdf0e10cSrcweir 
1538cdf0e10cSrcweir 	                if( bMedia )
1539cdf0e10cSrcweir 	                {
1540cdf0e10cSrcweir 	                    Reference < XShapes > xShapes;
1541cdf0e10cSrcweir 					    pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
1542cdf0e10cSrcweir 									    GetImport(), p_nPrefix, rLocalName, xAttrList, xShapes, m_xAttrList );
1543cdf0e10cSrcweir 					}
1544cdf0e10cSrcweir 				}
1545cdf0e10cSrcweir 				else if( XML_TEXT_FRAME_OBJECT == nFrameType ||
1546cdf0e10cSrcweir 						 XML_TEXT_FRAME_OBJECT_OLE == nFrameType )
1547cdf0e10cSrcweir 				{
1548cdf0e10cSrcweir 					m_bSupportsReplacement = sal_True;
1549cdf0e10cSrcweir 				}
1550ddde725dSArmin Le Grand                 else if(XML_TEXT_FRAME_GRAPHIC == nFrameType)
1551ddde725dSArmin Le Grand                 {
1552ddde725dSArmin Le Grand                     setSupportsMultipleContents(IsXMLToken(rLocalName, XML_IMAGE));
1553ddde725dSArmin Le Grand                 }
1554cdf0e10cSrcweir 
1555cdf0e10cSrcweir 				if( !pContext )
1556cdf0e10cSrcweir 				{
1557cdf0e10cSrcweir 
1558cdf0e10cSrcweir 					pContext = new XMLTextFrameContext_Impl( GetImport(), p_nPrefix,
1559cdf0e10cSrcweir 														rLocalName, xAttrList,
1560cdf0e10cSrcweir 														m_eDefaultAnchorType,
1561cdf0e10cSrcweir 														nFrameType,
1562cdf0e10cSrcweir 														m_xAttrList	);
1563cdf0e10cSrcweir 				}
1564cdf0e10cSrcweir 
1565cdf0e10cSrcweir 				m_xImplContext = pContext;
1566ddde725dSArmin Le Grand 
1567ddde725dSArmin Le Grand                 if(getSupportsMultipleContents() && XML_TEXT_FRAME_GRAPHIC == nFrameType)
1568ddde725dSArmin Le Grand                 {
1569ddde725dSArmin Le Grand                     addContent(*m_xImplContext);
1570ddde725dSArmin Le Grand                 }
1571cdf0e10cSrcweir 			}
1572cdf0e10cSrcweir 		}
1573cdf0e10cSrcweir 	}
1574ddde725dSArmin Le Grand     else if(getSupportsMultipleContents() && XML_NAMESPACE_DRAW == p_nPrefix && IsXMLToken(rLocalName, XML_IMAGE))
1575ddde725dSArmin Le Grand     {
1576ddde725dSArmin Le Grand         // read another image
1577ddde725dSArmin Le Grand         pContext = new XMLTextFrameContext_Impl(
1578ddde725dSArmin Le Grand             GetImport(), p_nPrefix, rLocalName, xAttrList,
1579ddde725dSArmin Le Grand             m_eDefaultAnchorType, XML_TEXT_FRAME_GRAPHIC, m_xAttrList);
1580ddde725dSArmin Le Grand 
1581ddde725dSArmin Le Grand         m_xImplContext = pContext;
1582ddde725dSArmin Le Grand         addContent(*m_xImplContext);
1583ddde725dSArmin Le Grand     }
1584cdf0e10cSrcweir 	else if( m_bSupportsReplacement && !m_xReplImplContext &&
1585cdf0e10cSrcweir 			 XML_NAMESPACE_DRAW == p_nPrefix &&
1586cdf0e10cSrcweir 			 IsXMLToken( rLocalName, XML_IMAGE ) )
1587cdf0e10cSrcweir 	{
1588cdf0e10cSrcweir 		// read replacement image
1589cdf0e10cSrcweir 		Reference < XPropertySet > xPropSet;
1590cdf0e10cSrcweir 		if( CreateIfNotThere( xPropSet ) )
1591cdf0e10cSrcweir 		{
1592cdf0e10cSrcweir 			pContext = new XMLReplacementImageContext( GetImport(),
1593cdf0e10cSrcweir 								p_nPrefix, rLocalName, xAttrList, xPropSet );
1594cdf0e10cSrcweir 			m_xReplImplContext = pContext;
1595cdf0e10cSrcweir 		}
1596cdf0e10cSrcweir 	}
1597cdf0e10cSrcweir 	else if( m_xImplContext->ISA( XMLTextFrameContext_Impl ) )
1598cdf0e10cSrcweir 	{
1599cdf0e10cSrcweir 		// the child is a writer frame
1600cdf0e10cSrcweir 		if( XML_NAMESPACE_SVG == p_nPrefix )
1601cdf0e10cSrcweir 		{
1602cdf0e10cSrcweir             // --> OD 2009-07-22 #i73249#
1603cdf0e10cSrcweir //            bool bOld = SvXMLImport::OOo_2x >= GetImport().getGeneratorVersion();
1604cdf0e10cSrcweir //            if( IsXMLToken( rLocalName, bOld ? XML_DESC : XML_TITLE ) )
1605cdf0e10cSrcweir //                pContext = new XMLTextFrameDescContext_Impl( GetImport(), p_nPrefix, rLocalName,
1606cdf0e10cSrcweir //                                                         xAttrList, m_sDesc );
1607cdf0e10cSrcweir             const bool bOld = SvXMLImport::OOo_2x >= GetImport().getGeneratorVersion();
1608cdf0e10cSrcweir             if ( bOld )
1609cdf0e10cSrcweir             {
1610cdf0e10cSrcweir                 if ( IsXMLToken( rLocalName, XML_DESC ) )
1611cdf0e10cSrcweir                 {
1612cdf0e10cSrcweir                     pContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(),
1613cdf0e10cSrcweir                                                                         p_nPrefix,
1614cdf0e10cSrcweir                                                                         rLocalName,
1615cdf0e10cSrcweir                                                                         m_sTitle );
1616cdf0e10cSrcweir                 }
1617cdf0e10cSrcweir             }
1618cdf0e10cSrcweir             else
1619cdf0e10cSrcweir             {
1620cdf0e10cSrcweir                 if( IsXMLToken( rLocalName, XML_TITLE ) )
1621cdf0e10cSrcweir                 {
1622cdf0e10cSrcweir                     pContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(),
1623cdf0e10cSrcweir                                                                         p_nPrefix,
1624cdf0e10cSrcweir                                                                         rLocalName,
1625cdf0e10cSrcweir                                                                         m_sTitle );
1626cdf0e10cSrcweir                 }
1627cdf0e10cSrcweir                 else if ( IsXMLToken( rLocalName, XML_DESC ) )
1628cdf0e10cSrcweir                 {
1629cdf0e10cSrcweir                     pContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(),
1630cdf0e10cSrcweir                                                                         p_nPrefix,
1631cdf0e10cSrcweir                                                                         rLocalName,
1632cdf0e10cSrcweir                                                                         m_sDesc );
1633cdf0e10cSrcweir                 }
1634cdf0e10cSrcweir             }
1635cdf0e10cSrcweir             // <--
1636cdf0e10cSrcweir 		}
1637cdf0e10cSrcweir 		else if( XML_NAMESPACE_DRAW == p_nPrefix )
1638cdf0e10cSrcweir 		{
1639cdf0e10cSrcweir 			Reference < XPropertySet > xPropSet;
1640cdf0e10cSrcweir 			if( IsXMLToken( rLocalName, XML_CONTOUR_POLYGON ) )
1641cdf0e10cSrcweir 			{
1642cdf0e10cSrcweir 				if( CreateIfNotThere( xPropSet ) )
1643cdf0e10cSrcweir 					pContext = new XMLTextFrameContourContext_Impl( GetImport(), p_nPrefix, rLocalName,
1644cdf0e10cSrcweir 												  xAttrList, xPropSet, sal_False );
1645cdf0e10cSrcweir 			}
1646cdf0e10cSrcweir 			else if( IsXMLToken( rLocalName, XML_CONTOUR_PATH ) )
1647cdf0e10cSrcweir 			{
1648cdf0e10cSrcweir 				if( CreateIfNotThere( xPropSet ) )
1649cdf0e10cSrcweir 					pContext = new XMLTextFrameContourContext_Impl( GetImport(), p_nPrefix, rLocalName,
1650cdf0e10cSrcweir 												  xAttrList, xPropSet, sal_True );
1651cdf0e10cSrcweir 			}
1652cdf0e10cSrcweir 			else if( IsXMLToken( rLocalName, XML_IMAGE_MAP ) )
1653cdf0e10cSrcweir 			{
1654cdf0e10cSrcweir 				if( CreateIfNotThere( xPropSet ) )
1655cdf0e10cSrcweir 					pContext = new XMLImageMapContext( GetImport(), p_nPrefix, rLocalName, xPropSet );
1656cdf0e10cSrcweir 			}
1657cdf0e10cSrcweir 		}
1658cdf0e10cSrcweir 		else if( (XML_NAMESPACE_OFFICE == p_nPrefix) && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
1659cdf0e10cSrcweir 		{
1660cdf0e10cSrcweir 			// do we still have the frame object?
1661cdf0e10cSrcweir 			Reference < XPropertySet > xPropSet;
1662cdf0e10cSrcweir 			if( CreateIfNotThere( xPropSet ) )
1663cdf0e10cSrcweir 			{
1664cdf0e10cSrcweir 				// is it an event supplier?
1665cdf0e10cSrcweir 				Reference<XEventsSupplier> xEventsSupplier(xPropSet, UNO_QUERY);
1666cdf0e10cSrcweir 				if (xEventsSupplier.is())
1667cdf0e10cSrcweir 				{
1668cdf0e10cSrcweir 					// OK, we have the events, so create the context
1669cdf0e10cSrcweir 					pContext = new XMLEventsImportContext(GetImport(), p_nPrefix,
1670cdf0e10cSrcweir 													  rLocalName, xEventsSupplier);
1671cdf0e10cSrcweir 				}
1672cdf0e10cSrcweir 			}
1673cdf0e10cSrcweir 		}
1674cdf0e10cSrcweir 	}
1675cdf0e10cSrcweir 	else if( p_nPrefix == XML_NAMESPACE_SVG &&	// #i68101#
1676cdf0e10cSrcweir 				(IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
1677cdf0e10cSrcweir 	{
1678cdf0e10cSrcweir 		pContext = m_xImplContext->CreateChildContext( p_nPrefix, rLocalName, xAttrList );
1679cdf0e10cSrcweir 	}
1680cdf0e10cSrcweir 	else
1681cdf0e10cSrcweir 	{
1682cdf0e10cSrcweir 		// the child is a drawing shape
1683cdf0e10cSrcweir 		pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
1684cdf0e10cSrcweir 									&m_xImplContext, p_nPrefix, rLocalName, xAttrList );
1685cdf0e10cSrcweir 	}
1686cdf0e10cSrcweir 
1687cdf0e10cSrcweir 	if( !pContext )
1688cdf0e10cSrcweir 		pContext = new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
1689cdf0e10cSrcweir 
1690cdf0e10cSrcweir 	return pContext;
1691cdf0e10cSrcweir }
1692cdf0e10cSrcweir 
1693cdf0e10cSrcweir void XMLTextFrameContext::SetHyperlink( const OUString& rHRef,
1694cdf0e10cSrcweir 					   const OUString& rName,
1695cdf0e10cSrcweir 					   const OUString& rTargetFrameName,
1696cdf0e10cSrcweir 					   sal_Bool bMap )
1697cdf0e10cSrcweir {
1698cdf0e10cSrcweir 	OSL_ENSURE( !m_pHyperlink, "recursive SetHyperlink call" );
1699cdf0e10cSrcweir 	delete m_pHyperlink;
1700cdf0e10cSrcweir 	m_pHyperlink = new XMLTextFrameContextHyperlink_Impl(
1701cdf0e10cSrcweir 				rHRef, rName, rTargetFrameName, bMap );
1702cdf0e10cSrcweir }
1703cdf0e10cSrcweir 
1704cdf0e10cSrcweir TextContentAnchorType XMLTextFrameContext::GetAnchorType() const
1705cdf0e10cSrcweir {
1706cdf0e10cSrcweir 	SvXMLImportContext *pContext = &m_xImplContext;
1707cdf0e10cSrcweir 	XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
1708cdf0e10cSrcweir 	if( pImpl )
1709cdf0e10cSrcweir 		return pImpl->GetAnchorType();
1710cdf0e10cSrcweir 	else
1711cdf0e10cSrcweir 		return m_eDefaultAnchorType;
1712cdf0e10cSrcweir }
1713cdf0e10cSrcweir 
1714cdf0e10cSrcweir Reference < XTextContent > XMLTextFrameContext::GetTextContent() const
1715cdf0e10cSrcweir {
1716cdf0e10cSrcweir 	Reference < XTextContent > xTxtCntnt;
1717cdf0e10cSrcweir 	SvXMLImportContext *pContext = &m_xImplContext;
1718cdf0e10cSrcweir 	XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
1719cdf0e10cSrcweir 	if( pImpl )
1720cdf0e10cSrcweir 		xTxtCntnt.set( pImpl->GetPropSet(), UNO_QUERY );
1721cdf0e10cSrcweir 
1722cdf0e10cSrcweir 	return xTxtCntnt;
1723cdf0e10cSrcweir }
1724cdf0e10cSrcweir 
1725cdf0e10cSrcweir // --> OD 2004-08-24 #33242#
1726cdf0e10cSrcweir Reference < XShape > XMLTextFrameContext::GetShape() const
1727cdf0e10cSrcweir {
1728cdf0e10cSrcweir     Reference < XShape > xShape;
1729cdf0e10cSrcweir     SvXMLImportContext* pContext = &m_xImplContext;
1730cdf0e10cSrcweir     SvXMLShapeContext* pImpl = PTR_CAST( SvXMLShapeContext, pContext );
1731cdf0e10cSrcweir     if ( pImpl )
1732cdf0e10cSrcweir     {
1733cdf0e10cSrcweir         xShape = pImpl->getShape();
1734cdf0e10cSrcweir     }
1735cdf0e10cSrcweir 
1736cdf0e10cSrcweir     return xShape;
1737cdf0e10cSrcweir }
1738cdf0e10cSrcweir // <--
1739