LCOV - code coverage report
Current view: top level - xmloff/source/draw - ximpstyl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 461 654 70.5 %
Date: 2012-08-25 Functions: 59 92 64.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 522 1181 44.2 %

           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 "ximpstyl.hxx"
      30                 :            : #include <xmloff/XMLShapeStyleContext.hxx>
      31                 :            : #include "xmloff/xmlnmspe.hxx"
      32                 :            : #include <xmloff/xmltoken.hxx>
      33                 :            : #include <xmloff/xmluconv.hxx>
      34                 :            : #include "ximpnote.hxx"
      35                 :            : #include <tools/debug.hxx>
      36                 :            : 
      37                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      38                 :            : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      39                 :            : #include <com/sun/star/presentation/XPresentationPage.hpp>
      40                 :            : #include <com/sun/star/drawing/XDrawPages.hpp>
      41                 :            : #include <com/sun/star/container/XNamed.hpp>
      42                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      43                 :            : #include <com/sun/star/beans/XPropertyState.hpp>
      44                 :            : #include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
      45                 :            : #include <comphelper/namecontainer.hxx>
      46                 :            : #include <xmloff/xmlprcon.hxx>
      47                 :            : #include <xmloff/families.hxx>
      48                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      49                 :            : #include <svl/zforlist.hxx>
      50                 :            : #include "PropertySetMerger.hxx"
      51                 :            : #include "sdpropls.hxx"
      52                 :            : #include "layerimp.hxx"
      53                 :            : #include <xmloff/XMLGraphicsDefaultStyle.hxx>
      54                 :            : #include "XMLNumberStylesImport.hxx"
      55                 :            : #include "xmloff/xmlerror.hxx"
      56                 :            : 
      57                 :            : using ::rtl::OUString;
      58                 :            : using ::rtl::OUStringBuffer;
      59                 :            : 
      60                 :            : using namespace ::com::sun::star;
      61                 :            : using namespace ::com::sun::star::uno;
      62                 :            : using namespace ::com::sun::star::xml::sax;
      63                 :            : using namespace ::xmloff::token;
      64                 :            : 
      65                 :            : //////////////////////////////////////////////////////////////////////////////
      66                 :            : 
      67                 :            : class SdXMLDrawingPagePropertySetContext : public SvXMLPropertySetContext
      68                 :            : {
      69                 :            : public:
      70                 :            : 
      71                 :            :     TYPEINFO();
      72                 :            : 
      73                 :            :     SdXMLDrawingPagePropertySetContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
      74                 :            :                 const ::rtl::OUString& rLName,
      75                 :            :                  const ::com::sun::star::uno::Reference<
      76                 :            :                          ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
      77                 :            :                  ::std::vector< XMLPropertyState > &rProps,
      78                 :            :                  const UniReference < SvXMLImportPropertyMapper > &rMap );
      79                 :            : 
      80                 :            :     virtual ~SdXMLDrawingPagePropertySetContext();
      81                 :            : 
      82                 :            :     using SvXMLPropertySetContext::CreateChildContext;
      83                 :            :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
      84                 :            :                                    const ::rtl::OUString& rLocalName,
      85                 :            :                                    const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
      86                 :            :                                    ::std::vector< XMLPropertyState > &rProperties,
      87                 :            :                                    const XMLPropertyState& rProp);
      88                 :            : };
      89                 :            : 
      90 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLDrawingPagePropertySetContext, SvXMLPropertySetContext );
      91                 :            : 
      92                 :         28 : SdXMLDrawingPagePropertySetContext::SdXMLDrawingPagePropertySetContext(
      93                 :            :                  SvXMLImport& rImport, sal_uInt16 nPrfx,
      94                 :            :                  const OUString& rLName,
      95                 :            :                  const uno::Reference< xml::sax::XAttributeList > & xAttrList,
      96                 :            :                  ::std::vector< XMLPropertyState > &rProps,
      97                 :            :                  const UniReference < SvXMLImportPropertyMapper > &rMap ) :
      98                 :            :     SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList,
      99                 :         28 :                              XML_TYPE_PROP_DRAWING_PAGE, rProps, rMap )
     100                 :            : {
     101                 :         28 : }
     102                 :            : 
     103                 :         28 : SdXMLDrawingPagePropertySetContext::~SdXMLDrawingPagePropertySetContext()
     104                 :            : {
     105         [ -  + ]:         56 : }
     106                 :            : 
     107                 :          0 : SvXMLImportContext *SdXMLDrawingPagePropertySetContext::CreateChildContext(
     108                 :            :                    sal_uInt16 p_nPrefix,
     109                 :            :                    const OUString& rLocalName,
     110                 :            :                    const uno::Reference< xml::sax::XAttributeList > & xAttrList,
     111                 :            :                    ::std::vector< XMLPropertyState > &rProperties,
     112                 :            :                    const XMLPropertyState& rProp )
     113                 :            : {
     114                 :          0 :     SvXMLImportContext *pContext = 0;
     115                 :            : 
     116         [ #  # ]:          0 :     switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
     117                 :            :     {
     118                 :            :     case CTF_PAGE_SOUND_URL:
     119                 :            :     {
     120         [ #  # ]:          0 :         const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
     121         [ #  # ]:          0 :         for(sal_Int16 i=0; i < nAttrCount; i++)
     122                 :            :         {
     123                 :          0 :             OUString aLocalName;
     124 [ #  # ][ #  # ]:          0 :             sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(xAttrList->getNameByIndex(i), &aLocalName);
                 [ #  # ]
     125                 :            : 
     126 [ #  # ][ #  # ]:          0 :             if( (nPrefix == XML_NAMESPACE_XLINK) && IsXMLToken( aLocalName, XML_HREF ) )
         [ #  # ][ #  # ]
     127                 :            :             {
     128 [ #  # ][ #  # ]:          0 :                 uno::Any aAny( GetImport().GetAbsoluteReference( xAttrList->getValueByIndex(i) ) );
         [ #  # ][ #  # ]
     129                 :          0 :                 XMLPropertyState aPropState( rProp.mnIndex, aAny );
     130         [ #  # ]:          0 :                 rProperties.push_back( aPropState );
     131                 :            :             }
     132                 :          0 :         }
     133                 :          0 :         break;
     134                 :            :     }
     135                 :            :     }
     136                 :            : 
     137         [ #  # ]:          0 :     if( !pContext )
     138                 :            :         pContext = SvXMLPropertySetContext::CreateChildContext( p_nPrefix, rLocalName,
     139                 :            :                                                             xAttrList,
     140                 :          0 :                                                             rProperties, rProp );
     141                 :            : 
     142                 :          0 :     return pContext;
     143                 :            : }
     144                 :            : 
     145                 :            : //////////////////////////////////////////////////////////////////////////////
     146                 :            : 
     147                 :            : class SdXMLDrawingPageStyleContext : public XMLPropStyleContext
     148                 :            : {
     149                 :            : public:
     150                 :            :     TYPEINFO();
     151                 :            : 
     152                 :            :     SdXMLDrawingPageStyleContext(
     153                 :            :         SvXMLImport& rImport,
     154                 :            :         sal_uInt16 nPrfx,
     155                 :            :         const rtl::OUString& rLName,
     156                 :            :         const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
     157                 :            :         SvXMLStylesContext& rStyles,
     158                 :            :         sal_uInt16 nFamily = XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID);
     159                 :            :     virtual ~SdXMLDrawingPageStyleContext();
     160                 :            : 
     161                 :            :     SvXMLImportContext * CreateChildContext(
     162                 :            :         sal_uInt16 nPrefix,
     163                 :            :         const ::rtl::OUString& rLocalName,
     164                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
     165                 :            : 
     166                 :            :     virtual void Finish( sal_Bool bOverwrite );
     167                 :            : 
     168                 :            :     // #i35918#
     169                 :            :     virtual void FillPropertySet(
     170                 :            :             const ::com::sun::star::uno::Reference<
     171                 :            :                 ::com::sun::star::beans::XPropertySet > & rPropSet );
     172                 :            : };
     173                 :            : 
     174 [ -  + ][ +  + ]:        342 : TYPEINIT1( SdXMLDrawingPageStyleContext, XMLPropStyleContext );
     175                 :            : 
     176                 :         36 : SdXMLDrawingPageStyleContext::SdXMLDrawingPageStyleContext(
     177                 :            :     SvXMLImport& rImport,
     178                 :            :     sal_uInt16 nPrfx,
     179                 :            :     const OUString& rLName,
     180                 :            :     const uno::Reference< xml::sax::XAttributeList >& xAttrList,
     181                 :            :     SvXMLStylesContext& rStyles,
     182                 :            :     sal_uInt16 nFamily)
     183                 :         36 : :   XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily )
     184                 :            : {
     185                 :         36 : }
     186                 :            : 
     187                 :         36 : SdXMLDrawingPageStyleContext::~SdXMLDrawingPageStyleContext()
     188                 :            : {
     189         [ -  + ]:         72 : }
     190                 :            : 
     191                 :         28 : SvXMLImportContext *SdXMLDrawingPageStyleContext::CreateChildContext(
     192                 :            :         sal_uInt16 nPrefix,
     193                 :            :         const OUString& rLocalName,
     194                 :            :         const uno::Reference< xml::sax::XAttributeList > & xAttrList )
     195                 :            : {
     196                 :         28 :     SvXMLImportContext *pContext = 0;
     197                 :            : 
     198   [ +  -  +  - ]:         56 :     if( XML_NAMESPACE_STYLE == nPrefix &&
                 [ +  - ]
     199                 :         28 :         IsXMLToken( rLocalName, XML_DRAWING_PAGE_PROPERTIES ) )
     200                 :            :     {
     201                 :            :         UniReference < SvXMLImportPropertyMapper > xImpPrMap =
     202         [ +  - ]:         28 :             GetStyles()->GetImportPropertyMapper( GetFamily() );
     203         [ +  - ]:         28 :         if( xImpPrMap.is() )
     204                 :         28 :             pContext = new SdXMLDrawingPagePropertySetContext( GetImport(), nPrefix,
     205                 :            :                                                     rLocalName, xAttrList,
     206                 :         28 :                                                     GetProperties(),
     207 [ +  - ][ +  - ]:         28 :                                                     xImpPrMap );
                 [ +  - ]
     208                 :            :     }
     209                 :            : 
     210         [ -  + ]:         28 :     if( !pContext )
     211                 :            :         pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
     212                 :          0 :                                                           xAttrList );
     213                 :            : 
     214                 :         28 :     return pContext;
     215                 :            : }
     216                 :            : 
     217                 :         36 : void SdXMLDrawingPageStyleContext::Finish( sal_Bool bOverwrite )
     218                 :            : {
     219         [ +  - ]:         36 :     XMLPropStyleContext::Finish( bOverwrite );
     220                 :            : 
     221                 :         36 :     ::std::vector< XMLPropertyState > &rProperties = GetProperties();
     222                 :            : 
     223 [ +  - ][ +  - ]:         36 :     const UniReference< XMLPropertySetMapper >& rImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() )->getPropertySetMapper();
                 [ +  - ]
     224                 :            : 
     225                 :         36 :     ::std::vector< XMLPropertyState >::iterator property = rProperties.begin();
     226 [ +  - ][ +  + ]:        129 :     for(; property != rProperties.end(); ++property)
     227                 :            :     {
     228         [ -  + ]:         93 :         if( property->mnIndex == -1 )
     229                 :          0 :             continue;
     230                 :            : 
     231 [ +  - ][ +  - ]:         93 :         sal_Int16 nContextID = rImpPrMap->GetEntryContextId(property->mnIndex);
     232         [ -  + ]:         93 :         switch( nContextID )
     233                 :            :         {
     234                 :            :             case CTF_DATE_TIME_FORMAT:
     235                 :            :             {
     236                 :          0 :                 OUString sStyleName;
     237                 :          0 :                 (*property).maValue >>= sStyleName;
     238                 :            : 
     239                 :          0 :                 sal_Int32 nStyle = 0;
     240                 :            : 
     241                 :            :                 SdXMLNumberFormatImportContext* pSdNumStyle =
     242 [ #  # ][ #  # ]:          0 :                     PTR_CAST( SdXMLNumberFormatImportContext,
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     243                 :            :                         GetStyles()->FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE, sStyleName, sal_True ) );
     244                 :            : 
     245         [ #  # ]:          0 :                 if( pSdNumStyle )
     246                 :          0 :                     nStyle = pSdNumStyle->GetDrawKey();
     247                 :            : 
     248         [ #  # ]:          0 :                 (*property).maValue <<= nStyle;
     249                 :            :             }
     250                 :          0 :             break;
     251                 :            :         }
     252                 :            :     }
     253                 :            : 
     254                 :         36 : }
     255                 :            : 
     256                 :            : // #i35918#
     257                 :         78 : void SdXMLDrawingPageStyleContext::FillPropertySet(
     258                 :            :     const Reference< beans::XPropertySet > & rPropSet )
     259                 :            : {
     260                 :         78 :     const sal_uInt16 MAX_SPECIAL_DRAW_STYLES = 7;
     261                 :            :     struct _ContextID_Index_Pair aContextIDs[MAX_SPECIAL_DRAW_STYLES+1] =
     262                 :            :     {
     263                 :            :         { CTF_DASHNAME , -1 },
     264                 :            :         { CTF_LINESTARTNAME , -1 },
     265                 :            :         { CTF_LINEENDNAME , -1 },
     266                 :            :         { CTF_FILLGRADIENTNAME, -1 },
     267                 :            :         { CTF_FILLTRANSNAME , -1 },
     268                 :            :         { CTF_FILLHATCHNAME , -1 },
     269                 :            :         { CTF_FILLBITMAPNAME , -1 },
     270                 :            :         { -1, -1 }
     271                 :         78 :     };
     272                 :            :     static sal_uInt16 aFamilies[MAX_SPECIAL_DRAW_STYLES] =
     273                 :            :     {
     274                 :            :         XML_STYLE_FAMILY_SD_STROKE_DASH_ID,
     275                 :            :         XML_STYLE_FAMILY_SD_MARKER_ID,
     276                 :            :         XML_STYLE_FAMILY_SD_MARKER_ID,
     277                 :            :         XML_STYLE_FAMILY_SD_GRADIENT_ID,
     278                 :            :         XML_STYLE_FAMILY_SD_GRADIENT_ID,
     279                 :            :         XML_STYLE_FAMILY_SD_HATCH_ID,
     280                 :            :         XML_STYLE_FAMILY_SD_FILL_IMAGE_ID
     281                 :            :     };
     282                 :            : 
     283                 :            :     UniReference < SvXMLImportPropertyMapper > xImpPrMap =
     284         [ +  - ]:         78 :         GetStyles()->GetImportPropertyMapper( GetFamily() );
     285                 :            :     DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
     286         [ +  - ]:         78 :     if( xImpPrMap.is() )
     287 [ +  - ][ +  - ]:         78 :         xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
     288                 :            : 
     289                 :         78 :     Reference< beans::XPropertySetInfo > xInfo;
     290         [ +  + ]:        624 :     for( sal_uInt16 i=0; i<MAX_SPECIAL_DRAW_STYLES; i++ )
     291                 :            :     {
     292                 :        546 :         sal_Int32 nIndex = aContextIDs[i].nIndex;
     293         [ -  + ]:        546 :         if( nIndex != -1 )
     294                 :            :         {
     295                 :          0 :             struct XMLPropertyState& rState = GetProperties()[nIndex];
     296                 :          0 :             OUString sStyleName;
     297                 :          0 :             rState.maValue >>= sStyleName;
     298                 :          0 :             sStyleName = GetImport().GetStyleDisplayName( aFamilies[i],
     299         [ #  # ]:          0 :                                                           sStyleName );
     300                 :            :             // get property set mapper
     301                 :            :             UniReference<XMLPropertySetMapper> rPropMapper =
     302 [ #  # ][ #  # ]:          0 :                                         xImpPrMap->getPropertySetMapper();
     303                 :            : 
     304                 :            :             // set property
     305                 :            :             const OUString& rPropertyName =
     306 [ #  # ][ #  # ]:          0 :                     rPropMapper->GetEntryAPIName(rState.mnIndex);
     307         [ #  # ]:          0 :             if( !xInfo.is() )
     308 [ #  # ][ #  # ]:          0 :                 xInfo = rPropSet->getPropertySetInfo();
                 [ #  # ]
     309 [ #  # ][ #  # ]:          0 :             if ( xInfo->hasPropertyByName( rPropertyName ) )
                 [ #  # ]
     310                 :            :             {
     311 [ #  # ][ #  # ]:          0 :                 rPropSet->setPropertyValue( rPropertyName, Any( sStyleName ) );
                 [ #  # ]
     312         [ #  # ]:          0 :             }
     313                 :            :         }
     314         [ +  - ]:         78 :     }
     315                 :         78 : }
     316                 :            : 
     317                 :            : //////////////////////////////////////////////////////////////////////////////
     318                 :            : 
     319 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLPageMasterStyleContext, SvXMLStyleContext );
     320                 :            : 
     321                 :         18 : SdXMLPageMasterStyleContext::SdXMLPageMasterStyleContext(
     322                 :            :     SdXMLImport& rImport,
     323                 :            :     sal_uInt16 nPrfx,
     324                 :            :     const OUString& rLName,
     325                 :            :     const uno::Reference< xml::sax::XAttributeList>& xAttrList)
     326                 :            : :   SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PAGEMASTERSTYLECONEXT_ID),
     327                 :            :     mnBorderBottom( 0L ),
     328                 :            :     mnBorderLeft( 0L ),
     329                 :            :     mnBorderRight( 0L ),
     330                 :            :     mnBorderTop( 0L ),
     331                 :            :     mnWidth( 0L ),
     332                 :            :     mnHeight( 0L ),
     333                 :         18 :     meOrientation(GetSdImport().IsDraw() ? view::PaperOrientation_PORTRAIT : view::PaperOrientation_LANDSCAPE)
     334                 :            : {
     335                 :            :     // set family to something special at SvXMLStyleContext
     336                 :            :     // for differences in search-methods
     337                 :            : 
     338 [ +  - ][ +  - ]:         18 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ +  - ]
     339         [ +  + ]:        144 :     for(sal_Int16 i=0; i < nAttrCount; i++)
     340                 :            :     {
     341 [ +  - ][ +  - ]:        126 :         OUString sAttrName = xAttrList->getNameByIndex(i);
     342                 :        126 :         OUString aLocalName;
     343         [ +  - ]:        126 :         sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
     344 [ +  - ][ +  - ]:        126 :         OUString sValue = xAttrList->getValueByIndex(i);
     345         [ +  - ]:        126 :         const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetPageMasterStyleAttrTokenMap();
     346                 :            : 
     347 [ +  - ][ +  +  :        126 :         switch(rAttrTokenMap.Get(nPrefix, aLocalName))
          +  +  +  +  +  
                      - ]
     348                 :            :         {
     349                 :            :             case XML_TOK_PAGEMASTERSTYLE_MARGIN_TOP:
     350                 :            :             {
     351                 :         18 :                 GetSdImport().GetMM100UnitConverter().convertMeasureToCore(
     352         [ +  - ]:         18 :                         mnBorderTop, sValue);
     353                 :         18 :                 break;
     354                 :            :             }
     355                 :            :             case XML_TOK_PAGEMASTERSTYLE_MARGIN_BOTTOM:
     356                 :            :             {
     357                 :         18 :                 GetSdImport().GetMM100UnitConverter().convertMeasureToCore(
     358         [ +  - ]:         18 :                         mnBorderBottom, sValue);
     359                 :         18 :                 break;
     360                 :            :             }
     361                 :            :             case XML_TOK_PAGEMASTERSTYLE_MARGIN_LEFT:
     362                 :            :             {
     363                 :         18 :                 GetSdImport().GetMM100UnitConverter().convertMeasureToCore(
     364         [ +  - ]:         18 :                         mnBorderLeft, sValue);
     365                 :         18 :                 break;
     366                 :            :             }
     367                 :            :             case XML_TOK_PAGEMASTERSTYLE_MARGIN_RIGHT:
     368                 :            :             {
     369                 :         18 :                 GetSdImport().GetMM100UnitConverter().convertMeasureToCore(
     370         [ +  - ]:         18 :                         mnBorderRight, sValue);
     371                 :         18 :                 break;
     372                 :            :             }
     373                 :            :             case XML_TOK_PAGEMASTERSTYLE_PAGE_WIDTH:
     374                 :            :             {
     375                 :         18 :                 GetSdImport().GetMM100UnitConverter().convertMeasureToCore(
     376         [ +  - ]:         18 :                         mnWidth, sValue);
     377                 :         18 :                 break;
     378                 :            :             }
     379                 :            :             case XML_TOK_PAGEMASTERSTYLE_PAGE_HEIGHT:
     380                 :            :             {
     381                 :         18 :                 GetSdImport().GetMM100UnitConverter().convertMeasureToCore(
     382         [ +  - ]:         18 :                         mnHeight, sValue);
     383                 :         18 :                 break;
     384                 :            :             }
     385                 :            :             case XML_TOK_PAGEMASTERSTYLE_PAGE_ORIENTATION:
     386                 :            :             {
     387 [ +  - ][ +  + ]:         18 :                 if( IsXMLToken( sValue, XML_PORTRAIT ) )
     388                 :         11 :                     meOrientation = view::PaperOrientation_PORTRAIT;
     389                 :            :                 else
     390                 :          7 :                     meOrientation = view::PaperOrientation_LANDSCAPE;
     391                 :         18 :                 break;
     392                 :            :             }
     393                 :            :         }
     394                 :        126 :     }
     395                 :         18 : }
     396                 :            : 
     397                 :            : //////////////////////////////////////////////////////////////////////////////
     398                 :            : 
     399                 :         18 : SdXMLPageMasterStyleContext::~SdXMLPageMasterStyleContext()
     400                 :            : {
     401         [ -  + ]:         36 : }
     402                 :            : 
     403                 :            : //////////////////////////////////////////////////////////////////////////////
     404                 :            : //////////////////////////////////////////////////////////////////////////////
     405                 :            : 
     406 [ +  + ][ -  + ]:        154 : TYPEINIT1( SdXMLPageMasterContext, SvXMLStyleContext );
     407                 :            : 
     408                 :         18 : SdXMLPageMasterContext::SdXMLPageMasterContext(
     409                 :            :     SdXMLImport& rImport,
     410                 :            :     sal_uInt16 nPrfx,
     411                 :            :     const OUString& rLName,
     412                 :            :     const uno::Reference< xml::sax::XAttributeList>& xAttrList)
     413                 :            : :   SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID),
     414                 :         18 :     mpPageMasterStyle( 0L )
     415                 :            : {
     416                 :            :     // set family to something special at SvXMLStyleContext
     417                 :            :     // for differences in search-methods
     418                 :            : 
     419 [ +  - ][ +  - ]:         18 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ +  - ]
     420         [ +  + ]:         36 :     for(sal_Int16 i=0; i < nAttrCount; i++)
     421                 :            :     {
     422 [ +  - ][ +  - ]:         18 :         OUString sAttrName = xAttrList->getNameByIndex(i);
     423                 :         18 :         OUString aLocalName;
     424         [ +  - ]:         18 :         sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
     425 [ +  - ][ +  - ]:         18 :         OUString sValue = xAttrList->getValueByIndex(i);
     426         [ +  - ]:         18 :         const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetPageMasterAttrTokenMap();
     427                 :            : 
     428 [ +  - ][ +  - ]:         18 :         switch(rAttrTokenMap.Get(nPrefix, aLocalName))
     429                 :            :         {
     430                 :            :             case XML_TOK_PAGEMASTER_NAME:
     431                 :            :             {
     432                 :         18 :                 msName = sValue;
     433                 :         18 :                 break;
     434                 :            :             }
     435                 :            :         }
     436                 :         18 :     }
     437                 :         18 : }
     438                 :            : 
     439                 :            : //////////////////////////////////////////////////////////////////////////////
     440                 :            : 
     441                 :         18 : SdXMLPageMasterContext::~SdXMLPageMasterContext()
     442                 :            : {
     443                 :            :     // release remembered contexts, they are no longer needed
     444         [ +  - ]:         18 :     if(mpPageMasterStyle)
     445                 :            :     {
     446         [ +  - ]:         18 :         mpPageMasterStyle->ReleaseRef();
     447                 :         18 :         mpPageMasterStyle = 0L;
     448                 :            :     }
     449         [ -  + ]:         36 : }
     450                 :            : 
     451                 :            : //////////////////////////////////////////////////////////////////////////////
     452                 :            : 
     453                 :         18 : SvXMLImportContext *SdXMLPageMasterContext::CreateChildContext(
     454                 :            :     sal_uInt16 nPrefix,
     455                 :            :     const OUString& rLocalName,
     456                 :            :     const uno::Reference< xml::sax::XAttributeList >& xAttrList )
     457                 :            : {
     458                 :         18 :     SvXMLImportContext* pContext = 0;
     459                 :            : 
     460 [ +  - ][ +  - ]:         18 :     if(nPrefix == XML_NAMESPACE_STYLE && IsXMLToken( rLocalName, XML_PAGE_LAYOUT_PROPERTIES) )
                 [ +  - ]
     461                 :            :     {
     462         [ +  - ]:         18 :         pContext = new SdXMLPageMasterStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList);
     463                 :            : 
     464                 :            :         // remember SdXMLPresentationPlaceholderContext for later evaluation
     465         [ +  - ]:         18 :         if(pContext)
     466                 :            :         {
     467                 :         18 :             pContext->AddRef();
     468                 :            :             DBG_ASSERT(!mpPageMasterStyle, "PageMasterStyle is set, there seem to be two of them (!)");
     469                 :         18 :             mpPageMasterStyle = (SdXMLPageMasterStyleContext*)pContext;
     470                 :            :         }
     471                 :            :     }
     472                 :            : 
     473                 :            :     // call base class
     474         [ -  + ]:         18 :     if(!pContext)
     475                 :          0 :         pContext = SvXMLStyleContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
     476                 :            : 
     477                 :         18 :     return pContext;
     478                 :            : }
     479                 :            : 
     480                 :            : //////////////////////////////////////////////////////////////////////////////
     481                 :            : //////////////////////////////////////////////////////////////////////////////
     482                 :            : 
     483 [ +  - ][ #  # ]:        385 : TYPEINIT1( SdXMLPresentationPageLayoutContext, SvXMLStyleContext );
     484                 :            : 
     485                 :         17 : SdXMLPresentationPageLayoutContext::SdXMLPresentationPageLayoutContext(
     486                 :            :     SdXMLImport& rImport,
     487                 :            :     sal_uInt16 nPrfx,
     488                 :            :     const OUString& rLName,
     489                 :            :     const uno::Reference< xml::sax::XAttributeList >& xAttrList)
     490                 :            : :   SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PRESENTATIONPAGELAYOUT_ID),
     491         [ +  - ]:         17 :     mnTypeId( 20 ) // AUTOLAYOUT_NONE
     492                 :            : {
     493                 :            :     // set family to somethiong special at SvXMLStyleContext
     494                 :            :     // for differences in search-methods
     495                 :            : 
     496 [ +  - ][ +  - ]:         17 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ +  - ]
     497         [ +  + ]:         34 :     for( sal_Int16 i=0; i < nAttrCount; i++ )
     498                 :            :     {
     499 [ +  - ][ +  - ]:         17 :         const OUString& rAttrName = xAttrList->getNameByIndex( i );
     500                 :         17 :         OUString aLocalName;
     501         [ +  - ]:         17 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
     502                 :            : 
     503 [ +  - ][ +  - ]:         17 :         if(nPrefix == XML_NAMESPACE_STYLE && IsXMLToken( aLocalName, XML_NAME ) )
         [ +  - ][ +  - ]
     504                 :            :         {
     505 [ +  - ][ +  - ]:         17 :             msName = xAttrList->getValueByIndex( i );
     506                 :            :         }
     507                 :         17 :     }
     508                 :         17 : }
     509                 :            : 
     510                 :         17 : SdXMLPresentationPageLayoutContext::~SdXMLPresentationPageLayoutContext()
     511                 :            : {
     512         [ -  + ]:         34 : }
     513                 :            : 
     514                 :         62 : SvXMLImportContext *SdXMLPresentationPageLayoutContext::CreateChildContext(
     515                 :            :     sal_uInt16 nPrefix,
     516                 :            :     const OUString& rLocalName,
     517                 :            :     const uno::Reference< xml::sax::XAttributeList >& xAttrList )
     518                 :            : {
     519                 :         62 :     SvXMLImportContext* pContext = 0;
     520                 :            : 
     521 [ +  - ][ +  - ]:         62 :     if(nPrefix == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_PLACEHOLDER ) )
                 [ +  - ]
     522                 :            :     {
     523                 :            :         // presentation:placeholder inside style:presentation-page-layout context
     524                 :            :         pContext = new SdXMLPresentationPlaceholderContext(
     525         [ +  - ]:         62 :             GetSdImport(), nPrefix, rLocalName, xAttrList);
     526                 :            : 
     527                 :            :         // remember SdXMLPresentationPlaceholderContext for later evaluation
     528         [ +  - ]:         62 :         if(pContext)
     529                 :            :         {
     530                 :         62 :             pContext->AddRef();
     531         [ +  - ]:         62 :             maList.push_back( (SdXMLPresentationPlaceholderContext*)pContext );
     532                 :            :         }
     533                 :            :     }
     534                 :            : 
     535                 :            :     // call base class
     536         [ -  + ]:         62 :     if(!pContext)
     537                 :          0 :         pContext = SvXMLStyleContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
     538                 :            : 
     539                 :         62 :     return pContext;
     540                 :            : }
     541                 :            : 
     542                 :         17 : void SdXMLPresentationPageLayoutContext::EndElement()
     543                 :            : {
     544                 :            :     // build presentation page layout type here
     545                 :            :     // calc mnTpeId due to content of maList
     546                 :            :     // at the moment only use number of types used there
     547         [ +  - ]:         17 :     if( !maList.empty() )
     548                 :            :     {
     549                 :         17 :         SdXMLPresentationPlaceholderContext* pObj0 = maList[ 0 ];
     550         [ +  + ]:         17 :         if( pObj0->GetName() == "handout" )
     551                 :            :         {
     552   [ -  -  -  -  :          7 :             switch( maList.size() )
                   -  + ]
     553                 :            :             {
     554                 :            :             case 1:
     555                 :          0 :                 mnTypeId = 22; // AUTOLAYOUT_HANDOUT1
     556                 :          0 :                 break;
     557                 :            :             case 2:
     558                 :          0 :                 mnTypeId = 23; // AUTOLAYOUT_HANDOUT2
     559                 :          0 :                 break;
     560                 :            :             case 3:
     561                 :          0 :                 mnTypeId = 24; // AUTOLAYOUT_HANDOUT3
     562                 :          0 :                 break;
     563                 :            :             case 4:
     564                 :          0 :                 mnTypeId = 25; // AUTOLAYOUT_HANDOUT4
     565                 :          0 :                 break;
     566                 :            :             case 9:
     567                 :          0 :                 mnTypeId = 31; // AUTOLAYOUT_HANDOUT9
     568                 :          0 :                 break;
     569                 :            :             default:
     570                 :          7 :                 mnTypeId = 26; // AUTOLAYOUT_HANDOUT6
     571                 :            :             }
     572                 :            :         }
     573                 :            :         else
     574                 :            :         {
     575   [ -  +  -  -  :         10 :             switch( maList.size() )
                -  -  - ]
     576                 :            :             {
     577                 :            :                 case 1:
     578                 :            :                 {
     579         [ #  # ]:          0 :                     if( pObj0->GetName() == "title" )
     580                 :            :                     {
     581                 :          0 :                         mnTypeId = 19; // AUTOLAYOUT_ONLY_TITLE
     582                 :            :                     }
     583                 :            :                     else
     584                 :            :                     {
     585                 :          0 :                         mnTypeId = 32; // AUTOLAYOUT_ONLY_TEXT
     586                 :            :                     }
     587                 :          0 :                     break;
     588                 :            :                 }
     589                 :            :                 case 2:
     590                 :            :                 {
     591                 :         10 :                     SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ];
     592                 :            : 
     593         [ +  + ]:         10 :                     if( pObj1->GetName() == "subtitle" )
     594                 :            :                     {
     595                 :          7 :                         mnTypeId = 0; // AUTOLAYOUT_TITLE
     596                 :            :                     }
     597         [ +  - ]:          3 :                     else if( pObj1->GetName() == "outline" )
     598                 :            :                     {
     599                 :          3 :                         mnTypeId = 1; // AUTOLAYOUT_ENUM
     600                 :            :                     }
     601         [ #  # ]:          0 :                     else if( pObj1->GetName() == "chart" )
     602                 :            :                     {
     603                 :          0 :                         mnTypeId = 2; // AUTOLAYOUT_CHART
     604                 :            :                     }
     605         [ #  # ]:          0 :                     else if( pObj1->GetName() == "table" )
     606                 :            :                     {
     607                 :          0 :                         mnTypeId = 8; // AUTOLAYOUT_TAB
     608                 :            :                     }
     609         [ #  # ]:          0 :                     else if( pObj1->GetName() == "object" )
     610                 :            :                     {
     611                 :          0 :                         mnTypeId = 11; // AUTOLAYOUT_OBJ
     612                 :            :                     }
     613         [ #  # ]:          0 :                     else if( pObj1->GetName() == "vertical_outline" )
     614                 :            :                     {
     615         [ #  # ]:          0 :                         if( pObj0->GetName() == "vertical_title" )
     616                 :            :                         {
     617                 :            :                             // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
     618                 :          0 :                             mnTypeId = 28;
     619                 :            :                         }
     620                 :            :                         else
     621                 :            :                         {
     622                 :            :                             // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
     623                 :          0 :                             mnTypeId = 29;
     624                 :            :                         }
     625                 :            :                     }
     626                 :            :                     else
     627                 :            :                     {
     628                 :          0 :                         mnTypeId = 21; // AUTOLAYOUT_NOTES
     629                 :            :                     }
     630                 :         10 :                     break;
     631                 :            :                 }
     632                 :            :                 case 3:
     633                 :            :                 {
     634                 :          0 :                     SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ];
     635                 :          0 :                     SdXMLPresentationPlaceholderContext* pObj2 = maList[ 2 ];
     636                 :            : 
     637         [ #  # ]:          0 :                     if( pObj1->GetName() == "outline" )
     638                 :            :                     {
     639         [ #  # ]:          0 :                         if( pObj2->GetName() == "outline" )
     640                 :            :                         {
     641                 :          0 :                             mnTypeId = 3; // AUTOLAYOUT_2TEXT
     642                 :            :                         }
     643         [ #  # ]:          0 :                         else if( pObj2->GetName() == "chart" )
     644                 :            :                         {
     645                 :          0 :                             mnTypeId = 4; // AUTOLAYOUT_TEXTCHART
     646                 :            :                         }
     647         [ #  # ]:          0 :                         else if( pObj2->GetName() == "graphic" )
     648                 :            :                         {
     649                 :          0 :                             mnTypeId = 6; // AUTOLAYOUT_TEXTCLIP
     650                 :            :                         }
     651                 :            :                         else
     652                 :            :                         {
     653         [ #  # ]:          0 :                             if(pObj1->GetX() < pObj2->GetX())
     654                 :            :                             {
     655                 :          0 :                                 mnTypeId = 10; // AUTOLAYOUT_TEXTOBJ -> outline left, object right
     656                 :            :                             }
     657                 :            :                             else
     658                 :            :                             {
     659                 :          0 :                                 mnTypeId = 17; // AUTOLAYOUT_TEXTOVEROBJ -> outline top, object right
     660                 :            :                             }
     661                 :            :                         }
     662                 :            :                     }
     663         [ #  # ]:          0 :                     else if( pObj1->GetName() == "chart" )
     664                 :            :                     {
     665                 :          0 :                         mnTypeId = 7; // AUTOLAYOUT_CHARTTEXT
     666                 :            :                     }
     667         [ #  # ]:          0 :                     else if( pObj1->GetName() == "graphic" )
     668                 :            :                     {
     669         [ #  # ]:          0 :                         if( pObj2->GetName() == "vertical_outline" )
     670                 :            :                         {
     671                 :            :                             // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
     672                 :          0 :                             mnTypeId = 30;
     673                 :            :                         }
     674                 :            :                         else
     675                 :            :                         {
     676                 :          0 :                             mnTypeId = 9; // AUTOLAYOUT_CLIPTEXT
     677                 :            :                         }
     678                 :            :                     }
     679         [ #  # ]:          0 :                     else if( pObj1->GetName() == "vertical_outline" )
     680                 :            :                     {
     681                 :            :                         // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
     682                 :          0 :                         mnTypeId = 27;
     683                 :            :                     }
     684                 :            :                     else
     685                 :            :                     {
     686         [ #  # ]:          0 :                         if(pObj1->GetX() < pObj2->GetX())
     687                 :            :                         {
     688                 :          0 :                             mnTypeId = 13; // AUTOLAYOUT_OBJTEXT -> left, right
     689                 :            :                         }
     690                 :            :                         else
     691                 :            :                         {
     692                 :          0 :                             mnTypeId = 14; // AUTOLAYOUT_OBJOVERTEXT -> top, bottom
     693                 :            :                         }
     694                 :            :                     }
     695                 :          0 :                     break;
     696                 :            :                 }
     697                 :            :                 case 4:
     698                 :            :                 {
     699                 :          0 :                     SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ];
     700                 :          0 :                     SdXMLPresentationPlaceholderContext* pObj2 = maList[ 2 ];
     701                 :            : 
     702         [ #  # ]:          0 :                     if( pObj1->GetName() == "object" )
     703                 :            :                     {
     704         [ #  # ]:          0 :                         if(pObj1->GetX() < pObj2->GetX())
     705                 :            :                         {
     706                 :          0 :                             mnTypeId = 16; // AUTOLAYOUT_2OBJOVERTEXT
     707                 :            :                         }
     708                 :            :                         else
     709                 :            :                         {
     710                 :          0 :                             mnTypeId = 15; // AUTOLAYOUT_2OBJTEXT
     711                 :            :                         }
     712                 :            :                     }
     713                 :            :                     else
     714                 :            :                     {
     715                 :          0 :                         mnTypeId = 12; // AUTOLAYOUT_TEXT2OBJ
     716                 :            :                     }
     717                 :          0 :                     break;
     718                 :            :                 }
     719                 :            :                 case 5:
     720                 :            :                 {
     721                 :          0 :                     SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ];
     722                 :            : 
     723         [ #  # ]:          0 :                     if( pObj1->GetName() == "object" )
     724                 :            :                     {
     725                 :          0 :                         mnTypeId = 18; // AUTOLAYOUT_4OBJ
     726                 :            :                     }
     727                 :            :                     else
     728                 :            :                     {
     729                 :          0 :                         mnTypeId = 33; // AUTOLAYOUT_4CLIPART
     730                 :            :                     }
     731                 :          0 :                      break;
     732                 :            : 
     733                 :            :                 }
     734                 :            :                 case 7:
     735                 :            :                 {
     736                 :          0 :                     mnTypeId = 33; // AUTOLAYOUT_6CLIPART
     737                 :          0 :                     break;
     738                 :            :                 }
     739                 :            :                 default:
     740                 :            :                 {
     741                 :          0 :                     mnTypeId = 20; // AUTOLAYOUT_NONE
     742                 :          0 :                     break;
     743                 :            :                 }
     744                 :            :             }
     745                 :            :         }
     746                 :            : 
     747                 :            :         // release remembered contexts, they are no longer needed
     748         [ +  + ]:         79 :         for ( size_t i = maList.size(); i > 0; )
     749                 :         62 :             maList[ --i ]->ReleaseRef();
     750                 :         17 :         maList.clear();
     751                 :            :     }
     752                 :         17 : }
     753                 :            : 
     754                 :            : //////////////////////////////////////////////////////////////////////////////
     755                 :            : //////////////////////////////////////////////////////////////////////////////
     756                 :            : 
     757                 :         62 : SdXMLPresentationPlaceholderContext::SdXMLPresentationPlaceholderContext(
     758                 :            :     SdXMLImport& rImport,
     759                 :            :     sal_uInt16 nPrfx, const
     760                 :            :     OUString& rLName,
     761                 :            :     const uno::Reference< xml::sax::XAttributeList>& xAttrList)
     762                 :            : :   SvXMLImportContext( rImport, nPrfx, rLName),
     763                 :            :     mnX(0L),
     764                 :            :     mnY(0L),
     765                 :            :     mnWidth(1L),
     766                 :         62 :     mnHeight(1L)
     767                 :            : {
     768 [ +  - ][ +  - ]:         62 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ +  - ]
     769         [ +  + ]:        372 :     for(sal_Int16 i=0; i < nAttrCount; i++)
     770                 :            :     {
     771 [ +  - ][ +  - ]:        310 :         OUString sAttrName = xAttrList->getNameByIndex(i);
     772                 :        310 :         OUString aLocalName;
     773         [ +  - ]:        310 :         sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
     774 [ +  - ][ +  - ]:        310 :         OUString sValue = xAttrList->getValueByIndex(i);
     775         [ +  - ]:        310 :         const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetPresentationPlaceholderAttrTokenMap();
     776                 :            : 
     777 [ +  - ][ +  +  :        310 :         switch(rAttrTokenMap.Get(nPrefix, aLocalName))
             +  +  +  - ]
     778                 :            :         {
     779                 :            :             case XML_TOK_PRESENTATIONPLACEHOLDER_OBJECTNAME:
     780                 :            :             {
     781                 :         62 :                 msName = sValue;
     782                 :         62 :                 break;
     783                 :            :             }
     784                 :            :             case XML_TOK_PRESENTATIONPLACEHOLDER_X:
     785                 :            :             {
     786                 :         62 :                 GetSdImport().GetMM100UnitConverter().convertMeasureToCore(
     787         [ +  - ]:         62 :                         mnX, sValue);
     788                 :         62 :                 break;
     789                 :            :             }
     790                 :            :             case XML_TOK_PRESENTATIONPLACEHOLDER_Y:
     791                 :            :             {
     792                 :         62 :                 GetSdImport().GetMM100UnitConverter().convertMeasureToCore(
     793         [ +  - ]:         62 :                         mnY, sValue);
     794                 :         62 :                 break;
     795                 :            :             }
     796                 :            :             case XML_TOK_PRESENTATIONPLACEHOLDER_WIDTH:
     797                 :            :             {
     798                 :         62 :                 GetSdImport().GetMM100UnitConverter().convertMeasureToCore(
     799         [ +  - ]:         62 :                         mnWidth, sValue);
     800                 :         62 :                 break;
     801                 :            :             }
     802                 :            :             case XML_TOK_PRESENTATIONPLACEHOLDER_HEIGHT:
     803                 :            :             {
     804                 :         62 :                 GetSdImport().GetMM100UnitConverter().convertMeasureToCore(
     805         [ +  - ]:         62 :                         mnHeight, sValue);
     806                 :         62 :                 break;
     807                 :            :             }
     808                 :            :         }
     809                 :        310 :     }
     810                 :         62 : }
     811                 :            : 
     812                 :            : //////////////////////////////////////////////////////////////////////////////
     813                 :            : 
     814                 :         62 : SdXMLPresentationPlaceholderContext::~SdXMLPresentationPlaceholderContext()
     815                 :            : {
     816         [ -  + ]:        124 : }
     817                 :            : 
     818                 :            : //////////////////////////////////////////////////////////////////////////////
     819                 :            : //////////////////////////////////////////////////////////////////////////////
     820                 :            : 
     821 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLMasterPageContext, SdXMLGenericPageContext );
     822                 :            : 
     823                 :         18 : SdXMLMasterPageContext::SdXMLMasterPageContext(
     824                 :            :     SdXMLImport& rImport,
     825                 :            :     sal_uInt16 nPrfx,
     826                 :            :     const OUString& rLName,
     827                 :            :     const uno::Reference< xml::sax::XAttributeList>& xAttrList,
     828                 :            :     uno::Reference< drawing::XShapes >& rShapes)
     829                 :         18 : :   SdXMLGenericPageContext( rImport, nPrfx, rLName, xAttrList, rShapes )
     830                 :            : {
     831         [ +  - ]:         18 :     const sal_Bool bHandoutMaster = IsXMLToken( rLName, XML_HANDOUT_MASTER );
     832                 :            : 
     833 [ +  - ][ +  - ]:         18 :     const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ +  - ]
     834         [ +  + ]:         72 :     for(sal_Int16 i=0; i < nAttrCount; i++)
     835                 :            :     {
     836 [ +  - ][ +  - ]:         54 :         OUString sAttrName = xAttrList->getNameByIndex( i );
     837                 :         54 :         OUString aLocalName;
     838         [ +  - ]:         54 :         sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
     839 [ +  - ][ +  - ]:         54 :         OUString sValue = xAttrList->getValueByIndex( i );
     840         [ +  - ]:         54 :         const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetMasterPageAttrTokenMap();
     841                 :            : 
     842 [ +  - ][ +  -  :         54 :         switch(rAttrTokenMap.Get(nPrefix, aLocalName))
          +  +  +  -  -  
                   -  - ]
     843                 :            :         {
     844                 :            :             case XML_TOK_MASTERPAGE_NAME:
     845                 :            :             {
     846                 :         11 :                 msName = sValue;
     847                 :         11 :                 break;
     848                 :            :             }
     849                 :            :             case XML_TOK_MASTERPAGE_DISPLAY_NAME:
     850                 :            :             {
     851                 :          0 :                 msDisplayName = sValue;
     852                 :          0 :                 break;
     853                 :            :             }
     854                 :            :             case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME:
     855                 :            :             {
     856                 :         18 :                 msPageMasterName = sValue;
     857                 :         18 :                 break;
     858                 :            :             }
     859                 :            :             case XML_TOK_MASTERPAGE_STYLE_NAME:
     860                 :            :             {
     861                 :         18 :                 msStyleName = sValue;
     862                 :         18 :                 break;
     863                 :            :             }
     864                 :            :             case XML_TOK_MASTERPAGE_PAGE_LAYOUT_NAME:
     865                 :            :             {
     866                 :          7 :                 maPageLayoutName = sValue;
     867                 :          7 :                 break;
     868                 :            :             }
     869                 :            :             case XML_TOK_MASTERPAGE_USE_HEADER_NAME:
     870                 :            :             {
     871                 :          0 :                 maUseHeaderDeclName =  sValue;
     872                 :          0 :                 break;
     873                 :            :             }
     874                 :            :             case XML_TOK_MASTERPAGE_USE_FOOTER_NAME:
     875                 :            :             {
     876                 :          0 :                 maUseFooterDeclName =  sValue;
     877                 :          0 :                 break;
     878                 :            :             }
     879                 :            :             case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME:
     880                 :            :             {
     881                 :          0 :                 maUseDateTimeDeclName =  sValue;
     882                 :          0 :                 break;
     883                 :            :             }
     884                 :            :         }
     885                 :         54 :     }
     886                 :            : 
     887         [ +  - ]:         18 :     if( msDisplayName.isEmpty() )
     888                 :         18 :         msDisplayName = msName;
     889         [ #  # ]:          0 :     else if( msDisplayName != msName )
     890         [ #  # ]:          0 :         GetImport().AddStyleDisplayName( XML_STYLE_FAMILY_MASTER_PAGE, msName, msDisplayName );
     891                 :            : 
     892 [ +  - ][ +  - ]:         18 :     GetImport().GetShapeImport()->startPage( GetLocalShapesContext() );
         [ +  - ][ +  - ]
     893                 :            : 
     894                 :            :     // set page name?
     895 [ +  + ][ +  - ]:         18 :     if(!bHandoutMaster && !msDisplayName.isEmpty() && GetLocalShapesContext().is())
         [ +  - ][ +  + ]
     896                 :            :     {
     897         [ +  - ]:         11 :         uno::Reference < container::XNamed > xNamed(GetLocalShapesContext(), uno::UNO_QUERY);
     898         [ +  - ]:         11 :         if(xNamed.is())
     899 [ +  - ][ +  - ]:         11 :             xNamed->setName(msDisplayName);
     900                 :            :     }
     901                 :            : 
     902                 :            :     // set page-master?
     903         [ +  - ]:         18 :     if(!msPageMasterName.isEmpty())
     904                 :            :     {
     905         [ +  - ]:         18 :         SetPageMaster( msPageMasterName );
     906                 :            :     }
     907                 :            : 
     908         [ +  - ]:         18 :     SetStyle( msStyleName );
     909                 :            : 
     910         [ +  - ]:         18 :     SetLayout();
     911                 :            : 
     912         [ +  - ]:         18 :     DeleteAllShapes();
     913                 :         18 : }
     914                 :            : 
     915                 :            : //////////////////////////////////////////////////////////////////////////////
     916                 :            : 
     917                 :         18 : SdXMLMasterPageContext::~SdXMLMasterPageContext()
     918                 :            : {
     919         [ -  + ]:         36 : }
     920                 :            : 
     921                 :            : //////////////////////////////////////////////////////////////////////////////
     922                 :            : 
     923                 :         18 : void SdXMLMasterPageContext::EndElement()
     924                 :            : {
     925                 :            :     // set styles on master-page
     926 [ +  + ][ +  - ]:         18 :     if(!msName.isEmpty() && GetSdImport().GetShapeImport()->GetStylesContext())
         [ +  - ][ +  - ]
                 [ +  + ]
           [ +  +  #  # ]
     927                 :            :     {
     928         [ +  - ]:         11 :         SvXMLImportContext* pContext = GetSdImport().GetShapeImport()->GetStylesContext();
     929 [ +  - ][ +  - ]:         11 :         if( pContext && pContext->ISA( SvXMLStyleContext ) )
                 [ +  - ]
     930                 :         11 :             ((SdXMLStylesContext*)pContext)->SetMasterPageStyles(*this);
     931                 :            :     }
     932                 :            : 
     933                 :         18 :     SdXMLGenericPageContext::EndElement();
     934 [ +  - ][ +  - ]:         18 :     GetImport().GetShapeImport()->endPage(GetLocalShapesContext());
     935                 :         18 : }
     936                 :            : 
     937                 :            : //////////////////////////////////////////////////////////////////////////////
     938                 :            : 
     939                 :         98 : SvXMLImportContext* SdXMLMasterPageContext::CreateChildContext(
     940                 :            :     sal_uInt16 nPrefix,
     941                 :            :     const OUString& rLocalName,
     942                 :            :     const uno::Reference< xml::sax::XAttributeList>& xAttrList )
     943                 :            : {
     944                 :         98 :     SvXMLImportContext* pContext = 0;
     945                 :         98 :     const SvXMLTokenMap& rTokenMap = GetSdImport().GetMasterPageElemTokenMap();
     946                 :            : 
     947                 :            :     // some special objects inside style:masterpage context
     948      [ -  +  + ]:         98 :     switch(rTokenMap.Get(nPrefix, rLocalName))
     949                 :            :     {
     950                 :            :         case XML_TOK_MASTERPAGE_STYLE:
     951                 :            :         {
     952 [ #  # ][ #  # ]:          0 :             if(GetSdImport().GetShapeImport()->GetStylesContext())
     953                 :            :             {
     954                 :            :                 // style:style inside master-page context -> presentation style
     955                 :            :                 XMLShapeStyleContext* pNew = new XMLShapeStyleContext(
     956                 :          0 :                     GetSdImport(), nPrefix, rLocalName, xAttrList,
     957         [ #  # ]:          0 :                     *GetSdImport().GetShapeImport()->GetStylesContext(),
     958 [ #  # ][ #  # ]:          0 :                     XML_STYLE_FAMILY_SD_PRESENTATION_ID);
     959                 :            : 
     960                 :            :                 // add this style to the outer StylesContext class for later processing
     961         [ #  # ]:          0 :                 if(pNew)
     962                 :            :                 {
     963                 :          0 :                     pContext = pNew;
     964 [ #  # ][ #  # ]:          0 :                     GetSdImport().GetShapeImport()->GetStylesContext()->AddStyle(*pNew);
     965                 :            :                 }
     966                 :            :             }
     967                 :          0 :             break;
     968                 :            :         }
     969                 :            :         case XML_TOK_MASTERPAGE_NOTES:
     970                 :            :         {
     971         [ +  - ]:          7 :             if( GetSdImport().IsImpress() )
     972                 :            :             {
     973                 :            :                 // get notes page
     974         [ +  - ]:          7 :                 uno::Reference< presentation::XPresentationPage > xPresPage(GetLocalShapesContext(), uno::UNO_QUERY);
     975         [ +  - ]:          7 :                 if(xPresPage.is())
     976                 :            :                 {
     977 [ +  - ][ +  - ]:          7 :                     uno::Reference< drawing::XDrawPage > xNotesDrawPage(xPresPage->getNotesPage(), uno::UNO_QUERY);
                 [ +  - ]
     978         [ +  - ]:          7 :                     if(xNotesDrawPage.is())
     979                 :            :                     {
     980         [ +  - ]:          7 :                         uno::Reference< drawing::XShapes > xNewShapes(xNotesDrawPage, uno::UNO_QUERY);
     981         [ +  - ]:          7 :                         if(xNewShapes.is())
     982                 :            :                         {
     983                 :            :                             // presentation:notes inside master-page context
     984 [ +  - ][ +  - ]:          7 :                             pContext = new SdXMLNotesContext( GetSdImport(), nPrefix, rLocalName, xAttrList, xNewShapes);
     985                 :          7 :                         }
     986                 :          7 :                     }
     987                 :          7 :                 }
     988                 :            :             }
     989                 :            :         }
     990                 :            :     }
     991                 :            : 
     992                 :            :     // call base class
     993         [ +  + ]:         98 :     if(!pContext)
     994                 :         91 :         pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
     995                 :            : 
     996                 :         98 :     return pContext;
     997                 :            : }
     998                 :            : 
     999                 :            : //////////////////////////////////////////////////////////////////////////////
    1000                 :            : //////////////////////////////////////////////////////////////////////////////
    1001                 :            : 
    1002 [ -  + ][ +  - ]:        288 : TYPEINIT1( SdXMLStylesContext, SvXMLStyleContext );
    1003                 :            : 
    1004                 :         33 : SdXMLStylesContext::SdXMLStylesContext(
    1005                 :            :     SdXMLImport& rImport,
    1006                 :            :     sal_uInt16 nPrfx,
    1007                 :            :     const OUString& rLName,
    1008                 :            :     const uno::Reference< xml::sax::XAttributeList >& xAttrList,
    1009                 :            :     sal_Bool bIsAutoStyle)
    1010                 :            : :   SvXMLStylesContext(rImport, nPrfx, rLName, xAttrList),
    1011                 :         33 :     mbIsAutoStyle(bIsAutoStyle)
    1012                 :            : {
    1013         [ +  - ]:         33 :     Reference< lang::XMultiServiceFactory > xMSF = rImport.getServiceFactory();
    1014 [ +  - ][ +  - ]:         33 :     mpNumFormatter = new SvNumberFormatter( xMSF, LANGUAGE_SYSTEM );
    1015 [ +  - ][ +  - ]:         33 :     mpNumFmtHelper = new SvXMLNumFmtHelper( mpNumFormatter, xMSF );
    1016                 :         33 : }
    1017                 :            : 
    1018                 :            : //////////////////////////////////////////////////////////////////////////////
    1019                 :            : 
    1020         [ +  - ]:         33 : SdXMLStylesContext::~SdXMLStylesContext()
    1021                 :            : {
    1022 [ +  - ][ +  - ]:         33 :     delete mpNumFmtHelper;
    1023 [ +  - ][ +  - ]:         33 :     delete mpNumFormatter;
    1024         [ -  + ]:         66 : }
    1025                 :            : 
    1026                 :            : //////////////////////////////////////////////////////////////////////////////
    1027                 :            : 
    1028                 :        592 : SvXMLStyleContext* SdXMLStylesContext::CreateStyleChildContext(
    1029                 :            :     sal_uInt16 nPrefix,
    1030                 :            :     const OUString& rLocalName,
    1031                 :            :     const uno::Reference< xml::sax::XAttributeList >& xAttrList)
    1032                 :            : {
    1033                 :        592 :     SvXMLStyleContext* pContext = 0;
    1034                 :        592 :     const SvXMLTokenMap& rStyleTokenMap = GetSdImport().GetStylesElemTokenMap();
    1035                 :            : 
    1036      [ +  +  + ]:        592 :     switch(rStyleTokenMap.Get(nPrefix, rLocalName))
    1037                 :            :     {
    1038                 :            :         case XML_TOK_STYLES_PAGE_MASTER:
    1039                 :            :         {
    1040                 :            :             // style:page-master inside office:styles context
    1041         [ +  - ]:         18 :             pContext = new SdXMLPageMasterContext(GetSdImport(), nPrefix, rLocalName, xAttrList);
    1042                 :         18 :             break;
    1043                 :            :         }
    1044                 :            :         case XML_TOK_STYLES_PRESENTATION_PAGE_LAYOUT:
    1045                 :            :         {
    1046                 :            :             // style:presentation-page-layout inside office:styles context
    1047         [ +  - ]:         17 :             pContext = new SdXMLPresentationPageLayoutContext(GetSdImport(), nPrefix, rLocalName, xAttrList);
    1048                 :         17 :             break;
    1049                 :            :         }
    1050                 :            :     }
    1051                 :            : 
    1052         [ +  + ]:        592 :     if(!pContext)
    1053                 :            :     {
    1054                 :        557 :         const SvXMLTokenMap& rTokenMap = mpNumFmtHelper->GetStylesElemTokenMap();
    1055                 :        557 :         sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
    1056      [ -  -  + ]:        557 :         switch (nToken)
    1057                 :            :         {
    1058                 :            :             case XML_TOK_STYLES_DATE_STYLE:
    1059                 :            :             case XML_TOK_STYLES_TIME_STYLE:
    1060                 :            :                 // number:date-style or number:time-style
    1061         [ #  # ]:          0 :                 pContext = new SdXMLNumberFormatImportContext( GetSdImport(), nPrefix, rLocalName, mpNumFmtHelper->getData(), nToken, xAttrList, *this );
    1062                 :          0 :                 break;
    1063                 :            : 
    1064                 :            :             case XML_TOK_STYLES_NUMBER_STYLE:
    1065                 :            :             case XML_TOK_STYLES_CURRENCY_STYLE:
    1066                 :            :             case XML_TOK_STYLES_PERCENTAGE_STYLE:
    1067                 :            :             case XML_TOK_STYLES_BOOLEAN_STYLE:
    1068                 :            :             case XML_TOK_STYLES_TEXT_STYLE:
    1069                 :          0 :                 pContext = new SvXMLNumFormatContext( GetSdImport(), nPrefix, rLocalName,
    1070         [ #  # ]:          0 :                                                         mpNumFmtHelper->getData(), nToken, xAttrList, *this );
    1071                 :        557 :                 break;
    1072                 :            :         }
    1073                 :            :     }
    1074                 :            : 
    1075 [ +  + ][ -  + ]:        592 :     if(!pContext && nPrefix == XML_NAMESPACE_PRESENTATION )
    1076                 :            :     {
    1077   [ #  #  #  #  :          0 :         if( IsXMLToken( rLocalName, XML_HEADER_DECL ) ||
           #  # ][ #  # ]
    1078                 :          0 :             IsXMLToken( rLocalName, XML_FOOTER_DECL ) ||
    1079                 :          0 :             IsXMLToken( rLocalName, XML_DATE_TIME_DECL ) )
    1080                 :            :         {
    1081         [ #  # ]:          0 :             pContext = new SdXMLHeaderFooterDeclContext( GetImport(), nPrefix, rLocalName, xAttrList );
    1082                 :            :         }
    1083                 :            :     }
    1084                 :            : 
    1085 [ +  + ][ +  + ]:        592 :     if(!pContext && (nPrefix == XML_NAMESPACE_TABLE) && IsXMLToken( rLocalName, XML_TABLE_TEMPLATE ) )
         [ +  - ][ +  + ]
    1086                 :            :     {
    1087 [ +  - ][ +  - ]:          3 :         pContext = GetImport().GetShapeImport()->GetShapeTableImport()->CreateTableTemplateContext(nPrefix, rLocalName, xAttrList );
                 [ +  - ]
    1088                 :            :     }
    1089                 :            : 
    1090                 :            :     // call base class
    1091         [ +  + ]:        592 :     if(!pContext)
    1092                 :        554 :         pContext = SvXMLStylesContext::CreateStyleChildContext(nPrefix, rLocalName, xAttrList);
    1093                 :            : 
    1094                 :        592 :     return pContext;
    1095                 :            : }
    1096                 :            : 
    1097                 :            : //////////////////////////////////////////////////////////////////////////////
    1098                 :            : 
    1099                 :        488 : SvXMLStyleContext* SdXMLStylesContext::CreateStyleStyleChildContext(
    1100                 :            :     sal_uInt16 nFamily,
    1101                 :            :     sal_uInt16 nPrefix,
    1102                 :            :     const OUString& rLocalName,
    1103                 :            :     const uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList)
    1104                 :            : {
    1105                 :        488 :     SvXMLStyleContext* pContext = 0;
    1106                 :            : 
    1107      [ +  +  + ]:        488 :     switch( nFamily )
    1108                 :            :     {
    1109                 :            :     case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
    1110         [ +  - ]:         36 :         pContext = new SdXMLDrawingPageStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList, *this );
    1111                 :         36 :         break;
    1112                 :            :     case XML_STYLE_FAMILY_TABLE_CELL:
    1113                 :            :     case XML_STYLE_FAMILY_TABLE_COLUMN:
    1114                 :            :     case XML_STYLE_FAMILY_TABLE_ROW:
    1115         [ +  - ]:         30 :         pContext = new XMLShapeStyleContext( GetSdImport(), nPrefix, rLocalName, xAttrList, *this, nFamily );
    1116                 :         30 :         break;
    1117                 :            :     }
    1118                 :            : 
    1119                 :            :     // call base class
    1120         [ +  + ]:        488 :     if(!pContext)
    1121                 :        422 :         pContext = SvXMLStylesContext::CreateStyleStyleChildContext(nFamily, nPrefix, rLocalName, xAttrList);
    1122                 :            : 
    1123                 :        488 :     return pContext;
    1124                 :            : }
    1125                 :            : 
    1126                 :            : //////////////////////////////////////////////////////////////////////////////
    1127                 :            : 
    1128                 :         11 : SvXMLStyleContext* SdXMLStylesContext::CreateDefaultStyleStyleChildContext(
    1129                 :            :     sal_uInt16 nFamily,
    1130                 :            :     sal_uInt16 nPrefix,
    1131                 :            :     const OUString& rLocalName,
    1132                 :            :     const Reference< XAttributeList > & xAttrList )
    1133                 :            : {
    1134                 :         11 :     SvXMLStyleContext* pContext = 0;
    1135                 :            : 
    1136         [ +  - ]:         11 :     switch( nFamily )
    1137                 :            :     {
    1138                 :            :     case XML_STYLE_FAMILY_SD_GRAPHICS_ID:
    1139         [ +  - ]:         11 :         pContext = new XMLGraphicsDefaultStyle(GetSdImport(), nPrefix, rLocalName, xAttrList, *this );
    1140                 :         11 :         break;
    1141                 :            :     }
    1142                 :            : 
    1143                 :            :     // call base class
    1144         [ -  + ]:         11 :     if(!pContext)
    1145                 :          0 :         pContext = SvXMLStylesContext::CreateDefaultStyleStyleChildContext(nFamily, nPrefix, rLocalName, xAttrList);
    1146                 :            : 
    1147                 :         11 :     return pContext;
    1148                 :            : }
    1149                 :            : 
    1150                 :            : //////////////////////////////////////////////////////////////////////////////
    1151                 :            : 
    1152                 :        499 : sal_uInt16 SdXMLStylesContext::GetFamily( const OUString& rFamily ) const
    1153                 :            : {
    1154                 :            :     // call base class
    1155                 :        499 :     return SvXMLStylesContext::GetFamily(rFamily);
    1156                 :            : }
    1157                 :            : 
    1158                 :            : //////////////////////////////////////////////////////////////////////////////
    1159                 :            : 
    1160                 :       2751 : UniReference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropertyMapper(
    1161                 :            :     sal_uInt16 nFamily) const
    1162                 :            : {
    1163                 :       2751 :     UniReference < SvXMLImportPropertyMapper > xMapper;
    1164                 :            : 
    1165      [ +  +  + ]:       2751 :     switch( nFamily )
    1166                 :            :     {
    1167                 :            :     case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
    1168                 :            :     {
    1169         [ +  + ]:        142 :         if(!xPresImpPropMapper.is())
    1170                 :            :         {
    1171         [ +  - ]:         22 :             UniReference< XMLShapeImportHelper > aImpHelper = ((SvXMLImport&)GetImport()).GetShapeImport();
    1172                 :            :             ((SdXMLStylesContext*)this)->xPresImpPropMapper =
    1173 [ +  - ][ +  - ]:         22 :                 aImpHelper->GetPresPagePropsMapper();
                 [ +  - ]
    1174                 :            :         }
    1175         [ +  - ]:        142 :         xMapper = xPresImpPropMapper;
    1176                 :        142 :         break;
    1177                 :            :     }
    1178                 :            : 
    1179                 :            :     case XML_STYLE_FAMILY_TABLE_COLUMN:
    1180                 :            :     case XML_STYLE_FAMILY_TABLE_ROW:
    1181                 :            :     case XML_STYLE_FAMILY_TABLE_CELL:
    1182                 :            :     {
    1183 [ +  - ][ +  - ]:        192 :         const rtl::Reference< XMLTableImport >& xTableImport( const_cast< SvXMLImport& >( GetImport() ).GetShapeImport()->GetShapeTableImport() );
         [ +  - ][ +  - ]
    1184                 :            : 
    1185   [ +  +  +  - ]:        192 :         switch( nFamily )
    1186                 :            :         {
    1187 [ +  - ][ +  - ]:         42 :         case XML_STYLE_FAMILY_TABLE_COLUMN: xMapper = xTableImport->GetColumnImportPropertySetMapper().get(); break;
                 [ +  - ]
    1188 [ +  - ][ +  - ]:         42 :         case XML_STYLE_FAMILY_TABLE_ROW: xMapper = xTableImport->GetRowImportPropertySetMapper().get(); break;
                 [ +  - ]
    1189 [ +  - ][ +  - ]:        108 :         case XML_STYLE_FAMILY_TABLE_CELL: xMapper = xTableImport->GetCellImportPropertySetMapper().get(); break;
                 [ +  - ]
    1190                 :            :         }
    1191                 :        192 :         break;
    1192                 :            :     }
    1193                 :            :     }
    1194                 :            : 
    1195                 :            :     // call base class
    1196         [ +  + ]:       2751 :     if( !xMapper.is() )
    1197 [ +  - ][ +  - ]:       2417 :         xMapper = SvXMLStylesContext::GetImportPropertyMapper(nFamily);
                 [ +  - ]
    1198                 :       2751 :     return xMapper;
    1199                 :            : }
    1200                 :            : 
    1201                 :            : //////////////////////////////////////////////////////////////////////////////
    1202                 :            : // Process all style and object info
    1203                 :            : //
    1204                 :         33 : void SdXMLStylesContext::EndElement()
    1205                 :            : {
    1206         [ +  + ]:         33 :     if(mbIsAutoStyle)
    1207                 :            :     {
    1208                 :            :         // AutoStyles for text import
    1209 [ +  - ][ +  - ]:         22 :         GetImport().GetTextImport()->SetAutoStyles( this );
    1210                 :            : 
    1211                 :            :         // AutoStyles for chart
    1212         [ +  - ]:         22 :         GetImport().GetChartImport()->SetAutoStylesContext( this );
    1213                 :            : 
    1214                 :            :         // AutoStyles for forms
    1215 [ +  - ][ +  - ]:         22 :         GetImport().GetFormImport()->setAutoStyleContext( this );
    1216                 :            : 
    1217                 :            :         // associate AutoStyles with styles in preparation to setting Styles on shapes
    1218         [ +  + ]:        267 :         for(sal_uInt32 a(0L); a < GetStyleCount(); a++)
    1219                 :            :         {
    1220                 :        245 :             const SvXMLStyleContext* pStyle = GetStyle(a);
    1221 [ +  + ][ +  + ]:        245 :             if(pStyle && pStyle->ISA(XMLShapeStyleContext))
                 [ +  - ]
    1222                 :            :             {
    1223                 :        147 :                 XMLShapeStyleContext* pDocStyle = (XMLShapeStyleContext*)pStyle;
    1224                 :            : 
    1225         [ +  - ]:        147 :                 SvXMLStylesContext* pStylesContext = GetSdImport().GetShapeImport()->GetStylesContext();
    1226         [ +  + ]:        147 :                 if( pStylesContext )
    1227                 :            :                 {
    1228                 :         35 :                     pStyle = pStylesContext->FindStyleChildContext(pStyle->GetFamily(), pStyle->GetParentName());
    1229                 :            : 
    1230 [ +  - ][ +  - ]:         35 :                     if(pStyle && pStyle->ISA(XMLShapeStyleContext))
                 [ +  - ]
    1231                 :            :                     {
    1232                 :         35 :                         XMLShapeStyleContext* pParentStyle = (XMLShapeStyleContext*)pStyle;
    1233         [ +  + ]:         35 :                         if(pParentStyle->GetStyle().is())
    1234                 :            :                         {
    1235                 :         14 :                             pDocStyle->SetStyle(pParentStyle->GetStyle());
    1236                 :            :                         }
    1237                 :            :                     }
    1238                 :            :                 }
    1239                 :            :             }
    1240                 :            :         }
    1241                 :            : 
    1242                 :         22 :         FinishStyles( false );
    1243                 :            :     }
    1244                 :            :     else
    1245                 :            :     {
    1246                 :            :         // Process styles list
    1247         [ +  - ]:         11 :         ImpSetGraphicStyles();
    1248         [ +  - ]:         11 :         ImpSetCellStyles();
    1249 [ +  - ][ +  - ]:         11 :         GetImport().GetShapeImport()->GetShapeTableImport()->finishStyles();
         [ +  - ][ +  - ]
                 [ +  - ]
    1250                 :            : 
    1251                 :            :         // put style infos in the info set for other components ( content import f.e. )
    1252         [ +  - ]:         11 :         uno::Reference< beans::XPropertySet > xInfoSet( GetImport().getImportInfo() );
    1253         [ +  - ]:         11 :         if( xInfoSet.is() )
    1254                 :            :         {
    1255 [ +  - ][ +  - ]:         11 :             uno::Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
    1256                 :            : 
    1257 [ +  - ][ +  - ]:         11 :             if( xInfoSetInfo->hasPropertyByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayouts" ) ) ) )
         [ +  - ][ +  - ]
    1258 [ +  - ][ +  - ]:         11 :                 xInfoSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayouts" ) ), uno::makeAny( getPageLayouts() ) );
         [ +  - ][ +  - ]
                 [ +  - ]
    1259                 :         11 :         }
    1260                 :            : 
    1261                 :            :     }
    1262                 :         33 : }
    1263                 :            : 
    1264                 :            : //////////////////////////////////////////////////////////////////////////////
    1265                 :            : // set master-page styles (all with family="presentation" and a special
    1266                 :            : // prefix) on given master-page.
    1267                 :            : //
    1268                 :         11 : void SdXMLStylesContext::SetMasterPageStyles(SdXMLMasterPageContext& rMaster) const
    1269                 :            : {
    1270                 :            :     const uno::Reference<container::XNameAccess>& rStyleFamilies =
    1271                 :         11 :         GetSdImport().GetLocalDocStyleFamilies();
    1272                 :            : 
    1273         [ -  + ]:         11 :     if (!rStyleFamilies.is())
    1274                 :          0 :         return;
    1275                 :            : 
    1276         [ -  + ]:         11 :     if (!rStyleFamilies->hasByName(rMaster.GetDisplayName()))
    1277                 :          0 :         return;
    1278                 :            : 
    1279                 :            :     try
    1280                 :            :     {
    1281 [ +  - ][ +  - ]:         11 :         uno::Reference< container::XNameAccess > xMasterPageStyles( rStyleFamilies->getByName(rMaster.GetDisplayName()), UNO_QUERY_THROW );
                 [ +  - ]
    1282                 :         11 :         rtl::OUString sPrefix(rMaster.GetDisplayName());
    1283                 :         11 :         sPrefix += rtl::OUString(static_cast<sal_Unicode>('-'));
    1284 [ #  # ][ +  - ]:         11 :         ImpSetGraphicStyles(xMasterPageStyles, XML_STYLE_FAMILY_SD_PRESENTATION_ID, sPrefix);
    1285                 :            :     }
    1286                 :          0 :     catch (const uno::Exception&)
    1287                 :            :     {
    1288                 :            :         OSL_FAIL( "xmloff::SdXMLStylesContext::SetMasterPageStyles(), exception caught!" );
    1289                 :            :     }
    1290                 :            : }
    1291                 :            : 
    1292                 :            : //////////////////////////////////////////////////////////////////////////////
    1293                 :            : // Process styles list:
    1294                 :            : // set graphic styles (all with family="graphics"). Remember xStyle at list element.
    1295                 :            : //
    1296                 :         11 : void SdXMLStylesContext::ImpSetGraphicStyles() const
    1297                 :            : {
    1298         [ +  - ]:         11 :     if(GetSdImport().GetLocalDocStyleFamilies().is()) try
    1299                 :            :     {
    1300         [ +  - ]:         11 :         const OUString sGraphicStyleName(OUString(RTL_CONSTASCII_USTRINGPARAM("graphics")));
    1301 [ +  - ][ +  - ]:         11 :         uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sGraphicStyleName), uno::UNO_QUERY_THROW );
                 [ +  - ]
    1302                 :            : 
    1303 [ #  # ][ +  - ]:         11 :         ImpSetGraphicStyles(xGraphicPageStyles, XML_STYLE_FAMILY_SD_GRAPHICS_ID, rtl::OUString());
    1304                 :            :     }
    1305                 :          0 :     catch( uno::Exception& )
    1306                 :            :     {
    1307                 :            :         OSL_FAIL( "xmloff::SdXMLStylesContext::ImpSetGraphicStyles(), exception caught!" );
    1308                 :            :     }
    1309                 :         11 : }
    1310                 :            : 
    1311                 :         11 : void SdXMLStylesContext::ImpSetCellStyles() const
    1312                 :            : {
    1313         [ +  - ]:         11 :     if(GetSdImport().GetLocalDocStyleFamilies().is()) try
    1314                 :            :     {
    1315         [ +  - ]:         11 :         const OUString sCellStyleName(OUString(RTL_CONSTASCII_USTRINGPARAM("cell")));
    1316 [ +  - ][ +  - ]:         11 :         uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sCellStyleName), uno::UNO_QUERY_THROW );
                 [ +  - ]
    1317                 :            : 
    1318 [ #  # ][ +  - ]:         11 :         ImpSetGraphicStyles(xGraphicPageStyles, XML_STYLE_FAMILY_TABLE_CELL, rtl::OUString());
    1319                 :            :     }
    1320                 :          0 :     catch( uno::Exception& )
    1321                 :            :     {
    1322                 :            :         OSL_FAIL( "xmloff::SdXMLStylesContext::ImpSetCellStyles(), exception caught!" );
    1323                 :            :     }
    1324                 :         11 : }
    1325                 :            : 
    1326                 :            : //////////////////////////////////////////////////////////////////////////////
    1327                 :            : // help function used by ImpSetGraphicStyles() and ImpSetMasterPageStyles()
    1328                 :            : //
    1329                 :         33 : void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAccess >& xPageStyles,  sal_uInt16 nFamily,  const rtl::OUString& rPrefix) const
    1330                 :            : {
    1331                 :         33 :     sal_Int32 nPrefLen(rPrefix.getLength());
    1332                 :            : 
    1333                 :            :     sal_uInt32 a;
    1334                 :            : 
    1335                 :            :     // set defaults
    1336         [ +  + ]:        951 :     for( a = 0; a < GetStyleCount(); a++)
    1337                 :            :     {
    1338                 :        918 :         const SvXMLStyleContext* pStyle = GetStyle(a);
    1339                 :            : 
    1340 [ +  + ][ +  + ]:        918 :         if(nFamily == pStyle->GetFamily() && pStyle->IsDefaultStyle())
                 [ +  + ]
    1341                 :            :         {
    1342                 :         11 :             ((SvXMLStyleContext*)pStyle)->SetDefaults();
    1343                 :            :         }
    1344                 :            :     }
    1345                 :            : 
    1346                 :            :     // create all styles and set properties
    1347         [ +  + ]:        951 :     for( a = 0; a < GetStyleCount(); a++)
    1348                 :            :     {
    1349                 :            :         try
    1350                 :            :         {
    1351         [ +  - ]:        918 :             const SvXMLStyleContext* pStyle = GetStyle(a);
    1352 [ +  + ][ +  + ]:        918 :             if(nFamily == pStyle->GetFamily() && !pStyle->IsDefaultStyle())
                 [ +  + ]
    1353                 :            :             {
    1354                 :        275 :                 OUString aStyleName(pStyle->GetDisplayName());
    1355         [ +  + ]:        275 :                 if( nPrefLen )
    1356                 :            :                 {
    1357                 :         98 :                     sal_Int32 nStylePrefLen = aStyleName.lastIndexOf( sal_Unicode('-') ) + 1;
    1358 [ -  + ][ -  + ]:         98 :                     if( (nPrefLen != nStylePrefLen) ||  (aStyleName.compareTo( rPrefix, nPrefLen ) != 0) )
                 [ +  - ]
    1359                 :          0 :                         continue;
    1360                 :            : 
    1361                 :         98 :                     aStyleName = aStyleName.copy( nPrefLen );
    1362                 :            :                 }
    1363                 :            : 
    1364                 :        275 :                 uno::Reference< style::XStyle > xStyle;
    1365 [ +  - ][ +  - ]:        275 :                 if(xPageStyles->hasByName(aStyleName))
                 [ +  - ]
    1366                 :            :                 {
    1367 [ +  - ][ +  - ]:        275 :                     xPageStyles->getByName(aStyleName) >>= xStyle;
                 [ +  - ]
    1368                 :            : 
    1369                 :            :                     // set properties of existing styles to default
    1370         [ +  - ]:        275 :                     uno::Reference< beans::XPropertySet > xPropSet( xStyle, uno::UNO_QUERY );
    1371                 :        275 :                     uno::Reference< beans::XPropertySetInfo > xPropSetInfo;
    1372         [ +  - ]:        275 :                     if( xPropSet.is() )
    1373 [ +  - ][ +  - ]:        275 :                         xPropSetInfo = xPropSet->getPropertySetInfo();
                 [ +  - ]
    1374                 :            : 
    1375         [ +  - ]:        275 :                     uno::Reference< beans::XPropertyState > xPropState( xStyle, uno::UNO_QUERY );
    1376                 :            : 
    1377         [ +  - ]:        275 :                     if( xPropState.is() )
    1378                 :            :                     {
    1379                 :        275 :                         UniReference < XMLPropertySetMapper > xPrMap;
    1380         [ +  - ]:        275 :                         UniReference < SvXMLImportPropertyMapper > xImpPrMap = GetImportPropertyMapper( nFamily );
    1381                 :            :                         DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
    1382         [ +  - ]:        275 :                         if( xImpPrMap.is() )
    1383 [ +  - ][ +  - ]:        275 :                             xPrMap = xImpPrMap->getPropertySetMapper();
    1384         [ +  - ]:        275 :                         if( xPrMap.is() )
    1385                 :            :                         {
    1386         [ +  - ]:        275 :                             const sal_Int32 nCount = xPrMap->GetEntryCount();
    1387         [ +  + ]:     126840 :                             for( sal_Int32 i = 0; i < nCount; i++ )
    1388                 :            :                             {
    1389 [ +  - ][ +  - ]:     126565 :                                 const OUString& rName = xPrMap->GetEntryAPIName( i );
    1390 [ +  - ][ +  - ]:     126565 :                                 if( xPropSetInfo->hasPropertyByName( rName ) && beans::PropertyState_DIRECT_VALUE == xPropState->getPropertyState( rName ) )
         [ +  + ][ +  - ]
         [ +  - ][ +  + ]
                 [ +  + ]
    1391                 :            :                                 {
    1392 [ +  - ][ +  - ]:       2333 :                                     xPropState->setPropertyToDefault( rName );
    1393                 :            :                                 }
    1394                 :            :                             }
    1395 [ +  - ][ +  - ]:        275 :                         }
    1396                 :        275 :                     }
    1397                 :            :                 }
    1398                 :            :                 else
    1399                 :            :                 {
    1400                 :            :                     // graphics style does not exist, create and add it
    1401         [ #  # ]:          0 :                     uno::Reference< lang::XSingleServiceFactory > xServiceFact(xPageStyles, uno::UNO_QUERY);
    1402         [ #  # ]:          0 :                     if(xServiceFact.is())
    1403                 :            :                     {
    1404 [ #  # ][ #  # ]:          0 :                         uno::Reference< style::XStyle > xNewStyle( xServiceFact->createInstance(), uno::UNO_QUERY);
                 [ #  # ]
    1405                 :            : 
    1406         [ #  # ]:          0 :                         if(xNewStyle.is())
    1407                 :            :                         {
    1408                 :            :                             // remember style
    1409         [ #  # ]:          0 :                             xStyle = xNewStyle;
    1410                 :            : 
    1411                 :            :                             // add new style to graphics style pool
    1412         [ #  # ]:          0 :                             uno::Reference< container::XNameContainer > xInsertContainer(xPageStyles, uno::UNO_QUERY);
    1413         [ #  # ]:          0 :                             if(xInsertContainer.is())
    1414 [ #  # ][ #  # ]:          0 :                                 xInsertContainer->insertByName(aStyleName, uno::Any( xStyle ) );
                 [ #  # ]
    1415                 :          0 :                         }
    1416                 :          0 :                     }
    1417                 :            :                 }
    1418                 :            : 
    1419         [ +  - ]:        275 :                 if(xStyle.is())
    1420                 :            :                 {
    1421                 :            :                     // set properties at style
    1422         [ -  + ]:        275 :                     XMLPropStyleContext* pPropStyle = dynamic_cast< XMLPropStyleContext* >( const_cast< SvXMLStyleContext* >( pStyle ) );
    1423         [ +  - ]:        275 :                     uno::Reference< beans::XPropertySet > xPropSet(xStyle, uno::UNO_QUERY);
    1424                 :            : 
    1425 [ +  - ][ +  - ]:        275 :                     if(xPropSet.is() && pPropStyle)
                 [ +  - ]
    1426                 :            :                     {
    1427         [ +  - ]:        275 :                         pPropStyle->FillPropertySet(xPropSet);
    1428         [ +  - ]:        275 :                         pPropStyle->SetStyle(xStyle);
    1429                 :        275 :                     }
    1430         [ +  - ]:        275 :                 }
    1431                 :            :             }
    1432                 :            :         }
    1433         [ #  # ]:          0 :         catch(const Exception& e)
    1434                 :            :         {
    1435         [ #  # ]:          0 :             uno::Sequence<OUString> aSeq(0);
    1436   [ #  #  #  #  :          0 :             const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
                   #  # ]
    1437                 :            :         }
    1438                 :            :     }
    1439                 :            : 
    1440                 :            :     // now set parents for all styles (when necessary)
    1441         [ +  + ]:        951 :     for(a = 0L; a < GetStyleCount(); a++)
    1442                 :            :     {
    1443                 :        918 :         const SvXMLStyleContext* pStyle = GetStyle(a);
    1444                 :            : 
    1445 [ +  + ][ +  + ]:        918 :         if(pStyle && !pStyle->GetDisplayName().isEmpty() && (nFamily == pStyle->GetFamily())) try
         [ +  + ][ +  - ]
    1446                 :            :         {
    1447                 :        275 :             OUString aStyleName(pStyle->GetDisplayName());
    1448         [ +  + ]:        275 :             if( nPrefLen )
    1449                 :            :             {
    1450                 :         98 :                 sal_Int32 nStylePrefLen = aStyleName.lastIndexOf( sal_Unicode('-') ) + 1;
    1451 [ -  + ][ -  + ]:         98 :                 if( (nPrefLen != nStylePrefLen) ||  (aStyleName.compareTo( rPrefix, nPrefLen ) != 0) )
                 [ +  - ]
    1452                 :          0 :                     continue;
    1453                 :            : 
    1454                 :         98 :                 aStyleName = aStyleName.copy( nPrefLen );
    1455                 :            :             }
    1456                 :            : 
    1457 [ +  - ][ +  - ]:        275 :             uno::Reference< style::XStyle > xStyle( xPageStyles->getByName(aStyleName), UNO_QUERY );
                 [ +  - ]
    1458         [ +  - ]:        275 :             if(xStyle.is())
    1459                 :            :             {
    1460                 :            :                 // set parent style name
    1461         [ +  - ]:        275 :                 ::rtl::OUString sParentStyleDisplayName( const_cast< SvXMLImport& >( GetImport() ).GetStyleDisplayName( pStyle->GetFamily(), pStyle->GetParentName() ) );
    1462         [ +  + ]:        275 :                 if( nPrefLen )
    1463                 :            :                 {
    1464                 :         98 :                     sal_Int32 nStylePrefLen = sParentStyleDisplayName.lastIndexOf( sal_Unicode('-') ) + 1;
    1465 [ -  + ][ +  + ]:         98 :                     if( (nPrefLen != nStylePrefLen) || (sParentStyleDisplayName.compareTo( rPrefix, nPrefLen ) != 0) )
                 [ +  + ]
    1466                 :         42 :                         continue;
    1467                 :            : 
    1468                 :         56 :                     sParentStyleDisplayName = sParentStyleDisplayName.copy( nPrefLen );
    1469                 :            :                 }
    1470 [ +  - ][ +  - ]:        275 :                 xStyle->setParentStyle( sParentStyleDisplayName );
                 [ +  + ]
    1471 [ +  + ][ +  + ]:        275 :             }
    1472                 :            :         }
    1473         [ #  # ]:          0 :         catch( const Exception& e )
    1474                 :            :         {
    1475         [ #  # ]:          0 :             uno::Sequence<OUString> aSeq(0);
    1476   [ #  #  #  #  :          0 :             const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
                   #  # ]
    1477                 :            :         }
    1478                 :            :     }
    1479                 :         33 : }
    1480                 :            : 
    1481                 :            : ////////////////////////////////////////////////////////////////////////////////
    1482                 :            : // helper function to create the uno component that hold the mappings from
    1483                 :            : // xml auto layout name to internal autolayout id
    1484                 :            : 
    1485                 :         11 : uno::Reference< container::XNameAccess > SdXMLStylesContext::getPageLayouts() const
    1486                 :            : {
    1487 [ +  - ][ +  - ]:         11 :     uno::Reference< container::XNameContainer > xLayouts( comphelper::NameContainer_createInstance( ::getCppuType((const sal_Int32*)0)) );
    1488                 :            : 
    1489 [ +  - ][ +  + ]:        317 :     for(sal_uInt32 a(0L); a < GetStyleCount(); a++)
    1490                 :            :     {
    1491         [ +  - ]:        306 :         const SvXMLStyleContext* pStyle = GetStyle(a);
    1492 [ +  - ][ +  - ]:        306 :         if(pStyle && pStyle->ISA(SdXMLPresentationPageLayoutContext))
         [ +  + ][ +  + ]
    1493                 :            :         {
    1494         [ +  - ]:         34 :             xLayouts->insertByName( pStyle->GetName(), uno::makeAny(
    1495   [ +  -  +  - ]:         34 :             (sal_Int32)((SdXMLPresentationPageLayoutContext*)pStyle)->GetTypeId() ) );
    1496                 :            :         }
    1497                 :            :     }
    1498                 :            : 
    1499         [ +  - ]:         11 :     return uno::Reference< container::XNameAccess >::query( xLayouts );
    1500                 :            : }
    1501                 :            : 
    1502                 :            : ////////////////////////////////////////////////////////////////////////////////
    1503                 :            : ////////////////////////////////////////////////////////////////////////////////
    1504                 :            : //
    1505 [ #  # ][ #  # ]:          0 : TYPEINIT1( SdXMLMasterStylesContext, SvXMLImportContext );
    1506                 :            : 
    1507                 :         11 : SdXMLMasterStylesContext::SdXMLMasterStylesContext(
    1508                 :            :     SdXMLImport& rImport,
    1509                 :            :     sal_uInt16 nPrfx,
    1510                 :            :     const rtl::OUString& rLName)
    1511         [ +  - ]:         11 : :   SvXMLImportContext( rImport, nPrfx, rLName)
    1512                 :            : {
    1513                 :         11 : }
    1514                 :            : 
    1515                 :         11 : SdXMLMasterStylesContext::~SdXMLMasterStylesContext()
    1516                 :            : {
    1517         [ +  + ]:         22 :     for ( size_t i = maMasterPageList.size(); i > 0; )
    1518         [ +  - ]:         11 :         maMasterPageList[ --i ]->ReleaseRef();
    1519                 :         11 :     maMasterPageList.clear();
    1520         [ -  + ]:         22 : }
    1521                 :            : 
    1522                 :         29 : SvXMLImportContext* SdXMLMasterStylesContext::CreateChildContext(
    1523                 :            :     sal_uInt16 nPrefix,
    1524                 :            :     const rtl::OUString& rLocalName,
    1525                 :            :     const uno::Reference< xml::sax::XAttributeList >& xAttrList)
    1526                 :            : {
    1527                 :         29 :     SvXMLImportContext* pContext = 0;
    1528                 :            : 
    1529   [ +  +  +  + ]:         47 :     if(nPrefix == XML_NAMESPACE_STYLE
                 [ +  + ]
    1530                 :         18 :        && IsXMLToken( rLocalName, XML_MASTER_PAGE ) )
    1531                 :            :     {
    1532                 :            :         // style:masterpage inside office:styles context
    1533                 :         11 :         uno::Reference< drawing::XDrawPage > xNewMasterPage;
    1534         [ +  - ]:         11 :         uno::Reference< drawing::XDrawPages > xMasterPages(GetSdImport().GetLocalMasterPages(), uno::UNO_QUERY);
    1535                 :            : 
    1536         [ +  - ]:         11 :         if( xMasterPages.is() )
    1537                 :            :         {
    1538 [ +  - ][ +  - ]:         11 :             if(GetSdImport().GetNewMasterPageCount() + 1 > xMasterPages->getCount())
                 [ -  + ]
    1539                 :            :             {
    1540                 :            :                 // new page, create and insert
    1541 [ #  # ][ #  # ]:          0 :                 xNewMasterPage = xMasterPages->insertNewByIndex(xMasterPages->getCount());
         [ #  # ][ #  # ]
                 [ #  # ]
    1542                 :            :             }
    1543                 :            :             else
    1544                 :            :             {
    1545                 :            :                 // existing page, use it
    1546 [ +  - ][ +  - ]:         11 :                 xMasterPages->getByIndex(GetSdImport().GetNewMasterPageCount()) >>= xNewMasterPage;
                 [ +  - ]
    1547                 :            :             }
    1548                 :            : 
    1549                 :            :             // increment global import page counter
    1550                 :         11 :             GetSdImport().IncrementNewMasterPageCount();
    1551                 :            : 
    1552         [ +  - ]:         11 :             if(xNewMasterPage.is())
    1553                 :            :             {
    1554         [ +  - ]:         11 :                 uno::Reference< drawing::XShapes > xNewShapes(xNewMasterPage, uno::UNO_QUERY);
    1555 [ +  - ][ +  - ]:         11 :                 if(xNewShapes.is() && GetSdImport().GetShapeImport()->GetStylesContext())
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
           [ +  -  #  # ]
    1556                 :            :                 {
    1557                 :            :                     pContext = new SdXMLMasterPageContext(GetSdImport(),
    1558 [ +  - ][ +  - ]:         11 :                         nPrefix, rLocalName, xAttrList, xNewShapes);
    1559                 :            : 
    1560         [ +  - ]:         11 :                     if(pContext)
    1561                 :            :                     {
    1562                 :         11 :                         pContext->AddRef();
    1563         [ +  - ]:         11 :                         maMasterPageList.push_back( (SdXMLMasterPageContext*)pContext );
    1564                 :            :                     }
    1565                 :         11 :                 }
    1566                 :            :             }
    1567                 :         11 :         }
    1568                 :            :     }
    1569   [ +  +  +  - ]:         25 :     else    if(nPrefix == XML_NAMESPACE_STYLE
                 [ +  + ]
    1570                 :          7 :         && IsXMLToken( rLocalName, XML_HANDOUT_MASTER ) )
    1571                 :            :     {
    1572         [ +  - ]:          7 :         uno::Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetSdImport().GetModel(), uno::UNO_QUERY );
    1573         [ +  - ]:          7 :         if( xHandoutSupp.is() )
    1574                 :            :         {
    1575 [ +  - ][ +  - ]:          7 :             uno::Reference< drawing::XShapes > xHandoutPage( xHandoutSupp->getHandoutMasterPage(), uno::UNO_QUERY );
                 [ +  - ]
    1576 [ +  - ][ +  - ]:          7 :             if(xHandoutPage.is() && GetSdImport().GetShapeImport()->GetStylesContext())
         [ +  - ][ +  - ]
                 [ +  - ]
           [ +  -  #  # ]
                 [ +  - ]
    1577                 :            :             {
    1578                 :            :                 pContext = new SdXMLMasterPageContext(GetSdImport(),
    1579 [ +  - ][ +  - ]:          7 :                     nPrefix, rLocalName, xAttrList, xHandoutPage);
    1580                 :          7 :             }
    1581                 :          7 :         }
    1582                 :            :     }
    1583 [ +  - ][ +  - ]:         11 :     else if( (nPrefix == XML_NAMESPACE_DRAW )&& IsXMLToken( rLocalName, XML_LAYER_SET ) )
                 [ +  - ]
    1584                 :            :     {
    1585         [ +  - ]:         11 :         pContext = new SdXMLLayerSetContext( GetImport(), nPrefix, rLocalName, xAttrList );
    1586                 :            :     }
    1587                 :            : 
    1588                 :            :     // call base class
    1589         [ -  + ]:         29 :     if(!pContext)
    1590                 :          0 :         pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
    1591                 :            : 
    1592                 :         29 :     return pContext;
    1593                 :            : }
    1594                 :            : 
    1595                 :            : ///////////////////////////////////////////////////////////////////////
    1596                 :            : 
    1597                 :          0 : SdXMLHeaderFooterDeclContext::SdXMLHeaderFooterDeclContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
    1598                 :            :         const ::rtl::OUString& rLName,
    1599                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
    1600                 :          0 : : SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList )
    1601                 :            : {
    1602 [ #  # ][ #  # ]:          0 :     const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ #  # ]
    1603         [ #  # ]:          0 :     for(sal_Int16 i=0; i < nAttrCount; i++)
    1604                 :            :     {
    1605                 :          0 :         OUString aLocalName;
    1606 [ #  # ][ #  # ]:          0 :         const OUString aValue( xAttrList->getValueByIndex(i) );
    1607 [ #  # ][ #  # ]:          0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(xAttrList->getNameByIndex(i), &aLocalName);
                 [ #  # ]
    1608                 :            : 
    1609         [ #  # ]:          0 :         if( nPrefix == XML_NAMESPACE_PRESENTATION )
    1610                 :            :         {
    1611 [ #  # ][ #  # ]:          0 :             if( IsXMLToken( aLocalName, XML_NAME ) )
    1612                 :            :             {
    1613                 :          0 :                 maStrName = aValue;
    1614                 :            :             }
    1615 [ #  # ][ #  # ]:          0 :             else if( IsXMLToken( aLocalName, XML_SOURCE ) )
    1616                 :            :             {
    1617         [ #  # ]:          0 :                 mbFixed = IsXMLToken( aValue, XML_FIXED );
    1618                 :            :             }
    1619                 :            :         }
    1620         [ #  # ]:          0 :         else if( nPrefix == XML_NAMESPACE_STYLE )
    1621                 :            :         {
    1622 [ #  # ][ #  # ]:          0 :             if( IsXMLToken( aLocalName, XML_DATA_STYLE_NAME ) )
    1623                 :            :             {
    1624                 :          0 :                 maStrDateTimeFormat = aValue;
    1625                 :            :             }
    1626                 :            :         }
    1627                 :          0 :     }
    1628                 :          0 : }
    1629                 :            : 
    1630                 :          0 : sal_Bool SdXMLHeaderFooterDeclContext::IsTransient() const
    1631                 :            : {
    1632                 :          0 :     return sal_True;
    1633                 :            : }
    1634                 :            : 
    1635                 :          0 : void SdXMLHeaderFooterDeclContext::EndElement()
    1636                 :            : {
    1637         [ #  # ]:          0 :     SdXMLImport& rImport = *dynamic_cast< SdXMLImport* >( &GetImport() );
    1638         [ #  # ]:          0 :     if( IsXMLToken( GetLocalName(), XML_HEADER_DECL ) )
    1639                 :            :     {
    1640                 :          0 :         rImport.AddHeaderDecl( maStrName, maStrText );
    1641                 :            :     }
    1642         [ #  # ]:          0 :     else if( IsXMLToken( GetLocalName(), XML_FOOTER_DECL ) )
    1643                 :            :     {
    1644                 :          0 :         rImport.AddFooterDecl( maStrName, maStrText );
    1645                 :            :     }
    1646         [ #  # ]:          0 :     else if( IsXMLToken( GetLocalName(), XML_DATE_TIME_DECL ) )
    1647                 :            :     {
    1648                 :          0 :         rImport.AddDateTimeDecl( maStrName, maStrText, mbFixed, maStrDateTimeFormat );
    1649                 :            :     }
    1650                 :          0 : }
    1651                 :            : 
    1652                 :          0 : void SdXMLHeaderFooterDeclContext::Characters( const ::rtl::OUString& rChars )
    1653                 :            : {
    1654                 :          0 :     maStrText += rChars;
    1655                 :          0 : }
    1656                 :            : 
    1657                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10