LCOV - code coverage report
Current view: top level - sc/source/filter/xml - xmlexprt.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 6 83.3 %
Date: 2012-08-25 Functions: 5 6 83.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 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                 :            : #ifndef SC_XMLEXPRT_HXX
      29                 :            : #define SC_XMLEXPRT_HXX
      30                 :            : 
      31                 :            : #include <xmloff/xmlexp.hxx>
      32                 :            : #include <com/sun/star/sheet/XSpreadsheet.hpp>
      33                 :            : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
      34                 :            : #include <com/sun/star/table/CellRangeAddress.hpp>
      35                 :            : #include <com/sun/star/table/CellAddress.hpp>
      36                 :            : #include <com/sun/star/drawing/XShapes.hpp>
      37                 :            : #include <com/sun/star/table/XCellRange.hpp>
      38                 :            : 
      39                 :            : #include "address.hxx"
      40                 :            : 
      41                 :            : namespace com { namespace sun { namespace star {
      42                 :            :     namespace beans { class XPropertySet; }
      43                 :            : } } }
      44                 :            : 
      45                 :            : #include <boost/unordered_map.hpp>
      46                 :            : 
      47                 :            : class ScOutlineArray;
      48                 :            : class SvXMLExportPropertyMapper;
      49                 :            : class ScMyMergedRangesContainer;
      50                 :            : class ScMyValidationsContainer;
      51                 :            : class ScMyNotEmptyCellsIterator;
      52                 :            : class ScChangeTrackingExportHelper;
      53                 :            : class ScColumnStyles;
      54                 :            : class ScRowStyles;
      55                 :            : class ScFormatRangeStyles;
      56                 :            : class ScRowFormatRanges;
      57                 :            : class ScMyOpenCloseColumnRowGroup;
      58                 :            : class ScMyAreaLinksContainer;
      59                 :            : class ScMyDetectiveOpContainer;
      60                 :            : struct ScMyCell;
      61                 :            : class ScDocument;
      62                 :            : class ScMySharedData;
      63                 :            : class ScMyDefaultStyles;
      64                 :            : class XMLNumberFormatAttributesExportHelper;
      65                 :            : class ScChartListener;
      66                 :            : class SfxItemPool;
      67                 :            : class ScAddress;
      68                 :            : class ScXMLCachedRowAttrAccess;
      69                 :            : class ScRangeName;
      70                 :            : 
      71                 :            : typedef std::vector< com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > > ScMyXShapesVec;
      72                 :            : 
      73                 :            : class ScXMLExport : public SvXMLExport
      74                 :            : {
      75                 :            :     ScDocument*                 pDoc;
      76                 :            :     com::sun::star::uno::Reference <com::sun::star::sheet::XSpreadsheet> xCurrentTable;
      77                 :            :     com::sun::star::uno::Reference <com::sun::star::table::XCellRange> xCurrentTableCellRange;
      78                 :            : 
      79                 :            :     com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xSourceStream;
      80                 :            :     sal_Int32                   nSourceStreamPos;
      81                 :            : 
      82                 :            :     UniReference < XMLPropertyHandlerFactory >  xScPropHdlFactory;
      83                 :            :     UniReference < XMLPropertySetMapper >       xCellStylesPropertySetMapper;
      84                 :            :     UniReference < XMLPropertySetMapper >       xColumnStylesPropertySetMapper;
      85                 :            :     UniReference < XMLPropertySetMapper >       xRowStylesPropertySetMapper;
      86                 :            :     UniReference < XMLPropertySetMapper >       xTableStylesPropertySetMapper;
      87                 :            :     UniReference < SvXMLExportPropertyMapper >  xCellStylesExportPropertySetMapper;
      88                 :            :     UniReference < SvXMLExportPropertyMapper >  xColumnStylesExportPropertySetMapper;
      89                 :            :     UniReference < SvXMLExportPropertyMapper >  xRowStylesExportPropertySetMapper;
      90                 :            :     UniReference < SvXMLExportPropertyMapper >  xTableStylesExportPropertySetMapper;
      91                 :            :     XMLNumberFormatAttributesExportHelper* pNumberFormatAttributesExportHelper;
      92                 :            :     typedef ::boost::unordered_map<sal_Int32, sal_Int32>  NumberFormatIndexMap;
      93                 :            :     NumberFormatIndexMap                aNumFmtIndexMap;
      94                 :            :     ScMySharedData*                     pSharedData;
      95                 :            :     ScColumnStyles*                 pColumnStyles;
      96                 :            :     ScRowStyles*                    pRowStyles;
      97                 :            :     ScFormatRangeStyles*                pCellStyles;
      98                 :            :     ScRowFormatRanges*                  pRowFormatRanges;
      99                 :            :     std::vector<rtl::OUString>          aTableStyles;
     100                 :            :     com::sun::star::table::CellRangeAddress aRowHeaderRange;
     101                 :            :     ScMyOpenCloseColumnRowGroup*        pGroupColumns;
     102                 :            :     ScMyOpenCloseColumnRowGroup*        pGroupRows;
     103                 :            :     ScMyDefaultStyles*                  pDefaults;
     104                 :            :     ScChartListener*                    pChartListener;
     105                 :            :     const ScMyCell*                     pCurrentCell;
     106                 :            : 
     107                 :            :     ScMyMergedRangesContainer*  pMergedRangesContainer;
     108                 :            :     ScMyValidationsContainer*   pValidationsContainer;
     109                 :            :     ScMyNotEmptyCellsIterator*  pCellsItr;
     110                 :            :     ScChangeTrackingExportHelper*   pChangeTrackingExportHelper;
     111                 :            :     const rtl::OUString         sLayerID;
     112                 :            :     const rtl::OUString         sCaptionShape;
     113                 :            :     rtl::OUString               sExternalRefTabStyleName;
     114                 :            :     rtl::OUString               sAttrName;
     115                 :            :     rtl::OUString               sAttrStyleName;
     116                 :            :     rtl::OUString               sAttrColumnsRepeated;
     117                 :            :     rtl::OUString               sAttrFormula;
     118                 :            :     rtl::OUString               sAttrValueType;
     119                 :            :     rtl::OUString               sAttrStringValue;
     120                 :            :     rtl::OUString               sElemCell;
     121                 :            :     rtl::OUString               sElemCoveredCell;
     122                 :            :     rtl::OUString               sElemCol;
     123                 :            :     rtl::OUString               sElemRow;
     124                 :            :     rtl::OUString               sElemTab;
     125                 :            :     rtl::OUString               sElemP;
     126                 :            :     sal_Int32                   nOpenRow;
     127                 :            :     sal_Int32                   nProgressCount;
     128                 :            :     sal_uInt16                  nCurrentTable;
     129                 :            :     bool                        bHasRowHeader;
     130                 :            :     bool                        bRowHeaderOpen;
     131                 :            :     bool                        mbShowProgress;
     132                 :            : 
     133                 :            :     sal_Int32       GetNumberFormatStyleIndex(sal_Int32 nNumFmt) const;
     134                 :            :     void            CollectSharedData(sal_Int32& nTableCount, sal_Int32& nShapesCount);
     135                 :            :     void            CollectShapesAutoStyles(const sal_Int32 nTableCount);
     136                 :            :     void            WriteTablesView(const com::sun::star::uno::Any& aTableView);
     137                 :            :     void            WriteView(const com::sun::star::uno::Any& aView);
     138                 :            :     virtual void _ExportFontDecls();
     139                 :            :     virtual void _ExportStyles( sal_Bool bUsed );
     140                 :            :     virtual void _ExportAutoStyles();
     141                 :            :     virtual void _ExportMasterStyles();
     142                 :            :     virtual void SetBodyAttributes();
     143                 :            :     virtual void _ExportContent();
     144                 :            :     virtual void _ExportMeta();
     145                 :            : 
     146                 :            :     void CollectInternalShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
     147                 :            : 
     148                 :            :     com::sun::star::table::CellRangeAddress GetEndAddress(const com::sun::star::uno::Reference<com::sun::star::sheet::XSpreadsheet>& xTable,
     149                 :            :                                                         const sal_Int32 nTable);
     150                 :            : //  ScMyEmptyDatabaseRangesContainer GetEmptyDatabaseRanges();
     151                 :            :     void GetAreaLinks( com::sun::star::uno::Reference< com::sun::star::sheet::XSpreadsheetDocument>& xSpreadDoc, ScMyAreaLinksContainer& rAreaLinks );
     152                 :            :     void GetDetectiveOpList( ScMyDetectiveOpContainer& rDetOp );
     153                 :            :     void WriteSingleColumn(const sal_Int32 nRepeatColumns, const sal_Int32 nStyleIndex,
     154                 :            :         const sal_Int32 nIndex, const bool bIsAutoStyle, const bool bIsVisible);
     155                 :            :     void WriteColumn(const sal_Int32 nColumn, const sal_Int32 nRepeatColumns,
     156                 :            :         const sal_Int32 nStyleIndex, const bool bIsVisible);
     157                 :            :     void OpenHeaderColumn();
     158                 :            :     void CloseHeaderColumn();
     159                 :            :     void ExportColumns(const sal_Int32 nTable, const com::sun::star::table::CellRangeAddress& aColumnHeaderRange, const bool bHasColumnHeader);
     160                 :            :     void ExportExternalRefCacheStyles();
     161                 :            :     void ExportFormatRanges(const sal_Int32 nStartCol, const sal_Int32 nStartRow,
     162                 :            :         const sal_Int32 nEndCol, const sal_Int32 nEndRow, const sal_Int32 nSheet);
     163                 :            :     void WriteRowContent();
     164                 :            :     void WriteRowStartTag(sal_Int32 nRow, const sal_Int32 nIndex, const sal_Int32 nEmptyRows, bool bHidden, bool bFiltered);
     165                 :            :     void OpenHeaderRows();
     166                 :            :     void CloseHeaderRows();
     167                 :            :     void OpenNewRow(const sal_Int32 nIndex, const sal_Int32 nStartRow, const sal_Int32 nEmptyRows,
     168                 :            :                     bool bHidden, bool bFiltered);
     169                 :            :     void OpenAndCloseRow(const sal_Int32 nIndex, const sal_Int32 nStartRow, const sal_Int32 nEmptyRows,
     170                 :            :                          bool bHidden, bool bFiltered);
     171                 :            :     void OpenRow(const sal_Int32 nTable, const sal_Int32 nStartRow, const sal_Int32 nRepeatRow, ScXMLCachedRowAttrAccess& rRowAttr);
     172                 :            :     void CloseRow(const sal_Int32 nRow);
     173                 :            :     void GetColumnRowHeader(bool& bHasColumnHeader, com::sun::star::table::CellRangeAddress& aColumnHeaderRange,
     174                 :            :         bool& bHasRowHeader, com::sun::star::table::CellRangeAddress& aRowHeaderRange,
     175                 :            :         rtl::OUString& rPrintRanges) const;
     176                 :            :     void FillFieldGroup(ScOutlineArray* pFields, ScMyOpenCloseColumnRowGroup* pGroups);
     177                 :            :     void FillColumnRowGroups();
     178                 :            : 
     179                 :            :     bool GetMerged (const com::sun::star::table::CellRangeAddress* pCellRange,
     180                 :            :         const com::sun::star::uno::Reference <com::sun::star::sheet::XSpreadsheet>& xTable);
     181                 :            : 
     182                 :            :     bool GetCellText (ScMyCell& rMyCell, const ScAddress& aPos) const;
     183                 :            : 
     184                 :            :     void WriteTable(sal_Int32 nTable, const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet>& xTable);
     185                 :            :     void WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount);
     186                 :            :     void WriteAreaLink(const ScMyCell& rMyCell);
     187                 :            :     void WriteAnnotation(ScMyCell& rMyCell);
     188                 :            :     void WriteDetective(const ScMyCell& rMyCell);
     189                 :            :     void ExportShape(const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape, com::sun::star::awt::Point* pPoint);
     190                 :            :     void WriteShapes(const ScMyCell& rMyCell);
     191                 :            :     void WriteTableShapes();
     192                 :            :     void SetRepeatAttribute(sal_Int32 nEqualCellCount, bool bIncProgress);
     193                 :            : 
     194                 :            :     bool IsCellTypeEqual (const ScMyCell& aCell1, const ScMyCell& aCell2) const;
     195                 :            :     bool IsEditCell(const com::sun::star::table::CellAddress& aAddress, ScMyCell* pMyCell = NULL) const;
     196                 :            :     bool IsEditCell(ScMyCell& rCell) const;
     197                 :            :     bool IsMultiLineFormulaCell(ScMyCell& rCell) const;
     198                 :            :     bool IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2);
     199                 :            : 
     200                 :            :     void WriteCalculationSettings(const com::sun::star::uno::Reference <com::sun::star::sheet::XSpreadsheetDocument>& xSpreadDoc);
     201                 :            :     void WriteTableSource();
     202                 :            :     void WriteScenario();   // core implementation
     203                 :            :     void WriteTheLabelRanges(const com::sun::star::uno::Reference< com::sun::star::sheet::XSpreadsheetDocument >& xSpreadDoc);
     204                 :            :     void WriteLabelRanges( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& xRangesIAccess, bool bColumn );
     205                 :            :     void WriteNamedExpressions();
     206                 :            :     void WriteNamedRange(ScRangeName* pRangeName);
     207                 :            :     void ExportConditionalFormat(SCTAB nTab);
     208                 :            :     void WriteExternalRefCaches();
     209                 :            :     void WriteConsolidation();  // core implementation
     210                 :            : 
     211                 :            : 
     212                 :            :     void CollectUserDefinedNamespaces(const SfxItemPool* pPool, sal_uInt16 nAttrib);
     213                 :            : 
     214                 :            :     void AddStyleFromCells(
     215                 :            :         const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xProperties,
     216                 :            :         const com::sun::star::uno::Reference< com::sun::star::sheet::XSpreadsheet >& xTable,
     217                 :            :         sal_Int32 nTable, const rtl::OUString* pOldName );
     218                 :            :     void AddStyleFromColumn(
     219                 :            :         const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xColumnProperties,
     220                 :            :         const rtl::OUString* pOldName, sal_Int32& rIndex, bool& rIsVisible );
     221                 :            :     void AddStyleFromRow(
     222                 :            :         const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xRowProperties,
     223                 :            :         const rtl::OUString* pOldName, sal_Int32& rIndex );
     224                 :            : 
     225                 :            :     void IncrementProgressBar(bool bEditCell, sal_Int32 nInc = 1);
     226                 :            : 
     227                 :            :     void CopySourceStream( sal_Int32 nStartOffset, sal_Int32 nEndOffset, sal_Int32& rNewStart, sal_Int32& rNewEnd );
     228                 :            : 
     229                 :            : protected:
     230                 :            :     virtual SvXMLAutoStylePoolP* CreateAutoStylePool();
     231                 :            :     virtual XMLPageExport* CreatePageExport();
     232                 :            :     virtual XMLShapeExport* CreateShapeExport();
     233                 :            :     virtual XMLFontAutoStylePool* CreateFontAutoStylePool();
     234                 :            : public:
     235                 :            :     // #110680#
     236                 :            :     ScXMLExport(
     237                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
     238                 :            :         const sal_uInt16 nExportFlag);
     239                 :            : 
     240                 :            :     virtual ~ScXMLExport();
     241                 :            : 
     242                 :            :     static sal_Int16 GetFieldUnit();
     243                 :        162 :     inline ScDocument*          GetDocument()           { return pDoc; }
     244                 :          0 :     inline const ScDocument*    GetDocument() const     { return pDoc; }
     245                 :            :     bool IsMatrix (const ScAddress& aCell,
     246                 :            :         com::sun::star::table::CellRangeAddress& aCellAddress, bool& bIsFirst) const;
     247                 :            : 
     248                 :          4 :     UniReference < XMLPropertySetMapper > GetCellStylesPropertySetMapper() { return xCellStylesPropertySetMapper; }
     249                 :         16 :     UniReference < XMLPropertySetMapper > GetTableStylesPropertySetMapper() { return xTableStylesPropertySetMapper; }
     250                 :            : 
     251                 :            :     void SetSourceStream( const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xNewStream );
     252                 :            : 
     253                 :            :     void GetChangeTrackViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProps);
     254                 :            :     virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProps);
     255                 :            :     virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProps);
     256                 :            : 
     257                 :            :     virtual void exportAnnotationMeta( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape);
     258                 :            : 
     259                 :            :     void CreateSharedData(const sal_Int32 nTableCount);
     260                 :         16 :     void SetSharedData(ScMySharedData* pTemp) { pSharedData = pTemp; }
     261                 :         24 :     ScMySharedData* GetSharedData() { return pSharedData; }
     262                 :            :     XMLNumberFormatAttributesExportHelper* GetNumberFormatAttributesExportHelper();
     263                 :            : 
     264                 :            :     // Export the document.
     265                 :            :     virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
     266                 :            : 
     267                 :            :     // XExporter
     268                 :            :     virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
     269                 :            : 
     270                 :            :     // XFilter
     271                 :            :     virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw(::com::sun::star::uno::RuntimeException);
     272                 :            :     virtual void SAL_CALL cancel() throw(::com::sun::star::uno::RuntimeException);
     273                 :            : 
     274                 :            :     // XInitialization
     275                 :            :     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
     276                 :            : 
     277                 :            :     // XServiceInfo
     278                 :            :     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
     279                 :            :     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
     280                 :            :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
     281                 :            : 
     282                 :            :     // XUnoTunnel
     283                 :            :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
     284                 :            : 
     285                 :            :     virtual void DisposingModel();
     286                 :            : };
     287                 :            : 
     288                 :            : #endif
     289                 :            : 
     290                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10