merged tag ooo/OOO330_m14
[LibreOffice.git] / sc / source / filter / inc / eeparser.hxx
blobafc8c959392b4341c4ebfbfe9de7687762224142
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef SC_EEPARSER_HXX
29 #define SC_EEPARSER_HXX
31 #include <tools/string.hxx>
32 #include <tools/gen.hxx>
33 #include <vcl/graph.hxx>
34 #include <tools/table.hxx>
35 #include <svl/itemset.hxx>
36 #include <editeng/editdata.hxx>
37 #include <address.hxx>
39 const sal_Char nHorizontal = 1;
40 const sal_Char nVertical = 2;
41 const sal_Char nHoriVerti = nHorizontal | nVertical;
43 struct ScHTMLImage
45 String aURL;
46 Size aSize;
47 Point aSpace;
48 String aFilterName;
49 Graphic* pGraphic; // wird von WriteToDocument uebernommen
50 sal_Char nDir; // 1==hori, 2==verti, 3==beides
52 ScHTMLImage() :
53 aSize( 0, 0 ), aSpace( 0, 0 ), pGraphic( NULL ),
54 nDir( nHorizontal )
56 ~ScHTMLImage()
57 { if ( pGraphic ) delete pGraphic; }
59 DECLARE_LIST( ScHTMLImageList, ScHTMLImage* )
61 struct ScEEParseEntry
63 SfxItemSet aItemSet;
64 ESelection aSel; // Selection in EditEngine
65 String* pValStr; // HTML evtl. SDVAL String
66 String* pNumStr; // HTML evtl. SDNUM String
67 String* pName; // HTML evtl. Anchor/RangeName
68 String aAltText; // HTML IMG ALT Text
69 ScHTMLImageList* pImageList; // Grafiken in dieser Zelle
70 SCCOL nCol; // relativ zum Beginn des Parse
71 SCROW nRow;
72 USHORT nTab; // HTML TableInTable
73 USHORT nTwips; // RTF ColAdjust etc.
74 SCCOL nColOverlap; // merged cells wenn >1
75 SCROW nRowOverlap; // merged cells wenn >1
76 USHORT nOffset; // HTML PixelOffset
77 USHORT nWidth; // HTML PixelWidth
78 BOOL bHasGraphic; // HTML any image loaded
79 bool bEntirePara; // TRUE = use entire paragraph, false = use selection
81 ScEEParseEntry( SfxItemPool* pPool ) :
82 aItemSet( *pPool ), pValStr( NULL ),
83 pNumStr( NULL ), pName( NULL ), pImageList( NULL ),
84 nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0),
85 nColOverlap(1), nRowOverlap(1),
86 nOffset(0), nWidth(0), bHasGraphic(FALSE), bEntirePara(true)
88 ScEEParseEntry( const SfxItemSet& rItemSet ) :
89 aItemSet( rItemSet ), pValStr( NULL ),
90 pNumStr( NULL ), pName( NULL ), pImageList( NULL ),
91 nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0),
92 nColOverlap(1), nRowOverlap(1),
93 nOffset(0), nWidth(0), bHasGraphic(FALSE), bEntirePara(true)
95 ~ScEEParseEntry()
97 if ( pValStr )
98 delete pValStr;
99 if ( pNumStr )
100 delete pNumStr;
101 if ( pName )
102 delete pName;
103 if ( pImageList )
105 for ( ScHTMLImage* pI = pImageList->First();
106 pI; pI = pImageList->Next() )
108 delete pI;
110 delete pImageList;
114 DECLARE_LIST( ScEEParseList, ScEEParseEntry* )
117 class EditEngine;
119 class ScEEParser
121 protected:
122 EditEngine* pEdit;
123 SfxItemPool* pPool;
124 SfxItemPool* pDocPool;
125 ScEEParseList* pList;
126 ScEEParseEntry* pActEntry;
127 Table* pColWidths;
128 int nLastToken;
129 SCCOL nColCnt;
130 SCROW nRowCnt;
131 SCCOL nColMax;
132 SCROW nRowMax;
134 void NewActEntry( ScEEParseEntry* );
136 public:
137 ScEEParser( EditEngine* );
138 virtual ~ScEEParser();
140 virtual ULONG Read( SvStream&, const String& rBaseURL ) = 0;
142 void GetDimensions( SCCOL& nCols, SCROW& nRows ) const
143 { nCols = nColMax; nRows = nRowMax; }
144 ULONG Count() const { return pList->Count(); }
145 ScEEParseEntry* First() const { return pList->First(); }
146 ScEEParseEntry* Next() const { return pList->Next(); }
147 Table* GetColWidths() const { return pColWidths; }
152 #endif