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