LCOV - code coverage report
Current view: top level - reportdesign/source/filter/xml - xmlSubDocument.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 55 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 147 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                 :            : #include "xmlSubDocument.hxx"
      29                 :            : #include "xmlCell.hxx"
      30                 :            : #include "xmlfilter.hxx"
      31                 :            : #include <xmloff/xmltoken.hxx>
      32                 :            : #include <xmloff/xmlnmspe.hxx>
      33                 :            : #include <xmloff/nmspmap.hxx>
      34                 :            : #include "xmlEnums.hxx"
      35                 :            : #include "xmlMasterFields.hxx"
      36                 :            : #include "xmlTable.hxx"
      37                 :            : #include <tools/debug.hxx>
      38                 :            : #include <comphelper/property.hxx>
      39                 :            : #include <com/sun/star/report/XReportControlModel.hpp>
      40                 :            : 
      41                 :            : namespace rptxml
      42                 :            : {
      43                 :            :     using namespace ::com::sun::star;
      44                 :            :     using namespace ::com::sun::star::report;
      45                 :            :     using namespace ::com::sun::star::uno;
      46                 :            :     using namespace ::com::sun::star::xml::sax;
      47                 :            : DBG_NAME( rpt_OXMLSubDocument )
      48                 :            : 
      49                 :          0 : OXMLSubDocument::OXMLSubDocument( ORptFilter& rImport,
      50                 :            :                 sal_uInt16 nPrfx
      51                 :            :                 ,const ::rtl::OUString& rLName
      52                 :            :                 ,const Reference< XReportComponent > & _xComponent
      53                 :            :                 ,OXMLTable* _pContainer
      54                 :            :                 ,OXMLCell* _pCellParent) :
      55                 :            :     OXMLReportElementBase( rImport, nPrfx, rLName,_xComponent.get(),_pContainer)
      56                 :            : ,m_xFake(_xComponent)
      57                 :            : ,m_pCellParent(_pCellParent)
      58                 :            : ,m_nCurrentCount(0)
      59 [ #  # ][ #  # ]:          0 : ,m_bContainsShape(false)
                 [ #  # ]
      60                 :            : {
      61                 :            :     DBG_CTOR( rpt_OXMLSubDocument,NULL);
      62                 :            : 
      63                 :          0 : }
      64                 :            : // -----------------------------------------------------------------------------
      65                 :            : 
      66                 :          0 : OXMLSubDocument::~OXMLSubDocument()
      67                 :            : {
      68                 :            :     DBG_DTOR( rpt_OXMLSubDocument,NULL);
      69         [ #  # ]:          0 : }
      70                 :            : 
      71                 :            : // -----------------------------------------------------------------------------
      72                 :          0 : SvXMLImportContext* OXMLSubDocument::_CreateChildContext(
      73                 :            :         sal_uInt16 _nPrefix,
      74                 :            :         const ::rtl::OUString& _rLocalName,
      75                 :            :         const Reference< XAttributeList > & xAttrList )
      76                 :            : {
      77                 :          0 :     SvXMLImportContext *pContext = OXMLReportElementBase::_CreateChildContext(_nPrefix,_rLocalName,xAttrList);
      78         [ #  # ]:          0 :     if ( pContext )
      79                 :          0 :         return pContext;
      80                 :          0 :     const SvXMLTokenMap&    rTokenMap   = static_cast<ORptFilter&>(GetImport()).GetReportElemTokenMap();
      81                 :            : 
      82      [ #  #  # ]:          0 :     switch( rTokenMap.Get( _nPrefix, _rLocalName ) )
      83                 :            :     {
      84                 :            :         case XML_TOK_MASTER_DETAIL_FIELDS:
      85                 :            :             {
      86                 :          0 :                 GetImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      87         [ #  # ]:          0 :                 pContext = new OXMLMasterFields(static_cast<ORptFilter&>(GetImport()), _nPrefix, _rLocalName,xAttrList ,this);
      88                 :            :             }
      89                 :          0 :             break;
      90                 :            :         case XML_TOK_SUB_FRAME:
      91                 :            :             {
      92         [ #  # ]:          0 :                 if ( !m_bContainsShape )
      93 [ #  # ][ #  # ]:          0 :                     m_nCurrentCount = m_pContainer->getSection()->getCount();
                 [ #  # ]
      94         [ #  # ]:          0 :                 UniReference< XMLShapeImportHelper > xShapeImportHelper = GetImport().GetShapeImport();
      95 [ #  # ][ #  # ]:          0 :                 uno::Reference< drawing::XShapes > xShapes = m_pContainer->getSection().get();
         [ #  # ][ #  # ]
      96 [ #  # ][ #  # ]:          0 :                 pContext = xShapeImportHelper->CreateGroupChildContext(GetImport(),_nPrefix,_rLocalName,xAttrList,xShapes);
      97                 :          0 :                 m_bContainsShape = true;
      98         [ #  # ]:          0 :                 if (m_pCellParent)
      99                 :            :                 {
     100                 :            :                     // #i94115 say to the parent Cell it contains shapes
     101         [ #  # ]:          0 :                     m_pCellParent->setContainsShape(true);
     102         [ #  # ]:          0 :                 }
     103                 :            :             }
     104                 :          0 :             break;
     105                 :            :         default:
     106                 :          0 :             break;
     107                 :            :     }
     108                 :            : 
     109         [ #  # ]:          0 :     if( !pContext )
     110         [ #  # ]:          0 :         pContext = new SvXMLImportContext( GetImport(), _nPrefix, _rLocalName );
     111                 :            : 
     112                 :          0 :     return pContext;
     113                 :            : }
     114                 :            : // -----------------------------------------------------------------------------
     115                 :          0 : void OXMLSubDocument::EndElement()
     116                 :            : {
     117         [ #  # ]:          0 :     if ( m_bContainsShape )
     118                 :            :     {
     119 [ #  # ][ #  # ]:          0 :         m_xComponent.set(m_pContainer->getSection()->getByIndex(m_nCurrentCount),uno::UNO_QUERY);
                 [ #  # ]
     120         [ #  # ]:          0 :         if ( m_xComponent.is() )
     121                 :            :         {
     122         [ #  # ]:          0 :             if ( !m_aMasterFields.empty() )
     123 [ #  # ][ #  # ]:          0 :                 m_xComponent->setMasterFields(Sequence< ::rtl::OUString>(&*m_aMasterFields.begin(),m_aMasterFields.size()));
         [ #  # ][ #  # ]
     124         [ #  # ]:          0 :             if ( !m_aDetailFields.empty() )
     125 [ #  # ][ #  # ]:          0 :                 m_xComponent->setDetailFields(Sequence< ::rtl::OUString>(&*m_aDetailFields.begin(),m_aDetailFields.size()));
         [ #  # ][ #  # ]
     126                 :            : 
     127 [ #  # ][ #  # ]:          0 :             m_xComponent->setName(m_xFake->getName());
         [ #  # ][ #  # ]
     128 [ #  # ][ #  # ]:          0 :             m_xComponent->setPrintRepeatedValues(m_xFake->getPrintRepeatedValues());
         [ #  # ][ #  # ]
     129         [ #  # ]:          0 :             uno::Reference< report::XReportControlModel >   xFakeModel(m_xFake,uno::UNO_QUERY);
     130         [ #  # ]:          0 :             uno::Reference< report::XReportControlModel >   xComponentModel(m_xComponent,uno::UNO_QUERY);
     131 [ #  # ][ #  # ]:          0 :             if ( xComponentModel.is() && xFakeModel.is() )
                 [ #  # ]
     132                 :            :             {
     133 [ #  # ][ #  # ]:          0 :                 const sal_Int32 nCount = xFakeModel->getCount();
     134                 :            :                 try
     135                 :            :                 {
     136         [ #  # ]:          0 :                     for (sal_Int32 i = 0; i < nCount ; ++i)
     137                 :            :                     {
     138 [ #  # ][ #  # ]:          0 :                         uno::Reference< report::XFormatCondition > xCond(xFakeModel->getByIndex(i),uno::UNO_QUERY);
                 [ #  # ]
     139 [ #  # ][ #  # ]:          0 :                         uno::Reference< report::XFormatCondition > xNewCond = xComponentModel->createFormatCondition();
     140 [ #  # ][ #  # ]:          0 :                         ::comphelper::copyProperties(xCond.get(),xNewCond.get());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     141 [ #  # ][ #  # ]:          0 :                         xComponentModel->insertByIndex(xComponentModel->getCount(),uno::makeAny(xNewCond));
         [ #  # ][ #  # ]
                 [ #  # ]
     142         [ #  # ]:          0 :                     }
     143                 :            :                 }
     144         [ #  # ]:          0 :                 catch(uno::Exception&)
     145                 :            :                 {
     146                 :            :                     OSL_FAIL("Can not access format condition!");
     147                 :            :                 }
     148                 :            : 
     149                 :          0 :             }
     150                 :            :         }
     151                 :            :     }
     152                 :          0 : }
     153                 :            : // -----------------------------------------------------------------------------
     154                 :          0 : void OXMLSubDocument::addMasterDetailPair(const ::std::pair< ::rtl::OUString,::rtl::OUString >& _aPair)
     155                 :            : {
     156                 :          0 :     m_aMasterFields.push_back(_aPair.first);
     157                 :          0 :     m_aDetailFields.push_back(_aPair.second);
     158                 :          0 : }
     159                 :            : //----------------------------------------------------------------------------
     160                 :            : } // namespace rptxml
     161                 :            : // -----------------------------------------------------------------------------
     162                 :            : 
     163                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10