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 <utility>
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
35const char nHorizontal = 1;
36const char nVertical = 2;
37
39{
40 OUString aURL;
43 OUString aFilterName;
44 std::optional<Graphic>
45 oGraphic; // is taken over by WriteToDocument
46 char nDir; // 1==hori, 2==verti, 3==both
47
49 aSize( 0, 0 ), aSpace( 0, 0 ), nDir( nHorizontal )
50 {}
51};
52
54{
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
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
77 aItemSet( *pPool ),
80 nOffset(0), nWidth(0), bHasGraphic(false), bEntirePara(true)
81 {}
82
84 aItemSet(std::move( _aItemSet )),
87 nOffset(0), nWidth(0), bHasGraphic(false), bEntirePara(true)
88 {}
89
91 {
92 maImageList.clear();
93 }
94};
95
96class EditEngine;
97
98typedef std::map<SCCOL, sal_uInt16> ColWidthsMap;
99
101{
102protected:
106 std::vector<std::shared_ptr<ScEEParseEntry>> maList;
107 std::shared_ptr<ScEEParseEntry> mxActEntry;
114
115 void NewActEntry( const ScEEParseEntry* );
116
117public:
119 virtual ~ScEEParser();
120
121 virtual ErrCode Read( SvStream&, const OUString& rBaseURL ) = 0;
122
123 const ColWidthsMap& GetColWidths() const { 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: */
const SCCOL SCCOL_MAX
Definition: address.hxx:56
const SCROW SCROW_MAX
Definition: address.hxx:55
ScEEParser(EditEngine *)
Definition: eeimpars.cxx:628
ScEEParseEntry * ListEntry(size_t index)
Definition: eeparser.hxx:129
const ScEEParseEntry * ListEntry(size_t index) const
Definition: eeparser.hxx:130
void NewActEntry(const ScEEParseEntry *)
Definition: eeimpars.cxx:655
SCCOL nColCnt
Definition: eeparser.hxx:110
ColWidthsMap maColWidths
Definition: eeparser.hxx:108
ColWidthsMap & GetColWidths()
Definition: eeparser.hxx:124
EditEngine * pEdit
Definition: eeparser.hxx:103
const ColWidthsMap & GetColWidths() const
Definition: eeparser.hxx:123
virtual ErrCode Read(SvStream &, const OUString &rBaseURL)=0
std::vector< std::shared_ptr< ScEEParseEntry > > maList
Definition: eeparser.hxx:106
std::shared_ptr< ScEEParseEntry > mxActEntry
Definition: eeparser.hxx:107
size_t ListSize() const
Definition: eeparser.hxx:128
SCROW nRowMax
Definition: eeparser.hxx:113
SCROW nRowCnt
Definition: eeparser.hxx:111
void GetDimensions(SCCOL &nCols, SCROW &nRows) const
Definition: eeparser.hxx:125
SCCOL nColMax
Definition: eeparser.hxx:112
rtl::Reference< SfxItemPool > pDocPool
Definition: eeparser.hxx:105
int nRtfLastToken
Definition: eeparser.hxx:109
virtual ~ScEEParser()
Definition: eeimpars.cxx:644
rtl::Reference< SfxItemPool > pPool
Definition: eeparser.hxx:104
const char nHorizontal
Definition: eeparser.hxx:35
const char nVertical
Definition: eeparser.hxx:36
std::map< SCCOL, sal_uInt16 > ColWidthsMap
Definition: eeparser.hxx:96
index
std::vector< std::unique_ptr< ScHTMLImage > > maImageList
Definition: eeparser.hxx:64
std::optional< OUString > pValStr
Definition: eeparser.hxx:58
SfxItemSet aItemSet
Definition: eeparser.hxx:55
SCCOL nColOverlap
Definition: eeparser.hxx:69
std::optional< OUString > pName
Definition: eeparser.hxx:62
ESelection aSel
Definition: eeparser.hxx:56
bool bEntirePara
Definition: eeparser.hxx:74
ScEEParseEntry(SfxItemSet _aItemSet)
Definition: eeparser.hxx:83
sal_uInt16 nTab
Definition: eeparser.hxx:67
ScEEParseEntry(SfxItemPool *pPool)
Definition: eeparser.hxx:76
bool bHasGraphic
Definition: eeparser.hxx:73
sal_uInt16 nWidth
Definition: eeparser.hxx:72
sal_uInt16 nTwips
Definition: eeparser.hxx:68
sal_uInt16 nOffset
Definition: eeparser.hxx:71
OUString aAltText
Definition: eeparser.hxx:63
std::optional< OUString > pNumStr
Definition: eeparser.hxx:60
SCROW nRowOverlap
Definition: eeparser.hxx:70
Point aSpace
Definition: eeparser.hxx:42
OUString aURL
Definition: eeparser.hxx:40
OUString aFilterName
Definition: eeparser.hxx:43
Size aSize
Definition: eeparser.hxx:41
std::optional< Graphic > oGraphic
Definition: eeparser.hxx:45
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17