LCOV - code coverage report
Current view: top level - xmloff/source/text - XMLTextFrameContext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 304 696 43.7 %
Date: 2012-08-25 Functions: 18 64 28.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 411 1528 26.9 %

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

Generated by: LCOV version 1.10