40#include <osl/diagnose.h>
72#define NETSCAPE_DFLT_BORDER 1
73#define NETSCAPE_DFLT_CELLSPACING 2
75using ::editeng::SvxBorderLine;
90struct HTMLTableOptions
95 sal_uInt16 nCellPadding;
96 sal_uInt16 nCellSpacing;
106 bool bPercentWidth : 1;
107 bool bTableAdjust : 1;
113 OUString aBGImage, aStyle, aId, aClass, aDir;
118class HTMLTableContext
124 std::unique_ptr<SwPosition> m_pPos;
126 size_t m_nContextStAttrMin;
127 size_t m_nContextStMin;
129 bool m_bRestartPRE : 1;
130 bool m_bRestartXMP : 1;
131 bool m_bRestartListing : 1;
133 HTMLTableContext(
const HTMLTableContext&) =
delete;
134 HTMLTableContext& operator=(
const HTMLTableContext&) =
delete;
138 std::shared_ptr<HTMLAttrTable> m_xAttrTab;
140 HTMLTableContext(
SwPosition *pPs,
size_t nCntxtStMin,
141 size_t nCntxtStAttrMin ) :
142 m_pTableNd( nullptr ),
143 m_pFrameFormat( nullptr ),
145 m_nContextStAttrMin( nCntxtStAttrMin ),
146 m_nContextStMin( nCntxtStMin ),
147 m_bRestartPRE( false ),
148 m_bRestartXMP( false ),
149 m_bRestartListing( false ),
161 SwPosition *GetPos()
const {
return m_pPos.get(); }
163 void SetTableNode(
SwTableNode *pNd ) { m_pTableNd = pNd; }
164 SwTableNode *GetTableNode()
const {
return m_pTableNd; }
166 void SetFrameFormat(
SwFrameFormat *pFormat ) { m_pFrameFormat = pFormat; }
167 SwFrameFormat *GetFrameFormat()
const {
return m_pFrameFormat; }
169 size_t GetContextStMin()
const {
return m_nContextStMin; }
170 size_t GetContextStAttrMin()
const {
return m_nContextStAttrMin; }
205 void Add( std::unique_ptr<HTMLTableCnts> pNewCnts );
223 std::shared_ptr<HTMLTableCnts> m_xContents;
224 std::shared_ptr<SvxBrushItem> m_xBGBrush;
225 std::shared_ptr<SvxBoxItem> m_xBoxItem;
228 sal_uInt32 m_nNumFormat;
229 sal_uInt16 m_nRowSpan;
230 sal_uInt16 m_nColSpan;
232 sal_Int16 m_eVertOrient;
233 bool m_bProtected : 1;
234 bool m_bRelWidth : 1;
235 bool m_bHasNumFormat : 1;
236 bool m_bHasValue : 1;
245 void Set( std::shared_ptr<HTMLTableCnts>
const& rCnts, sal_uInt16 nRSpan, sal_uInt16 nCSpan,
246 sal_Int16 eVertOri, std::shared_ptr<SvxBrushItem>
const& rBGBrush,
247 std::shared_ptr<SvxBoxItem>
const& rBoxItem,
248 bool bHasNumFormat, sal_uInt32 nNumFormat,
249 bool bHasValue,
double nValue,
bool bNoWrap,
bool bCovered );
255 void SetContents(std::shared_ptr<HTMLTableCnts>
const& rCnts) { m_xContents = rCnts; }
256 const std::shared_ptr<HTMLTableCnts>& GetContents()
const {
return m_xContents; }
259 void SetRowSpan( sal_uInt16 nRSpan ) { m_nRowSpan = nRSpan; }
260 sal_uInt16 GetRowSpan()
const {
return m_nRowSpan; }
262 void SetColSpan( sal_uInt16 nCSpan ) { m_nColSpan = nCSpan; }
263 sal_uInt16 GetColSpan()
const {
return m_nColSpan; }
265 inline void SetWidth( sal_uInt16 nWidth,
bool bRelWidth );
267 const std::shared_ptr<SvxBrushItem>& GetBGBrush()
const {
return m_xBGBrush; }
268 const std::shared_ptr<SvxBoxItem>& GetBoxItem()
const {
return m_xBoxItem; }
270 inline bool GetNumFormat( sal_uInt32& rNumFormat )
const;
271 inline bool GetValue(
double& rValue )
const;
273 sal_Int16 GetVertOri()
const {
return m_eVertOrient; }
276 bool IsUsed()
const {
return m_xContents || m_bProtected; }
278 std::unique_ptr<SwHTMLTableLayoutCell> CreateLayoutInfo();
280 bool IsCovered()
const {
return mbCovered; }
291 std::vector<HTMLTableCell> m_aCells;
292 std::unique_ptr<SvxBrushItem> m_xBGBrush;
295 sal_uInt16 m_nHeight;
296 sal_uInt16 m_nEmptyRows;
297 sal_Int16 m_eVertOri;
298 bool m_bIsEndOfGroup : 1;
299 bool m_bBottomBorder : 1;
303 explicit HTMLTableRow( sal_uInt16 nCells );
305 void SetBottomBorder(
bool bIn) { m_bBottomBorder = bIn; }
306 bool GetBottomBorder()
const {
return m_bBottomBorder; }
308 inline void SetHeight( sal_uInt16 nHeight );
309 sal_uInt16 GetHeight()
const {
return m_nHeight; }
311 const HTMLTableCell& GetCell(sal_uInt16 nCell)
const;
312 HTMLTableCell& GetCell(sal_uInt16 nCell)
314 return const_cast<HTMLTableCell&
>(
const_cast<const HTMLTableRow&
>(*this).GetCell(nCell));
317 void SetAdjust(
SvxAdjust eAdj ) { m_eAdjust = eAdj; }
318 SvxAdjust GetAdjust()
const {
return m_eAdjust; }
320 void SetVertOri( sal_Int16 eV) { m_eVertOri = eV; }
321 sal_Int16 GetVertOri()
const {
return m_eVertOri; }
323 void SetBGBrush(std::unique_ptr<SvxBrushItem>& rBrush ) { m_xBGBrush = std::move(rBrush); }
324 const std::unique_ptr<SvxBrushItem>& GetBGBrush()
const {
return m_xBGBrush; }
326 void SetEndOfGroup() { m_bIsEndOfGroup =
true; }
327 bool IsEndOfGroup()
const {
return m_bIsEndOfGroup; }
329 void IncEmptyRows() { m_nEmptyRows++; }
330 sal_uInt16 GetEmptyRows()
const {
return m_nEmptyRows; }
333 void Expand( sal_uInt16 nCells,
bool bOneCell=
false );
336 void Shrink( sal_uInt16 nCells );
342 bool m_bIsEndOfGroup;
348 sal_Int16 m_eVertOri;
352 static inline sal_uInt16 GetFrameFormatIdx(
bool bBorderLine,
353 sal_Int16 eVertOri );
361 inline void SetWidth( sal_uInt16 nWidth,
bool bRelWidth);
363 void SetAdjust(
SvxAdjust eAdj ) { m_eAdjust = eAdj; }
364 SvxAdjust GetAdjust()
const {
return m_eAdjust; }
366 void SetVertOri( sal_Int16 eV) { m_eVertOri = eV; }
367 sal_Int16 GetVertOri()
const {
return m_eVertOri; }
369 void SetEndOfGroup() { m_bIsEndOfGroup =
true; }
370 bool IsEndOfGroup()
const {
return m_bIsEndOfGroup; }
372 inline void SetFrameFormat(
SwFrameFormat *pFormat,
bool bBorderLine,
373 sal_Int16 eVertOri );
375 sal_Int16 eVertOri )
const;
377 std::unique_ptr<SwHTMLTableLayoutColumn> CreateLayoutInfo();
470 void InitCtor(
const HTMLTableOptions& rOptions);
476 void ProtectRowSpan( sal_uInt16 nRow, sal_uInt16 nCol, sal_uInt16 nRowSpan );
487 sal_uInt16 nRowSpan, sal_uInt16 nColSpan,
488 bool bFirstPara=
true,
bool bLastPara=
true )
const;
500 sal_uInt16 nTopRow, sal_uInt16 nLeftCol,
501 sal_uInt16 nBottomRow, sal_uInt16 nRightCol );
506 sal_uInt16 nTopRow, sal_uInt16 nLeftCol,
507 sal_uInt16 nBootomRow, sal_uInt16 nRightCol );
513 sal_uInt16 nRow, sal_uInt16 nCol,
515 bool bFirstPara,
bool bLastPara );
519 sal_uInt16 nCol, sal_uInt16 nColSpan );
531 bool bWithDistance=
false )
const;
540 bool bParHead,
bool bHasParentSec,
542 const HTMLTableOptions& rOptions);
547 const HTMLTableCell&
GetCell(sal_uInt16 nRow, sal_uInt16 nCell)
const;
548 HTMLTableCell&
GetCell(sal_uInt16 nRow, sal_uInt16 nCell)
550 return const_cast<HTMLTableCell&
>(
const_cast<const HTMLTable&
>(*this).
GetCell(nRow, nCell));
571 void InsertCell( std::shared_ptr<HTMLTableCnts>
const& rCnts, sal_uInt16 nRowSpan, sal_uInt16 nColSpan,
572 sal_uInt16 nWidth,
bool bRelWidth, sal_uInt16 nHeight,
573 sal_Int16 eVertOri, std::shared_ptr<SvxBrushItem>
const& rBGBrushItem,
574 std::shared_ptr<SvxBoxItem>
const& rBoxItem,
575 bool bHasNumFormat, sal_uInt32 nNumFormat,
576 bool bHasValue,
double nValue,
bool bNoWrap );
579 void OpenRow(
SvxAdjust eAdjust, sal_Int16 eVertOri, std::unique_ptr<SvxBrushItem>& rBGBrush);
586 inline void CloseColGroup( sal_uInt16 nSpan, sal_uInt16 nWidth,
bool bRelWidth,
590 void InsertCol( sal_uInt16 nSpan, sal_uInt16 nWidth,
bool bRelWidth,
598 sal_uInt16 nRelAvail=0, sal_uInt16 nAbsLeftSpace=0,
599 sal_uInt16 nAbsRightSpace=0, sal_uInt16 nInhAbsSpace=0 );
614 sal_uInt16 nLeft, sal_uInt16 nRight,
615 const SwTable *pSwTab=
nullptr,
bool bFrcFrame=
false );
648 : m_pStartNode(pStNd)
654 : m_pStartNode(nullptr)
655 , m_xTable(
std::move(xTab))
673 pCnts->
m_pNext = std::move(pNewCnts);
687 std::shared_ptr<SwHTMLTableLayoutCnts> xNextInfo;
689 xNextInfo =
m_pNext->CreateLayoutInfo();
690 std::shared_ptr<SwHTMLTableLayout> xTableInfo;
692 xTableInfo =
m_xTable->CreateLayoutInfo();
699HTMLTableCell::HTMLTableCell():
705 m_eVertOrient(
text::VertOrientation::
NONE ),
707 m_bRelWidth( false ),
708 m_bHasNumFormat(false),
714void HTMLTableCell::Set( std::shared_ptr<HTMLTableCnts>
const& rCnts, sal_uInt16 nRSpan, sal_uInt16 nCSpan,
715 sal_Int16 eVert, std::shared_ptr<SvxBrushItem>
const& rBrush,
716 std::shared_ptr<SvxBoxItem>
const& rBoxItem,
717 bool bHasNF, sal_uInt32 nNF,
bool bHasV,
double nVal,
718 bool bNWrap,
bool bCovered )
723 m_bProtected =
false;
724 m_eVertOrient = eVert;
728 m_bHasNumFormat = bHasNF;
734 mbCovered = bCovered;
737inline void HTMLTableCell::SetWidth( sal_uInt16 nWdth,
bool bRelWdth )
740 m_bRelWidth = bRelWdth;
743void HTMLTableCell::SetProtected()
752 m_xBGBrush = std::make_shared<SvxBrushItem>(*m_xBGBrush);
759inline bool HTMLTableCell::GetNumFormat( sal_uInt32& rNumFormat )
const
761 rNumFormat = m_nNumFormat;
762 return m_bHasNumFormat;
765inline bool HTMLTableCell::GetValue(
double& rValue )
const
771std::unique_ptr<SwHTMLTableLayoutCell> HTMLTableCell::CreateLayoutInfo()
773 std::shared_ptr<SwHTMLTableLayoutCnts> xCntInfo;
775 xCntInfo = m_xContents->CreateLayoutInfo();
776 return std::unique_ptr<SwHTMLTableLayoutCell>(
new SwHTMLTableLayoutCell(xCntInfo, m_nRowSpan, m_nColSpan, m_nWidth,
777 m_bRelWidth, m_bNoWrap));
780HTMLTableRow::HTMLTableRow(sal_uInt16
const nCells)
785 , m_eVertOri(
text::VertOrientation::
TOP)
786 , m_bIsEndOfGroup(false)
787 , m_bBottomBorder(false)
789 assert(nCells == m_aCells.size() &&
790 "wrong Cell count in new HTML table row");
793inline void HTMLTableRow::SetHeight( sal_uInt16 nHght )
795 if( nHght > m_nHeight )
799const HTMLTableCell& HTMLTableRow::GetCell(sal_uInt16 nCell)
const
801 OSL_ENSURE( nCell < m_aCells.size(),
802 "invalid cell index in HTML table row" );
803 return m_aCells.at(nCell);
806void HTMLTableRow::Expand( sal_uInt16 nCells,
bool bOneCell )
811 sal_uInt16 nColSpan = nCells - m_aCells.size();
812 for (sal_uInt16 i = m_aCells.size(); i < nCells; ++i)
814 m_aCells.emplace_back();
816 m_aCells.back().SetColSpan(nColSpan);
820 OSL_ENSURE(nCells == m_aCells.size(),
821 "wrong Cell count in expanded HTML table row");
824void HTMLTableRow::Shrink( sal_uInt16 nCells )
826 OSL_ENSURE(nCells < m_aCells.size(),
"number of cells too large");
828#if OSL_DEBUG_LEVEL > 0
829 sal_uInt16
const nEnd = m_aCells.size();
836 HTMLTableCell& rCell = m_aCells[--
i];
837 if (!rCell.GetContents())
839#if OSL_DEBUG_LEVEL > 0
840 OSL_ENSURE( rCell.GetColSpan() == nEnd - i,
841 "invalid col span for empty cell at row end" );
843 rCell.SetColSpan( nCells-i);
848#if OSL_DEBUG_LEVEL > 0
849 for( i=nCells;
i<nEnd;
i++ )
851 HTMLTableCell& rCell = m_aCells[
i];
852 OSL_ENSURE( rCell.GetRowSpan() == 1,
853 "RowSpan of to be deleted cell is wrong" );
854 OSL_ENSURE( rCell.GetColSpan() == nEnd - i,
855 "ColSpan of to be deleted cell is wrong" );
856 OSL_ENSURE( !rCell.GetContents(),
"To be deleted cell has content" );
860 m_aCells.erase(m_aCells.begin() + nCells, m_aCells.end());
863HTMLTableColumn::HTMLTableColumn():
864 m_bIsEndOfGroup(false),
865 m_nWidth(0), m_bRelWidth(false),
873inline void HTMLTableColumn::SetWidth( sal_uInt16 nWdth,
bool bRelWdth )
875 if( m_bRelWidth==bRelWdth )
877 if( nWdth > m_nWidth )
882 m_bRelWidth = bRelWdth;
885inline std::unique_ptr<SwHTMLTableLayoutColumn> HTMLTableColumn::CreateLayoutInfo()
887 return std::unique_ptr<SwHTMLTableLayoutColumn>(
new SwHTMLTableLayoutColumn( m_nWidth, m_bRelWidth, m_bLeftBorder ));
890inline sal_uInt16 HTMLTableColumn::GetFrameFormatIdx(
bool bBorderLine,
891 sal_Int16 eVertOrient )
893 OSL_ENSURE( text::VertOrientation::TOP != eVertOrient,
"Top is not allowed" );
894 sal_uInt16
n = bBorderLine ? 3 : 0;
895 switch( eVertOrient )
897 case text::VertOrientation::CENTER:
n+=1;
break;
898 case text::VertOrientation::BOTTOM:
n+=2;
break;
905inline void HTMLTableColumn::SetFrameFormat(
SwFrameFormat *pFormat,
bool bBorderLine,
906 sal_Int16 eVertOrient )
908 m_aFrameFormats[GetFrameFormatIdx(bBorderLine,eVertOrient)] = pFormat;
911inline SwFrameFormat *HTMLTableColumn::GetFrameFormat(
bool bBorderLine,
912 sal_Int16 eVertOrient )
const
914 return m_aFrameFormats[GetFrameFormatIdx(bBorderLine,eVertOrient)];
940 const Color& rBorderColor = rOptions.aBorderColor;
945 tools::Long nPHeight = nBorderOpt==USHRT_MAX ? 0 : nBorderOpt;
951 m_nBorder = o3tl::narrowing<sal_uInt16>(nPWidth);
952 if( nBorderOpt==USHRT_MAX )
955 if ( rOptions.nCellSpacing != 0 )
963 if( nPWidth == nPHeight )
969 if ( rOptions.nCellSpacing != 0 )
978 if( rOptions.nCellSpacing != 0 )
979 m_aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE);
1001 nPWidth = rOptions.nHSpace;
1002 nPHeight = rOptions.nVSpace;
1004 m_nHSpace = o3tl::narrowing<sal_uInt16>(nPWidth);
1005 m_nVSpace = o3tl::narrowing<sal_uInt16>(nPHeight);
1010 rOptions.bBGColor ? &(rOptions.aBGColor) :
nullptr,
1011 rOptions.aBGImage, OUString(), OUString(), OUString()));
1016 m_aId = rOptions.aId;
1024 bool bHasParentSec,
bool bHasToFlw,
1025 const HTMLTableOptions& rOptions) :
1026 m_aColumns(rOptions.nCols),
1027 m_nCols(rOptions.nCols),
1028 m_nFilledColumns( 0 ),
1029 m_nCellPadding(rOptions.nCellPadding),
1030 m_nCellSpacing(rOptions.nCellSpacing),
1032 m_pCaptionStartNode( nullptr ),
1033 m_bTableAdjustOfTag( rOptions.bTableAdjust ),
1034 m_bIsParentHead( bParHead ),
1035 m_bHasParentSection( bHasParentSec ),
1036 m_bHasToFly( bHasToFlw ),
1037 m_bFixedCols( rOptions.nCols>0 ),
1038 m_bPercentWidth( rOptions.bPercentWidth ),
1040 m_nWidth( rOptions.nWidth ),
1041 m_nHeight( rOptions.nHeight ),
1042 m_eTableAdjust( rOptions.eAdjust ),
1043 m_eVertOrientation( rOptions.eVertOri ),
1044 m_eFrame( rOptions.eFrame ),
1045 m_eRules( rOptions.eRules ),
1046 m_bTopCaption( false ),
1091 SdrObject *pObj = (*m_xResizeDrawObjects)[
i];
1109 sal_uInt16 nLeftBorderWidth =
1111 sal_uInt16 nRightBorderWidth =
1122 bool bExportable =
true;
1127 for( sal_uInt16 j=0; j<
m_nCols; j++ )
1129 m_xLayoutInfo->SetCell(rRow.GetCell(j).CreateLayoutInfo(),
i, j);
1134 const std::shared_ptr<SwHTMLTableLayoutCnts>& rLayoutCnts =
1136 bExportable = !rLayoutCnts ||
1137 (rLayoutCnts->GetStartNode() && !rLayoutCnts->GetNext());
1159 sal_uInt16 nRowSpan=1;
1162 HTMLTableCell& rCell =
GetCell(nRow, nCol);
1163 if (rCell.GetContents().get() != pCnts)
1165 rCell.SetRowSpan(nRowSpan);
1176 for( sal_uInt16
i=0;
i<nRowSpan;
i++ )
1178 GetCell(nRow+
i,nCol).SetProtected();
1193 pPrevCnts =
GetCell(0, nCol - 1).GetContents().get();
1197 else if( USHRT_MAX==nRow && USHRT_MAX==nCol )
1203 const HTMLTableRow& rPrevRow =
m_aRows[nRow-1];
1210 if( 1 == rPrevRow.GetCell(
i).GetRowSpan() )
1212 pPrevCnts =
GetCell(nRow,
i).GetContents().get();
1221 while( !pPrevCnts &&
i )
1224 pPrevCnts = rPrevRow.GetCell(
i).GetContents().get();
1228 OSL_ENSURE( pPrevCnts,
"No previous filled cell found" );
1231 pPrevCnts =
GetCell(0, 0).GetContents().get();
1236 while( pPrevCnts->
Next() )
1237 pPrevCnts = pPrevCnts->
Next();
1264 if( nRow+nRowSpan ==
m_nRows )
1273 sal_uInt16 nRow, sal_uInt16 nCol,
1274 sal_uInt16 nRowSpan, sal_uInt16 nColSpan,
1275 bool bFirstPara,
bool bLastPara )
const
1280 std::shared_ptr<SvxBoxItem> pBoxItem;
1281 bool bTopLine =
false, bBottomLine =
false, bLastBottomLine =
false;
1282 bool bReUsable =
false;
1283 sal_uInt16 nEmptyRows = 0;
1284 bool bHasNumFormat =
false;
1285 bool bHasValue =
false;
1286 sal_uInt32 nNumFormat = 0;
1289 const HTMLTableColumn& rColumn =
m_aColumns[nCol];
1294 const HTMLTableCell& rCell =
GetCell(nRow, nCol);
1295 pBoxItem = rCell.GetBoxItem();
1296 pBGBrushItem = rCell.GetBGBrush().get();
1302 pBGBrushItem =
m_aRows[nRow].GetBGBrush().get();
1307 if (
m_aRows[nRow+nRowSpan-1].GetBottomBorder() && bLastPara)
1309 nEmptyRows =
m_aRows[nRow+nRowSpan-1].GetEmptyRows();
1310 if( nRow+nRowSpan ==
m_nRows )
1311 bLastBottomLine =
true;
1316 eVOri = rCell.GetVertOri();
1317 bHasNumFormat = rCell.GetNumFormat( nNumFormat );
1319 bHasValue = rCell.GetValue(
nValue );
1321 if( nColSpan==1 && !bTopLine && !bLastBottomLine && !nEmptyRows &&
1322 !pBGBrushItem && !bHasNumFormat && !pBoxItem)
1324 pFrameFormat = rColumn.GetFrameFormat( bBottomLine, eVOri );
1325 bReUsable = !pFrameFormat;
1335 ->GetRelColWidth());
1336 for( sal_uInt16
i=1;
i<nColSpan;
i++ )
1338 ->GetRelColWidth());
1355 if( bLastBottomLine )
1360 else if( bBottomLine )
1369 aThickBorderLine.SetBorderLineStyle(SvxBorderLineStyle::SOLID);
1371 aBoxItem.
SetLine( &aThickBorderLine, SvxBoxItemLine::BOTTOM );
1381 const SvxBorderLine& rBorderLine =
1383 aBoxItem.
SetLine( &rBorderLine, SvxBoxItemLine::LEFT );
1401 sal_uInt16 nBDist =
static_cast< sal_uInt16
>(
1403 : (nInnerFrameWidth / 2) );
1420 if( bHasNumFormat && (bHasValue || pBox->
IsEmpty()) )
1446 pFrameFormat->LockModify();
1449 pFrameFormat->UnlockModify();
1450 else if( pCNd && SvxAdjust::End != eAdjust )
1459 OSL_ENSURE( eVOri != text::VertOrientation::TOP,
"text::VertOrientation::TOP is not allowed!" );
1468 const_cast<HTMLTableColumn&
>(rColumn).SetFrameFormat(pFrameFormat, bBottomLine, eVOri);
1502 "Box without content has vertical orientation" );
1531 "Cell has vertical orientation" );
1536 sal_uInt16 nTopRow, sal_uInt16 nLeftCol,
1537 sal_uInt16 nBottomRow, sal_uInt16 nRightCol )
1540 if (!pUpper && 0 == nTopRow)
1547 const HTMLTableRow& rTopRow =
m_aRows[nTopRow];
1548 sal_uInt16 nRowHeight = rTopRow.GetHeight();
1550 if (nTopRow > 0 || nBottomRow <
m_nRows)
1554 pBGBrushItem = rTopRow.GetBGBrush().get();
1556 if( nTopRow==nBottomRow-1 && (nRowHeight || pBGBrushItem) )
1587 sal_uInt16 nStartCol = nLeftCol;
1588 while( nStartCol<nRightCol )
1590 sal_uInt16 nCol = nStartCol;
1591 sal_uInt16 nSplitCol = nRightCol;
1592 bool bSplitted =
false;
1595 OSL_ENSURE( nCol < nRightCol,
"Gone too far" );
1597 HTMLTableCell& rCell =
GetCell(nTopRow,nCol);
1598 const bool bSplit = 1 == rCell.GetColSpan();
1600 OSL_ENSURE((nCol != nRightCol-1) || bSplit,
"Split-Flag wrong");
1604 HTMLTableCell& rCell2 =
GetCell(nTopRow, nStartCol);
1605 if (rCell2.GetColSpan() == (nCol+1-nStartCol))
1608 nSplitCol = nCol + 1;
1610 sal_Int32 nBoxRowSpan = rCell2.GetRowSpan();
1611 if (!rCell2.GetContents() || rCell2.IsCovered())
1613 if (rCell2.IsCovered())
1614 nBoxRowSpan = -1 * nBoxRowSpan;
1618 auto xCnts = std::make_shared<HTMLTableCnts>(
1620 const std::shared_ptr<SwHTMLTableLayoutCnts> xCntsLayoutInfo =
1621 xCnts->CreateLayoutInfo();
1623 rCell2.SetContents(xCnts);
1626 if( nBoxRowSpan < 0 )
1630 for( sal_uInt16 j=nStartCol+1; j<nSplitCol; j++ )
1632 GetCell(nTopRow, j).SetContents(xCnts);
1634 ->SetContents(xCntsLayoutInfo);
1640 nBottomRow, nSplitCol);
1642 if (1 != nBoxRowSpan && pBox)
1648 OSL_ENSURE( pBox,
"Colspan trouble" );
1651 rBoxes.push_back( pBox );
1655 nStartCol = nSplitCol;
1663 sal_uInt16 nTopRow, sal_uInt16 nLeftCol,
1664 sal_uInt16 nBottomRow, sal_uInt16 nRightCol )
1667 sal_uInt16 nColSpan = nRightCol - nLeftCol;
1668 sal_uInt16 nRowSpan = nBottomRow - nTopRow;
1670 if( !pCnts->
Next() )
1681 pTable->InheritVertBorders(
this, nLeftCol,
1682 nRightCol-nLeftCol );
1686 sal_uInt16 nAbs, nRel;
1688 sal_uInt16 nLSpace =
m_xLayoutInfo->GetLeftCellSpace( nLeftCol, nColSpan );
1689 sal_uInt16 nRSpace =
m_xLayoutInfo->GetRightCellSpace( nLeftCol, nColSpan );
1690 sal_uInt16 nInhSpace =
m_xLayoutInfo->GetInhCellSpace( nLeftCol, nColSpan );
1691 pCnts->
GetTable()->MakeTable( pBox, nAbs, nRel, nLSpace, nRSpace,
1704 bool bFirstPara =
true;
1726 bFirstPara,
nullptr==pCnts->
Next() );
1733 pCnts->
GetTable()->InheritVertBorders(
this, nLeftCol,
1734 nRightCol-nLeftCol );
1736 sal_uInt16 nAbs, nRel;
1738 sal_uInt16 nLSpace =
m_xLayoutInfo->GetLeftCellSpace( nLeftCol,
1740 sal_uInt16 nRSpace =
m_xLayoutInfo->GetRightCellSpace( nLeftCol,
1742 sal_uInt16 nInhSpace =
m_xLayoutInfo->GetInhCellSpace( nLeftCol, nColSpan );
1743 pCnts->
GetTable()->MakeTable( pBox, nAbs, nRel, nLSpace,
1744 nRSpace, nInhSpace );
1747 pCnts = pCnts->
Next();
1758 sal_uInt16 nRow, sal_uInt16 nCol,
1759 sal_uInt16 nRowSpan,
1760 bool bFirstPara,
bool bLastPara )
1763 "Was CloseTable not called?" );
1776 if (pParent->
m_aRows[nRow+nRowSpan-1].GetBottomBorder() && bLastPara)
1788 (0==nRow || !pParent->
m_aRows[nRow-1].GetBottomBorder())) );
1792 if( !pInhBG && pParent !=
this &&
1797 pInhBG = pParent->
m_aRows[nRow].GetBGBrush().get();
1808 sal_uInt16 nCol, sal_uInt16 nColSpan )
1810 sal_uInt16 nInhLeftBorderWidth = 0;
1811 sal_uInt16 nInhRightBorderWidth = 0;
1817 nInhRightBorderWidth =
1826 nInhLeftBorderWidth =
1835 nInhRightBorderWidth );
1838 (nCol+nColSpan==pParent->
m_nCols ||
1839 !pParent->
m_aColumns[nCol+nColSpan].m_bLeftBorder) );
1880 for (sal_uInt16 j=0; j<
m_nCols; ++j)
1882 HTMLTableCell& rCell = rRow.GetCell(j);
1883 if (rCell.GetContents())
1886 bool bFirstPara =
true;
1895 nullptr==pCnts->
Next());
1899 pCnts = pCnts->
Next();
1909 bool bWithDistance )
const
1925 OSL_ENSURE(nRow <
m_aRows.size(),
"invalid row index in HTML table");
1926 return m_aRows[nRow].GetCell(nCell);
1933 if( SvxAdjust::End==eAdjust )
1945 if( text::VertOrientation::TOP==eVOri )
1948 OSL_ENSURE(
m_eVertOrientation != text::VertOrientation::TOP,
"text::VertOrientation::TOP is not allowed!" );
1953 sal_uInt16 nRowSpan, sal_uInt16 nColSpan,
1954 sal_uInt16 nCellWidth,
bool bRelWidth, sal_uInt16 nCellHeight,
1955 sal_Int16 eVertOrient, std::shared_ptr<SvxBrushItem>
const& rBGBrushItem,
1956 std::shared_ptr<SvxBoxItem>
const& rBoxItem,
1957 bool bHasNumFormat, sal_uInt32 nNumFormat,
1958 bool bHasValue,
double nValue,
bool bNoWrap )
1960 if( !nRowSpan ||
static_cast<sal_uInt32
>(
m_nCurrentRow) + nRowSpan > USHRT_MAX )
1963 if( !nColSpan ||
static_cast<sal_uInt32
>(
m_nCurrentColumn) + nColSpan > USHRT_MAX )
1978 "wrong number of columns after expanding");
1989 OSL_ENSURE(
m_nRows ==
m_aRows.size(),
"wrong number of rows in Insert");
1993 sal_uInt16 nSpanedCols = 0;
1999 HTMLTableCell& rCell = rCurRow.GetCell(
i);
2000 if (rCell.GetContents())
2005 nSpanedCols =
i + rCell.GetColSpan();
2007 if (rCell.GetRowSpan() > nRowSpan)
2009 rCell.GetRowSpan()-nRowSpan );
2012 for(
i=nColsReq;
i<nSpanedCols;
i++ )
2015 HTMLTableCell& rCell = rCurRow.GetCell(
i);
2022 for(
i=nColSpan;
i>0;
i-- )
2024 for( j=nRowSpan; j>0; j-- )
2026 const bool bCovered =
i != nColSpan || j != nRowSpan;
2028 .Set( rCnts, j,
i, eVertOrient, rBGBrushItem,
rBoxItem,
2029 bHasNumFormat, nNumFormat, bHasValue,
nValue, bNoWrap, bCovered );
2043 sal_uInt16 nTmp = bRelWidth ?
nCellWidth : o3tl::narrowing<sal_uInt16>(aTwipSz.
Width());
2074 std::unique_ptr<SvxBrushItem>& rBGBrushItem)
2085 "Row number in OpenRow is wrong" );
2089 rCurRow.SetAdjust(eAdjust);
2090 rCurRow.SetVertOri(eVertOrient);
2121 HTMLTableCell& rCell = rRow.GetCell(--
i);
2122 if (!rCell.GetContents())
2126 rCell.SetColSpan(nColSpan);
2137 sal_Int16 eVertOrient )
2140 InsertCol( nSpan, _nWidth, bRelWidth, eAdjust, eVertOrient );
2148 SvxAdjust eAdjust, sal_Int16 eVertOrient )
2167 Size aTwipSz( bRelWidth ? 0 : nColWidth, 0 );
2177 sal_uInt16 nTmp = bRelWidth ? nColWidth : o3tl::narrowing<sal_uInt16>(aTwipSz.
Width());
2178 rCol.SetWidth( nTmp, bRelWidth );
2179 rCol.SetAdjust( eAdjust );
2180 rCol.SetVertOri( eVertOrient );
2200 HTMLTableCell& rCell = rPrevRow.GetCell(
i);
2201 if (rCell.GetRowSpan() > 1)
2283 sal_uInt16 nRelAvail, sal_uInt16 nAbsLeftSpace,
2284 sal_uInt16 nAbsRightSpace, sal_uInt16 nInhAbsSpace )
2287 "Was CloseTable not called?" );
2289 OSL_ENSURE(
m_xLayoutInfo ==
nullptr,
"Table already has layout info");
2307 m_xLayoutInfo->AutoLayoutPass2( nAbsAvail, nRelAvail, nAbsLeftSpace,
2308 nAbsRightSpace, nInhAbsSpace );
2317 eHoriOri =
m_bPercentWidth ? text::HoriOrientation::FULL : text::HoriOrientation::LEFT;
2324 case SvxAdjust::Right:
2326 eHoriOri = text::HoriOrientation::RIGHT;
2328 case SvxAdjust::Center:
2330 eHoriOri = text::HoriOrientation::CENTER;
2332 case SvxAdjust::Left:
2335 eHoriOri =
m_nLeftMargin ? text::HoriOrientation::LEFT_AND_WIDTH : text::HoriOrientation::LEFT;
2348 if (text::HoriOrientation::LEFT_AND_WIDTH == eHoriOri)
2351 "There are still leftovers from relative margins" );
2362 pFrameFormat->LockModify();
2366 pFrameFormat->UnlockModify();
2406 if (eAdjust != SvxAdjust::Left &&
2407 eAdjust != SvxAdjust::Right)
2412 OSL_ENSURE(
HasToFly(),
"Why is the table in a frame?" );
2414 if( nMin > USHRT_MAX )
2418 m_pContext->GetFrameFormat()->SetFormatAttr( aFlyFrameSize );
2419 bIsInFlyFrame =
false;
2426 if(
m_pContext->GetFrameFormat()->GetAnchor().GetAnchorNode()
2430 if( nMax > USHRT_MAX )
2433 m_pContext->GetFrameFormat()->SetFormatAttr( aFlyFrameSize );
2434 bIsInFlyFrame =
false;
2450 SAL_WARN(
"sw.html",
"no table box");
2460 SdrObject *pObj = (*m_xResizeDrawObjects)[
i];
2461 sal_uInt16 nRow = (*m_xDrawObjectPercentWidths)[3*
i];
2462 sal_uInt16 nCol = (*m_xDrawObjectPercentWidths)[3*
i+1];
2467 sal_uInt16 nColSpan = pLayoutCell->
GetColSpan();
2469 sal_uInt16 nWidth2, nDummy;
2471 nWidth2 =
static_cast< sal_uInt16
>((
static_cast<tools::Long>(
m_nWidth) * nPercentWidth) / 100);
2479 sal_uInt16 nLeft, sal_uInt16 nRight,
2480 const SwTable *pSwTab,
bool bFrcFrame )
2517void HTMLTableContext::SavePREListingXMP(
SwHTMLParser& rParser )
2519 m_bRestartPRE = rParser.IsReadPRE();
2520 m_bRestartXMP = rParser.IsReadXMP();
2521 m_bRestartListing = rParser.IsReadListing();
2522 rParser.FinishPREListingXMP();
2525void HTMLTableContext::RestorePREListingXMP(
SwHTMLParser& rParser )
2527 rParser.FinishPREListingXMP();
2535 if( m_bRestartListing )
2536 rParser.StartListing();
2542 OSL_ENSURE( pPrevStNd,
"Start-Node is NULL" );
2569 eState = SvParserState::Error;
2578 pCNd->
SetAttr( aFontHeightCJK );
2580 pCNd->
SetAttr( aFontHeightCTL );
2606 eState = SvParserState::Error;
2618 eState = SvParserState::Error;
2626 pTableNd = pOutTable;
2639 eState = SvParserState::Error;
2658 sal_Int32 nStripped = 0;
2673 sal_Int32
nPos = nLen;
2674 sal_Int32 nLFCount = 0;
2691 nPos = nLen - nLFCount;
2694 nStripped = nLFCount;
2703 const OUString& rImageURL,
2704 const OUString& rStyle,
2705 const OUString& rId,
2706 const OUString& rClass )
2710 if( !rStyle.isEmpty() || !rId.isEmpty() || !rClass.isEmpty() )
2715 if( !rClass.isEmpty() )
2717 OUString aClass( rClass );
2724 if( !rId.isEmpty() )
2731 m_pCSS1Parser->ParseStyleOption( rStyle, aItemSet, aPropInfo );
2738 if( !pBrushItem && (pColor || !rImageURL.isEmpty()) )
2745 if( !rImageURL.isEmpty() )
2768#if OSL_DEBUG_LEVEL > 0
2775 m_nBaseFontStMinSave(rParser.m_nBaseFontStMin),
2776 m_nFontStMinSave(rParser.m_nFontStMin),
2777 m_nFontStHeadStartSave(rParser.m_nFontStHeadStart),
2778 m_nDefListDeepSave(rParser.m_nDefListDeep),
2779 m_nContextStMinSave(rParser.m_nContextStMin),
2780 m_nContextStAttrMinSave(rParser.m_nContextStAttrMin)
2813 "The Context Stack was not cleaned up" );
2860 void AddContents( std::unique_ptr<HTMLTableCnts> pNewCnts );
2876 bool bHd,
bool bReadOpt ) :
2878 m_pCurrCnts( nullptr ),
2885 m_nNoBreakEndContentPos( 0 ),
2886 m_eVertOri( pCurTable->GetInheritedVertOri() ),
2888 m_bPercentWidth( false ),
2889 m_bHasNumFormat( false ),
2890 m_bHasValue( false ),
2891 m_bBGColor( false ),
2895 OUString aNumFormat, aValue, aDir, aLang;
2900 const HTMLOptions& rOptions = rParser.GetOptions();
2901 for (
size_t i = rOptions.size();
i; )
2906 case HtmlOptionId::ID:
2909 case HtmlOptionId::COLSPAN:
2917 case HtmlOptionId::ROWSPAN:
2925 case HtmlOptionId::ALIGN:
2928 case HtmlOptionId::VALIGN:
2931 case HtmlOptionId::WIDTH:
2937 case HtmlOptionId::HEIGHT:
2939 if( rOption.
GetString().indexOf(
'%') != -1)
2942 case HtmlOptionId::BGCOLOR:
2951 case HtmlOptionId::BACKGROUND:
2954 case HtmlOptionId::STYLE:
2957 case HtmlOptionId::CLASS:
2960 case HtmlOptionId::LANG:
2963 case HtmlOptionId::DIR:
2966 case HtmlOptionId::SDNUM:
2970 case HtmlOptionId::SDVAL:
2974 case HtmlOptionId::NOWRAP:
2981 if( !
m_aId.isEmpty() )
2990 *rParser.
m_xDoc->GetNumberFormatter() );
2999 nToken = HtmlTokenId::TABLEHEADER_ON;
3004 nToken = HtmlTokenId::TABLEDATA_ON;
3008 if( SvxAdjust::End != eAdjust )
3019 aPropInfo, &aLang, &aDir ) )
3026 rParser.
InsertAttrs(aItemSet, aPropInfo, xCntxt.get());
3040 m_xCnts->Add( std::move(pNewCnts) );
3042 m_xCnts = std::move(pNewCnts);
3048#if OSL_DEBUG_LEVEL > 0
3069 OSL_ENSURE( !*pTable,
"The attribute table isn't empty" );
3075 std::shared_ptr<SvxBrushItem> xBrushItem(
3090 m_xCnts->GetStartNode()->GetIndex() + 1 ==
3132 if(
' '==cLast ||
'\x0a'==cLast )
3165 HTMLAttr *pAttr = *pHTMLAttributes;
3168 OSL_ENSURE( !pAttr->
GetPrev(),
"Attribute has previous list" );
3178 return std::make_unique<HTMLTableCnts>( pStNd );
3199 std::unique_ptr<CellSaveStruct> xSaveStruct;
3202 bool bPending =
false;
3209 bPending = SvParserState::Error == eState && !
m_vPendingStack.empty();
3218 SaveState( HtmlTokenId::NONE );
3224 bool bTopTable =
m_xTable.get() == pCurTable;
3237 > aItemSet(
m_xDoc->GetAttrPool() );
3243 aItemSet, aPropInfo,
3262 sal_uInt16 nLeftSpace = 0;
3263 sal_uInt16 nRightSpace = 0;
3269 bool bForceFrame =
false;
3270 bool bAppended =
false;
3271 bool bParentLFStripped =
false;
3278 bForceFrame = eTableAdjust == SvxAdjust::Left ||
3279 eTableAdjust == SvxAdjust::Right ||
3286 "table in frame has no parent!" );
3288 bool bAppend =
false;
3365 std::unique_ptr<HTMLTableContext> pTCntxt(
3370 std::optional<std::deque<std::unique_ptr<HTMLAttr>>> pPostIts;
3379 if( (bTopTable && !bAppended) ||
3380 (!bTopTable && !bParentLFStripped &&
3383 SetAttr( bTopTable, bTopTable, pPostIts ? &*pPostIts :
nullptr );
3388 if( bTopTable && !bAppended )
3391 SetAttr(
true,
true, &*pPostIts );
3399 pTCntxt->SavePREListingXMP( *
this );
3408 aFrameSet(
m_xDoc->GetAttrPool() );
3412 css::text::WrapTextMode eSurround = css::text::WrapTextMode_NONE;
3417 case SvxAdjust::Right:
3418 eHori = text::HoriOrientation::RIGHT;
3419 eSurround = css::text::WrapTextMode_LEFT;
3421 case SvxAdjust::Center:
3422 eHori = text::HoriOrientation::CENTER;
3424 case SvxAdjust::Left:
3425 eSurround = css::text::WrapTextMode_RIGHT;
3428 eHori = text::HoriOrientation::LEFT;
3439 aFrameSet.Put( aFrameSize );
3441 sal_uInt16 nSpace = pCurTable->
GetHSpace();
3454 pTCntxt->SetFrameFormat( pFrameFormat );
3464 "The paragraph after the table is not empty!" );
3474 m_xDoc->GetNodes().Delete( aDstIdx );
3478 if (bStyleParsed && pFrameFormat)
3487 SwTextNode *
const pOldTextNd = (!bAppended && !bForceFrame) ?
3490 if (pFrameFormat && pOldTextNd)
3494 if( pPageDescItem && pPageDescItem->
GetPageDesc() )
3503 switch( pBreakItem->GetBreak() )
3505 case SvxBreak::PageBefore:
3506 case SvxBreak::PageAfter:
3507 case SvxBreak::PageBoth:
3517 if( !bAppended && pPostIts )
3526 auto pTableNode = pTCntxt->GetTableNode();
3527 pCurTable->
SetTable( pTableNode, std::move(pTCntxt),
3528 nLeftSpace, nRightSpace,
3529 pSwTable, bForceFrame );
3531 OSL_ENSURE( !pPostIts,
"unused PostIts" );
3537 bParentLFStripped =
false;
3543 if( !bParentLFStripped )
3558 pCurTable->
SetTable( pStNd, std::move(pTCntxt), nLeftSpace, nRightSpace );
3568 xSaveStruct.reset(
new CellSaveStruct(*
this, pCurTable, bHead, bReadOptions));
3571 SaveState( HtmlTokenId::NONE );
3574 if(
nToken == HtmlTokenId::NONE )
3578 while( (IsParserWorking() && !bDone) || bPending )
3585 "Where is the section??" );
3593 case HtmlTokenId::TABLEHEADER_ON:
3594 case HtmlTokenId::TABLEDATA_ON:
3595 case HtmlTokenId::TABLEROW_ON:
3596 case HtmlTokenId::TABLEROW_OFF:
3597 case HtmlTokenId::THEAD_ON:
3598 case HtmlTokenId::THEAD_OFF:
3599 case HtmlTokenId::TFOOT_ON:
3600 case HtmlTokenId::TFOOT_OFF:
3601 case HtmlTokenId::TBODY_ON:
3602 case HtmlTokenId::TBODY_OFF:
3603 case HtmlTokenId::TABLE_OFF:
3606 case HtmlTokenId::TABLEHEADER_OFF:
3607 case HtmlTokenId::TABLEDATA_OFF:
3610 case HtmlTokenId::TABLE_ON:
3612 bool bHasToFly =
false;
3621 if( !xSaveStruct->IsInSection() )
3625 bool bNeedsSection =
false;
3627 for (
const auto & rOption : rHTMLOptions)
3629 if( HtmlOptionId::ALIGN==rOption.GetToken() )
3632 bNeedsSection = SvxAdjust::Left == eAdjust ||
3633 SvxAdjust::Right == eAdjust;
3639 xSaveStruct->AddContents(
3657 std::shared_ptr<HTMLTable> xSubTable =
BuildTable(eTabAdjust,
3659 xSaveStruct->IsInSection(),
3661 if( SvParserState::Pending != GetStatus() )
3666 OSL_ENSURE( xSubTable->GetTableAdjust(
false)!= SvxAdjust::Left &&
3667 xSubTable->GetTableAdjust(
false)!= SvxAdjust::Right,
3668 "left or right aligned tables belong in frames" );
3670 auto& rParentContents = xSubTable->GetParentContents();
3671 if (rParentContents)
3673 OSL_ENSURE( !xSaveStruct->IsInSection(),
3674 "Where is the section" );
3677 xSaveStruct->AddContents(std::move(rParentContents));
3681 xSubTable->GetCaptionStartNode();
3683 if (xSubTable->GetContext())
3685 OSL_ENSURE( !xSubTable->GetContext()->GetFrameFormat(),
3688 if( pCapStNd && xSubTable->IsTopCaption() )
3690 xSaveStruct->AddContents(
3691 std::make_unique<HTMLTableCnts>(pCapStNd) );
3694 xSaveStruct->AddContents(
3695 std::make_unique<HTMLTableCnts>(xSubTable) );
3697 if( pCapStNd && !xSubTable->IsTopCaption() )
3699 xSaveStruct->AddContents(
3700 std::make_unique<HTMLTableCnts>(pCapStNd) );
3704 xSaveStruct->ClearIsInSection();
3710 xSaveStruct->AddContents(
3711 std::make_unique<HTMLTableCnts>(pCapStNd) );
3714 xSaveStruct->ClearIsInSection();
3723 case HtmlTokenId::NOBR_ON:
3728 case HtmlTokenId::NOBR_OFF:
3732 case HtmlTokenId::COMMENT:
3738 case HtmlTokenId::MARQUEE_ON:
3739 if( !xSaveStruct->IsInSection() )
3742 xSaveStruct->AddContents(
3749 case HtmlTokenId::TEXTTOKEN:
3751 if( !xSaveStruct->IsInSection() && 1==aToken.getLength() &&
3756 if( !xSaveStruct->IsInSection() )
3759 xSaveStruct->AddContents(
3763 if( IsParserWorking() || bPending )
3769 "SwHTMLParser::BuildTableCell: There is a PendStack again" );
3771 if( IsParserWorking() )
3772 SaveState( HtmlTokenId::NONE );
3778 if( SvParserState::Pending == GetStatus() )
3781 : HtmlTokenId::TABLEDATA_ON );
3791 if( !xSaveStruct->HasFirstContents() ||
3792 (!xSaveStruct->IsInSection() && !pCurTable->
HasColTags()) )
3794 OSL_ENSURE( xSaveStruct->HasFirstContents() ||
3795 !xSaveStruct->IsInSection(),
3796 "Section or not, that is the question here" );
3803 eState = SvParserState::Error;
3809 eState = SvParserState::Error;
3816 pCNd->
SetAttr( aFontHeightCJK );
3818 pCNd->
SetAttr( aFontHeightCTL );
3822 xSaveStruct->AddContents( std::make_unique<HTMLTableCnts>(pStNd) );
3823 xSaveStruct->ClearIsInSection();
3826 if( xSaveStruct->IsInSection() )
3834 std::unique_ptr<HTMLAttrContext> xCntxt(
PopContext());
3841 HTMLTableContext* pTableContext =
m_xTable ?
m_xTable->GetContext() :
nullptr;
3842 SwPosition* pSavedPos = pTableContext ? pTableContext->GetPos() :
nullptr;
3849 std::unique_ptr<HTMLAttrContext> xCntxt(
PopContext());
3858 std::unique_ptr<HTMLAttrContext> xCntxt(
PopContext());
3870 xSaveStruct->InsertCell( *
this, pCurTable );
3873 xSaveStruct.reset();
3894 sal_Int16 eGrpVertOri )
3902 std::unique_ptr<RowSaveStruct> xSaveStruct;
3904 bool bPending =
false;
3907 xSaveStruct.reset(
static_cast<RowSaveStruct*
>(
m_vPendingStack.back().pData.release()));
3911 bPending = SvParserState::Error == eState && !
m_vPendingStack.empty();
3918 sal_Int16 eVertOri = eGrpVertOri;
3920 OUString aBGImage, aStyle, aId, aClass;
3921 bool bBGColor =
false;
3922 xSaveStruct.reset(
new RowSaveStruct);
3927 for (
size_t i = rHTMLOptions.size();
i; )
3932 case HtmlOptionId::ID:
3935 case HtmlOptionId::ALIGN:
3938 case HtmlOptionId::VALIGN:
3941 case HtmlOptionId::BGCOLOR:
3950 case HtmlOptionId::BACKGROUND:
3953 case HtmlOptionId::STYLE:
3956 case HtmlOptionId::CLASS:
3964 if( !aId.isEmpty() )
3967 std::unique_ptr<SvxBrushItem> xBrushItem(
3970 pCurTable->
OpenRow(eAdjust, eVertOri, xBrushItem);
3972 SaveState( HtmlTokenId::NONE );
3975 if(
nToken == HtmlTokenId::NONE )
3979 while( (IsParserWorking() && !bDone) || bPending )
3987 "Where is the section??" );
3996 case HtmlTokenId::TABLE_ON:
4004 case HtmlTokenId::TABLEROW_ON:
4005 case HtmlTokenId::THEAD_ON:
4006 case HtmlTokenId::THEAD_OFF:
4007 case HtmlTokenId::TBODY_ON:
4008 case HtmlTokenId::TBODY_OFF:
4009 case HtmlTokenId::TFOOT_ON:
4010 case HtmlTokenId::TFOOT_OFF:
4011 case HtmlTokenId::TABLE_OFF:
4014 case HtmlTokenId::TABLEROW_OFF:
4017 case HtmlTokenId::TABLEHEADER_ON:
4018 case HtmlTokenId::TABLEDATA_ON:
4020 if( SvParserState::Pending != GetStatus() )
4022 xSaveStruct->bHasCells =
true;
4026 case HtmlTokenId::CAPTION_ON:
4030 case HtmlTokenId::CAPTION_OFF:
4031 case HtmlTokenId::TABLEHEADER_OFF:
4032 case HtmlTokenId::TABLEDATA_OFF:
4033 case HtmlTokenId::COLGROUP_ON:
4034 case HtmlTokenId::COLGROUP_OFF:
4035 case HtmlTokenId::COL_ON:
4036 case HtmlTokenId::COL_OFF:
4040 case HtmlTokenId::MULTICOL_ON:
4043 case HtmlTokenId::FORM_ON:
4046 case HtmlTokenId::FORM_OFF:
4049 case HtmlTokenId::COMMENT:
4052 case HtmlTokenId::MAP_ON:
4056 case HtmlTokenId::TEXTTOKEN:
4059 1==aToken.getLength() &&
' '==aToken[0] )
4069 "SwHTMLParser::BuildTableRow: There is a PendStack again" );
4071 if( IsParserWorking() )
4072 SaveState( HtmlTokenId::NONE );
4078 if( SvParserState::Pending == GetStatus() )
4085 pCurTable->
CloseRow(!xSaveStruct->bHasCells);
4086 xSaveStruct.reset();
4101 bool bPending =
false;
4102 std::unique_ptr<RowSaveStruct> xSaveStruct;
4106 xSaveStruct.reset(
static_cast<RowSaveStruct*
>(
m_vPendingStack.back().pData.release()));
4110 bPending = SvParserState::Error == eState && !
m_vPendingStack.empty();
4116 xSaveStruct.reset(
new RowSaveStruct);
4121 for (
size_t i = rHTMLOptions.size();
i; )
4126 case HtmlOptionId::ID:
4129 case HtmlOptionId::ALIGN:
4130 xSaveStruct->eAdjust =
4133 case HtmlOptionId::VALIGN:
4134 xSaveStruct->eVertOri =
4136 xSaveStruct->eVertOri );
4144 SaveState( HtmlTokenId::NONE );
4147 if(
nToken == HtmlTokenId::NONE )
4151 while( (IsParserWorking() && !bDone) || bPending )
4159 "Where is the section?" );
4168 case HtmlTokenId::TABLE_ON:
4176 case HtmlTokenId::THEAD_ON:
4177 case HtmlTokenId::TFOOT_ON:
4178 case HtmlTokenId::TBODY_ON:
4179 case HtmlTokenId::TABLE_OFF:
4182 case HtmlTokenId::THEAD_OFF:
4183 case HtmlTokenId::TBODY_OFF:
4184 case HtmlTokenId::TFOOT_OFF:
4187 case HtmlTokenId::CAPTION_ON:
4191 case HtmlTokenId::CAPTION_OFF:
4193 case HtmlTokenId::TABLEHEADER_ON:
4194 case HtmlTokenId::TABLEDATA_ON:
4197 xSaveStruct->eVertOri );
4200 case HtmlTokenId::TABLEROW_ON:
4202 xSaveStruct->eVertOri );
4205 case HtmlTokenId::MULTICOL_ON:
4208 case HtmlTokenId::FORM_ON:
4211 case HtmlTokenId::FORM_OFF:
4214 case HtmlTokenId::TEXTTOKEN:
4218 1==aToken.getLength() &&
' ' == aToken[0] )
4227 "SwHTMLParser::BuildTableSection: There is a PendStack again" );
4229 if( IsParserWorking() )
4230 SaveState( HtmlTokenId::NONE );
4236 if( SvParserState::Pending == GetStatus() )
4239 : HtmlTokenId::TBODY_ON );
4245 xSaveStruct.reset();
4255 sal_uInt16 nColGrpSpan;
4256 sal_uInt16 nColGrpWidth;
4257 bool bRelColGrpWidth;
4259 sal_Int16 eColGrpVertOri;
4261 inline TableColGrpSaveStruct();
4263 inline void CloseColGroup(
HTMLTable *pTable );
4268inline TableColGrpSaveStruct::TableColGrpSaveStruct() :
4269 nColGrpSpan( 1 ), nColGrpWidth( 0 ),
4270 bRelColGrpWidth( false ), eColGrpAdjust(
SvxAdjust::
End ),
4271 eColGrpVertOri(
text::VertOrientation::
TOP )
4274inline void TableColGrpSaveStruct::CloseColGroup(
HTMLTable *pTable )
4277 bRelColGrpWidth, eColGrpAdjust, eColGrpVertOri );
4289 bool bPending =
false;
4290 std::unique_ptr<TableColGrpSaveStruct> pSaveStruct;
4294 pSaveStruct.reset(
static_cast<TableColGrpSaveStruct*
>(
m_vPendingStack.back().pData.release()));
4299 bPending = SvParserState::Error == eState && !
m_vPendingStack.empty();
4306 pSaveStruct.reset(
new TableColGrpSaveStruct);
4310 for (
size_t i = rColGrpOptions.size();
i; )
4315 case HtmlOptionId::ID:
4318 case HtmlOptionId::SPAN:
4319 pSaveStruct->nColGrpSpan = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
4320 if (pSaveStruct->nColGrpSpan > 256)
4322 SAL_INFO(
"sw.html",
"ignoring huge SPAN " << pSaveStruct->nColGrpSpan);
4323 pSaveStruct->nColGrpSpan = 1;
4326 case HtmlOptionId::WIDTH:
4327 pSaveStruct->nColGrpWidth = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
4328 pSaveStruct->bRelColGrpWidth =
4329 (rOption.
GetString().indexOf(
'*') != -1);
4331 case HtmlOptionId::ALIGN:
4332 pSaveStruct->eColGrpAdjust =
4335 case HtmlOptionId::VALIGN:
4336 pSaveStruct->eColGrpVertOri =
4338 pSaveStruct->eColGrpVertOri );
4345 SaveState( HtmlTokenId::NONE );
4348 if(
nToken == HtmlTokenId::NONE )
4352 while( (IsParserWorking() && !bDone) || bPending )
4360 "Where is the section?" );
4369 case HtmlTokenId::TABLE_ON:
4377 case HtmlTokenId::COLGROUP_ON:
4378 case HtmlTokenId::THEAD_ON:
4379 case HtmlTokenId::TFOOT_ON:
4380 case HtmlTokenId::TBODY_ON:
4381 case HtmlTokenId::TABLEROW_ON:
4382 case HtmlTokenId::TABLE_OFF:
4385 case HtmlTokenId::COLGROUP_OFF:
4388 case HtmlTokenId::COL_ON:
4390 sal_uInt16 nColSpan = 1;
4391 sal_uInt16 nColWidth = pSaveStruct->nColGrpWidth;
4392 bool bRelColWidth = pSaveStruct->bRelColGrpWidth;
4393 SvxAdjust eColAdjust = pSaveStruct->eColGrpAdjust;
4394 sal_Int16 eColVertOri = pSaveStruct->eColGrpVertOri;
4397 for (
size_t i = rColOptions.size();
i; )
4402 case HtmlOptionId::ID:
4405 case HtmlOptionId::SPAN:
4406 nColSpan = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
4409 SAL_INFO(
"sw.html",
"ignoring huge SPAN " << nColSpan);
4413 case HtmlOptionId::WIDTH:
4414 nColWidth = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
4416 (rOption.
GetString().indexOf(
'*') != -1);
4418 case HtmlOptionId::ALIGN:
4421 case HtmlOptionId::VALIGN:
4428 pCurTable->
InsertCol( nColSpan, nColWidth, bRelColWidth,
4429 eColAdjust, eColVertOri );
4432 pSaveStruct->nColGrpSpan = 0;
4435 case HtmlTokenId::COL_OFF:
4437 case HtmlTokenId::MULTICOL_ON:
4440 case HtmlTokenId::TEXTTOKEN:
4443 1==aToken.getLength() &&
' '==aToken[0] )
4452 "SwHTMLParser::BuildTableColGrp: There is a PendStack again" );
4454 if( IsParserWorking() )
4455 SaveState( HtmlTokenId::NONE );
4461 if( SvParserState::Pending == GetStatus() )
4468 pSaveStruct->CloseColGroup( pCurTable );
4515 std::unique_ptr<CaptionSaveStruct> xSaveStruct;
4523 OSL_ENSURE(
m_vPendingStack.empty(),
"Where does a PendStack coming from?" );
4531 SaveState( HtmlTokenId::NONE );
4537 for (
size_t i = rHTMLOptions.size();
i; )
4540 if( HtmlOptionId::ALIGN == rOption.
GetToken() )
4542 if (rOption.
GetString().equalsIgnoreAsciiCase(
4561 std::unique_ptr<HTMLAttrContext> xCntxt(
new HTMLAttrContext(HtmlTokenId::CAPTION_ON));
4575 SaveState( HtmlTokenId::NONE );
4578 if(
nToken == HtmlTokenId::NONE )
4583 while( IsParserWorking() && !bDone )
4591 case HtmlTokenId::TABLE_ON:
4595 bool bHasToFly = xSaveStruct->m_xTable.get() != pCurTable;
4597 false,
true, bHasToFly );
4603 if( SvParserState::Pending != GetStatus() )
4608 case HtmlTokenId::TABLE_OFF:
4609 case HtmlTokenId::COLGROUP_ON:
4610 case HtmlTokenId::THEAD_ON:
4611 case HtmlTokenId::TFOOT_ON:
4612 case HtmlTokenId::TBODY_ON:
4613 case HtmlTokenId::TABLEROW_ON:
4618 case HtmlTokenId::CAPTION_OFF:
4628 if( IsParserWorking() )
4633 if( IsParserWorking() )
4634 SaveState( HtmlTokenId::NONE );
4640 if( SvParserState::Pending==GetStatus() )
4650 std::unique_ptr<HTMLAttrContext> xCntxt(
PopContext());
4671 std::unique_ptr<HTMLAttrContext> xCntxt(
PopContext());
4681 xSaveStruct->RestoreAll(*
this);
4692 std::shared_ptr<HTMLTable> m_xCurrentTable;
4694 explicit TableSaveStruct(std::shared_ptr<HTMLTable> xCurTable)
4695 : m_xCurrentTable(
std::move(xCurTable))
4706void TableSaveStruct::MakeTable( sal_uInt16 nWidth,
SwPosition& rPos,
SwDoc *pDoc )
4708 m_xCurrentTable->MakeTable(
nullptr, nWidth);
4710 HTMLTableContext *pTCntxt = m_xCurrentTable->GetContext();
4711 OSL_ENSURE( pTCntxt,
"Where is the table context" );
4714 OSL_ENSURE( pTableNd,
"Where is the table node" );
4720 if( pTCntxt->GetFrameFormat() )
4722 pTCntxt->GetFrameFormat()->DelFrames();
4724 pTCntxt->GetFrameFormat()->MakeFrames();
4730 OSL_ENSURE( aIdx.GetIndex() <= pTCntxt->GetPos()->GetNodeIndex(),
4731 "unexpected node for table layout" );
4736 rPos = *pTCntxt->GetPos();
4739HTMLTableOptions::HTMLTableOptions(
const HTMLOptions& rOptions,
4742 nWidth( 0 ), nHeight( 0 ),
4743 nCellPadding( USHRT_MAX ), nCellSpacing( USHRT_MAX ),
4745 nHSpace( 0 ), nVSpace( 0 ),
4746 eAdjust( eParentAdjust ), eVertOri(
text::VertOrientation::
CENTER ),
4748 bPercentWidth( false ),
4749 bTableAdjust( false ),
4753 bool bBorderColor =
false;
4754 bool bHasFrame =
false, bHasRules =
false;
4756 for (
size_t i = rOptions.size(); i; )
4761 case HtmlOptionId::ID:
4764 case HtmlOptionId::COLS:
4765 nCols = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
4767 case HtmlOptionId::WIDTH:
4768 nWidth = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
4769 bPercentWidth = (rOption.
GetString().indexOf(
'%') != -1);
4770 if( bPercentWidth && nWidth>100 )
4773 case HtmlOptionId::HEIGHT:
4774 nHeight = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
4775 if( rOption.
GetString().indexOf(
'%') != -1 )
4778 case HtmlOptionId::CELLPADDING:
4779 nCellPadding = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
4781 case HtmlOptionId::CELLSPACING:
4782 nCellSpacing = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
4784 case HtmlOptionId::ALIGN:
4788 bTableAdjust =
true;
4792 case HtmlOptionId::VALIGN:
4795 case HtmlOptionId::BORDER:
4798 !rOption.
GetString().equalsIgnoreAsciiCase(
4799 OOO_STRING_SVTOOLS_HTML_O_border))
4807 eFrame = (
nBorder ? HTMLTableFrame::Box : HTMLTableFrame::Void );
4809 eRules = (
nBorder ? HTMLTableRules::All : HTMLTableRules::NONE );
4811 case HtmlOptionId::FRAME:
4815 case HtmlOptionId::RULES:
4819 case HtmlOptionId::BGCOLOR:
4828 case HtmlOptionId::BACKGROUND:
4831 case HtmlOptionId::BORDERCOLOR:
4833 bBorderColor =
true;
4835 case HtmlOptionId::BORDERCOLORDARK:
4839 case HtmlOptionId::STYLE:
4842 case HtmlOptionId::CLASS:
4845 case HtmlOptionId::DIR:
4848 case HtmlOptionId::HSPACE:
4849 nHSpace = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
4851 case HtmlOptionId::VSPACE:
4852 nVSpace = o3tl::narrowing<sal_uInt16>(rOption.
GetNumber());
4858 if( nCols && !nWidth )
4861 bPercentWidth =
true;
4865 if( 0==nBorder || USHRT_MAX==nBorder )
4867 eFrame = HTMLTableFrame::Void;
4868 eRules = HTMLTableRules::NONE;
4879 m_xDoc->getIDocumentContentOperations().DeleteSection(pSttNd);
4892 bool bHasParentSection,
4897 eState = SvParserState::Error;
4900 return std::shared_ptr<HTMLTable>();
4904 bool bPending =
false;
4905 std::unique_ptr<TableSaveStruct> xSaveStruct;
4909 xSaveStruct.reset(
static_cast<TableSaveStruct*
>(
m_vPendingStack.back().pData.release()));
4913 bPending = SvParserState::Error == eState && !
m_vPendingStack.empty();
4924 for (
size_t i = rHTMLOptions.size();
i;)
4927 if (rOption.
GetToken() == HtmlOptionId::STYLE)
4932 if (!aStyle.isEmpty())
4944 eParentAdjust = SvxAdjust::Center;
4949 HTMLTableOptions aTableOptions(GetOptions(), eParentAdjust);
4951 if (!aTableOptions.aId.isEmpty())
4954 std::shared_ptr<HTMLTable> xCurTable(std::make_shared<HTMLTable>(
this,
4961 xSaveStruct.reset(
new TableSaveStruct(xCurTable));
4964 SaveState( HtmlTokenId::NONE );
4967 std::shared_ptr<HTMLTable> xCurTable = xSaveStruct->m_xCurrentTable;
4970 if(
nToken == HtmlTokenId::NONE )
4974 while( (IsParserWorking() && !bDone) || bPending )
4981 xCurTable->GetContext() || xCurTable->HasParentSection(),
4982 "Where is the section?" );
4984 (xCurTable->GetContext() || xCurTable->HasParentSection()) )
4991 case HtmlTokenId::TABLE_ON:
4992 if( !xCurTable->GetContext() )
5000 case HtmlTokenId::TABLE_OFF:
5003 case HtmlTokenId::CAPTION_ON:
5007 case HtmlTokenId::COL_ON:
5011 case HtmlTokenId::COLGROUP_ON:
5014 case HtmlTokenId::TABLEROW_ON:
5015 case HtmlTokenId::TABLEHEADER_ON:
5016 case HtmlTokenId::TABLEDATA_ON:
5021 case HtmlTokenId::THEAD_ON:
5022 case HtmlTokenId::TFOOT_ON:
5023 case HtmlTokenId::TBODY_ON:
5027 case HtmlTokenId::MULTICOL_ON:
5030 case HtmlTokenId::FORM_ON:
5033 case HtmlTokenId::FORM_OFF:
5036 case HtmlTokenId::TEXTTOKEN:
5038 if( (xCurTable->GetContext() ||
5039 !xCurTable->HasParentSection()) &&
5040 1==aToken.getLength() &&
' '==aToken[0] )
5044 xCurTable->MakeParentContents();
5050 "SwHTMLParser::BuildTable: There is a PendStack again" );
5052 if( IsParserWorking() )
5053 SaveState( HtmlTokenId::NONE );
5059 if( SvParserState::Pending == GetStatus() )
5063 return std::shared_ptr<HTMLTable>();
5066 HTMLTableContext *pTCntxt = xCurTable->GetContext();
5071 xCurTable->CloseTable();
5077 std::unique_ptr<HTMLAttrContext> xCntxt(
PopContext());
5101 bool bTop =
m_xTable->IsTopCaption();
5104 OSL_ENSURE( pTableStNd,
"Where is the table node" );
5106 "Are we in the wrong table?" );
5117 m_xDoc->getIDocumentContentOperations().MoveNodeRange( aSrcRg, aDstIdx.
GetNode(),
5136 m_xTable->SetCaption(
nullptr,
false );
5145 pTCntxt->RestorePREListingXMP( *
this );
5171 if( !
m_nParaCnt && SvParserState::Working == GetStatus() )
5180 const SwStartNode *pCapStNd = xCurTable->GetCaptionStartNode();
5186 xCurTable->SetCaption(
nullptr,
false );
5192 xSaveStruct->m_xCurrentTable.reset();
5196 std::shared_ptr<HTMLTable> xRetTable = xSaveStruct->m_xCurrentTable;
5197 xSaveStruct.reset();
static OutputDevice * GetDefaultDevice()
SwHTMLNumRuleInfo m_aNumRuleInfo
void RestoreAll(SwHTMLParser &rParser)
CaptionSaveStruct(SwHTMLParser &rParser, SwPosition aPos)
std::shared_ptr< HTMLAttrTable > m_xAttrTab
const SwPosition & GetPos() const
void InsertCell(SwHTMLParser &rParser, HTMLTable *pCurTable)
HTMLTableCnts * m_pCurrCnts
sal_Int32 m_nNoBreakEndContentPos
std::shared_ptr< HTMLTableCnts > m_xCnts
bool IsHeaderCell() const
void CheckNoBreak(const SwPosition &rPos)
CellSaveStruct(SwHTMLParser &rParser, HTMLTable const *pCurTable, bool bHd, bool bReadOpt)
bool HasFirstContents() const
void EndNoBreak(const SwPosition &rPos)
void AddContents(std::unique_ptr< HTMLTableCnts > pNewCnts)
std::shared_ptr< SvxBoxItem > m_xBoxItem
std::optional< SwNodeIndex > m_oNoBreakEndNodeIndex
void StartNoBreak(const SwPosition &rPos)
sal_Int32 m_nStartContent
HTMLAttr * GetPrev() const
HTMLAttr * GetNext() const
HtmlOptionId GetToken() const
HTMLTableFrame GetTableFrame() const
const OUString & GetString() const
EnumT GetEnum(const HTMLOptionEnum< EnumT > *pOptEnums, EnumT nDflt=static_cast< EnumT >(0)) const
void GetColor(Color &) const
sal_uInt32 GetNumber() const
HTMLTableRules GetTableRules() const
std::shared_ptr< HTMLTable > m_xTable
std::shared_ptr< HTMLTable > & GetTable()
const SwStartNode * GetStartNode() const
HTMLTableCnts(const SwStartNode *pStNd)
void Add(std::unique_ptr< HTMLTableCnts > pNewCnts)
const HTMLTableCnts * Next() const
const std::shared_ptr< HTMLTable > & GetTable() const
const SwStartNode * m_pStartNode
const std::shared_ptr< SwHTMLTableLayoutCnts > & CreateLayoutInfo()
void SetTableBox(SwTableBox *pBox)
std::unique_ptr< HTMLTableCnts > m_pNext
std::shared_ptr< SwHTMLTableLayoutCnts > m_xLayoutInfo
void MakeParentContents()
const HTMLTableCell & GetCell(sal_uInt16 nRow, sal_uInt16 nCell) const
bool m_bFillerBottomBorder
const OUString & GetId() const
sal_Int16 GetInheritedVertOri() const
SwTableBoxFormat * m_pBoxFormat
void ProtectRowSpan(sal_uInt16 nRow, sal_uInt16 nCol, sal_uInt16 nRowSpan)
void RegisterDrawObject(SdrObject *pObj, sal_uInt8 nPercentWidth)
sal_uInt16 m_nCurrentColumn
SwTableBox * MakeTableBox(SwTableLine *pUpper, HTMLTableCnts *pCnts, sal_uInt16 nTopRow, sal_uInt16 nLeftCol, sal_uInt16 nBootomRow, sal_uInt16 nRightCol)
void SetHasParentSection(bool bSet)
void OpenRow(SvxAdjust eAdjust, sal_Int16 eVertOri, std::unique_ptr< SvxBrushItem > &rBGBrush)
const OUString & GetClass() const
std::unique_ptr< SvxBrushItem > m_xInheritedBackgroundBrush
std::shared_ptr< SwHTMLTableLayout > m_xLayoutInfo
SvxBorderLine m_aBottomBorderLine
bool m_bInheritedLeftBorder
const SwStartNode * GetCaptionStartNode() const
std::unique_ptr< SwTableBox > m_xBox1
sal_uInt16 IncGrfsThatResize()
HTMLTableContext * GetContext() const
sal_uInt32 m_nHeadlineRepeat
SvxAdjust GetInheritedAdjust() const
bool HasParentSection() const
const SwStartNode * m_pPrevStartNode
const std::unique_ptr< SvxBrushItem > & GetInhBGBrush() const
sal_uInt16 GetBorderWidth(const SvxBorderLine &rBLine, bool bWithDistance=false) const
std::unique_ptr< HTMLTableCnts > & GetParentContents()
void InitCtor(const HTMLTableOptions &rOptions)
void InheritBorders(const HTMLTable *pParent, sal_uInt16 nRow, sal_uInt16 nCol, sal_uInt16 nRowSpan, bool bFirstPara, bool bLastPara)
void InheritVertBorders(const HTMLTable *pParent, sal_uInt16 nCol, sal_uInt16 nColSpan)
SvxBorderLine m_aTopBorderLine
std::vector< HTMLTableRow > m_aRows
table rows
const SwTable * m_pSwTable
std::unique_ptr< HTMLTableCnts > m_xParentContents
sal_uInt16 m_nFilledColumns
SvxBorderLine m_aBorderLine
void MakeTable(SwTableBox *pUpper, sal_uInt16 nAbsAvail, sal_uInt16 nRelAvail=0, sal_uInt16 nAbsLeftSpace=0, sal_uInt16 nAbsRightSpace=0, sal_uInt16 nInhAbsSpace=0)
SwTableLine * MakeTableLine(SwTableBox *pUpper, sal_uInt16 nTopRow, sal_uInt16 nLeftCol, sal_uInt16 nBottomRow, sal_uInt16 nRightCol)
SvxAdjust GetTableAdjust(bool bAny) const
SvxBorderLine m_aInheritedRightBorderLine
void CloseRow(bool bEmpty)
HTMLTable(SwHTMLParser *pPars, bool bParHead, bool bHasParentSec, bool bHasToFly, const HTMLTableOptions &rOptions)
void SetCaption(const SwStartNode *pStNd, bool bTop)
const std::unique_ptr< SvxBrushItem > & GetBGBrush() const
sal_uInt16 GetBottomCellSpace(sal_uInt16 nRow, sal_uInt16 nRowSpan) const
SwTableLineFormat * m_pLineFormat
void InsertCol(sal_uInt16 nSpan, sal_uInt16 nWidth, bool bRelWidth, SvxAdjust eAdjust, sal_Int16 eVertOri)
SvxBorderLine m_aRightBorderLine
sal_uInt16 m_nCellSpacing
bool IsOverflowing() const
std::unique_ptr< HTMLTableContext > m_pContext
virtual void ObjectInDestruction(const SdrObject &rObject) override
std::unique_ptr< SvxBrushItem > m_xBackgroundBrush
SwTableLineFormat * m_pLineFrameFormatNoHeight
void InsertCell(std::shared_ptr< HTMLTableCnts > const &rCnts, sal_uInt16 nRowSpan, sal_uInt16 nColSpan, sal_uInt16 nWidth, bool bRelWidth, sal_uInt16 nHeight, sal_Int16 eVertOri, std::shared_ptr< SvxBrushItem > const &rBGBrushItem, std::shared_ptr< SvxBoxItem > const &rBoxItem, bool bHasNumFormat, sal_uInt32 nNumFormat, bool bHasValue, double nValue, bool bNoWrap)
std::optional< std::vector< sal_uInt16 > > m_xDrawObjectPercentWidths
void MakeTable_(SwTableBox *pUpper)
bool IsTopCaption() const
void CloseSection(bool bHead)
void FixRowSpan(sal_uInt16 nRow, sal_uInt16 nCol, const HTMLTableCnts *pCnts)
sal_uInt16 GetHSpace() const
const OUString & GetDirection() const
sal_uInt16 m_nCellPadding
const SwStartNode * GetPrevBoxStartNode(sal_uInt16 nRow, sal_uInt16 nCell) const
sal_Int16 m_eVertOrientation
void FixFrameFormat(SwTableBox *pBox, sal_uInt16 nRow, sal_uInt16 nCol, sal_uInt16 nRowSpan, sal_uInt16 nColSpan, bool bFirstPara=true, bool bLastPara=true) const
bool m_bInheritedRightBorder
sal_uInt16 GetVSpace() const
sal_uInt16 m_nRightMargin
SwTableBox * NewTableBox(const SwStartNode *pStNd, SwTableLine *pUpper) const
sal_uInt16 GetTopCellSpace(sal_uInt16 nRow) const
std::optional< SdrObjects > m_xResizeDrawObjects
std::vector< HTMLTableColumn > m_aColumns
table columns
const SwStartNode * m_pCaptionStartNode
const SwTable * GetSwTable() const
void SetTable(const SwStartNode *pStNd, std::unique_ptr< HTMLTableContext > pCntxt, sal_uInt16 nLeft, sal_uInt16 nRight, const SwTable *pSwTab=nullptr, bool bFrcFrame=false)
void SetBGBrush(const SvxBrushItem &rBrush)
const std::shared_ptr< SwHTMLTableLayout > & CreateLayoutInfo()
void CloseColGroup(sal_uInt16 nSpan, sal_uInt16 nWidth, bool bRelWidth, SvxAdjust eAdjust, sal_Int16 eVertOri)
void SetParentContents(std::unique_ptr< HTMLTableCnts > pCnts)
HTMLTableCell & GetCell(sal_uInt16 nRow, sal_uInt16 nCell)
SvxBorderLine m_aLeftBorderLine
SvxBorderLine m_aInheritedLeftBorderLine
const OUString & GetStyle() const
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
static void ResetFrameFormatAttrs(SfxItemSet &rFrameSet)
void AddObjectUser(sdr::ObjectUser &rNewUser)
void RemoveObjectUser(sdr::ObjectUser &rOldUser)
size_t m_nContextStMinSave
sal_uInt16 m_nBaseFontStMinSave
sal_uInt16 m_nDefListDeepSave
sal_uInt16 m_nFontStMinSave
std::shared_ptr< HTMLTable > m_xTable
sal_uInt16 m_nFontStHeadStartSave
void Restore(SwHTMLParser &rParser)
size_t m_nContextStAttrMinSave
SectionSaveStruct(SwHTMLParser &rParser)
size_t GetContextStAttrMin() const
static double GetTableDataOptionsValNum(sal_uInt32 &nNumForm, LanguageType &eNumLang, const OUString &aValStr, std::u16string_view aNumStr, SvNumberFormatter &rFormatter)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
constexpr tools::Long Height() const
constexpr tools::Long Width() const
SvxAdjust GetAdjust() const
static const sal_Int16 Hairline
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
void SetAllDistances(sal_Int16 nNew)
void SetGraphicPos(SvxGraphicPosition eNew)
void SetGraphicLink(const OUString &rNew)
void SetColor(const Color &rCol)
const SfxItemSet & GetItemSet() const
static void PixelToTwip(tools::Long &nWidth, tools::Long &nHeight)
SvxCSS1LengthType m_eRightMarginType
SvxCSS1LengthType m_eLeftMarginType
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
SwAttrPool * GetPool() const
static Css1ScriptFlags GetScriptFromClass(OUString &rClass, bool bSubClassOnly=true)
Marks a character position inside a document model content node (SwContentNode)
bool HasSwAttrSet() const
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
virtual bool SetAttr(const SfxPoolItem &)
made virtual
const SwAttrSet * GetpSwAttrSet() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
SwTableAutoFormatTable & GetTableStyles()
Return the available table styles.
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Ends a section of nodes in the document model.
Content, content of frame (header, footer, fly).
const SwNodeIndex * GetContentIdx() const
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
SwPageDesc * GetPageDesc()
sal_uInt8 GetLevel() const
void Set(const SwHTMLNumRuleInfo &rInf)
std::shared_ptr< HTMLTable > m_xTable
std::vector< std::unique_ptr< SwTableBox > > m_aOrphanedTableBoxes
void PushContext(std::unique_ptr< HTMLAttrContext > &rCntxt)
sal_uInt16 m_nDefListDeep
void NewMarquee(HTMLTable *pCurTable=nullptr)
size_t m_nContextStAttrMin
void RegisterHTMLTable(HTMLTable *pNew)
std::unique_ptr< HTMLAttrContext > PopContext(HtmlTokenId nToken=HtmlTokenId::NONE)
void SetAnchorAndAdjustment(sal_Int16 eVertOri, sal_Int16 eHoriOri, const SvxCSS1PropertyInfo &rPropInfo, SfxItemSet &rFrameSet)
static sal_uInt16 ToTwips(sal_uInt16 nPixel)
void InsertAttrs(std::deque< std::unique_ptr< HTMLAttr > > rAttrs)
void InsertBookmark(const OUString &rName)
HtmlTokenId m_nOpenParaToken
friend class CaptionSaveStruct
HTMLAttrContexts m_aContexts
void InsertAttr(const SfxPoolItem &rItem, bool bInsAtStart)
void DeleteSection(SwStartNode *pSttNd)
virtual void NextToken(HtmlTokenId nToken) override
SvxBrushItem * CreateBrushItem(const Color *pColor, const OUString &rImageURL, const OUString &rStyle, const OUString &rId, const OUString &rClass)
void EndForm(bool bAppend=true)
void SaveAttrTab(std::shared_ptr< HTMLAttrTable > const &rNewAttrTab)
std::shared_ptr< HTMLAttrTable > m_xAttrTab
void SetAttr(bool bChkEnd=true, bool bBeforeTable=false, std::deque< std::unique_ptr< HTMLAttr > > *pPostIts=nullptr)
void ClearContext(HTMLAttrContext *pContext)
std::shared_ptr< HTMLTable > BuildTable(SvxAdjust eCellAdjust, bool bIsParentHead=false, bool bHasParentSection=true, bool bHasToFlow=false)
static bool HasStyleOptions(std::u16string_view rStyle, std::u16string_view rId, std::u16string_view rClass, const OUString *pLang=nullptr, const OUString *pDir=nullptr)
std::vector< sal_uInt16 > m_aFontStack
void BuildTableSection(HTMLTable *pTable, bool bReadOptions, bool bHead)
void BuildTableRow(HTMLTable *pTable, bool bReadOptions, SvxAdjust eGrpAdjust, sal_Int16 eVertOri)
SwHTMLNumRuleInfo & GetNumInfo()
void SetTextCollAttrs(HTMLAttrContext *pContext=nullptr)
bool m_isInTableStructure
void NewAttr(const std::shared_ptr< HTMLAttrTable > &rAttrTab, HTMLAttr **ppAttr, const SfxPoolItem &rItem)
rtl::Reference< SwDoc > m_xDoc
bool ParseStyleOptions(const OUString &rStyle, const OUString &rId, const OUString &rClass, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, const OUString *pLang=nullptr, const OUString *pDir=nullptr)
bool EndSections(bool bLFStripped)
sal_Int32 StripTrailingLF()
friend class CellSaveStruct
std::vector< sal_uInt16 > m_aBaseFontStack
rtl::Reference< SdrObject > m_pMarquee
std::unique_ptr< SwCSS1Parser > m_pCSS1Parser
SwTwips GetCurrentBrowseWidth()
void SplitPREListingXMP(HTMLAttrContext *pCntxt)
sal_uInt16 m_nFontStHeadStart
void BuildTableCell(HTMLTable *pTable, bool bReadOptions, bool bHead)
std::vector< SwPending > m_vPendingStack
std::vector< HTMLTable * > m_aTables
SwStartNode * InsertTempTableCaptionSection()
void DeregisterHTMLTable(HTMLTable *pOld)
bool AppendTextNode(SwHTMLAppendMode eMode=AM_NORMAL, bool bUpdateNum=true)
const SwStartNode * InsertTableSection(const SwStartNode *pPrevStNd)
void EndContext(HTMLAttrContext *pContext)
void GetMarginsFromContextWithNumberBullet(sal_uInt16 &nLeft, sal_uInt16 &nRight, short &nIndent) const
void MovePageDescAttrs(SwNode *pSrcNd, SwNodeOffset nDestIdx, bool bFormatBreak)
static void RegisterDrawObjectToTable(HTMLTable *pCurTable, SdrObject *pObj, sal_uInt8 nWidth)
static void ResizeDrawObject(SdrObject *pObj, SwTwips nWidth)
sal_uInt16 m_nBaseFontStMin
std::unique_ptr< HTMLTableCnts > InsertTableContents(bool bHead)
sal_uInt16 IncGrfsThatResizeTable()
void SplitAttrTab(const SwPosition &rNewPos)
bool HasCurrentParaBookmarks(bool bIgnoreStack=false) const
void SetNodeNum(sal_uInt8 nLevel)
void BuildTableColGroup(HTMLTable *pTable, bool bReadOptions)
void RestoreAttrTab(std::shared_ptr< HTMLAttrTable > const &rNewAttrTab)
void BuildTableCaption(HTMLTable *pTable)
bool HasCurrentParaFlys(bool bNoSurroundOnly=false, bool bSurroundOnly=false) const
void NewForm(bool bAppend=true)
sal_uInt16 GetColSpan() const
void SetRowSpan(sal_uInt16 nRSpan)
Set or get ROWSPAN/COLSPAN of cell.
const std::shared_ptr< SwHTMLTableLayoutCnts > & GetContents() const
void SetContents(std::shared_ptr< SwHTMLTableLayoutCnts > const &rCnts)
Set or get content of a cell.
Marks a node in the document model.
SwNodeOffset GetIndex() const
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodeOffset GetIndex() const
const SwStartNode * FindTableBoxStartNode() const
SwNodes & GetNodes()
Node is in which nodes-array/doc?
SwTableNode * FindTableNode()
Search table node, in which it is.
const SwStartNode * StartOfSectionNode() const
SwNodeOffset EndOfSectionIndex() const
SwTableNode * GetTableNode()
const SwEndNode * EndOfSectionNode() const
SwNode & GetPointNode() const
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
const SwPosition * GetPoint() const
Starts a section of nodes in the document model.
static const OUString & GetUIName(const OUString &rName, SwGetPoolIdFromName)
SwTableBox is one table cell in the document model.
void SetUpper(SwTableLine *pNew)
bool IsEmpty(bool bWithRemainingNestedTable=true) const
void setRowSpan(sal_Int32 nNewRowSpan)
SwTableLines & GetTabLines()
const SwStartNode * GetSttNd() const
void ChgFrameFormat(SwTableBoxFormat *pNewFormat, bool bNeedToReregister=true)
SwFrameFormat * ClaimFrameFormat()
SwTableLine is one table row in the document model.
SwFrameFormat * GetFrameFormat()
SwFrameFormat * ClaimFrameFormat()
SwTableBoxes & GetTabBoxes()
void push_back(SwTableLine *pLine)
const SwTable & GetTable() const
void MakeOwnFrames(SwPosition *pIdxBehind=nullptr)
Creates the frms for the table node (i.e.
void DelFrames(SwRootFrame const *pLayout=nullptr)
Method deletes all views of document for the node.
SwTable is one table in the document model, containing rows (which contain cells).
SwTableLines & GetTabLines()
SwTableFormat * GetFrameFormat()
SwHTMLTableLayout * GetHTMLTableLayout()
SwTableSortBoxes & GetTabSortBoxes()
Represents the style of a paragraph.
SwTextNode is a paragraph in the document model.
void EraseText(const SwContentIndex &rIdx, const sal_Int32 nCount=SAL_MAX_INT32, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
delete text content ATTENTION: must not be called with a range that overlaps the start of an attribut...
virtual SwFormatColl * ChgFormatColl(SwFormatColl *) override
const OUString & GetText() const
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
constexpr ::Color COL_GRAY(0x80, 0x80, 0x80)
@ Variable
Frame is variable in Var-direction.
@ Minimum
Value in Var-direction gives minimum (can be exceeded but not be less).
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
constexpr TypedWhichId< SvxFormatKeepItem > RES_KEEP(116)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr TypedWhichId< SwFormatLayoutSplit > RES_LAYOUT_SPLIT(119)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
constexpr TypedWhichId< SvxFormatSplitItem > RES_PARATR_SPLIT(65)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
#define OOO_STRING_SVTOOLS_HTML_VA_middle
#define OOO_STRING_SVTOOLS_HTML_VA_bottom
#define OOO_STRING_SVTOOLS_HTML_VA_top
#define NETSCAPE_DFLT_CELLSPACING
std::vector< SdrObject * > SdrObjects
HTMLOptionEnum< sal_Int16 > const aHTMLTableVAlignTable[]
#define NETSCAPE_DFLT_BORDER
static void ResetLineFrameFormatAttrs(SwFrameFormat *pFrameFormat)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
tools::Long const nBorder
std::shared_ptr< T > make_shared(Args &&... args)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
const sal_Int32 nCellHeight
const sal_Int32 nCellWidth
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
SwMoveFnCollection const & fnMoveBackward
::std::vector< HTMLOption > HTMLOptions
@ RES_POOLCOLL_TEXT
Text body.
@ RES_POOLCOLL_STANDARD
Standard.
@ RES_POOLCOLL_TABLE
Subgroup table.
@ RES_POOLCOLL_TABLE_HDLN
Table of Contents - heading.
@ RES_POOLTABLESTYLE_DEFAULT
Marks a position in the document model.
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
SwNodeOffset GetNodeIndex() const
sal_Int32 GetContentIndex() const
HTMLOptionEnum< SvxAdjust > const aHTMLPAlignTable[]
std::deque< HTMLAttr * > HTMLAttrs
std::vector< SwTableBox * > SwTableBoxes
constexpr SwTwips MIN_BORDER_DIST