43#include <osl/diagnose.h>
51#define MAX_TABWIDTH (USHRT_MAX - 2001)
55class SwHTMLTableLayoutConstraints
59 sal_uInt16 m_nColSpan;
61 std::unique_ptr<SwHTMLTableLayoutConstraints> m_pNext;
67 sal_uInt16 nCol, sal_uInt16 nColSp );
69 sal_uLong GetMinNoAlign()
const {
return m_nMinNoAlign; }
70 sal_uLong GetMaxNoAlign()
const {
return m_nMaxNoAlign; }
72 SwHTMLTableLayoutConstraints *InsertNext( SwHTMLTableLayoutConstraints *pNxt );
73 SwHTMLTableLayoutConstraints* GetNext()
const {
return m_pNext.get(); }
75 sal_uInt16 GetColSpan()
const {
return m_nColSpan; }
76 sal_uInt16 GetColumn()
const {
return m_nCol; }
82 std::shared_ptr<SwHTMLTableLayout> xTab,
84 std::shared_ptr<SwHTMLTableLayoutCnts> xNxt ) :
85 m_xNext(
std::move(xNxt) ), m_pBox( nullptr ), m_xTable(
std::move(xTab) ), m_pStartNode( pSttNd ),
86 m_nPass1Done( 0 ), m_nWidthSet( 0 ), m_bNoBreakTag( bNoBrTag )
95 sal_uInt16 nRSpan, sal_uInt16 nCSpan,
96 sal_uInt16 nWidth,
bool bPercentWidth,
98 m_xContents(
std::move(xCnts)),
99 m_nRowSpan( nRSpan ), m_nColSpan( nCSpan ),
100 m_nWidthOption( nWidth ), m_bPercentWidthOption( bPercentWidth ),
101 m_bNoWrapOption( bNWrapOpt )
108 m_nMin(0), m_nMax(0),
109 m_nAbsColWidth(0), m_nRelColWidth(0),
110 m_nWidthOption( nWidth ), m_bRelWidthOption( bRelWidth ),
111 m_bLeftBorder( bLBorder )
114SwHTMLTableLayoutConstraints::SwHTMLTableLayoutConstraints(
sal_uLong nMin,
sal_uLong nMax,
115 sal_uInt16 nRw, sal_uInt16 nColumn,
120 , m_nMinNoAlign(nMin)
121 , m_nMaxNoAlign(nMax)
124SwHTMLTableLayoutConstraints *SwHTMLTableLayoutConstraints::InsertNext(
125 SwHTMLTableLayoutConstraints *pNxt )
127 SwHTMLTableLayoutConstraints *pPrev =
nullptr;
128 SwHTMLTableLayoutConstraints *pConstr =
this;
131 if (pConstr->m_nRow > pNxt->m_nRow || pConstr->GetColumn() > pNxt->GetColumn())
134 pConstr = pConstr->GetNext();
139 pNxt->m_pNext = std::move(pPrev->m_pNext);
140 pPrev->m_pNext.reset(pNxt);
145 pNxt->m_pNext.reset(
this);
153 sal_uInt16 nRws, sal_uInt16 nCls,
154 bool bColsOpt,
bool bColTgs,
155 sal_uInt16 nWdth,
bool bPercentWdth,
156 sal_uInt16 nBorderOpt, sal_uInt16 nCellPad,
158 sal_uInt16 nLMargin, sal_uInt16 nRMargin,
159 sal_uInt16 nBWidth, sal_uInt16 nLeftBWidth,
160 sal_uInt16 nRightBWidth )
161 : m_aResizeTimer(
"SwHTMLTableLayout m_aResizeTimer")
163 , m_aCells( static_cast<size_t>(nRws)*nCls )
164 , m_pSwTable( pTable )
169 , m_nLeftMargin( nLMargin )
170 , m_nRightMargin( nRMargin )
171 , m_nInhAbsLeftSpace( 0 )
172 , m_nInhAbsRightSpace( 0 )
173 , m_nRelLeftFill( 0 )
174 , m_nRelRightFill( 0 )
175 , m_nRelTabWidth( 0 )
176 , m_nWidthOption( nWdth )
177 , m_nCellPadding( nCellPad )
178 , m_nCellSpacing( nCellSp )
179 , m_nBorder( nBorderOpt )
180 , m_nLeftBorderWidth( nLeftBWidth )
181 , m_nRightBorderWidth( nRightBWidth )
182 , m_nInhLeftBorderWidth( 0 )
183 , m_nInhRightBorderWidth( 0 )
184 , m_nBorderWidth( nBWidth )
185 , m_nDelayedResizeAbsAvail( 0 )
186 , m_nLastResizeAbsAvail( 0 )
189 , m_eTableAdjust( eAdjust )
190 , m_bColsOption( bColsOpt )
191 , m_bColTags( bColTgs )
192 , m_bPercentWidthOption( bPercentWdth )
193 , m_bUseRelWidth( false )
194 , m_bMustResize( true )
195 , m_bExportable( true )
196 , m_bBordersChanged( false )
197 , m_bMayBeInFlyFrame( false )
198 , m_bDelayedResizeRecalc( false)
199 , m_bMustNotResize( false )
200 , m_bMustNotRecalc( false )
203 DelayedResize_Impl ) );
218 bool bSwBorders )
const
229 else if( bSwBorders )
239 OSL_ENSURE( !
m_nCellPadding,
"GetLeftCellSpace: CELLPADDING!=0" );
251 bool bSwBorders )
const
261 else if( bSwBorders &&
GetColumn(nCol)->HasLeftBorder() &&
264 OSL_ENSURE( !
m_nCellPadding,
"GetRightCellSpace: CELLPADDING!=0" );
276 sal_uInt16 nCol, sal_uInt16 nColSpan,
277 bool bSwBorders )
const
288 sal_uInt16 nColSpan )
const
302 sal_uInt16& rAbsAvail, sal_uInt16& rRelAvail )
const
306 for( sal_uInt16
i=nCol;
i<nCol+nColSpan;
i++ )
355 const SwFrame *pAnchor =
static_cast<const SwFlyFrame *
>(pUpper)->GetAnchorFrame();
369 rTabFrame.
CalcFlyOffsets(nUpperDummy, nLeftOffset, nRightOffset,
nullptr);
370 nWidth -= (nLeftOffset + nRightOffset);
377 sal_uInt16 nBrowseWidth = 0;
396 while(
nullptr == (pBoxSttNd = pBox->
GetSttNd()) )
399 "Box without start node and lines" );
401 "Line without boxes" );
411 OSL_ENSURE( pTableNd,
"No Table-Node?" );
419 pTextNd->
GetMinMaxSize( nIdx, rMinNoAlignCnts, rMaxNoAlignCnts,
420 rAbsMinNoAlignCnts );
421 OSL_ENSURE( rAbsMinNoAlignCnts <= rMinNoAlignCnts,
422 "GetMinMaxSize: absmin > min" );
423 OSL_ENSURE( rMinNoAlignCnts <= rMaxNoAlignCnts,
424 "GetMinMaxSize: max > min" );
438 rMinNoAlignCnts = rMaxNoAlignCnts;
439 rAbsMinNoAlignCnts = rMaxNoAlignCnts;
449 bool bFixRelWidths =
false;
452 std::unique_ptr<SwHTMLTableLayoutConstraints> xConstraints;
458 sal_uInt16 nMinColSpan = USHRT_MAX;
459 sal_uInt16 nColSkip = USHRT_MAX;
461 for( sal_uInt16 j=0; j<
m_nRows; j++ )
469 if( nColSpan < nColSkip )
475 if( nColSpan < nMinColSpan )
476 nMinColSpan = nColSpan;
491 while (!rDoc.
GetNodes()[nIdx]->IsEndNode())
506 if( nMinNoAlignCnts > nMinNoAlignCell )
507 nMinNoAlignCell = nMinNoAlignCnts;
508 if( nMaxNoAlignCnts > nMaxNoAlignCell )
509 nMaxNoAlignCell = nMaxNoAlignCnts;
510 if( nAbsMinNoAlignCnts > nAbsMinNoAlignCell )
511 nAbsMinNoAlignCell = nAbsMinNoAlignCnts;
530 if( nTabWidth >= nAbsMinTableCnts )
532 nMaxTableCnts = nTabWidth;
533 nAbsMinTableCnts = nTabWidth;
537 nMaxTableCnts = nAbsMinTableCnts;
541 if( nMaxTableCnts > nMaxTableCell )
542 nMaxTableCell = nMaxTableCnts;
543 if( nAbsMinTableCnts > nAbsMinTableCell )
544 nAbsMinTableCell = nAbsMinTableCnts;
554 OSL_ENSURE(
false,
"Sub tables in HTML import?" );
555 pChild->AutoLayoutPass1();
556 sal_uLong nMaxTableCnts = pChild->m_nMax;
557 sal_uLong nAbsMinTableCnts = pChild->m_nMin;
561 if( !pChild->m_bPercentWidthOption && pChild->m_nWidthOption )
563 sal_uLong nTabWidth = pChild->m_nWidthOption;
564 if( nTabWidth >= nAbsMinTableCnts )
566 nMaxTableCnts = nTabWidth;
567 nAbsMinTableCnts = nTabWidth;
571 nMaxTableCnts = nAbsMinTableCnts;
575 if( nMaxTableCnts > nMaxTableCell )
576 nMaxTableCell = nMaxTableCnts;
577 if( nAbsMinTableCnts > nAbsMinTableCell )
578 nAbsMinTableCell = nAbsMinTableCnts;
581 pCnts = pCnts->
GetNext().get();
587 if( nMaxTableCell > nMaxNoAlignCell )
588 nMaxNoAlignCell = nMaxTableCell;
589 if( nAbsMinTableCell > nAbsMinNoAlignCell )
591 nAbsMinNoAlignCell = nAbsMinTableCell;
592 if( nMinNoAlignCell < nAbsMinNoAlignCell )
593 nMinNoAlignCell = nAbsMinNoAlignCell;
594 if( nMaxNoAlignCell < nMinNoAlignCell )
595 nMaxNoAlignCell = nMinNoAlignCell;
608 if( nWidth==0 || bRelWidth )
610 nMinNoAlignCell = nMaxNoAlignCell;
611 nAbsMinNoAlignCell = nMaxNoAlignCell;
615 if( nWidth>nMinNoAlignCell )
616 nMinNoAlignCell = nWidth;
617 if( nWidth>nAbsMinNoAlignCell )
618 nAbsMinNoAlignCell = nWidth;
623 if( nMinNoAlignCell <
MINLAY )
625 if( nMaxNoAlignCell <
MINLAY )
627 if( nAbsMinNoAlignCell <
MINLAY )
628 nAbsMinNoAlignCell =
MINLAY;
632 nAbsMinNoAlignCell,
i, nColSpan );
639 nAbsMinNoAlignCell );
652 sal_uLong nAbsWidth = nWidth, nDummy = 0, nDummy2 = 0;
654 i, nColSpan,
false );
656 if( nAbsWidth >= nMinNoAlignCell )
658 nMaxNoAlignCell = nAbsWidth;
660 nMinNoAlignCell = nAbsWidth;
662 else if( nAbsWidth >= nAbsMinNoAlignCell )
664 nMaxNoAlignCell = nAbsWidth;
665 nMinNoAlignCell = nAbsWidth;
669 nMaxNoAlignCell = nAbsMinNoAlignCell;
670 nMinNoAlignCell = nAbsMinNoAlignCell;
674 nMinNoAlignCell = nAbsMinNoAlignCell;
676 SwHTMLTableLayoutConstraints *pConstr =
677 new SwHTMLTableLayoutConstraints( nMinNoAlignCell,
678 nMaxNoAlignCell, j,
i, nColSpan );
681 SwHTMLTableLayoutConstraints* pConstraints = xConstraints->InsertNext(pConstr);
683 xConstraints.release();
684 xConstraints.reset(pConstraints);
687 xConstraints.reset(pConstr);
692 OSL_ENSURE( nMinColSpan>0 && nColSkip>0 && nColSkip <= nMinColSpan,
693 "Layout pass 1: Columns are being forgotten!" );
694 OSL_ENSURE( nMinColSpan!=USHRT_MAX,
695 "Layout pass 1: unnecessary pass through the loop or a bug" );
737 pColumn->
SetMinMax( nAbsWidth, nAbsWidth );
752 else if( USHRT_MAX!=nMinColSpan )
767 SwHTMLTableLayoutConstraints *pConstr = xConstraints.get();
772 sal_uInt16 nCol = pConstr->GetColumn();
773 sal_uInt16 nColSpan = pConstr->GetColSpan();
774 sal_uLong nConstrMin = pConstr->GetMinNoAlign();
775 sal_uLong nConstrMax = pConstr->GetMaxNoAlign();
780 for( sal_uInt16 j=nCol; j<nCol+nColSpan; j++ )
783 nColsMin += pColumn->
GetMin();
784 nColsMax += pColumn->
GetMax();
787 if( nColsMin<nConstrMin )
792 if( nConstrMin > nColsMax )
795 sal_uInt16 nEndCol = nCol+nColSpan;
797 for( sal_uInt16 ic=nCol; ic<nEndCol; ic++ )
810 nAdd = (nColMin * nMinD) / nColsMin;
818 OSL_ENSURE( nDiff >= nAdd,
"Ooops: nDiff is not correct anymore" );
821 if( nColMax < nColMin )
836 for( sal_uInt16 ic=nCol; ic<nCol+nColSpan; ic++ )
847 "Why is the Column suddenly too narrow?" );
859 for( sal_uInt16 ic=nCol; ic<nCol+nColSpan; ic++ )
871 pConstr = pConstr->GetNext();
899 nAbsMin += pColumn->
GetMin();
920 OSL_ENSURE( 0==nRel || nQuot!=ULONG_MAX,
921 "Where did the relative columns go?" );
932 "Maximum column width is lower than the minimum column width" );
940 sal_uInt16 nRelCols = 0;
944 OSL_ENSURE( nRel<=100, "relative width of all columns > 100%
" );
945 SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
946 if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption() )
948 // Make sure that the relative widths don't go above 100%
949 sal_uInt16 nColWidth = pColumn->GetWidthOption();
950 if( nRel+nColWidth > 100 )
952 nColWidth = 100 - nRel;
953 pColumn->SetWidthOption( nColWidth );
955 nRelMax += pColumn->GetMax();
956 nRel = nRel + nColWidth;
959 else if( !pColumn->GetMin() )
961 // The column is empty (so it was solely created by
962 // COLSPAN) and therefore must not be assigned a % width.
967 // If there are percentages left we distribute them to the columns
968 // that don't have a width setting. Like in Netscape we distribute
969 // the remaining percentages according to the ratio of the maximum
970 // width of the affected columns.
971 // For the maximum widths we also take the fixed-width columns
972 // into account. Is that correct?
973 sal_uLong nFixMax = 0;
974 if( nRel < 100 && nRelCols < m_nCols )
976 nFixMax = m_nMax - nRelMax;
977 SAL_WARN_IF(!nFixMax, "sw.core
", "bad fixed width
max");
981 sal_uInt16 nRelLeft = 100 - nRel;
982 for( i=0; i<m_nCols; i++ )
984 SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
985 if( !pColumn->IsRelWidthOption() &&
986 !pColumn->GetWidthOption() &&
989 // the next column gets the rest
990 sal_uInt16 nColWidth =
991 o3tl::narrowing<sal_uInt16>((pColumn->GetMax() * nRelLeft) / nFixMax);
992 pColumn->SetWidthOption( nColWidth );
997 // adjust the maximum widths now accordingly
998 sal_uLong nQuotMax = ULONG_MAX;
999 sal_uLong nOldMax = m_nMax;
1001 for( i=0; i<m_nCols; i++ )
1003 // Columns with a % setting are adapted accordingly.
1005 // - do not have a % setting and are located within a tables
1006 // with COLS and WIDTH, or
1007 // - their width is 0%
1008 // get set to the minimum width.
1009 SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
1010 if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption() )
1013 sal_uLong nColQuotMax;
1014 if( !m_nWidthOption )
1016 nNewMax = nOldMax * pColumn->GetWidthOption();
1017 nColQuotMax = nNewMax / pColumn->GetMax();
1021 nNewMax = m_nMin * pColumn->GetWidthOption();
1022 nColQuotMax = nNewMax / pColumn->GetMin();
1024 pColumn->SetMax( nNewMax );
1025 if( nColQuotMax < nQuotMax )
1026 nQuotMax = nColQuotMax;
1028 else if( HasColsOption() || m_nWidthOption ||
1029 (pColumn->IsRelWidthOption() &&
1030 !pColumn->GetWidthOption()) )
1031 pColumn->SetMax( pColumn->GetMin() );
1033 // and divide by the quotient
1034 SAL_WARN_IF(!nQuotMax, "sw.core
", "Where did the relative columns go?
");
1035 for (i = 0; i < m_nCols; ++i)
1037 SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
1038 if (pColumn->IsRelWidthOption() && pColumn->GetWidthOption() && nQuotMax)
1040 pColumn->SetMax( pColumn->GetMax() / nQuotMax );
1041 OSL_ENSURE( pColumn->GetMax() >= pColumn->GetMin(),
1042 "Minimum width is
one column bigger than maximum
" );
1043 if( pColumn->GetMax() < pColumn->GetMin() )
1044 pColumn->SetMax( pColumn->GetMin() );
1046 m_nMax += pColumn->GetMax();
1051//TODO: provide documentation
1059void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAvail,
1060 sal_uInt16 nAbsLeftSpace,
1061 sal_uInt16 nAbsRightSpace,
1062 sal_uInt16 nParentInhAbsSpace )
1064 // For a start we do a lot of plausibility tests
1066 // An absolute width always has to be passed
1067 OSL_ENSURE( nAbsAvail, "AutoLayout pass 2: No absolute width given
" );
1069 // A relative width must only be passed for tables within tables (?)
1070 OSL_ENSURE( IsTopTable() == (nRelAvail==0),
1071 "AutoLayout pass 2: Relative width at table in table or the other way around
" );
1073 // The table's minimum width must not be bigger than its maximum width
1074 OSL_ENSURE( m_nMin<=m_nMax, "AutoLayout pass 2: nMin > nMax
" );
1076 // Remember the available width for which the table was calculated.
1077 // This is a good place as we pass by here for the initial calculation
1078 // of the table in the parser and for each Resize_ call.
1079 m_nLastResizeAbsAvail = nAbsAvail;
1081 // Step 1: The available space is readjusted for the left/right border,
1082 // possibly existing filler cells and distances.
1084 // Distance to the content and border
1085 sal_uInt16 nAbsLeftFill = 0, nAbsRightFill = 0;
1086 if( !IsTopTable() &&
1087 GetMin() + nAbsLeftSpace + nAbsRightSpace <= nAbsAvail )
1089 nAbsLeftFill = nAbsLeftSpace;
1090 nAbsRightFill = nAbsRightSpace;
1093 // Left and right distance
1094 if( m_nLeftMargin || m_nRightMargin )
1098 // For the top table we always respect the borders, because we
1099 // never go below the table's minimum width.
1100 nAbsAvail -= (m_nLeftMargin + m_nRightMargin);
1102 else if( GetMin() + m_nLeftMargin + m_nRightMargin <= nAbsAvail )
1104 // Else, we only respect the borders if there's space available
1105 // for them (nMin has already been calculated!)
1106 nAbsLeftFill = nAbsLeftFill + m_nLeftMargin;
1107 nAbsRightFill = nAbsRightFill + m_nRightMargin;
1111 // Read just the available space
1113 m_nRelRightFill = 0;
1114 if( !IsTopTable() && (nAbsLeftFill>0 || nAbsRightFill) )
1116 sal_uLong nAbsLeftFillL = nAbsLeftFill, nAbsRightFillL = nAbsRightFill;
1118 m_nRelLeftFill = o3tl::narrowing<sal_uInt16>((nAbsLeftFillL * nRelAvail) / nAbsAvail);
1119 m_nRelRightFill = o3tl::narrowing<sal_uInt16>((nAbsRightFillL * nRelAvail) / nAbsAvail);
1121 nAbsAvail -= (nAbsLeftFill + nAbsRightFill);
1123 nRelAvail -= (m_nRelLeftFill + m_nRelRightFill);
1126 // Step 2: Calculate the absolute table width.
1127 sal_uInt16 nAbsTabWidth = 0;
1128 m_bUseRelWidth = false;
1129 if( m_nWidthOption )
1131 if( m_bPercentWidthOption )
1133 OSL_ENSURE( m_nWidthOption<=100, "Percentage value too high
" );
1134 if( m_nWidthOption > 100 )
1135 m_nWidthOption = 100;
1137 // The absolute width is equal to the given percentage of
1138 // the available width.
1139 // Top tables only get a relative width if the available space
1140 // is *strictly larger* than the minimum width.
1142 // CAUTION: We need the "strictly larger
" because changing from a
1143 // relative width to an absolute width by resizing would lead
1144 // to an infinite loop.
1146 // Because we do not call resize for tables in frames if the
1147 // frame has a non-relative width, we cannot play such games.
1149 // Let's play such games now anyway. We had a graphic in a 1% wide
1150 // table and it didn't fit in of course.
1151 nAbsTabWidth = o3tl::narrowing<sal_uInt16>( (static_cast<sal_uLong>(nAbsAvail) * m_nWidthOption) / 100 );
1153 ( /*MayBeInFlyFrame() ||*/ static_cast<sal_uLong>(nAbsTabWidth) > m_nMin ) )
1155 nRelAvail = USHRT_MAX;
1156 m_bUseRelWidth = true;
1161 nAbsTabWidth = m_nWidthOption;
1162 if( nAbsTabWidth > MAX_TABWIDTH )
1163 nAbsTabWidth = MAX_TABWIDTH;
1165 // Tables within tables must never get wider than the available
1167 if( !IsTopTable() && nAbsTabWidth > nAbsAvail )
1168 nAbsTabWidth = nAbsAvail;
1172 OSL_ENSURE( IsTopTable() || nAbsTabWidth<=nAbsAvail,
1173 "AutoLayout pass 2: nAbsTabWidth > nAbsAvail
for table in table
" );
1174 OSL_ENSURE( !nRelAvail || nAbsTabWidth<=nAbsAvail,
1175 "AutoLayout pass 2: nAbsTabWidth > nAbsAvail
for relative width
" );
1177 // Catch for the two asserts above (we never know!)
1178 if( (!IsTopTable() || nRelAvail>0) && nAbsTabWidth>nAbsAvail )
1179 nAbsTabWidth = nAbsAvail;
1181 // Step 3: Identify the column width and, if applicable, the absolute
1182 // and relative table widths.
1183 if( (!IsTopTable() && m_nMin > static_cast<sal_uLong>(nAbsAvail)) ||
1184 m_nMin > MAX_TABWIDTH )
1187 // - an inner table's minimum is larger than the available space, or
1188 // - a top table's minimum is larger than USHORT_MAX the table
1189 // has to be adapted to the available space or USHORT_MAX.
1190 // We preserve the widths' ratio amongst themselves, however.
1192 nAbsTabWidth = IsTopTable() ? MAX_TABWIDTH : nAbsAvail;
1193 m_nRelTabWidth = (nRelAvail ? nRelAvail : nAbsTabWidth );
1195 // First of all, we check whether we can fit the layout constrains,
1196 // which are: Every cell's width excluding the borders must be at least
1199 sal_uLong nRealMin = 0;
1200 for( sal_uInt16 i=0; i<m_nCols; i++ )
1202 sal_uLong nRealColMin = MINLAY, nDummy1 = 0, nDummy2 = 0;
1203 AddBorderWidth( nRealColMin, nDummy1, nDummy2, i, 1 );
1204 nRealMin += nRealColMin;
1206 if( (nRealMin >= nAbsTabWidth) || (nRealMin >= m_nMin) )
1208 // "Rien ne va plus
": we cannot get the minimum column widths
1209 // the layout wants to have.
1211 sal_uInt16 nAbs = 0, nRel = 0;
1212 SwHTMLTableLayoutColumn *pColumn;
1213 for( sal_uInt16 i=0; i<m_nCols-1; i++ )
1215 pColumn = GetColumn( i );
1216 sal_uLong nColMin = pColumn->GetMin();
1217 if( nColMin <= USHRT_MAX )
1219 pColumn->SetAbsColWidth(
1220 o3tl::narrowing<sal_uInt16>((nColMin * nAbsTabWidth) / m_nMin) );
1221 pColumn->SetRelColWidth(
1222 o3tl::narrowing<sal_uInt16>((nColMin * m_nRelTabWidth) / m_nMin) );
1226 double nColMinD = nColMin;
1227 pColumn->SetAbsColWidth(
1228 o3tl::narrowing<sal_uInt16>((nColMinD * nAbsTabWidth) / m_nMin) );
1229 pColumn->SetRelColWidth(
1230 o3tl::narrowing<sal_uInt16>((nColMinD * m_nRelTabWidth) / m_nMin) );
1233 nAbs = nAbs + pColumn->GetAbsColWidth();
1234 nRel = nRel + pColumn->GetRelColWidth();
1236 pColumn = GetColumn( m_nCols-1 );
1237 pColumn->SetAbsColWidth( nAbsTabWidth - nAbs );
1238 pColumn->SetRelColWidth( m_nRelTabWidth - nRel );
1242 sal_uLong nDistAbs = nAbsTabWidth - nRealMin;
1243 sal_uLong nDistRel = m_nRelTabWidth - nRealMin;
1244 sal_uLong nDistMin = m_nMin - nRealMin;
1245 sal_uInt16 nAbs = 0, nRel = 0;
1246 SwHTMLTableLayoutColumn *pColumn;
1247 for( sal_uInt16 i=0; i<m_nCols-1; i++ )
1249 pColumn = GetColumn( i );
1250 sal_uLong nColMin = pColumn->GetMin();
1251 sal_uLong nRealColMin = MINLAY, nDummy1 = 0, nDummy2 = 0;
1252 AddBorderWidth( nRealColMin, nDummy1, nDummy2, i, 1 );
1254 if( nColMin <= USHRT_MAX )
1256 pColumn->SetAbsColWidth(
1257 o3tl::narrowing<sal_uInt16>((((nColMin-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) );
1258 pColumn->SetRelColWidth(
1259 o3tl::narrowing<sal_uInt16>((((nColMin-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) );
1263 double nColMinD = nColMin;
1264 pColumn->SetAbsColWidth(
1265 o3tl::narrowing<sal_uInt16>((((nColMinD-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) );
1266 pColumn->SetRelColWidth(
1267 o3tl::narrowing<sal_uInt16>((((nColMinD-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) );
1270 nAbs = nAbs + pColumn->GetAbsColWidth();
1271 nRel = nRel + pColumn->GetRelColWidth();
1273 pColumn = GetColumn( m_nCols-1 );
1274 pColumn->SetAbsColWidth( nAbsTabWidth - nAbs );
1275 pColumn->SetRelColWidth( m_nRelTabWidth - nRel );
1278 else if( m_nMax <= static_cast<sal_uLong>(nAbsTabWidth ? nAbsTabWidth : nAbsAvail) )
1281 // - the table has a fixed width and the table's maximum is
1283 //- the maximum is smaller than the available space,
1284 // we can take over the maximum as it is. Respectively
1285 // the table can only be adapted to the fixed width by
1286 // respecting the maximum.
1288 // No fixed width, use the maximum.
1290 nAbsTabWidth = o3tl::narrowing<sal_uInt16>(m_nMax);
1292 // A top table may also get wider then the available space.
1293 if( nAbsTabWidth > nAbsAvail )
1295 OSL_ENSURE( IsTopTable(),
1296 "Table in table should
get wider than the surrounding cell.
" );
1297 nAbsAvail = nAbsTabWidth;
1300 // Only use the relative widths' fraction, that is used for the
1302 sal_uLong nAbsTabWidthL = nAbsTabWidth;
1306 throw o3tl::divide_by_zero();
1307 m_nRelTabWidth = o3tl::narrowing<sal_uInt16>((nAbsTabWidthL * nRelAvail) / nAbsAvail);
1310 m_nRelTabWidth = nAbsTabWidth;
1312 // Are there columns width a percentage setting and some without one?
1313 sal_uLong nFixMax = m_nMax;
1314 for( sal_uInt16 i=0; i<m_nCols; i++ )
1316 const SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
1317 if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption()>0 )
1318 nFixMax -= pColumn->GetMax();
1321 if( nFixMax > 0 && nFixMax < m_nMax )
1323 // Yes, distribute the to-be-distributed space only to the
1324 // columns with a percentage setting.
1326 // In this case (and in this case only) there are columns
1327 // that exactly keep their maximum width, that is they neither
1328 // get smaller nor wider. When calculating the absolute width
1329 // from the relative width we can get rounding errors.
1330 // To correct this, we first make the fixed widths compensate for
1331 // this error. We then fix the relative widths the same way.
1333 sal_uInt16 nAbs = 0, nRel = 0;
1334 sal_uInt16 nFixedCols = 0;
1337 for( i = 0; i < m_nCols; i++ )
1339 SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
1340 if( !pColumn->IsRelWidthOption() || !pColumn->GetWidthOption() )
1342 // The column keeps its width.
1344 sal_uLong nColMax = pColumn->GetMax();
1345 pColumn->SetAbsColWidth( o3tl::narrowing<sal_uInt16>(nColMax) );
1347 sal_uLong nRelColWidth =
1348 (nColMax * m_nRelTabWidth) / nAbsTabWidth;
1349 sal_uLong nChkWidth =
1350 (nRelColWidth * nAbsTabWidth) / m_nRelTabWidth;
1351 if( nChkWidth < nColMax )
1353 else if( nChkWidth > nColMax )
1355 pColumn->SetRelColWidth( o3tl::narrowing<sal_uInt16>(nRelColWidth) );
1357 nAbs = nAbs + o3tl::narrowing<sal_uInt16>(nColMax);
1358 nRel = nRel + o3tl::narrowing<sal_uInt16>(nRelColWidth);
1362 // The to-be-distributed percentage of the maximum, the
1363 // relative and absolute widths. Here, nFixMax corresponds
1364 // to nAbs, so that we could've called it nAbs.
1365 // The code is, however, more readable like that.
1366 OSL_ENSURE( nFixMax == nAbs, "Two loops, two sums?
" );
1367 sal_uLong nDistMax = m_nMax - nFixMax;
1368 sal_uInt16 nDistAbsTabWidth = nAbsTabWidth - nAbs;
1369 sal_uInt16 nDistRelTabWidth = m_nRelTabWidth - nRel;
1371 for( i=0; i<m_nCols; i++ )
1373 SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
1374 if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption() > 0 )
1376 // The column gets proportionately wider.
1378 if( nFixedCols == m_nCols )
1380 pColumn->SetAbsColWidth( nAbsTabWidth-nAbs );
1381 pColumn->SetRelColWidth( m_nRelTabWidth-nRel );
1385 sal_uLong nColMax = pColumn->GetMax();
1386 pColumn->SetAbsColWidth(
1387 o3tl::narrowing<sal_uInt16>((nColMax * nDistAbsTabWidth) / nDistMax) );
1388 pColumn->SetRelColWidth(
1389 o3tl::narrowing<sal_uInt16>((nColMax * nDistRelTabWidth) / nDistMax) );
1391 nAbs = nAbs + pColumn->GetAbsColWidth();
1392 nRel = nRel + pColumn->GetRelColWidth();
1395 OSL_ENSURE( m_nCols==nFixedCols, "Missed a column!
" );
1397 else if (m_nCols > 0)
1400 throw o3tl::divide_by_zero();
1401 // No. So distribute the space regularly among all columns.
1402 for (sal_uInt16 i=0; i < m_nCols; ++i)
1404 sal_uLong nColMax = GetColumn( i )->GetMax();
1405 GetColumn( i )->SetAbsColWidth(
1406 o3tl::narrowing<sal_uInt16>((nColMax * nAbsTabWidth) / m_nMax) );
1407 GetColumn( i )->SetRelColWidth(
1408 o3tl::narrowing<sal_uInt16>((nColMax * m_nRelTabWidth) / m_nMax) );
1414 // Proportionately distribute the space that extends over the minimum
1415 // width among the columns.
1417 nAbsTabWidth = nAbsAvail;
1418 if( nAbsTabWidth < m_nMin )
1419 nAbsTabWidth = o3tl::narrowing<sal_uInt16>(m_nMin);
1421 if( nAbsTabWidth > nAbsAvail )
1423 OSL_ENSURE( IsTopTable(),
1424 "A nested table should become wider than the available space.
" );
1425 nAbsAvail = nAbsTabWidth;
1428 sal_uLong nAbsTabWidthL = nAbsTabWidth;
1432 throw o3tl::divide_by_zero();
1433 m_nRelTabWidth = o3tl::narrowing<sal_uInt16>((nAbsTabWidthL * nRelAvail) / nAbsAvail);
1436 m_nRelTabWidth = nAbsTabWidth;
1437 double nW = nAbsTabWidth - m_nMin;
1438 double nD = (m_nMax==m_nMin ? 1 : m_nMax-m_nMin);
1439 sal_uInt16 nAbs = 0, nRel = 0;
1440 for( sal_uInt16 i=0; i<m_nCols-1; i++ )
1442 double nd = GetColumn( i )->GetMax() - GetColumn( i )->GetMin();
1443 sal_uLong nAbsColWidth = GetColumn( i )->GetMin() + static_cast<sal_uLong>((nd*nW)/nD);
1444 sal_uLong nRelColWidth = nRelAvail
1445 ? (nAbsColWidth * m_nRelTabWidth) / nAbsTabWidth
1448 GetColumn( i )->SetAbsColWidth( o3tl::narrowing<sal_uInt16>(nAbsColWidth) );
1449 GetColumn( i )->SetRelColWidth( o3tl::narrowing<sal_uInt16>(nRelColWidth) );
1450 nAbs = nAbs + o3tl::narrowing<sal_uInt16>(nAbsColWidth);
1451 nRel = nRel + o3tl::narrowing<sal_uInt16>(nRelColWidth);
1453 GetColumn( m_nCols-1 )->SetAbsColWidth( nAbsTabWidth - nAbs );
1454 GetColumn( m_nCols-1 )->SetRelColWidth( m_nRelTabWidth - nRel );
1458 // Step 4: For nested tables we can have balancing cells on the
1459 // left or right. Here we calculate their width.
1460 m_nInhAbsLeftSpace = 0;
1461 m_nInhAbsRightSpace = 0;
1463 !(m_nRelLeftFill>0 || m_nRelRightFill>0 || nAbsTabWidth<nAbsAvail) )
1466 // Calculate the width of additional cells we use for
1467 // aligning inner tables.
1468 sal_uInt16 nAbsDist = o3tl::narrowing<sal_uInt16>(nAbsAvail-nAbsTabWidth);
1469 sal_uInt16 nRelDist = o3tl::narrowing<sal_uInt16>(nRelAvail-m_nRelTabWidth);
1470 sal_uInt16 nParentInhAbsLeftSpace = 0, nParentInhAbsRightSpace = 0;
1472 // Calculate the size and position of the additional cells.
1473 switch( m_eTableAdjust )
1475 case SvxAdjust::Right:
1476 nAbsLeftFill = nAbsLeftFill + nAbsDist;
1477 m_nRelLeftFill = m_nRelLeftFill + nRelDist;
1478 nParentInhAbsLeftSpace = nParentInhAbsSpace;
1480 case SvxAdjust::Center:
1482 sal_uInt16 nAbsLeftDist = nAbsDist / 2;
1483 nAbsLeftFill = nAbsLeftFill + nAbsLeftDist;
1484 nAbsRightFill += nAbsDist - nAbsLeftDist;
1485 sal_uInt16 nRelLeftDist = nRelDist / 2;
1486 m_nRelLeftFill = m_nRelLeftFill + nRelLeftDist;
1487 m_nRelRightFill += nRelDist - nRelLeftDist;
1488 nParentInhAbsLeftSpace = nParentInhAbsSpace / 2;
1489 nParentInhAbsRightSpace = nParentInhAbsSpace -
1490 nParentInhAbsLeftSpace;
1493 case SvxAdjust::Left:
1495 nAbsRightFill = nAbsRightFill + nAbsDist;
1496 m_nRelRightFill = m_nRelRightFill + nRelDist;
1497 nParentInhAbsRightSpace = nParentInhAbsSpace;
1501 // Filler widths are added to the outer columns, if there are no boxes
1502 // for them after the first pass (nWidth>0) or their width would become
1503 // too small or if there are COL tags and the filler width corresponds
1504 // to the border width.
1505 // In the last case we probably exported the table ourselves.
1506 if( m_nRelLeftFill &&
1507 ( m_nWidthSet>0 || nAbsLeftFill<MINLAY+m_nInhLeftBorderWidth ||
1508 (HasColTags() && nAbsLeftFill < nAbsLeftSpace+nParentInhAbsLeftSpace+20) ) )
1510 SwHTMLTableLayoutColumn *pColumn = GetColumn( 0 );
1511 pColumn->SetAbsColWidth( pColumn->GetAbsColWidth()+nAbsLeftFill );
1512 pColumn->SetRelColWidth( pColumn->GetRelColWidth()+m_nRelLeftFill );
1514 m_nInhAbsLeftSpace = nAbsLeftSpace + nParentInhAbsLeftSpace;
1516 if( m_nRelRightFill &&
1517 ( m_nWidthSet>0 || nAbsRightFill<MINLAY+m_nInhRightBorderWidth ||
1518 (HasColTags() && nAbsRightFill < nAbsRightSpace+nParentInhAbsRightSpace+20) ) )
1520 SwHTMLTableLayoutColumn *pColumn = GetColumn( m_nCols-1 );
1521 pColumn->SetAbsColWidth( pColumn->GetAbsColWidth()+nAbsRightFill );
1522 pColumn->SetRelColWidth( pColumn->GetRelColWidth()+m_nRelRightFill );
1523 m_nRelRightFill = 0;
1524 m_nInhAbsRightSpace = nAbsRightSpace + nParentInhAbsRightSpace;
1528static void lcl_ResizeLine( const SwTableLine* pLine, SwTwips *pWidth );
1530static void lcl_ResizeBox( const SwTableBox* pBox, SwTwips* pWidth )
1532 if( !pBox->GetSttNd() )
1535 for( const SwTableLine *pLine : pBox->GetTabLines() )
1536 lcl_ResizeLine( pLine, &nWidth );
1537 pBox->GetFrameFormat()->SetFormatAttr( SwFormatFrameSize( SwFrameSize::Variable, nWidth, 0 ));
1538 *pWidth = *pWidth + nWidth;
1542 *pWidth = *pWidth + pBox->GetFrameFormat()->GetFrameSize().GetSize().Width();
1546static void lcl_ResizeLine( const SwTableLine* pLine, SwTwips *pWidth )
1548 SwTwips nOldWidth = *pWidth;
1550 for( const SwTableBox* pBox : pLine->GetTabBoxes() )
1551 lcl_ResizeBox(pBox, pWidth );
1553 SAL_WARN_IF( nOldWidth && std::abs(*pWidth-nOldWidth) >= COLFUZZY, "sw.core
",
1554 "A box
's rows have all a different length" );
1557void SwHTMLTableLayout::SetWidths( bool bCallPass2, sal_uInt16 nAbsAvail,
1558 sal_uInt16 nRelAvail, sal_uInt16 nAbsLeftSpace,
1559 sal_uInt16 nAbsRightSpace,
1560 sal_uInt16 nParentInhAbsSpace )
1562 // SetWidth must have been passed through once more for every cell in the
1566 // Step 0: If necessary, we call the layout algorithm of Pass2.
1568 AutoLayoutPass2( nAbsAvail, nRelAvail, nAbsLeftSpace, nAbsRightSpace,
1569 nParentInhAbsSpace );
1571 // Step 1: Set the new width in all content boxes.
1572 // Because the boxes don't know anything about the HTML table structure,
1575 for( sal_uInt16 i=0; i<
m_nRows; i++ )
1577 for( sal_uInt16 j=0; j<m_nCols; j++ )
1579 SwHTMLTableLayoutCell *pCell = GetCell( i, j );
1581 SwHTMLTableLayoutCnts* pContents = pCell->GetContents().get();
1582 while( pContents && !pContents->IsWidthSet(m_nWidthSet) )
1584 SwTableBox *pBox = pContents->GetTableBox();
1587 SetBoxWidth( pBox, j, pCell->GetColSpan() );
1589 else if (SwHTMLTableLayout *pTable = pContents->GetTable())
1591 sal_uInt16 nAbs = 0, nRel = 0, nLSpace = 0, nRSpace = 0,
1595 sal_uInt16 nColSpan = pCell->GetColSpan();
1596 GetAvail( j, nColSpan, nAbs, nRel );
1597 nLSpace = GetLeftCellSpace( j, nColSpan );
1598 nRSpace = GetRightCellSpace( j, nColSpan );
1599 nInhSpace = GetInhCellSpace( j, nColSpan );
1601 pTable->SetWidths( bCallPass2, nAbs, nRel,
1606 pContents->SetWidthSet( m_nWidthSet );
1607 pContents = pContents->GetNext().get();
1625 "Table width is not equal to the row width" );
1645 if( pFlyFrameFormat )
1652 aFlyFrameSize.SetWidth(
m_nMin > USHRT_MAX ? USHRT_MAX
1665 for (
size_t n = 0;
n < rLines.
size(); ++
n)
1700 if( 0 == nAbsAvail )
1702 OSL_ENSURE(
IsTopTable(),
"Resize must only be called for top tables!" );
1722 nAbsAvail = nVisAreaWidth;
1750 Resize_( nAbsAvail, bRecalc );
1752 else if( nDelay > 0 )
1761 Resize_( nAbsAvail, bRecalc );
1771 Resize( nAbsAvail,
true );
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
tools::Long GetWidth() const
const SwFrame * GetAnchorFrame() const
SwFormatColl & GetAnyFormatColl() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
general base class for all free-flowing frames
const SwRect & getFrameArea() const
const SwRect & getFramePrintArea() const
Base class of the Writer layout elements.
SwLayoutFrame * GetUpper()
sal_uInt16 GetColSpan() const
bool IsPercentWidthOption() const
bool HasNoWrapOption() const
sal_uInt16 GetWidthOption() const
const std::shared_ptr< SwHTMLTableLayoutCnts > & GetContents() const
SwHTMLTableLayoutCell(std::shared_ptr< SwHTMLTableLayoutCnts > xCnts, sal_uInt16 nRSpan, sal_uInt16 nCSpan, sal_uInt16 nWidthOpt, bool bPercentWidthOpt, bool bNWrapOpt)
const std::shared_ptr< SwHTMLTableLayoutCnts > & GetNext() const
Calculation of next node.
SwHTMLTableLayout * GetTable() const
void SetPass1Done(sal_uInt8 nRef)
const SwStartNode * m_pStartNode
During first run there are still no boxes.
const SwStartNode * GetStartNode() const
bool HasNoBreakTag() const
SwHTMLTableLayoutCnts(const SwStartNode *pSttNd, std::shared_ptr< SwHTMLTableLayout > aTab, bool bNoBreakTag, std::shared_ptr< SwHTMLTableLayoutCnts > rNxt)
bool IsPass1Done(sal_uInt8 nRef) const
SwTableBox * m_pBox
Only one of the following two pointers may be set!
void AddToMin(sal_uLong nVal)
sal_uLong GetMinNoAlign() const
void ClearPass1Info(bool bWidthOpt)
sal_uLong GetMaxNoAlign() const
void MergeCellWidthOption(sal_uInt16 nWidth, bool bPercent)
SwHTMLTableLayoutColumn(sal_uInt16 nColWidthOpt, bool bRelColWidthOpt, bool bLBorder)
void SetMax(sal_uLong nVal)
sal_uInt16 GetWidthOption() const
void AddToMax(sal_uLong nVal)
void SetMinMax(sal_uLong nMin, sal_uLong nMax)
void MergeMinMaxNoAlign(sal_uLong nMin, sal_uLong nMax, sal_uLong nAbsMin)
sal_uInt16 GetRelColWidth() const
sal_uLong GetAbsMinNoAlign() const
sal_uInt16 GetAbsColWidth() const
bool IsRelWidthOption() const
SwFrameFormat * FindFlyFrameFormat() const
sal_uInt8 m_nPass1Done
Reference-values for.
void AddBorderWidth(sal_uLong &rMin, sal_uLong &rMax, sal_uLong &rAbsMin, sal_uInt16 nCol, sal_uInt16 nColSpan, bool bSwBorders=true) const
sal_uInt16 m_nCols
Column count.
sal_uInt16 GetLeftCellSpace(sal_uInt16 nCol, sal_uInt16 nColSpan, bool bSwBorders=true) const
The border widths are calculated like in Netscape: Outer border: BORDER + CELLSPACING + CELLPADDING I...
void SetWidths(bool bCallPass2=false, sal_uInt16 nAbsAvail=0, sal_uInt16 nRelAvail=0, sal_uInt16 nAbsLeftSpace=0, sal_uInt16 nAbsRightSpace=0, sal_uInt16 nParentInhSpace=0)
SwHTMLTableLayoutColumn * GetColumn(sal_uInt16 nCol) const
bool m_bDelayedResizeRecalc
Param for delayed Resize.
sal_uInt16 GetBrowseWidthByTabFrame(const SwTabFrame &rTabFrame) const
Calculates available width by table-frame.
const SwDoc & GetDoc() const
sal_uInt16 m_nWidthOption
Width of table (in Twips or %).
sal_uInt16 m_nRows
Row count.
void Resize_(sal_uInt16 nAbsAvail, bool bRecalc)
sal_uInt16 m_nRelTabWidth
Relative width of table.
bool m_bBordersChanged
Borders have been changed.
bool m_bUseRelWidth
SwTable gets relative width.
const SwTable * m_pSwTable
SwTable (Top-Table only).
SwTwips m_nRightBorderWidth
bool Resize(sal_uInt16 nAbsAvail, bool bRecalc=false, bool bForce=false, sal_uLong nDelay=0)
Recalculation of table widths for available width that has been passed.
void SetBoxWidth(SwTableBox *pBox, sal_uInt16 nCol, sal_uInt16 nColSpan) const
sal_uInt16 GetRightCellSpace(sal_uInt16 nCol, sal_uInt16 nColSpan, bool bSwBorders=true) const
SwHTMLTableLayoutCell * GetCell(sal_uInt16 nRow, sal_uInt16 nCol) const
bool HasColsOption() const
sal_uInt16 m_nDelayedResizeAbsAvail
Param for delayed Resize.
sal_uInt16 m_nCellPadding
Space to contents (in Twips).
sal_uInt16 GetBrowseWidthByTable(const SwDoc &rDoc) const
Calculates available width by the table-frame or static GetBrowseWidth if no layout exists.
bool m_bMustNotRecalc
Table may not be adapted to its contents.
void GetAvail(sal_uInt16 nCol, sal_uInt16 nColSpan, sal_uInt16 &rAbsAvail, sal_uInt16 &rRelAvail) const
SwTwips m_nLeftBorderWidth
Line strength of outer border, or rather the space needed for it as calculated by Netscape.
bool m_bPercentWidthOption
Width is given in percent.
static sal_uInt16 GetBrowseWidthByVisArea(const SwDoc &rDoc)
sal_uLong m_nMin
Minimal width of table (Twips).
const SwStartNode * GetAnyBoxStartNode() const
SwHTMLTableLayout(const SwTable *pSwTable, sal_uInt16 nRows, sal_uInt16 nCols, bool bColsOpt, bool ColTgs, sal_uInt16 nWidth, bool bPercentWidth, sal_uInt16 nBorderOpt, sal_uInt16 nCellPad, sal_uInt16 nCellSp, SvxAdjust eAdjust, sal_uInt16 nLMargin, sal_uInt16 nRMargin, sal_uInt16 nBWidth, sal_uInt16 nLeftBWidth, sal_uInt16 nRightBWidth)
bool MayBeInFlyFrame() const
bool m_bMustResize
Table width must be defined.
sal_uLong m_nMax
Maximal width of table (Twips).
void BordersChanged(sal_uInt16 nAbsAvail)
sal_uInt16 m_nLastResizeAbsAvail
Timer m_aResizeTimer
Timer for DelayedResize.
static sal_uInt16 GetBrowseWidth(const SwDoc &rDoc)
Calculate available width.
bool m_bMustNotResize
Table may not be resized.
sal_uInt16 m_nCellSpacing
Cell spacing (in Twips).
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
SwNodeOffset GetIndex() const
SwTableNode * FindTableNode()
Search table node, in which it is.
const SwEndNode * EndOfSectionNode() const
void Width(tools::Long nNew)
The root element of a Writer document layout.
void StartAllAction()
Set up Start-/EndAction for all Shells on an as high as possible (Shell section) level.
bool IsCallbackActionEnabled() const
Starts a section of nodes in the document model.
SwTabFrame is one table in the document layout, containing rows (which contain cells).
bool CalcFlyOffsets(SwTwips &rUpper, tools::Long &rLeftOffset, tools::Long &rRightOffset, SwTwips *pSpaceBelowBottom) const
Calculate the offsets arising because of FlyFrames.
SwTableBox is one table cell in the document model.
SwFrameFormat * GetFrameFormat()
SwTableLines & GetTabLines()
const SwStartNode * GetSttNd() const
SwTableLine is one table row in the document model.
SwTableBoxes & GetTabBoxes()
SwTableLine * front() const
const SwTable & GetTable() const
SwTable is one table in the document model, containing rows (which contain cells).
SwTableLines & GetTabLines()
SwTableFormat * GetFrameFormat()
SwHTMLTableLayout * GetHTMLTableLayout()
SwTextNode is a paragraph in the document model.
void GetMinMaxSize(SwNodeOffset nIndex, sal_uLong &rMin, sal_uLong &rMax, sal_uLong &rAbs) const
Is in itratr.
bool getBrowseMode() const
const SwViewOption * GetViewOptions() const
SwRootFrame * GetLayout() const
sal_Int32 GetBrowseWidth() const
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
@ Variable
Frame is variable in Var-direction.
@ Minimum
Value in Var-direction gives minimum (can be exceeded but not be less).
IMPL_LINK_NOARG(SwHTMLTableLayout, DelayedResize_Impl, Timer *, void)
static void lcl_GetMinMaxSize(sal_uLong &rMinNoAlignCnts, sal_uLong &rMaxNoAlignCnts, sal_uLong &rAbsMinNoAlignCnts, SwTextNode const *pTextNd, SwNodeOffset nIdx, bool bNoBreak)
static void lcl_ResizeLine(const SwTableLine *pLine, SwTwips *pWidth)
#define HTMLTABLE_RESIZE_NOW
#define LINK(Instance, Class, Member)
#define SAL_WARN_IF(condition, area, stream)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Dialog to specify the properties of date form field.
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
SwNodeOffset abs(const SwNodeOffset &a)
const sal_uInt16 USER_FMT
POLLCOLL-groups:
constexpr SwTwips MIN_BORDER_DIST
void CheckBoxWidth(const SwTableLine &rLine, SwTwips nSize)