LCOV - code coverage report
Current view: top level - sw/source/core/inc - tblrwcl.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 6 31 19.4 %
Date: 2014-04-11 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             : // Klasse fuers SplitTable
      57             : // sammelt von einer Line die Boxen aller obersten oder untersten Lines
      58             : // in einem Array. Zusaetzlich werden die Positionen vermerkt.
      59             : // ( die Implementierung steht im ndtbl.cxx)
      60             : 
      61           0 : class SwCollectTblLineBoxes
      62             : {
      63             :     std::vector<sal_uInt16> aPosArr;
      64             :     std::vector<SwTableBox*> m_Boxes;
      65             :     SwHistory* pHst;
      66             :     sal_uInt16 nMode, nWidth;
      67             :     bool bGetFromTop : 1;
      68             :     bool bGetValues : 1;
      69             : 
      70             : public:
      71           0 :     SwCollectTblLineBoxes( bool bTop, sal_uInt16 nMd = 0, SwHistory* pHist=0 )
      72             :         :
      73             :         pHst( pHist ), nMode( nMd ), nWidth( 0 ),
      74           0 :         bGetFromTop( bTop ), bGetValues( true )
      75             : 
      76           0 :     {}
      77             : 
      78             :     void AddBox( const SwTableBox& rBox );
      79             :     const SwTableBox* GetBoxOfPos( const SwTableBox& rBox );
      80             :     void AddToUndoHistory( const SwCntntNode& rNd );
      81             : 
      82           0 :     size_t Count() const                { return m_Boxes.size(); }
      83           0 :     const SwTableBox& GetBox( std::size_t nPos, sal_uInt16* pWidth = 0 ) const
      84             :         {
      85             :             // hier wird die EndPos der Spalte benoetigt!
      86           0 :             if( pWidth )
      87           0 :                 *pWidth = (nPos+1 == aPosArr.size()) ? nWidth
      88           0 :                                                     : aPosArr[ nPos+1 ];
      89           0 :             return *m_Boxes[ nPos ];
      90             :         }
      91             : 
      92           0 :     bool IsGetFromTop() const           { return bGetFromTop; }
      93           0 :     bool IsGetValues() const            { return bGetValues; }
      94             : 
      95           0 :     sal_uInt16 GetMode() const              { return nMode; }
      96           0 :     void SetValues( bool bFlag )        { bGetValues = false; nWidth = 0;
      97           0 :                                           bGetFromTop = bFlag; }
      98             :     bool Resize( sal_uInt16 nOffset, sal_uInt16 nWidth );
      99             : };
     100             : 
     101             : void sw_Box_CollectBox( const SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara );
     102             : bool sw_Line_CollectBox( const SwTableLine*& rpLine, void* pPara );
     103             : 
     104             : void sw_BoxSetSplitBoxFmts( SwTableBox* pBox, SwCollectTblLineBoxes* pSplPara );
     105             : 
     106             : // This structure is needed by Undo to restore row span attributes
     107             : // when a table has been splitted into two tables
     108           0 : struct SwSaveRowSpan
     109             : {
     110             :     sal_uInt16 mnSplitLine; // the line number where the table has been splitted
     111             :     std::vector< long > mnRowSpans; // the row span attributes in this line
     112             :     SwSaveRowSpan( SwTableBoxes& rBoxes, sal_uInt16 nSplitLn );
     113             : };
     114             : 
     115             : struct _SwGCLineBorder
     116             : {
     117             :     const SwTableLines* pLines;
     118             :     SwShareBoxFmts* pShareFmts;
     119             :     sal_uInt16 nLinePos;
     120             : 
     121           0 :     _SwGCLineBorder( const SwTable& rTable )
     122           0 :         : pLines( &rTable.GetTabLines() ), pShareFmts(0), nLinePos( 0 )  {}
     123             : 
     124           0 :     _SwGCLineBorder( const SwTableBox& rBox )
     125           0 :         : pLines( &rBox.GetTabLines() ), pShareFmts(0), nLinePos( 0 )  {}
     126           0 :     bool IsLastLine() const { return nLinePos + 1 >= (sal_uInt16)pLines->size(); }
     127             : };
     128             : 
     129             : class _SwGCBorder_BoxBrd
     130             : {
     131             :     const editeng::SvxBorderLine* pBrdLn;
     132             :     bool bAnyBorderFnd;
     133             : public:
     134           0 :     _SwGCBorder_BoxBrd() : pBrdLn( 0 ), bAnyBorderFnd( false ) {}
     135             : 
     136           0 :     void SetBorder( const editeng::SvxBorderLine& rBorderLine )
     137           0 :         { pBrdLn = &rBorderLine; bAnyBorderFnd = false; }
     138             : 
     139             :     // checke, ob die linke Border dieselbe wie die gesetzte ist
     140             :     // returnt false falls gar keine Border gesetzt ist
     141             :     bool CheckLeftBorderOfFormat( const SwFrmFmt& rFmt );
     142             : 
     143           0 :     bool IsAnyBorderFound() const { return bAnyBorderFnd; }
     144             : };
     145             : 
     146             : void sw_GC_Line_Border( const SwTableLine* pLine, _SwGCLineBorder* pGCPara );
     147             : 
     148        5544 : class SwShareBoxFmt
     149             : {
     150             :     const SwFrmFmt* pOldFmt;
     151             :     std::vector<SwFrmFmt*> aNewFmts;
     152             : 
     153             : public:
     154        5544 :     SwShareBoxFmt( const SwFrmFmt& rFmt )
     155        5544 :         : pOldFmt( &rFmt )
     156        5544 :     {}
     157             : 
     158       14230 :     const SwFrmFmt& GetOldFormat() const { return *pOldFmt; }
     159             : 
     160             :     SwFrmFmt* GetFormat( long nWidth ) const;
     161             :     SwFrmFmt* GetFormat( const SfxPoolItem& rItem ) const;
     162             :     void AddFormat( SwFrmFmt& rFmt );
     163             :     // returnt sal_True, wenn geloescht werden kann
     164             :     bool RemoveFormat( const SwFrmFmt& rFmt );
     165             : };
     166             : 
     167             : typedef boost::ptr_vector<SwShareBoxFmt> _SwShareBoxFmts;
     168             : 
     169             : class SwShareBoxFmts
     170             : {
     171             :     _SwShareBoxFmts aShareArr;
     172             :     bool Seek_Entry( const SwFrmFmt& rFmt, sal_uInt16* pPos ) const;
     173             : 
     174             :     void ChangeFrmFmt( SwTableBox* pBox, SwTableLine* pLn, SwFrmFmt& rFmt );
     175             : 
     176             : public:
     177        2312 :     SwShareBoxFmts() {}
     178             :     ~SwShareBoxFmts();
     179             : 
     180             :     SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, long nWidth ) const;
     181             :     SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, const SfxPoolItem& ) const;
     182             : 
     183             :     void AddFormat( const SwFrmFmt& rOld, SwFrmFmt& rNew );
     184             : 
     185             :     void SetSize( SwTableBox& rBox, const SwFmtFrmSize& rSz );
     186             :     void SetAttr( SwTableBox& rBox, const SfxPoolItem& rItem );
     187             :     void SetAttr( SwTableLine& rLine, const SfxPoolItem& rItem );
     188             : 
     189             :     void RemoveFormat( const SwFrmFmt& rFmt );
     190             : };
     191             : 
     192             : #endif
     193             : 
     194             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10