LCOV - code coverage report
Current view: top level - sc/source/filter/xml - xmlstyli.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 430 505 85.1 %
Date: 2012-08-25 Functions: 61 78 78.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 394 768 51.3 %

           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 "xmlstyli.hxx"
      30                 :            : #include <xmloff/nmspmap.hxx>
      31                 :            : #include <xmloff/xmlnmspe.hxx>
      32                 :            : #include <xmloff/xmlimppr.hxx>
      33                 :            : #include <xmloff/families.hxx>
      34                 :            : #include <xmloff/xmlnumfi.hxx>
      35                 :            : #include <xmloff/XMLGraphicsDefaultStyle.hxx>
      36                 :            : #include <xmloff/xmltoken.hxx>
      37                 :            : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      38                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      39                 :            : #include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
      40                 :            : #include <com/sun/star/table/BorderLine2.hpp>
      41                 :            : #include <comphelper/extract.hxx>
      42                 :            : #include <xmloff/xmlprcon.hxx>
      43                 :            : #include <xmloff/xmluconv.hxx>
      44                 :            : #include "XMLTableHeaderFooterContext.hxx"
      45                 :            : #include "XMLConverter.hxx"
      46                 :            : #include "XMLTableShapeImportHelper.hxx"
      47                 :            : #include "sheetdata.hxx"
      48                 :            : #include "xmlannoi.hxx"
      49                 :            : #include "textuno.hxx"
      50                 :            : #include "cellsuno.hxx"
      51                 :            : 
      52                 :            : #include "docuno.hxx"
      53                 :            : #include "unonames.hxx"
      54                 :            : #include "document.hxx"
      55                 :            : 
      56                 :            : #define XML_LINE_LEFT 0
      57                 :            : #define XML_LINE_RIGHT 1
      58                 :            : #define XML_LINE_TOP 2
      59                 :            : #define XML_LINE_BOTTOM 3
      60                 :            : 
      61                 :            : #define XML_LINE_TLBR 0
      62                 :            : #define XML_LINE_BLTR 1
      63                 :            : 
      64                 :            : using namespace ::com::sun::star;
      65                 :            : using namespace ::com::sun::star::xml::sax;
      66                 :            : using namespace ::com::sun::star::style;
      67                 :            : using namespace ::com::sun::star::frame;
      68                 :            : using namespace ::com::sun::star::beans;
      69                 :            : using namespace ::com::sun::star::container;
      70                 :            : using namespace xmloff::token;
      71                 :            : using namespace ::formula;
      72                 :            : 
      73                 :            : using rtl::OUString;
      74                 :            : using com::sun::star::uno::Reference;
      75                 :            : using com::sun::star::uno::UNO_QUERY;
      76                 :            : 
      77                 :        130 : ScXMLCellImportPropertyMapper::ScXMLCellImportPropertyMapper(
      78                 :            :         const UniReference< XMLPropertySetMapper >& rMapper,
      79                 :            :         SvXMLImport& rImportP) :
      80                 :        130 :     SvXMLImportPropertyMapper( rMapper, rImportP )
      81                 :            : {
      82                 :        130 : }
      83                 :            : 
      84                 :        130 : ScXMLCellImportPropertyMapper::~ScXMLCellImportPropertyMapper()
      85                 :            : {
      86         [ -  + ]:        260 : }
      87                 :            : 
      88                 :       1092 : void ScXMLCellImportPropertyMapper::finished(::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const
      89                 :            : {
      90                 :            :     static const sal_Int16 aPaddingCTF[4] = { CTF_SC_LEFTPADDING, CTF_SC_RIGHTPADDING,
      91                 :            :                                             CTF_SC_TOPPADDING, CTF_SC_BOTTOMPADDING };
      92                 :            :     static const sal_Int16 aBorderCTF[4] = { CTF_SC_LEFTBORDER, CTF_SC_RIGHTBORDER,
      93                 :            :                                             CTF_SC_TOPBORDER, CTF_SC_BOTTOMBORDER };
      94                 :            : 
      95         [ +  - ]:       1092 :     SvXMLImportPropertyMapper::finished(rProperties, nStartIndex, nEndIndex);
      96                 :       1092 :     XMLPropertyState* pAllPaddingProperty(NULL);
      97                 :       1092 :     XMLPropertyState* pPadding[4] = { NULL, NULL, NULL, NULL };
      98                 :       1092 :     XMLPropertyState* pNewPadding[4] = { NULL, NULL, NULL, NULL };
      99                 :       1092 :     XMLPropertyState* pAllBorderProperty = NULL;
     100                 :       1092 :     XMLPropertyState* pBorders[4] = { NULL, NULL, NULL, NULL };
     101                 :       1092 :     XMLPropertyState* pNewBorders[4] = { NULL, NULL, NULL, NULL };
     102                 :       1092 :     XMLPropertyState* pAllBorderWidthProperty = NULL;
     103                 :       1092 :     XMLPropertyState* pBorderWidths[4] = { NULL, NULL, NULL, NULL };
     104                 :       1092 :     XMLPropertyState* pDiagBorders[2] = { 0 };
     105                 :       1092 :     XMLPropertyState* pOldDiagBorderWidths[2] = { 0 };      // old attribute names without "s"
     106                 :       1092 :     XMLPropertyState* pDiagBorderWidths[2] = { 0 };
     107                 :            : 
     108                 :       1092 :     ::std::vector< XMLPropertyState >::iterator endproperty(rProperties.end());
     109 [ +  - ][ +  + ]:       5984 :     for (::std::vector< XMLPropertyState >::iterator aIter =  rProperties.begin();
     110                 :            :         aIter != endproperty; ++aIter)
     111                 :            :     {
     112                 :       4892 :         XMLPropertyState*property = &(*aIter);
     113         [ +  + ]:       4892 :         if (property->mnIndex != -1)
     114                 :            :         {
     115 [ +  - ][ +  - ]:       4888 :             sal_Int16 nContextID = getPropertySetMapper()->GetEntryContextId(property->mnIndex);
     116   [ +  +  +  +  :       4888 :             switch (nContextID)
          +  +  +  +  +  
          +  +  -  -  -  
          -  -  -  -  -  
                -  -  + ]
     117                 :            :             {
     118                 :          4 :                 case CTF_SC_ALLPADDING                  : pAllPaddingProperty = &*property; break;
     119                 :         56 :                 case CTF_SC_LEFTPADDING                 : pPadding[XML_LINE_LEFT] = &*property; break;
     120                 :         56 :                 case CTF_SC_RIGHTPADDING                : pPadding[XML_LINE_RIGHT] = &*property; break;
     121                 :         56 :                 case CTF_SC_TOPPADDING                  : pPadding[XML_LINE_TOP] = &*property; break;
     122                 :         56 :                 case CTF_SC_BOTTOMPADDING               : pPadding[XML_LINE_BOTTOM] = &*property; break;
     123                 :         70 :                 case CTF_SC_ALLBORDER                   : pAllBorderProperty = &*property; break;
     124                 :        156 :                 case CTF_SC_LEFTBORDER                  : pBorders[XML_LINE_LEFT] = &*property; break;
     125                 :        156 :                 case CTF_SC_RIGHTBORDER                 : pBorders[XML_LINE_RIGHT] = &*property; break;
     126                 :        156 :                 case CTF_SC_TOPBORDER                   : pBorders[XML_LINE_TOP] = &*property; break;
     127                 :        156 :                 case CTF_SC_BOTTOMBORDER                : pBorders[XML_LINE_BOTTOM] = &*property; break;
     128                 :         36 :                 case CTF_SC_ALLBORDERWIDTH              : pAllBorderWidthProperty = &*property; break;
     129                 :          0 :                 case CTF_SC_LEFTBORDERWIDTH             : pBorderWidths[XML_LINE_LEFT] = &*property; break;
     130                 :          0 :                 case CTF_SC_RIGHTBORDERWIDTH            : pBorderWidths[XML_LINE_RIGHT] = &*property; break;
     131                 :          0 :                 case CTF_SC_TOPBORDERWIDTH              : pBorderWidths[XML_LINE_TOP] = &*property; break;
     132                 :          0 :                 case CTF_SC_BOTTOMBORDERWIDTH           : pBorderWidths[XML_LINE_BOTTOM] = &*property; break;
     133                 :          0 :                 case CTF_SC_DIAGONALTLBR                : pDiagBorders[XML_LINE_TLBR] = &*property; break;
     134                 :          0 :                 case CTF_SC_DIAGONALBLTR                : pDiagBorders[XML_LINE_BLTR] = &*property; break;
     135                 :          0 :                 case CTF_SC_DIAGONALTLBRWIDTH           : pOldDiagBorderWidths[XML_LINE_TLBR] = &*property; break;
     136                 :          0 :                 case CTF_SC_DIAGONALTLBRWIDTHS          : pDiagBorderWidths[XML_LINE_TLBR] = &*property; break;
     137                 :          0 :                 case CTF_SC_DIAGONALBLTRWIDTH           : pOldDiagBorderWidths[XML_LINE_BLTR] = &*property; break;
     138                 :       4888 :                 case CTF_SC_DIAGONALBLTRWIDTHS          : pDiagBorderWidths[XML_LINE_BLTR] = &*property; break;
     139                 :            :             }
     140                 :            :         }
     141                 :            :     }
     142                 :            :     sal_uInt16 i;
     143                 :            : 
     144                 :            :     // #i27594#; copy Value, but don't insert
     145         [ +  + ]:       1092 :     if (pAllBorderWidthProperty)
     146                 :         36 :         pAllBorderWidthProperty->mnIndex = -1;
     147         [ +  + ]:       1092 :     if (pAllBorderProperty)
     148                 :         70 :         pAllBorderProperty->mnIndex = -1;
     149         [ +  + ]:       1092 :     if (pAllPaddingProperty)
     150                 :          4 :         pAllPaddingProperty->mnIndex = -1;
     151                 :            : 
     152         [ +  + ]:       5460 :     for (i = 0; i < 4; ++i)
     153                 :            :     {
     154 [ +  + ][ +  - ]:       4368 :         if (pAllPaddingProperty && !pPadding[i])
     155 [ +  - ][ +  - ]:         16 :             pNewPadding[i] = new XMLPropertyState(maPropMapper->FindEntryIndex(aPaddingCTF[i]), pAllPaddingProperty->maValue);
                 [ +  - ]
     156 [ +  + ][ +  - ]:       4368 :         if (pAllBorderProperty && !pBorders[i])
     157                 :            :         {
     158 [ +  - ][ +  - ]:        280 :             pNewBorders[i] = new XMLPropertyState(maPropMapper->FindEntryIndex(aBorderCTF[i]), pAllBorderProperty->maValue);
                 [ +  - ]
     159                 :        280 :             pBorders[i] = pNewBorders[i];
     160                 :            :         }
     161         [ +  - ]:       4368 :         if( !pBorderWidths[i] )
     162                 :       4368 :             pBorderWidths[i] = pAllBorderWidthProperty;
     163                 :            :         else
     164                 :          0 :             pBorderWidths[i]->mnIndex = -1;
     165         [ +  + ]:       4368 :         if( pBorders[i] )
     166                 :            :         {
     167                 :        904 :             table::BorderLine2 aBorderLine;
     168         [ +  - ]:        904 :             pBorders[i]->maValue >>= aBorderLine;
     169         [ +  + ]:        904 :             if( pBorderWidths[i] )
     170                 :            :             {
     171                 :            :                 // Merge style:border-line-width values to fo:border values. Do
     172                 :            :                 // not override fo:border line width or line style with an
     173                 :            :                 // empty value!
     174                 :        144 :                 table::BorderLine2 aBorderLineWidth;
     175         [ +  - ]:        144 :                 pBorderWidths[i]->maValue >>= aBorderLineWidth;
     176                 :        144 :                 aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
     177                 :        144 :                 aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
     178                 :        144 :                 aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
     179         [ +  - ]:        904 :                 pBorders[i]->maValue <<= aBorderLine;
     180                 :            :             }
     181                 :            :         }
     182                 :            :     }
     183         [ +  + ]:       3276 :     for( i = 0; i < 2; ++i )
     184                 :            :     {
     185 [ -  + ][ #  # ]:       2184 :         if( pDiagBorders[i] && ( pDiagBorderWidths[i] || pOldDiagBorderWidths[i] ) )
                 [ #  # ]
     186                 :            :         {
     187                 :          0 :             table::BorderLine2 aBorderLine;
     188         [ #  # ]:          0 :             pDiagBorders[i]->maValue >>= aBorderLine;
     189                 :          0 :             table::BorderLine2 aBorderLineWidth;
     190         [ #  # ]:          0 :             if (pDiagBorderWidths[i])
     191         [ #  # ]:          0 :                 pDiagBorderWidths[i]->maValue >>= aBorderLineWidth;     // prefer new attribute
     192                 :            :             else
     193         [ #  # ]:          0 :                 pOldDiagBorderWidths[i]->maValue >>= aBorderLineWidth;
     194                 :          0 :             aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
     195                 :          0 :             aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
     196                 :          0 :             aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
     197         [ #  # ]:          0 :             pDiagBorders[i]->maValue <<= aBorderLine;
     198         [ #  # ]:          0 :             if (pDiagBorderWidths[i])
     199                 :          0 :                 pDiagBorderWidths[i]->mnIndex = -1;
     200         [ #  # ]:          0 :             if (pOldDiagBorderWidths[i])
     201                 :          0 :                 pOldDiagBorderWidths[i]->mnIndex = -1;      // reset mnIndex for old and new attribute if both are present
     202                 :            :         }
     203                 :            :     }
     204                 :            : 
     205         [ +  + ]:       5460 :     for (i = 0; i < 4; ++i)
     206                 :            :     {
     207         [ +  + ]:       4368 :         if (pNewPadding[i])
     208                 :            :         {
     209         [ +  - ]:         16 :             rProperties.push_back(*pNewPadding[i]);
     210         [ +  - ]:         16 :             delete pNewPadding[i];
     211                 :            :         }
     212         [ +  + ]:       4368 :         if (pNewBorders[i])
     213                 :            :         {
     214         [ +  - ]:        280 :             rProperties.push_back(*pNewBorders[i]);
     215         [ +  - ]:        280 :             delete pNewBorders[i];
     216                 :            :         }
     217                 :            :     }
     218                 :       1092 : }
     219                 :            : 
     220                 :         93 : ScXMLRowImportPropertyMapper::ScXMLRowImportPropertyMapper(
     221                 :            :         const UniReference< XMLPropertySetMapper >& rMapper,
     222                 :            :         SvXMLImport& rImportP) :
     223                 :         93 :     SvXMLImportPropertyMapper( rMapper, rImportP )
     224                 :            : {
     225                 :         93 : }
     226                 :            : 
     227                 :         93 : ScXMLRowImportPropertyMapper::~ScXMLRowImportPropertyMapper()
     228                 :            : {
     229         [ -  + ]:        186 : }
     230                 :            : 
     231                 :        127 : void ScXMLRowImportPropertyMapper::finished(::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const
     232                 :            : {
     233         [ +  - ]:        127 :     SvXMLImportPropertyMapper::finished(rProperties, nStartIndex, nEndIndex);
     234                 :        127 :     XMLPropertyState* pHeight(NULL);
     235                 :        127 :     XMLPropertyState* pOptimalHeight(NULL);
     236                 :        127 :     XMLPropertyState* pPageBreak(NULL);
     237                 :        127 :     ::std::vector< XMLPropertyState >::iterator endproperty(rProperties.end());
     238 [ +  - ][ +  + ]:        498 :     for (::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
     239                 :            :         aIter != endproperty; ++aIter)
     240                 :            :     {
     241                 :        371 :         XMLPropertyState* property = &(*aIter);
     242         [ +  - ]:        371 :         if (property->mnIndex != -1)
     243                 :            :         {
     244 [ +  - ][ +  - ]:        371 :             sal_Int16 nContextID = getPropertySetMapper()->GetEntryContextId(property->mnIndex);
     245   [ +  +  +  - ]:        371 :             switch (nContextID)
     246                 :            :             {
     247                 :        122 :                 case CTF_SC_ROWHEIGHT                   : pHeight = property; break;
     248                 :        122 :                 case CTF_SC_ROWOPTIMALHEIGHT            : pOptimalHeight = property; break;
     249                 :        371 :                 case CTF_SC_ROWBREAKBEFORE              : pPageBreak = property; break;
     250                 :            :             }
     251                 :            :         }
     252                 :            :     }
     253         [ +  - ]:        127 :     if (pPageBreak)
     254                 :            :     {
     255 [ +  - ][ +  - ]:        127 :         if(!(::cppu::any2bool(pPageBreak->maValue)))
     256                 :        127 :             pPageBreak->mnIndex = -1;
     257                 :            :     }
     258         [ +  + ]:        127 :     if (pOptimalHeight)
     259                 :            :     {
     260 [ +  - ][ +  + ]:        122 :         if (::cppu::any2bool(pOptimalHeight->maValue))
     261                 :            :         {
     262         [ +  - ]:        114 :             if (pHeight)
     263                 :            :             {
     264                 :            :                 // set the stored height, but keep "optimal" flag:
     265                 :            :                 // pass the height value as OptimalHeight property (only allowed while loading!)
     266                 :        114 :                 pOptimalHeight->maValue = pHeight->maValue;
     267                 :        114 :                 pHeight->mnIndex = -1;
     268                 :            :             }
     269                 :            :             else
     270                 :          0 :                 pOptimalHeight->mnIndex = -1;
     271                 :            :         }
     272                 :            :     }
     273         [ -  + ]:          5 :     else if (pHeight)
     274                 :            :     {
     275 [ #  # ][ #  # ]:          0 :         rProperties.push_back(XMLPropertyState(maPropMapper->FindEntryIndex(CTF_SC_ROWOPTIMALHEIGHT), ::cppu::bool2any( false )));
         [ #  # ][ #  # ]
     276                 :            :     }
     277                 :            :     // don't access pointers to rProperties elements after push_back!
     278                 :        127 : }
     279                 :            : 
     280                 :            : class ScXMLMapContext : public SvXMLImportContext
     281                 :            : {
     282                 :            :     rtl::OUString sApplyStyle;
     283                 :            :     rtl::OUString sCondition;
     284                 :            :     rtl::OUString sBaseCell;
     285                 :            : public:
     286                 :            : 
     287                 :            :     ScXMLMapContext(
     288                 :            :             SvXMLImport& rImport, sal_uInt16 nPrfx,
     289                 :            :             const rtl::OUString& rLName,
     290                 :            :             const uno::Reference< xml::sax::XAttributeList > & xAttrList );
     291                 :            :     virtual ~ScXMLMapContext();
     292                 :            : 
     293                 :         33 :     const rtl::OUString& GetApplyStyle() const { return sApplyStyle; }
     294                 :         33 :     const rtl::OUString& GetCondition() const { return sCondition; }
     295                 :         33 :     const rtl::OUString& GetBaseCell() const { return sBaseCell; }
     296                 :            : };
     297                 :            : 
     298                 :         33 : ScXMLMapContext::ScXMLMapContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
     299                 :            :             const OUString& rLName, const uno::Reference< xml::sax::XAttributeList > & xAttrList )
     300                 :         33 :     : SvXMLImportContext( rImport, nPrfx, rLName )
     301                 :            : {
     302 [ +  - ][ +  - ]:         33 :     sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
                 [ +  - ]
     303         [ +  + ]:        132 :     for( sal_Int16 i=0; i < nAttrCount; ++i )
     304                 :            :     {
     305 [ +  - ][ +  - ]:         99 :         const OUString& rAttrName(xAttrList->getNameByIndex( i ));
     306                 :         99 :         OUString aLocalName;
     307         [ +  - ]:         99 :         sal_uInt16 nPrefix(GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName ));
     308 [ +  - ][ +  - ]:         99 :         const OUString& rValue(xAttrList->getValueByIndex( i ));
     309                 :            : 
     310                 :            :         // TODO: use a map here
     311         [ +  - ]:         99 :         if( XML_NAMESPACE_STYLE == nPrefix )
     312                 :            :         {
     313 [ +  - ][ +  + ]:         99 :             if( IsXMLToken(aLocalName, XML_CONDITION ) )
     314                 :         33 :                 sCondition = rValue;
     315 [ +  - ][ +  + ]:         66 :             else if( IsXMLToken(aLocalName, XML_APPLY_STYLE_NAME ) )
     316         [ +  - ]:         33 :                 sApplyStyle = GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_TABLE_CELL, rValue);
     317 [ +  - ][ +  - ]:         33 :             else if ( IsXMLToken(aLocalName, XML_BASE_CELL_ADDRESS ) )
     318                 :         33 :                 sBaseCell = rValue;
     319                 :            :         }
     320                 :         99 :     }
     321                 :         33 : }
     322                 :            : 
     323                 :         33 : ScXMLMapContext::~ScXMLMapContext()
     324                 :            : {
     325         [ -  + ]:         66 : }
     326                 :            : 
     327                 :            : namespace {
     328                 :            : 
     329                 :            : template< typename Type >
     330                 :        297 : inline void lclAppendProperty( uno::Sequence< beans::PropertyValue >& rProps, const OUString& rPropName, const Type& rValue )
     331                 :            : {
     332                 :        297 :     sal_Int32 nLength = rProps.getLength();
     333                 :        297 :     rProps.realloc( nLength + 1 );
     334                 :        297 :     rProps[ nLength ].Name = rPropName;
     335                 :        297 :     rProps[ nLength ].Value <<= rValue;
     336                 :        297 : }
     337                 :            : 
     338                 :            : } // namespace
     339                 :            : 
     340                 :         33 : void XMLTableStyleContext::SetOperator( uno::Sequence< beans::PropertyValue >& rProps, sheet::ConditionOperator eOp ) const
     341                 :            : {
     342         [ +  - ]:         33 :     lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_OPERATOR ) ), eOp );
     343                 :         33 : }
     344                 :            : 
     345                 :         33 : void XMLTableStyleContext::SetBaseCellAddress( uno::Sequence< beans::PropertyValue >& rProps, const OUString& rBaseCell ) const
     346                 :            : {
     347                 :            :     /*  Source position must be set as string, because it may refer
     348                 :            :         to a sheet that hasn't been loaded yet. */
     349         [ +  - ]:         33 :     lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SOURCESTR ) ), rBaseCell );
     350                 :         33 : }
     351                 :            : 
     352                 :         33 : void XMLTableStyleContext::SetStyle( uno::Sequence<beans::PropertyValue>& rProps, const OUString& rApplyStyle ) const
     353                 :            : {
     354         [ +  - ]:         33 :     lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_STYLENAME ) ), rApplyStyle );
     355                 :         33 : }
     356                 :            : 
     357                 :         66 : void XMLTableStyleContext::SetFormula( uno::Sequence< beans::PropertyValue >& rProps,
     358                 :            :         sal_Int32 nFormulaIdx, const OUString& rFormula, const OUString& rFormulaNmsp,
     359                 :            :         FormulaGrammar::Grammar eGrammar, bool bHasNmsp ) const
     360                 :            : {
     361                 :         66 :     OUString aFormula, aFormulaNmsp;
     362                 :         66 :     FormulaGrammar::Grammar eNewGrammar = FormulaGrammar::GRAM_UNSPECIFIED;
     363         [ -  + ]:         66 :     if( bHasNmsp )
     364                 :            :     {
     365                 :            :         // the entire attribute contains a namespace: internal namespace not allowed
     366                 :          0 :         aFormula = rFormula;
     367                 :          0 :         aFormulaNmsp = rFormulaNmsp;
     368                 :          0 :         eNewGrammar = eGrammar;
     369                 :            :     }
     370                 :            :     else
     371                 :            :     {
     372                 :            :         // the attribute does not contain a namespace: try to find a namespace of an external grammar
     373         [ +  - ]:         66 :         GetScImport().ExtractFormulaNamespaceGrammar( aFormula, aFormulaNmsp, eNewGrammar, rFormula, true );
     374         [ +  - ]:         66 :         if( eNewGrammar != FormulaGrammar::GRAM_EXTERNAL )
     375                 :         66 :             eNewGrammar = eGrammar;
     376                 :            :     }
     377                 :            : 
     378                 :            :     // add formula, formula namespace, and grammar with appropriate property names
     379                 :         66 :     sal_Int32 nGrammar = static_cast< sal_Int32 >( eNewGrammar );
     380      [ +  +  - ]:         66 :     switch( nFormulaIdx )
     381                 :            :     {
     382                 :            :         case 1:
     383 [ +  - ][ +  - ]:         33 :             lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_FORMULA1 ) ), aFormula );
     384 [ +  - ][ +  - ]:         33 :             lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_FORMULANMSP1 ) ), aFormulaNmsp );
     385 [ +  - ][ +  - ]:         33 :             lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_GRAMMAR1 ) ), nGrammar );
     386                 :         33 :         break;
     387                 :            :         case 2:
     388 [ +  - ][ +  - ]:         33 :             lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_FORMULA2 ) ), aFormula );
     389 [ +  - ][ +  - ]:         33 :             lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_FORMULANMSP2 ) ), aFormulaNmsp );
     390 [ +  - ][ +  - ]:         33 :             lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_GRAMMAR2 ) ), nGrammar );
     391                 :         33 :         break;
     392                 :            :         default:
     393                 :            :             OSL_FAIL( "XMLTableStyleContext::SetFormula - invalid formula index" );
     394                 :         66 :     }
     395                 :         66 : }
     396                 :            : 
     397                 :         33 : void XMLTableStyleContext::GetConditionalFormat(uno::Any& aAny,
     398                 :            :         const rtl::OUString& sTempCondition,
     399                 :            :         const rtl::OUString& sApplyStyle, const rtl::OUString& sBaseCell) const
     400                 :            : {
     401 [ +  - ][ +  - ]:         33 :     if (!sTempCondition.isEmpty() && !sApplyStyle.isEmpty())
                 [ +  - ]
     402                 :            :     {
     403         [ +  - ]:         33 :         uno::Reference<sheet::XSheetConditionalEntries> xConditionalEntries(aAny, uno::UNO_QUERY);
     404         [ +  - ]:         33 :         if (xConditionalEntries.is())
     405                 :            :         {
     406         [ +  - ]:         33 :             uno::Sequence<beans::PropertyValue> aProps;
     407         [ +  - ]:         33 :             if (!sBaseCell.isEmpty())
     408         [ +  - ]:         33 :                 SetBaseCellAddress(aProps, sBaseCell);
     409         [ +  - ]:         33 :             SetStyle(aProps, sApplyStyle);
     410                 :            : 
     411                 :            :             // extract leading namespace from condition string
     412                 :         33 :             OUString aCondition, aConditionNmsp;
     413                 :         33 :             FormulaGrammar::Grammar eGrammar = FormulaGrammar::GRAM_UNSPECIFIED;
     414         [ +  - ]:         33 :             GetScImport().ExtractFormulaNamespaceGrammar( aCondition, aConditionNmsp, eGrammar, sTempCondition );
     415                 :         33 :             bool bHasNmsp = aCondition.getLength() < sTempCondition.getLength();
     416                 :            : 
     417                 :            :             // parse a condition from the attribute string
     418                 :         33 :             ScXMLConditionParseResult aParseResult;
     419         [ +  - ]:         33 :             ScXMLConditionHelper::parseCondition( aParseResult, aCondition, 0 );
     420                 :            : 
     421                 :            :             /*  Check the result. A valid value in aParseResult.meToken implies
     422                 :            :                 that the other members of aParseResult are filled with valid
     423                 :            :                 data for that token. */
     424         [ +  - ]:         33 :             switch( aParseResult.meToken )
     425                 :            :             {
     426                 :            :                 case XML_COND_CELLCONTENT:      // condition is 'cell-content()<operator><expression>'
     427                 :            :                 case XML_COND_ISTRUEFORMULA:    // condition is 'is-true-formula(<expression>)'
     428                 :            :                 case XML_COND_ISBETWEEN:        // condition is 'cell-content-is-between(<expression1>,<expression2>)'
     429                 :            :                 case XML_COND_ISNOTBETWEEN:     // condition is 'cell-content-is-not-between(<expression1>,<expression2>)'
     430         [ +  - ]:         33 :                     SetOperator( aProps, aParseResult.meOperator );
     431         [ +  - ]:         33 :                     SetFormula( aProps, 1, aParseResult.maOperand1, aConditionNmsp, eGrammar, bHasNmsp );
     432         [ +  - ]:         33 :                     SetFormula( aProps, 2, aParseResult.maOperand2, aConditionNmsp, eGrammar, bHasNmsp );
     433                 :         33 :                 break;
     434                 :            : 
     435                 :            :                 default:;   // unacceptable or unknown condition
     436                 :            :             }
     437                 :            : 
     438 [ +  - ][ +  - ]:         33 :             xConditionalEntries->addNew( aProps );
     439 [ +  - ][ +  - ]:         33 :             aAny <<= xConditionalEntries;
     440                 :         33 :         }
     441                 :            :     }
     442                 :         33 : }
     443                 :            : 
     444                 :       3635 : void XMLTableStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
     445                 :            :                                         const OUString& rLocalName,
     446                 :            :                                         const OUString& rValue )
     447                 :            : {
     448                 :            :     // TODO: use a map here
     449         [ +  + ]:       3635 :     if( IsXMLToken(rLocalName, XML_DATA_STYLE_NAME ) )
     450                 :        159 :         sDataStyleName = rValue;
     451         [ +  + ]:       3476 :     else if ( IsXMLToken(rLocalName, XML_MASTER_PAGE_NAME ) )
     452                 :         97 :         sPageStyle = rValue;
     453                 :            :     else
     454                 :       3379 :         XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
     455                 :       3635 : }
     456                 :            : 
     457                 :        186 : struct ScXMLMapContent
     458                 :            : {
     459                 :            :     rtl::OUString sCondition;
     460                 :            :     rtl::OUString sApplyStyle;
     461                 :            :     rtl::OUString sBaseCell;
     462                 :            : };
     463                 :            : 
     464 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLTableStyleContext, XMLPropStyleContext );
     465                 :            : 
     466                 :       1348 : XMLTableStyleContext::XMLTableStyleContext( ScXMLImport& rImport,
     467                 :            :         sal_uInt16 nPrfx, const OUString& rLName,
     468                 :            :         const uno::Reference< XAttributeList > & xAttrList,
     469                 :            :         SvXMLStylesContext& rStyles, sal_uInt16 nFamily, bool bDefaultStyle ) :
     470                 :            :     XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, bDefaultStyle ),
     471                 :            :     sDataStyleName(),
     472                 :            :     sNumberFormat(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberFormat"))),
     473                 :            :     pStyles(&rStyles),
     474                 :            :     nNumberFormat(-1),
     475                 :            :     nLastSheet(-1),
     476                 :            :     bConditionalFormatCreated(false),
     477 [ +  - ][ +  - ]:       1348 :     bParentSet(false)
     478                 :            : {
     479                 :       1348 : }
     480                 :            : 
     481                 :       1348 : XMLTableStyleContext::~XMLTableStyleContext()
     482                 :            : {
     483         [ -  + ]:       2696 : }
     484                 :            : 
     485                 :       1535 : SvXMLImportContext *XMLTableStyleContext::CreateChildContext(
     486                 :            :         sal_uInt16 nPrefix,
     487                 :            :         const OUString& rLocalName,
     488                 :            :         const uno::Reference< XAttributeList > & xAttrList )
     489                 :            : {
     490                 :       1535 :     SvXMLImportContext *pContext(NULL);
     491                 :            : 
     492   [ +  -  +  + ]:       3070 :     if( (XML_NAMESPACE_STYLE == nPrefix) &&
                 [ +  + ]
     493                 :       1535 :         IsXMLToken(rLocalName, XML_MAP ) )
     494                 :            :     {
     495 [ +  - ][ +  - ]:         33 :         pContext = new ScXMLMapContext(GetImport(), nPrefix, rLocalName, xAttrList);
     496                 :            : 
     497                 :         33 :         ScXMLMapContent aMap;
     498                 :         33 :         aMap.sCondition = ((ScXMLMapContext*)pContext)->GetCondition();
     499                 :         33 :         aMap.sApplyStyle = ((ScXMLMapContext*)pContext)->GetApplyStyle();
     500                 :         33 :         aMap.sBaseCell = ((ScXMLMapContext*)pContext)->GetBaseCell();
     501         [ +  - ]:         33 :         aMaps.push_back(aMap);
     502                 :            :     }
     503         [ +  + ]:       1535 :     if (!pContext)
     504                 :            :         pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
     505                 :       1502 :                                                            xAttrList );
     506                 :       1535 :     return pContext;
     507                 :            : }
     508                 :            : 
     509                 :       5913 : void XMLTableStyleContext::FillPropertySet(
     510                 :            :     const uno::Reference< XPropertySet > & rPropSet )
     511                 :            : {
     512         [ +  + ]:       5913 :     if (!IsDefaultStyle())
     513                 :            :     {
     514         [ +  + ]:       5820 :         if (GetFamily() == XML_STYLE_FAMILY_TABLE_CELL)
     515                 :            :         {
     516         [ +  + ]:        863 :             if (!bParentSet)
     517                 :            :             {
     518 [ +  - ][ +  - ]:        845 :                 AddProperty(CTF_SC_CELLSTYLE, uno::makeAny(GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_TABLE_CELL, GetParentName() )));
                 [ +  - ]
     519                 :        845 :                 bParentSet = true;
     520                 :            :             }
     521         [ +  - ]:        863 :             sal_Int32 nNumFmt = GetNumberFormat();
     522         [ +  + ]:        863 :             if (nNumFmt >= 0)
     523 [ +  - ][ +  - ]:        159 :                 AddProperty(CTF_SC_NUMBERFORMAT, uno::makeAny(nNumFmt));
     524 [ +  + ][ +  - ]:        863 :             if (!GetScImport().HasNewCondFormatData() && !bConditionalFormatCreated && (!aMaps.empty()))
         [ +  + ][ +  + ]
     525                 :            :             {
     526 [ +  - ][ +  - ]:          9 :                 aConditionalFormat = rPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CONDXML)));
                 [ +  - ]
     527                 :          9 :                 std::vector<ScXMLMapContent>::iterator aItr(aMaps.begin());
     528                 :          9 :                 std::vector<ScXMLMapContent>::iterator aEndItr(aMaps.end());
     529 [ +  - ][ +  + ]:         42 :                 while(aItr != aEndItr)
     530                 :            :                 {
     531                 :            :                     //rPropSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_CONDITIONALFORMAT)),
     532         [ +  - ]:         33 :                     GetConditionalFormat(aConditionalFormat, aItr->sCondition, aItr->sApplyStyle, aItr->sBaseCell);
     533                 :            : 
     534                 :         33 :                     ++aItr;
     535                 :            :                 }
     536         [ +  - ]:          9 :                 AddProperty(CTF_SC_IMPORT_MAP, aConditionalFormat);
     537                 :        863 :                 bConditionalFormatCreated = true;
     538                 :            :             }
     539                 :            :         }
     540         [ +  + ]:       4957 :         else if (GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE)
     541                 :            :         {
     542         [ +  - ]:        224 :             if (!sPageStyle.isEmpty())
     543 [ +  - ][ +  - ]:        224 :                 AddProperty(CTF_SC_MASTERPAGENAME, uno::makeAny(GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_MASTER_PAGE, sPageStyle )));
     544                 :            :         }
     545                 :            :     }
     546                 :       5913 :     XMLPropStyleContext::FillPropertySet(rPropSet);
     547                 :       5913 : }
     548                 :            : 
     549                 :         93 : void XMLTableStyleContext::SetDefaults()
     550                 :            : {
     551 [ +  - ][ +  - ]:         93 :     if ((GetFamily() == XML_STYLE_FAMILY_TABLE_CELL) && GetImport().GetModel().is())
                 [ +  - ]
     552                 :            :     {
     553         [ +  - ]:         93 :         uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetImport().GetModel(), uno::UNO_QUERY);
     554         [ +  - ]:         93 :         if (xMultiServiceFactory.is())
     555                 :            :         {
     556 [ +  - ][ +  - ]:         93 :             uno::Reference <beans::XPropertySet> xProperties(xMultiServiceFactory->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.Defaults"))), uno::UNO_QUERY);
         [ +  - ][ +  - ]
     557         [ +  - ]:         93 :             if (xProperties.is())
     558         [ +  - ]:         93 :                 FillPropertySet(xProperties);
     559                 :         93 :         }
     560                 :            :     }
     561                 :         93 : }
     562                 :            : 
     563                 :       1237 : void XMLTableStyleContext::AddProperty(const sal_Int16 nContextID, const uno::Any& rValue)
     564                 :            : {
     565         [ +  - ]:       1237 :     XMLPropertyState* property = FindProperty(nContextID);
     566         [ +  + ]:       1237 :     if (property)
     567                 :        127 :         property->mnIndex = -1; // #i46996# remove old property, so it isn't double
     568         [ +  - ]:       1237 :     sal_Int32 nIndex(static_cast<XMLTableStylesContext *>(pStyles)->GetIndex(nContextID));
     569                 :            :     OSL_ENSURE(nIndex != -1, "Property not found in Map");
     570                 :       1237 :     XMLPropertyState aPropState(nIndex, rValue);
     571         [ +  - ]:       1237 :     GetProperties().push_back(aPropState); // has to be insertes in a sort order later
     572                 :       1237 : }
     573                 :            : 
     574                 :       1237 : XMLPropertyState* XMLTableStyleContext::FindProperty(const sal_Int16 nContextID)
     575                 :            : {
     576                 :       1237 :     XMLPropertyState* pRet = NULL;
     577                 :       1237 :     UniReference < XMLPropertySetMapper > xPrMap;
     578                 :            :     UniReference < SvXMLImportPropertyMapper > xImpPrMap =
     579         [ +  - ]:       1237 :         pStyles->GetImportPropertyMapper( GetFamily() );
     580                 :            :     OSL_ENSURE( xImpPrMap.is(), "There is the import prop mapper" );
     581         [ +  - ]:       1237 :     if( xImpPrMap.is() )
     582 [ +  - ][ +  - ]:       1237 :         xPrMap = xImpPrMap->getPropertySetMapper();
     583         [ +  - ]:       1237 :     if( xPrMap.is() )
     584                 :            :     {
     585                 :       1237 :         ::std::vector< XMLPropertyState >::iterator endproperty(GetProperties().end());
     586                 :       1237 :         ::std::vector< XMLPropertyState >::iterator aIter(GetProperties().begin());
     587 [ +  + ][ +  - ]:       5158 :         while(!pRet && aIter != endproperty)
         [ +  + ][ +  + ]
     588                 :            :         {
     589                 :       3921 :             XMLPropertyState* property = &(*aIter);
     590 [ +  - ][ +  - ]:       3921 :             if (property->mnIndex != -1 && xPrMap->GetEntryContextId(property->mnIndex) == nContextID)
         [ +  + ][ +  + ]
                 [ +  + ]
     591                 :            :             {
     592                 :        127 :                 pRet = property;
     593                 :            :             }
     594                 :            :             else
     595                 :       3794 :                 ++aIter;
     596                 :            :         }
     597                 :            :     }
     598 [ +  - ][ +  - ]:       1237 :     return pRet;
     599                 :            : }
     600                 :            : 
     601                 :       1207 : sal_Int32 XMLTableStyleContext::GetNumberFormat()
     602                 :            : {
     603 [ +  + ][ +  + ]:       1207 :     if (nNumberFormat < 0 && !sDataStyleName.isEmpty())
                 [ +  + ]
     604                 :            :     {
     605                 :            :         const SvXMLNumFormatContext* pStyle = static_cast<const SvXMLNumFormatContext*>(
     606                 :        159 :             pStyles->FindStyleChildContext(XML_STYLE_FAMILY_DATA_STYLE, sDataStyleName, sal_True));
     607                 :            : 
     608         [ -  + ]:        159 :         if (!pStyle)
     609                 :            :         {
     610                 :          0 :             XMLTableStylesContext* pMyStyles = static_cast<XMLTableStylesContext*>(GetScImport().GetStyles());
     611         [ #  # ]:          0 :             if (pMyStyles)
     612                 :            :                 pStyle = static_cast<const SvXMLNumFormatContext*>(
     613                 :          0 :                     pMyStyles->FindStyleChildContext(XML_STYLE_FAMILY_DATA_STYLE, sDataStyleName, sal_True));
     614                 :            :             else
     615                 :            :             {
     616                 :            :                 OSL_FAIL("not possible to get style");
     617                 :            :             }
     618                 :            :         }
     619         [ +  - ]:        159 :         if (pStyle)
     620                 :        159 :             nNumberFormat = const_cast<SvXMLNumFormatContext*>(pStyle)->GetKey();
     621                 :            :     }
     622                 :       1207 :     return nNumberFormat;
     623                 :            : }
     624                 :            : 
     625                 :            : // ----------------------------------------------------------------------------
     626                 :            : 
     627                 :       1298 : SvXMLStyleContext *XMLTableStylesContext::CreateStyleStyleChildContext(
     628                 :            :         sal_uInt16 nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
     629                 :            :         const uno::Reference< xml::sax::XAttributeList > & xAttrList )
     630                 :            : {
     631                 :            :     SvXMLStyleContext *pStyle;
     632                 :            :     // use own wrapper for text and paragraph, to record style usage
     633 [ +  + ][ +  + ]:       1298 :     if (nFamily == XML_STYLE_FAMILY_TEXT_PARAGRAPH || nFamily == XML_STYLE_FAMILY_TEXT_TEXT)
     634                 :         22 :         pStyle = new ScCellTextStyleContext( GetImport(), nPrefix, rLocalName,
     635         [ +  - ]:         22 :                                             xAttrList, *this, nFamily );
     636                 :            :     else
     637                 :            :         pStyle = SvXMLStylesContext::CreateStyleStyleChildContext(
     638                 :       1276 :                     nFamily, nPrefix, rLocalName, xAttrList );
     639                 :            : 
     640         [ +  + ]:       1298 :     if (!pStyle)
     641                 :            :     {
     642         [ +  - ]:       1255 :         switch( nFamily )
     643                 :            :         {
     644                 :            :         case XML_STYLE_FAMILY_TABLE_CELL:
     645                 :            :         case XML_STYLE_FAMILY_TABLE_COLUMN:
     646                 :            :         case XML_STYLE_FAMILY_TABLE_ROW:
     647                 :            :         case XML_STYLE_FAMILY_TABLE_TABLE:
     648                 :            :             pStyle = new XMLTableStyleContext( GetScImport(), nPrefix, rLocalName,
     649         [ +  - ]:       1255 :                                                xAttrList, *this, nFamily );
     650                 :       1255 :             break;
     651                 :            :         }
     652                 :            :     }
     653                 :            : 
     654                 :       1298 :     return pStyle;
     655                 :            : }
     656                 :            : 
     657                 :        102 : SvXMLStyleContext *XMLTableStylesContext::CreateDefaultStyleStyleChildContext(
     658                 :            :         sal_uInt16 nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
     659                 :            :         const uno::Reference< xml::sax::XAttributeList > & xAttrList )
     660                 :            : {
     661                 :            :     SvXMLStyleContext *pStyle(SvXMLStylesContext::CreateDefaultStyleStyleChildContext( nFamily, nPrefix,
     662                 :            :                                                             rLocalName,
     663                 :        102 :                                                             xAttrList ));
     664         [ +  - ]:        102 :     if (!pStyle)
     665                 :            :     {
     666      [ +  +  - ]:        102 :         switch( nFamily )
     667                 :            :         {
     668                 :            :             case XML_STYLE_FAMILY_TABLE_CELL:
     669                 :            :                 pStyle = new XMLTableStyleContext( GetScImport(), nPrefix, rLocalName,
     670         [ +  - ]:         93 :                                             xAttrList, *this, nFamily, sal_True);
     671                 :         93 :             break;
     672                 :            :             case XML_STYLE_FAMILY_SD_GRAPHICS_ID:
     673                 :          9 :                 pStyle = new XMLGraphicsDefaultStyle( GetScImport(), nPrefix, rLocalName,
     674         [ +  - ]:          9 :                                             xAttrList, *this);
     675                 :        102 :             break;
     676                 :            :         }
     677                 :            :     }
     678                 :            : 
     679                 :        102 :     return pStyle;
     680                 :            : }
     681                 :            : 
     682                 :        280 : XMLTableStylesContext::XMLTableStylesContext( SvXMLImport& rImport,
     683                 :            :         sal_uInt16 nPrfx ,
     684                 :            :         const OUString& rLName ,
     685                 :            :         const uno::Reference< XAttributeList > & xAttrList,
     686                 :            :         const bool bTempAutoStyles ) :
     687                 :            :     SvXMLStylesContext( rImport, nPrfx, rLName, xAttrList ),
     688                 :            :     sCellStyleServiceName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.CellStyle" ) )),
     689                 :            :     sColumnStyleServiceName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME ))),
     690                 :            :     sRowStyleServiceName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME ))),
     691                 :            :     sTableStyleServiceName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME ))),
     692                 :            :     nNumberFormatIndex(-1),
     693                 :            :     nConditionalFormatIndex(-1),
     694                 :            :     nCellStyleIndex(-1),
     695                 :            :     nMasterPageNameIndex(-1),
     696 [ +  - ][ +  - ]:        280 :     bAutoStyles(bTempAutoStyles)
         [ +  - ][ +  - ]
     697                 :            : {
     698                 :        280 : }
     699                 :            : 
     700 [ +  - ][ +  - ]:        280 : XMLTableStylesContext::~XMLTableStylesContext()
         [ +  - ][ +  - ]
     701                 :            : {
     702         [ -  + ]:        560 : }
     703                 :            : 
     704                 :        280 : void XMLTableStylesContext::EndElement()
     705                 :            : {
     706                 :        280 :     SvXMLStylesContext::EndElement();
     707         [ +  + ]:        280 :     if (bAutoStyles)
     708 [ +  - ][ +  - ]:        186 :         GetImport().GetTextImport()->SetAutoStyles( this );
     709                 :            :     else
     710                 :         94 :         ((ScXMLImport&)GetImport()).InsertStyles();
     711                 :        280 : }
     712                 :            : 
     713                 :            : UniReference < SvXMLImportPropertyMapper >
     714                 :      10496 :     XMLTableStylesContext::GetImportPropertyMapper(
     715                 :            :                     sal_uInt16 nFamily ) const
     716                 :            : {
     717                 :      10496 :     UniReference < SvXMLImportPropertyMapper > xMapper(SvXMLStylesContext::GetImportPropertyMapper(nFamily));
     718                 :            : 
     719         [ +  + ]:      10496 :     if (!xMapper.is())
     720                 :            :     {
     721   [ +  +  +  +  :       9502 :         switch( nFamily )
                      - ]
     722                 :            :         {
     723                 :            :             case XML_STYLE_FAMILY_TABLE_CELL:
     724                 :            :             {
     725         [ +  + ]:       3818 :                 if( !xCellImpPropMapper.is() )
     726                 :            :                 {
     727                 :            :                     ((XMLTableStylesContext *)this)->xCellImpPropMapper =
     728 [ +  - ][ +  - ]:        130 :                         new ScXMLCellImportPropertyMapper( GetScImport().GetCellStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) );
         [ +  - ][ +  - ]
                 [ +  - ]
     729 [ +  - ][ +  - ]:        130 :                     xCellImpPropMapper->ChainImportMapper(XMLTextImportHelper::CreateParaExtPropMapper(const_cast<SvXMLImport&>(GetImport()), const_cast<XMLFontStylesContext*>(GetScImport().GetFontDecls())));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     730                 :            :                 }
     731         [ +  - ]:       3818 :                 xMapper = xCellImpPropMapper;
     732                 :            :             }
     733                 :       3818 :             break;
     734                 :            :             case XML_STYLE_FAMILY_TABLE_COLUMN:
     735                 :            :             {
     736         [ +  + ]:        515 :                 if( !xColumnImpPropMapper.is() )
     737                 :            :                     ((XMLTableStylesContext *)this)->xColumnImpPropMapper =
     738 [ +  - ][ +  - ]:         93 :                         new SvXMLImportPropertyMapper( GetScImport().GetColumnStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) );
         [ +  - ][ +  - ]
                 [ +  - ]
     739         [ +  - ]:        515 :                 xMapper = xColumnImpPropMapper;
     740                 :            :             }
     741                 :        515 :              break;
     742                 :            :             case XML_STYLE_FAMILY_TABLE_ROW:
     743                 :            :             {
     744         [ +  + ]:       4531 :                 if( !xRowImpPropMapper.is() )
     745                 :            :                     ((XMLTableStylesContext *)this)->xRowImpPropMapper =
     746 [ +  - ][ +  - ]:         93 :                         new ScXMLRowImportPropertyMapper( GetScImport().GetRowStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) );
         [ +  - ][ +  - ]
                 [ +  - ]
     747         [ +  - ]:       4531 :                 xMapper = xRowImpPropMapper;
     748                 :            :             }
     749                 :       4531 :              break;
     750                 :            :             case XML_STYLE_FAMILY_TABLE_TABLE:
     751                 :            :             {
     752         [ +  + ]:        638 :                 if( !xTableImpPropMapper.is() )
     753                 :            :                     ((XMLTableStylesContext *)this)->xTableImpPropMapper =
     754 [ +  - ][ +  - ]:         93 :                         new SvXMLImportPropertyMapper( GetScImport().GetTableStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) );
         [ +  - ][ +  - ]
                 [ +  - ]
     755         [ +  - ]:        638 :                 xMapper = xTableImpPropMapper;
     756                 :            :             }
     757                 :       9502 :              break;
     758                 :            :         }
     759                 :            :     }
     760                 :            : 
     761                 :      10496 :     return xMapper;
     762                 :            : }
     763                 :            : 
     764                 :            : uno::Reference < XNameContainer >
     765                 :       1038 :         XMLTableStylesContext::GetStylesContainer( sal_uInt16 nFamily ) const
     766                 :            : {
     767                 :       1038 :     uno::Reference < XNameContainer > xStyles(SvXMLStylesContext::GetStylesContainer(nFamily));
     768         [ +  - ]:       1038 :     if (!xStyles.is())
     769                 :            :     {
     770                 :       1038 :         OUString sName;
     771   [ -  +  -  -  :       1038 :         switch( nFamily )
                      - ]
     772                 :            :         {
     773                 :            :             case XML_STYLE_FAMILY_TABLE_TABLE:
     774                 :            :             {
     775         [ #  # ]:          0 :                 if( xTableStyles.is() )
     776         [ #  # ]:          0 :                     xStyles.set(xTableStyles);
     777                 :            :                 else
     778                 :            :                     sName =
     779         [ #  # ]:          0 :                         OUString( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "TableStyles" ) ));
     780                 :            :             }
     781                 :          0 :             break;
     782                 :            :             case XML_STYLE_FAMILY_TABLE_CELL:
     783                 :            :             {
     784         [ +  + ]:       1038 :                 if( xCellStyles.is() )
     785         [ +  - ]:        944 :                     xStyles.set(xCellStyles);
     786                 :            :                 else
     787                 :            :                     sName =
     788         [ +  - ]:         94 :                         OUString( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CellStyles" ) ));
     789                 :            :             }
     790                 :       1038 :             break;
     791                 :            :             case XML_STYLE_FAMILY_TABLE_COLUMN:
     792                 :            :             {
     793         [ #  # ]:          0 :                 if( xColumnStyles.is() )
     794         [ #  # ]:          0 :                     xStyles.set(xColumnStyles);
     795                 :            :                 else
     796                 :            :                     sName =
     797         [ #  # ]:          0 :                         OUString( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnStyles" ) ));
     798                 :            :             }
     799                 :          0 :             break;
     800                 :            :             case XML_STYLE_FAMILY_TABLE_ROW:
     801                 :            :             {
     802         [ #  # ]:          0 :                 if( xRowStyles.is() )
     803         [ #  # ]:          0 :                     xStyles.set(xRowStyles);
     804                 :            :                 else
     805                 :            :                     sName =
     806         [ #  # ]:          0 :                         OUString( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowStyles" ) ));
     807                 :            :             }
     808                 :          0 :             break;
     809                 :            :         }
     810 [ +  + ][ +  - ]:       1038 :         if( !xStyles.is() && !sName.isEmpty() && GetScImport().GetModel().is() )
         [ +  - ][ +  + ]
     811                 :            :         {
     812                 :            :             uno::Reference< XStyleFamiliesSupplier > xFamiliesSupp(
     813         [ +  - ]:         94 :                                             GetScImport().GetModel(), UNO_QUERY );
     814         [ +  - ]:         94 :             if (xFamiliesSupp.is())
     815                 :            :             {
     816 [ +  - ][ +  - ]:         94 :                 uno::Reference< XNameAccess > xFamilies(xFamiliesSupp->getStyleFamilies());
     817                 :            : 
     818                 :            :                 try
     819                 :            :                 {
     820 [ +  - ][ +  - ]:         94 :                     xStyles.set(xFamilies->getByName( sName ), uno::UNO_QUERY);
         [ +  - ][ #  # ]
     821                 :            :                 }
     822         [ #  # ]:          0 :                 catch ( uno::Exception& )
     823                 :            :                 {
     824                 :            :                     // #i97680# Named table/column/row styles aren't supported, getByName will throw an exception.
     825                 :            :                     // For better interoperability, these styles should then be handled as automatic styles.
     826                 :            :                     // For now, NULL is returned (and the style is ignored).
     827                 :            :                 }
     828   [ -  +  -  -  :         94 :                 switch( nFamily )
                      - ]
     829                 :            :                 {
     830                 :            :                 case XML_STYLE_FAMILY_TABLE_TABLE:
     831         [ #  # ]:          0 :                     ((XMLTableStylesContext *)this)->xTableStyles.set(xStyles);
     832                 :          0 :                     break;
     833                 :            :                 case XML_STYLE_FAMILY_TABLE_CELL:
     834         [ +  - ]:         94 :                     ((XMLTableStylesContext *)this)->xCellStyles.set(xStyles);
     835                 :         94 :                     break;
     836                 :            :                 case XML_STYLE_FAMILY_TABLE_COLUMN:
     837         [ #  # ]:          0 :                     ((XMLTableStylesContext *)this)->xColumnStyles.set(xStyles);
     838                 :          0 :                     break;
     839                 :            :                 case XML_STYLE_FAMILY_TABLE_ROW:
     840         [ #  # ]:          0 :                     ((XMLTableStylesContext *)this)->xRowStyles.set(xStyles);
     841                 :          0 :                     break;
     842                 :         94 :                 }
     843                 :         94 :             }
     844                 :       1038 :         }
     845                 :            :     }
     846                 :            : 
     847                 :       1038 :     return xStyles;
     848                 :            : }
     849                 :            : 
     850                 :         54 : OUString XMLTableStylesContext::GetServiceName( sal_uInt16 nFamily ) const
     851                 :            : {
     852                 :         54 :     rtl::OUString sServiceName(SvXMLStylesContext::GetServiceName(nFamily));
     853         [ +  - ]:         54 :     if (sServiceName.isEmpty())
     854                 :            :     {
     855   [ -  -  +  -  :         54 :         switch( nFamily )
                      - ]
     856                 :            :         {
     857                 :            :         case XML_STYLE_FAMILY_TABLE_COLUMN:
     858                 :          0 :             sServiceName = sColumnStyleServiceName;
     859                 :          0 :             break;
     860                 :            :         case XML_STYLE_FAMILY_TABLE_ROW:
     861                 :          0 :             sServiceName = sRowStyleServiceName;
     862                 :          0 :             break;
     863                 :            :         case XML_STYLE_FAMILY_TABLE_CELL:
     864                 :         54 :             sServiceName = sCellStyleServiceName;
     865                 :         54 :             break;
     866                 :            :         case XML_STYLE_FAMILY_TABLE_TABLE:
     867                 :          0 :             sServiceName = sTableStyleServiceName;
     868                 :         54 :             break;
     869                 :            :         }
     870                 :            :     }
     871                 :         54 :     return sServiceName;
     872                 :            : }
     873                 :            : 
     874                 :       1237 : sal_Int32 XMLTableStylesContext::GetIndex(const sal_Int16 nContextID)
     875                 :            : {
     876         [ +  + ]:       1237 :     if (nContextID == CTF_SC_CELLSTYLE)
     877                 :            :     {
     878         [ +  + ]:        845 :         if (nCellStyleIndex == -1)
     879                 :            :             nCellStyleIndex =
     880 [ +  - ][ +  - ]:        130 :                 GetImportPropertyMapper(XML_STYLE_FAMILY_TABLE_CELL)->getPropertySetMapper()->FindEntryIndex(nContextID);
                 [ +  - ]
     881                 :        845 :         return nCellStyleIndex;
     882                 :            :     }
     883         [ +  + ]:        392 :     else if (nContextID == CTF_SC_NUMBERFORMAT)
     884                 :            :     {
     885         [ +  + ]:        159 :         if (nNumberFormatIndex == -1)
     886                 :            :             nNumberFormatIndex =
     887 [ +  - ][ +  - ]:        105 :                 GetImportPropertyMapper(XML_STYLE_FAMILY_TABLE_CELL)->getPropertySetMapper()->FindEntryIndex(nContextID);
                 [ +  - ]
     888                 :        159 :         return nNumberFormatIndex;
     889                 :            :     }
     890         [ +  + ]:        233 :     else if (nContextID == CTF_SC_IMPORT_MAP)
     891                 :            :     {
     892         [ +  + ]:          9 :         if (nConditionalFormatIndex == -1)
     893                 :            :             nConditionalFormatIndex =
     894 [ +  - ][ +  - ]:          3 :                 GetImportPropertyMapper(XML_STYLE_FAMILY_TABLE_CELL)->getPropertySetMapper()->FindEntryIndex(nContextID);
                 [ +  - ]
     895                 :          9 :         return nConditionalFormatIndex;
     896                 :            :     }
     897         [ +  - ]:        224 :     else if (nContextID == CTF_SC_MASTERPAGENAME)
     898                 :            :     {
     899         [ +  + ]:        224 :         if (nMasterPageNameIndex == -1)
     900                 :            :                 nMasterPageNameIndex =
     901 [ +  - ][ +  - ]:         93 :                 GetImportPropertyMapper(XML_STYLE_FAMILY_TABLE_TABLE)->getPropertySetMapper()->FindEntryIndex(nContextID);
                 [ +  - ]
     902                 :        224 :         return nMasterPageNameIndex;
     903                 :            :     }
     904                 :            :     else
     905                 :       1237 :         return -1;
     906                 :            : }
     907                 :            : 
     908                 :            : // ---------------------------------------------------------------------------
     909 [ #  # ][ #  # ]:          0 : TYPEINIT1( ScXMLMasterStylesContext, SvXMLStylesContext );
     910                 :            : 
     911                 :        384 : sal_Bool ScXMLMasterStylesContext::InsertStyleFamily( sal_uInt16 ) const
     912                 :            : {
     913                 :        384 :     return sal_True;
     914                 :            : }
     915                 :            : 
     916                 :         93 : ScXMLMasterStylesContext::ScXMLMasterStylesContext(
     917                 :            :         SvXMLImport& rImport,
     918                 :            :         sal_uInt16 nPrfx, const OUString& rLName,
     919                 :            :         const uno::Reference< XAttributeList > & xAttrList ) :
     920                 :         93 :     SvXMLStylesContext( rImport, nPrfx, rLName, xAttrList )
     921                 :            : {
     922                 :         93 : }
     923                 :            : 
     924                 :         93 : ScXMLMasterStylesContext::~ScXMLMasterStylesContext()
     925                 :            : {
     926         [ -  + ]:        186 : }
     927                 :            : 
     928                 :        192 : SvXMLStyleContext *ScXMLMasterStylesContext::CreateStyleChildContext(
     929                 :            :         sal_uInt16 nPrefix,
     930                 :            :         const OUString& rLocalName,
     931                 :            :         const uno::Reference< XAttributeList > & xAttrList )
     932                 :            : {
     933                 :        192 :     SvXMLStyleContext *pContext(0);
     934                 :            : 
     935   [ +  -  +  -  :        576 :     if( (XML_NAMESPACE_STYLE == nPrefix) &&
           +  - ][ +  - ]
     936                 :        192 :         IsXMLToken(rLocalName, XML_MASTER_PAGE) &&
     937                 :        192 :          InsertStyleFamily( XML_STYLE_FAMILY_MASTER_PAGE ) )
     938                 :            :         pContext = new ScMasterPageContext(
     939                 :        192 :                         GetImport(), nPrefix, rLocalName, xAttrList,
     940 [ +  - ][ +  - ]:        192 :                         !GetImport().GetTextImport()->IsInsertMode() );
         [ +  - ][ +  - ]
     941                 :            : 
     942                 :            :     // any other style will be ignored here!
     943                 :            : 
     944                 :        192 :     return pContext;
     945                 :            : }
     946                 :            : 
     947                 :          0 : SvXMLStyleContext *ScXMLMasterStylesContext::CreateStyleStyleChildContext(
     948                 :            :         sal_uInt16 /* nFamily */,
     949                 :            :         sal_uInt16 /* nPrefix */,
     950                 :            :         const OUString& /* rLocalName */,
     951                 :            :         const uno::Reference< XAttributeList > & /* xAttrList */ )
     952                 :            : {
     953                 :          0 :     return 0;
     954                 :            : }
     955                 :            : 
     956                 :         93 : void ScXMLMasterStylesContext::EndElement()
     957                 :            : {
     958                 :         93 :     FinishStyles(sal_True);
     959                 :         93 : }
     960                 :            : 
     961 [ #  # ][ #  # ]:          0 : TYPEINIT1( ScMasterPageContext, XMLTextMasterPageContext );
     962                 :            : 
     963                 :        192 : ScMasterPageContext::ScMasterPageContext( SvXMLImport& rImport,
     964                 :            :         sal_uInt16 nPrfx, const OUString& rLName,
     965                 :            :         const uno::Reference< XAttributeList > & xAttrList,
     966                 :            :         bool bOverwrite ) :
     967                 :            :     XMLTextMasterPageContext( rImport, nPrfx, rLName, xAttrList, bOverwrite ),
     968                 :            :     bContainsRightHeader(false),
     969                 :        192 :     bContainsRightFooter(false)
     970                 :            : {
     971                 :        192 : }
     972                 :            : 
     973                 :        192 : ScMasterPageContext::~ScMasterPageContext()
     974                 :            : {
     975         [ -  + ]:        384 : }
     976                 :            : 
     977                 :        748 : SvXMLImportContext *ScMasterPageContext::CreateChildContext(
     978                 :            :         sal_uInt16 nPrefix,
     979                 :            :         const OUString& rLocalName,
     980                 :            :         const uno::Reference< XAttributeList > & xAttrList )
     981                 :            : {
     982                 :        748 :     return XMLTextMasterPageContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
     983                 :            : }
     984                 :            : 
     985                 :        748 : SvXMLImportContext *ScMasterPageContext::CreateHeaderFooterContext(
     986                 :            :             sal_uInt16 nPrefix,
     987                 :            :             const ::rtl::OUString& rLocalName,
     988                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
     989                 :            :             const sal_Bool bFooter,
     990                 :            :             const sal_Bool bLeft,
     991                 :            :             const sal_Bool /*bFirst*/ )
     992                 :            : {
     993         [ +  + ]:        748 :     if (!bLeft)
     994                 :            :     {
     995         [ +  + ]:        384 :         if (bFooter)
     996                 :        192 :             bContainsRightFooter = sal_True;
     997                 :            :         else
     998                 :        192 :             bContainsRightHeader = sal_True;
     999                 :            :     }
    1000         [ +  + ]:        748 :     if (!xPropSet.is())
    1001         [ +  - ]:        192 :         xPropSet.set(GetStyle(), UNO_QUERY );
    1002                 :        748 :     return new XMLTableHeaderFooterContext( GetImport(),
    1003                 :            :                                                 nPrefix, rLocalName,
    1004                 :            :                                                 xAttrList,
    1005                 :            :                                                 xPropSet,
    1006         [ +  - ]:        748 :                                                 bFooter, bLeft );
    1007                 :            : }
    1008                 :            : 
    1009                 :          0 : void ScMasterPageContext::ClearContent(const rtl::OUString& rContent)
    1010                 :            : {
    1011         [ #  # ]:          0 :     if (!xPropSet.is())
    1012         [ #  # ]:          0 :         xPropSet.set(GetStyle(), UNO_QUERY );
    1013                 :            : 
    1014         [ #  # ]:          0 :     if (xPropSet.is())
    1015                 :            :     {
    1016 [ #  # ][ #  # ]:          0 :         uno::Reference < sheet::XHeaderFooterContent > xHeaderFooterContent(xPropSet->getPropertyValue( rContent ), uno::UNO_QUERY);
                 [ #  # ]
    1017         [ #  # ]:          0 :         if (xHeaderFooterContent.is())
    1018                 :            :         {
    1019 [ #  # ][ #  # ]:          0 :             xHeaderFooterContent->getLeftText()->setString(sEmpty);
         [ #  # ][ #  # ]
    1020 [ #  # ][ #  # ]:          0 :             xHeaderFooterContent->getCenterText()->setString(sEmpty);
         [ #  # ][ #  # ]
    1021 [ #  # ][ #  # ]:          0 :             xHeaderFooterContent->getRightText()->setString(sEmpty);
         [ #  # ][ #  # ]
    1022 [ #  # ][ #  # ]:          0 :             xPropSet->setPropertyValue( rContent, uno::makeAny(xHeaderFooterContent) );
                 [ #  # ]
    1023                 :          0 :         }
    1024                 :            :     }
    1025                 :          0 : }
    1026                 :            : 
    1027                 :        192 : void ScMasterPageContext::Finish( sal_Bool bOverwrite )
    1028                 :            : {
    1029                 :        192 :     XMLTextMasterPageContext::Finish(bOverwrite);
    1030         [ -  + ]:        192 :     if (!bContainsRightFooter)
    1031         [ #  # ]:          0 :         ClearContent(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_PAGE_RIGHTFTRCON)));
    1032         [ -  + ]:        192 :     if (!bContainsRightHeader)
    1033         [ #  # ]:          0 :         ClearContent(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_PAGE_RIGHTHDRCON)));
    1034                 :        192 : }
    1035                 :            : 
    1036                 :            : // ---------------------------------------------------------------------------
    1037                 :            : 
    1038                 :         22 : ScCellTextStyleContext::ScCellTextStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
    1039                 :            :             const rtl::OUString& rLName, const uno::Reference<xml::sax::XAttributeList> & xAttrList,
    1040                 :            :             SvXMLStylesContext& rStyles, sal_uInt16 nFamily, sal_Bool bDefaultStyle ) :
    1041                 :            :     XMLTextStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, bDefaultStyle ),
    1042                 :         22 :     nLastSheet(-1)
    1043                 :            : {
    1044                 :         22 : }
    1045                 :            : 
    1046                 :         22 : ScCellTextStyleContext::~ScCellTextStyleContext()
    1047                 :            : {
    1048         [ -  + ]:         44 : }
    1049                 :            : 
    1050                 :        103 : void ScCellTextStyleContext::FillPropertySet( const uno::Reference<beans::XPropertySet>& xPropSet )
    1051                 :            : {
    1052                 :        103 :     XMLTextStyleContext::FillPropertySet( xPropSet );
    1053                 :            : 
    1054                 :        103 :     ScXMLImport& rXMLImport = GetScImport();
    1055                 :            : 
    1056         [ +  - ]:        103 :     ScCellTextCursor* pCellImp = ScCellTextCursor::getImplementation( xPropSet );
    1057         [ +  + ]:        103 :     if (pCellImp)
    1058                 :            :     {
    1059                 :          3 :         ScAddress aPos = pCellImp->GetCellObj().GetPosition();
    1060         [ +  - ]:          3 :         if ( aPos.Tab() != nLastSheet )
    1061                 :            :         {
    1062                 :          3 :             ESelection aSel = pCellImp->GetSelection();
    1063                 :            : 
    1064 [ +  - ][ +  - ]:          3 :             ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetImport().GetModel())->GetSheetSaveData();
    1065         [ +  - ]:          3 :             pSheetData->AddTextStyle( GetName(), aPos, aSel );
    1066                 :            : 
    1067                 :          3 :             nLastSheet = aPos.Tab();
    1068                 :            :         }
    1069                 :            :     }
    1070         [ +  - ]:        100 :     else if ( rXMLImport.GetTables().GetCurrentSheet() != nLastSheet )
    1071                 :            :     {
    1072         [ +  - ]:        100 :         ScDrawTextCursor* pDrawImp = ScDrawTextCursor::getImplementation( xPropSet );
    1073         [ +  + ]:        100 :         if (pDrawImp)
    1074                 :            :         {
    1075                 :          3 :             XMLTableShapeImportHelper* pTableShapeImport = (XMLTableShapeImportHelper*)GetScImport().GetShapeImport().get();
    1076                 :          3 :             ScXMLAnnotationContext* pAnnotationContext = pTableShapeImport->GetAnnotationContext();
    1077         [ +  - ]:          3 :             if (pAnnotationContext)
    1078                 :            :             {
    1079                 :          3 :                 pAnnotationContext->AddContentStyle( GetFamily(), GetName(), pDrawImp->GetSelection() );
    1080                 :          3 :                 nLastSheet = rXMLImport.GetTables().GetCurrentSheet();
    1081                 :            :             }
    1082                 :            :         }
    1083                 :            : 
    1084                 :            :         // if it's a different shape, BlockSheet is called from XMLTableShapeImportHelper::finishShape
    1085                 :            :         // formatted text in page headers/footers can be ignored
    1086                 :            :     }
    1087                 :        103 : }
    1088                 :            : 
    1089                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10