LibreOffice Module sc (master) 1
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ScHTMLTable Class Reference

Stores data for one table in an HTML document. More...

#include <htmlpars.hxx>

Inheritance diagram for ScHTMLTable:
[legend]
Collaboration diagram for ScHTMLTable:
[legend]

Public Member Functions

 ScHTMLTable (ScHTMLTable &rParentTable, const HtmlImportInfo &rInfo, bool bPreFormText, const ScDocument &rDoc)
 Creates a new HTML table without content. More...
 
virtual ~ScHTMLTable ()
 
const OUString & GetTableName () const
 Returns the name of the table, specified in the TABLE tag. More...
 
const OUString & GetTableCaption () const
 Returns the caption of the table, specified in the tag. More...
 
ScHTMLTableId GetTableId () const
 Returns the unique identifier of the table. More...
 
ScHTMLSize GetSpan (const ScHTMLPos &rCellPos) const
 Returns the cell spanning of the specified cell. More...
 
ScHTMLTableFindNestedTable (ScHTMLTableId nTableId) const
 Searches in all nested tables for the specified table. More...
 
void PutItem (const SfxPoolItem &rItem)
 Puts the item into the item set of the current entry. More...
 
void PutText (const HtmlImportInfo &rInfo)
 Inserts a text portion into current entry. More...
 
void InsertPara (const HtmlImportInfo &rInfo)
 Inserts a new line, if in preformatted text, else does nothing. More...
 
void BreakOn ()
 Inserts a line break (
tag). More...
 
