LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter/xfilter - xfnumberstyle.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 22 26 84.6 %
Date: 2015-06-13 12:38:46 Functions: 8 10 80.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             :  *
       4             :  *  The Contents of this file are made available subject to the terms of
       5             :  *  either of the following licenses
       6             :  *
       7             :  *         - GNU Lesser General Public License Version 2.1
       8             :  *         - Sun Industry Standards Source License Version 1.1
       9             :  *
      10             :  *  Sun Microsystems Inc., October, 2000
      11             :  *
      12             :  *  GNU Lesser General Public License Version 2.1
      13             :  *  =============================================
      14             :  *  Copyright 2000 by Sun Microsystems, Inc.
      15             :  *  901 San Antonio Road, Palo Alto, CA 94303, USA
      16             :  *
      17             :  *  This library is free software; you can redistribute it and/or
      18             :  *  modify it under the terms of the GNU Lesser General Public
      19             :  *  License version 2.1, as published by the Free Software Foundation.
      20             :  *
      21             :  *  This library is distributed in the hope that it will be useful,
      22             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      23             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      24             :  *  Lesser General Public License for more details.
      25             :  *
      26             :  *  You should have received a copy of the GNU Lesser General Public
      27             :  *  License along with this library; if not, write to the Free Software
      28             :  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
      29             :  *  MA  02111-1307  USA
      30             :  *
      31             :  *
      32             :  *  Sun Industry Standards Source License Version 1.1
      33             :  *  =================================================
      34             :  *  The contents of this file are subject to the Sun Industry Standards
      35             :  *  Source License Version 1.1 (the "License"); You may not use this file
      36             :  *  except in compliance with the License. You may obtain a copy of the
      37             :  *  License at http://www.openoffice.org/license.html.
      38             :  *
      39             :  *  Software provided under this License is provided on an "AS IS" basis,
      40             :  *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
      41             :  *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
      42             :  *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
      43             :  *  See the License for the specific provisions governing your rights and
      44             :  *  obligations concerning the Software.
      45             :  *
      46             :  *  The Initial Developer of the Original Code is: IBM Corporation
      47             :  *
      48             :  *  Copyright: 2008 by IBM Corporation
      49             :  *
      50             :  *  All Rights Reserved.
      51             :  *
      52             :  *  Contributor(s): _______________________________________
      53             :  *
      54             :  *
      55             :  ************************************************************************/
      56             : /*************************************************************************
      57             :  * @file
      58             :  * Number style for table cell.
      59             :  ************************************************************************/
      60             : #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFNUMBERSTYLE_HXX
      61             : #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFNUMBERSTYLE_HXX
      62             : 
      63             : #include "xfstyle.hxx"
      64             : #include "xfstylemanager.hxx"
      65             : #include "xfcolor.hxx"
      66             : #include <rtl/ustring.hxx>
      67             : 
      68          48 : class XFNumberStyle : public XFStyle
      69             : {
      70             : public:
      71             :     XFNumberStyle();
      72             : 
      73             : public:
      74             :     void    SetDecimalDigits(sal_Int32 decimal);
      75             : 
      76             :     void    SetMinInteger(sal_Int32 integer);
      77             : 
      78             :     void    SetMinExponent(sal_Int32 exponent);
      79             : 
      80             :     void    SetGroup(bool group = true);
      81             : 
      82             :     void    SetColor(const XFColor& color);
      83           0 :     XFColor GetColor(){return m_aColor;}
      84             : 
      85             :     void    SetPrefix(const OUString& prefix);
      86             : 
      87             :     void    SetSurfix(const OUString& surfix);
      88             : 
      89             :     void    SetNegativeStyle(const OUString& prefix, const OUString& suffix, const XFColor& color=XFColor(255,0,0));
      90             : 
      91             :     void    SetNumberType(enumXFNumberType type);
      92             : 
      93             :     void    SetCurrencySymbol(bool post, const OUString& symbol, bool bShowSpace=false);
      94             : 
      95             :     virtual enumXFStyle GetStyleFamily() SAL_OVERRIDE;
      96             : 
      97             :     virtual bool Equal(IXFStyle *pStyle) SAL_OVERRIDE;
      98             : 
      99             :     virtual void ToXml(IXFStream *pStrm) SAL_OVERRIDE;
     100             : 
     101             : protected:
     102             :     void    ToXml_StartElement(IXFStream *pStrm);
     103             : 
     104             :     void    ToXml_EndElement(IXFStream *pStrm);
     105             : 
     106             :     void    ToXml_Normal(IXFStream *pStrm);
     107             : 
     108             :     void    ToXml_Negative(IXFStream *pStrm);
     109             : 
     110             :     void    ToXml_Content(IXFStream *pStrm, bool nagetive);
     111             : 
     112             : protected:
     113             :     enumXFNumberType    m_eType;
     114             :     sal_Int32   m_nDecimalDigits;
     115             :     sal_Int32   m_nMinInteger;
     116             :     sal_Int32   m_nMinExponent;
     117             :     bool    m_bGroup;
     118             :     XFColor     m_aColor;
     119             :     bool    m_bCurrencySymbolPost;
     120             :     OUString   m_strCurrencySymbol;
     121             :     OUString   m_strPrefix;
     122             :     OUString   m_strSuffix;
     123             : 
     124             :     bool    m_bRedIfNegative;
     125             :     XFColor     m_aNegativeColor;
     126             :     OUString   m_strNegativePrefix;
     127             :     OUString   m_strNegativeSuffix;
     128             : };
     129             : 
     130          24 : inline void XFNumberStyle::SetDecimalDigits(sal_Int32 decimal)
     131             : {
     132          24 :     m_nDecimalDigits = decimal;
     133          24 : }
     134             : 
     135             : inline void XFNumberStyle::SetMinInteger(sal_Int32 integer)
     136             : {
     137             :     m_nMinInteger = integer;
     138             : }
     139             : 
     140             : inline void XFNumberStyle::SetMinExponent(sal_Int32 exponent)
     141             : {
     142             :     m_nMinExponent = exponent;
     143             : }
     144             : 
     145          24 : inline void XFNumberStyle::SetNegativeStyle(const OUString& prefix, const OUString& suffix, const XFColor& color)
     146             : {
     147          24 :     m_bRedIfNegative = true;
     148          24 :     m_aNegativeColor = color;
     149          24 :     m_strNegativePrefix = prefix;
     150          24 :     m_strNegativeSuffix = suffix;
     151          24 : }
     152             : 
     153           0 : inline void XFNumberStyle::SetGroup(bool group)
     154             : {
     155           0 :     m_bGroup = group;
     156           0 : }
     157             : 
     158          24 : inline void XFNumberStyle::SetColor(const XFColor& color)
     159             : {
     160          24 :     m_aColor = color;
     161          24 : }
     162             : 
     163          24 : inline void XFNumberStyle::SetNumberType(enumXFNumberType type)
     164             : {
     165          24 :     m_eType = type;
     166          24 : }
     167             : 
     168          24 : inline void XFNumberStyle::SetPrefix(const OUString& prefix)
     169             : {
     170          24 :     m_strPrefix = prefix;
     171          24 : }
     172             : 
     173          24 : inline void XFNumberStyle::SetSurfix(const OUString& surfix)
     174             : {
     175          24 :     m_strSuffix = surfix;
     176          24 : }
     177             : 
     178             : inline void XFNumberStyle::SetCurrencySymbol(bool post, const OUString& symbol, bool bShowSpace)
     179             : {
     180             :     m_bCurrencySymbolPost = post;
     181             :     m_strCurrencySymbol = symbol;
     182             : 
     183             :     if( bShowSpace )
     184             :     {
     185             :         if( post )
     186             :             m_strCurrencySymbol = " " + m_strCurrencySymbol;
     187             :         else
     188             :             m_strCurrencySymbol += " ";
     189             :     }
     190             : }
     191             : 
     192             : #endif
     193             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11