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