LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/inc - tblrwcl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 6 31 19.4 %
Date: 2012-12-27 Functions: 4 19 21.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef _TBLRWCL_HXX
      20             : #define _TBLRWCL_HXX
      21             : #include <cstddef>
      22             : #include <vector>
      23             : #include <swtypes.hxx>
      24             : #include <tblsel.hxx>
      25             : #include <swtable.hxx>
      26             : 
      27             : namespace editeng { class SvxBorderLine; }
      28             : 
      29             : class SwDoc;
      30             : class SwTableNode;
      31             : class SwTableLine;
      32             : class SwTableBox;
      33             : class SwTableBoxFmt;
      34             : class SwHistory;
      35             : class SwCntntNode;
      36             : class SfxPoolItem;
      37             : class SwShareBoxFmts;
      38             : class SwFmtFrmSize;
      39             : struct _CpyPara;
      40             : struct _InsULPara;
      41             : 
      42             : void sw_LineSetHeadCondColl( const SwTableLine* pLine );
      43             : 
      44             : 
      45             : #ifdef DBG_UTIL
      46             : void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize );
      47             : #endif
      48             : 
      49             : void _InsTblBox( SwDoc* pDoc, SwTableNode* pTblNd,
      50             :                 SwTableLine* pLine, SwTableBoxFmt* pBoxFrmFmt,
      51             :                 SwTableBox* pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt = 1 );
      52             : 
      53             : SW_DLLPUBLIC void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo = 0,
      54             :                 bool bCalcNewSize = true, const bool bCorrBorder = true,
      55             :                 SwShareBoxFmts* pShareFmts = 0 );
      56             : 
      57             : // Klasse fuers SplitTable
      58             : // sammelt von einer Line die Boxen aller obersten oder untersten Lines
      59             : // in einem Array. Zusaetzlich werden die Positionen vermerkt.
      60             : // ( die Implementierung steht im ndtbl.cxx)
      61             : 
      62           0 : class SwCollectTblLineBoxes
      63             : {
      64             :     std::vector<sal_uInt16> aPosArr;
      65             :     std::vector<SwTableBox*> m_Boxes;
      66             :     SwHistory* pHst;
      67             :     sal_uInt16 nMode, nWidth;
      68             :     bool bGetFromTop : 1;
      69             :     bool bGetValues : 1;
      70             : 
      71             : public:
      72           0 :     SwCollectTblLineBoxes( bool bTop, sal_uInt16 nMd = 0, SwHistory* pHist=0 )
      73             :         :
      74             :         pHst( pHist ), nMode( nMd ), nWidth( 0 ),
      75           0 :         bGetFromTop( bTop ), bGetValues( true )
      76             : 
      77           0 :     {}
      78             : 
      79             :     void AddBox( const SwTableBox& rBox );
      80             :     const SwTableBox* GetBoxOfPos( const SwTableBox& rBox );
      81             :     void AddToUndoHistory( const SwCntntNode& rNd );
      82             : 
      83           0 :     size_t Count() const                { return m_Boxes.size(); }
      84           0 :     const SwTableBox& GetBox( std::size_t nPos, sal_uInt16* pWidth = 0 ) const
      85             :         {
      86             :             // hier wird die EndPos der Spalte benoetigt!
      87           0 :             if( pWidth )
      88           0 :                 *pWidth = (nPos+1 == aPosArr.size()) ? nWidth
      89           0 :                                                     : aPosArr[ nPos+1 ];
      90           0 :             return *m_Boxes[ nPos ];
      91             :         }
      92             : 
      93           0 :     bool IsGetFromTop() const           { return bGetFromTop; }
      94           0 :     bool IsGetValues() const            { return bGetValues; }
      95             : 
      96           0 :     sal_uInt16 GetMode() const              { return nMode; }
      97           0 :     void SetValues( bool bFlag )        { bGetValues = false; nWidth = 0;
      98           0 :                                           bGetFromTop = bFlag; }
      99             :     bool Resize( sal_uInt16 nOffset, sal_uInt16 nWidth );
     100             : };
     101             : 
     102             : void sw_Box_CollectBox( const SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara );
     103             : bool sw_Line_CollectBox( const SwTableLine*& rpLine, void* pPara );
     104             : 
     105             : void sw_BoxSetSplitBoxFmts( SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara );
     106             : 
     107             : // This structure is needed by Undo to restore row span attributes
     108             : // when a table has been splitted into two tables
     109           0 : struct SwSaveRowSpan
     110             : {
     111             :     sal_uInt16 mnSplitLine; // the line number where the table has been splitted
     112             :     std::vector< long > mnRowSpans; // the row span attributes in this line
     113             :     SwSaveRowSpan( SwTableBoxes& rBoxes, sal_uInt16 nSplitLn );
     114             : };
     115             : 
     116             : struct _SwGCLineBorder
     117             : {
     118             :     const SwTableLines* pLines;
     119             :     SwShareBoxFmts* pShareFmts;
     120             :     sal_uInt16 nLinePos;
     121             : 
     122           0 :     _SwGCLineBorder( const SwTable& rTable )
     123           0 :         : pLines( &rTable.GetTabLines() ), pShareFmts(0), nLinePos( 0 )  {}
     124             : 
     125           0 :     _SwGCLineBorder( const SwTableBox& rBox )
     126           0 :         : pLines( &rBox.GetTabLines() ), pShareFmts(0), nLinePos( 0 )  {}
     127           0 :     bool IsLastLine() const { return nLinePos + 1 >= (sal_uInt16)pLines->size(); }
     128             : };
     129             : 
     130             : class _SwGCBorder_BoxBrd
     131             : {
     132             :     const editeng::SvxBorderLine* pBrdLn;
     133             :     bool bAnyBorderFnd;
     134             : public:
     135           0 :     _SwGCBorder_BoxBrd() : pBrdLn( 0 ), bAnyBorderFnd( false ) {}
     136             : 
     137           0 :     void SetBorder( const editeng::SvxBorderLine& rBorderLine )
     138           0 :         { pBrdLn = &rBorderLine; bAnyBorderFnd = false; }
     139             : 
     140             :     // checke, ob die linke Border dieselbe wie die gesetzte ist
     141             :     // returnt false falls gar keine Border gesetzt ist
     142             :     bool CheckLeftBorderOfFormat( const SwFrmFmt& rFmt );
     143             : 
     144           0 :     bool IsAnyBorderFound() const { return bAnyBorderFnd; }
     145             : };
     146             : 
     147             : void sw_GC_Line_Border( const SwTableLine* pLine, _SwGCLineBorder* pGCPara );
     148             : 
     149             : 
     150         140 : class SwShareBoxFmt
     151             : {
     152             :     const SwFrmFmt* pOldFmt;
     153             :     std::vector<SwFrmFmt*> aNewFmts;
     154             : 
     155             : public:
     156         140 :     SwShareBoxFmt( const SwFrmFmt& rFmt )
     157         140 :         : pOldFmt( &rFmt )
     158         140 :     {}
     159             : 
     160         452 :     const SwFrmFmt& GetOldFormat() const { return *pOldFmt; }
     161             : 
     162             :     SwFrmFmt* GetFormat( long nWidth ) const;
     163             :     SwFrmFmt* GetFormat( const SfxPoolItem& rItem ) const;
     164             :     void AddFormat( SwFrmFmt& rFmt );
     165             :     // returnt sal_True, wenn geloescht werden kann
     166             :     bool RemoveFormat( const SwFrmFmt& rFmt );
     167             : };
     168             : 
     169             : 
     170             : typedef boost::ptr_vector<SwShareBoxFmt> _SwShareBoxFmts;
     171             : 
     172             : class SwShareBoxFmts
     173             : {
     174             :     _SwShareBoxFmts aShareArr;
     175             :     bool Seek_Entry( const SwFrmFmt& rFmt, sal_uInt16* pPos ) const;
     176             : 
     177             :     void ChangeFrmFmt( SwTableBox* pBox, SwTableLine* pLn, SwFrmFmt& rFmt );
     178             : 
     179             : public:
     180         115 :     SwShareBoxFmts() {}
     181             :     ~SwShareBoxFmts();
     182             : 
     183             :     SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, long nWidth ) const;
     184             :     SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, const SfxPoolItem& ) const;
     185             : 
     186             :     void AddFormat( const SwFrmFmt& rOld, SwFrmFmt& rNew );
     187             : 
     188             :     void SetSize( SwTableBox& rBox, const SwFmtFrmSize& rSz );
     189             :     void SetAttr( SwTableBox& rBox, const SfxPoolItem& rItem );
     190             :     void SetAttr( SwTableLine& rLine, const SfxPoolItem& rItem );
     191             : 
     192             :     void RemoveFormat( const SwFrmFmt& rFmt );
     193             : };
     194             : 
     195             : 
     196             : 
     197             : #endif
     198             : 
     199             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10