1*38d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*38d50f7bSAndrew Rist * distributed with this work for additional information 6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10*38d50f7bSAndrew Rist * 11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*38d50f7bSAndrew Rist * 13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an 15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 17*38d50f7bSAndrew Rist * specific language governing permissions and limitations 18*38d50f7bSAndrew Rist * under the License. 19*38d50f7bSAndrew Rist * 20*38d50f7bSAndrew Rist *************************************************************/ 21*38d50f7bSAndrew Rist 22*38d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SC_EEPARSER_HXX 25cdf0e10cSrcweir #define SC_EEPARSER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <tools/string.hxx> 28cdf0e10cSrcweir #include <tools/gen.hxx> 29cdf0e10cSrcweir #include <vcl/graph.hxx> 30cdf0e10cSrcweir #include <tools/table.hxx> 31cdf0e10cSrcweir #include <svl/itemset.hxx> 32cdf0e10cSrcweir #include <editeng/editdata.hxx> 33cdf0e10cSrcweir #include <address.hxx> 34cdf0e10cSrcweir 35cdf0e10cSrcweir const sal_Char nHorizontal = 1; 36cdf0e10cSrcweir const sal_Char nVertical = 2; 37cdf0e10cSrcweir const sal_Char nHoriVerti = nHorizontal | nVertical; 38cdf0e10cSrcweir 39cdf0e10cSrcweir struct ScHTMLImage 40cdf0e10cSrcweir { 41cdf0e10cSrcweir String aURL; 42cdf0e10cSrcweir Size aSize; 43cdf0e10cSrcweir Point aSpace; 44cdf0e10cSrcweir String aFilterName; 45cdf0e10cSrcweir Graphic* pGraphic; // wird von WriteToDocument uebernommen 46cdf0e10cSrcweir sal_Char nDir; // 1==hori, 2==verti, 3==beides 47cdf0e10cSrcweir ScHTMLImageScHTMLImage48cdf0e10cSrcweir ScHTMLImage() : 49cdf0e10cSrcweir aSize( 0, 0 ), aSpace( 0, 0 ), pGraphic( NULL ), 50cdf0e10cSrcweir nDir( nHorizontal ) 51cdf0e10cSrcweir {} ~ScHTMLImageScHTMLImage52cdf0e10cSrcweir ~ScHTMLImage() 53cdf0e10cSrcweir { if ( pGraphic ) delete pGraphic; } 54cdf0e10cSrcweir }; 55cdf0e10cSrcweir DECLARE_LIST( ScHTMLImageList, ScHTMLImage* ) 56cdf0e10cSrcweir 57cdf0e10cSrcweir struct ScEEParseEntry 58cdf0e10cSrcweir { 59cdf0e10cSrcweir SfxItemSet aItemSet; 60cdf0e10cSrcweir ESelection aSel; // Selection in EditEngine 61cdf0e10cSrcweir String* pValStr; // HTML evtl. SDVAL String 62cdf0e10cSrcweir String* pNumStr; // HTML evtl. SDNUM String 63cdf0e10cSrcweir String* pName; // HTML evtl. Anchor/RangeName 64cdf0e10cSrcweir String aAltText; // HTML IMG ALT Text 65cdf0e10cSrcweir ScHTMLImageList* pImageList; // Grafiken in dieser Zelle 66cdf0e10cSrcweir SCCOL nCol; // relativ zum Beginn des Parse 67cdf0e10cSrcweir SCROW nRow; 68cdf0e10cSrcweir sal_uInt16 nTab; // HTML TableInTable 69cdf0e10cSrcweir sal_uInt16 nTwips; // RTF ColAdjust etc. 70cdf0e10cSrcweir SCCOL nColOverlap; // merged cells wenn >1 71cdf0e10cSrcweir SCROW nRowOverlap; // merged cells wenn >1 72cdf0e10cSrcweir sal_uInt16 nOffset; // HTML PixelOffset 73cdf0e10cSrcweir sal_uInt16 nWidth; // HTML PixelWidth 74cdf0e10cSrcweir sal_Bool bHasGraphic; // HTML any image loaded 75cdf0e10cSrcweir bool bEntirePara; // sal_True = use entire paragraph, false = use selection 76cdf0e10cSrcweir ScEEParseEntryScEEParseEntry77cdf0e10cSrcweir ScEEParseEntry( SfxItemPool* pPool ) : 78cdf0e10cSrcweir aItemSet( *pPool ), pValStr( NULL ), 79cdf0e10cSrcweir pNumStr( NULL ), pName( NULL ), pImageList( NULL ), 80cdf0e10cSrcweir nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0), 81cdf0e10cSrcweir nColOverlap(1), nRowOverlap(1), 82cdf0e10cSrcweir nOffset(0), nWidth(0), bHasGraphic(sal_False), bEntirePara(true) 83cdf0e10cSrcweir {} ScEEParseEntryScEEParseEntry84cdf0e10cSrcweir ScEEParseEntry( const SfxItemSet& rItemSet ) : 85cdf0e10cSrcweir aItemSet( rItemSet ), pValStr( NULL ), 86cdf0e10cSrcweir pNumStr( NULL ), pName( NULL ), pImageList( NULL ), 87cdf0e10cSrcweir nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0), 88cdf0e10cSrcweir nColOverlap(1), nRowOverlap(1), 89cdf0e10cSrcweir nOffset(0), nWidth(0), bHasGraphic(sal_False), bEntirePara(true) 90cdf0e10cSrcweir {} ~ScEEParseEntryScEEParseEntry91cdf0e10cSrcweir ~ScEEParseEntry() 92cdf0e10cSrcweir { 93cdf0e10cSrcweir if ( pValStr ) 94cdf0e10cSrcweir delete pValStr; 95cdf0e10cSrcweir if ( pNumStr ) 96cdf0e10cSrcweir delete pNumStr; 97cdf0e10cSrcweir if ( pName ) 98cdf0e10cSrcweir delete pName; 99cdf0e10cSrcweir if ( pImageList ) 100cdf0e10cSrcweir { 101cdf0e10cSrcweir for ( ScHTMLImage* pI = pImageList->First(); 102cdf0e10cSrcweir pI; pI = pImageList->Next() ) 103cdf0e10cSrcweir { 104cdf0e10cSrcweir delete pI; 105cdf0e10cSrcweir } 106cdf0e10cSrcweir delete pImageList; 107cdf0e10cSrcweir } 108cdf0e10cSrcweir } 109cdf0e10cSrcweir }; 110cdf0e10cSrcweir DECLARE_LIST( ScEEParseList, ScEEParseEntry* ) 111cdf0e10cSrcweir 112cdf0e10cSrcweir 113cdf0e10cSrcweir class EditEngine; 114cdf0e10cSrcweir 115cdf0e10cSrcweir class ScEEParser 116cdf0e10cSrcweir { 117cdf0e10cSrcweir protected: 118cdf0e10cSrcweir EditEngine* pEdit; 119cdf0e10cSrcweir SfxItemPool* pPool; 120cdf0e10cSrcweir SfxItemPool* pDocPool; 121cdf0e10cSrcweir ScEEParseList* pList; 122cdf0e10cSrcweir ScEEParseEntry* pActEntry; 123cdf0e10cSrcweir Table* pColWidths; 124cdf0e10cSrcweir int nLastToken; 125cdf0e10cSrcweir SCCOL nColCnt; 126cdf0e10cSrcweir SCROW nRowCnt; 127cdf0e10cSrcweir SCCOL nColMax; 128cdf0e10cSrcweir SCROW nRowMax; 129cdf0e10cSrcweir 130cdf0e10cSrcweir void NewActEntry( ScEEParseEntry* ); 131cdf0e10cSrcweir 132cdf0e10cSrcweir public: 133cdf0e10cSrcweir ScEEParser( EditEngine* ); 134cdf0e10cSrcweir virtual ~ScEEParser(); 135cdf0e10cSrcweir 136cdf0e10cSrcweir virtual sal_uLong Read( SvStream&, const String& rBaseURL ) = 0; 137cdf0e10cSrcweir GetDimensions(SCCOL & nCols,SCROW & nRows) const138cdf0e10cSrcweir void GetDimensions( SCCOL& nCols, SCROW& nRows ) const 139cdf0e10cSrcweir { nCols = nColMax; nRows = nRowMax; } Count() const140cdf0e10cSrcweir sal_uLong Count() const { return pList->Count(); } First() const141cdf0e10cSrcweir ScEEParseEntry* First() const { return pList->First(); } Next() const142cdf0e10cSrcweir ScEEParseEntry* Next() const { return pList->Next(); } GetColWidths() const143cdf0e10cSrcweir Table* GetColWidths() const { return pColWidths; } 144cdf0e10cSrcweir }; 145cdf0e10cSrcweir 146cdf0e10cSrcweir 147cdf0e10cSrcweir 148cdf0e10cSrcweir #endif 149cdf0e10cSrcweir 150