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 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_HTMLPARS_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_HTMLPARS_HXX
22 
23 #include <memory>
24 #include <map>
25 #include <stack>
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; }
344  ScHTMLSize GetSpan( const ScHTMLPos& rCellPos ) const;
345 
348  ScHTMLTable* FindNestedTable( ScHTMLTableId nTableId ) const;
349 
351  void PutItem( const SfxPoolItem& rItem );
353  void PutText( const HtmlImportInfo& rInfo );
355  void InsertPara( const HtmlImportInfo& rInfo );
356 
359  void BreakOn();
361  void HeadingOn();
363  void AnchorOn();
364 
367  ScHTMLTable* TableOn( const HtmlImportInfo& rInfo );
370  ScHTMLTable* TableOff( const HtmlImportInfo& rInfo );
373  ScHTMLTable* PreOn( const HtmlImportInfo& rInfo );
376  ScHTMLTable* PreOff( const HtmlImportInfo& rInfo );
377 
380  void RowOn( const HtmlImportInfo& rInfo );
383  void RowOff( const HtmlImportInfo& rInfo );
385  void DataOn( const HtmlImportInfo& rInfo );
388  void DataOff( const HtmlImportInfo& rInfo );
389 
391  void BodyOn( const HtmlImportInfo& rInfo );
393  void BodyOff( const HtmlImportInfo& rInfo );
394 
398  ScHTMLTable* CloseTable( const HtmlImportInfo& rInfo );
399 
401  SCCOLROW GetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellPos ) const;
403  SCCOLROW GetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellBegin, SCCOLROW nCellEnd ) const;
405  SCCOLROW GetDocSize( ScHTMLOrient eOrient ) const;
407  ScHTMLSize GetDocSize( const ScHTMLPos& rCellPos ) const;
408 
410  const ScHTMLPos& GetDocPos() const { return maDocBasePos; }
412  SCCOLROW GetDocPos( ScHTMLOrient eOrient, SCCOLROW nCellPos ) const;
414  ScHTMLPos GetDocPos( const ScHTMLPos& rCellPos ) const;
415 
417  void GetDocRange( ScRange& rRange ) const;
418 
420  void ApplyCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos ) const;
421 
423 
424 protected:
427  explicit ScHTMLTable(
428  SfxItemPool& rPool,
429  EditEngine& rEditEngine,
430  std::vector<std::shared_ptr<ScEEParseEntry>>& rEEParseList,
431  ScHTMLTableId& rnUnusedId, ScHTMLParser* pParser );
432 
434  void FillEmptyCells();
436  void RecalcDocSize();
439  void RecalcDocPos( const ScHTMLPos& rBasePos );
440 
441 private:
442  typedef ::std::unique_ptr< ScHTMLTableMap > ScHTMLTableMapPtr;
443  typedef ::std::unique_ptr< SfxItemSet > SfxItemSetPtr;
444  typedef ::std::vector< SCCOLROW > ScSizeVec;
445  typedef ::std::vector< ScHTMLEntry* > ScHTMLEntryVector;
446  typedef ::std::unique_ptr< ScHTMLEntry > ScHTMLEntryPtr;
447 
449  bool IsEmptyCell() const;
451  const SfxItemSet& GetCurrItemSet() const;
452 
454  static bool IsSpaceCharInfo( const HtmlImportInfo& rInfo );
455 
457  ScHTMLEntryPtr CreateEntry() const;
460  void CreateNewEntry( const HtmlImportInfo& rInfo );
461 
463  void InsertLeadingEmptyLine();
464 
466  void ImplPushEntryToVector( ScHTMLEntryVector& rEntryVector, ScHTMLEntryPtr& rxEntry );
471  bool PushEntry( ScHTMLEntryPtr& rxEntry );
476  bool PushEntry( const HtmlImportInfo& rInfo, bool bLastInCell = false );
478  void PushTableEntry( ScHTMLTableId nTableId );
479 
484  ScHTMLTable* GetExistingTable( ScHTMLTableId nTableId ) const;
487  ScHTMLTable* InsertNestedTable( const HtmlImportInfo& rInfo, bool bPreFormText );
488 
490  void InsertNewCell( const ScHTMLSize& rSpanSize );
491 
493  void ImplRowOn();
495  void ImplRowOff();
497  void ImplDataOn( const ScHTMLSize& rSpanSize );
499  void ImplDataOff();
500 
502  static void ProcessFormatOptions( SfxItemSet& rItemSet, const HtmlImportInfo& rInfo );
503 
506  void SetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellPos, SCCOLROW nSize );
512  void CalcNeededDocSize(
513  ScHTMLOrient eOrient, SCCOLROW nCellPos,
514  SCCOLROW nCellSpan, SCCOLROW nRealDocSize );
515 
516 private:
518  ScHTMLTableMapPtr mxNestedTables;
519  OUString maTableName;
522  SfxItemSetPtr mxRowItemSet;
523  SfxItemSetPtr mxDataItemSet;
528  std::vector<std::shared_ptr<ScEEParseEntry>>& mrEEParseList;
529  std::map< ScHTMLPos, ScHTMLEntryVector > maEntryMap;
530  ScHTMLEntryVector* mpCurrEntryVector;
531  ScHTMLEntryPtr mxCurrEntry;
532  ScSizeVec maCumSizes[ 2 ];
537  bool mbBorderOn:1;
538  bool mbPreFormText:1;
539  bool mbRowOn:1;
540  bool mbDataOn:1;
542 };
543 
546 {
547 public:
548  explicit ScHTMLGlobalTable(
549  SfxItemPool& rPool,
550  EditEngine& rEditEngine,
551  std::vector<std::shared_ptr<ScEEParseEntry>>& rEEParseList,
552  ScHTMLTableId& rnUnusedId, ScHTMLParser* pParser );
553 
554  virtual ~ScHTMLGlobalTable() override;
555 
557  void Recalc();
558 };
559 
566 {
567 public:
568  explicit ScHTMLQueryParser( EditEngine* pEditEngine, ScDocument* pDoc );
569  virtual ~ScHTMLQueryParser() override;
570 
571  virtual ErrCode Read( SvStream& rStrm, const OUString& rBaseURL ) override;
572 
574  virtual const ScHTMLTable* GetGlobalTable() const override;
575 
576 private:
578  void ProcessToken( const HtmlImportInfo& rInfo );
580  void InsertText( const HtmlImportInfo& rInfo );
582  void FontOn( const HtmlImportInfo& rInfo );
583 
585  void MetaOn( const HtmlImportInfo& rInfo );
587  void TitleOn();
589  void TitleOff( const HtmlImportInfo& rInfo );
590 
592  void TableOn( const HtmlImportInfo& rInfo );
594  void TableOff( const HtmlImportInfo& rInfo );
596  void PreOn( const HtmlImportInfo& rInfo );
598  void PreOff( const HtmlImportInfo& rInfo );
599 
601  void CloseTable( const HtmlImportInfo& rInfo );
602 
603  static void ParseStyle(const OUString& rStrm);
604 
605  DECL_LINK( HTMLImportHdl, HtmlImportInfo&, void );
606 
607 private:
608  typedef ::std::unique_ptr< ScHTMLGlobalTable > ScHTMLGlobalTablePtr;
609 
610  OUStringBuffer maTitle;
611  ScHTMLGlobalTablePtr mxGlobTable;
614  bool mbTitleOn;
615 };
616 
617 #endif
618 
619 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DECL_LINK(HTMLImportHdl, HtmlImportInfo &, void)
std::unique_ptr< OuterMap > pTables
Definition: htmlpars.hxx:159
void RowOn(const HtmlImportInfo &rInfo)
Starts next row (tag).
Definition: htmlpars.cxx:1989
EditEngine & mrEditEngine
List of all used cells.
Definition: htmlpars.hxx:527
ScHTMLStyles()
just a persistent empty string.
Definition: htmlpars.cxx:70
std::vector< std::shared_ptr< ScEEParseEntry > > & mrEEParseList
Edit engine (from ScEEParser).
Definition: htmlpars.hxx:528
::std::unique_ptr< ScHTMLTableMap > ScHTMLTableMapPtr
Definition: htmlpars.hxx:442
SCCOL mnCols
Definition: htmlpars.hxx:261
ScHTMLTable * PreOn(const HtmlImportInfo &rInfo)
Starts a new table based on preformatted text (.
Definition: htmlpars.cxx:1978
void AnchorOn(HtmlImportInfo *)
Definition: htmlpars.cxx:1401
SfxItemSet maTableItemSet
Unique identifier of this table.
Definition: htmlpars.hxx:521
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:533
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:1812
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:1704
SfxItemSet aItemSet
Definition: eeparser.hxx:53
virtual ~ScHTMLParser() override
Definition: htmlpars.cxx:194
void Strip(const EditEngine &rEditEngine)
Deletes leading and trailing empty paragraphs from the entry.
Definition: htmlpars.cxx:1681
SCROW Row() const
Definition: address.hxx:262
bool mbBorderOn
Definition: htmlpars.hxx:537
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:2307
const sal_uInt32 SC_HTML_FONTSIZES
Definition: htmlpars.hxx:33
ScHTMLEntry(const SfxItemSet &rItemSet, ScHTMLTableId nTableId=SC_HTML_NO_TABLE)
Definition: htmlpars.cxx:1645
ESelection aSel
Definition: eeparser.hxx:54
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:2277
void InsertNewCell(const ScHTMLSize &rSpanSize)
Inserts a new cell in an unused position, starting from current cell position.
Definition: htmlpars.cxx:2386
::std::map< sal_uInt16, InnerMap * > OuterMap
Definition: htmlpars.hxx:148
OUString maTableName
Table of nested HTML tables.
Definition: htmlpars.hxx:519
ScRangeList maHMergedCells
Items for the current cell.
Definition: htmlpars.hxx:524
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:1671
bool IsAtBeginningOfText(const HtmlImportInfo *)
Definition: htmlpars.cxx:1411
ScHTMLTable * TableOn(const HtmlImportInfo &rInfo)
Starts a new table nested in this table (.
Definition: htmlpars.cxx:1967
ScHTMLTable * TableOff(const HtmlImportInfo &rInfo)
Closes this table (tag).
Definition: htmlpars.cxx:1973
NamePropsType m_GlobalProps
Definition: htmlpars.hxx:53
bool mbPreFormText
true = Table borders on.
Definition: htmlpars.hxx:538
virtual ~ScHTMLTable()
Definition: htmlpars.cxx:1887
ScSizeVec maCumSizes[2]
Working entry, not yet inserted in a list.
Definition: htmlpars.hxx:532
void InsertText(const HtmlImportInfo &rInfo)
Inserts a text portion into current entry.
Definition: htmlpars.cxx:2899
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:3005
ScHTMLTableAutoId maTableId
Table name from.
Definition: htmlpars.hxx:520
SCCOLROW GetDocSize(ScHTMLOrient eOrient, SCCOLROW nCellPos) const
Returns the resulting document row/column count of the specified HTML row/column. ...
Definition: htmlpars.cxx:2174
void ProcToken(HtmlImportInfo *)
Definition: htmlpars.cxx:1474
SCROW mnRow
Definition: htmlpars.hxx:236
virtual ~ScHTMLGlobalTable() override
Definition: htmlpars.cxx:2745
ScHTMLEntryPtr mxCurrEntry
Current entry vector from map for faster access.
Definition: htmlpars.hxx:531
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:536
void NextRow(const HtmlImportInfo *)
Definition: htmlpars.cxx:326
void BodyOff(const HtmlImportInfo &rInfo)
Closes the body of the HTML document ( tag).
Definition: htmlpars.cxx:2147
ScHTMLEntryVector * mpCurrEntryVector
List of entries for each cell.
Definition: htmlpars.hxx:530
const sal_uInt16 SC_HTML_OFFSET_TOLERANCE_SMALL
Definition: htmlpars.hxx:36
virtual ~ScHTMLQueryParser() override
Definition: htmlpars.cxx:2769
bool mbDataOn
true = Inside of .
Definition: htmlpars.hxx:540
ScHTMLQueryParser(EditEngine *pEditEngine, ScDocument *pDoc)
Definition: htmlpars.cxx:2759
void FillEmptyCells()
Fills all empty cells in this and nested tables with dummy parse entries.
Definition: htmlpars.cxx:2571
void TableRowOn(const HtmlImportInfo *)
Definition: htmlpars.cxx:1002
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:2948
std::map< ScHTMLPos, ScHTMLEntryVector > maEntryMap
List that owns the parse entries (from ScEEParser).
Definition: htmlpars.hxx:529
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:1009
ScRangeList maUsedCells
List of all vertically merged cells.
Definition: htmlpars.hxx:526
void RecalcDocSize()
Recalculates the size of all columns/rows in the table, regarding nested tables.
Definition: htmlpars.cxx:2607
virtual const ScHTMLTable * GetGlobalTable() const =0
Returns the "global table" which contains the entire HTML document.
sal_uInt16 nTab
Definition: eeparser.hxx:65
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:24
ScHTMLGlobalTablePtr mxGlobTable
The title of the document.
Definition: htmlpars.hxx:611
o3tl::sorted_vector< sal_uLong > ScHTMLColOffset
Definition: htmlpars.hxx:96
void Recalc()
Recalculates sizes and resulting positions of all document entries.
Definition: htmlpars.cxx:2749
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:2158
::std::vector< ScHTMLEntry * > ScHTMLEntryVector
Definition: htmlpars.hxx:445
ScHTMLTable(ScHTMLTable &rParentTable, const HtmlImportInfo &rInfo, bool bPreFormText)
Creates a new HTML table without content.
Definition: htmlpars.cxx:1819
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:2656
bool mbImportAlways
Definition: htmlpars.hxx:302
bool mbPushEmptyLine
true = Inside of or .
Definition: htmlpars.hxx:541
::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:1947
void Image(HtmlImportInfo *)
Definition: htmlpars.cxx:1275
ScHTMLTableId GetTableId() const
Returns the unique identifier of the table.
Definition: htmlpars.hxx:342
sal_uInt16 nColOffset
Definition: htmlpars.hxx:169
void ImplRowOn()
Set internal states for a new table row.
Definition: htmlpars.cxx:2439
void ImplDataOff()
Set internal states for leaving a table cell.
Definition: htmlpars.cxx:2473
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:2299
ScHTMLEntryPtr CreateEntry() const
Creates and returns a new empty flying entry at position (0,0).
Definition: htmlpars.cxx:2287
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:2000
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:2359
SfxItemSetPtr mxRowItemSet
Items for the entire table.
Definition: htmlpars.hxx:522
ScHTMLTable * GetExistingTable(ScHTMLTableId nTableId) const
Tries to find a table from the table container.
Definition: htmlpars.cxx:2369
sal_Int16 SCCOL
Definition: types.hxx:22
OUStringBuffer maTitle
Definition: htmlpars.hxx:610
ScHTMLPos maCurrCell
Size of the table.
Definition: htmlpars.hxx:534
bool mbRowOn
true = Table from preformatted text (
Definition: htmlpars.hxx:539
void DataOff(const HtmlImportInfo &rInfo)
Closes the current cell ( or tag).
Definition: htmlpars.cxx:2124
void PutItem(const SfxPoolItem &rItem)
Puts the item into the item set of the current entry.
Definition: htmlpars.cxx:1913
ScHTMLTableId mnUnusedId
Pointer to current table (performance).
Definition: htmlpars.hxx:613
sal_uInt16 GetWidthPixel(const HTMLOption &)
Definition: htmlpars.cxx:1381
void ProcessToken(const HtmlImportInfo &rInfo)
Handles all possible tags in the HTML document.
Definition: htmlpars.cxx:2816
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:517
static bool IsSpaceCharInfo(const HtmlImportInfo &rInfo)
Returns true, if import info represents a space character.
Definition: htmlpars.cxx:2282
The HTML parser for data queries.
Definition: htmlpars.hxx:565
Collection of HTML style data parsed from the content of