LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/xml - xmlstyli.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 6 6 100.0 %
Date: 2012-12-27 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef SC_XMLSTYLI_HXX
      21             : #define SC_XMLSTYLI_HXX
      22             : 
      23             : #include <rtl/ustring.hxx>
      24             : #include <vector>
      25             : #include <xmloff/xmlimp.hxx>
      26             : #include <xmloff/xmlictxt.hxx>
      27             : #include <xmloff/maptype.hxx>
      28             : #include <xmloff/prstylei.hxx>
      29             : #include <xmloff/xmlimppr.hxx>
      30             : #include <xmloff/XMLTextMasterPageContext.hxx>
      31             : #include <xmloff/XMLTextMasterStylesContext.hxx>
      32             : #include <xmloff/txtstyli.hxx>
      33             : #include <com/sun/star/sheet/ConditionOperator.hpp>
      34             : #include "xmlimprt.hxx"
      35             : 
      36             : class ScConditionalFormat;
      37             : 
      38             : class ScXMLCellImportPropertyMapper : public SvXMLImportPropertyMapper
      39             : {
      40             : protected:
      41             : 
      42             : public:
      43             : 
      44             :     ScXMLCellImportPropertyMapper(
      45             :             const UniReference< XMLPropertySetMapper >& rMapper,
      46             :             SvXMLImport& rImport);
      47             :     virtual ~ScXMLCellImportPropertyMapper();
      48             : 
      49             :     /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set */
      50             : /*  virtual sal_Bool handleSpecialItem(
      51             :             XMLPropertyState& rProperty,
      52             :             ::std::vector< XMLPropertyState >& rProperties,
      53             :             const ::rtl::OUString& rValue,
      54             :             const SvXMLUnitConverter& rUnitConverter,
      55             :             const SvXMLNamespaceMap& rNamespaceMap ) const;*/
      56             : 
      57             :     /** this method is called for every item that has the MID_FLAG_NO_ITEM_IMPORT flag set */
      58             : /*  virtual sal_Bool handleNoItem(
      59             :             sal_Int32 nIndex,
      60             :             ::std::vector< XMLPropertyState >& rProperties,
      61             :                const ::rtl::OUString& rValue,
      62             :                const SvXMLUnitConverter& rUnitConverter,
      63             :                const SvXMLNamespaceMap& rNamespaceMap ) const;*/
      64             : 
      65             :     /** This method is called when all attributes have been processed. It may be used to remove items that are incomplete */
      66             :     virtual void finished(
      67             :             ::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
      68             : };
      69             : 
      70             : class ScXMLRowImportPropertyMapper : public SvXMLImportPropertyMapper
      71             : {
      72             : protected:
      73             : 
      74             : public:
      75             : 
      76             :     ScXMLRowImportPropertyMapper(
      77             :             const UniReference< XMLPropertySetMapper >& rMapper,
      78             :             SvXMLImport& rImport);
      79             :     virtual ~ScXMLRowImportPropertyMapper();
      80             : 
      81             :     /** This method is called when all attributes have been processed. It may be used to remove items that are incomplete */
      82             :     virtual void finished(
      83             :             ::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
      84             : };
      85             : 
      86             : class XMLTableStyleContext : public XMLPropStyleContext
      87             : {
      88             :     ::rtl::OUString             sDataStyleName;
      89             :     rtl::OUString               sPageStyle;
      90             :     SvXMLStylesContext*         pStyles;
      91             :     sal_Int32                   nNumberFormat;
      92             :     SCTAB                       nLastSheet;
      93             :     bool                        bParentSet;
      94             :     ScConditionalFormat*        mpCondFormat;
      95             :     bool                        mbDeleteCondFormat;
      96             : 
      97             :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
      98          12 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
      99             : 
     100             : protected:
     101             : 
     102             :     virtual void SetAttribute( sal_uInt16 nPrefixKey,
     103             :                                const ::rtl::OUString& rLocalName,
     104             :                                const ::rtl::OUString& rValue );
     105             : 
     106             : public:
     107             : 
     108             :     TYPEINFO();
     109             : 
     110             :     XMLTableStyleContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     111             :             const ::rtl::OUString& rLName,
     112             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
     113             :             SvXMLStylesContext& rStyles, sal_uInt16 nFamily, bool bDefaultStyle = false );
     114             :     virtual ~XMLTableStyleContext();
     115             : 
     116             :     virtual SvXMLImportContext *CreateChildContext(
     117             :             sal_uInt16 nPrefix,
     118             :             const ::rtl::OUString& rLocalName,
     119             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
     120             : 
     121             :     virtual void FillPropertySet(const ::com::sun::star::uno::Reference<
     122             :                 ::com::sun::star::beans::XPropertySet > & rPropSet );
     123             : 
     124             :     virtual void SetDefaults();
     125             : 
     126             :       void AddProperty(sal_Int16 nContextID, const com::sun::star::uno::Any& aValue);
     127             :     XMLPropertyState* FindProperty(const sal_Int16 nContextID);
     128             : 
     129             :     sal_Int32 GetNumberFormat();// { return nNumberFormat; }
     130             : 
     131        1525 :     SCTAB GetLastSheet() const       { return nLastSheet; }
     132         229 :     void SetLastSheet(SCTAB nNew)    { nLastSheet = nNew; }
     133             : 
     134             :     void ApplyCondFormat( com::sun::star::uno::Sequence<com::sun::star::table::CellRangeAddress> xCellRanges );
     135             : 
     136             : private:
     137             :     using XMLPropStyleContext::SetStyle;
     138             : };
     139             : 
     140             : class XMLTableStylesContext : public SvXMLStylesContext
     141             : {
     142             :     ::com::sun::star::uno::Reference <
     143             :                     ::com::sun::star::container::XNameContainer > xCellStyles;
     144             :     ::com::sun::star::uno::Reference <
     145             :                     ::com::sun::star::container::XNameContainer > xColumnStyles;
     146             :     ::com::sun::star::uno::Reference <
     147             :                     ::com::sun::star::container::XNameContainer > xRowStyles;
     148             :     ::com::sun::star::uno::Reference <
     149             :                     ::com::sun::star::container::XNameContainer > xTableStyles;
     150             :     const ::rtl::OUString sCellStyleServiceName;
     151             :     const ::rtl::OUString sColumnStyleServiceName;
     152             :     const ::rtl::OUString sRowStyleServiceName;
     153             :     const ::rtl::OUString sTableStyleServiceName;
     154             :     sal_Int32 nNumberFormatIndex;
     155             :     sal_Int32 nConditionalFormatIndex;
     156             :     sal_Int32 nCellStyleIndex;
     157             :     sal_Int32 nMasterPageNameIndex;
     158             :     bool bAutoStyles;
     159             : 
     160             :     UniReference < SvXMLImportPropertyMapper > xCellImpPropMapper;
     161             :     UniReference < SvXMLImportPropertyMapper > xColumnImpPropMapper;
     162             :     UniReference < SvXMLImportPropertyMapper > xRowImpPropMapper;
     163             :     UniReference < SvXMLImportPropertyMapper > xTableImpPropMapper;
     164             : 
     165         174 :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
     166         342 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
     167             : 
     168             : protected:
     169             : 
     170             :     // Create a style context.
     171             :     virtual SvXMLStyleContext *CreateStyleStyleChildContext(
     172             :             sal_uInt16 nFamily,
     173             :             sal_uInt16 nPrefix,
     174             :             const ::rtl::OUString& rLocalName,
     175             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
     176             : 
     177             :     virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
     178             :         sal_uInt16 nFamily, sal_uInt16 nPrefix,
     179             :         const ::rtl::OUString& rLocalName,
     180             :         const ::com::sun::star::uno::Reference<
     181             :             ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
     182             : 
     183             : //  virtual SvXMLImportPropertyMapper *GetImpPropMapper();
     184             : 
     185             : public:
     186             : 
     187             :     XMLTableStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx ,
     188             :             const ::rtl::OUString& rLName ,
     189             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
     190             :             const bool bAutoStyles );
     191             :     virtual ~XMLTableStylesContext();
     192             : 
     193             :     // Create child element.
     194             : /*  virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     195             :         const ::rtl::OUString& rLocalName,
     196             :         const ::com::sun::star::uno::Reference<
     197             :             ::com::sun::star::xml::sax::XAttributeList > & xAttrList );*/
     198             : 
     199             :     virtual void EndElement();
     200             : 
     201             :     virtual UniReference < SvXMLImportPropertyMapper > GetImportPropertyMapper(
     202             :                         sal_uInt16 nFamily ) const;
     203             :     virtual ::com::sun::star::uno::Reference <
     204             :                     ::com::sun::star::container::XNameContainer >
     205             :         GetStylesContainer( sal_uInt16 nFamily ) const;
     206             :     virtual ::rtl::OUString GetServiceName( sal_uInt16 nFamily ) const;
     207             : 
     208             :     sal_Int32 GetIndex(const sal_Int16 nContextID);
     209             : };
     210             : 
     211             : class ScXMLMasterStylesContext : public SvXMLStylesContext
     212             : {
     213             : protected:
     214             :     virtual SvXMLStyleContext *CreateStyleChildContext( sal_uInt16 nPrefix,
     215             :         const ::rtl::OUString& rLocalName,
     216             :         const ::com::sun::star::uno::Reference<
     217             :             ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
     218             : 
     219             :     virtual SvXMLStyleContext *CreateStyleStyleChildContext( sal_uInt16 nFamily,
     220             :         sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
     221             :         const ::com::sun::star::uno::Reference<
     222             :             ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
     223             : 
     224             :     virtual sal_Bool InsertStyleFamily( sal_uInt16 nFamily ) const;
     225             : 
     226             : public:
     227             :     TYPEINFO();
     228             : 
     229             :     ScXMLMasterStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
     230             :         const ::rtl::OUString& rLName,
     231             :         const ::com::sun::star::uno::Reference<
     232             :             ::com::sun::star::xml::sax::XAttributeList > & xAttrList);
     233             : 
     234             :     virtual ~ScXMLMasterStylesContext();
     235             :     virtual void EndElement();
     236             : };
     237             : 
     238             : namespace com { namespace sun { namespace star {
     239             :     namespace style { class XStyle; }
     240             : } } }
     241             : 
     242             : class ScMasterPageContext : public XMLTextMasterPageContext
     243             : {
     244             :     com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xPropSet;
     245             :     const rtl::OUString     sEmpty;
     246             :     sal_Bool                bContainsRightHeader;
     247             :     sal_Bool                bContainsRightFooter;
     248             : 
     249             :     void ClearContent(const rtl::OUString& rContent);
     250             : public:
     251             : 
     252             :     TYPEINFO();
     253             : 
     254             :     ScMasterPageContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
     255             :             const ::rtl::OUString& rLName,
     256             :             const ::com::sun::star::uno::Reference<
     257             :                 ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
     258             :             bool bOverwrite );
     259             :     virtual ~ScMasterPageContext();
     260             : 
     261             :     virtual SvXMLImportContext *CreateChildContext(
     262             :             sal_uInt16 nPrefix,
     263             :             const ::rtl::OUString& rLocalName,
     264             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
     265             : 
     266             :     virtual SvXMLImportContext *CreateHeaderFooterContext(
     267             :             sal_uInt16 nPrefix,
     268             :             const ::rtl::OUString& rLocalName,
     269             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
     270             :             const sal_Bool bFooter,
     271             :             const sal_Bool bLeft,
     272             :             const sal_Bool bFirst );
     273             : 
     274             :     virtual void Finish( sal_Bool bOverwrite );
     275             : };
     276             : 
     277             : class ScCellTextStyleContext : public XMLTextStyleContext
     278             : {
     279             :     sal_Int32   nLastSheet;
     280             : 
     281             :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
     282           6 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
     283             : 
     284             : public:
     285             :     ScCellTextStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
     286             :             const ::rtl::OUString& rLName,
     287             :             const ::com::sun::star::uno::Reference<
     288             :                 ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
     289             :             SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
     290             :             sal_Bool bDefaultStyle = false );
     291             :     virtual ~ScCellTextStyleContext();
     292             : 
     293             :     // overload FillPropertySet to store style information
     294             :     virtual void FillPropertySet(
     295             :             const ::com::sun::star::uno::Reference<
     296             :                 ::com::sun::star::beans::XPropertySet > & rPropSet );
     297             : };
     298             : 
     299             : 
     300             : #endif
     301             : 
     302             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10