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