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