LCOV - code coverage report
Current view: top level - sw/source/core/inc - tblrwcl.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 6 31 19.4 %
Date: 2014-11-03 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 INCLUDED_SW_SOURCE_CORE_INC_TBLRWCL_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_INC_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             : #ifdef DBG_UTIL
      45             : void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize );
      46             : #endif
      47             : 
      48             : void _InsTblBox( SwDoc* pDoc, SwTableNode* pTblNd,
      49             :                 SwTableLine* pLine, SwTableBoxFmt* pBoxFrmFmt,
      50             :                 SwTableBox* pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt = 1 );
      51             : 
      52             : SW_DLLPUBLIC void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo = 0,
      53             :                 bool bCalcNewSize = true, const bool bCorrBorder = true,
      54             :                 SwShareBoxFmts* pShareFmts = 0 );
      55             : 
      56             : /**
      57             :  * Class for SplitTable
      58             :  * Collects the uppermost or lowermost Lines of a Box from a Line in an array.
      59             :  * We also store their positions.
      60             :  *
      61             :  * @see implementation in im ndtbl.cxx
      62             :  */
      63           0 : class SwCollectTblLineBoxes
      64             : {
      65             :     std::vector<sal_uInt16> aPosArr;
      66             :     std::vector<SwTableBox*> m_Boxes;
      67             :     SwHistory* pHst;
      68             :     sal_uInt16 nMode, nWidth;
      69             :     bool bGetFromTop : 1;
      70             :     bool bGetValues : 1;
      71             : 
      72             : public:
      73           0 :     SwCollectTblLineBoxes( bool bTop, sal_uInt16 nMd = 0, SwHistory* pHist=0 )
      74             :         :
      75             :         pHst( pHist ), nMode( nMd ), nWidth( 0 ),
      76           0 :         bGetFromTop( bTop ), bGetValues( true )
      77             : 
      78           0 :     {}
      79             : 
      80             :     void AddBox( const SwTableBox& rBox );
      81             :     const SwTableBox* GetBoxOfPos( const SwTableBox& rBox );
      82             :     void AddToUndoHistory( const SwCntntNode& rNd );
      83             : 
      84           0 :     size_t Count() const                { return m_Boxes.size(); }
      85           0 :     const SwTableBox& GetBox( std::size_t nPos, sal_uInt16* pWidth = 0 ) const
      86             :         {
      87             :             // We need the EndPos of the column here!
      88           0 :             if( pWidth )
      89           0 :                 *pWidth = (nPos+1 == aPosArr.size()) ? nWidth
      90           0 :                                                     : aPosArr[ nPos+1 ];
      91           0 :             return *m_Boxes[ nPos ];
      92             :         }
      93             : 
      94           0 :     bool IsGetFromTop() const           { return bGetFromTop; }
      95           0 :     bool IsGetValues() const            { return bGetValues; }
      96             : 
      97           0 :     sal_uInt16 GetMode() const              { return nMode; }
      98           0 :     void SetValues( bool bFlag )        { bGetValues = false; nWidth = 0;
      99           0 :                                           bGetFromTop = bFlag; }
     100             :     bool Resize( sal_uInt16 nOffset, sal_uInt16 nWidth );
     101             : };
     102             : 
     103             : void sw_Box_CollectBox( const SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara );
     104             : bool sw_Line_CollectBox( const SwTableLine*& rpLine, void* pPara );
     105             : 
     106             : void sw_BoxSetSplitBoxFmts( SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara );
     107             : 
     108             : /**
     109             :  * This structure is needed by Undo to restore row span attributes
     110             :  * when a table has been split into two tables
     111             :  */
     112           0 : struct SwSaveRowSpan
     113             : {
     114             :     sal_uInt16 mnSplitLine; // the line number where the table has been splitted
     115             :     std::vector< long > mnRowSpans; // the row span attributes in this line
     116             :     SwSaveRowSpan( SwTableBoxes& rBoxes, sal_uInt16 nSplitLn );
     117             : };
     118             : 
     119             : struct _SwGCLineBorder
     120             : {
     121             :     const SwTableLines* pLines;
     122             :     SwShareBoxFmts* pShareFmts;
     123             :     sal_uInt16 nLinePos;
     124             : 
     125           0 :     _SwGCLineBorder( const SwTable& rTable )
     126           0 :         : pLines( &rTable.GetTabLines() ), pShareFmts(0), nLinePos( 0 )  {}
     127             : 
     128           0 :     _SwGCLineBorder( const SwTableBox& rBox )
     129           0 :         : pLines( &rBox.GetTabLines() ), pShareFmts(0), nLinePos( 0 )  {}
     130           0 :     bool IsLastLine() const { return nLinePos + 1 >= (sal_uInt16)pLines->size(); }
     131             : };
     132             : 
     133             : class _SwGCBorder_BoxBrd
     134             : {
     135             :     const editeng::SvxBorderLine* pBrdLn;
     136             :     bool bAnyBorderFnd;
     137             : public:
     138           0 :     _SwGCBorder_BoxBrd() : pBrdLn( 0 ), bAnyBorderFnd( false ) {}
     139             : 
     140           0 :     void SetBorder( const editeng::SvxBorderLine& rBorderLine )
     141           0 :         { pBrdLn = &rBorderLine; bAnyBorderFnd = false; }
     142             : 
     143             :     /**
     144             :      * Check whether the left Border is the same as the set one
     145             :      * @returns false if no Border was set
     146             :      */
     147             :     bool CheckLeftBorderOfFormat( const SwFrmFmt& rFmt );
     148             : 
     149           0 :     bool IsAnyBorderFound() const { return bAnyBorderFnd; }
     150             : };
     151             : 
     152             : void sw_GC_Line_Border( const SwTableLine* pLine, _SwGCLineBorder* pGCPara );
     153             : 
     154       12362 : class SwShareBoxFmt
     155             : {
     156             :     const SwFrmFmt* pOldFmt;
     157             :     std::vector<SwFrmFmt*> aNewFmts;
     158             : 
     159             : public:
     160       12362 :     SwShareBoxFmt( const SwFrmFmt& rFmt )
     161       12362 :         : pOldFmt( &rFmt )
     162       12362 :     {}
     163             : 
     164       27564 :     const SwFrmFmt& GetOldFormat() const { return *pOldFmt; }
     165             : 
     166             :     SwFrmFmt* GetFormat( long nWidth ) const;
     167             :     SwFrmFmt* GetFormat( const SfxPoolItem& rItem ) const;
     168             :     void AddFormat( SwFrmFmt& rFmt );
     169             :     /// @returns true, if we can delete
     170             :     bool RemoveFormat( const SwFrmFmt& rFmt );
     171             : };
     172             : 
     173             : typedef boost::ptr_vector<SwShareBoxFmt> _SwShareBoxFmts;
     174             : 
     175             : class SwShareBoxFmts
     176             : {
     177             :     _SwShareBoxFmts aShareArr;
     178             :     bool Seek_Entry( const SwFrmFmt& rFmt, sal_uInt16* pPos ) const;
     179             : 
     180             :     void ChangeFrmFmt( SwTableBox* pBox, SwTableLine* pLn, SwFrmFmt& rFmt );
     181             : 
     182             : public:
     183        5796 :     SwShareBoxFmts() {}
     184             :     ~SwShareBoxFmts();
     185             : 
     186             :     SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, long nWidth ) const;
     187             :     SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, const SfxPoolItem& ) const;
     188             : 
     189             :     void AddFormat( const SwFrmFmt& rOld, SwFrmFmt& rNew );
     190             : 
     191             :     void SetSize( SwTableBox& rBox, const SwFmtFrmSize& rSz );
     192             :     void SetAttr( SwTableBox& rBox, const SfxPoolItem& rItem );
     193             :     void SetAttr( SwTableLine& rLine, const SfxPoolItem& rItem );
     194             : 
     195             :     void RemoveFormat( const SwFrmFmt& rFmt );
     196             : };
     197             : 
     198             : #endif
     199             : 
     200             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10