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 <stack>
25 #include <string_view>
26 #include <unordered_map>
27 #include <vector>
28 #include <o3tl/sorted_vector.hxx>
29 
30 #include <rangelst.hxx>
31 #include "eeparser.hxx"
32 
33 const sal_uInt32 SC_HTML_FONTSIZES = 7; // like export, HTML options
34 
35 // Pixel tolerance for SeekOffset and related.
36 const sal_uInt16 SC_HTML_OFFSET_TOLERANCE_SMALL = 1; // single table
37 const sal_uInt16 SC_HTML_OFFSET_TOLERANCE_LARGE = 10; // nested
38 
39 // BASE class for HTML parser classes
40 
41 class ScHTMLTable;
42 
48 {
49  typedef std::unordered_map<OUString, OUString> PropsType;
50  typedef ::std::map<OUString, std::unique_ptr<PropsType>> NamePropsType;
51  typedef ::std::map<OUString, std::unique_ptr<NamePropsType>> ElemsType;
52 
53  NamePropsType m_GlobalProps;
54  NamePropsType m_ElemGlobalProps;
55  ElemsType m_ElemProps;
56  const OUString maEmpty;
57 public:
58  ScHTMLStyles();
59 
60  void add(const char* pElemName, size_t nElemName, const char* pClassName, size_t nClassName,
61  const OUString& aProp, const OUString& aValue);
62 
66  const OUString& getPropertyValue(
67  const OUString& rElem, const OUString& rClass, const OUString& rPropName) const;
68 
69 private:
70  static void insertProp(
71  NamePropsType& rProps, const OUString& aName,
72  const OUString& aProp, const OUString& aValue);
73 };
74 
76 class ScHTMLParser : public ScEEParser
77 {
79 protected:
82 
83 public:
84  explicit ScHTMLParser( EditEngine* pEditEngine, ScDocument* pDoc );
85  virtual ~ScHTMLParser() override;
86 
87  virtual ErrCode Read( SvStream& rStrm, const OUString& rBaseURL ) override = 0;
88 
90  ScDocument& GetDoc() { return *mpDoc;}
91 
93  virtual const ScHTMLTable* GetGlobalTable() const = 0;
94 };
95 
97 
99 {
101  std::shared_ptr<ScEEParseEntry> xCellEntry;
107  sal_uInt16 nTable;
108  sal_uInt16 nTableWidth;
109  sal_uInt16 nColOffset;
110  sal_uInt16 nColOffsetStart;
111  bool bFirstRow;
112  ScHTMLTableStackEntry( const std::shared_ptr<ScEEParseEntry>& rE,
113  const ScRangeListRef& rL, ScHTMLColOffset* pTO,
114  sal_uLong nFTC,
115  SCROW nRow,
116  SCCOL nStart, SCCOL nMax, sal_uInt16 nTab,
117  sal_uInt16 nTW, sal_uInt16 nCO, sal_uInt16 nCOS,
118  bool bFR )
119  : xLockedList( rL ), xCellEntry(rE),
120  pLocalColOffset( pTO ),
121  nFirstTableCell( nFTC ),
122  nRowCnt( nRow ),
123  nColCntStart( nStart ), nMaxCol( nMax ),
124  nTable( nTab ), nTableWidth( nTW ),
125  nColOffset( nCO ), nColOffsetStart( nCOS ),
126  bFirstRow( bFR )
127  {}
128 };
129 
131 {
136  SCROW nCRow )
137  : nLastCol( nLCol ), nNextRow( nNRow ),
138  nCurRow( nCRow )
139  {}
140 };
141 
142 class EditEngine;
143 class ScDocument;
145 
146 // TODO these need better names
147 typedef ::std::map<SCROW, SCROW> InnerMap;
148 typedef ::std::map<sal_uInt16, InnerMap*> OuterMap;
149 
151 {
152 private:
154  OUString aBaseURL;
155  ::std::stack< std::unique_ptr<ScHTMLTableStackEntry> >
157  OUString aString;
159  std::unique_ptr<OuterMap> pTables;
163  short nTableLevel;
164  sal_uInt16 nTable;
165  sal_uInt16 nMaxTable;
166  SCCOL nColCntStart; // first Col per table
167  SCCOL nMaxCol; // per table
168  sal_uInt16 nTableWidth; // per table
169  sal_uInt16 nColOffset; // current, pixel
170  sal_uInt16 nColOffsetStart; // start value per table, in pixel
171  sal_uInt16 nOffsetTolerance; // for use with SeekOffset and related
172  bool bFirstRow; // per table, whether in first row
174  bool bInCell:1;
175  bool bInTitle:1;
176 
177  DECL_LINK( HTMLImportHdl, HtmlImportInfo&, void );
178  void NewActEntry( const ScEEParseEntry* );
179  static void EntryEnd( ScEEParseEntry*, const ESelection& );
180  void ProcToken( HtmlImportInfo* );
181  void CloseEntry( const HtmlImportInfo* );
182  void NextRow( const HtmlImportInfo* );
183  void SkipLocked( ScEEParseEntry*, bool bJoin = true );
184  static bool SeekOffset( const ScHTMLColOffset*, sal_uInt16 nOffset,
185  SCCOL* pCol, sal_uInt16 nOffsetTol );
186  static void MakeCol( ScHTMLColOffset*, sal_uInt16& nOffset,
187  sal_uInt16& nWidth, sal_uInt16 nOffsetTol,
188  sal_uInt16 nWidthTol );
189  static void MakeColNoRef( ScHTMLColOffset*, sal_uInt16 nOffset,
190  sal_uInt16 nWidth, sal_uInt16 nOffsetTol,
191  sal_uInt16 nWidthTol );
192  static void ModifyOffset( ScHTMLColOffset*, sal_uInt16& nOldOffset,
193  sal_uInt16& nNewOffset, sal_uInt16 nOffsetTol );
194  void Colonize( ScEEParseEntry* );
195  sal_uInt16 GetWidth( const ScEEParseEntry* );
196  void SetWidths();
197  void Adjust();
198 
199  sal_uInt16 GetWidthPixel( const HTMLOption& );
200  bool IsAtBeginningOfText( const HtmlImportInfo* );
201 
202  void TableOn( HtmlImportInfo* );
203  void ColOn( HtmlImportInfo* );
204  void TableRowOn( const HtmlImportInfo* );
205  void TableRowOff( const HtmlImportInfo* );
206  void TableDataOn( HtmlImportInfo* );
207  void TableDataOff( const HtmlImportInfo* );
208  void TableOff( const HtmlImportInfo* );
209  void Image( HtmlImportInfo* );
210  void AnchorOn( HtmlImportInfo* );
211  void FontOn( HtmlImportInfo* );
212 
213 public:
214  ScHTMLLayoutParser( EditEngine*, const OUString& rBaseURL, const Size& aPageSize, ScDocument* );
215  virtual ~ScHTMLLayoutParser() override;
216  virtual ErrCode Read( SvStream&, const OUString& rBaseURL ) override;
217  virtual const ScHTMLTable* GetGlobalTable() const override;
218 };
219 
220 // HTML DATA QUERY PARSER
221 
223 enum ScHTMLOrient { tdCol = 0 , tdRow = 1 };
224 
226 typedef sal_uInt16 ScHTMLTableId;
231 
233 struct ScHTMLPos
234 {
237 
238  explicit ScHTMLPos() : mnCol( 0 ), mnRow( 0 ) {}
239  explicit ScHTMLPos( SCCOL nCol, SCROW nRow ) :
240  mnCol( nCol ), mnRow( nRow ) {}
241  explicit ScHTMLPos( const ScAddress& rAddr ) { Set( rAddr ); }
242 
243  SCCOLROW Get( ScHTMLOrient eOrient ) const
244  { return (eOrient == tdCol) ? mnCol : mnRow; }
245  void Set( SCCOL nCol, SCROW nRow )
246  { mnCol = nCol; mnRow = nRow; }
247  void Set( const ScAddress& rAddr )
248  { Set( rAddr.Col(), rAddr.Row() ); }
250  { return ScAddress( mnCol, mnRow, 0 ); }
251 };
252 
253 inline bool operator<( const ScHTMLPos& rPos1, const ScHTMLPos& rPos2 )
254 {
255  return (rPos1.mnRow < rPos2.mnRow) || ((rPos1.mnRow == rPos2.mnRow) && (rPos1.mnCol < rPos2.mnCol));
256 }
257 
260 {
263 
264  explicit ScHTMLSize( SCCOL nCols, SCROW nRows ) :
265  mnCols( nCols ), mnRows( nRows ) {}
266  void Set( SCCOL nCols, SCROW nRows )
267  { mnCols = nCols; mnRows = nRows; }
268 };
269 
272 {
273 public:
274  explicit ScHTMLEntry(
275  const SfxItemSet& rItemSet,
276  ScHTMLTableId nTableId = SC_HTML_NO_TABLE );
277 
279  bool IsEmpty() const { return !aSel.HasRange(); }
281  bool HasContents() const;
283  bool IsTable() const { return nTab != SC_HTML_NO_TABLE; }
285  ScHTMLTableId GetTableId() const { return nTab; }
286 
288  void SetImportAlways() { mbImportAlways = true; }
290  void AdjustStart( const HtmlImportInfo& rInfo );
292  void AdjustEnd( const HtmlImportInfo& rInfo );
294  void Strip( const EditEngine& rEditEngine );
295 
299  const SfxItemSet& GetItemSet() const { return aItemSet; }
300 
301 private:
303 };
304 
307 {
310 
312  explicit ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId );
313 };
314 
315 class ScHTMLTableMap;
316 
325 {
326 public:
332  explicit ScHTMLTable(
333  ScHTMLTable& rParentTable,
334  const HtmlImportInfo& rInfo,
335  bool bPreFormText );
336 
337  virtual ~ScHTMLTable();
338 
340  const OUString& GetTableName() const { return maTableName; }
342  const OUString& GetTableCaption() const { return maCaption; }
346  ScHTMLSize GetSpan( const ScHTMLPos& rCellPos ) const;
347 
350  ScHTMLTable* FindNestedTable( ScHTMLTableId nTableId ) const;
351 
353  void PutItem( const SfxPoolItem& rItem );
355  void PutText( const HtmlImportInfo& rInfo );
357  void InsertPara( const HtmlImportInfo& rInfo );
358 
361  void BreakOn();
363  void HeadingOn();
365  void AnchorOn();
366 
369  ScHTMLTable* TableOn( const HtmlImportInfo& rInfo );
372  ScHTMLTable* TableOff( const HtmlImportInfo& rInfo );
374  void CaptionOn();
376  void CaptionOff();
379  ScHTMLTable* PreOn( const HtmlImportInfo& rInfo );
382  ScHTMLTable* PreOff( const HtmlImportInfo& rInfo );
383 
386  void RowOn( const HtmlImportInfo& rInfo );
389  void RowOff( const HtmlImportInfo& rInfo );
391  void DataOn( const HtmlImportInfo& rInfo );
394  void DataOff( const HtmlImportInfo& rInfo );
395 
397  void BodyOn( const HtmlImportInfo& rInfo );
399  void BodyOff( const HtmlImportInfo& rInfo );
400 
404  ScHTMLTable* CloseTable( const HtmlImportInfo& rInfo );
405 
407  SCCOLROW GetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellPos ) const;
409  SCCOLROW GetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellBegin, SCCOLROW nCellEnd ) const;
411  SCCOLROW GetDocSize( ScHTMLOrient eOrient ) const;
413  ScHTMLSize GetDocSize( const ScHTMLPos& rCellPos ) const;
414 
416  const ScHTMLPos& GetDocPos() const { return maDocBasePos; }
418  SCCOLROW GetDocPos( ScHTMLOrient eOrient, SCCOLROW nCellPos ) const;
420  ScHTMLPos GetDocPos( const ScHTMLPos& rCellPos ) const;
421 
423  void GetDocRange( ScRange& rRange ) const;
424 
426  void ApplyCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos ) const;
427 
429 
430 protected:
433  explicit ScHTMLTable(
434  SfxItemPool& rPool,
435  EditEngine& rEditEngine,
436  std::vector<std::shared_ptr<ScEEParseEntry>>& rEEParseList,
437  ScHTMLTableId& rnUnusedId, ScHTMLParser* pParser );
438 
440  void FillEmptyCells();
442  void RecalcDocSize();
445  void RecalcDocPos( const ScHTMLPos& rBasePos );
446 
447 private:
448  typedef ::std::unique_ptr< ScHTMLTableMap > ScHTMLTableMapPtr;
449  typedef ::std::unique_ptr< SfxItemSet > SfxItemSetPtr;
450  typedef ::std::vector< SCCOLROW > ScSizeVec;
451  typedef ::std::vector< ScHTMLEntry* > ScHTMLEntryVector;
452  typedef ::std::unique_ptr< ScHTMLEntry > ScHTMLEntryPtr;
453 
455  bool IsEmptyCell() const;
457  const SfxItemSet& GetCurrItemSet() const;
458 
460  static bool IsSpaceCharInfo( const HtmlImportInfo& rInfo );
461 
463  ScHTMLEntryPtr CreateEntry() const;
466  void CreateNewEntry( const HtmlImportInfo& rInfo );
467 
469  void InsertLeadingEmptyLine();
470 
472  void ImplPushEntryToVector( ScHTMLEntryVector& rEntryVector, ScHTMLEntryPtr& rxEntry );
477  bool PushEntry( ScHTMLEntryPtr& rxEntry );
482  bool PushEntry( const HtmlImportInfo& rInfo, bool bLastInCell = false );
484  void PushTableEntry( ScHTMLTableId nTableId );
485 
490  ScHTMLTable* GetExistingTable( ScHTMLTableId nTableId ) const;
493  ScHTMLTable* InsertNestedTable( const HtmlImportInfo& rInfo, bool bPreFormText );
494 
496  void InsertNewCell( const ScHTMLSize& rSpanSize );
497 
499  void ImplRowOn();
501  void ImplRowOff();
503  void ImplDataOn( const ScHTMLSize& rSpanSize );
505  void ImplDataOff();
506 
508  static void ProcessFormatOptions( SfxItemSet& rItemSet, const HtmlImportInfo& rInfo );
509 
512  void SetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellPos, SCCOLROW nSize );
518  void CalcNeededDocSize(
519  ScHTMLOrient eOrient, SCCOLROW nCellPos,
520  SCCOLROW nCellSpan, SCCOLROW nRealDocSize );
521 
522 private:
524  ScHTMLTableMapPtr mxNestedTables;
525  OUString maTableName;
526  OUString maCaption;
527  OUStringBuffer maCaptionBuffer;
530  SfxItemSetPtr mxRowItemSet;
531  SfxItemSetPtr mxDataItemSet;
536  std::vector<std::shared_ptr<ScEEParseEntry>>& mrEEParseList;
537  std::map< ScHTMLPos, ScHTMLEntryVector > maEntryMap;
538  ScHTMLEntryVector* mpCurrEntryVector;
539  ScHTMLEntryPtr mxCurrEntry;
540  ScSizeVec maCumSizes[ 2 ];
545  bool mbBorderOn:1;
546  bool mbPreFormText:1;
547  bool mbRowOn:1;
548  bool mbDataOn:1;
550  bool mbCaptionOn:1;
551 };
552 
555 {
556 public:
557  explicit ScHTMLGlobalTable(
558  SfxItemPool& rPool,
559  EditEngine& rEditEngine,
560  std::vector<std::shared_ptr<ScEEParseEntry>>& rEEParseList,
561  ScHTMLTableId& rnUnusedId, ScHTMLParser* pParser );
562 
563  virtual ~ScHTMLGlobalTable() override;
564 
566  void Recalc();
567 };
568 
575 {
576 public:
577  explicit ScHTMLQueryParser( EditEngine* pEditEngine, ScDocument* pDoc );
578  virtual ~ScHTMLQueryParser() override;
579 
580  virtual ErrCode Read( SvStream& rStrm, const OUString& rBaseURL ) override;
581 
583  virtual const ScHTMLTable* GetGlobalTable() const override;
584 
585 private:
587  void ProcessToken( const HtmlImportInfo& rInfo );
589  void InsertText( const HtmlImportInfo& rInfo );
591  void FontOn( const HtmlImportInfo& rInfo );
592 
594  void MetaOn( const HtmlImportInfo& rInfo );
596  void TitleOn();
598  void TitleOff( const HtmlImportInfo& rInfo );
599 
601  void TableOn( const HtmlImportInfo& rInfo );
603  void TableOff( const HtmlImportInfo& rInfo );
605  void PreOn( const HtmlImportInfo& rInfo );
607  void PreOff( const HtmlImportInfo& rInfo );
608 
610  void CloseTable( const HtmlImportInfo& rInfo );
611 
612  static void ParseStyle(std::u16string_view rStrm);
613 
614  DECL_LINK( HTMLImportHdl, HtmlImportInfo&, void );
615 
616 private:
617  typedef ::std::unique_ptr< ScHTMLGlobalTable > ScHTMLGlobalTablePtr;
618 
619  OUStringBuffer maTitle;
620  ScHTMLGlobalTablePtr mxGlobTable;
623  bool mbTitleOn;
624 };
625 
626 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DECL_LINK(HTMLImportHdl, HtmlImportInfo &, void)
OUString maCaption
Table name from.
Definition: htmlpars.hxx:526
std::unique_ptr< OuterMap > pTables
Definition: htmlpars.hxx:159
void RowOn(const HtmlImportInfo &rInfo)
Starts next row (tag).
Definition: htmlpars.cxx:1983
EditEngine & mrEditEngine
List of all used cells.
Definition: htmlpars.hxx:535
ScHTMLStyles()
just a persistent empty string.
Definition: htmlpars.cxx:70
std::vector< std::shared_ptr< ScEEParseEntry > > & mrEEParseList
Edit engine (from ScEEParser).
Definition: htmlpars.hxx:536
::std::unique_ptr< ScHTMLTableMap > ScHTMLTableMapPtr
Definition: htmlpars.hxx:448
SCCOL mnCols
Definition: htmlpars.hxx:261
ScHTMLTable * PreOn(const HtmlImportInfo &rInfo)
Starts a new table based on preformatted text (.
Definition: htmlpars.cxx:1972
void AnchorOn(HtmlImportInfo *)
Definition: htmlpars.cxx:1376
SfxItemSet maTableItemSet
Unique identifier of this table.
Definition: htmlpars.hxx:529
const sal_uInt16 SC_HTML_OFFSET_TOLERANCE_LARGE
Definition: htmlpars.hxx:37
static void EntryEnd(ScEEParseEntry *, const ESelection &)
Definition: htmlpars.cxx:310
void Set(const ScAddress &rAddr)
Definition: htmlpars.hxx:247
ScHTMLSize maSize
Cumulated cell counts for each HTML table column/row.
Definition: htmlpars.hxx:541
ScDocument * mpDoc
Definition: htmlpars.hxx:81
static void MakeCol(ScHTMLColOffset *, sal_uInt16 &nOffset, sal_uInt16 &nWidth, sal_uInt16 nOffsetTol, sal_uInt16 nWidthTol)
Definition: htmlpars.cxx:362
sal_uInt16 nColOffset
Definition: htmlpars.hxx:109
ScHTMLTableAutoId(ScHTMLTableId &rnUnusedId)
Reference to global unused identifier variable.
Definition: htmlpars.cxx:1787
static void ModifyOffset(ScHTMLColOffset *, sal_uInt16 &nOldOffset, sal_uInt16 &nNewOffset, sal_uInt16 nOffsetTol)
Definition: htmlpars.cxx:396
A map of ScHTMLTable objects.
Definition: htmlpars.cxx:1679
SfxItemSet aItemSet
Definition: eeparser.hxx:54
virtual ~ScHTMLParser() override
Definition: htmlpars.cxx:194
void Strip(const EditEngine &rEditEngine)
Deletes leading and trailing empty paragraphs from the entry.
Definition: htmlpars.cxx:1656
SCROW Row() const
Definition: address.hxx:261
bool mbBorderOn
Definition: htmlpars.hxx:545
ScHTMLStyles maStyles
Definition: htmlpars.hxx:78
A single entry containing a line of text or representing a table.
Definition: htmlpars.hxx:271
bool PushEntry(ScHTMLEntryPtr &rxEntry)
Tries to insert the entry into the current cell.
Definition: htmlpars.cxx:2301
const sal_uInt32 SC_HTML_FONTSIZES
Definition: htmlpars.hxx:33
ScHTMLEntry(const SfxItemSet &rItemSet, ScHTMLTableId nTableId=SC_HTML_NO_TABLE)
Definition: htmlpars.cxx:1620
ESelection aSel
Definition: eeparser.hxx:55
void Colonize(ScEEParseEntry *)
Definition: htmlpars.cxx:774
::std::map< SCROW, SCROW > InnerMap
Definition: htmlpars.hxx:144
bool IsEmptyCell() const
Returns true, if the current cell does not contain an entry yet.
Definition: htmlpars.cxx:2271
void InsertNewCell(const ScHTMLSize &rSpanSize)
Inserts a new cell in an unused position, starting from current cell position.
Definition: htmlpars.cxx:2380
::std::map< sal_uInt16, InnerMap * > OuterMap
Definition: htmlpars.hxx:148
OUString maTableName
Table of nested HTML tables.
Definition: htmlpars.hxx:525
ScRangeList maHMergedCells
Items for the current cell.
Definition: htmlpars.hxx:532
sal_uIntPtr sal_uLong
void CloseEntry(const HtmlImportInfo *)
Definition: htmlpars.cxx:802
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:1646
bool IsAtBeginningOfText(const HtmlImportInfo *)
Definition: htmlpars.cxx:1386
ScHTMLTable * TableOn(const HtmlImportInfo &rInfo)
Starts a new table nested in this table (.
Definition: htmlpars.cxx:1947
ScHTMLTable * TableOff(const HtmlImportInfo &rInfo)
Closes this table (tag).
Definition: htmlpars.cxx:1953
NamePropsType m_GlobalProps
Definition: htmlpars.hxx:53
bool mbPreFormText
true = Table borders on.
Definition: htmlpars.hxx:546
virtual ~ScHTMLTable()
Definition: htmlpars.cxx:1864
ScSizeVec maCumSizes[2]
Working entry, not yet inserted in a list.
Definition: htmlpars.hxx:540
void InsertText(const HtmlImportInfo &rInfo)
Inserts a text portion into current entry.
Definition: htmlpars.cxx:2895
ScHTMLPos(SCCOL nCol, SCROW nRow)
Definition: htmlpars.hxx:239
void CloseTable(const HtmlImportInfo &rInfo)
Closes the current table, regardless on opening tag.
Definition: htmlpars.cxx:3001
ScHTMLTableAutoId maTableId
Caption buffer of the table from
Definition: htmlpars.hxx:528
SCCOLROW GetDocSize(ScHTMLOrient eOrient, SCCOLROW nCellPos) const
Returns the resulting document row/column count of the specified HTML row/column. ...
Definition: htmlpars.cxx:2168
void ProcToken(HtmlImportInfo *)
Definition: htmlpars.cxx:1449
SCROW mnRow
Definition: htmlpars.hxx:236
virtual ~ScHTMLGlobalTable() override
Definition: htmlpars.cxx:2739
ScHTMLEntryPtr mxCurrEntry
Current entry vector from map for faster access.
Definition: htmlpars.hxx:539
ScHTMLTableId & mrnUnusedId
The created unique table identifier.
Definition: htmlpars.hxx:309
ScDocument & GetDoc()
Definition: htmlpars.hxx:90
ScHTMLParser * mpParser
Resulting base address in a Calc document.
Definition: htmlpars.hxx:544
static void ParseStyle(std::u16string_view rStrm)
Definition: htmlpars.cxx:3091
void NextRow(const HtmlImportInfo *)
Definition: htmlpars.cxx:326
void BodyOff(const HtmlImportInfo &rInfo)
Closes the body of the HTML document ( tag).
Definition: htmlpars.cxx:2141
ScHTMLEntryVector * mpCurrEntryVector
List of entries for each cell.
Definition: htmlpars.hxx:538
const sal_uInt16 SC_HTML_OFFSET_TOLERANCE_SMALL
Definition: htmlpars.hxx:36
virtual ~ScHTMLQueryParser() override
Definition: htmlpars.cxx:2763
bool mbDataOn
true = Inside of .
Definition: htmlpars.hxx:548
ScHTMLQueryParser(EditEngine *pEditEngine, ScDocument *pDoc)
Definition: htmlpars.cxx:2753
void FillEmptyCells()
Fills all empty cells in this and nested tables with dummy parse entries.
Definition: htmlpars.cxx:2565
void TableRowOn(const HtmlImportInfo *)
Definition: htmlpars.cxx:977
const ScHTMLTableId SC_HTML_NO_TABLE
Used as table index for normal (non-table) entries in ScHTMLEntry structs.
Definition: htmlpars.hxx:230
sal_uInt16 nTableWidth
Definition: htmlpars.hxx:168
static void MakeColNoRef(ScHTMLColOffset *, sal_uInt16 nOffset, sal_uInt16 nWidth, sal_uInt16 nOffsetTol, sal_uInt16 nWidthTol)
Definition: htmlpars.cxx:380
void MetaOn(const HtmlImportInfo &rInfo)
Processes the tag.
Definition: htmlpars.cxx:2944
std::map< ScHTMLPos, ScHTMLEntryVector > maEntryMap
List that owns the parse entries (from ScEEParser).
Definition: htmlpars.hxx:537
virtual const ScHTMLTable * GetGlobalTable() const override
Returns the "global table" which contains the entire HTML document.
Definition: htmlpars.cxx:290
sal_uInt16 nTable
Definition: htmlpars.hxx:164
sal_uInt16 ScHTMLTableId
Type for a unique identifier for each table.
Definition: htmlpars.hxx:226
bool IsEmpty() const
Returns true, if the selection of the entry is empty.
Definition: htmlpars.hxx:279
void TableRowOff(const HtmlImportInfo *)
Definition: htmlpars.cxx:984
ScRangeList maUsedCells
List of all vertically merged cells.
Definition: htmlpars.hxx:534
void RecalcDocSize()
Recalculates the size of all columns/rows in the table, regarding nested tables.
Definition: htmlpars.cxx:2601
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:1964
ScHTMLLayoutParser(EditEngine *, const OUString &rBaseURL, const Size &aPageSize, ScDocument *)
Definition: htmlpars.cxx:198
sal_uLong nFirstTableCell
Definition: htmlpars.hxx:103
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:620
o3tl::sorted_vector< sal_uLong > ScHTMLColOffset
Definition: htmlpars.hxx:96
void Recalc()
Recalculates sizes and resulting positions of all document entries.
Definition: htmlpars.cxx:2743
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:117
ScHTMLTable * CloseTable(const HtmlImportInfo &rInfo)
Closes this table (tag) or preformatted text ( tag).
Definition: htmlpars.cxx:2152
::std::vector< ScHTMLEntry * > ScHTMLEntryVector
Definition: htmlpars.hxx:451
ScHTMLTable(ScHTMLTable &rParentTable, const HtmlImportInfo &rInfo, bool bPreFormText)
Creates a new HTML table without content.
Definition: htmlpars.cxx:1794
bool operator<(const ScHTMLPos &rPos1, const ScHTMLPos &rPos2)
Definition: htmlpars.hxx:253
void RecalcDocPos(const ScHTMLPos &rBasePos)
Recalculates the position of all cell entries and nested tables.
Definition: htmlpars.cxx:2650
bool mbImportAlways
Definition: htmlpars.hxx:302
bool mbPushEmptyLine
true = Inside of or .
Definition: htmlpars.hxx:549
::std::stack< std::unique_ptr< ScHTMLTableStackEntry > > aTableStack
Definition: htmlpars.hxx:156
void SetImportAlways()
Sets or clears the import always state.
Definition: htmlpars.hxx:288
std::shared_ptr< ScEEParseEntry > xCellEntry
Definition: htmlpars.hxx:101
::std::map< OUString, std::unique_ptr< PropsType > > NamePropsType
Definition: htmlpars.hxx:50
void HeadingOn()
Inserts a heading line (.
Definition: htmlpars.cxx:1927
void Image(HtmlImportInfo *)
Definition: htmlpars.cxx:1250
ScHTMLTableId GetTableId() const
Returns the unique identifier of the table.
Definition: htmlpars.hxx:344
sal_uInt16 nColOffset
Definition: htmlpars.hxx:169
void ImplRowOn()
Set internal states for a new table row.
Definition: htmlpars.cxx:2433
void ImplDataOff()
Set internal states for leaving a table cell.
Definition: htmlpars.cxx:2467
ScHTMLStyles & GetStyles()
Definition: htmlpars.hxx:89
::std::map< OUString, std::unique_ptr< NamePropsType > > ElemsType
Definition: htmlpars.hxx:51
void ImplPushEntryToVector(ScHTMLEntryVector &rEntryVector, ScHTMLEntryPtr &rxEntry)
Pushes the passed entry into the list of the current cell.
Definition: htmlpars.cxx:2293
ScHTMLEntryPtr CreateEntry() const
Creates and returns a new empty flying entry at position (0,0).
Definition: htmlpars.cxx:2281
void add(const char *pElemName, size_t nElemName, const char *pClassName, size_t nClassName, const OUString &aProp, const OUString &aValue)
Definition: htmlpars.cxx:72
sal_uInt16 nColOffsetStart
Definition: htmlpars.hxx:110
void RowOff(const HtmlImportInfo &rInfo)
Closes the current row (tag).
Definition: htmlpars.cxx:1994
virtual ~ScHTMLLayoutParser() override
Definition: htmlpars.cxx:225
void PushTableEntry(ScHTMLTableId nTableId)
Pushes a new entry into current cell which references a nested table.
Definition: htmlpars.cxx:2353
SfxItemSetPtr mxRowItemSet
Items for the entire table.
Definition: htmlpars.hxx:530
ScHTMLTable * GetExistingTable(ScHTMLTableId nTableId) const
Tries to find a table from the table container.
Definition: htmlpars.cxx:2363
sal_Int16 SCCOL
Definition: types.hxx:21
OUStringBuffer maTitle
Definition: htmlpars.hxx:619
ScHTMLPos maCurrCell
Size of the table.
Definition: htmlpars.hxx:542
bool mbRowOn
true = Table from preformatted text (
Definition: htmlpars.hxx:547
void DataOff(const HtmlImportInfo &rInfo)
Closes the current cell ( or tag).
Definition: htmlpars.cxx:2118
void PutItem(const SfxPoolItem &rItem)
Puts the item into the item set of the current entry.
Definition: htmlpars.cxx:1890
ScHTMLTableId mnUnusedId
Pointer to current table (performance).
Definition: htmlpars.hxx:622
sal_uInt16 GetWidthPixel(const HTMLOption &)
Definition: htmlpars.cxx:1356
void ProcessToken(const HtmlImportInfo &rInfo)
Handles all possible tags in the HTML document.
Definition: htmlpars.cxx:2810
sal_uInt16 nOffsetTolerance
Definition: htmlpars.hxx:171
virtual ErrCode Read(SvStream &rStrm, const OUString &rBaseURL) override=0
ScHTMLColOffset * pLocalColOffset
Definition: htmlpars.hxx:161
ScHTMLTable * mpParentTable
Definition: htmlpars.hxx:523
static bool IsSpaceCharInfo(const HtmlImportInfo &rInfo)
Returns true, if import info represents a space character.
Definition: htmlpars.cxx:2276
The HTML parser for data queries.
Definition: htmlpars.hxx:574
Collection of HTML style data parsed from the content of