1*1d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1d2dbeb0SAndrew Rist * distributed with this work for additional information 6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations 18*1d2dbeb0SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*1d2dbeb0SAndrew Rist *************************************************************/ 21*1d2dbeb0SAndrew Rist 22*1d2dbeb0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _HTMLTBL_HXX 25cdf0e10cSrcweir #define _HTMLTBL_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <vcl/timer.hxx> 29cdf0e10cSrcweir #include <editeng/svxenum.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "swtypes.hxx" 32cdf0e10cSrcweir #include "node.hxx" // Fuer SwStartNode 33cdf0e10cSrcweir 34cdf0e10cSrcweir 35cdf0e10cSrcweir class SwTableBox; 36cdf0e10cSrcweir class SwTable; 37cdf0e10cSrcweir class SwHTMLTableLayout; 38cdf0e10cSrcweir class SwDoc; 39cdf0e10cSrcweir class SwFrmFmt; 40cdf0e10cSrcweir 41cdf0e10cSrcweir #define HTMLTABLE_RESIZE_NOW (ULONG_MAX) 42cdf0e10cSrcweir 43cdf0e10cSrcweir class SwHTMLTableLayoutCnts 44cdf0e10cSrcweir { 45cdf0e10cSrcweir SwHTMLTableLayoutCnts *pNext; // der naechste Inhalt 46cdf0e10cSrcweir 47cdf0e10cSrcweir // von den beiden naechsten Pointern darf nur einer gesetzt sein! 48cdf0e10cSrcweir SwTableBox *pBox; // ein Box 49cdf0e10cSrcweir SwHTMLTableLayout *pTable; // eine "Tabelle in der Tabelle" 50cdf0e10cSrcweir 51cdf0e10cSrcweir // Beim ersten Durchlauf gibt es noch keine Boxen. Es wird dann 52cdf0e10cSrcweir // pStartNode anstelle von pBox verwendet. 53cdf0e10cSrcweir const SwStartNode *pStartNode; 54cdf0e10cSrcweir 55cdf0e10cSrcweir // Die folgenden Zahler geben an, wie oft ein Pass bereits fuer diesen 56cdf0e10cSrcweir // Inhalt durchgefuehrt wurde. Dazu werden sie mit einer Soll-Vorgabe 57cdf0e10cSrcweir // verglichen. Wird 255 erreicht laufen sie bei 0 weiter. So wird 58cdf0e10cSrcweir // eine Reinitialisierung bei jedem Resize vermieden. 59cdf0e10cSrcweir sal_uInt8 nPass1Done; // Wieoft wurde Pass 1 aufgerufen? 60cdf0e10cSrcweir sal_uInt8 nWidthSet; // Wieoft wurde die Breite gesetzt? 61cdf0e10cSrcweir 62cdf0e10cSrcweir sal_Bool bNoBreakTag; // <NOBR>-Tag ueber gesamten Inhalt 63cdf0e10cSrcweir 64cdf0e10cSrcweir public: 65cdf0e10cSrcweir 66cdf0e10cSrcweir SwHTMLTableLayoutCnts( const SwStartNode* pSttNd, SwHTMLTableLayout* pTab, 67cdf0e10cSrcweir sal_Bool bNoBreakTag, SwHTMLTableLayoutCnts* pNxt ); 68cdf0e10cSrcweir 69cdf0e10cSrcweir ~SwHTMLTableLayoutCnts(); 70cdf0e10cSrcweir 71cdf0e10cSrcweir void SetTableBox( SwTableBox *pBx ) { pBox = pBx; } 72cdf0e10cSrcweir SwTableBox *GetTableBox() const { return pBox; } 73cdf0e10cSrcweir 74cdf0e10cSrcweir SwHTMLTableLayout *GetTable() const { return pTable; } 75cdf0e10cSrcweir 76cdf0e10cSrcweir const SwStartNode *GetStartNode() const; 77cdf0e10cSrcweir 78cdf0e10cSrcweir // Ermitteln des naechsten Knotens 79cdf0e10cSrcweir SwHTMLTableLayoutCnts *GetNext() const { return pNext; } 80cdf0e10cSrcweir 81cdf0e10cSrcweir void SetWidthSet( sal_uInt8 nRef ) { nWidthSet = nRef; } 82cdf0e10cSrcweir sal_Bool IsWidthSet( sal_uInt8 nRef ) const { return nRef==nWidthSet; } 83cdf0e10cSrcweir 84cdf0e10cSrcweir void SetPass1Done( sal_uInt8 nRef ) { nPass1Done = nRef; } 85cdf0e10cSrcweir sal_Bool IsPass1Done( sal_uInt8 nRef ) const { return nRef==nPass1Done; } 86cdf0e10cSrcweir 87cdf0e10cSrcweir sal_Bool HasNoBreakTag() const { return bNoBreakTag; } 88cdf0e10cSrcweir }; 89cdf0e10cSrcweir 90cdf0e10cSrcweir /* */ 91cdf0e10cSrcweir 92cdf0e10cSrcweir class SwHTMLTableLayoutCell 93cdf0e10cSrcweir { 94cdf0e10cSrcweir SwHTMLTableLayoutCnts *pContents; // der Inhalt der Zelle 95cdf0e10cSrcweir 96cdf0e10cSrcweir sal_uInt16 nRowSpan; // ROWSPAN der Zelle 97cdf0e10cSrcweir sal_uInt16 nColSpan; // COLSPAN der Zelle 98cdf0e10cSrcweir sal_uInt16 nWidthOption;// angegebene Breite der Zelle in Twip oder % 99cdf0e10cSrcweir 100cdf0e10cSrcweir sal_Bool bPrcWidthOption : 1;// nWidth ist %-Angabe 101cdf0e10cSrcweir sal_Bool bNoWrapOption : 1; // NOWRAP-Option 102cdf0e10cSrcweir 103cdf0e10cSrcweir public: 104cdf0e10cSrcweir 105cdf0e10cSrcweir SwHTMLTableLayoutCell( SwHTMLTableLayoutCnts *pCnts, 106cdf0e10cSrcweir sal_uInt16 nRSpan, sal_uInt16 nCSpan, 107cdf0e10cSrcweir sal_uInt16 nWidthOpt, sal_Bool bPrcWdthOpt, 108cdf0e10cSrcweir sal_Bool nNWrapOpt ); 109cdf0e10cSrcweir 110cdf0e10cSrcweir ~SwHTMLTableLayoutCell(); 111cdf0e10cSrcweir 112cdf0e10cSrcweir // Setzen/Ermitteln des Inhalts einer Zelle 113cdf0e10cSrcweir void SetContents( SwHTMLTableLayoutCnts *pCnts ) { pContents = pCnts; } 114cdf0e10cSrcweir SwHTMLTableLayoutCnts *GetContents() const { return pContents; } 115cdf0e10cSrcweir 116cdf0e10cSrcweir inline void SetProtected(); 117cdf0e10cSrcweir 118cdf0e10cSrcweir // ROWSPAN/COLSPAN der Zelle Setzen/Ermitteln 119cdf0e10cSrcweir void SetRowSpan( sal_uInt16 nRSpan ) { nRowSpan = nRSpan; } 120cdf0e10cSrcweir sal_uInt16 GetRowSpan() const { return nRowSpan; } 121cdf0e10cSrcweir sal_uInt16 GetColSpan() const { return nColSpan; } 122cdf0e10cSrcweir 123cdf0e10cSrcweir sal_uInt16 GetWidthOption() const { return nWidthOption; } 124cdf0e10cSrcweir sal_Bool IsPrcWidthOption() const { return bPrcWidthOption; } 125cdf0e10cSrcweir 126cdf0e10cSrcweir sal_Bool HasNoWrapOption() const { return bNoWrapOption; } 127cdf0e10cSrcweir }; 128cdf0e10cSrcweir 129cdf0e10cSrcweir /* */ 130cdf0e10cSrcweir 131cdf0e10cSrcweir class SwHTMLTableLayoutColumn 132cdf0e10cSrcweir { 133cdf0e10cSrcweir // Zwischenwerte von AutoLayoutPass1 134cdf0e10cSrcweir sal_uLong nMinNoAlign, nMaxNoAlign, nAbsMinNoAlign; 135cdf0e10cSrcweir 136cdf0e10cSrcweir // Ergebnisse von AutoLayoutPass1 137cdf0e10cSrcweir sal_uLong nMin, nMax; 138cdf0e10cSrcweir 139cdf0e10cSrcweir // Ergibnisse von Pass 2 140cdf0e10cSrcweir sal_uInt16 nAbsColWidth; // in Twips 141cdf0e10cSrcweir sal_uInt16 nRelColWidth; // in Twips bzw. relativ zu USHRT_MAX 142cdf0e10cSrcweir 143cdf0e10cSrcweir sal_uInt16 nWidthOption; // Optionen von <COL> oder <TD>/<TH> 144cdf0e10cSrcweir 145cdf0e10cSrcweir sal_Bool bRelWidthOption : 1; 146cdf0e10cSrcweir sal_Bool bLeftBorder : 1; 147cdf0e10cSrcweir 148cdf0e10cSrcweir public: 149cdf0e10cSrcweir 150cdf0e10cSrcweir SwHTMLTableLayoutColumn( sal_uInt16 nColWidthOpt, sal_Bool bRelColWidthOpt, 151cdf0e10cSrcweir sal_Bool bLBorder ); 152cdf0e10cSrcweir 153cdf0e10cSrcweir ~SwHTMLTableLayoutColumn() {} 154cdf0e10cSrcweir 155cdf0e10cSrcweir inline void MergeCellWidthOption( sal_uInt16 nWidth, sal_Bool bPrc ); 156cdf0e10cSrcweir inline void SetWidthOption( sal_uInt16 nWidth, sal_Bool bRelWidth, sal_Bool bTest ); 157cdf0e10cSrcweir 158cdf0e10cSrcweir sal_uInt16 GetWidthOption() const { return nWidthOption; } 159cdf0e10cSrcweir sal_Bool IsRelWidthOption() const { return bRelWidthOption; } 160cdf0e10cSrcweir 161cdf0e10cSrcweir inline void MergeMinMaxNoAlign( sal_uLong nMin, sal_uLong nMax, sal_uLong nAbsMin ); 162cdf0e10cSrcweir sal_uLong GetMinNoAlign() const { return nMinNoAlign; } 163cdf0e10cSrcweir sal_uLong GetMaxNoAlign() const { return nMaxNoAlign; } 164cdf0e10cSrcweir sal_uLong GetAbsMinNoAlign() const { return nAbsMinNoAlign; } 165cdf0e10cSrcweir inline void ClearPass1Info( sal_Bool bWidthOpt ); 166cdf0e10cSrcweir 167cdf0e10cSrcweir inline void SetMinMax( sal_uLong nMin, sal_uLong nMax ); 168cdf0e10cSrcweir void SetMax( sal_uLong nVal ) { nMax = nVal; } 169cdf0e10cSrcweir void AddToMin( sal_uLong nVal ) { nMin += nVal; } 170cdf0e10cSrcweir void AddToMax( sal_uLong nVal ) { nMax += nVal; } 171cdf0e10cSrcweir sal_uLong GetMin() const { return nMin; } 172cdf0e10cSrcweir sal_uLong GetMax() const { return nMax; } 173cdf0e10cSrcweir 174cdf0e10cSrcweir void SetAbsColWidth( sal_uInt16 nWidth ) { nAbsColWidth = nWidth; } 175cdf0e10cSrcweir sal_uInt16 GetAbsColWidth() const { return nAbsColWidth; } 176cdf0e10cSrcweir 177cdf0e10cSrcweir void SetRelColWidth( sal_uInt16 nWidth ) { nRelColWidth = nWidth; } 178cdf0e10cSrcweir sal_uInt16 GetRelColWidth() const { return nRelColWidth; } 179cdf0e10cSrcweir 180cdf0e10cSrcweir sal_Bool HasLeftBorder() const { return bLeftBorder; } 181cdf0e10cSrcweir }; 182cdf0e10cSrcweir 183cdf0e10cSrcweir /* */ 184cdf0e10cSrcweir 185cdf0e10cSrcweir class SwHTMLTableLayout 186cdf0e10cSrcweir { 187cdf0e10cSrcweir Timer aResizeTimer; // Timer fuer DelayedResize 188cdf0e10cSrcweir 189cdf0e10cSrcweir SwHTMLTableLayoutColumn **aColumns; 190cdf0e10cSrcweir SwHTMLTableLayoutCell **aCells; 191cdf0e10cSrcweir 192cdf0e10cSrcweir const SwTable *pSwTable; // die SwTable (nur Top-Table) 193cdf0e10cSrcweir SwTableBox *pLeftFillerBox; // linke Filler-Zelle (nur Tab in Tab) 194cdf0e10cSrcweir SwTableBox *pRightFillerBox; // rechte Filler-Zelle (nur Tab-in Tab) 195cdf0e10cSrcweir 196cdf0e10cSrcweir sal_uLong nMin; // minimale Breite der Tabelle (Twips) 197cdf0e10cSrcweir sal_uLong nMax; // maximale Breite der Tabelle (Twips) 198cdf0e10cSrcweir 199cdf0e10cSrcweir sal_uInt16 nRows; // Anzahl Zeilen 200cdf0e10cSrcweir sal_uInt16 nCols; // Anzahl Spalten 201cdf0e10cSrcweir 202cdf0e10cSrcweir sal_uInt16 nLeftMargin; // Abstand zum linken Rand (aus Absatz) 203cdf0e10cSrcweir sal_uInt16 nRightMargin; // Abstand zum rechten Rand (aus Absatz) 204cdf0e10cSrcweir 205cdf0e10cSrcweir sal_uInt16 nInhAbsLeftSpace; // von umgebender Zelle geerbter Abstand, 206cdf0e10cSrcweir sal_uInt16 nInhAbsRightSpace; // der Zellen zugeschlagen wurde 207cdf0e10cSrcweir 208cdf0e10cSrcweir sal_uInt16 nRelLeftFill; // relative Breiten der Zellen zur 209cdf0e10cSrcweir sal_uInt16 nRelRightFill; // Ausrichtung von Tabellen in Tabellen 210cdf0e10cSrcweir 211cdf0e10cSrcweir sal_uInt16 nRelTabWidth; // Die relative Breite der Tabelle 212cdf0e10cSrcweir 213cdf0e10cSrcweir sal_uInt16 nWidthOption; // die Breite der Tabelle (in Twip oder %) 214cdf0e10cSrcweir sal_uInt16 nCellPadding; // Abstand zum Inhalt (in Twip) 215cdf0e10cSrcweir sal_uInt16 nCellSpacing; // Absatnd zwischen Zellen (in Twip) 216cdf0e10cSrcweir sal_uInt16 nBorder; // Dicke der ausseren Umrandung bzw. 217cdf0e10cSrcweir // Platz, den Netscape hierfuer einrechnet. 218cdf0e10cSrcweir 219cdf0e10cSrcweir sal_uInt16 nLeftBorderWidth; 220cdf0e10cSrcweir sal_uInt16 nRightBorderWidth; 221cdf0e10cSrcweir sal_uInt16 nInhLeftBorderWidth; 222cdf0e10cSrcweir sal_uInt16 nInhRightBorderWidth; 223cdf0e10cSrcweir sal_uInt16 nBorderWidth; 224cdf0e10cSrcweir 225cdf0e10cSrcweir sal_uInt16 nDelayedResizeAbsAvail; // Param fuer's verzoegerte Resize 226cdf0e10cSrcweir sal_uInt16 nLastResizeAbsAvail; 227cdf0e10cSrcweir 228cdf0e10cSrcweir sal_uInt8 nPass1Done; // Vorgabe-Werte fuer die einzelen 229cdf0e10cSrcweir sal_uInt8 nWidthSet; // Schleifen-Durchlauefe 230cdf0e10cSrcweir 231cdf0e10cSrcweir SvxAdjust eTableAdjust; // Die Ausrichtung der Tabelle 232cdf0e10cSrcweir 233cdf0e10cSrcweir sal_Bool bColsOption : 1; // Tabelle besitzt eine COLS-Option 234cdf0e10cSrcweir sal_Bool bColTags : 1; // Tabelle besitzt COL/COLGRP-Tags 235cdf0e10cSrcweir sal_Bool bPrcWidthOption : 1; // Breite ist eine %-Angabe 236cdf0e10cSrcweir sal_Bool bUseRelWidth : 1; // SwTable bekommt relative Breite 237cdf0e10cSrcweir 238cdf0e10cSrcweir sal_Bool bMustResize : 1; // Tabelle muss in der Breite ang. werden 239cdf0e10cSrcweir sal_Bool bExportable : 1; // Layout kann zum Export genutzt werden 240cdf0e10cSrcweir sal_Bool bBordersChanged : 1; // Umrandung wurde geaendert 241cdf0e10cSrcweir sal_Bool bMayBeInFlyFrame : 1; // Die Tabelle koennte im Rahmen sein 242cdf0e10cSrcweir 243cdf0e10cSrcweir sal_Bool bDelayedResizeRecalc : 1; // Param fuer's verzoegerte Resize 244cdf0e10cSrcweir sal_Bool bMustNotResize : 1; // Die Tabelle darf nicht reseized werden 245cdf0e10cSrcweir sal_Bool bMustNotRecalc : 1; // Tabelle darf nicht an Inhalt angepasst 246cdf0e10cSrcweir // werden 247cdf0e10cSrcweir 248cdf0e10cSrcweir // sal_uInt16 GetLeftBorderWidth( sal_uInt16 nCol ) const; 249cdf0e10cSrcweir // sal_uInt16 GetRightBorderWidth( sal_uInt16 nCol, sal_uInt16 nColSpan ) const; 250cdf0e10cSrcweir 251cdf0e10cSrcweir void AddBorderWidth( sal_uLong &rMin, sal_uLong &rMax, sal_uLong& rAbsMin, 252cdf0e10cSrcweir sal_uInt16 nCol, sal_uInt16 nColSpan, 253cdf0e10cSrcweir sal_Bool bSwBorders=sal_True ) const; 254cdf0e10cSrcweir void SetBoxWidth( SwTableBox *pBox, sal_uInt16 nCol, sal_uInt16 nColSpan ) const; 255cdf0e10cSrcweir 256cdf0e10cSrcweir const SwStartNode *GetAnyBoxStartNode() const; 257cdf0e10cSrcweir SwFrmFmt *FindFlyFrmFmt() const; 258cdf0e10cSrcweir const SwDoc *GetDoc() const { return GetAnyBoxStartNode()->GetDoc(); } 259cdf0e10cSrcweir 260cdf0e10cSrcweir void ClearPass1Info() { nMin = nMax = 0; } 261cdf0e10cSrcweir 262cdf0e10cSrcweir void _Resize( sal_uInt16 nAbsAvail, sal_Bool bRecalc=sal_False ); 263cdf0e10cSrcweir 264cdf0e10cSrcweir DECL_STATIC_LINK( SwHTMLTableLayout, DelayedResize_Impl, void* ); 265cdf0e10cSrcweir 266cdf0e10cSrcweir static sal_uInt16 GetBrowseWidthByVisArea( const SwDoc& rDoc ); 267cdf0e10cSrcweir public: 268cdf0e10cSrcweir 269cdf0e10cSrcweir SwHTMLTableLayout( const SwTable *pSwTbl, 270cdf0e10cSrcweir sal_uInt16 nRows, sal_uInt16 nCols, sal_Bool bColsOpt, sal_Bool ColTgs, 271cdf0e10cSrcweir sal_uInt16 nWidth, sal_Bool bPrcWidth, sal_uInt16 nBorderOpt, 272cdf0e10cSrcweir sal_uInt16 nCellPad, sal_uInt16 nCellSp, SvxAdjust eAdjust, 273cdf0e10cSrcweir sal_uInt16 nLMargin, sal_uInt16 nRMargin, sal_uInt16 nBWidth, 274cdf0e10cSrcweir sal_uInt16 nLeftBWidth, sal_uInt16 nRightBWidth, 275cdf0e10cSrcweir sal_uInt16 nInhLeftBWidth, sal_uInt16 nInhRightBWidth ); 276cdf0e10cSrcweir 277cdf0e10cSrcweir ~SwHTMLTableLayout(); 278cdf0e10cSrcweir 279cdf0e10cSrcweir sal_uInt16 GetLeftCellSpace( sal_uInt16 nCol, sal_uInt16 nColSpan, 280cdf0e10cSrcweir sal_Bool bSwBorders=sal_True ) const; 281cdf0e10cSrcweir sal_uInt16 GetRightCellSpace( sal_uInt16 nCol, sal_uInt16 nColSpan, 282cdf0e10cSrcweir sal_Bool bSwBorders=sal_True ) const; 283cdf0e10cSrcweir inline sal_uInt16 GetInhCellSpace( sal_uInt16 nCol, sal_uInt16 nColSpan ) const; 284cdf0e10cSrcweir 285cdf0e10cSrcweir inline void SetInhBorderWidths( sal_uInt16 nLeft, sal_uInt16 nRight ); 286cdf0e10cSrcweir 287cdf0e10cSrcweir 288cdf0e10cSrcweir void GetAvail( sal_uInt16 nCol, sal_uInt16 nColSpan, sal_uInt16& rAbsAvail, 289cdf0e10cSrcweir sal_uInt16& rRelAvail ) const; 290cdf0e10cSrcweir 291cdf0e10cSrcweir void AutoLayoutPass1(); 292cdf0e10cSrcweir void AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAvail, 293cdf0e10cSrcweir sal_uInt16 nAbsLeftSpace, sal_uInt16 nAbsRightSpace, 294cdf0e10cSrcweir sal_uInt16 nParentInhSpace ); 295cdf0e10cSrcweir void SetWidths( sal_Bool bCallPass2=sal_False, sal_uInt16 nAbsAvail=0, 296cdf0e10cSrcweir sal_uInt16 nRelAvail=0, sal_uInt16 nAbsLeftSpace=0, 297cdf0e10cSrcweir sal_uInt16 nAbsRightSpace=0, 298cdf0e10cSrcweir sal_uInt16 nParentInhSpace=0 ); 299cdf0e10cSrcweir 300cdf0e10cSrcweir inline SwHTMLTableLayoutColumn *GetColumn( sal_uInt16 nCol ) const; 301cdf0e10cSrcweir inline void SetColumn( SwHTMLTableLayoutColumn *pCol, sal_uInt16 nCol ); 302cdf0e10cSrcweir 303cdf0e10cSrcweir inline SwHTMLTableLayoutCell *GetCell( sal_uInt16 nRow, sal_uInt16 nCol ) const; 304cdf0e10cSrcweir inline void SetCell( SwHTMLTableLayoutCell *pCell, sal_uInt16 nRow, sal_uInt16 nCol ); 305cdf0e10cSrcweir 306cdf0e10cSrcweir void SetLeftFillerBox( SwTableBox *pBox ) { pLeftFillerBox = pBox; } 307cdf0e10cSrcweir void SetRightFillerBox( SwTableBox *pBox ) { pRightFillerBox = pBox; } 308cdf0e10cSrcweir 309cdf0e10cSrcweir sal_uLong GetMin() const { return nMin; } 310cdf0e10cSrcweir sal_uLong GetMax() const { return nMax; } 311cdf0e10cSrcweir sal_uInt16 GetRelLeftFill() const { return nRelLeftFill; } 312cdf0e10cSrcweir sal_uInt16 GetRelRightFill() const { return nRelRightFill; } 313cdf0e10cSrcweir 314cdf0e10cSrcweir inline long GetBrowseWidthMin() const; 315cdf0e10cSrcweir 316cdf0e10cSrcweir sal_Bool HasColsOption() const { return bColsOption; } 317cdf0e10cSrcweir sal_Bool HasColTags() const { return bColTags; } 318cdf0e10cSrcweir 319cdf0e10cSrcweir sal_Bool IsTopTable() const { return pSwTable != 0; } 320cdf0e10cSrcweir 321cdf0e10cSrcweir void SetMustResize( sal_Bool bSet ) { bMustResize = bSet; } 322cdf0e10cSrcweir void SetMustNotResize( sal_Bool bSet ) { bMustNotResize = bSet; } 323cdf0e10cSrcweir void SetMustNotRecalc( sal_Bool bSet ) { bMustNotRecalc = bSet; } 324cdf0e10cSrcweir 325cdf0e10cSrcweir // Neueberechnung der Tabellenbreiten fuer die uebergebene verfuegbare 326cdf0e10cSrcweir // Breite. 327cdf0e10cSrcweir // - Wenn bRecalc gesetzt ist, werden auch der Inhalt der Boxen 328cdf0e10cSrcweir // zur Berechnung herangezogen. 329cdf0e10cSrcweir // neu berechnet. 330cdf0e10cSrcweir // - Wenn bForce gesetzt ist, wird die Tabelle auch neu berechnet, wenn 331cdf0e10cSrcweir // dies mit SetMustNotResize unterdrueckt werden soll. 332cdf0e10cSrcweir // - Wenn nDelay>0 wird die Berechnung entsprechend verzoegert. 333cdf0e10cSrcweir // Innerhalb der Verzeoegerung auftretende Resize-Aufrufe werden 334cdf0e10cSrcweir // ignoriert, die Verzeogerung wird aber ggf. uebernommen. 335cdf0e10cSrcweir // - Wenn nDelay==HTMLTABLE_RESIZE_NOW ist, wird sofort Resized und 336cdf0e10cSrcweir // eventuell noch asstehende Resize-Aufrufe werden nicht mehr 337cdf0e10cSrcweir // ausgefuehrt. 338cdf0e10cSrcweir // - Der Rueckgabewert gibt an, ob sich die Tabelle geaendert hat. 339cdf0e10cSrcweir sal_Bool Resize( sal_uInt16 nAbsAvail, sal_Bool bRecalc=sal_False, sal_Bool bForce=sal_False, 340cdf0e10cSrcweir sal_uLong nDelay=0 ); 341cdf0e10cSrcweir 342cdf0e10cSrcweir void BordersChanged( sal_uInt16 nAbsAvail, sal_Bool bRecalc=sal_False ); 343cdf0e10cSrcweir 344cdf0e10cSrcweir // Ermitteln der verfuegbaren Breite. Das geht nur, wenn ein Layout 345cdf0e10cSrcweir // oder eine ViewShell vorhanden ist. Sonst wird 0 zurueckgegeben. 346cdf0e10cSrcweir // (Wird vom HTML-Filter benoetigt, da der nicht an das Layout kommt.) 347cdf0e10cSrcweir static sal_uInt16 GetBrowseWidth( const SwDoc& rDoc ); 348cdf0e10cSrcweir 349cdf0e10cSrcweir // Ermitteln der verfuegbaren Breite uber den Tabellen-Frame 350cdf0e10cSrcweir sal_uInt16 GetBrowseWidthByTabFrm( const SwTabFrm& rTabFrm ) const; 351cdf0e10cSrcweir 352cdf0e10cSrcweir // Ermitteln der verfuegbaren Breite uber den Tabellen-Frame oder 353cdf0e10cSrcweir // das statische GetBrowseWidth, wenn kein Layout existiert. 354cdf0e10cSrcweir sal_uInt16 GetBrowseWidthByTable( const SwDoc& rDoc ) const; 355cdf0e10cSrcweir 356cdf0e10cSrcweir // Fuer Export 357cdf0e10cSrcweir sal_uInt16 GetWidthOption() const { return nWidthOption; } 358cdf0e10cSrcweir sal_Bool HasPrcWidthOption() const { return bPrcWidthOption; } 359cdf0e10cSrcweir 360cdf0e10cSrcweir sal_uInt16 GetCellPadding() const { return nCellPadding; } 361cdf0e10cSrcweir sal_uInt16 GetCellSpacing() const { return nCellSpacing; } 362cdf0e10cSrcweir sal_uInt16 GetBorder() const { return nBorder; } 363cdf0e10cSrcweir 364cdf0e10cSrcweir sal_uInt16 GetRowCount() const { return nRows; } 365cdf0e10cSrcweir sal_uInt16 GetColCount() const { return nCols; } 366cdf0e10cSrcweir 367cdf0e10cSrcweir void SetExportable( sal_Bool bSet ) { bExportable = bSet; } 368cdf0e10cSrcweir sal_Bool IsExportable() const { return bExportable; } 369cdf0e10cSrcweir 370cdf0e10cSrcweir sal_Bool HaveBordersChanged() const { return bBordersChanged; } 371cdf0e10cSrcweir 372cdf0e10cSrcweir void SetMayBeInFlyFrame( sal_Bool bSet ) { bMayBeInFlyFrame = bSet; } 373cdf0e10cSrcweir sal_Bool MayBeInFlyFrame() const { return bMayBeInFlyFrame; } 374cdf0e10cSrcweir }; 375cdf0e10cSrcweir 376cdf0e10cSrcweir /* */ 377cdf0e10cSrcweir 378cdf0e10cSrcweir inline void SwHTMLTableLayoutCell::SetProtected() 379cdf0e10cSrcweir { 380cdf0e10cSrcweir nRowSpan = 1; 381cdf0e10cSrcweir nColSpan = 1; 382cdf0e10cSrcweir 383cdf0e10cSrcweir pContents = 0; 384cdf0e10cSrcweir } 385cdf0e10cSrcweir 386cdf0e10cSrcweir /* */ 387cdf0e10cSrcweir 388cdf0e10cSrcweir inline void SwHTMLTableLayoutColumn::MergeMinMaxNoAlign( sal_uLong nCMin, 389cdf0e10cSrcweir sal_uLong nCMax, sal_uLong nAbsMin ) 390cdf0e10cSrcweir { 391cdf0e10cSrcweir if( nCMin > nMinNoAlign ) 392cdf0e10cSrcweir nMinNoAlign = nCMin; 393cdf0e10cSrcweir if( nCMax > nMaxNoAlign ) 394cdf0e10cSrcweir nMaxNoAlign = nCMax; 395cdf0e10cSrcweir if( nAbsMin > nAbsMinNoAlign ) 396cdf0e10cSrcweir nAbsMinNoAlign = nAbsMin; 397cdf0e10cSrcweir } 398cdf0e10cSrcweir 399cdf0e10cSrcweir inline void SwHTMLTableLayoutColumn::ClearPass1Info( sal_Bool bWidthOpt ) 400cdf0e10cSrcweir { 401cdf0e10cSrcweir nMinNoAlign = nMaxNoAlign = nAbsMinNoAlign = MINLAY; 402cdf0e10cSrcweir nMin = nMax = 0; 403cdf0e10cSrcweir if( bWidthOpt ) 404cdf0e10cSrcweir { 405cdf0e10cSrcweir nWidthOption = 0; 406cdf0e10cSrcweir bRelWidthOption = sal_False; 407cdf0e10cSrcweir } 408cdf0e10cSrcweir } 409cdf0e10cSrcweir 410cdf0e10cSrcweir inline void SwHTMLTableLayoutColumn::MergeCellWidthOption( 411cdf0e10cSrcweir sal_uInt16 nWidth, sal_Bool bRel ) 412cdf0e10cSrcweir { 413cdf0e10cSrcweir if( !nWidthOption || 414cdf0e10cSrcweir (bRel==bRelWidthOption && nWidthOption < nWidth) ) 415cdf0e10cSrcweir { 416cdf0e10cSrcweir nWidthOption = nWidth; 417cdf0e10cSrcweir bRelWidthOption = bRel; 418cdf0e10cSrcweir } 419cdf0e10cSrcweir } 420cdf0e10cSrcweir 421cdf0e10cSrcweir inline void SwHTMLTableLayoutColumn::SetMinMax( sal_uLong nMn, sal_uLong nMx ) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir nMin = nMn; 424cdf0e10cSrcweir nMax = nMx; 425cdf0e10cSrcweir } 426cdf0e10cSrcweir 427cdf0e10cSrcweir /* */ 428cdf0e10cSrcweir 429cdf0e10cSrcweir inline sal_uInt16 SwHTMLTableLayout::GetInhCellSpace( sal_uInt16 nCol, 430cdf0e10cSrcweir sal_uInt16 nColSpan ) const 431cdf0e10cSrcweir { 432cdf0e10cSrcweir sal_uInt16 nSpace = 0; 433cdf0e10cSrcweir if( nCol==0 ) 434cdf0e10cSrcweir nSpace = nSpace + sal::static_int_cast< sal_uInt16 >(nInhAbsLeftSpace); 435cdf0e10cSrcweir if( nCol+nColSpan==nCols ) 436cdf0e10cSrcweir nSpace = nSpace + sal::static_int_cast< sal_uInt16 >(nInhAbsRightSpace); 437cdf0e10cSrcweir 438cdf0e10cSrcweir return nSpace; 439cdf0e10cSrcweir } 440cdf0e10cSrcweir 441cdf0e10cSrcweir inline SwHTMLTableLayoutColumn *SwHTMLTableLayout::GetColumn( sal_uInt16 nCol ) const 442cdf0e10cSrcweir { 443cdf0e10cSrcweir return aColumns[nCol]; 444cdf0e10cSrcweir } 445cdf0e10cSrcweir 446cdf0e10cSrcweir inline void SwHTMLTableLayoutColumn::SetWidthOption( 447cdf0e10cSrcweir sal_uInt16 nWidth, sal_Bool bRelWidth, sal_Bool bTest ) 448cdf0e10cSrcweir { 449cdf0e10cSrcweir if( bTest && bRelWidthOption==bRelWidth ) 450cdf0e10cSrcweir { 451cdf0e10cSrcweir if( nWidth > nWidthOption ) 452cdf0e10cSrcweir nWidthOption = nWidth; 453cdf0e10cSrcweir } 454cdf0e10cSrcweir else 455cdf0e10cSrcweir nWidthOption = nWidth; 456cdf0e10cSrcweir bRelWidthOption = bRelWidth; 457cdf0e10cSrcweir } 458cdf0e10cSrcweir 459cdf0e10cSrcweir inline void SwHTMLTableLayout::SetColumn( SwHTMLTableLayoutColumn *pCol, sal_uInt16 nCol ) 460cdf0e10cSrcweir { 461cdf0e10cSrcweir aColumns[nCol] = pCol; 462cdf0e10cSrcweir } 463cdf0e10cSrcweir 464cdf0e10cSrcweir inline SwHTMLTableLayoutCell *SwHTMLTableLayout::GetCell( sal_uInt16 nRow, sal_uInt16 nCol ) const 465cdf0e10cSrcweir { 466cdf0e10cSrcweir return aCells[nRow*nCols+nCol]; 467cdf0e10cSrcweir } 468cdf0e10cSrcweir 469cdf0e10cSrcweir inline void SwHTMLTableLayout::SetCell( SwHTMLTableLayoutCell *pCell, 470cdf0e10cSrcweir sal_uInt16 nRow, sal_uInt16 nCol ) 471cdf0e10cSrcweir { 472cdf0e10cSrcweir aCells[nRow*nCols+nCol] = pCell; 473cdf0e10cSrcweir } 474cdf0e10cSrcweir 475cdf0e10cSrcweir inline long SwHTMLTableLayout::GetBrowseWidthMin() const 476cdf0e10cSrcweir { 477cdf0e10cSrcweir return (long)( (!nWidthOption || bPrcWidthOption) ? nMin : nRelTabWidth ); 478cdf0e10cSrcweir } 479cdf0e10cSrcweir 480cdf0e10cSrcweir void SwHTMLTableLayout::SetInhBorderWidths( sal_uInt16 nLeft, sal_uInt16 nRight ) 481cdf0e10cSrcweir { 482cdf0e10cSrcweir nInhLeftBorderWidth = nLeft; 483cdf0e10cSrcweir nInhRightBorderWidth = nRight; 484cdf0e10cSrcweir } 485cdf0e10cSrcweir 486cdf0e10cSrcweir 487cdf0e10cSrcweir #endif 488