LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/editeng - boxitem.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 22 25 88.0 %
Date: 2012-08-25 Functions: 18 21 85.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 6 33.3 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _SVX_BOXITEM_HXX
      29                 :            : #define _SVX_BOXITEM_HXX
      30                 :            : 
      31                 :            : #include <svl/poolitem.hxx>
      32                 :            : #include <editeng/borderline.hxx>
      33                 :            : #include <editeng/editengdllapi.h>
      34                 :            : #include <com/sun/star/table/BorderLine2.hpp>
      35                 :            : 
      36                 :            : namespace rtl { class OUString; }
      37                 :            : 
      38                 :            : // class SvxBoxItem ------------------------------------------------------
      39                 :            : 
      40                 :            : /*  [Description]
      41                 :            : 
      42                 :            :     This item describes a border attribute
      43                 :            :     (all four edges and the inward distance)
      44                 :            : */
      45                 :            : 
      46                 :            : #define BOX_LINE_TOP    ((sal_uInt16)0)
      47                 :            : #define BOX_LINE_BOTTOM ((sal_uInt16)1)
      48                 :            : #define BOX_LINE_LEFT   ((sal_uInt16)2)
      49                 :            : #define BOX_LINE_RIGHT  ((sal_uInt16)3)
      50                 :            : 
      51                 :            : /**
      52                 :            : This version causes SvxBoxItem to store the 4 cell spacing distances separately
      53                 :            : when serializing to stream.
      54                 :            : */
      55                 :            : #define BOX_4DISTS_VERSION ((sal_uInt16)1)
      56                 :            : /**
      57                 :            : This version causes SvxBoxItem to store the styles for its border lines when
      58                 :            : serializing to stream.
      59                 :            : */
      60                 :            : #define BOX_BORDER_STYLE_VERSION ((sal_uInt16)2)
      61                 :            : 
      62                 :            : class EDITENG_DLLPUBLIC SvxBoxItem : public SfxPoolItem
      63                 :            : {
      64                 :            :     editeng::SvxBorderLine  *pTop,
      65                 :            :                             *pBottom,
      66                 :            :                             *pLeft,
      67                 :            :                             *pRight;
      68                 :            :     sal_uInt16          nTopDist,
      69                 :            :                     nBottomDist,
      70                 :            :                     nLeftDist,
      71                 :            :                     nRightDist;
      72                 :            : 
      73                 :            : public:
      74                 :            :     TYPEINFO();
      75                 :            : 
      76                 :            :     SvxBoxItem( const sal_uInt16 nId );
      77                 :            :     SvxBoxItem( const SvxBoxItem &rCpy );
      78                 :            :     ~SvxBoxItem();
      79                 :            :     SvxBoxItem &operator=( const SvxBoxItem& rBox );
      80                 :            : 
      81                 :            :     // "pure virtual Methods" from SfxPoolItem
      82                 :            :     virtual int              operator==( const SfxPoolItem& ) const;
      83                 :            :     virtual bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
      84                 :            :     virtual bool            PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
      85                 :            : 
      86                 :            :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
      87                 :            :                                     SfxMapUnit eCoreMetric,
      88                 :            :                                     SfxMapUnit ePresMetric,
      89                 :            :                                     String &rText, const IntlWrapper * = 0 ) const;
      90                 :            : 
      91                 :            :     virtual SfxPoolItem*     Clone( SfxItemPool *pPool = 0 ) const;
      92                 :            :     virtual SfxPoolItem*     Create(SvStream &, sal_uInt16) const;
      93                 :            :     virtual SvStream&        Store(SvStream &, sal_uInt16 nItemVersion ) const;
      94                 :            :     virtual sal_uInt16           GetVersion( sal_uInt16 nFileVersion ) const;
      95                 :            : 
      96                 :            :     virtual bool             ScaleMetrics( long nMult, long nDiv );
      97                 :            :     virtual bool             HasMetrics() const;
      98                 :            : 
      99                 :    1545075 :     const   editeng::SvxBorderLine* GetTop()    const { return pTop; }
     100                 :    1490574 :     const   editeng::SvxBorderLine* GetBottom() const { return pBottom; }
     101                 :    1502751 :     const   editeng::SvxBorderLine* GetLeft()   const { return pLeft; }
     102                 :    1493253 :     const   editeng::SvxBorderLine* GetRight()  const { return pRight; }
     103                 :            : 
     104                 :            :     const   editeng::SvxBorderLine* GetLine( sal_uInt16 nLine ) const;
     105                 :            : 
     106                 :            :         //The Pointers are being copied!
     107                 :            :     void    SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine );
     108                 :            : 
     109                 :            :     sal_uInt16  GetDistance( sal_uInt16 nLine ) const;
     110                 :            :     sal_uInt16  GetDistance() const;
     111                 :            : 
     112                 :            :     void    SetDistance( sal_uInt16 nNew, sal_uInt16 nLine );
     113                 :            :     inline void SetDistance( sal_uInt16 nNew );
     114                 :            : 
     115                 :            :         // Line width plus Space plus inward distance
     116                 :            :         //bIgnoreLine = TRUE -> Also return distance, when no Line is set
     117                 :            :     sal_uInt16  CalcLineSpace( sal_uInt16 nLine, sal_Bool bIgnoreLine = sal_False ) const;
     118                 :            :     static com::sun::star::table::BorderLine2 SvxLineToLine( const editeng::SvxBorderLine* pLine, sal_Bool bConvert );
     119                 :            :     static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert);
     120                 :            :     static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert);
     121                 :            : };
     122                 :            : 
     123                 :       4872 : inline void SvxBoxItem::SetDistance( sal_uInt16 nNew )
     124                 :            : {
     125                 :       4872 :     nTopDist = nBottomDist = nLeftDist = nRightDist = nNew;
     126                 :       4872 : }
     127                 :            : 
     128                 :            : // class SvxBoxInfoItem --------------------------------------------------
     129                 :            : 
     130                 :            : /*  [Description]
     131                 :            : 
     132                 :            :     Another item for the border. This item has only limited functionality.
     133                 :            :     On one hand, the general Dialog is told by the item which options it
     134                 :            :     should offer. On the other hand, this attribute  may be used to
     135                 :            :     transported the borderline for the inner horizontal and vertical lines.
     136                 :            : */
     137                 :            : 
     138                 :            : #define BOXINFO_LINE_HORI   ((sal_uInt16)0)
     139                 :            : #define BOXINFO_LINE_VERT   ((sal_uInt16)1)
     140                 :            : 
     141                 :            : #define VALID_TOP           0x01
     142                 :            : #define VALID_BOTTOM        0x02
     143                 :            : #define VALID_LEFT          0x04
     144                 :            : #define VALID_RIGHT         0x08
     145                 :            : #define VALID_HORI          0x10
     146                 :            : #define VALID_VERT          0x20
     147                 :            : #define VALID_DISTANCE      0x40
     148                 :            : #define VALID_DISABLE       0x80
     149                 :            : 
     150                 :            : class EDITENG_DLLPUBLIC SvxBoxInfoItem : public SfxPoolItem
     151                 :            : {
     152                 :            :     editeng::SvxBorderLine* pHori;   //inner horizontal Line
     153                 :            :     editeng::SvxBorderLine* pVert;   //inner vertical Line
     154                 :            : 
     155                 :            :     bool                mbEnableHor;   /// true = Enable inner horizontal line.
     156                 :            :     bool                mbEnableVer;   /// true = Enable inner vertical line.
     157                 :            : 
     158                 :            :     /*
     159                 :            :      Currently only for StarWriter: distance inward from SvxBoxItem. If the
     160                 :            :      distance is requested, then the field for the distance from the dialog be
     161                 :            :      activated. nDefDist is regarded as a default value. If any line is
     162                 :            :      turned on or will be turned on it must this distance be set to default.
     163                 :            :      bMinDist indicates whether the user can go below this value or not.
     164                 :            :      With NDIST is the current distance from the app transported back and
     165                 :            :      forth to the dialogue.
     166                 :            :     */
     167                 :            : 
     168                 :            :     sal_Bool    bDist      :1;  // TRUE, Unlock Distance.
     169                 :            :     sal_Bool    bMinDist   :1;  // TRUE, Going below minimum Distance is prohibited
     170                 :            : 
     171                 :            :     sal_uInt8   nValidFlags;    // 0000 0000
     172                 :            :                             // ³³³³ ³³³ÀÄ VALID_TOP
     173                 :            :                             // ³³³³ ³³ÀÄÄ VALID_BOTTOM
     174                 :            :                             // ³³³³ ³ÀÄÄÄ VALID_LEFT
     175                 :            :                             // ³³³³ ÀÄÄÄÄ VALID_RIGHT
     176                 :            :                             // ³³³ÀÄÄÄÄÄÄ VALID_HORI
     177                 :            :                             // ³³ÀÄÄÄÄÄÄÄ VALID_VERT
     178                 :            :                             // ³ÀÄÄÄÄÄÄÄÄ VALID_DIST
     179                 :            :                             // ÀÄÄÄÄÄÄÄÄÄ VALID_DISABLE
     180                 :            : 
     181                 :            :     sal_uInt16  nDefDist;       // The default or minimum distance.
     182                 :            : 
     183                 :            : public:
     184                 :            :     TYPEINFO();
     185                 :            : 
     186                 :            :     SvxBoxInfoItem( const sal_uInt16 nId );
     187                 :            :     SvxBoxInfoItem( const SvxBoxInfoItem &rCpy );
     188                 :            :     ~SvxBoxInfoItem();
     189                 :            :     SvxBoxInfoItem &operator=( const SvxBoxInfoItem &rCpy );
     190                 :            : 
     191                 :            :     // "pure virtual Methods" from SfxPoolItem
     192                 :            :     virtual int              operator==( const SfxPoolItem& ) const;
     193                 :            :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     194                 :            :                                     SfxMapUnit eCoreMetric,
     195                 :            :                                     SfxMapUnit ePresMetric,
     196                 :            :                                     String &rText, const IntlWrapper * = 0 ) const;
     197                 :            :     virtual bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
     198                 :            :     virtual bool            PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
     199                 :            : 
     200                 :            :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
     201                 :            :     virtual SfxPoolItem*    Create(SvStream &, sal_uInt16) const;
     202                 :            :     virtual SvStream&       Store(SvStream &, sal_uInt16 nItemVersion ) const;
     203                 :            :     virtual bool             ScaleMetrics( long nMult, long nDiv );
     204                 :            :     virtual bool             HasMetrics() const;
     205                 :            : 
     206                 :      25600 :     const editeng::SvxBorderLine*   GetHori() const { return pHori; }
     207                 :      25496 :     const editeng::SvxBorderLine*   GetVert() const { return pVert; }
     208                 :            : 
     209                 :            :         //The Pointers are being copied!
     210                 :            :     void                    SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine );
     211                 :            : 
     212 [ #  # ][ #  # ]:          0 :     sal_Bool    IsTable() const             { return mbEnableHor && mbEnableVer; }
     213                 :      15675 :     void    SetTable( sal_Bool bNew )       { mbEnableHor = mbEnableVer = bNew; }
     214                 :            : 
     215                 :          0 :     inline bool         IsHorEnabled() const { return mbEnableHor; }
     216                 :         50 :     inline void         EnableHor( bool bEnable ) { mbEnableHor = bEnable; }
     217                 :          0 :     inline bool         IsVerEnabled() const { return mbEnableVer; }
     218                 :         50 :     inline void         EnableVer( bool bEnable ) { mbEnableVer = bEnable; }
     219                 :            : 
     220                 :      24595 :     sal_Bool    IsDist() const              { return bDist; }
     221                 :      15666 :     void    SetDist( sal_Bool bNew )        { bDist = bNew; }
     222                 :      24595 :     sal_Bool    IsMinDist() const           { return bMinDist; }
     223                 :      10490 :     void    SetMinDist( sal_Bool bNew )     { bMinDist = bNew; }
     224                 :      24595 :     sal_uInt16  GetDefDist() const          { return nDefDist; }
     225                 :       9540 :     void    SetDefDist( sal_uInt16 nNew )   { nDefDist = nNew; }
     226                 :            : 
     227                 :      22025 :     sal_Bool                    IsValid( sal_uInt8 nValid ) const
     228                 :      22025 :                                 { return ( nValidFlags & nValid ) == nValid; }
     229                 :      21549 :     void                    SetValid( sal_uInt8 nValid, sal_Bool bValid = sal_True )
     230                 :            :                                 { bValid ? ( nValidFlags |= nValid )
     231         [ +  + ]:      21549 :                                          : ( nValidFlags &= ~nValid ); }
     232                 :            :     void                    ResetFlags();
     233                 :            : };
     234                 :            : #endif
     235                 :            : 
     236                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10