LCOV - code coverage report
Current view: top level - sw/inc - fmtclds.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 31 0.0 %
Date: 2014-04-14 Functions: 0 29 0.0 %
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_INC_FMTCLDS_HXX
      20             : #define INCLUDED_SW_INC_FMTCLDS_HXX
      21             : 
      22             : #include <editeng/borderline.hxx>
      23             : #include <tools/color.hxx>
      24             : #include <svl/poolitem.hxx>
      25             : #include "swdllapi.h"
      26             : #include <hintids.hxx>
      27             : #include <format.hxx>
      28             : #include <boost/ptr_container/ptr_vector.hpp>
      29             : 
      30             : /// ColumnDescriptor
      31             : class SwColumn
      32             : {
      33             :     sal_uInt16 nWish;   /**< Desired width, borders included.
      34             :                          It is inversely proportional to the ratio of
      35             :                          desired width environment / current width column. */
      36             :     sal_uInt16 nUpper;  ///< Top border.
      37             :     sal_uInt16 nLower;  ///< Bottom border.
      38             :     sal_uInt16 nLeft;   ///< Left border.
      39             :     sal_uInt16 nRight;  ///< Right border.
      40             : 
      41             : public:
      42             :     SwColumn();
      43             : 
      44             :     sal_Bool operator==( const SwColumn & ) const;
      45             : 
      46           0 :     void SetWishWidth( sal_uInt16 nNew ) { nWish  = nNew; }
      47             :     void SetUpper( sal_uInt16  nNew ) { nUpper = nNew; }
      48             :     void SetLower( sal_uInt16  nNew ) { nLower = nNew; }
      49           0 :     void SetLeft ( sal_uInt16  nNew ) { nLeft  = nNew; }
      50           0 :     void SetRight( sal_uInt16  nNew ) { nRight = nNew; }
      51             : 
      52           0 :     sal_uInt16 GetWishWidth() const { return nWish;  }
      53           0 :     sal_uInt16 GetUpper() const { return nUpper; }
      54           0 :     sal_uInt16 GetLower() const { return nLower; }
      55           0 :     sal_uInt16 GetLeft () const { return nLeft; }
      56           0 :     sal_uInt16 GetRight() const { return nRight; }
      57             : };
      58             : 
      59             : typedef boost::ptr_vector<SwColumn> SwColumns;
      60             : 
      61             : enum SwColLineAdj
      62             : {
      63             :     COLADJ_NONE,
      64             :     COLADJ_TOP,
      65             :     COLADJ_CENTER,
      66             :     COLADJ_BOTTOM
      67             : };
      68             : 
      69             : class SW_DLLPUBLIC SwFmtCol : public SfxPoolItem
      70             : {
      71             :     editeng::SvxBorderStyle eLineStyle;     ///< style of the separator line
      72             :     sal_uLong   nLineWidth;                 ///< Width of the separator line.
      73             :     Color   aLineColor;                     ///< Color of the separator line.
      74             : 
      75             :     sal_uInt16   nLineHeight;               /**< Percentile height of lines.
      76             :                                           (Based on height of columns including UL). */
      77             : 
      78             :     SwColLineAdj eAdj;                      ///< Line will be adjusted top, centered or bottom.
      79             : 
      80             :     SwColumns   aColumns;                   ///< Information concerning the columns.
      81             :     sal_uInt16  nWidth;                     ///< Total desired width of all columns.
      82             :     sal_Int16   aWidthAdjustValue;
      83             : 
      84             :     sal_Bool bOrtho;            /**< Only if this flag is set, the setting of GutterWidth will
      85             :                              be accompanied by a "visual rearrangement".
      86             :                              The flag must be reset if widths of columns or borders are changed.
      87             :                              When it is set (again) the visual arrangement is recalculated.
      88             :                              The flag is initially set. */
      89             : 
      90             :     SAL_DLLPRIVATE void Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct );
      91             : 
      92             : public:
      93             :     SwFmtCol();
      94             :     SwFmtCol( const SwFmtCol& );
      95             :     virtual ~SwFmtCol();
      96             :     //#i120133#
      97           0 :     sal_Int16 GetAdjustValue() const { return aWidthAdjustValue; }
      98           0 :     void SetAdjustValue( const sal_Int16& n ) { aWidthAdjustValue = n; }
      99             : 
     100             :     SwFmtCol& operator=( const SwFmtCol& );
     101             : 
     102             :     /// "pure virtual methods" of SfxPoolItem
     103             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
     104             :     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
     105             :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     106             :                                     SfxMapUnit eCoreMetric,
     107             :                                     SfxMapUnit ePresMetric,
     108             :                                     OUString &rText,
     109             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     110             : 
     111             :     virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
     112             :     virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
     113             : 
     114           0 :     const SwColumns &GetColumns() const { return aColumns; }
     115           0 :           SwColumns &GetColumns()       { return aColumns; }
     116           0 :     sal_uInt16           GetNumCols() const { return aColumns.size(); }
     117             : 
     118           0 :     editeng::SvxBorderStyle     GetLineStyle() const  { return eLineStyle;}
     119           0 :     sal_uLong           GetLineWidth() const  { return nLineWidth;}
     120           0 :     const Color&    GetLineColor() const { return aLineColor;}
     121             : 
     122           0 :     SwColLineAdj     GetLineAdj() const { return eAdj; }
     123           0 :     sal_Bool             IsOrtho()    const { return bOrtho; }
     124           0 :     sal_uInt16           GetWishWidth() const { return nWidth; }
     125           0 :     sal_uInt8            GetLineHeight()const { return nLineHeight; }
     126             : 
     127             :     /** @return USHRT_MAX if ambiguous.
     128             :      @return smallest width if bMin is true. */
     129             :     sal_uInt16 GetGutterWidth( sal_Bool bMin = sal_False ) const;
     130             : 
     131           0 :     void SetLineStyle(editeng::SvxBorderStyle eStyle)        { eLineStyle = eStyle;}
     132           0 :     void SetLineWidth(sal_uLong nLWidth)        { nLineWidth = nLWidth;}
     133           0 :     void SetLineColor(const Color& rCol )   { aLineColor = rCol;}
     134           0 :     void SetLineHeight( sal_uInt8 nNew )     { nLineHeight = nNew; }
     135           0 :     void SetLineAdj( SwColLineAdj eNew ){ eAdj = eNew; }
     136           0 :     void SetWishWidth( sal_uInt16 nNew )    { nWidth = nNew; }
     137             : 
     138             :     /** This function allows to (repeatedly) initialize the columns.
     139             :      The Ortho flag is set automatically. */
     140             :     void Init( sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct );
     141             : 
     142             :     /** Adjusts borders for columns in aColumns.
     143             :      If flag bOrtho is set, columns are visually re-arranged.
     144             :      If the flag is not set, columns widths are not changed and
     145             :      borders are adjusted. */
     146             :     void SetGutterWidth( sal_uInt16 nNew, sal_uInt16 nAct );
     147             : 
     148             :     /** This too re-arranges columns automatically if flag is set.
     149             :      Only in this case the second parameter is needed and evaluated. */
     150             :     void SetOrtho( sal_Bool bNew, sal_uInt16 nGutterWidth, sal_uInt16 nAct );
     151             : 
     152             :     /// For the reader
     153           0 :     void _SetOrtho( sal_Bool bNew ) { bOrtho = bNew; }
     154             : 
     155             :     /** Calculates current width of column nCol.
     156             :      The ratio of desired width of this column to return value is
     157             :      proportional to ratio of total desired value to nAct. */
     158             :     sal_uInt16 CalcColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const;
     159             : 
     160             :     /** As above except that it @return the width of PrtArea -
     161             :      that corresponds to what constitutes the column for the user. */
     162             :     sal_uInt16 CalcPrtColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const;
     163             : };
     164             : 
     165           0 : inline const SwFmtCol &SwAttrSet::GetCol(sal_Bool bInP) const
     166           0 :     { return (const SwFmtCol&)Get( RES_COL,bInP); }
     167             : 
     168           0 : inline const SwFmtCol &SwFmt::GetCol(sal_Bool bInP) const
     169           0 :     { return aSet.GetCol(bInP); }
     170             : 
     171             : #endif
     172             : 
     173             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10