LCOV - code coverage report
Current view: top level - sc/source/filter/inc - excrecds.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 32 0.0 %
Date: 2014-04-14 Functions: 0 66 0.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_EXCRECDS_HXX
      21             : #define SC_EXCRECDS_HXX
      22             : 
      23             : #include <rtl/string.hxx>
      24             : #include <rtl/ustring.hxx>
      25             : #include <svl/zforlist.hxx>
      26             : #include <tools/solar.h>
      27             : #include <tools/color.hxx>
      28             : #include <vcl/vclenum.hxx>
      29             : 
      30             : 
      31             : #include <vector>
      32             : #include "olinetab.hxx"
      33             : #include "filter.hxx"
      34             : #include "rangelst.hxx"
      35             : #include "xerecord.hxx"
      36             : #include "xeroot.hxx"
      37             : #include "xeformula.hxx"
      38             : #include "xestring.hxx"
      39             : #include "root.hxx"
      40             : #include "excdefs.hxx"
      41             : #include <boost/shared_ptr.hpp>
      42             : 
      43             : //------------------------------------------------------------------ Forwards -
      44             : 
      45             : struct ScQueryEntry;
      46             : 
      47             : //----------------------------------------------------------- class ExcRecord -
      48             : 
      49           0 : class ExcRecord : public XclExpRecord
      50             : {
      51             : public:
      52             :     virtual void            Save( XclExpStream& rStrm ) SAL_OVERRIDE;
      53             :     virtual void            SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
      54             : 
      55             :     virtual sal_uInt16          GetNum() const = 0;
      56             :     virtual sal_Size        GetLen() const = 0;
      57             : 
      58             : protected:
      59             :     virtual void            SaveCont( XclExpStream& rStrm );
      60             : 
      61             : private:
      62             :     /** Writes the body of the record. */
      63             :     virtual void            WriteBody( XclExpStream& rStrm ) SAL_OVERRIDE;
      64             : };
      65             : 
      66             : 
      67             : //--------------------------------------------------------- class ExcEmptyRec -
      68             : 
      69           0 : class ExcEmptyRec : public ExcRecord
      70             : {
      71             : private:
      72             : protected:
      73             : public:
      74             :     virtual void            Save( XclExpStream& rStrm ) SAL_OVERRIDE;
      75             :     virtual sal_uInt16          GetNum() const SAL_OVERRIDE;
      76             :     virtual sal_Size        GetLen() const SAL_OVERRIDE;
      77             : };
      78             : 
      79             : //--------------------------------------------------------- class ExcDummyRec -
      80             : 
      81           0 : class ExcDummyRec : public ExcRecord
      82             : {
      83             : protected:
      84             : public:
      85             :     virtual void            Save( XclExpStream& rStrm ) SAL_OVERRIDE;
      86             :     virtual sal_uInt16          GetNum() const SAL_OVERRIDE;
      87             :     virtual const sal_uInt8*        GetData() const = 0;    // byte data must contain header and body
      88             : };
      89             : 
      90             : 
      91             : //------------------------------------------------------- class ExcBoolRecord -
      92             : // stores bool as 16bit val ( 0x0000 | 0x0001 )
      93             : 
      94           0 : class ExcBoolRecord : public ExcRecord
      95             : {
      96             : private:
      97             :     virtual void            SaveCont( XclExpStream& rStrm ) SAL_OVERRIDE;
      98             : 
      99             : protected:
     100             :     bool                    bVal;
     101             : 
     102           0 :     inline                  ExcBoolRecord() : bVal( false ) {}
     103             : 
     104             : public:
     105             :     inline                  ExcBoolRecord( const bool bDefault ) : bVal( bDefault ) {}
     106             : 
     107             :     virtual sal_Size        GetLen( void ) const SAL_OVERRIDE;
     108             : };
     109             : 
     110             : 
     111             : //--------------------------------------------------------- class ExcBof_Base -
     112             : 
     113           0 : class ExcBof_Base : public ExcRecord
     114             : {
     115             : private:
     116             : protected:
     117             :     sal_uInt16                  nDocType;
     118             :     sal_uInt16                  nVers;
     119             :     sal_uInt16                  nRupBuild;
     120             :     sal_uInt16                  nRupYear;
     121             : public:
     122             :                             ExcBof_Base( void );
     123             : };
     124             : 
     125             : 
     126             : //-------------------------------------------------------------- class ExcBof -
     127             : // Header Record fuer WORKSHEETS
     128             : 
     129           0 : class ExcBof : public ExcBof_Base
     130             : {
     131             : private:
     132             :     virtual void            SaveCont( XclExpStream& rStrm ) SAL_OVERRIDE;
     133             : public:
     134             :                             ExcBof( void );
     135             : 
     136             :     virtual sal_uInt16          GetNum( void ) const SAL_OVERRIDE;
     137             :     virtual sal_Size        GetLen( void ) const SAL_OVERRIDE;
     138             : };
     139             : 
     140             : 
     141             : //------------------------------------------------------------- class ExcBofW -
     142             : // Header Record fuer WORKBOOKS
     143             : 
     144           0 : class ExcBofW : public ExcBof_Base
     145             : {
     146             : private:
     147             :     virtual void            SaveCont( XclExpStream& rStrm ) SAL_OVERRIDE;
     148             : public:
     149             :                             ExcBofW( void );
     150             : 
     151             :     virtual sal_uInt16          GetNum( void ) const SAL_OVERRIDE;
     152             :     virtual sal_Size        GetLen( void ) const SAL_OVERRIDE;
     153             : };
     154             : 
     155             : 
     156             : //-------------------------------------------------------------- class ExcEof -
     157             : 
     158           0 : class ExcEof : public ExcRecord
     159             : {
     160             : private:
     161             : public:
     162             :     virtual sal_uInt16          GetNum( void ) const SAL_OVERRIDE;
     163             :     virtual sal_Size        GetLen( void ) const SAL_OVERRIDE;
     164             : };
     165             : 
     166             : 
     167             : //--------------------------------------------------------- class ExcDummy_00 -
     168             : // INTERFACEHDR to FNGROUPCOUNT (see excrecds.cxx)
     169             : 
     170           0 : class ExcDummy_00 : public ExcDummyRec
     171             : {
     172             : private:
     173             :     static const sal_uInt8      pMyData[];
     174             :     static const sal_Size   nMyLen;
     175             : public:
     176             :     virtual sal_Size        GetLen( void ) const SAL_OVERRIDE;
     177             :     virtual const sal_uInt8*        GetData( void ) const SAL_OVERRIDE;
     178             : };
     179             : 
     180             : // EXC_ID_WINDOWPROTECTION
     181           0 : class XclExpWindowProtection : public   XclExpBoolRecord
     182             : {
     183             :     public:
     184             :         XclExpWindowProtection(bool bValue);
     185             : 
     186             :     virtual void            SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
     187             : };
     188             : 
     189             : // EXC_ID_PROTECT  Document Protection
     190           0 : class XclExpProtection : public XclExpBoolRecord
     191             : {
     192             :     public:
     193             :         XclExpProtection(bool bValue);
     194             : };
     195             : 
     196           0 : class XclExpSheetProtection : public XclExpProtection
     197             : {
     198             :     SCTAB                   mnTab;
     199             :     public:
     200             :         XclExpSheetProtection(bool bValue, SCTAB nTab);
     201             :     virtual void            SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
     202             : };
     203             : 
     204             : class XclExpPassHash : public XclExpRecord
     205             : {
     206             : public:
     207             :     XclExpPassHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aHash);
     208             :     virtual ~XclExpPassHash();
     209             : 
     210             : private:
     211             :     virtual void    WriteBody(XclExpStream& rStrm) SAL_OVERRIDE;
     212             : 
     213             : private:
     214             :     sal_uInt16  mnHash;
     215             : };
     216             : 
     217             : 
     218             : //-------------------------------------------------------- class ExcDummy_04x -
     219             : // PASSWORD to BOOKBOOL (see excrecds.cxx), no 1904
     220             : 
     221           0 : class ExcDummy_040 : public ExcDummyRec
     222             : {
     223             : private:
     224             :     static const sal_uInt8      pMyData[];
     225             :     static const sal_Size   nMyLen;
     226             : public:
     227             :     virtual sal_Size        GetLen( void ) const SAL_OVERRIDE;
     228             :     virtual const sal_uInt8*        GetData( void ) const SAL_OVERRIDE;
     229             : };
     230             : 
     231           0 : class ExcDummy_041 : public ExcDummyRec
     232             : {
     233             : private:
     234             :     static const sal_uInt8      pMyData[];
     235             :     static const sal_Size   nMyLen;
     236             : public:
     237             :     virtual sal_Size        GetLen( void ) const SAL_OVERRIDE;
     238             :     virtual const sal_uInt8*        GetData( void ) const SAL_OVERRIDE;
     239             : };
     240             : 
     241             : 
     242             : //------------------------------------------------------------- class Exc1904 -
     243             : 
     244           0 : class Exc1904 : public ExcBoolRecord
     245             : {
     246             : public:
     247             :                             Exc1904( ScDocument& rDoc );
     248             :     virtual sal_uInt16          GetNum( void ) const SAL_OVERRIDE;
     249             : 
     250             :     virtual void            SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
     251             : private:
     252             :     bool                    bDateCompatibility;
     253             : };
     254             : 
     255             : 
     256             : //------------------------------------------------------ class ExcBundlesheet -
     257             : 
     258           0 : class ExcBundlesheetBase : public ExcRecord
     259             : {
     260             : protected:
     261             :     sal_uInt64              m_nStrPos;
     262             :     sal_uInt64              m_nOwnPos;    // Position after # and Len
     263             :     sal_uInt16                  nGrbit;
     264             :     SCTAB                   nTab;
     265             : 
     266             :                             ExcBundlesheetBase();
     267             : 
     268             : public:
     269             :                             ExcBundlesheetBase( RootData& rRootData, SCTAB nTab );
     270             : 
     271           0 :     inline void             SetStreamPos(sal_uInt64 const nStrPos) { m_nStrPos = nStrPos; }
     272             :     void                    UpdateStreamPos( XclExpStream& rStrm );
     273             : 
     274             :     virtual sal_uInt16          GetNum() const SAL_OVERRIDE;
     275             : };
     276             : 
     277           0 : class ExcBundlesheet : public ExcBundlesheetBase
     278             : {
     279             : private:
     280             :     OString            aName;
     281             : 
     282             :     virtual void            SaveCont( XclExpStream& rStrm ) SAL_OVERRIDE;
     283             : 
     284             : public:
     285             :                             ExcBundlesheet( RootData& rRootData, SCTAB nTab );
     286             :     virtual sal_Size        GetLen() const SAL_OVERRIDE;
     287             : };
     288             : 
     289             : //--------------------------------------------------------- class ExcDummy_02 -
     290             : // sheet dummies: CALCMODE to SETUP
     291             : 
     292           0 : class ExcDummy_02a : public ExcDummyRec
     293             : {
     294             : private:
     295             :     static const sal_uInt8      pMyData[];
     296             :     static const sal_Size   nMyLen;
     297             : public:
     298             :     virtual sal_Size        GetLen( void ) const SAL_OVERRIDE;
     299             :     virtual const sal_uInt8*        GetData( void ) const SAL_OVERRIDE;
     300             : };
     301             : 
     302             : 
     303             : /** This record contains the Windows country IDs for the UI and document language. */
     304           0 : class XclExpCountry : public XclExpRecord
     305             : {
     306             : public:
     307             :     explicit                    XclExpCountry( const XclExpRoot& rRoot );
     308             : 
     309             : private:
     310             :     sal_uInt16                  mnUICountry;        /// The UI country ID.
     311             :     sal_uInt16                  mnDocCountry;       /// The document country ID.
     312             : 
     313             :     /** Writes the body of the COUNTRY record. */
     314             :     virtual void                WriteBody( XclExpStream& rStrm ) SAL_OVERRIDE;
     315             : };
     316             : 
     317             : 
     318             : // XclExpWsbool ===============================================================
     319             : 
     320           0 : class XclExpWsbool : public XclExpUInt16Record
     321             : {
     322             : public:
     323             :     explicit XclExpWsbool( bool bFitToPages );
     324             : };
     325             : 
     326             : /**
     327             :  * Save sheetPr element and its children for xlsx export.
     328             :  */
     329           0 : class XclExpXmlSheetPr : public XclExpRecordBase
     330             : {
     331             : public:
     332             :     explicit XclExpXmlSheetPr(
     333             :         bool bFitToPages, SCTAB nScTab, const Color& rTabColor, XclExpFilterManager* pManager );
     334             : 
     335             :     virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
     336             : 
     337             : private:
     338             :     SCTAB mnScTab;
     339             :     XclExpFilterManager* mpManager;
     340             :     bool mbFitToPage;
     341             :     Color maTabColor;
     342             : };
     343             : 
     344             : 
     345           0 : class XclExpFiltermode : public XclExpEmptyRecord
     346             : {
     347             : public:
     348             :     explicit            XclExpFiltermode();
     349             : };
     350             : 
     351           0 : class XclExpAutofilterinfo : public XclExpUInt16Record
     352             : {
     353             : public:
     354             :     explicit            XclExpAutofilterinfo( const ScAddress& rStartPos, SCCOL nScCol );
     355             : 
     356           0 :     inline const ScAddress GetStartPos() const { return maStartPos; }
     357           0 :     inline SCCOL        GetColCount() const { return static_cast< SCCOL >( GetValue() ); }
     358             : 
     359             : private:
     360             :     ScAddress           maStartPos;
     361             : };
     362             : 
     363             : class ExcFilterCondition
     364             : {
     365             : private:
     366             :     sal_uInt8               nType;
     367             :     sal_uInt8               nOper;
     368             :     double                  fVal;
     369             :     XclExpString*           pText;
     370             : 
     371             : protected:
     372             : public:
     373             :                             ExcFilterCondition();
     374             :                             ~ExcFilterCondition();
     375             : 
     376           0 :     inline bool             IsEmpty() const     { return (nType == EXC_AFTYPE_NOTUSED); }
     377             :     inline bool             HasEqual() const    { return (nOper == EXC_AFOPER_EQUAL); }
     378             :     sal_uLong               GetTextBytes() const;
     379             : 
     380             :     void                    SetCondition( sal_uInt8 nTp, sal_uInt8 nOp, double fV, OUString* pT );
     381             : 
     382             :     void                    Save( XclExpStream& rStrm );
     383             :     void                    SaveXml( XclExpXmlStream& rStrm );
     384             :     void                    SaveText( XclExpStream& rStrm );
     385             : };
     386             : 
     387           0 : class XclExpAutofilter : public XclExpRecord, protected XclExpRoot
     388             : {
     389             : private:
     390             :     enum FilterType { FilterCondition, MultiValue };
     391             :     FilterType              meType;
     392             :     sal_uInt16              nCol;
     393             :     sal_uInt16              nFlags;
     394             :     ExcFilterCondition      aCond[ 2 ];
     395             :     std::vector<OUString> maMultiValues;
     396             : 
     397             :     bool                    AddCondition( ScQueryConnect eConn, sal_uInt8 nType,
     398             :                                 sal_uInt8 nOp, double fVal, OUString* pText,
     399             :                                 bool bSimple = false );
     400             : 
     401             :     virtual void            WriteBody( XclExpStream& rStrm ) SAL_OVERRIDE;
     402             : 
     403             : public:
     404             :                             XclExpAutofilter( const XclExpRoot& rRoot, sal_uInt16 nC );
     405             : 
     406           0 :     inline sal_uInt16       GetCol() const          { return nCol; }
     407           0 :     inline bool             HasTop10() const        { return ::get_flag( nFlags, EXC_AFFLAG_TOP10 ); }
     408             : 
     409             :     bool                    HasCondition() const;
     410             :     bool                    AddEntry( const ScQueryEntry& rEntry );
     411             :     bool                    AddMultiValueEntry( const ScQueryEntry& rEntry );
     412             : 
     413             :     virtual void            SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
     414             : };
     415             : 
     416             : class ExcAutoFilterRecs : public XclExpRecordBase, protected XclExpRoot
     417             : {
     418             : public:
     419             :     explicit            ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab );
     420             :     virtual             ~ExcAutoFilterRecs();
     421             : 
     422             :     void                AddObjRecs();
     423             : 
     424             :     virtual void        Save( XclExpStream& rStrm ) SAL_OVERRIDE;
     425             :     virtual void        SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
     426             : 
     427             :     bool                HasFilterMode() const;
     428             : 
     429             : private:
     430             :     XclExpAutofilter*   GetByCol( SCCOL nCol ); // always 0-based
     431             :     bool                IsFiltered( SCCOL nCol );
     432             : 
     433             : private:
     434             :     typedef XclExpRecordList< XclExpAutofilter >    XclExpAutofilterList;
     435             :     typedef XclExpAutofilterList::RecordRefType     XclExpAutofilterRef;
     436             : 
     437             :     XclExpAutofilterList maFilterList;
     438             :     XclExpFiltermode*   pFilterMode;
     439             :     XclExpAutofilterinfo* pFilterInfo;
     440             :     ScRange                 maRef;
     441             :     bool mbAutoFilter;
     442             : };
     443             : 
     444             : /** Sheet filter manager. Contains auto filters or advanced filters from all sheets. */
     445           0 : class XclExpFilterManager : protected XclExpRoot
     446             : {
     447             : public:
     448             :     explicit            XclExpFilterManager( const XclExpRoot& rRoot );
     449             : 
     450             :     /** Creates the filter records for the specified sheet.
     451             :         @descr  Creates and inserts related built-in NAME records. Therefore this
     452             :             function is called from the name buffer itself. */
     453             :     void                InitTabFilter( SCTAB nScTab );
     454             : 
     455             :     /** Returns a record object containing all filter records for the specified sheet. */
     456             :     XclExpRecordRef     CreateRecord( SCTAB nScTab );
     457             : 
     458             :     /** Returns whether or not FilterMode is present */
     459             :     bool                HasFilterMode( SCTAB nScTab );
     460             : 
     461             : private:
     462             :     using               XclExpRoot::CreateRecord;
     463             : 
     464             :     typedef boost::shared_ptr< ExcAutoFilterRecs >  XclExpTabFilterRef;
     465             :     typedef ::std::map< SCTAB, XclExpTabFilterRef > XclExpTabFilterMap;
     466             : 
     467             :     XclExpTabFilterMap  maFilterMap;
     468             : };
     469             : 
     470             : 
     471             : #endif
     472             : 
     473             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10