LCOV - code coverage report
Current view: top level - sc/inc - sheetdata.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 31 32 96.9 %
Date: 2015-06-13 12:38:46 Functions: 27 28 96.4 %
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 INCLUDED_SC_INC_SHEETDATA_HXX
      21             : #define INCLUDED_SC_INC_SHEETDATA_HXX
      22             : 
      23             : #include <xmloff/maptype.hxx>
      24             : #include <editeng/editdata.hxx>
      25             : #include <unordered_set>
      26             : #include <vector>
      27             : 
      28             : #include "address.hxx"
      29             : 
      30             : class ScAddress;
      31             : class SvXMLNamespaceMap;
      32             : 
      33             : struct ScStreamEntry
      34             : {
      35             :     sal_Int32   mnStartOffset;
      36             :     sal_Int32   mnEndOffset;
      37             : 
      38         287 :                 ScStreamEntry() :
      39             :                     mnStartOffset(-1),
      40         287 :                     mnEndOffset(-1)
      41             :                 {
      42         287 :                 }
      43             : 
      44         287 :                 ScStreamEntry( sal_Int32 nStart, sal_Int32 nEnd ) :
      45             :                     mnStartOffset(nStart),
      46         287 :                     mnEndOffset(nEnd)
      47             :                 {
      48         287 :                 }
      49             : };
      50             : 
      51       14511 : struct ScCellStyleEntry
      52             : {
      53             :     OUString   maName;
      54             :     ScAddress       maCellPos;
      55             : 
      56        2981 :                 ScCellStyleEntry( const OUString& rName, const ScAddress& rPos ) :
      57             :                     maName(rName),
      58        2981 :                     maCellPos(rPos)
      59             :                 {
      60        2981 :                 }
      61             : };
      62             : 
      63         269 : struct ScNoteStyleEntry
      64             : {
      65             :     OUString   maStyleName;
      66             :     OUString   maTextStyle;
      67             :     ScAddress       maCellPos;
      68             : 
      69         217 :                 ScNoteStyleEntry( const OUString& rStyle, const OUString& rText, const ScAddress& rPos ) :
      70             :                     maStyleName(rStyle),
      71             :                     maTextStyle(rText),
      72         217 :                     maCellPos(rPos)
      73             :                 {
      74         217 :                 }
      75             : };
      76             : 
      77        2191 : struct ScTextStyleEntry
      78             : {
      79             :     OUString   maName;
      80             :     ScAddress       maCellPos;
      81             :     ESelection      maSelection;
      82             : 
      83         409 :                 ScTextStyleEntry( const OUString& rName, const ScAddress& rPos, const ESelection& rSel ) :
      84             :                     maName(rName),
      85             :                     maCellPos(rPos),
      86         409 :                     maSelection(rSel)
      87             :                 {
      88         409 :                 }
      89             : };
      90             : 
      91       38221 : struct ScLoadedNamespaceEntry
      92             : {
      93             :     OUString   maPrefix;
      94             :     OUString   maName;
      95             :     sal_uInt16      mnKey;
      96             : 
      97        6069 :                 ScLoadedNamespaceEntry( const OUString& rPrefix, const OUString& rName, sal_uInt16 nKey ) :
      98             :                     maPrefix(rPrefix),
      99             :                     maName(rName),
     100        6069 :                     mnKey(nKey)
     101             :                 {
     102        6069 :                 }
     103             : };
     104             : 
     105             : class ScSheetSaveData
     106             : {
     107             :     std::unordered_set<OUString, OUStringHash>  maInitialPrefixes;
     108             :     std::vector<ScLoadedNamespaceEntry>              maLoadedNamespaces;
     109             : 
     110             :     std::vector<ScCellStyleEntry> maCellStyles;
     111             :     std::vector<ScCellStyleEntry> maColumnStyles;
     112             :     std::vector<ScCellStyleEntry> maRowStyles;
     113             :     std::vector<ScCellStyleEntry> maTableStyles;
     114             :     std::vector<ScNoteStyleEntry> maNoteStyles;
     115             :     std::vector<ScTextStyleEntry> maNoteParaStyles;
     116             :     std::vector<ScTextStyleEntry> maNoteTextStyles;
     117             :     std::vector<ScTextStyleEntry> maTextStyles;
     118             :     std::vector<bool>          maBlocked;
     119             :     std::vector<ScStreamEntry> maStreamEntries;
     120             :     std::vector<ScStreamEntry> maSaveEntries;
     121             :     SCTAB   mnStartTab;
     122             :     sal_Int32   mnStartOffset;
     123             : 
     124             :     ScNoteStyleEntry    maPreviousNote;
     125             : 
     126             :     bool                mbInSupportedSave;
     127             : 
     128             : public:
     129             :                 ScSheetSaveData();
     130             :                 ~ScSheetSaveData();
     131             : 
     132             :     void        AddCellStyle( const OUString& rName, const ScAddress& rCellPos );
     133             :     void        AddColumnStyle( const OUString& rName, const ScAddress& rCellPos );
     134             :     void        AddRowStyle( const OUString& rName, const ScAddress& rCellPos );
     135             :     void        AddTableStyle( const OUString& rName, const ScAddress& rCellPos );
     136             : 
     137             :     void        HandleNoteStyles( const OUString& rStyleName, const OUString& rTextName, const ScAddress& rCellPos );
     138             :     void        AddNoteContentStyle( sal_uInt16 nFamily, const OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection );
     139             : 
     140             :     void        AddTextStyle( const OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection );
     141             : 
     142             :     void        BlockSheet( SCTAB nTab );
     143             :     bool        IsSheetBlocked( SCTAB nTab ) const;
     144             : 
     145             :     void        AddStreamPos( SCTAB nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset );
     146             :     void        GetStreamPos( SCTAB nTab, sal_Int32& rStartOffset, sal_Int32& rEndOffset ) const;
     147             :     bool        HasStreamPos( SCTAB nTab ) const;
     148             : 
     149             :     void        StartStreamPos( SCTAB nTab, sal_Int32 nStartOffset );
     150             :     void        EndStreamPos( sal_Int32 nEndOffset );
     151             : 
     152         779 :     bool        HasStartPos() const { return mnStartTab >= 0; }
     153             : 
     154             :     void        ResetSaveEntries();
     155             :     void        AddSavePos( SCTAB nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset );
     156             :     void        UseSaveEntries();
     157             : 
     158             :     void        StoreInitialNamespaces( const SvXMLNamespaceMap& rNamespaces );
     159             :     void        StoreLoadedNamespaces( const SvXMLNamespaceMap& rNamespaces );
     160             :     bool        AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) const;
     161             : 
     162          29 :     const std::vector<ScCellStyleEntry>& GetCellStyles() const   { return maCellStyles; }
     163          29 :     const std::vector<ScCellStyleEntry>& GetColumnStyles() const { return maColumnStyles; }
     164          29 :     const std::vector<ScCellStyleEntry>& GetRowStyles() const    { return maRowStyles; }
     165          29 :     const std::vector<ScCellStyleEntry>& GetTableStyles() const  { return maTableStyles; }
     166          29 :     const std::vector<ScNoteStyleEntry>& GetNoteStyles() const   { return maNoteStyles; }
     167          29 :     const std::vector<ScTextStyleEntry>& GetNoteParaStyles() const { return maNoteParaStyles; }
     168          29 :     const std::vector<ScTextStyleEntry>& GetNoteTextStyles() const { return maNoteTextStyles; }
     169          29 :     const std::vector<ScTextStyleEntry>& GetTextStyles() const   { return maTextStyles; }
     170             : 
     171           0 :     bool        IsInSupportedSave() const { return mbInSupportedSave;}
     172             :     void        SetInSupportedSave( bool bSet );
     173             : };
     174             : 
     175             : #endif
     176             : 
     177             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11