void HeadingOn ()
 Inserts a heading line (. More...
 
void AnchorOn ()
 Processes a hyperlink ( tag). More...
 
ScHTMLTableTableOn (const HtmlImportInfo &rInfo)
 Starts a new table nested in this table (. More...
 
ScHTMLTableTableOff (const HtmlImportInfo &rInfo)
 Closes this table (tag). More...
 
void CaptionOn ()
 Processes the caption of the table ( tag). More...
 
void CaptionOff ()
 Processes the caption of the table ( tag). More...
 
ScHTMLTablePreOn (const HtmlImportInfo &rInfo)
 Starts a new table based on preformatted text (. More...
 
ScHTMLTablePreOff (const HtmlImportInfo &rInfo)
 Closes this table based on preformatted text ( tag). More...
 
void RowOn (const HtmlImportInfo &rInfo)
 Starts next row (tag). More...
 
void RowOff (const HtmlImportInfo &rInfo)
 Closes the current row (tag). More...
 
void DataOn (const HtmlImportInfo &rInfo)
 Starts the next cell (or tag). More...
 
void DataOff (const HtmlImportInfo &rInfo)
 Closes the current cell ( or tag). More...
 
void BodyOn (const HtmlImportInfo &rInfo)
 Starts the body of the HTML document (<body> tag). More...
 
void BodyOff (const HtmlImportInfo &rInfo)
 Closes the body of the HTML document (</body> tag). More...
 
ScHTMLTableCloseTable (const HtmlImportInfo &rInfo)
 Closes this table (tag) or preformatted text ( tag). More...
 
SCCOLROW GetDocSize (ScHTMLOrient eOrient, SCCOLROW nCellPos) const
 Returns the resulting document row/column count of the specified HTML row/column. More...
 
SCCOLROW GetDocSize (ScHTMLOrient eOrient, SCCOLROW nCellBegin, SCCOLROW nCellEnd) const
 Returns the resulting document row/column count in the half-open range [nCellBegin, nCellEnd). More...
 
SCCOLROW GetDocSize (ScHTMLOrient eOrient) const
 Returns the total document row/column count in the specified direction. More...
 
ScHTMLSize GetDocSize (const ScHTMLPos &rCellPos) const
 Returns the total document row/column count of the specified HTML cell. More...
 
const ScHTMLPosGetDocPos () const
 Returns the resulting Calc position of the top left edge of the table. More...
 
SCCOLROW GetDocPos (ScHTMLOrient eOrient, SCCOLROW nCellPos) const
 Calculates the resulting Calc position of the specified HTML column/row. More...
 
ScHTMLPos GetDocPos (const ScHTMLPos &rCellPos) const
 Calculates the resulting Calc position of the specified HTML cell. More...
 
void GetDocRange (ScRange &rRange) const
 Calculates the current Calc document area of this table. More...
 
void ApplyCellBorders (ScDocument *pDoc, const ScAddress &rFirstPos) const
 Applies border formatting to the passed document. More...
 
SvNumberFormatterGetFormatTable ()
 

Protected Member Functions

 ScHTMLTable (SfxItemPool &rPool, EditEngine &rEditEngine, std::vector< std::shared_ptr< ScEEParseEntry > > &rEEParseList, ScHTMLTableId &rnUnusedId, ScHTMLParser *pParser, const ScDocument &rDoc)
 Creates a new HTML table without parent. More...
 
void FillEmptyCells ()
 Fills all empty cells in this and nested tables with dummy parse entries. More...
 
void RecalcDocSize ()
 Recalculates the size of all columns/rows in the table, regarding nested tables. More...
 
void RecalcDocPos (const ScHTMLPos &rBasePos)
 Recalculates the position of all cell entries and nested tables. More...
 

Private Types

typedef ::std::unique_ptr< ScHTMLTableMapScHTMLTableMapPtr
 
typedef ::std::vector< SCCOLROWScSizeVec
 
typedef ::std::vector< ScHTMLEntry * > ScHTMLEntryVector
 
typedef ::std::unique_ptr< ScHTMLEntryScHTMLEntryPtr
 

Private Member Functions

bool IsEmptyCell () const
 Returns true, if the current cell does not contain an entry yet. More...
 
const SfxItemSetGetCurrItemSet () const
 Returns the item set from cell, row, or table, depending on current state. More...
 
ScHTMLEntryPtr CreateEntry () const
 Creates and returns a new empty flying entry at position (0,0). More...
 
void CreateNewEntry (const HtmlImportInfo &rInfo)
 Creates a new flying entry. More...
 
void InsertLeadingEmptyLine ()
 Inserts an empty line in front of the next entry. More...
 
void ImplPushEntryToVector (ScHTMLEntryVector &rEntryVector, ScHTMLEntryPtr &rxEntry)
 Pushes the passed entry into the list of the current cell. More...
 
bool PushEntry (ScHTMLEntryPtr &rxEntry)
 Tries to insert the entry into the current cell. More...
 
bool PushEntry (const HtmlImportInfo &rInfo, bool bLastInCell=false)
 Puts the current entry into the entry list, if it is not empty. More...
 
void PushTableEntry (ScHTMLTableId nTableId)
 Pushes a new entry into current cell which references a nested table. More...
 
ScHTMLTableGetExistingTable (ScHTMLTableId nTableId) const
 Tries to find a table from the table container. More...
 
ScHTMLTableInsertNestedTable (const HtmlImportInfo &rInfo, bool bPreFormText)
 Inserts a nested table in the current cell at the specified position. More...
 
void InsertNewCell (const ScHTMLSize &rSpanSize)
 Inserts a new cell in an unused position, starting from current cell position. More...
 
void ImplRowOn ()
 Set internal states for a new table row. More...
 
void ImplRowOff ()
 Set internal states for leaving a table row. More...
 
void ImplDataOn (const ScHTMLSize &rSpanSize)
 Set internal states for entering a new table cell. More...
 
void ImplDataOff ()
 Set internal states for leaving a table cell. More...
 
void SetDocSize (ScHTMLOrient eOrient, SCCOLROW nCellPos, SCCOLROW nSize)
 Updates the document column/row size of the specified column or row. More...
 
void CalcNeededDocSize (ScHTMLOrient eOrient, SCCOLROW nCellPos, SCCOLROW nCellSpan, SCCOLROW nRealDocSize)
 Calculates and sets the resulting size the cell needs in the document. More...
 

Static Private Member Functions

static bool IsSpaceCharInfo (const HtmlImportInfo &rInfo)
 Returns true, if import info represents a space character. More...
 
static void ProcessFormatOptions (SfxItemSet &rItemSet, const HtmlImportInfo &rInfo)
 Inserts additional formatting options from import info into the item set. More...
 

Private Attributes

ScHTMLTablempParentTable
 
ScHTMLTableMapPtr mxNestedTables
 Pointer to parent table. More...
 
OUString maTableName
 Table of nested HTML tables. More...
 
OUString maCaption
 Table name from. More...
 
OUStringBuffer maCaptionBuffer
 Caption name of the table from More...
 
ScHTMLTableAutoId maTableId
 Caption buffer of the table from More...
 
SfxItemSet maTableItemSet
 Unique identifier of this table. More...
 
std::optional< SfxItemSetmoRowItemSet
 Items for the entire table. More...
 
std::optional< SfxItemSetmoDataItemSet
 Items for the current table row. More...
 
ScRangeList maHMergedCells
 Items for the current cell. More...
 
ScRangeList maVMergedCells
 List of all horizontally merged cells. More...
 
ScRangeList maUsedCells
 List of all vertically merged cells. More...
 
EditEnginemrEditEngine
 List of all used cells. More...
 
std::vector< std::shared_ptr< ScEEParseEntry > > & mrEEParseList
 Edit engine (from ScEEParser). More...
 
std::map< ScHTMLPos, ScHTMLEntryVectormaEntryMap
 List that owns the parse entries (from ScEEParser). More...
 
ScHTMLEntryVectormpCurrEntryVector
 List of entries for each cell. More...
 
ScHTMLEntryPtr mxCurrEntry
 Current entry vector from map for faster access. More...
 
ScSizeVec maCumSizes [2]
 Working entry, not yet inserted in a list. More...
 
ScHTMLSize maSize
 Cumulated cell counts for each HTML table column/row. More...
 
ScHTMLPos maCurrCell
 Size of the table. More...
 
ScHTMLPos maDocBasePos
 Address of current cell to fill. More...
 
ScHTMLParsermpParser
 Resulting base address in a Calc document. More...
 
const ScDocumentmrDoc
 
bool mbBorderOn:1
 
bool mbPreFormText:1
 true = Table borders on. More...
 
bool mbRowOn:1
 true = Table from preformatted text ( More...
 
bool mbDataOn:1
 true = Inside of . More...
 
bool mbPushEmptyLine:1
 true = Inside of or . More...
 
bool mbCaptionOn:1
 true = Insert empty line before current entry. More...
 

Detailed Description

Stores data for one table in an HTML document.

This class does the main work for importing an HTML document. It manages the correct insertion of parse entries into the correct cells and the creation of nested tables. Recalculation of resulting document size and position is done recursively in all nested tables.

Definition at line 326 of file htmlpars.hxx.

Member Typedef Documentation

◆ ScHTMLEntryPtr

typedef ::std::unique_ptr< ScHTMLEntry > ScHTMLTable::ScHTMLEntryPtr
private

Definition at line 455 of file htmlpars.hxx.

◆ ScHTMLEntryVector

typedef ::std::vector< ScHTMLEntry* > ScHTMLTable::ScHTMLEntryVector
private

Definition at line 454 of file htmlpars.hxx.

◆ ScHTMLTableMapPtr

typedef ::std::unique_ptr< ScHTMLTableMap > ScHTMLTable::ScHTMLTableMapPtr
private

Definition at line 452 of file htmlpars.hxx.

◆ ScSizeVec

typedef ::std::vector< SCCOLROW > ScHTMLTable::ScSizeVec
private

Definition at line 453 of file htmlpars.hxx.

Constructor & Destructor Documentation

◆ ScHTMLTable() [1/2]

ScHTMLTable::ScHTMLTable ( ScHTMLTable rParentTable,
const HtmlImportInfo rInfo,
bool  bPreFormText,
const ScDocument rDoc 
)
explicit

Creates a new HTML table without content.

@descr Internally handles a current cell position. This position is invalid until first calls of RowOn() and DataOn().

Parameters
rParentTableReference to the parent table that owns this table.
bPreFormTexttrue = Table is based on preformatted text (
 tag). 

Definition at line 1810 of file htmlpars.cxx.

References CreateNewEntry(), ImplDataOn(), ImplRowOn(), maSize, maTableItemSet, maTableName, mbBorderOn, mbPreFormText, HtmlImportInfo::pParser, and ProcessFormatOptions().

◆ ~ScHTMLTable()

ScHTMLTable::~ScHTMLTable ( )
virtual

Definition at line 1882 of file htmlpars.cxx.

◆ ScHTMLTable() [2/2]

ScHTMLTable::ScHTMLTable ( SfxItemPool rPool,
EditEngine rEditEngine,
std::vector< std::shared_ptr< ScEEParseEntry > > &  rEEParseList,
ScHTMLTableId rnUnusedId,
ScHTMLParser pParser,
const ScDocument rDoc 
)
explicitprotected

Creates a new HTML table without parent.

@descr This constructor is used to create the "global table".

Definition at line 1854 of file htmlpars.cxx.

References CreateEntry(), ImplDataOn(), ImplRowOn(), maSize, and mxCurrEntry.

Member Function Documentation

◆ AnchorOn()

void ScHTMLTable::AnchorOn ( )

Processes a hyperlink ( tag).

Definition at line 1957 of file htmlpars.cxx.

References mxCurrEntry.

Referenced by ScHTMLQueryParser::ProcessToken().

◆ ApplyCellBorders()

void ScHTMLTable::ApplyCellBorders ( ScDocument pDoc,
const ScAddress rFirstPos 
) const

◆ BodyOff()

void ScHTMLTable::BodyOff ( const HtmlImportInfo rInfo)

Closes the body of the HTML document (</body> tag).

Definition at line 2159 of file htmlpars.cxx.

References CreateNewEntry(), ImplDataOff(), ImplRowOff(), mpParentTable, and PushEntry().

Referenced by ScHTMLQueryParser::ProcessToken().

◆ BodyOn()

void ScHTMLTable::BodyOn ( const HtmlImportInfo rInfo)

Starts the body of the HTML document (<body> tag).

Definition at line 2144 of file htmlpars.cxx.

References CreateNewEntry(), ImplDataOn(), ImplRowOn(), mbDataOn, mbRowOn, moDataItemSet, mpParentTable, ProcessFormatOptions(), and PushEntry().

Referenced by ScHTMLQueryParser::ProcessToken().

◆ BreakOn()

void ScHTMLTable::BreakOn ( )

Inserts a line break (
tag).

@descr Inserts the current entry regardless if it is empty.

Definition at line 1939 of file htmlpars.cxx.

References IsEmptyCell(), mbDataOn, mbPreFormText, and mbPushEmptyLine.

Referenced by ScHTMLQueryParser::ProcessToken().

◆ CalcNeededDocSize()

void ScHTMLTable::CalcNeededDocSize ( ScHTMLOrient  eOrient,
SCCOLROW  nCellPos,
SCCOLROW  nCellSpan,
SCCOLROW  nRealDocSize 
)
private

Calculates and sets the resulting size the cell needs in the document.

@descr Reduces the needed size in merged cells.

Parameters
nCellPosThe first column/row position of the (merged) cell.
nCellSpanThe cell spanning in the specified orientation.
nRealDocSizeThe raw document size of all entries of the cell.

Definition at line 2567 of file htmlpars.cxx.

References GetDocSize(), and SetDocSize().

Referenced by RecalcDocSize().

◆ CaptionOff()

void ScHTMLTable::CaptionOff ( )

Processes the caption of the table ( tag).

Definition at line 1982 of file htmlpars.cxx.

References maCaption, maCaptionBuffer, and mbCaptionOn.

Referenced by ScHTMLQueryParser::ProcessToken().

◆ CaptionOn()

void ScHTMLTable::CaptionOn ( )

Processes the caption of the table ( tag).

Definition at line 1976 of file htmlpars.cxx.

References maCaptionBuffer, and mbCaptionOn.

Referenced by ScHTMLQueryParser::ProcessToken().

◆ CloseTable()

ScHTMLTable * ScHTMLTable::CloseTable ( const HtmlImportInfo rInfo)

Closes this table (tag) or preformatted text ( tag).

@descr Used to close this table object regardless on opening tag type.

Returns
Pointer to the parent table, or this, if no parent found.

Definition at line 2170 of file htmlpars.cxx.

References CreateNewEntry(), GetTableId(), ImplDataOff(), ImplRowOff(), InsertLeadingEmptyLine(), mbDataOn, mbPreFormText, mpParentTable, PushEntry(), and PushTableEntry().

Referenced by ScHTMLQueryParser::CloseTable(), PreOff(), and TableOff().

◆ CreateEntry()

ScHTMLTable::ScHTMLEntryPtr ScHTMLTable::CreateEntry ( ) const
private

Creates and returns a new empty flying entry at position (0,0).

Definition at line 2299 of file htmlpars.cxx.

References GetCurrItemSet().

Referenced by CreateNewEntry(), FillEmptyCells(), PushEntry(), and ScHTMLTable().

◆ CreateNewEntry()

void ScHTMLTable::CreateNewEntry ( const HtmlImportInfo rInfo)
private

Creates a new flying entry.

Parameters
rInfoContains the initial edit engine selection for the entry.

Definition at line 2304 of file htmlpars.cxx.

References HtmlImportInfo::aSelection, CreateEntry(), and mxCurrEntry.

Referenced by BodyOff(), BodyOn(), CloseTable(), DataOff(), DataOn(), InsertPara(), RowOff(), RowOn(), and ScHTMLTable().

◆ DataOff()

void ScHTMLTable::DataOff ( const HtmlImportInfo rInfo)

Closes the current cell ( or tag).

@descr Cell address is invalid until next call of DataOn().

Definition at line 2136 of file htmlpars.cxx.

References CreateNewEntry(), ImplDataOff(), mbPreFormText, mpParentTable, and PushEntry().

Referenced by ScHTMLQueryParser::ProcessToken().

◆ DataOn()

void ScHTMLTable::DataOn ( const HtmlImportInfo rInfo)

◆ FillEmptyCells()

void ScHTMLTable::FillEmptyCells ( )
protected

◆ FindNestedTable()

ScHTMLTable * ScHTMLTable::FindNestedTable ( ScHTMLTableId  nTableId) const

Searches in all nested tables for the specified table.

Parameters
nTableIdUnique identifier of the table.

Definition at line 1903 of file htmlpars.cxx.

References mxNestedTables.

Referenced by ScHTMLTableMap::FindTable(), and ScHTMLImport::WriteToDocument().

◆ GetCurrItemSet()

const SfxItemSet & ScHTMLTable::GetCurrItemSet ( ) const
private

Returns the item set from cell, row, or table, depending on current state.

Definition at line 1886 of file htmlpars.cxx.

References maTableItemSet, moDataItemSet, and moRowItemSet.

Referenced by CreateEntry().

◆ GetDocPos() [1/3]

const ScHTMLPos & ScHTMLTable::GetDocPos ( ) const
inline

Returns the resulting Calc position of the top left edge of the table.

Definition at line 419 of file htmlpars.hxx.

References maDocBasePos.

Referenced by ApplyCellBorders(), GetDocPos(), ScHTMLGlobalTable::Recalc(), and RecalcDocPos().

◆ GetDocPos() [2/3]

ScHTMLPos ScHTMLTable::GetDocPos ( const ScHTMLPos rCellPos) const

Calculates the resulting Calc position of the specified HTML cell.

Definition at line 2222 of file htmlpars.cxx.

References GetDocPos(), ScHTMLPos::mnCol, ScHTMLPos::mnRow, tdCol, and tdRow.

◆ GetDocPos() [3/3]

SCCOLROW ScHTMLTable::GetDocPos ( ScHTMLOrient  eOrient,
SCCOLROW  nCellPos 
) const

Calculates the resulting Calc position of the specified HTML column/row.

Definition at line 2217 of file htmlpars.cxx.

References ScHTMLPos::Get(), GetDocSize(), and maDocBasePos.

◆ GetDocRange()

void ScHTMLTable::GetDocRange ( ScRange rRange) const

Calculates the current Calc document area of this table.

Definition at line 2229 of file htmlpars.cxx.

References ScRange::aEnd, ScRange::aStart, GetDocSize(), maDocBasePos, ScHTMLPos::MakeAddr(), ScAddress::Move(), mrDoc, tdCol, tdRow, and ScAddress::UNINITIALIZED.

Referenced by ScHTMLImport::WriteToDocument().

◆ GetDocSize() [1/4]

ScHTMLSize ScHTMLTable::GetDocSize ( const ScHTMLPos rCellPos) const

Returns the total document row/column count of the specified HTML cell.

Definition at line 2209 of file htmlpars.cxx.

References GetDocSize(), GetSpan(), ScHTMLPos::mnCol, ScHTMLSize::mnCols, ScHTMLPos::mnRow, ScHTMLSize::mnRows, tdCol, and tdRow.

◆ GetDocSize() [2/4]

SCCOLROW ScHTMLTable::GetDocSize ( ScHTMLOrient  eOrient) const

Returns the total document row/column count in the specified direction.

Definition at line 2203 of file htmlpars.cxx.

References maCumSizes.

◆ GetDocSize() [3/4]

SCCOLROW ScHTMLTable::GetDocSize ( ScHTMLOrient  eOrient,
SCCOLROW  nCellBegin,
SCCOLROW  nCellEnd 
) const

Returns the resulting document row/column count in the half-open range [nCellBegin, nCellEnd).

Definition at line 2194 of file htmlpars.cxx.

References maCumSizes.

◆ GetDocSize() [4/4]

SCCOLROW ScHTMLTable::GetDocSize ( ScHTMLOrient  eOrient,
SCCOLROW  nCellPos 
) const

Returns the resulting document row/column count of the specified HTML row/column.

Definition at line 2186 of file htmlpars.cxx.

References maCumSizes, and nIndex.

Referenced by ApplyCellBorders(), CalcNeededDocSize(), GetDocPos(), GetDocRange(), GetDocSize(), RecalcDocPos(), RecalcDocSize(), and ScHTMLImport::WriteToDocument().

◆ GetExistingTable()

ScHTMLTable * ScHTMLTable::GetExistingTable ( ScHTMLTableId  nTableId) const
private

Tries to find a table from the table container.

@descr Assumes that the table is located in the current container or that the passed table identifier is 0.

Parameters
nTableIdUnique identifier of the table or 0.

Definition at line 2381 of file htmlpars.cxx.

References mxNestedTables, and SC_HTML_GLOBAL_TABLE.

Referenced by RecalcDocPos(), and RecalcDocSize().

◆ GetFormatTable()

SvNumberFormatter * ScHTMLTable::GetFormatTable ( )

Definition at line 2284 of file htmlpars.cxx.

References ScHTMLParser::GetDoc(), ScDocument::GetFormatTable(), and mpParser.

Referenced by DataOn().

◆ GetSpan()

ScHTMLSize ScHTMLTable::GetSpan ( const ScHTMLPos rCellPos) const

Returns the cell spanning of the specified cell.

Definition at line 1892 of file htmlpars.cxx.

References ScRange::aEnd, ScRange::aStart, ScAddress::Col(), ScRangeList::Find(), maHMergedCells, ScHTMLPos::MakeAddr(), maVMergedCells, ScAddress::Row(), and ScHTMLSize::Set().

Referenced by GetDocSize(), and RecalcDocSize().

◆ GetTableCaption()

const OUString & ScHTMLTable::GetTableCaption ( ) const
inline

Returns the caption of the table, specified in the tag.

Definition at line 345 of file htmlpars.hxx.

References maCaption.

Referenced by ScHTMLImport::WriteToDocument().

◆ GetTableId()

ScHTMLTableId ScHTMLTable::GetTableId ( ) const
inline

Returns the unique identifier of the table.

Definition at line 347 of file htmlpars.hxx.

References maTableId, and ScHTMLTableAutoId::mnTableId.

Referenced by CloseTable(), ScHTMLTableMap::CreateTable(), and ScHTMLTableMap::FindTable().

◆ GetTableName()

const OUString & ScHTMLTable::GetTableName ( ) const
inline

Returns the name of the table, specified in the TABLE tag.

Definition at line 343 of file htmlpars.hxx.

References maTableName.

Referenced by ScHTMLImport::WriteToDocument().

◆ HeadingOn()

void ScHTMLTable::HeadingOn ( )

Inserts a heading line (.

and <h*> tags).

Definition at line 1945 of file htmlpars.cxx.

References InsertLeadingEmptyLine().

Referenced by ScHTMLQueryParser::ProcessToken().

◆ ImplDataOff()

void ScHTMLTable::ImplDataOff ( )
private

Set internal states for leaving a table cell.

Definition at line 2485 of file htmlpars.cxx.

References maCurrCell, mbDataOn, ScHTMLPos::mnCol, moDataItemSet, and mpCurrEntryVector.

Referenced by BodyOff(), CloseTable(), DataOff(), ImplDataOn(), and ImplRowOff().

◆ ImplDataOn()

void ScHTMLTable::ImplDataOn ( const ScHTMLSize rSpanSize)
private

Set internal states for entering a new table cell.

Definition at line 2473 of file htmlpars.cxx.

References ImplDataOff(), ImplRowOn(), InsertNewCell(), mbDataOn, mbPushEmptyLine, mbRowOn, moDataItemSet, and moRowItemSet.

Referenced by BodyOn(), DataOn(), and ScHTMLTable().

◆ ImplPushEntryToVector()

void ScHTMLTable::ImplPushEntryToVector ( ScHTMLEntryVector rEntryVector,
ScHTMLEntryPtr rxEntry 
)
private

Pushes the passed entry into the list of the current cell.

Definition at line 2311 of file htmlpars.cxx.

References mrEEParseList.

Referenced by FillEmptyCells(), PushEntry(), and RecalcDocPos().

◆ ImplRowOff()

void ScHTMLTable::ImplRowOff ( )
private

Set internal states for leaving a table row.

Definition at line 2461 of file htmlpars.cxx.

References ImplDataOff(), maCurrCell, mbDataOn, mbRowOn, ScHTMLPos::mnRow, and moRowItemSet.

Referenced by BodyOff(), CloseTable(), ImplRowOn(), and RowOff().

◆ ImplRowOn()

void ScHTMLTable::ImplRowOn ( )
private

Set internal states for a new table row.

Definition at line 2451 of file htmlpars.cxx.

References ImplRowOff(), maCurrCell, maTableItemSet, mbDataOn, mbRowOn, ScHTMLPos::mnCol, and moRowItemSet.

Referenced by BodyOn(), ImplDataOn(), RowOn(), and ScHTMLTable().

◆ InsertLeadingEmptyLine()

void ScHTMLTable::InsertLeadingEmptyLine ( )
private

Inserts an empty line in front of the next entry.

Definition at line 1951 of file htmlpars.cxx.

References IsEmptyCell(), mbDataOn, mbPreFormText, and mbPushEmptyLine.

Referenced by CloseTable(), HeadingOn(), InsertNestedTable(), and InsertPara().

◆ InsertNestedTable()

ScHTMLTable * ScHTMLTable::InsertNestedTable ( const HtmlImportInfo rInfo,
bool  bPreFormText 
)
private

Inserts a nested table in the current cell at the specified position.

Parameters
bPreFormTexttrue = New table is based on preformatted text (
 tag). 

Definition at line 2389 of file htmlpars.cxx.

References InsertLeadingEmptyLine(), mrDoc, and mxNestedTables.

Referenced by PreOn(), and TableOn().

◆ InsertNewCell()

void ScHTMLTable::InsertNewCell ( const ScHTMLSize rSpanSize)
private

◆ InsertPara()

void ScHTMLTable::InsertPara ( const HtmlImportInfo rInfo)

Inserts a new line, if in preformatted text, else does nothing.

Definition at line 1930 of file htmlpars.cxx.

References CreateNewEntry(), InsertLeadingEmptyLine(), IsEmptyCell(), mbDataOn, mxCurrEntry, and PushEntry().

◆ IsEmptyCell()

bool ScHTMLTable::IsEmptyCell ( ) const
private

Returns true, if the current cell does not contain an entry yet.

Definition at line 2289 of file htmlpars.cxx.

References mpCurrEntryVector.

Referenced by BreakOn(), InsertLeadingEmptyLine(), InsertPara(), and PushEntry().

◆ IsSpaceCharInfo()

bool ScHTMLTable::IsSpaceCharInfo ( const HtmlImportInfo rInfo)
staticprivate

Returns true, if import info represents a space character.

Definition at line 2294 of file htmlpars.cxx.

References HtmlImportInfo::aText, and HtmlImportInfo::nToken.

Referenced by PutText().

◆ PreOff()

ScHTMLTable * ScHTMLTable::PreOff ( const HtmlImportInfo rInfo)

Closes this table based on preformatted text ( tag).

Returns
Pointer to the parent table.

Definition at line 1996 of file htmlpars.cxx.

References CloseTable(), and mbPreFormText.

Referenced by ScHTMLQueryParser::PreOff().

◆ PreOn()

ScHTMLTable * ScHTMLTable::PreOn ( const HtmlImportInfo rInfo)

Starts a new table based on preformatted text (.

 tag).
Returns
Pointer to the new table.

Definition at line 1990 of file htmlpars.cxx.

References InsertNestedTable(), and PushEntry().

Referenced by ScHTMLQueryParser::PreOn().

◆ ProcessFormatOptions()

void ScHTMLTable::ProcessFormatOptions ( SfxItemSet rItemSet,
const HtmlImportInfo rInfo 
)
staticprivate

◆ PushEntry() [1/2]

bool ScHTMLTable::PushEntry ( const HtmlImportInfo rInfo,
bool  bLastInCell = false 
)
private

Puts the current entry into the entry list, if it is not empty.

Parameters
rInfoThe import info struct containing the end position of the current entry.
bLastInCelltrue = If cell is still empty, put this entry always.
Returns
true = Entry as been pushed into the current cell; false = Entry dropped.

Definition at line 2347 of file htmlpars.cxx.

References IsEmptyCell(), mbPushEmptyLine, mrEditEngine, mxCurrEntry, and PushEntry().

◆ PushEntry() [2/2]

bool ScHTMLTable::PushEntry ( ScHTMLEntryPtr rxEntry)
private

Tries to insert the entry into the current cell.

@descr If insertion is not possible (i.e., currently no cell open), the entry will be inserted into the parent table.

Returns
true = Entry has been pushed into the current cell; false = Entry dropped.

Definition at line 2319 of file htmlpars.cxx.

References CreateEntry(), ImplPushEntryToVector(), mbPushEmptyLine, mpCurrEntryVector, mpParentTable, and PushEntry().

Referenced by BodyOff(), BodyOn(), CloseTable(), DataOff(), DataOn(), InsertPara(), PreOn(), PushEntry(), PushTableEntry(), RowOff(), RowOn(), and TableOn().

◆ PushTableEntry()

void ScHTMLTable::PushTableEntry ( ScHTMLTableId  nTableId)
private

Pushes a new entry into current cell which references a nested table.

Definition at line 2371 of file htmlpars.cxx.

References maTableItemSet, PushEntry(), and SC_HTML_GLOBAL_TABLE.

Referenced by CloseTable().

◆ PutItem()

void ScHTMLTable::PutItem ( const SfxPoolItem rItem)

Puts the item into the item set of the current entry.

Definition at line 1908 of file htmlpars.cxx.

References mxCurrEntry.

Referenced by ScHTMLQueryParser::FontOn(), and ScHTMLQueryParser::ProcessToken().

◆ PutText()

void ScHTMLTable::PutText ( const HtmlImportInfo rInfo)

Inserts a text portion into current entry.

Definition at line 1915 of file htmlpars.cxx.

References HtmlImportInfo::aText, IsSpaceCharInfo(), maCaptionBuffer, mbCaptionOn, and mxCurrEntry.

Referenced by ScHTMLQueryParser::InsertText().

◆ RecalcDocPos()

void ScHTMLTable::RecalcDocPos ( const ScHTMLPos rBasePos)
protected

◆ RecalcDocSize()

void ScHTMLTable::RecalcDocSize ( )
protected

Recalculates the size of all columns/rows in the table, regarding nested tables.

Definition at line 2619 of file htmlpars.cxx.

References CalcNeededDocSize(), GetDocSize(), GetExistingTable(), GetSpan(), maEntryMap, ScHTMLSize::mnCols, ScHTMLSize::mnRows, mxNestedTables, tdCol, and tdRow.

Referenced by ScHTMLGlobalTable::Recalc().

◆ RowOff()

void ScHTMLTable::RowOff ( const HtmlImportInfo rInfo)

Closes the current row (tag).

@descr Cell address is invalid until call of RowOn() and DataOn().

Definition at line 2012 of file htmlpars.cxx.

References CreateNewEntry(), ImplRowOff(), mbPreFormText, mpParentTable, and PushEntry().

Referenced by ScHTMLQueryParser::ProcessToken().

◆ RowOn()

void ScHTMLTable::RowOn ( const HtmlImportInfo rInfo)

Starts next row (tag).

@descr Cell address is invalid until first call of DataOn().

Definition at line 2001 of file htmlpars.cxx.

References CreateNewEntry(), ImplRowOn(), mbPreFormText, moRowItemSet, mpParentTable, ProcessFormatOptions(), and PushEntry().

Referenced by ScHTMLQueryParser::ProcessToken().

◆ SetDocSize()

void ScHTMLTable::SetDocSize ( ScHTMLOrient  eOrient,
SCCOLROW  nCellPos,
SCCOLROW  nSize 
)
private

Updates the document column/row size of the specified column or row.

@descr Only increases the present count, never decreases.

Definition at line 2552 of file htmlpars.cxx.

References maCumSizes, and nIndex.

Referenced by CalcNeededDocSize().

◆ TableOff()

ScHTMLTable * ScHTMLTable::TableOff ( const HtmlImportInfo rInfo)

Closes this table (tag).

Returns
Pointer to the parent table.

Definition at line 1971 of file htmlpars.cxx.

References CloseTable(), and mbPreFormText.

Referenced by ScHTMLQueryParser::TableOff().

◆ TableOn()

ScHTMLTable * ScHTMLTable::TableOn ( const HtmlImportInfo rInfo)

Starts a new table nested in this table (.

).

Returns
Pointer to the new table.

Definition at line 1965 of file htmlpars.cxx.

References InsertNestedTable(), and PushEntry().

Referenced by ScHTMLQueryParser::TableOn().

Member Data Documentation

◆ maCaption

OUString ScHTMLTable::maCaption
private

Table name from.

.

Definition at line 529 of file htmlpars.hxx.

Referenced by CaptionOff(), and GetTableCaption().

◆ maCaptionBuffer

OUStringBuffer ScHTMLTable::maCaptionBuffer
private

Caption name of the table from

Definition at line 530 of file htmlpars.hxx.

Referenced by CaptionOff(), CaptionOn(), and PutText().

◆ maCumSizes

ScSizeVec ScHTMLTable::maCumSizes[2]
private

Working entry, not yet inserted in a list.

Definition at line 543 of file htmlpars.hxx.

Referenced by GetDocSize(), and SetDocSize().

◆ maCurrCell

ScHTMLPos ScHTMLTable::maCurrCell
private

Size of the table.

Definition at line 545 of file htmlpars.hxx.

Referenced by ImplDataOff(), ImplRowOff(), ImplRowOn(), and InsertNewCell().

◆ maDocBasePos

ScHTMLPos ScHTMLTable::maDocBasePos
private

Address of current cell to fill.

Definition at line 546 of file htmlpars.hxx.

Referenced by GetDocPos(), GetDocRange(), and RecalcDocPos().

◆ maEntryMap

std::map< ScHTMLPos, ScHTMLEntryVector > ScHTMLTable::maEntryMap
private

List that owns the parse entries (from ScEEParser).

Definition at line 540 of file htmlpars.hxx.

Referenced by FillEmptyCells(), InsertNewCell(), RecalcDocPos(), and RecalcDocSize().

◆ maHMergedCells

ScRangeList ScHTMLTable::maHMergedCells
private

Items for the current cell.

Definition at line 535 of file htmlpars.hxx.

Referenced by GetSpan(), and InsertNewCell().

◆ maSize

ScHTMLSize ScHTMLTable::maSize
private

Cumulated cell counts for each HTML table column/row.

Definition at line 544 of file htmlpars.hxx.

Referenced by ApplyCellBorders(), FillEmptyCells(), and InsertNewCell().

◆ maTableId

ScHTMLTableAutoId ScHTMLTable::maTableId
private

Caption buffer of the table from

Definition at line 531 of file htmlpars.hxx.

Referenced by GetTableId().

◆ maTableItemSet

SfxItemSet ScHTMLTable::maTableItemSet
private

Unique identifier of this table.

Definition at line 532 of file htmlpars.hxx.

Referenced by GetCurrItemSet(), ImplRowOn(), PushTableEntry(), and ScHTMLTable().

◆ maTableName

OUString ScHTMLTable::maTableName
private

Table of nested HTML tables.

Definition at line 528 of file htmlpars.hxx.

Referenced by GetTableName(), and ScHTMLTable().

◆ maUsedCells

ScRangeList ScHTMLTable::maUsedCells
private

List of all vertically merged cells.

Definition at line 537 of file htmlpars.hxx.

Referenced by FillEmptyCells(), and InsertNewCell().

◆ maVMergedCells

ScRangeList ScHTMLTable::maVMergedCells
private

List of all horizontally merged cells.

Definition at line 536 of file htmlpars.hxx.

Referenced by FillEmptyCells(), GetSpan(), and InsertNewCell().

◆ mbBorderOn

bool ScHTMLTable::mbBorderOn
private

Definition at line 549 of file htmlpars.hxx.

Referenced by ApplyCellBorders(), and ScHTMLTable().

◆ mbCaptionOn

bool ScHTMLTable::mbCaptionOn
private

true = Insert empty line before current entry.

Definition at line 554 of file htmlpars.hxx.

Referenced by CaptionOff(), CaptionOn(), and PutText().

◆ mbDataOn

bool ScHTMLTable::mbDataOn
private

true = Inside of .

Definition at line 552 of file htmlpars.hxx.

Referenced by BodyOn(), BreakOn(), CloseTable(), ImplDataOff(), ImplDataOn(), ImplRowOff(), ImplRowOn(), InsertLeadingEmptyLine(), and InsertPara().

◆ mbPreFormText

bool ScHTMLTable::mbPreFormText
private

true = Table borders on.

Definition at line 550 of file htmlpars.hxx.

Referenced by BreakOn(), CloseTable(), DataOff(), DataOn(), InsertLeadingEmptyLine(), PreOff(), RowOff(), RowOn(), ScHTMLTable(), and TableOff().

◆ mbPushEmptyLine

bool ScHTMLTable::mbPushEmptyLine
private

true = Inside of or .

Definition at line 553 of file htmlpars.hxx.

Referenced by BreakOn(), ImplDataOn(), InsertLeadingEmptyLine(), and PushEntry().

◆ mbRowOn

bool ScHTMLTable::mbRowOn
private

true = Table from preformatted text (

 tag).

Definition at line 551 of file htmlpars.hxx.

Referenced by BodyOn(), ImplDataOn(), ImplRowOff(), and ImplRowOn().

◆ moDataItemSet

std::optional<SfxItemSet> ScHTMLTable::moDataItemSet
private

Items for the current table row.

Definition at line 534 of file htmlpars.hxx.

Referenced by BodyOn(), DataOn(), GetCurrItemSet(), ImplDataOff(), and ImplDataOn().

◆ moRowItemSet

std::optional<SfxItemSet> ScHTMLTable::moRowItemSet
private

Items for the entire table.

Definition at line 533 of file htmlpars.hxx.

Referenced by GetCurrItemSet(), ImplDataOn(), ImplRowOff(), ImplRowOn(), and RowOn().

◆ mpCurrEntryVector

ScHTMLEntryVector* ScHTMLTable::mpCurrEntryVector
private

List of entries for each cell.

Definition at line 541 of file htmlpars.hxx.

Referenced by ImplDataOff(), InsertNewCell(), IsEmptyCell(), and PushEntry().

◆ mpParentTable

ScHTMLTable* ScHTMLTable::mpParentTable
private

◆ mpParser

ScHTMLParser* ScHTMLTable::mpParser
private

Resulting base address in a Calc document.

Definition at line 547 of file htmlpars.hxx.

Referenced by DataOn(), and GetFormatTable().

◆ mrDoc

const ScDocument& ScHTMLTable::mrDoc
private

Definition at line 548 of file htmlpars.hxx.

Referenced by GetDocRange(), InsertNestedTable(), and InsertNewCell().

◆ mrEditEngine

EditEngine& ScHTMLTable::mrEditEngine
private

List of all used cells.

Definition at line 538 of file htmlpars.hxx.

Referenced by PushEntry().

◆ mrEEParseList

std::vector<std::shared_ptr<ScEEParseEntry> >& ScHTMLTable::mrEEParseList
private

Edit engine (from ScEEParser).

Definition at line 539 of file htmlpars.hxx.

Referenced by ImplPushEntryToVector().

◆ mxCurrEntry

ScHTMLEntryPtr ScHTMLTable::mxCurrEntry
private

Current entry vector from map for faster access.

Definition at line 542 of file htmlpars.hxx.

Referenced by AnchorOn(), CreateNewEntry(), DataOn(), InsertPara(), PushEntry(), PutItem(), PutText(), and ScHTMLTable().

◆ mxNestedTables

ScHTMLTableMapPtr ScHTMLTable::mxNestedTables
private

Pointer to parent table.

Definition at line 527 of file htmlpars.hxx.

Referenced by ApplyCellBorders(), FillEmptyCells(), FindNestedTable(), GetExistingTable(), InsertNestedTable(), and RecalcDocSize().


The documentation for this class was generated from the following files: