LCOV - code coverage report
Current view: top level - sw/source/core/inc - tblrwcl.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 6 31 19.4 %
Date: 2015-06-13 12:38:46 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 SwTableBoxFormat;
      34             : class SwHistory;
      35             : class SwContentNode;
      36             : class SfxPoolItem;
      37             : class SwShareBoxFormats;
      38             : class SwFormatFrmSize;
      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 _InsTableBox( SwDoc* pDoc, SwTableNode* pTableNd,
      49             :                 SwTableLine* pLine, SwTableBoxFormat* pBoxFrameFormat,
      50             :                 SwTableBox* pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt = 1 );
      51             : 
      52             : SW_DLLPUBLIC void _DeleteBox( SwTable& rTable, SwTableBox* pBox, SwUndo* pUndo = 0,
      53             :                 bool bCalcNewSize = true, const bool bCorrBorder = true,
      54             :                 SwShareBoxFormats* pShareFormats = 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 SwCollectTableLineBoxes
      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 :     SwCollectTableLineBoxes( 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 SwContentNode& 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, SwCollectTableLineBoxes* pSplPara );
     104             : bool sw_Line_CollectBox( const SwTableLine*& rpLine, void* pPara );
     105             : 
     106             : void sw_BoxSetSplitBoxFormats( SwTableBox* pBox, SwCollectTableLineBoxes* 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             :     SwShareBoxFormats* pShareFormats;
     123             :     sal_uInt16 nLinePos;
     124             : 
     125           0 :     _SwGCLineBorder( const SwTable& rTable )
     126           0 :         : pLines( &rTable.GetTabLines() ), pShareFormats(0), nLinePos( 0 )  {}
     127             : 
     128           0 :     _SwGCLineBorder( const SwTableBox& rBox )
     129           0 :         : pLines( &rBox.GetTabLines() ), pShareFormats(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 SwFrameFormat& rFormat );
     148             : 
     149           0 :     bool IsAnyBorderFound() const { return bAnyBorderFnd; }
     150             : };
     151             : 
     152             : void sw_GC_Line_Border( const SwTableLine* pLine, _SwGCLineBorder* pGCPara );
     153             : 
     154        6766 : class SwShareBoxFormat
     155             : {
     156             :     const SwFrameFormat* pOldFormat;
     157             :     std::vector<SwFrameFormat*> aNewFormats;
     158             : 
     159             : public:
     160        6766 :     SwShareBoxFormat( const SwFrameFormat& rFormat )
     161        6766 :         : pOldFormat( &rFormat )
     162        6766 :     {}
     163             : 
     164       15031 :     const SwFrameFormat& GetOldFormat() const { return *pOldFormat; }
     165             : 
     166             :     SwFrameFormat* GetFormat( long nWidth ) const;
     167             :     SwFrameFormat* GetFormat( const SfxPoolItem& rItem ) const;
     168             :     void AddFormat( SwFrameFormat& rFormat );
     169             :     /// @returns true, if we can delete
     170             :     bool RemoveFormat( const SwFrameFormat& rFormat );
     171             : };
     172             : 
     173             : typedef boost::ptr_vector<SwShareBoxFormat> _SwShareBoxFormats;
     174             : 
     175             : class SwShareBoxFormats
     176             : {
     177             :     _SwShareBoxFormats aShareArr;
     178             :     bool Seek_Entry( const SwFrameFormat& rFormat, sal_uInt16* pPos ) const;
     179             : 
     180             :     void ChangeFrameFormat( SwTableBox* pBox, SwTableLine* pLn, SwFrameFormat& rFormat );
     181             : 
     182             : public:
     183        3229 :     SwShareBoxFormats() {}
     184             :     ~SwShareBoxFormats();
     185             : 
     186             :     SwFrameFormat* GetFormat( const SwFrameFormat& rFormat, long nWidth ) const;
     187             :     SwFrameFormat* GetFormat( const SwFrameFormat& rFormat, const SfxPoolItem& ) const;
     188             : 
     189             :     void AddFormat( const SwFrameFormat& rOld, SwFrameFormat& rNew );
     190             : 
     191             :     void SetSize( SwTableBox& rBox, const SwFormatFrmSize& rSz );
     192             :     void SetAttr( SwTableBox& rBox, const SfxPoolItem& rItem );
     193             :     void SetAttr( SwTableLine& rLine, const SfxPoolItem& rItem );
     194             : 
     195             :     void RemoveFormat( const SwFrameFormat& rFormat );
     196             : };
     197             : 
     198             : #endif
     199             : 
     200             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11