LibreOffice Module sc (master)  1
htmlpars.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 <memory>
23 #include <map>
24 #include <optional>
25 #include <stack>
26 #include <string_view>
27 #include <unordered_map>
28 #include <vector>
29 #include <o3tl/sorted_vector.hxx>
30 
31 #include <rangelst.hxx>
32 #include "eeparser.hxx"
33 
34 const sal_uInt32 SC_HTML_FONTSIZES = 7; // like export, HTML options
35 
36 // Pixel tolerance for SeekOffset and related.
37 const sal_uInt16 SC_HTML_OFFSET_TOLERANCE_SMALL = 1; // single table
38 const sal_uInt16 SC_HTML_OFFSET_TOLERANCE_LARGE = 10; // nested
39 
40 // BASE class for HTML parser classes
41 
42 class ScHTMLTable;
43 
49 {
50  typedef std::unordered_map<OUString, OUString> PropsType;
51  typedef ::std::map<OUString, PropsType> NamePropsType;
52  typedef ::std::map<OUString, NamePropsType> ElemsType;
53 
54  NamePropsType m_GlobalProps;
55  NamePropsType m_ElemGlobalProps;
56  ElemsType m_ElemProps;
57  const OUString maEmpty;
58 public:
59  ScHTMLStyles();
60 
61  void add(const char* pElemName, size_t nElemName, const char* pClassName, size_t nClassName,
62  const OUString& aProp, const OUString& aValue);
63 
67  const OUString& getPropertyValue(
68  const OUString& rElem, const OUString& rClass, const OUString& rPropName) const;
69 
70 private:
71  static void insertProp(
72  NamePropsType& rProps, const OUString& aName,
73  const OUString& aProp, const OUString& aValue);
74 };
75 
77 class ScHTMLParser : public ScEEParser
78 {
80 protected:
83 
84 public:
85  explicit ScHTMLParser( EditEngine* pEditEngine, ScDocument* pDoc );
86  virtual ~ScHTMLParser() override;
87 
88  virtual ErrCode Read( SvStream& rStrm, const OUString& rBaseURL ) override = 0;
89 
91  ScDocument& GetDoc() { return *mpDoc;}
92 
94  virtual const ScHTMLTable* GetGlobalTable() const = 0;
95 };
96 
98 
100 {
102  std::shared_ptr<ScEEParseEntry> xCellEntry;
108  sal_uInt16 nTable;
109  sal_uInt16 nTableWidth;
110  sal_uInt16 nColOffset;
111  sal_uInt16 nColOffsetStart;
112  bool bFirstRow;
113  ScHTMLTableStackEntry( const std::shared_ptr<ScEEParseEntry>& rE,
114  const ScRangeListRef& rL, ScHTMLColOffset* pTO,
115  sal_uLong nFTC,
116  SCROW nRow,
117  SCCOL nStart, SCCOL nMax, sal_uInt16 nTab,
118  sal_uInt16 nTW, sal_uInt16 nCO, sal_uInt16 nCOS,
119  bool bFR )
120  : xLockedList( rL ), xCellEntry(rE),
121  pLocalColOffset( pTO ),
122  nFirstTableCell( nFTC ),
123  nRowCnt( nRow ),
124  nColCntStart( nStart ), nMaxCol( nMax ),
125  nTable( nTab ), nTableWidth( nTW ),
126  nColOffset( nCO ), nColOffsetStart( nCOS ),
127  bFirstRow( bFR )
128  {}
129 };
130 
132 {
137  SCROW nCRow )
138  : nLastCol( nLCol ), nNextRow( nNRow ),
139  nCurRow( nCRow )
140  {}
141 };
142 
143 class EditEngine;
144 class ScDocument;
146 
147 // TODO these need better names
148 typedef ::std::map<SCROW, SCROW> InnerMap;
149 typedef ::std::map<sal_uInt16, InnerMap*> OuterMap;
150 
152 {
153 private:
155  OUString aBaseURL;
156  ::std::stack< std::unique_ptr<ScHTMLTableStackEntry> >
158  OUString aString;
160  std::unique_ptr<OuterMap> pTables;
164  short nTableLevel;
165  sal_uInt16 nTable;
166  sal_uInt16 nMaxTable;
167  SCCOL nColCntStart; // first Col per table
168  SCCOL nMaxCol; // per table
169  sal_uInt16 nTableWidth; // per table
170  sal_uInt16 nColOffset; // current, pixel
171  sal_uInt16 nColOffsetStart; // start value per table, in pixel
172  sal_uInt16 nOffsetTolerance; // for use with SeekOffset and related
173  bool bFirstRow; // per table, whether in first row
175  bool bInCell:1;
176  bool bInTitle:1;
177 
178  DECL_LINK( HTMLImportHdl, HtmlImportInfo&, void );
179  void NewActEntry( const ScEEParseEntry* );
180  static void EntryEnd( ScEEParseEntry*, const ESelection& );
181  void ProcToken( HtmlImportInfo* );
182  void CloseEntry( const HtmlImportInfo* );
183  void NextRow( const HtmlImportInfo* );
184  void SkipLocked( ScEEParseEntry*, bool bJoin = true );
185  static bool SeekOffset( const ScHTMLColOffset*, sal_uInt16 nOffset,
186  SCCOL* pCol, sal_uInt16 nOffsetTol );
187  static void MakeCol( ScHTMLColOffset*, sal_uInt16& nOffset,
188  sal_uInt16& nWidth, sal_uInt16 nOffsetTol,
189  sal_uInt16 nWidthTol );
190  static void MakeColNoRef( ScHTMLColOffset*, sal_uInt16 nOffset,
191  sal_uInt16 nWidth, sal_uInt16 nOffsetTol,
192  sal_uInt16 nWidthTol );
193  static void ModifyOffset( ScHTMLColOffset*, sal_uInt16& nOldOffset,
194  sal_uInt16& nNewOffset, sal_uInt16 nOffsetTol );
195  void Colonize( ScEEParseEntry* );
196  sal_uInt16 GetWidth( const ScEEParseEntry* );
197  void SetWidths();
198  void Adjust();
199 
200  sal_uInt16 GetWidthPixel( const HTMLOption& );
201  bool IsAtBeginningOfText( const HtmlImportInfo* );
202 
203  void TableOn( HtmlImportInfo* );
204  void ColOn( HtmlImportInfo* );
205  void TableRowOn( const HtmlImportInfo* );
206  void TableRowOff( const HtmlImportInfo* );
207  void TableDataOn( HtmlImportInfo* );
208  void TableDataOff( const HtmlImportInfo* );
209  void TableOff( const HtmlImportInfo* );
210  void Image( HtmlImportInfo* );
211  void AnchorOn( HtmlImportInfo* );
212  void FontOn( HtmlImportInfo* );
213 
214 public:
215  ScHTMLLayoutParser( EditEngine*, const OUString& rBaseURL, const Size& aPageSize, ScDocument* );
216  virtual ~ScHTMLLayoutParser() override;
217  virtual ErrCode Read( SvStream&, const OUString& rBaseURL ) override;
218  virtual const ScHTMLTable* GetGlobalTable() const override;
219 };
220 
221 // HTML DATA QUERY PARSER
222 
224 enum ScHTMLOrient { tdCol = 0 , tdRow = 1 };
225 
227 typedef sal_uInt16 ScHTMLTableId;
232 
234 struct ScHTMLPos
235 {
238 
239  explicit ScHTMLPos() : mnCol( 0 ), mnRow( 0 ) {}
240  explicit ScHTMLPos( SCCOL nCol, SCROW nRow ) :
241  mnCol( nCol ), mnRow( nRow ) {}
242  explicit ScHTMLPos( const ScAddress& rAddr ) { Set( rAddr ); }
243 
244  SCCOLROW Get( ScHTMLOrient eOrient ) const
245  { return (eOrient == tdCol) ? mnCol : mnRow; }
246  void Set( SCCOL nCol, SCROW nRow )
247  { mnCol = nCol; mnRow = nRow; }
248  void Set( const ScAddress& rAddr )
249  { Set( rAddr.Col(), rAddr.Row() ); }
251  { return ScAddress( mnCol, mnRow, 0 ); }
252 };
253 
254 inline bool operator<( const ScHTMLPos& rPos1, const ScHTMLPos& rPos2 )
255 {
256  return (rPos1.mnRow < rPos2.mnRow) || ((rPos1.mnRow == rPos2.mnRow) && (rPos1.mnCol < rPos2.mnCol));
257 }
258 
261 {
264 
265  explicit ScHTMLSize( SCCOL nCols, SCROW nRows ) :
266  mnCols( nCols ), mnRows( nRows ) {}
267  void Set( SCCOL nCols, SCROW nRows )
268  { mnCols = nCols; mnRows = nRows; }
269 };
270 
273 {
274 public:
275  explicit ScHTMLEntry(
276  const SfxItemSet& rItemSet,
277  ScHTMLTableId nTableId = SC_HTML_NO_TABLE );
278 
280  bool IsEmpty() const { return !aSel.HasRange(); }
282  bool HasContents() const;
284  bool IsTable() const { return nTab != SC_HTML_NO_TABLE; }
286  ScHTMLTableId GetTableId() const { return nTab; }
287 
289  void SetImportAlways() { mbImportAlways = true; }
291  void AdjustStart( const HtmlImportInfo& rInfo );
293  void AdjustEnd( const HtmlImportInfo& rInfo );
295  void Strip( const EditEngine& rEditEngine );
296 
300  const SfxItemSet& GetItemSet() const { return aItemSet; }
301 
302 private:
304 };
305 
308 {
311 
313  explicit ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId );
314 };
315 
316 class ScHTMLTableMap;
317 
326 {
327 public:
333  explicit ScHTMLTable(
334  ScHTMLTable& rParentTable,
335  const HtmlImportInfo& rInfo,
336  bool bPreFormText,
337  const ScDocument& rDoc );
338 
339  virtual ~ScHTMLTable();
340 
342  const OUString& GetTableName() const { return maTableName; }
344  const OUString& GetTableCaption() const { return maCaption; }
348  ScHTMLSize GetSpan( const ScHTMLPos& rCellPos ) const;
349 
352  ScHTMLTable* FindNestedTable( ScHTMLTableId nTableId ) const;
353 
355  void PutItem( const SfxPoolItem& rItem );
357  void PutText( const HtmlImportInfo& rInfo );
359  void InsertPara( const HtmlImportInfo& rInfo );
360 
363  void BreakOn();
365  void HeadingOn();
367  void AnchorOn();
368 
371  ScHTMLTable* TableOn( const HtmlImportInfo& rInfo );
374  ScHTMLTable* TableOff( const HtmlImportInfo& rInfo );
376  void CaptionOn();
378  void CaptionOff();
381  ScHTMLTable* PreOn( const HtmlImportInfo& rInfo );
384  ScHTMLTable* PreOff( const HtmlImportInfo& rInfo );
385 
388  void RowOn( const HtmlImportInfo& rInfo );
391  void RowOff( const HtmlImportInfo& rInfo );
393  void DataOn( const HtmlImportInfo& rInfo );
396  void DataOff( const HtmlImportInfo& rInfo );
397 
399  void BodyOn( const HtmlImportInfo& rInfo );
401  void BodyOff( const HtmlImportInfo& rInfo );
402 
406  ScHTMLTable* CloseTable( const HtmlImportInfo& rInfo );
407 
409  SCCOLROW GetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellPos ) const;
411  SCCOLROW GetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellBegin, SCCOLROW nCellEnd ) const;
413  SCCOLROW GetDocSize( ScHTMLOrient eOrient ) const;
415  ScHTMLSize GetDocSize( const ScHTMLPos& rCellPos ) const;
416 
418  const ScHTMLPos& GetDocPos() const { return maDocBasePos; }
420  SCCOLROW GetDocPos( ScHTMLOrient eOrient, SCCOLROW nCellPos ) const;
422  ScHTMLPos GetDocPos( const ScHTMLPos& rCellPos ) const;
423 
425  void GetDocRange( ScRange& rRange ) const;
426 
428  void ApplyCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos ) const;
429 
431 
432 protected:
435  explicit ScHTMLTable(
436  SfxItemPool& rPool,
437  EditEngine& rEditEngine,
438  std::vector<std::shared_ptr<ScEEParseEntry>>& rEEParseList,
439  ScHTMLTableId& rnUnusedId, ScHTMLParser* pParser,
440  const ScDocument& rDoc );
441 
443  void FillEmptyCells();
445  void RecalcDocSize();
448  void RecalcDocPos( const ScHTMLPos& rBasePos );
449 
450 private:
451  typedef ::std::unique_ptr< ScHTMLTableMap > ScHTMLTableMapPtr;
452  typedef ::std::vector< SCCOLROW > ScSizeVec;
453  typedef ::std::vector< ScHTMLEntry* > ScHTMLEntryVector;
454  typedef ::std::unique_ptr< ScHTMLEntry > ScHTMLEntryPtr;
455 
457  bool IsEmptyCell() const;
459  const SfxItemSet& GetCurrItemSet() const;
460 
462  static bool IsSpaceCharInfo( const HtmlImportInfo& rInfo );
463 
465  ScHTMLEntryPtr CreateEntry() const;
468  void CreateNewEntry( const HtmlImportInfo& rInfo );
469 
471  void InsertLeadingEmptyLine();
472 
474  void ImplPushEntryToVector( ScHTMLEntryVector& rEntryVector, ScHTMLEntryPtr& rxEntry );
479  bool PushEntry( ScHTMLEntryPtr& rxEntry );
484  bool PushEntry( const HtmlImportInfo& rInfo, bool bLastInCell = false );
486  void PushTableEntry( ScHTMLTableId nTableId );
487 
492  ScHTMLTable* GetExistingTable( ScHTMLTableId nTableId ) const;
495  ScHTMLTable* InsertNestedTable( const HtmlImportInfo& rInfo, bool bPreFormText );
496 
498  void InsertNewCell( const ScHTMLSize& rSpanSize );
499 
501  void ImplRowOn();
503  void ImplRowOff();
505  void ImplDataOn( const ScHTMLSize& rSpanSize );
507  void ImplDataOff();
508 
510  static void ProcessFormatOptions( SfxItemSet& rItemSet, const HtmlImportInfo& rInfo );
511 
514  void SetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellPos, SCCOLROW nSize );
520  void CalcNeededDocSize(
521  ScHTMLOrient eOrient, SCCOLROW nCellPos,
522  SCCOLROW nCellSpan, SCCOLROW nRealDocSize );
523 
524 private:
526  ScHTMLTableMapPtr mxNestedTables;
527  OUString maTableName;
528  OUString maCaption;
529  OUStringBuffer maCaptionBuffer;
532  std::optional<SfxItemSet> moRowItemSet;
533  std::optional<SfxItemSet> moDataItemSet;
538  std::vector<std::shared_ptr<ScEEParseEntry>>& mrEEParseList;
539  std::map< ScHTMLPos, ScHTMLEntryVector > maEntryMap;
540  ScHTMLEntryVector* mpCurrEntryVector;
541  ScHTMLEntryPtr mxCurrEntry;
542  ScSizeVec maCumSizes[ 2 ];
548  bool mbBorderOn:1;
549  bool mbPreFormText:1;
550  bool mbRowOn:1;
551  bool mbDataOn:1;
553  bool mbCaptionOn:1;
554 };
555 
558 {
559 public:
560  explicit ScHTMLGlobalTable(
561  SfxItemPool& rPool,
562  EditEngine& rEditEngine,
563  std::vector<std::shared_ptr<ScEEParseEntry>>& rEEParseList,
564  ScHTMLTableId& rnUnusedId, ScHTMLParser* pParser,
565  const ScDocument& rDoc );
566 
567  virtual ~ScHTMLGlobalTable() override;
568 
570  void Recalc();
571 };
572 
579 {
580 public:
581  explicit ScHTMLQueryParser( EditEngine* pEditEngine, ScDocument* pDoc );
582  virtual ~ScHTMLQueryParser() override;
583 
584  virtual ErrCode Read( SvStream& rStrm, const OUString& rBaseURL ) override;
585 
587  virtual const ScHTMLTable* GetGlobalTable() const override;
588 
589 private:
591  void ProcessToken( const HtmlImportInfo& rInfo );
593  void InsertText( const HtmlImportInfo& rInfo );
595  void FontOn( const HtmlImportInfo& rInfo );
596 
598  void MetaOn( const HtmlImportInfo& rInfo );
600  void TitleOn();
602  void TitleOff( const HtmlImportInfo& rInfo );
603 
605  void TableOn( const HtmlImportInfo& rInfo );
607  void TableOff( const HtmlImportInfo& rInfo );
609  void PreOn( const HtmlImportInfo& rInfo );
611  void PreOff( const HtmlImportInfo& rInfo );
612 
614  void CloseTable( const HtmlImportInfo& rInfo );
615 
616  void ParseStyle(std::u16string_view rStrm);
617 
618  DECL_LINK( HTMLImportHdl, HtmlImportInfo&, void );
619 
620 private:
621  typedef ::std::unique_ptr< ScHTMLGlobalTable > ScHTMLGlobalTablePtr;
622 
623  OUStringBuffer maTitle;
624  ScHTMLGlobalTablePtr mxGlobTable;
627  bool mbTitleOn;
628 };
629 
630 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DECL_LINK(HTMLImportHdl, HtmlImportInfo &, void)
OUString maCaption
Table name from.
Definition: htmlpars.hxx:528
std::unique_ptr< OuterMap > pTables
Definition: htmlpars.hxx:160
void RowOn(const HtmlImportInfo &rInfo)
Starts next row (tag).
Definition: htmlpars.cxx:2002
EditEngine & mrEditEngine
List of all used cells.
Definition: htmlpars.hxx:537
ScHTMLStyles()
just a persistent empty string.
Definition: htmlpars.cxx:73
std::vector< std::shared_ptr< ScEEParseEntry > > & mrEEParseList
Edit engine (from ScEEParser).
Definition: htmlpars.hxx:538
::std::unique_ptr< ScHTMLTableMap > ScHTMLTableMapPtr
Definition: htmlpars.hxx:451
SCCOL mnCols
Definition: htmlpars.hxx:262
ScHTMLTable * PreOn(const HtmlImportInfo &rInfo)
Starts a new table based on preformatted text (.
Definition: htmlpars.cxx:1991
void AnchorOn(HtmlImportInfo *)
Definition: htmlpars.cxx:1393
SfxItemSet maTableItemSet
Unique identifier of this table.
Definition: htmlpars.hxx:531
const sal_uInt16 SC_HTML_OFFSET_TOLERANCE_LARGE
Definition: htmlpars.hxx:38
static void EntryEnd(ScEEParseEntry *, const ESelection &)
Definition: htmlpars.cxx:317
void Set(const ScAddress &rAddr)
Definition: htmlpars.hxx:248
ScHTMLSize maSize
Cumulated cell counts for each HTML table column/row.
Definition: htmlpars.hxx:543
ScDocument * mpDoc
Definition: htmlpars.hxx:82
static void MakeCol(ScHTMLColOffset *, sal_uInt16 &nOffset, sal_uInt16 &nWidth, sal_uInt16 nOffsetTol, sal_uInt16 nWidthTol)
Definition: htmlpars.cxx:369
sal_uInt16 nColOffset
Definition: htmlpars.hxx:110
ScHTMLTableAutoId(ScHTMLTableId &rnUnusedId)
Reference to global unused identifier variable.
Definition: htmlpars.cxx:1804
ScHTMLGlobalTable(SfxItemPool &rPool, EditEngine &rEditEngine, std::vector< std::shared_ptr< ScEEParseEntry >> &rEEParseList, ScHTMLTableId &rnUnusedId, ScHTMLParser *pParser, const ScDocument &rDoc)
Definition: htmlpars.cxx:2747
static void ModifyOffset(ScHTMLColOffset *, sal_uInt16 &nOldOffset, sal_uInt16 &nNewOffset, sal_uInt16 nOffsetTol)
Definition: htmlpars.cxx:403
A map of ScHTMLTable objects.
Definition: htmlpars.cxx:1696
SfxItemSet aItemSet
Definition: eeparser.hxx:54
virtual ~ScHTMLParser() override
Definition: htmlpars.cxx:201
void Strip(const EditEngine &rEditEngine)
Deletes leading and trailing empty paragraphs from the entry.
Definition: htmlpars.cxx:1673
SCROW Row() const
Definition: address.hxx:274
bool mbBorderOn
Definition: htmlpars.hxx:548
ScHTMLStyles maStyles
Definition: htmlpars.hxx:79
A single entry containing a line of text or representing a table.
Definition: htmlpars.hxx:272
::std::map< OUString, NamePropsType > ElemsType
Definition: htmlpars.hxx:52
bool PushEntry(ScHTMLEntryPtr &rxEntry)
Tries to insert the entry into the current cell.
Definition: htmlpars.cxx:2320
const sal_uInt32 SC_HTML_FONTSIZES
Definition: htmlpars.hxx:34
ScHTMLEntry(const SfxItemSet &rItemSet, ScHTMLTableId nTableId=SC_HTML_NO_TABLE)
Definition: htmlpars.cxx:1637
ESelection aSel
Definition: eeparser.hxx:55
void Colonize(ScEEParseEntry *)
Definition: htmlpars.cxx:791
::std::map< SCROW, SCROW > InnerMap
Definition: htmlpars.hxx:145
bool IsEmptyCell() const
Returns true, if the current cell does not contain an entry yet.
Definition: htmlpars.cxx:2290
void InsertNewCell(const ScHTMLSize &rSpanSize)
Inserts a new cell in an unused position, starting from current cell position.
Definition: htmlpars.cxx:2399
::std::map< sal_uInt16, InnerMap * > OuterMap
Definition: htmlpars.hxx:149
OUString maTableName
Table of nested HTML tables.
Definition: htmlpars.hxx:527
ScRangeList maHMergedCells
Items for the current cell.
Definition: htmlpars.hxx:534
sal_uIntPtr sal_uLong
void CloseEntry(const HtmlImportInfo *)
Definition: htmlpars.cxx:819
DECL_LINK(HTMLImportHdl, HtmlImportInfo &, void)
void AdjustEnd(const HtmlImportInfo &rInfo)
Sets end point of the entry selection to the end of the import info object.
Definition: htmlpars.cxx:1663
bool IsAtBeginningOfText(const HtmlImportInfo *)
Definition: htmlpars.cxx:1403
ScHTMLTable * TableOn(const HtmlImportInfo &rInfo)
Starts a new table nested in this table (.
Definition: htmlpars.cxx:1966
ScHTMLTable * TableOff(const HtmlImportInfo &rInfo)
Closes this table (tag).
Definition: htmlpars.cxx:1972
NamePropsType m_GlobalProps
Definition: htmlpars.hxx:54
bool mbPreFormText
true = Table borders on.
Definition: htmlpars.hxx:549
virtual ~ScHTMLTable()
Definition: htmlpars.cxx:1883
ScSizeVec maCumSizes[2]
Working entry, not yet inserted in a list.
Definition: htmlpars.hxx:542
void InsertText(const HtmlImportInfo &rInfo)
Inserts a text portion into current entry.
Definition: htmlpars.cxx:2915
ScHTMLPos(SCCOL nCol, SCROW nRow)
Definition: htmlpars.hxx:240
void CloseTable(const HtmlImportInfo &rInfo)
Closes the current table, regardless on opening tag.
Definition: htmlpars.cxx:3021
ScHTMLTableAutoId maTableId
Caption buffer of the table from
Definition: htmlpars.hxx:530
SCCOLROW GetDocSize(ScHTMLOrient eOrient, SCCOLROW nCellPos) const
Returns the resulting document row/column count of the specified HTML row/column. ...
Definition: htmlpars.cxx:2187
void ProcToken(HtmlImportInfo *)
Definition: htmlpars.cxx:1466
SCROW mnRow
Definition: htmlpars.hxx:237
::std::map< OUString, PropsType > NamePropsType
Definition: htmlpars.hxx:51
virtual ~ScHTMLGlobalTable() override
Definition: htmlpars.cxx:2759
ScHTMLEntryPtr mxCurrEntry
Current entry vector from map for faster access.
Definition: htmlpars.hxx:541
ScHTMLTableId & mrnUnusedId
The created unique table identifier.
Definition: htmlpars.hxx:310
ScDocument & GetDoc()
Definition: htmlpars.hxx:91
ScHTMLParser * mpParser
Resulting base address in a Calc document.
Definition: htmlpars.hxx:546
void ParseStyle(std::u16string_view rStrm)
Definition: htmlpars.cxx:3122
void NextRow(const HtmlImportInfo *)
Definition: htmlpars.cxx:333
void BodyOff(const HtmlImportInfo &rInfo)
Closes the body of the HTML document ( tag).
Definition: htmlpars.cxx:2160
ScHTMLEntryVector * mpCurrEntryVector
List of entries for each cell.
Definition: htmlpars.hxx:540
const sal_uInt16 SC_HTML_OFFSET_TOLERANCE_SMALL
Definition: htmlpars.hxx:37
virtual ~ScHTMLQueryParser() override
Definition: htmlpars.cxx:2783
bool mbDataOn
true = Inside of .
Definition: htmlpars.hxx:551
ScHTMLQueryParser(EditEngine *pEditEngine, ScDocument *pDoc)
Definition: htmlpars.cxx:2773
void FillEmptyCells()
Fills all empty cells in this and nested tables with dummy parse entries.
Definition: htmlpars.cxx:2584
void TableRowOn(const HtmlImportInfo *)
Definition: htmlpars.cxx:994
const ScHTMLTableId SC_HTML_NO_TABLE
Used as table index for normal (non-table) entries in ScHTMLEntry structs.
Definition: htmlpars.hxx:231
sal_uInt16 nTableWidth
Definition: htmlpars.hxx:169
static void MakeColNoRef(ScHTMLColOffset *, sal_uInt16 nOffset, sal_uInt16 nWidth, sal_uInt16 nOffsetTol, sal_uInt16 nWidthTol)
Definition: htmlpars.cxx:387
void MetaOn(const HtmlImportInfo &rInfo)
Processes the tag.
Definition: htmlpars.cxx:2964
std::map< ScHTMLPos, ScHTMLEntryVector > maEntryMap
List that owns the parse entries (from ScEEParser).
Definition: htmlpars.hxx:539
virtual const ScHTMLTable * GetGlobalTable() const override
Returns the "global table" which contains the entire HTML document.
Definition: htmlpars.cxx:297
sal_uInt16 nTable
Definition: htmlpars.hxx:165
sal_uInt16 ScHTMLTableId
Type for a unique identifier for each table.
Definition: htmlpars.hxx:227
bool IsEmpty() const
Returns true, if the selection of the entry is empty.
Definition: htmlpars.hxx:280
void TableRowOff(const HtmlImportInfo *)
Definition: htmlpars.cxx:1001
ScRangeList maUsedCells
List of all vertically merged cells.
Definition: htmlpars.hxx:536
void RecalcDocSize()
Recalculates the size of all columns/rows in the table, regarding nested tables.
Definition: htmlpars.cxx:2620
virtual const ScHTMLTable * GetGlobalTable() const =0
Returns the "global table" which contains the entire HTML document.
sal_uInt16 nTab
Definition: eeparser.hxx:66
void CaptionOff()
Processes the caption of the table ( tag).
Definition: htmlpars.cxx:1983
ScHTMLLayoutParser(EditEngine *, const OUString &rBaseURL, const Size &aPageSize, ScDocument *)
Definition: htmlpars.cxx:205
sal_uLong nFirstTableCell
Definition: htmlpars.hxx:104
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
ScHTMLGlobalTablePtr mxGlobTable
The title of the document.
Definition: htmlpars.hxx:624
o3tl::sorted_vector< sal_uLong > ScHTMLColOffset
Definition: htmlpars.hxx:97
void Recalc()
Recalculates sizes and resulting positions of all document entries.
Definition: htmlpars.cxx:2763
const OUString & getPropertyValue(const OUString &rElem, const OUString &rClass, const OUString &rPropName) const
Find best-matching property value for given element and class names.
Definition: htmlpars.cxx:120
ScHTMLTable * CloseTable(const HtmlImportInfo &rInfo)
Closes this table (tag) or preformatted text ( tag).
Definition: htmlpars.cxx:2171
::std::vector< ScHTMLEntry * > ScHTMLEntryVector
Definition: htmlpars.hxx:453
bool operator<(const ScHTMLPos &rPos1, const ScHTMLPos &rPos2)
Definition: htmlpars.hxx:254
void RecalcDocPos(const ScHTMLPos &rBasePos)
Recalculates the position of all cell entries and nested tables.
Definition: htmlpars.cxx:2669
bool mbImportAlways
Definition: htmlpars.hxx:303
bool mbPushEmptyLine
true = Inside of or .
Definition: htmlpars.hxx:552
::std::stack< std::unique_ptr< ScHTMLTableStackEntry > > aTableStack
Definition: htmlpars.hxx:157
void SetImportAlways()
Sets or clears the import always state.
Definition: htmlpars.hxx:289
std::shared_ptr< ScEEParseEntry > xCellEntry
Definition: htmlpars.hxx:102
ScHTMLTable(ScHTMLTable &rParentTable, const HtmlImportInfo &rInfo, bool bPreFormText, const ScDocument &rDoc)
Creates a new HTML table without content.
Definition: htmlpars.cxx:1811
void HeadingOn()
Inserts a heading line (.
Definition: htmlpars.cxx:1946
void Image(HtmlImportInfo *)
Definition: htmlpars.cxx:1267
ScHTMLTableId GetTableId() const
Returns the unique identifier of the table.
Definition: htmlpars.hxx:346
sal_uInt16 nColOffset
Definition: htmlpars.hxx:170
void ImplRowOn()
Set internal states for a new table row.
Definition: htmlpars.cxx:2452
void ImplDataOff()
Set internal states for leaving a table cell.
Definition: htmlpars.cxx:2486
ScHTMLStyles & GetStyles()
Definition: htmlpars.hxx:90
void ImplPushEntryToVector(ScHTMLEntryVector &rEntryVector, ScHTMLEntryPtr &rxEntry)
Pushes the passed entry into the list of the current cell.
Definition: htmlpars.cxx:2312
ScHTMLEntryPtr CreateEntry() const
Creates and returns a new empty flying entry at position (0,0).
Definition: htmlpars.cxx:2300
void add(const char *pElemName, size_t nElemName, const char *pClassName, size_t nClassName, const OUString &aProp, const OUString &aValue)
Definition: htmlpars.cxx:75
sal_uInt16 nColOffsetStart
Definition: htmlpars.hxx:111
void RowOff(const HtmlImportInfo &rInfo)
Closes the current row (tag).
Definition: htmlpars.cxx:2013
virtual ~ScHTMLLayoutParser() override
Definition: htmlpars.cxx:232
void PushTableEntry(ScHTMLTableId nTableId)
Pushes a new entry into current cell which references a nested table.
Definition: htmlpars.cxx:2372
ScHTMLTable * GetExistingTable(ScHTMLTableId nTableId) const
Tries to find a table from the table container.
Definition: htmlpars.cxx:2382
sal_Int16 SCCOL
Definition: types.hxx:21
OUStringBuffer maTitle
Definition: htmlpars.hxx:623
ScHTMLPos maCurrCell
Size of the table.
Definition: htmlpars.hxx:544
bool mbRowOn
true = Table from preformatted text (
Definition: htmlpars.hxx:550
void DataOff(const HtmlImportInfo &rInfo)
Closes the current cell ( or tag).
Definition: htmlpars.cxx:2137
void PutItem(const SfxPoolItem &rItem)
Puts the item into the item set of the current entry.
Definition: htmlpars.cxx:1909
ScHTMLTableId mnUnusedId
Pointer to current table (performance).
Definition: htmlpars.hxx:626
sal_uInt16 GetWidthPixel(const HTMLOption &)
Definition: htmlpars.cxx:1373
void ProcessToken(const HtmlImportInfo &rInfo)
Handles all possible tags in the HTML document.
Definition: htmlpars.cxx:2830
sal_uInt16 nOffsetTolerance
Definition: htmlpars.hxx:172
virtual ErrCode Read(SvStream &rStrm, const OUString &rBaseURL) override=0
ScHTMLColOffset * pLocalColOffset
Definition: htmlpars.hxx:162
ScHTMLTable * mpParentTable
Definition: htmlpars.hxx:525
static bool IsSpaceCharInfo(const HtmlImportInfo &rInfo)
Returns true, if import info represents a space character.
Definition: htmlpars.cxx:2295
The HTML parser for data queries.
Definition: htmlpars.hxx:578
Collection of HTML style data parsed from the content of