Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / filter / inc / eeparser.hxx
blobab7b209bd9a059c16fd23ba12f5330d6117e7f8c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_EEPARSER_HXX
21 #define SC_EEPARSER_HXX
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>
31 const sal_Char nHorizontal = 1;
32 const sal_Char nVertical = 2;
33 const sal_Char nHoriVerti = nHorizontal | nVertical;
35 struct ScHTMLImage
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
44 ScHTMLImage() :
45 aSize( 0, 0 ), aSpace( 0, 0 ), pGraphic( NULL ),
46 nDir( nHorizontal )
49 ~ScHTMLImage() { delete pGraphic; }
52 struct ScEEParseEntry
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
72 ScEEParseEntry( SfxItemPool* pPool ) :
73 aItemSet( *pPool ), pValStr( NULL ),
74 pNumStr( NULL ), pName( NULL ),
75 nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0),
76 nColOverlap(1), nRowOverlap(1),
77 nOffset(0), nWidth(0), bHasGraphic(false), bEntirePara(true)
80 ScEEParseEntry( const SfxItemSet& rItemSet ) :
81 aItemSet( rItemSet ), pValStr( NULL ),
82 pNumStr( NULL ), pName( NULL ),
83 nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0),
84 nColOverlap(1), nRowOverlap(1),
85 nOffset(0), nWidth(0), bHasGraphic(false), bEntirePara(true)
88 ~ScEEParseEntry()
90 delete pValStr;
91 delete pNumStr;
92 delete pName;
93 maImageList.clear();
98 class EditEngine;
100 typedef std::map<SCCOL, sal_uInt16> ColWidthsMap;
102 class ScEEParser
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;
117 void NewActEntry( ScEEParseEntry* );
119 public:
120 ScEEParser( EditEngine* );
121 virtual ~ScEEParser();
123 virtual sal_uLong Read( SvStream&, const OUString& rBaseURL ) = 0;
125 const ColWidthsMap& GetColWidths() const { return maColWidths; }
126 ColWidthsMap& GetColWidths() { return maColWidths; }
127 void GetDimensions( SCCOL& nCols, SCROW& nRows ) const
128 { nCols = nColMax; nRows = nRowMax; }
130 inline size_t ListSize() const{ return maList.size(); }
131 ScEEParseEntry* ListEntry( size_t index ) { return maList[ index ]; }
132 const ScEEParseEntry* ListEntry( size_t index ) const { return maList[ index ]; }
137 #endif
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */