LCOV - code coverage report
Current view: top level - sc/source/filter/inc - eeparser.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 23 0.0 %
Date: 2014-04-14 Functions: 0 10 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_EEPARSER_HXX
      21             : #define SC_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           0 :     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           0 :         nOffset(0), nWidth(0), bHasGraphic(false), bEntirePara(true)
      78           0 :         {}
      79             : 
      80           0 :     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           0 :         nOffset(0), nWidth(0), bHasGraphic(false), bEntirePara(true)
      86           0 :         {}
      87             : 
      88           0 :     ~ScEEParseEntry()
      89           0 :     {
      90           0 :         delete pValStr;
      91           0 :         delete pNumStr;
      92           0 :         delete pName;
      93           0 :         maImageList.clear();
      94           0 :     }
      95             : };
      96             : 
      97             : 
      98             : class EditEngine;
      99             : 
     100             : typedef std::map<SCCOL, sal_uInt16> ColWidthsMap;
     101             : 
     102             : class ScEEParser
     103             : {
     104             : protected:
     105             :     EditEngine*         pEdit;
     106             :     SfxItemPool*        pPool;
     107             :     SfxItemPool*        pDocPool;
     108             :     ::std::vector< ScEEParseEntry* > maList;
     109             :     ScEEParseEntry*     pActEntry;
     110             :     ColWidthsMap        maColWidths;
     111             :     int                 nLastToken;
     112             :     SCCOL               nColCnt;
     113             :     SCROW               nRowCnt;
     114             :     SCCOL               nColMax;
     115             :     SCROW               nRowMax;
     116             : 
     117             :     void                NewActEntry( ScEEParseEntry* );
     118             : 
     119             : public:
     120             :                         ScEEParser( EditEngine* );
     121             :     virtual             ~ScEEParser();
     122             : 
     123             :     virtual sal_uLong       Read( SvStream&, const OUString& rBaseURL ) = 0;
     124             : 
     125             :     const ColWidthsMap&     GetColWidths() const { return maColWidths; }
     126           0 :     ColWidthsMap&           GetColWidths() { return maColWidths; }
     127           0 :     void                    GetDimensions( SCCOL& nCols, SCROW& nRows ) const
     128           0 :                                 { nCols = nColMax; nRows = nRowMax; }
     129             : 
     130           0 :     inline size_t           ListSize() const{ return maList.size(); }
     131           0 :     ScEEParseEntry*         ListEntry( size_t index ) { return maList[ index ]; }
     132           0 :     const ScEEParseEntry*   ListEntry( size_t index ) const { return maList[ index ]; }
     133             : };
     134             : 
     135             : #endif
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10