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

Generated by: LCOV version 1.11