LCOV - code coverage report
Current view: top level - sc/source/filter/inc - eeparser.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 19 23 82.6 %
Date: 2012-08-25 Functions: 8 10 80.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 18 38.9 %

           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                 :            : 
      29                 :            : #ifndef SC_EEPARSER_HXX
      30                 :            : #define SC_EEPARSER_HXX
      31                 :            : 
      32                 :            : #include <tools/string.hxx>
      33                 :            : #include <tools/gen.hxx>
      34                 :            : #include <vcl/graph.hxx>
      35                 :            : #include <svl/itemset.hxx>
      36                 :            : #include <editeng/editdata.hxx>
      37                 :            : #include <address.hxx>
      38                 :            : #include <boost/ptr_container/ptr_vector.hpp>
      39                 :            : #include <vector>
      40                 :            : 
      41                 :            : const sal_Char nHorizontal = 1;
      42                 :            : const sal_Char nVertical = 2;
      43                 :            : const sal_Char nHoriVerti = nHorizontal | nVertical;
      44                 :            : 
      45                 :            : struct ScHTMLImage
      46                 :            : {
      47                 :            :     rtl::OUString       aURL;
      48                 :            :     Size                aSize;
      49                 :            :     Point               aSpace;
      50                 :            :     rtl::OUString       aFilterName;
      51                 :            :     Graphic*            pGraphic;       // wird von WriteToDocument uebernommen
      52                 :            :     sal_Char            nDir;           // 1==hori, 2==verti, 3==beides
      53                 :            : 
      54                 :          0 :     ScHTMLImage() :
      55                 :            :         aSize( 0, 0 ), aSpace( 0, 0 ), pGraphic( NULL ),
      56                 :          0 :         nDir( nHorizontal )
      57                 :          0 :         {}
      58                 :            : 
      59 [ #  # ][ #  # ]:          0 :     ~ScHTMLImage() { delete pGraphic; }
      60                 :            : };
      61                 :            : 
      62                 :            : struct ScEEParseEntry
      63                 :            : {
      64                 :            :     SfxItemSet          aItemSet;
      65                 :            :     ESelection          aSel;           // Selection in EditEngine
      66                 :            :     rtl::OUString*      pValStr;        // HTML evtl. SDVAL String
      67                 :            :     rtl::OUString*      pNumStr;        // HTML evtl. SDNUM String
      68                 :            :     rtl::OUString*      pName;          // HTML evtl. Anchor/RangeName
      69                 :            :     rtl::OUString       aAltText;       // HTML IMG ALT Text
      70                 :            :     boost::ptr_vector< ScHTMLImage > maImageList;       // Grafiken in dieser Zelle
      71                 :            :     SCCOL               nCol;           // relativ zum Beginn des Parse
      72                 :            :     SCROW               nRow;
      73                 :            :     sal_uInt16          nTab;           // HTML TableInTable
      74                 :            :     sal_uInt16          nTwips;         // RTF ColAdjust etc.
      75                 :            :     SCCOL               nColOverlap;    // merged cells wenn >1
      76                 :            :     SCROW               nRowOverlap;    // merged cells wenn >1
      77                 :            :     sal_uInt16          nOffset;        // HTML PixelOffset
      78                 :            :     sal_uInt16          nWidth;         // HTML PixelWidth
      79                 :            :     bool                bHasGraphic:1;  // HTML any image loaded
      80                 :            :     bool                bEntirePara:1;  // true = use entire paragraph, false = use selection
      81                 :            : 
      82                 :          3 :     ScEEParseEntry( SfxItemPool* pPool ) :
      83                 :            :         aItemSet( *pPool ), pValStr( NULL ),
      84                 :            :         pNumStr( NULL ), pName( NULL ),
      85                 :            :         nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0),
      86                 :            :         nColOverlap(1), nRowOverlap(1),
      87         [ +  - ]:          3 :         nOffset(0), nWidth(0), bHasGraphic(false), bEntirePara(true)
      88                 :          3 :         {}
      89                 :            : 
      90                 :         84 :     ScEEParseEntry( const SfxItemSet& rItemSet ) :
      91                 :            :         aItemSet( rItemSet ), pValStr( NULL ),
      92                 :            :         pNumStr( NULL ), pName( NULL ),
      93                 :            :         nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0),
      94                 :            :         nColOverlap(1), nRowOverlap(1),
      95         [ +  - ]:         84 :         nOffset(0), nWidth(0), bHasGraphic(false), bEntirePara(true)
      96                 :         84 :         {}
      97                 :            : 
      98                 :         66 :     ~ScEEParseEntry()
      99         [ +  - ]:         66 :     {
     100         [ -  + ]:         66 :         delete pValStr;
     101         [ -  + ]:         66 :         delete pNumStr;
     102         [ -  + ]:         66 :         delete pName;
     103         [ +  - ]:         66 :         maImageList.clear();
     104                 :         66 :     }
     105                 :            : };
     106                 :            : 
     107                 :            : 
     108                 :            : class EditEngine;
     109                 :            : 
     110                 :            : typedef std::map<SCCOL, sal_uInt16> ColWidthsMap;
     111                 :            : 
     112                 :            : class ScEEParser
     113                 :            : {
     114                 :            : protected:
     115                 :            :     EditEngine*         pEdit;
     116                 :            :     SfxItemPool*        pPool;
     117                 :            :     SfxItemPool*        pDocPool;
     118                 :            :     ::std::vector< ScEEParseEntry* > maList;
     119                 :            :     ScEEParseEntry*     pActEntry;
     120                 :            :     ColWidthsMap        maColWidths;
     121                 :            :     int                 nLastToken;
     122                 :            :     SCCOL               nColCnt;
     123                 :            :     SCROW               nRowCnt;
     124                 :            :     SCCOL               nColMax;
     125                 :            :     SCROW               nRowMax;
     126                 :            : 
     127                 :            :     void                NewActEntry( ScEEParseEntry* );
     128                 :            : 
     129                 :            : public:
     130                 :            :                         ScEEParser( EditEngine* );
     131                 :            :     virtual             ~ScEEParser();
     132                 :            : 
     133                 :            :     virtual sal_uLong           Read( SvStream&, const String& rBaseURL ) = 0;
     134                 :            : 
     135                 :            :     const ColWidthsMap&     GetColWidths() const { return maColWidths; }
     136                 :          3 :     ColWidthsMap&           GetColWidths() { return maColWidths; }
     137                 :          3 :     void                    GetDimensions( SCCOL& nCols, SCROW& nRows ) const
     138                 :          3 :                                 { nCols = nColMax; nRows = nRowMax; }
     139                 :            : 
     140                 :          9 :     inline size_t           ListSize() const{ return maList.size(); }
     141                 :         21 :     ScEEParseEntry*         ListEntry( size_t index ) { return maList[ index ]; }
     142                 :         21 :     const ScEEParseEntry*   ListEntry( size_t index ) const { return maList[ index ]; }
     143                 :            : };
     144                 :            : 
     145                 :            : 
     146                 :            : 
     147                 :            : #endif
     148                 :            : 
     149                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10