LCOV - code coverage report
Current view: top level - reportdesign/source/filter/xml - xmlColumn.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 69 0.0 %
Date: 2012-08-25 Functions: 0 7 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 113 0.0 %

           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 "xmlColumn.hxx"
      30                 :            : #include <xmloff/xmluconv.hxx>
      31                 :            : #include "xmlfilter.hxx"
      32                 :            : #include <xmloff/xmltoken.hxx>
      33                 :            : #include <xmloff/xmlnmspe.hxx>
      34                 :            : #include <xmloff/nmspmap.hxx>
      35                 :            : #include "xmlEnums.hxx"
      36                 :            : #include "xmlCell.hxx"
      37                 :            : #include <tools/debug.hxx>
      38                 :            : #include "xmlStyleImport.hxx"
      39                 :            : #include "xmlTable.hxx"
      40                 :            : #include <comphelper/namecontainer.hxx>
      41                 :            : #include <comphelper/genericpropertyset.hxx>
      42                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      43                 :            : #include "xmlstrings.hrc"
      44                 :            : 
      45                 :            : #define PROPERTY_ID_WIDTH    1
      46                 :            : #define PROPERTY_ID_HEIGHT   2
      47                 :            : 
      48                 :            : namespace rptxml
      49                 :            : {
      50                 :            :     using namespace ::comphelper;
      51                 :            :     using namespace ::com::sun::star::uno;
      52                 :            :     using namespace ::com::sun::star::beans;
      53                 :            :     using namespace ::com::sun::star::xml::sax;
      54                 :            : 
      55                 :            : DBG_NAME( rpt_OXMLRowColumn )
      56                 :            : 
      57                 :          0 : OXMLRowColumn::OXMLRowColumn( ORptFilter& rImport
      58                 :            :                 ,sal_uInt16 nPrfx
      59                 :            :                 ,const ::rtl::OUString& _sLocalName
      60                 :            :                 ,const Reference< XAttributeList > & _xAttrList
      61                 :            :                 ,OXMLTable* _pContainer
      62                 :            :                 ) :
      63                 :            :     SvXMLImportContext( rImport, nPrfx, _sLocalName )
      64                 :          0 :     ,m_pContainer(_pContainer)
      65                 :            : {
      66                 :            :     DBG_CTOR( rpt_OXMLRowColumn,NULL);
      67                 :            : 
      68                 :          0 :     const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
      69         [ #  # ]:          0 :     const SvXMLTokenMap& rTokenMap = rImport.GetColumnTokenMap();
      70                 :            : 
      71 [ #  # ][ #  # ]:          0 :     const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
                 [ #  # ]
      72         [ #  # ]:          0 :     for(sal_Int16 i = 0; i < nLength; ++i)
      73                 :            :     {
      74                 :          0 :      ::rtl::OUString sLocalName;
      75 [ #  # ][ #  # ]:          0 :         const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i );
      76         [ #  # ]:          0 :         const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName );
      77 [ #  # ][ #  # ]:          0 :         const rtl::OUString sValue = _xAttrList->getValueByIndex( i );
      78                 :            : 
      79 [ #  # ][ #  # ]:          0 :         switch( rTokenMap.Get( nPrefix, sLocalName ) )
      80                 :            :         {
      81                 :            :             case XML_TOK_COLUMN_STYLE_NAME:
      82         [ #  # ]:          0 :                 fillStyle(sValue);
      83                 :          0 :                 break;
      84                 :            :             default:
      85                 :          0 :                 break;
      86                 :            :         }
      87                 :          0 :     }
      88                 :          0 : }
      89                 :            : // -----------------------------------------------------------------------------
      90                 :            : 
      91                 :          0 : OXMLRowColumn::~OXMLRowColumn()
      92                 :            : {
      93                 :            :     DBG_DTOR( rpt_OXMLRowColumn,NULL);
      94         [ #  # ]:          0 : }
      95                 :            : // -----------------------------------------------------------------------------
      96                 :          0 : SvXMLImportContext* OXMLRowColumn::CreateChildContext(
      97                 :            :         sal_uInt16 nPrefix,
      98                 :            :         const ::rtl::OUString& rLocalName,
      99                 :            :         const Reference< XAttributeList > & xAttrList )
     100                 :            : {
     101                 :          0 :     SvXMLImportContext *pContext = 0;
     102                 :          0 :     ORptFilter& rImport = GetOwnImport();
     103                 :          0 :     const SvXMLTokenMap&    rTokenMap   = rImport.GetColumnTokenMap();
     104                 :            : 
     105   [ #  #  #  #  :          0 :     switch( rTokenMap.Get( nPrefix, rLocalName ) )
                      # ]
     106                 :            :     {
     107                 :            :         case XML_TOK_COLUMN:
     108                 :          0 :             rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
     109         [ #  # ]:          0 :             pContext = new OXMLRowColumn( rImport, nPrefix, rLocalName,xAttrList,m_pContainer);
     110                 :          0 :             break;
     111                 :            :         case XML_TOK_ROW:
     112                 :          0 :             m_pContainer->incrementRowIndex();
     113                 :          0 :             rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
     114         [ #  # ]:          0 :             pContext = new OXMLRowColumn( rImport, nPrefix, rLocalName,xAttrList,m_pContainer);
     115                 :          0 :             break;
     116                 :            :         case XML_TOK_CELL:
     117                 :          0 :             m_pContainer->incrementColumnIndex();
     118                 :          0 :             rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
     119         [ #  # ]:          0 :             pContext = new OXMLCell( rImport, nPrefix, rLocalName,xAttrList,m_pContainer);
     120                 :          0 :             break;
     121                 :            :         case XML_TOK_COV_CELL:
     122                 :          0 :             m_pContainer->incrementColumnIndex();
     123         [ #  # ]:          0 :             m_pContainer->addCell(NULL);
     124                 :          0 :             break;
     125                 :            :         default:
     126                 :          0 :             break;
     127                 :            :     }
     128                 :            : 
     129         [ #  # ]:          0 :     if( !pContext )
     130         [ #  # ]:          0 :         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
     131                 :            : 
     132                 :          0 :     return pContext;
     133                 :            : }
     134                 :            : // -----------------------------------------------------------------------------
     135                 :          0 : void OXMLRowColumn::fillStyle(const ::rtl::OUString& _sStyleName)
     136                 :            : {
     137         [ #  # ]:          0 :     if ( !_sStyleName.isEmpty() )
     138                 :            :     {
     139                 :          0 :         const SvXMLStylesContext* pAutoStyles = GetOwnImport().GetAutoStyles();
     140         [ #  # ]:          0 :         if ( pAutoStyles )
     141                 :            :         {
     142                 :          0 :             PropertySetInfo* pInfo = new PropertySetInfo();
     143                 :            :             static PropertyMapEntry pMap[] =
     144                 :            :             {
     145         [ #  # ]:          0 :                 {PROPERTY_WIDTH.ascii,  static_cast<sal_uInt16>(PROPERTY_WIDTH.length),     PROPERTY_ID_WIDTH,          &::getCppuType(static_cast< sal_Int32* >( NULL ))       ,PropertyAttribute::BOUND,0},
     146         [ #  # ]:          0 :                 {PROPERTY_HEIGHT.ascii, static_cast<sal_uInt16>(PROPERTY_HEIGHT.length),    PROPERTY_ID_HEIGHT,         &::getCppuType(static_cast< sal_Int32* >( NULL ))       ,PropertyAttribute::BOUND,0},
     147                 :            :                 { NULL, 0, 0, NULL, 0, 0 }
     148 [ #  # ][ #  # ]:          0 :             };
                 [ #  # ]
     149                 :          0 :             pInfo->add(pMap);
     150         [ #  # ]:          0 :             Reference<XPropertySet> xProp = GenericPropertySet_CreateInstance(pInfo);
     151 [ #  # ][ #  # ]:          0 :             XMLPropStyleContext* pAutoStyle = PTR_CAST(XMLPropStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_COLUMN,_sStyleName));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     152         [ #  # ]:          0 :             if ( pAutoStyle )
     153                 :            :             {
     154         [ #  # ]:          0 :                 pAutoStyle->FillPropertySet(xProp);
     155                 :          0 :                 sal_Int32 nWidth = 0;
     156 [ #  # ][ #  # ]:          0 :                 xProp->getPropertyValue(PROPERTY_WIDTH) >>= nWidth;
                 [ #  # ]
     157         [ #  # ]:          0 :                 m_pContainer->addWidth(nWidth);
     158                 :            :             }
     159                 :            :             else
     160                 :            :             {
     161 [ #  # ][ #  # ]:          0 :                 pAutoStyle = PTR_CAST(XMLPropStyleContext,pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_ROW,_sStyleName));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     162         [ #  # ]:          0 :                 if ( pAutoStyle )
     163                 :            :                 {
     164         [ #  # ]:          0 :                     pAutoStyle->FillPropertySet(xProp);
     165                 :          0 :                     sal_Int32 nHeight = 0;
     166 [ #  # ][ #  # ]:          0 :                     xProp->getPropertyValue(PROPERTY_HEIGHT) >>= nHeight;
                 [ #  # ]
     167         [ #  # ]:          0 :                     m_pContainer->addHeight(nHeight);
     168                 :            :                 }
     169                 :          0 :             }
     170                 :            :         }
     171                 :            :     }
     172                 :          0 : }
     173                 :            : // -----------------------------------------------------------------------------
     174                 :          0 : ORptFilter& OXMLRowColumn::GetOwnImport()
     175                 :            : {
     176                 :          0 :     return static_cast<ORptFilter&>(GetImport());
     177                 :            : }
     178                 :            : // -----------------------------------------------------------------------------
     179                 :          0 : void OXMLRowColumn::EndElement()
     180                 :            : {
     181                 :          0 : }
     182                 :            : //----------------------------------------------------------------------------
     183                 :            : } // namespace rptxml
     184                 :            : // -----------------------------------------------------------------------------
     185                 :            : 
     186                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10