LibreOffice Module sc (master)  1
eeparser.hxx
Go to the documentation of this file.
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 INCLUDED_SC_SOURCE_FILTER_INC_EEPARSER_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_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 <optional>
28 #include <address.hxx>
29 #include <memory>
30 #include <vector>
31 #include <map>
32 
33 const char nHorizontal = 1;
34 const char nVertical = 2;
35 
37 {
38  OUString aURL;
41  OUString aFilterName;
42  std::unique_ptr<Graphic>
43  pGraphic; // is taken over by WriteToDocument
44  char nDir; // 1==hori, 2==verti, 3==both
45 
47  aSize( 0, 0 ), aSpace( 0, 0 ), nDir( nHorizontal )
48  {}
49 };
50 
52 {
54  ESelection aSel; // Selection in EditEngine
55  std::optional<OUString>
56  pValStr; // HTML possibly SDVAL string
57  std::optional<OUString>
58  pNumStr; // HTML possibly SDNUM string
59  std::optional<OUString>
60  pName; // HTML possibly anchor/RangeName
61  OUString aAltText; // HTML IMG ALT Text
62  std::vector< std::unique_ptr<ScHTMLImage> > maImageList; // graphics in this cell
63  SCCOL nCol; // relative to the beginning of the parse
65  sal_uInt16 nTab; // HTML TableInTable
66  sal_uInt16 nTwips; // RTF ColAdjust etc.
67  SCCOL nColOverlap; // merged cells if >1
68  SCROW nRowOverlap; // merged cells if >1
69  sal_uInt16 nOffset; // HTML PixelOffset
70  sal_uInt16 nWidth; // HTML PixelWidth
71  bool bHasGraphic:1; // HTML any image loaded
72  bool bEntirePara:1; // true = use entire paragraph, false = use selection
73 
75  aItemSet( *pPool ),
76  nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0),
77  nTwips(0), nColOverlap(1), nRowOverlap(1),
78  nOffset(0), nWidth(0), bHasGraphic(false), bEntirePara(true)
79  {}
80 
81  ScEEParseEntry( const SfxItemSet& rItemSet ) :
82  aItemSet( rItemSet ),
83  nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0),
84  nTwips(0), nColOverlap(1), nRowOverlap(1),
85  nOffset(0), nWidth(0), bHasGraphic(false), bEntirePara(true)
86  {}
87 
89  {
90  maImageList.clear();
91  }
92 };
93 
94 class EditEngine;
95 
96 typedef std::map<SCCOL, sal_uInt16> ColWidthsMap;
97 
99 {
100 protected:
104  std::vector<std::shared_ptr<ScEEParseEntry>> maList;
105  std::shared_ptr<ScEEParseEntry> mxActEntry;
112 
113  void NewActEntry( const ScEEParseEntry* );
114 
115 public:
117  virtual ~ScEEParser();
118 
119  virtual ErrCode Read( SvStream&, const OUString& rBaseURL ) = 0;
120 
121  const ColWidthsMap& GetColWidths() const { return maColWidths; }
123  void GetDimensions( SCCOL& nCols, SCROW& nRows ) const
124  { nCols = nColMax; nRows = nRowMax; }
125 
126  size_t ListSize() const{ return maList.size(); }
127  ScEEParseEntry* ListEntry( size_t index ) { return maList[index].get(); }
128  const ScEEParseEntry* ListEntry( size_t index ) const { return maList[index].get(); }
129 };
130 
131 #endif
132 
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
EditEngine * pEdit
Definition: eeparser.hxx:101
std::vector< std::unique_ptr< ScHTMLImage > > maImageList
Definition: eeparser.hxx:62
SfxItemPool * pDocPool
Definition: eeparser.hxx:103
const char nHorizontal
Definition: eeparser.hxx:33
SfxItemSet aItemSet
Definition: eeparser.hxx:53
void GetDimensions(SCCOL &nCols, SCROW &nRows) const
Definition: eeparser.hxx:123
SCCOL nColCnt
Definition: eeparser.hxx:108
void NewActEntry(const ScEEParseEntry *)
Definition: eeimpars.cxx:642
ESelection aSel
Definition: eeparser.hxx:54
std::map< SCCOL, sal_uInt16 > ColWidthsMap
Definition: eeparser.hxx:94
virtual ErrCode Read(SvStream &, const OUString &rBaseURL)=0
const SCCOL SCCOL_MAX
Definition: address.hxx:57
SCROW nRowMax
Definition: eeparser.hxx:111
const SCROW SCROW_MAX
Definition: address.hxx:56
bool bHasGraphic
Definition: eeparser.hxx:71
sal_uInt16 nTab
Definition: eeparser.hxx:65
SCROW nRowCnt
Definition: eeparser.hxx:109
bool bEntirePara
Definition: eeparser.hxx:72
ColWidthsMap & GetColWidths()
Definition: eeparser.hxx:122
sal_uInt16 nWidth
Definition: eeparser.hxx:70
SCROW nRowOverlap
Definition: eeparser.hxx:68
ScEEParser(EditEngine *)
Definition: eeimpars.cxx:615
ScEEParseEntry(SfxItemPool *pPool)
Definition: eeparser.hxx:74
std::unique_ptr< Graphic > pGraphic
Definition: eeparser.hxx:43
sal_uInt16 nOffset
Definition: eeparser.hxx:69
std::optional< OUString > pValStr
Definition: eeparser.hxx:56
virtual ~ScEEParser()
Definition: eeimpars.cxx:631
const char nVertical
Definition: eeparser.hxx:34
std::vector< std::shared_ptr< ScEEParseEntry > > maList
Definition: eeparser.hxx:104
sal_Int16 SCCOL
Definition: types.hxx:22
Point aSpace
Definition: eeparser.hxx:40
ColWidthsMap maColWidths
Definition: eeparser.hxx:106
ScEEParseEntry(const SfxItemSet &rItemSet)
Definition: eeparser.hxx:81
std::optional< OUString > pNumStr
Definition: eeparser.hxx:58
SCCOL nColOverlap
Definition: eeparser.hxx:67
OUString aFilterName
Definition: eeparser.hxx:41
std::shared_ptr< ScEEParseEntry > mxActEntry
Definition: eeparser.hxx:105
sal_Int32 SCROW
Definition: types.hxx:18
SfxItemPool * pPool
Definition: eeparser.hxx:102
const ColWidthsMap & GetColWidths() const
Definition: eeparser.hxx:121
OUString aURL
Definition: eeparser.hxx:38
size_t ListSize() const
Definition: eeparser.hxx:126
sal_uInt16 nTwips
Definition: eeparser.hxx:66
Size aSize
Definition: eeparser.hxx:39
int nRtfLastToken
Definition: eeparser.hxx:107
const ScEEParseEntry * ListEntry(size_t index) const
Definition: eeparser.hxx:128
std::optional< OUString > pName
Definition: eeparser.hxx:60
OUString aAltText
Definition: eeparser.hxx:61
SCCOL nColMax
Definition: eeparser.hxx:110
ScEEParseEntry * ListEntry(size_t index)
Definition: eeparser.hxx:127