42 #include <osl/diagnose.h>
50 #define MAX_TABWIDTH (USHRT_MAX - 2001)
54 class SwHTMLTableLayoutConstraints
58 sal_uInt16 m_nColSpan;
60 std::unique_ptr<SwHTMLTableLayoutConstraints> m_pNext;
66 sal_uInt16 nCol, sal_uInt16 nColSp );
68 sal_uLong GetMinNoAlign()
const {
return m_nMinNoAlign; }
69 sal_uLong GetMaxNoAlign()
const {
return m_nMaxNoAlign; }
71 SwHTMLTableLayoutConstraints *InsertNext( SwHTMLTableLayoutConstraints *pNxt );
72 SwHTMLTableLayoutConstraints* GetNext()
const {
return m_pNext.get(); }
74 sal_uInt16 GetColSpan()
const {
return m_nColSpan; }
75 sal_uInt16 GetColumn()
const {
return m_nCol; }
81 std::shared_ptr<SwHTMLTableLayout>
const& rTab,
83 std::shared_ptr<SwHTMLTableLayoutCnts>
const& rNxt ) :
84 m_xNext( rNxt ), m_pBox( nullptr ), m_xTable( rTab ), m_pStartNode( pSttNd ),
85 m_nPass1Done( 0 ), m_nWidthSet( 0 ), m_bNoBreakTag( bNoBrTag )
94 sal_uInt16 nRSpan, sal_uInt16 nCSpan,
95 sal_uInt16 nWidth,
bool bPercentWidth,
98 m_nRowSpan( nRSpan ), m_nColSpan( nCSpan ),
99 m_nWidthOption( nWidth ), m_bPercentWidthOption( bPercentWidth ),
100 m_bNoWrapOption( bNWrapOpt )
107 m_nMin(0), m_nMax(0),
108 m_nAbsColWidth(0), m_nRelColWidth(0),
109 m_nWidthOption( nWidth ), m_bRelWidthOption( bRelWidth ),
110 m_bLeftBorder( bLBorder )
113 SwHTMLTableLayoutConstraints::SwHTMLTableLayoutConstraints(
sal_uLong nMin,
sal_uLong nMax,
114 sal_uInt16 nRw, sal_uInt16 nColumn,
119 , m_nMinNoAlign(nMin)
120 , m_nMaxNoAlign(nMax)
123 SwHTMLTableLayoutConstraints *SwHTMLTableLayoutConstraints::InsertNext(
124 SwHTMLTableLayoutConstraints *pNxt )
126 SwHTMLTableLayoutConstraints *pPrev =
nullptr;
127 SwHTMLTableLayoutConstraints *pConstr =
this;
130 if (pConstr->m_nRow > pNxt->m_nRow || pConstr->GetColumn() > pNxt->GetColumn())
133 pConstr = pConstr->GetNext();
138 pNxt->m_pNext = std::move(pPrev->m_pNext);
139 pPrev->m_pNext.reset(pNxt);
144 pNxt->m_pNext.reset(
this);
152 sal_uInt16 nRws, sal_uInt16 nCls,
153 bool bColsOpt,
bool bColTgs,
154 sal_uInt16 nWdth,
bool bPercentWdth,
155 sal_uInt16 nBorderOpt, sal_uInt16 nCellPad,
157 sal_uInt16 nLMargin, sal_uInt16 nRMargin,
158 sal_uInt16 nBWidth, sal_uInt16 nLeftBWidth,
159 sal_uInt16 nRightBWidth )
161 , m_aCells( static_cast<size_t>(nRws)*nCls )
162 , m_pSwTable( pTable )
167 , m_nLeftMargin( nLMargin )
168 , m_nRightMargin( nRMargin )
169 , m_nInhAbsLeftSpace( 0 )
170 , m_nInhAbsRightSpace( 0 )
171 , m_nRelLeftFill( 0 )
172 , m_nRelRightFill( 0 )
173 , m_nRelTabWidth( 0 )
174 , m_nWidthOption( nWdth )
175 , m_nCellPadding( nCellPad )
176 , m_nCellSpacing( nCellSp )
177 , m_nBorder( nBorderOpt )
178 , m_nLeftBorderWidth( nLeftBWidth )
179 , m_nRightBorderWidth( nRightBWidth )
180 , m_nInhLeftBorderWidth( 0 )
181 , m_nInhRightBorderWidth( 0 )
182 , m_nBorderWidth( nBWidth )
183 , m_nDelayedResizeAbsAvail( 0 )
184 , m_nLastResizeAbsAvail( 0 )
187 , m_eTableAdjust( eAdjust )
188 , m_bColsOption( bColsOpt )
189 , m_bColTags( bColTgs )
190 , m_bPercentWidthOption( bPercentWdth )
191 , m_bUseRelWidth( false )
192 , m_bMustResize( true )
193 , m_bExportable( true )
194 , m_bBordersChanged( false )
195 , m_bMayBeInFlyFrame( false )
196 , m_bDelayedResizeRecalc( false)
197 , m_bMustNotResize( false )
198 , m_bMustNotRecalc( false )
201 DelayedResize_Impl ) );
216 bool bSwBorders )
const
227 else if( bSwBorders )
237 OSL_ENSURE( !m_nCellPadding,
"GetLeftCellSpace: CELLPADDING!=0" );
249 bool bSwBorders )
const
259 else if( bSwBorders &&
GetColumn(nCol)->HasLeftBorder() &&
262 OSL_ENSURE( !
m_nCellPadding,
"GetRightCellSpace: CELLPADDING!=0" );
274 sal_uInt16 nCol, sal_uInt16 nColSpan,
275 bool bSwBorders )
const
286 sal_uInt16 nColSpan )
const
300 sal_uInt16& rAbsAvail, sal_uInt16& rRelAvail )
const
304 for( sal_uInt16
i=nCol;
i<nCol+nColSpan;
i++ )
348 static_cast<const SwFlyFrame *
>(pUpper)->GetAnchorFrame() )
353 const SwFrame *pAnchor =
static_cast<const SwFlyFrame *
>(pUpper)->GetAnchorFrame();
367 rTabFrame.
CalcFlyOffsets( nUpperDummy, nLeftOffset, nRightOffset );
368 nWidth -= (nLeftOffset + nRightOffset);
375 sal_uInt16 nBrowseWidth = 0;
394 while(
nullptr == (pBoxSttNd = pBox->
GetSttNd()) )
397 "Box without start node and lines" );
399 "Line without boxes" );
409 OSL_ENSURE( pTableNd,
"No Table-Node?" );
417 pTextNd->
GetMinMaxSize( nIdx, rMinNoAlignCnts, rMaxNoAlignCnts,
418 rAbsMinNoAlignCnts );
419 OSL_ENSURE( rAbsMinNoAlignCnts <= rMinNoAlignCnts,
420 "GetMinMaxSize: absmin > min" );
421 OSL_ENSURE( rMinNoAlignCnts <= rMaxNoAlignCnts,
422 "GetMinMaxSize: max > min" );
436 rMinNoAlignCnts = rMaxNoAlignCnts;
437 rAbsMinNoAlignCnts = rMaxNoAlignCnts;
447 bool bFixRelWidths =
false;
450 std::unique_ptr<SwHTMLTableLayoutConstraints> xConstraints;
459 for( sal_uInt16 j=0; j<
m_nRows; j++ )
467 if( nColSpan < nColSkip )
473 if( nColSpan < nMinColSpan )
474 nMinColSpan = nColSpan;
489 while (!rDoc.
GetNodes()[nIdx]->IsEndNode())
504 if( nMinNoAlignCnts > nMinNoAlignCell )
505 nMinNoAlignCell = nMinNoAlignCnts;
506 if( nMaxNoAlignCnts > nMaxNoAlignCell )
507 nMaxNoAlignCell = nMaxNoAlignCnts;
508 if( nAbsMinNoAlignCnts > nAbsMinNoAlignCell )
509 nAbsMinNoAlignCell = nAbsMinNoAlignCnts;
528 if( nTabWidth >= nAbsMinTableCnts )
530 nMaxTableCnts = nTabWidth;
531 nAbsMinTableCnts = nTabWidth;
535 nMaxTableCnts = nAbsMinTableCnts;
539 if( nMaxTableCnts > nMaxTableCell )
540 nMaxTableCell = nMaxTableCnts;
541 if( nAbsMinTableCnts > nAbsMinTableCell )
542 nAbsMinTableCell = nAbsMinTableCnts;
552 OSL_ENSURE(
false,
"Sub tables in HTML import?" );
553 pChild->AutoLayoutPass1();
554 sal_uLong nMaxTableCnts = pChild->m_nMax;
555 sal_uLong nAbsMinTableCnts = pChild->m_nMin;
559 if( !pChild->m_bPercentWidthOption && pChild->m_nWidthOption )
561 sal_uLong nTabWidth = pChild->m_nWidthOption;
562 if( nTabWidth >= nAbsMinTableCnts )
564 nMaxTableCnts = nTabWidth;
565 nAbsMinTableCnts = nTabWidth;
569 nMaxTableCnts = nAbsMinTableCnts;
573 if( nMaxTableCnts > nMaxTableCell )
574 nMaxTableCell = nMaxTableCnts;
575 if( nAbsMinTableCnts > nAbsMinTableCell )
576 nAbsMinTableCell = nAbsMinTableCnts;
579 pCnts = pCnts->
GetNext().get();
585 if( nMaxTableCell > nMaxNoAlignCell )
586 nMaxNoAlignCell = nMaxTableCell;
587 if( nAbsMinTableCell > nAbsMinNoAlignCell )
589 nAbsMinNoAlignCell = nAbsMinTableCell;
590 if( nMinNoAlignCell < nAbsMinNoAlignCell )
591 nMinNoAlignCell = nAbsMinNoAlignCell;
592 if( nMaxNoAlignCell < nMinNoAlignCell )
593 nMaxNoAlignCell = nMinNoAlignCell;
606 if( nWidth==0 || bRelWidth )
608 nMinNoAlignCell = nMaxNoAlignCell;
609 nAbsMinNoAlignCell = nMaxNoAlignCell;
613 if( nWidth>nMinNoAlignCell )
614 nMinNoAlignCell = nWidth;
615 if( nWidth>nAbsMinNoAlignCell )
616 nAbsMinNoAlignCell = nWidth;
621 if( nMinNoAlignCell <
MINLAY )
623 if( nMaxNoAlignCell <
MINLAY )
625 if( nAbsMinNoAlignCell <
MINLAY )
626 nAbsMinNoAlignCell =
MINLAY;
630 nAbsMinNoAlignCell, i, nColSpan );
637 nAbsMinNoAlignCell );
650 sal_uLong nAbsWidth = nWidth, nDummy = 0, nDummy2 = 0;
652 i, nColSpan,
false );
654 if( nAbsWidth >= nMinNoAlignCell )
656 nMaxNoAlignCell = nAbsWidth;
658 nMinNoAlignCell = nAbsWidth;
660 else if( nAbsWidth >= nAbsMinNoAlignCell )
662 nMaxNoAlignCell = nAbsWidth;
663 nMinNoAlignCell = nAbsWidth;
667 nMaxNoAlignCell = nAbsMinNoAlignCell;
668 nMinNoAlignCell = nAbsMinNoAlignCell;
672 nMinNoAlignCell = nAbsMinNoAlignCell;
674 SwHTMLTableLayoutConstraints *pConstr =
675 new SwHTMLTableLayoutConstraints( nMinNoAlignCell,
676 nMaxNoAlignCell, j, i, nColSpan );
679 SwHTMLTableLayoutConstraints* pConstraints = xConstraints->InsertNext(pConstr);
680 xConstraints.release();
681 xConstraints.reset(pConstraints);
684 xConstraints.reset(pConstr);
689 OSL_ENSURE( nMinColSpan>0 && nColSkip>0 && nColSkip <= nMinColSpan,
690 "Layout pass 1: Columns are being forgotten!" );
692 "Layout pass 1: unnecessary pass through the loop or a bug" );
734 pColumn->
SetMinMax( nAbsWidth, nAbsWidth );
764 SwHTMLTableLayoutConstraints *pConstr = xConstraints.get();
769 sal_uInt16 nCol = pConstr->GetColumn();
770 sal_uInt16 nColSpan = pConstr->GetColSpan();
771 sal_uLong nConstrMin = pConstr->GetMinNoAlign();
772 sal_uLong nConstrMax = pConstr->GetMaxNoAlign();
777 for( sal_uInt16 j=nCol; j<nCol+nColSpan; j++ )
780 nColsMin += pColumn->
GetMin();
781 nColsMax += pColumn->
GetMax();
784 if( nColsMin<nConstrMin )
789 if( nConstrMin > nColsMax )
792 sal_uInt16 nEndCol = nCol+nColSpan;
794 for( sal_uInt16 ic=nCol; ic<nEndCol; ic++ )
807 nAdd = (nColMin * nMinD) / nColsMin;
815 OSL_ENSURE( nDiff >= nAdd,
"Ooops: nDiff is not correct anymore" );
818 if( nColMax < nColMin )
833 for( sal_uInt16 ic=nCol; ic<nCol+nColSpan; ic++ )
844 "Why is the Column suddenly too narrow?" );
856 for( sal_uInt16 ic=nCol; ic<nCol+nColSpan; ic++ )
868 pConstr = pConstr->GetNext();
896 nAbsMin += pColumn->
GetMin();
917 OSL_ENSURE( 0==nRel || nQuot!=ULONG_MAX,
918 "Where did the relative columns go?" );
929 "Maximum column width is lower than the minimum column width" );
937 sal_uInt16 nRelCols = 0;
941 OSL_ENSURE( nRel<=100, "relative width of all columns > 100%
" );
942 SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
943 if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption() )
945 // Make sure that the relative widths don't go above 100%
946 sal_uInt16 nColWidth = pColumn->GetWidthOption();
947 if( nRel+nColWidth > 100 )
949 nColWidth = 100 - nRel;
950 pColumn->SetWidthOption( nColWidth );
952 nRelMax += pColumn->GetMax();
953 nRel = nRel + nColWidth;
956 else if( !pColumn->GetMin() )
958 // The column is empty (so it was solely created by
959 // COLSPAN) and therefore must not be assigned a % width.
964 // If there are percentages left we distribute them to the columns
965 // that don't have a width setting. Like in Netscape we distribute
966 // the remaining percentages according to the ratio of the maximum
967 // width of the affected columns.
968 // For the maximum widths we also take the fixed-width columns
969 // into account. Is that correct?
970 sal_uLong nFixMax = 0;
971 if( nRel < 100 && nRelCols < m_nCols )
973 nFixMax = m_nMax - nRelMax;
974 SAL_WARN_IF(!nFixMax, "sw.core
", "bad fixed width
max");
978 sal_uInt16 nRelLeft = 100 - nRel;
979 for( i=0; i<m_nCols; i++ )
981 SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
982 if( !pColumn->IsRelWidthOption() &&
983 !pColumn->GetWidthOption() &&
986 // the next column gets the rest
987 sal_uInt16 nColWidth =
988 static_cast<sal_uInt16>((pColumn->GetMax() * nRelLeft) / nFixMax);
989 pColumn->SetWidthOption( nColWidth );
994 // adjust the maximum widths now accordingly
995 sal_uLong nQuotMax = ULONG_MAX;
996 sal_uLong nOldMax = m_nMax;
998 for( i=0; i<m_nCols; i++ )
1000 // Columns with a % setting are adapted accordingly.
1002 // - do not have a % setting and are located within a tables
1003 // with COLS and WIDTH, or
1004 // - their width is 0%
1005 // get set to the minimum width.
1006 SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
1007 if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption() )
1010 sal_uLong nColQuotMax;
1011 if( !m_nWidthOption )
1013 nNewMax = nOldMax * pColumn->GetWidthOption();
1014 nColQuotMax = nNewMax / pColumn->GetMax();
1018 nNewMax = m_nMin * pColumn->GetWidthOption();
1019 nColQuotMax = nNewMax / pColumn->GetMin();
1021 pColumn->SetMax( nNewMax );
1022 if( nColQuotMax < nQuotMax )
1023 nQuotMax = nColQuotMax;
1025 else if( HasColsOption() || m_nWidthOption ||
1026 (pColumn->IsRelWidthOption() &&
1027 !pColumn->GetWidthOption()) )
1028 pColumn->SetMax( pColumn->GetMin() );
1030 // and divide by the quotient
1031 SAL_WARN_IF(!nQuotMax, "sw.core
", "Where did the relative columns go?
");
1032 for (i = 0; i < m_nCols; ++i)
1034 SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
1035 if (pColumn->IsRelWidthOption() && pColumn->GetWidthOption() && nQuotMax)
1037 pColumn->SetMax( pColumn->GetMax() / nQuotMax );
1038 OSL_ENSURE( pColumn->GetMax() >= pColumn->GetMin(),
1039 "Minimum width is
one column bigger than maximum
" );
1040 if( pColumn->GetMax() < pColumn->GetMin() )
1041 pColumn->SetMax( pColumn->GetMin() );
1043 m_nMax += pColumn->GetMax();
1048 //TODO: provide documentation
1056 void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAvail,
1057 sal_uInt16 nAbsLeftSpace,
1058 sal_uInt16 nAbsRightSpace,
1059 sal_uInt16 nParentInhAbsSpace )
1061 // For a start we do a lot of plausibility tests
1063 // An absolute width always has to be passed
1064 OSL_ENSURE( nAbsAvail, "AutoLayout pass 2: No absolute width given
" );
1066 // A relative width must only be passed for tables within tables (?)
1067 OSL_ENSURE( IsTopTable() == (nRelAvail==0),
1068 "AutoLayout pass 2: Relative width at table in table or the other way around
" );
1070 // The table's minimum width must not be bigger than its maximum width
1071 OSL_ENSURE( m_nMin<=m_nMax, "AutoLayout pass 2: nMin > nMax
" );
1073 // Remember the available width for which the table was calculated.
1074 // This is a good place as we pass by here for the initial calculation
1075 // of the table in the parser and for each Resize_ call.
1076 m_nLastResizeAbsAvail = nAbsAvail;
1078 // Step 1: The available space is readjusted for the left/right border,
1079 // possibly existing filler cells and distances.
1081 // Distance to the content and border
1082 sal_uInt16 nAbsLeftFill = 0, nAbsRightFill = 0;
1083 if( !IsTopTable() &&
1084 GetMin() + nAbsLeftSpace + nAbsRightSpace <= nAbsAvail )
1086 nAbsLeftFill = nAbsLeftSpace;
1087 nAbsRightFill = nAbsRightSpace;
1090 // Left and right distance
1091 if( m_nLeftMargin || m_nRightMargin )
1095 // For the top table we always respect the borders, because we
1096 // never go below the table's minimum width.
1097 nAbsAvail -= (m_nLeftMargin + m_nRightMargin);
1099 else if( GetMin() + m_nLeftMargin + m_nRightMargin <= nAbsAvail )
1101 // Else, we only respect the borders if there's space available
1102 // for them (nMin has already been calculated!)
1103 nAbsLeftFill = nAbsLeftFill + m_nLeftMargin;
1104 nAbsRightFill = nAbsRightFill + m_nRightMargin;
1108 // Read just the available space
1110 m_nRelRightFill = 0;
1111 if( !IsTopTable() && (nAbsLeftFill>0 || nAbsRightFill) )
1113 sal_uLong nAbsLeftFillL = nAbsLeftFill, nAbsRightFillL = nAbsRightFill;
1115 m_nRelLeftFill = static_cast<sal_uInt16>((nAbsLeftFillL * nRelAvail) / nAbsAvail);
1116 m_nRelRightFill = static_cast<sal_uInt16>((nAbsRightFillL * nRelAvail) / nAbsAvail);
1118 nAbsAvail -= (nAbsLeftFill + nAbsRightFill);
1120 nRelAvail -= (m_nRelLeftFill + m_nRelRightFill);
1123 // Step 2: Calculate the absolute table width.
1124 sal_uInt16 nAbsTabWidth = 0;
1125 m_bUseRelWidth = false;
1126 if( m_nWidthOption )
1128 if( m_bPercentWidthOption )
1130 OSL_ENSURE( m_nWidthOption<=100, "Percentage value too high
" );
1131 if( m_nWidthOption > 100 )
1132 m_nWidthOption = 100;
1134 // The absolute width is equal to the given percentage of
1135 // the available width.
1136 // Top tables only get a relative width if the available space
1137 // is *strictly larger* than the minimum width.
1139 // CAUTION: We need the "strictly larger
" because changing from a
1140 // relative width to an absolute width by resizing would lead
1141 // to an infinite loop.
1143 // Because we do not call resize for tables in frames if the
1144 // frame has a non-relative width, we cannot play such games.
1146 // Let's play such games now anyway. We had a graphic in a 1% wide
1147 // table and it didn't fit in of course.
1148 nAbsTabWidth = static_cast<sal_uInt16>( (static_cast<sal_uLong>(nAbsAvail) * m_nWidthOption) / 100 );
1150 ( /*MayBeInFlyFrame() ||*/ static_cast<sal_uLong>(nAbsTabWidth) > m_nMin ) )
1152 nRelAvail = USHRT_MAX;
1153 m_bUseRelWidth = true;
1158 nAbsTabWidth = m_nWidthOption;
1159 if( nAbsTabWidth > MAX_TABWIDTH )
1160 nAbsTabWidth = MAX_TABWIDTH;
1162 // Tables within tables must never get wider than the available
1164 if( !IsTopTable() && nAbsTabWidth > nAbsAvail )
1165 nAbsTabWidth = nAbsAvail;
1169 OSL_ENSURE( IsTopTable() || nAbsTabWidth<=nAbsAvail,
1170 "AutoLayout pass 2: nAbsTabWidth > nAbsAvail
for table in table
" );
1171 OSL_ENSURE( !nRelAvail || nAbsTabWidth<=nAbsAvail,
1172 "AutoLayout pass 2: nAbsTabWidth > nAbsAvail
for relative width
" );
1174 // Catch for the two asserts above (we never know!)
1175 if( (!IsTopTable() || nRelAvail>0) && nAbsTabWidth>nAbsAvail )
1176 nAbsTabWidth = nAbsAvail;
1178 // Step 3: Identify the column width and, if applicable, the absolute
1179 // and relative table widths.
1180 if( (!IsTopTable() && m_nMin > static_cast<sal_uLong>(nAbsAvail)) ||
1181 m_nMin > MAX_TABWIDTH )
1184 // - an inner table's minimum is larger than the available space, or
1185 // - a top table's minimum is larger than USHORT_MAX the table
1186 // has to be adapted to the available space or USHORT_MAX.
1187 // We preserve the widths' ratio amongst themselves, however.
1189 nAbsTabWidth = IsTopTable() ? MAX_TABWIDTH : nAbsAvail;
1190 m_nRelTabWidth = (nRelAvail ? nRelAvail : nAbsTabWidth );
1192 // First of all, we check whether we can fit the layout constrains,
1193 // which are: Every cell's width excluding the borders must be at least
1196 sal_uLong nRealMin = 0;
1197 for( sal_uInt16 i=0; i<m_nCols; i++ )
1199 sal_uLong nRealColMin = MINLAY, nDummy1 = 0, nDummy2 = 0;
1200 AddBorderWidth( nRealColMin, nDummy1, nDummy2, i, 1 );
1201 nRealMin += nRealColMin;
1203 if( (nRealMin >= nAbsTabWidth) || (nRealMin >= m_nMin) )
1205 // "Rien ne va plus
": we cannot get the minimum column widths
1206 // the layout wants to have.
1208 sal_uInt16 nAbs = 0, nRel = 0;
1209 SwHTMLTableLayoutColumn *pColumn;
1210 for( sal_uInt16 i=0; i<m_nCols-1; i++ )
1212 pColumn = GetColumn( i );
1213 sal_uLong nColMin = pColumn->GetMin();
1214 if( nColMin <= USHRT_MAX )
1216 pColumn->SetAbsColWidth(
1217 static_cast<sal_uInt16>((nColMin * nAbsTabWidth) / m_nMin) );
1218 pColumn->SetRelColWidth(
1219 static_cast<sal_uInt16>((nColMin * m_nRelTabWidth) / m_nMin) );
1223 double nColMinD = nColMin;
1224 pColumn->SetAbsColWidth(
1225 static_cast<sal_uInt16>((nColMinD * nAbsTabWidth) / m_nMin) );
1226 pColumn->SetRelColWidth(
1227 static_cast<sal_uInt16>((nColMinD * m_nRelTabWidth) / m_nMin) );
1230 nAbs = nAbs + pColumn->GetAbsColWidth();
1231 nRel = nRel + pColumn->GetRelColWidth();
1233 pColumn = GetColumn( m_nCols-1 );
1234 pColumn->SetAbsColWidth( nAbsTabWidth - nAbs );
1235 pColumn->SetRelColWidth( m_nRelTabWidth - nRel );
1239 sal_uLong nDistAbs = nAbsTabWidth - nRealMin;
1240 sal_uLong nDistRel = m_nRelTabWidth - nRealMin;
1241 sal_uLong nDistMin = m_nMin - nRealMin;
1242 sal_uInt16 nAbs = 0, nRel = 0;
1243 SwHTMLTableLayoutColumn *pColumn;
1244 for( sal_uInt16 i=0; i<m_nCols-1; i++ )
1246 pColumn = GetColumn( i );
1247 sal_uLong nColMin = pColumn->GetMin();
1248 sal_uLong nRealColMin = MINLAY, nDummy1 = 0, nDummy2 = 0;
1249 AddBorderWidth( nRealColMin, nDummy1, nDummy2, i, 1 );
1251 if( nColMin <= USHRT_MAX )
1253 pColumn->SetAbsColWidth(
1254 static_cast<sal_uInt16>((((nColMin-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) );
1255 pColumn->SetRelColWidth(
1256 static_cast<sal_uInt16>((((nColMin-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) );
1260 double nColMinD = nColMin;
1261 pColumn->SetAbsColWidth(
1262 static_cast<sal_uInt16>((((nColMinD-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) );
1263 pColumn->SetRelColWidth(
1264 static_cast<sal_uInt16>((((nColMinD-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) );
1267 nAbs = nAbs + pColumn->GetAbsColWidth();
1268 nRel = nRel + pColumn->GetRelColWidth();
1270 pColumn = GetColumn( m_nCols-1 );
1271 pColumn->SetAbsColWidth( nAbsTabWidth - nAbs );
1272 pColumn->SetRelColWidth( m_nRelTabWidth - nRel );
1275 else if( m_nMax <= static_cast<sal_uLong>(nAbsTabWidth ? nAbsTabWidth : nAbsAvail) )
1278 // - the table has a fixed width and the table's maximum is
1280 //- the maximum is smaller than the available space,
1281 // we can take over the maximum as it is. Respectively
1282 // the table can only be adapted to the fixed width by
1283 // respecting the maximum.
1285 // No fixed width, use the maximum.
1287 nAbsTabWidth = static_cast<sal_uInt16>(m_nMax);
1289 // A top table may also get wider then the available space.
1290 if( nAbsTabWidth > nAbsAvail )
1292 OSL_ENSURE( IsTopTable(),
1293 "Table in table should
get wider than the surrounding cell.
" );
1294 nAbsAvail = nAbsTabWidth;
1297 // Only use the relative widths' fraction, that is used for the
1299 sal_uLong nAbsTabWidthL = nAbsTabWidth;
1303 throw o3tl::divide_by_zero();
1304 m_nRelTabWidth = static_cast<sal_uInt16>((nAbsTabWidthL * nRelAvail) / nAbsAvail);
1307 m_nRelTabWidth = nAbsTabWidth;
1309 // Are there columns width a percentage setting and some without one?
1310 sal_uLong nFixMax = m_nMax;
1311 for( sal_uInt16 i=0; i<m_nCols; i++ )
1313 const SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
1314 if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption()>0 )
1315 nFixMax -= pColumn->GetMax();
1318 if( nFixMax > 0 && nFixMax < m_nMax )
1320 // Yes, distribute the to-be-distributed space only to the
1321 // columns with a percentage setting.
1323 // In this case (and in this case only) there are columns
1324 // that exactly keep their maximum width, that is they neither
1325 // get smaller nor wider. When calculating the absolute width
1326 // from the relative width we can get rounding errors.
1327 // To correct this, we first make the fixed widths compensate for
1328 // this error. We then fix the relative widths the same way.
1330 sal_uInt16 nAbs = 0, nRel = 0;
1331 sal_uInt16 nFixedCols = 0;
1334 for( i = 0; i < m_nCols; i++ )
1336 SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
1337 if( !pColumn->IsRelWidthOption() || !pColumn->GetWidthOption() )
1339 // The column keeps its width.
1341 sal_uLong nColMax = pColumn->GetMax();
1342 pColumn->SetAbsColWidth( static_cast<sal_uInt16>(nColMax) );
1344 sal_uLong nRelColWidth =
1345 (nColMax * m_nRelTabWidth) / nAbsTabWidth;
1346 sal_uLong nChkWidth =
1347 (nRelColWidth * nAbsTabWidth) / m_nRelTabWidth;
1348 if( nChkWidth < nColMax )
1350 else if( nChkWidth > nColMax )
1352 pColumn->SetRelColWidth( static_cast<sal_uInt16>(nRelColWidth) );
1354 nAbs = nAbs + static_cast<sal_uInt16>(nColMax);
1355 nRel = nRel + static_cast<sal_uInt16>(nRelColWidth);
1359 // The to-be-distributed percentage of the maximum, the
1360 // relative and absolute widths. Here, nFixMax corresponds
1361 // to nAbs, so that we could've called it nAbs.
1362 // The code is, however, more readable like that.
1363 OSL_ENSURE( nFixMax == nAbs, "Two loops, two sums?
" );
1364 sal_uLong nDistMax = m_nMax - nFixMax;
1365 sal_uInt16 nDistAbsTabWidth = nAbsTabWidth - nAbs;
1366 sal_uInt16 nDistRelTabWidth = m_nRelTabWidth - nRel;
1368 for( i=0; i<m_nCols; i++ )
1370 SwHTMLTableLayoutColumn *pColumn = GetColumn( i );
1371 if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption() > 0 )
1373 // The column gets proportionately wider.
1375 if( nFixedCols == m_nCols )
1377 pColumn->SetAbsColWidth( nAbsTabWidth-nAbs );
1378 pColumn->SetRelColWidth( m_nRelTabWidth-nRel );
1382 sal_uLong nColMax = pColumn->GetMax();
1383 pColumn->SetAbsColWidth(
1384 static_cast<sal_uInt16>((nColMax * nDistAbsTabWidth) / nDistMax) );
1385 pColumn->SetRelColWidth(
1386 static_cast<sal_uInt16>((nColMax * nDistRelTabWidth) / nDistMax) );
1388 nAbs = nAbs + pColumn->GetAbsColWidth();
1389 nRel = nRel + pColumn->GetRelColWidth();
1392 OSL_ENSURE( m_nCols==nFixedCols, "Missed a column!
" );
1394 else if (m_nCols > 0)
1397 throw o3tl::divide_by_zero();
1398 // No. So distribute the space regularly among all columns.
1399 for (sal_uInt16 i=0; i < m_nCols; ++i)
1401 sal_uLong nColMax = GetColumn( i )->GetMax();
1402 GetColumn( i )->SetAbsColWidth(
1403 static_cast<sal_uInt16>((nColMax * nAbsTabWidth) / m_nMax) );
1404 GetColumn( i )->SetRelColWidth(
1405 static_cast<sal_uInt16>((nColMax * m_nRelTabWidth) / m_nMax) );
1411 // Proportionately distribute the space that extends over the minimum
1412 // width among the columns.
1414 nAbsTabWidth = nAbsAvail;
1415 if( nAbsTabWidth < m_nMin )
1416 nAbsTabWidth = static_cast<sal_uInt16>(m_nMin);
1418 if( nAbsTabWidth > nAbsAvail )
1420 OSL_ENSURE( IsTopTable(),
1421 "A nested table should become wider than the available space.
" );
1422 nAbsAvail = nAbsTabWidth;
1425 sal_uLong nAbsTabWidthL = nAbsTabWidth;
1429 throw o3tl::divide_by_zero();
1430 m_nRelTabWidth = static_cast<sal_uInt16>((nAbsTabWidthL * nRelAvail) / nAbsAvail);
1433 m_nRelTabWidth = nAbsTabWidth;
1434 double nW = nAbsTabWidth - m_nMin;
1435 double nD = (m_nMax==m_nMin ? 1 : m_nMax-m_nMin);
1436 sal_uInt16 nAbs = 0, nRel = 0;
1437 for( sal_uInt16 i=0; i<m_nCols-1; i++ )
1439 double nd = GetColumn( i )->GetMax() - GetColumn( i )->GetMin();
1440 sal_uLong nAbsColWidth = GetColumn( i )->GetMin() + static_cast<sal_uLong>((nd*nW)/nD);
1441 sal_uLong nRelColWidth = nRelAvail
1442 ? (nAbsColWidth * m_nRelTabWidth) / nAbsTabWidth
1445 GetColumn( i )->SetAbsColWidth( static_cast<sal_uInt16>(nAbsColWidth) );
1446 GetColumn( i )->SetRelColWidth( static_cast<sal_uInt16>(nRelColWidth) );
1447 nAbs = nAbs + static_cast<sal_uInt16>(nAbsColWidth);
1448 nRel = nRel + static_cast<sal_uInt16>(nRelColWidth);
1450 GetColumn( m_nCols-1 )->SetAbsColWidth( nAbsTabWidth - nAbs );
1451 GetColumn( m_nCols-1 )->SetRelColWidth( m_nRelTabWidth - nRel );
1455 // Step 4: For nested tables we can have balancing cells on the
1456 // left or right. Here we calculate their width.
1457 m_nInhAbsLeftSpace = 0;
1458 m_nInhAbsRightSpace = 0;
1460 !(m_nRelLeftFill>0 || m_nRelRightFill>0 || nAbsTabWidth<nAbsAvail) )
1463 // Calculate the width of additional cells we use for
1464 // aligning inner tables.
1465 sal_uInt16 nAbsDist = static_cast<sal_uInt16>(nAbsAvail-nAbsTabWidth);
1466 sal_uInt16 nRelDist = static_cast<sal_uInt16>(nRelAvail-m_nRelTabWidth);
1467 sal_uInt16 nParentInhAbsLeftSpace = 0, nParentInhAbsRightSpace = 0;
1469 // Calculate the size and position of the additional cells.
1470 switch( m_eTableAdjust )
1472 case SvxAdjust::Right:
1473 nAbsLeftFill = nAbsLeftFill + nAbsDist;
1474 m_nRelLeftFill = m_nRelLeftFill + nRelDist;
1475 nParentInhAbsLeftSpace = nParentInhAbsSpace;
1477 case SvxAdjust::Center:
1479 sal_uInt16 nAbsLeftDist = nAbsDist / 2;
1480 nAbsLeftFill = nAbsLeftFill + nAbsLeftDist;
1481 nAbsRightFill += nAbsDist - nAbsLeftDist;
1482 sal_uInt16 nRelLeftDist = nRelDist / 2;
1483 m_nRelLeftFill = m_nRelLeftFill + nRelLeftDist;
1484 m_nRelRightFill += nRelDist - nRelLeftDist;
1485 nParentInhAbsLeftSpace = nParentInhAbsSpace / 2;
1486 nParentInhAbsRightSpace = nParentInhAbsSpace -
1487 nParentInhAbsLeftSpace;
1490 case SvxAdjust::Left:
1492 nAbsRightFill = nAbsRightFill + nAbsDist;
1493 m_nRelRightFill = m_nRelRightFill + nRelDist;
1494 nParentInhAbsRightSpace = nParentInhAbsSpace;
1498 // Filler widths are added to the outer columns, if there are no boxes
1499 // for them after the first pass (nWidth>0) or their width would become
1500 // too small or if there are COL tags and the filler width corresponds
1501 // to the border width.
1502 // In the last case we probably exported the table ourselves.
1503 if( m_nRelLeftFill &&
1504 ( m_nWidthSet>0 || nAbsLeftFill<MINLAY+m_nInhLeftBorderWidth ||
1505 (HasColTags() && nAbsLeftFill < nAbsLeftSpace+nParentInhAbsLeftSpace+20) ) )
1507 SwHTMLTableLayoutColumn *pColumn = GetColumn( 0 );
1508 pColumn->SetAbsColWidth( pColumn->GetAbsColWidth()+nAbsLeftFill );
1509 pColumn->SetRelColWidth( pColumn->GetRelColWidth()+m_nRelLeftFill );
1511 m_nInhAbsLeftSpace = nAbsLeftSpace + nParentInhAbsLeftSpace;
1513 if( m_nRelRightFill &&
1514 ( m_nWidthSet>0 || nAbsRightFill<MINLAY+m_nInhRightBorderWidth ||
1515 (HasColTags() && nAbsRightFill < nAbsRightSpace+nParentInhAbsRightSpace+20) ) )
1517 SwHTMLTableLayoutColumn *pColumn = GetColumn( m_nCols-1 );
1518 pColumn->SetAbsColWidth( pColumn->GetAbsColWidth()+nAbsRightFill );
1519 pColumn->SetRelColWidth( pColumn->GetRelColWidth()+m_nRelRightFill );
1520 m_nRelRightFill = 0;
1521 m_nInhAbsRightSpace = nAbsRightSpace + nParentInhAbsRightSpace;
1525 static void lcl_ResizeLine( const SwTableLine* pLine, SwTwips *pWidth );
1527 static void lcl_ResizeBox( const SwTableBox* pBox, SwTwips* pWidth )
1529 if( !pBox->GetSttNd() )
1532 for( const SwTableLine *pLine : pBox->GetTabLines() )
1533 lcl_ResizeLine( pLine, &nWidth );
1534 pBox->GetFrameFormat()->SetFormatAttr( SwFormatFrameSize( SwFrameSize::Variable, nWidth, 0 ));
1535 *pWidth = *pWidth + nWidth;
1539 *pWidth = *pWidth + pBox->GetFrameFormat()->GetFrameSize().GetSize().Width();
1543 static void lcl_ResizeLine( const SwTableLine* pLine, SwTwips *pWidth )
1545 SwTwips nOldWidth = *pWidth;
1547 for( const SwTableBox* pBox : pLine->GetTabBoxes() )
1548 lcl_ResizeBox(pBox, pWidth );
1550 SAL_WARN_IF( nOldWidth && std::abs(*pWidth-nOldWidth) >= COLFUZZY, "sw.core
",
1551 "A box
's rows have all a different length" );
1554 void SwHTMLTableLayout::SetWidths( bool bCallPass2, sal_uInt16 nAbsAvail,
1555 sal_uInt16 nRelAvail, sal_uInt16 nAbsLeftSpace,
1556 sal_uInt16 nAbsRightSpace,
1557 sal_uInt16 nParentInhAbsSpace )
1559 // SetWidth must have been passed through once more for every cell in the
1563 // Step 0: If necessary, we call the layout algorithm of Pass2.
1565 AutoLayoutPass2( nAbsAvail, nRelAvail, nAbsLeftSpace, nAbsRightSpace,
1566 nParentInhAbsSpace );
1568 // Step 1: Set the new width in all content boxes.
1569 // Because the boxes don't know anything about the HTML table structure,
1572 for( sal_uInt16 i=0; i<
m_nRows; i++ )
1574 for( sal_uInt16 j=0; j<m_nCols; j++ )
1576 SwHTMLTableLayoutCell *pCell = GetCell( i, j );
1578 SwHTMLTableLayoutCnts* pContents = pCell->GetContents().get();
1579 while( pContents && !pContents->IsWidthSet(m_nWidthSet) )
1581 SwTableBox *pBox = pContents->GetTableBox();
1584 SetBoxWidth( pBox, j, pCell->GetColSpan() );
1586 else if (SwHTMLTableLayout *pTable = pContents->GetTable())
1588 sal_uInt16 nAbs = 0, nRel = 0, nLSpace = 0, nRSpace = 0,
1592 sal_uInt16 nColSpan = pCell->GetColSpan();
1593 GetAvail( j, nColSpan, nAbs, nRel );
1594 nLSpace = GetLeftCellSpace( j, nColSpan );
1595 nRSpace = GetRightCellSpace( j, nColSpan );
1596 nInhSpace = GetInhCellSpace( j, nColSpan );
1598 pTable->SetWidths( bCallPass2, nAbs, nRel,
1603 pContents->SetWidthSet( m_nWidthSet );
1604 pContents = pContents->GetNext().get();
1622 "Table width is not equal to the row width" );
1633 aFrameSize.SetWidthPercent( static_cast<sal_uInt8>(bRel ?
m_nWidthOption : 0) );
1642 if( pFlyFrameFormat )
1651 aFlyFrameSize.SetWidthPercent( static_cast<sal_uInt8>(m_nWidthOption) );
1662 for (
size_t n = 0;
n < rLines.
size(); ++
n)
1697 if( 0 == nAbsAvail )
1699 OSL_ENSURE(
IsTopTable(),
"Resize must only be called for top tables!" );
1719 nAbsAvail = nVisAreaWidth;
1747 Resize_( nAbsAvail, bRecalc );
1749 else if( nDelay > 0 )
1758 Resize_( nAbsAvail, bRecalc );
1768 Resize( nAbsAvail,
true );
SwHTMLTableLayoutColumn(sal_uInt16 nColWidthOpt, bool bRelColWidthOpt, bool bLBorder)
#define LINK(Instance, Class, Member)
const SwEndNode * EndOfSectionNode() const
Starts a section of nodes in the document model.
Base class of the Writer layout elements.
const SwStartNode * GetStartNode() const
tools::Long GetWidth() const
void AddBorderWidth(sal_uLong &rMin, sal_uLong &rMax, sal_uLong &rAbsMin, sal_uInt16 nCol, sal_uInt16 nColSpan, bool bSwBorders=true) const
bool m_bUseRelWidth
SwTable gets relative width.
sal_uLong GetIndex() const
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...
SwHTMLTableLayoutCnts(const SwStartNode *pSttNd, std::shared_ptr< SwHTMLTableLayout > const &rTab, bool bNoBreakTag, std::shared_ptr< SwHTMLTableLayoutCnts > const &rNxt)
const SwTable * m_pSwTable
SwTable (Top-Table only).
sal_uInt16 m_nWidthOption
Width of table (in Twips or %).
virtual const SwRootFrame * GetCurrentLayout() const =0
void SetBoxWidth(SwTableBox *pBox, sal_uInt16 nCol, sal_uInt16 nColSpan) const
bool HasNoWrapOption() const
bool m_bPercentWidthOption
Width is given in percent.
const SwStartNode * m_pStartNode
During first run there are still no boxes.
const SwRect & getFramePrintArea() const
SwFrameFormat * FindFlyFrameFormat() const
SwTabFrame is one table in the document layout, containing rows (which contain cells).
SwTableLine is one table row in the document model.
SwHTMLTableLayout * GetTable() const
Dialog to specify the properties of date form field.
bool MayBeInFlyFrame() const
SwTableLine * front() const
sal_uLong GetAbsMinNoAlign() const
SwHTMLTableLayoutCell(std::shared_ptr< SwHTMLTableLayoutCnts > const &rCnts, sal_uInt16 nRSpan, sal_uInt16 nCSpan, sal_uInt16 nWidthOpt, bool bPercentWidthOpt, bool bNWrapOpt)
void MergeMinMaxNoAlign(sal_uLong nMin, sal_uLong nMax, sal_uLong nAbsMin)
The root element of a Writer document layout.
sal_Int32 GetBrowseWidth() const
SwTableFormat * GetFrameFormat()
Value in Var-direction gives minimum (can be exceeded but not be less).
bool HasNoBreakTag() const
static void lcl_GetMinMaxSize(sal_uLong &rMinNoAlignCnts, sal_uLong &rMaxNoAlignCnts, sal_uLong &rAbsMinNoAlignCnts, SwTextNode const *pTextNd, sal_uLong nIdx, bool bNoBreak)
static sal_uInt16 GetBrowseWidthByVisArea(const SwDoc &rDoc)
bool CalcFlyOffsets(SwTwips &rUpper, tools::Long &rLeftOffset, tools::Long &rRightOffset) const
Calculate the offsets arising because of FlyFrames.
sal_uInt16 GetRelColWidth() const
static sal_uInt16 GetBrowseWidth(const SwDoc &rDoc)
Calculate available width.
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)
sal_uInt16 GetColSpan() const
const SwRect & getFrameArea() const
void MergeCellWidthOption(sal_uInt16 nWidth, bool bPercent)
bool getBrowseMode() const
sal_uInt16 GetWidthOption() const
void Width(tools::Long nNew)
void Resize_(sal_uInt16 nAbsAvail, bool bRecalc)
const SwTable & GetTable() const
bool m_bMustResize
Table width must be defined.
SwFormatColl & GetAnyFormatColl() const
void SetPass1Done(sal_uInt8 nRef)
sal_uInt16 GetBrowseWidthByTable(const SwDoc &rDoc) const
Calculates available width by the table-frame or static GetBrowseWidth if no layout exists...
const SwStartNode * GetAnyBoxStartNode() const
SwHTMLTableLayoutCell * GetCell(sal_uInt16 nRow, sal_uInt16 nCol) const
SwTwips m_nLeftBorderWidth
Line strength of outer border, or rather the space needed for it as calculated by Netscape...
sal_uInt16 GetRightCellSpace(sal_uInt16 nCol, sal_uInt16 nColSpan, bool bSwBorders=true) const
bool IsPercentWidthOption() const
bool IsRelWidthOption() const
sal_uInt8 m_nPass1Done
Reference-values for.
void CheckBoxWidth(const SwTableLine &rLine, SwTwips nSize)
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)
sal_uInt16 m_nDelayedResizeAbsAvail
Param for delayed Resize.
bool m_bMustNotResize
Table may not be resized.
sal_uInt16 m_nCellSpacing
Cell spacing (in Twips).
SwLayoutFrame * GetUpper()
void SetMax(sal_uLong nVal)
const std::shared_ptr< SwHTMLTableLayoutCnts > & GetContents() const
void BordersChanged(sal_uInt16 nAbsAvail)
virtual void Start() override
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.
SwFrameFormat * GetFrameFormat()
IMPL_LINK_NOARG(SwHTMLTableLayout, DelayedResize_Impl, Timer *, void)
void SetTimeout(sal_uInt64 nTimeoutMs)
sal_uInt16 m_nRelTabWidth
Relative width of table.
SwTableLines & GetTabLines()
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
SwTable is one table in the document model, containing rows (which contain cells).
void SetWidth(tools::Long n)
SwTableLines & GetTabLines()
bool m_bMustNotRecalc
Table may not be adapted to its contents.
bool m_bDelayedResizeRecalc
Param for delayed Resize.
const sal_uInt16 USER_FMT
POLLCOLL-groups:
void ClearPass1Info(bool bWidthOpt)
sal_uInt16 m_nCols
Column count.
SwTextNode is a paragraph in the document model.
bool HasColsOption() const
SwTableBoxes & GetTabBoxes()
const std::shared_ptr< SwHTMLTableLayoutCnts > & GetNext() const
Calculation of next node.
void GetMinMaxSize(sal_uLong nIndex, sal_uLong &rMin, sal_uLong &rMax, sal_uLong &rAbs) const
Is in itratr.
sal_uInt16 m_nLastResizeAbsAvail
const SwStartNode * GetSttNd() const
SwTableBox * m_pBox
Only one of the following two pointers may be set!
general base class for all free-flowing frames
#define SAL_WARN_IF(condition, area, stream)
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
const SwViewOption * GetViewOptions() const
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
SwTwips m_nRightBorderWidth
SwHTMLTableLayout * GetHTMLTableLayout()
void SetMinMax(sal_uLong nMin, sal_uLong nMax)
void AddToMin(sal_uLong nVal)
void GetAvail(sal_uInt16 nCol, sal_uInt16 nColSpan, sal_uInt16 &rAbsAvail, sal_uInt16 &rRelAvail) const
Timer m_aResizeTimer
Timer for DelayedResize.
sal_uLong m_nMin
Minimal width of table (Twips).
SwTableBox is one table cell in the document model.
void SetInvokeHandler(const Link< Timer *, void > &rLink)
SwTableNode * FindTableNode()
Search table node, in which it is.
const SwDoc & GetDoc() const
sal_uLong m_nMax
Maximal width of table (Twips).
sal_uLong GetMinNoAlign() const
sal_uInt16 GetAbsColWidth() const
void AddToMax(sal_uLong nVal)
void StartAllAction()
Set up Start-/EndAction for all Shells on an as high as possible (Shell section) level.
bool m_bBordersChanged
Borders have been changed.
bool IsPass1Done(sal_uInt8 nRef) const
sal_uInt16 GetBrowseWidthByTabFrame(const SwTabFrame &rTabFrame) const
Calculates available width by table-frame.
SwHTMLTableLayoutColumn * GetColumn(sal_uInt16 nCol) const
sal_uInt16 GetWidthOption() const
Frame is variable in Var-direction.
void EndAllAction(bool bVirDev=false)
static void lcl_ResizeLine(const SwTableLine *pLine, SwTwips *pWidth)
SwRootFrame * GetLayout() const
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
#define HTMLTABLE_RESIZE_NOW
sal_uInt16 m_nCellPadding
Space to contents (in Twips).
sal_uInt16 m_nRows
Row count.
bool IsCallbackActionEnabled() const
sal_uLong GetMaxNoAlign() const