/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ #ifndef _WRTSWTBL_HXX #define _WRTSWTBL_HXX #include #include #include #include class Color; class SwTableBox; class SwTableLine; class SwTableLines; class SwTable; class SwHTMLTableLayout; class SvxBrushItem; class SvxBorderLine; //--------------------------------------------------------------------------- // Code aus dem HTML-Filter fuers schreiben von Tabellen //--------------------------------------------------------------------------- #define COLFUZZY 20 #define ROWFUZZY 20 #define COL_DFLT_WIDTH ((2*COLFUZZY)+1) #define ROW_DFLT_HEIGHT (2*ROWFUZZY)+1 //----------------------------------------------------------------------- class SwWriteTableCell { const SwTableBox *pBox; // SwTableBox der Zelle const SvxBrushItem *pBackground; // geerbter Hintergrund einer Zeile long nHeight; // fixe/Mindest-Hoehe der Zeile sal_uInt32 nWidthOpt; // Breite aus Option; sal_uInt16 nRow; // Start-Zeile sal_uInt16 nCol; // Start-Spalte sal_uInt16 nRowSpan; // ueberspannte Zeilen sal_uInt16 nColSpan; // ueberspannte Spalten sal_Bool bPrcWidthOpt; public: SwWriteTableCell(const SwTableBox *pB, sal_uInt16 nR, sal_uInt16 nC, sal_uInt16 nRSpan, sal_uInt16 nCSpan, long nHght, const SvxBrushItem *pBGround) : pBox( pB ), pBackground( pBGround ), nHeight( nHght ), nWidthOpt( 0 ), nRow( nR ), nCol( nC ), nRowSpan( nRSpan ), nColSpan( nCSpan ), bPrcWidthOpt( sal_False ) {} const SwTableBox *GetBox() const { return pBox; } sal_uInt16 GetRow() const { return nRow; } sal_uInt16 GetCol() const { return nCol; } sal_uInt16 GetRowSpan() const { return nRowSpan; } sal_uInt16 GetColSpan() const { return nColSpan; } long GetHeight() const { return nHeight; } sal_Int16 GetVertOri() const; const SvxBrushItem *GetBackground() const { return pBackground; } void SetWidthOpt( sal_uInt16 nWidth, sal_Bool bPrc ) { nWidthOpt = nWidth; bPrcWidthOpt = bPrc; } sal_uInt32 GetWidthOpt() const { return nWidthOpt; } sal_Bool HasPrcWidthOpt() const { return bPrcWidthOpt; } }; typedef SwWriteTableCell *SwWriteTableCellPtr; SV_DECL_PTRARR_DEL( SwWriteTableCells, SwWriteTableCellPtr, 5, 5 ) //----------------------------------------------------------------------- class SwWriteTableRow { SwWriteTableCells aCells; // Alle Zellen der Rows const SvxBrushItem *pBackground;// Hintergrund long nPos; // End-Position (twips) der Zeile sal_Bool mbUseLayoutHeights; // Forbidden and not implemented. SwWriteTableRow(); SwWriteTableRow & operator= (const SwWriteTableRow &); protected: // GCC >= 3.4 needs accessible T (const T&) to pass T as const T& argument. SwWriteTableRow( const SwWriteTableRow & ); public: sal_uInt16 nTopBorder; // Dicke der oberen/unteren Umrandugen sal_uInt16 nBottomBorder; sal_Bool bTopBorder : 1; // Welche Umrandungen sind da? sal_Bool bBottomBorder : 1; SwWriteTableRow( long nPos, sal_Bool bUseLayoutHeights ); SwWriteTableCell *AddCell( const SwTableBox *pBox, sal_uInt16 nRow, sal_uInt16 nCol, sal_uInt16 nRowSpan, sal_uInt16 nColSpan, long nHeight, const SvxBrushItem *pBackground ); void SetBackground( const SvxBrushItem *pBGround ) { pBackground = pBGround; } const SvxBrushItem *GetBackground() const { return pBackground; } sal_Bool HasTopBorder() const { return bTopBorder; } sal_Bool HasBottomBorder() const { return bBottomBorder; } long GetPos() const { return nPos; } const SwWriteTableCells& GetCells() const { return aCells; } inline int operator==( const SwWriteTableRow& rRow ) const; inline int operator<( const SwWriteTableRow& rRow2 ) const; }; inline int SwWriteTableRow::operator==( const SwWriteTableRow& rRow ) const { // etwas Unschaerfe zulassen return (nPos >= rRow.nPos ? nPos - rRow.nPos : rRow.nPos - nPos ) <= (mbUseLayoutHeights ? 0 : ROWFUZZY); } inline int SwWriteTableRow::operator<( const SwWriteTableRow& rRow ) const { // Da wir hier nur die Wahrheits-Grade 0 und 1 kennen, lassen wir lieber // auch nicht zu, dass x==y und x= rCol.nPos ? nPos - rCol.nPos : rCol.nPos - nPos ) <= COLFUZZY; } inline int SwWriteTableCol::operator<( const SwWriteTableCol& rCol ) const { // Da wir hier nur die Wahrheits-Grade 0 und 1 kennen, lassen wir lieber // auch nicht zu, dass x==y und x