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

Generated by: LCOV version 1.10