LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/svx - numfmtsh.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 5 0.0 %
Date: 2012-08-25 Functions: 0 5 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           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_NUMFMTSH_HXX
      29                 :            : #define _SVX_NUMFMTSH_HXX
      30                 :            : 
      31                 :            : #include <tools/string.hxx>
      32                 :            : #include <i18npool/lang.h>
      33                 :            : 
      34                 :            : #include "svx/svxdllapi.h"
      35                 :            : 
      36                 :            : #include <svl/zforlist.hxx>
      37                 :            : 
      38                 :            : #include <vector>
      39                 :            : #include <map>
      40                 :            : 
      41                 :            : class Color;
      42                 :            : 
      43                 :            : enum SvxNumberValueType
      44                 :            : {
      45                 :            :     SVX_VALUE_TYPE_UNDEFINED = 0,
      46                 :            :     SVX_VALUE_TYPE_NUMBER,
      47                 :            :     SVX_VALUE_TYPE_STRING
      48                 :            : };
      49                 :            : 
      50                 :            : // sort order of the category ListBox entries in the TabPage
      51                 :            : #define CAT_ALL             0
      52                 :            : #define CAT_USERDEFINED     1
      53                 :            : #define CAT_NUMBER          2
      54                 :            : #define CAT_PERCENT         3
      55                 :            : #define CAT_CURRENCY        4
      56                 :            : #define CAT_DATE            5
      57                 :            : #define CAT_TIME            6
      58                 :            : #define CAT_SCIENTIFIC      7
      59                 :            : #define CAT_FRACTION        8
      60                 :            : #define CAT_BOOLEAN         9
      61                 :            : #define CAT_TEXT            10
      62                 :            : 
      63                 :            : #define SELPOS_NONE         -1
      64                 :            : 
      65                 :            : #define NUMBERFORMAT_ENTRY_NEW_CURRENCY     NUMBERFORMAT_ENTRY_NOT_FOUND-1
      66                 :            : 
      67                 :            : 
      68                 :            : class SVX_DLLPUBLIC SvxNumberFormatShell
      69                 :            : {
      70                 :            : public:
      71                 :            :                         SvxNumberFormatShell( SvNumberFormatter* pNumFormatter,
      72                 :            :                                               sal_uInt32         nFormatKey,
      73                 :            :                                               SvxNumberValueType eNumValType,
      74                 :            :                                               const String&      rNumStr );
      75                 :            : 
      76                 :            :                         SvxNumberFormatShell( SvNumberFormatter* pNumFormatter,
      77                 :            :                                               sal_uInt32         nFormatKey,
      78                 :            :                                               SvxNumberValueType eNumValType,
      79                 :            :                                               double             nNumVal,
      80                 :            :                                               const String*      pNumStr = NULL );
      81                 :            : 
      82                 :            :                         ~SvxNumberFormatShell();
      83                 :            : 
      84                 :            : 
      85                 :            :     static SvxNumberFormatShell*    Create( SvNumberFormatter* pNumFormatter,
      86                 :            :                                               sal_uInt32         nFormatKey,
      87                 :            :                                               SvxNumberValueType eNumValType,
      88                 :            :                                               const String&      rNumStr );
      89                 :            : 
      90                 :            :     static SvxNumberFormatShell*    Create( SvNumberFormatter* pNumFormatter,
      91                 :            :                                               sal_uInt32         nFormatKey,
      92                 :            :                                               SvxNumberValueType eNumValType,
      93                 :            :                                               double             nNumVal,
      94                 :            :                                               const String*      pNumStr = NULL );
      95                 :            : 
      96                 :            : 
      97                 :            :     void                GetInitSettings( sal_uInt16&           nCatLbPos,
      98                 :            :                                          LanguageType&         rLangType,
      99                 :            :                                          sal_uInt16&           nFmtLbSelPos,
     100                 :            :                                          std::vector<String*>& rFmtEntries,
     101                 :            :                                          String&               rPrevString,
     102                 :            :                                          Color*&               rpPrevColor );
     103                 :            : 
     104                 :            :     void                CategoryChanged( sal_uInt16            nCatLbPos,
     105                 :            :                                          short&                rFmtSelPos,
     106                 :            :                                          std::vector<String*>& rFmtEntries );
     107                 :            : 
     108                 :            :     void                LanguageChanged( LanguageType          eLangType,
     109                 :            :                                          short&                rFmtSelPos,
     110                 :            :                                          std::vector<String*>& rFmtEntries );
     111                 :            : 
     112                 :            :     void                FormatChanged( sal_uInt16  nFmtLbPos,
     113                 :            :                                        String& rPreviewStr,
     114                 :            :                                        Color*& rpFontColor );
     115                 :            : 
     116                 :            :     bool                AddFormat( String&               rFormat,
     117                 :            :                                    xub_StrLen&           rErrPos,
     118                 :            :                                    sal_uInt16&           rCatLbSelPos,
     119                 :            :                                    short&                rFmtSelPos,
     120                 :            :                                    std::vector<String*>& rFmtEntries );
     121                 :            : 
     122                 :            :     bool                RemoveFormat( const String&         rFormat,
     123                 :            :                                       sal_uInt16&           rCatLbSelPos,
     124                 :            :                                       short&                rFmtSelPos,
     125                 :            :                                       std::vector<String*>& rFmtEntries );
     126                 :            : 
     127                 :            :     void                MakeFormat( String& rFormat,
     128                 :            :                                     bool        bThousand,
     129                 :            :                                     bool        bNegRed,
     130                 :            :                                     sal_uInt16  nPrecision,
     131                 :            :                                     sal_uInt16  nLeadingZeroes,
     132                 :            :                                     sal_uInt16  nCurrencyEntryPos);
     133                 :            : 
     134                 :            :     void                GetOptions( const String& rFormat,
     135                 :            :                                     bool&         rThousand,
     136                 :            :                                     bool&         rNegRed,
     137                 :            :                                     sal_uInt16&   rPrecision,
     138                 :            :                                     sal_uInt16&   rLeadingZeroes,
     139                 :            :                                     sal_uInt16&   rCatLbPos );
     140                 :            : 
     141                 :            :     void                MakePreviewString( const String& rFormatStr,
     142                 :            :                                            String&       rPreviewStr,
     143                 :            :                                            Color*&       rpFontColor );
     144                 :            : 
     145                 :            :     void                MakePrevStringFromVal( const String& rFormatStr,
     146                 :            :                                                 String& rPreviewStr,
     147                 :            :                                                 Color*& rpFontColor,
     148                 :            :                                                 double  nValue);
     149                 :            : 
     150                 :            :     bool                IsUserDefined( const String& rFmtString );
     151                 :            :     bool                IsTmpCurrencyFormat( const String& rFmtString );
     152                 :            :     bool                FindEntry( const String& rFmtString, sal_uInt32* pAt = NULL );
     153                 :            : 
     154                 :          0 :     void                ValidateNewEntries( bool bValidate = true ) { bUndoAddList = !bValidate; }
     155                 :            :     size_t              GetUpdateDataCount() const;
     156                 :            :     void                GetUpdateData( sal_uInt32* pDelArray, const sal_uInt32 nSize );
     157                 :            : 
     158                 :          0 :     void                SetCurNumFmtKey( sal_uInt32 nNew )  { nCurFormatKey = nNew; }
     159                 :            :     void                SetCurLanguage( LanguageType eNew ) { eCurLanguage = eNew; }
     160                 :          0 :     sal_uInt32          GetCurNumFmtKey() const             { return nCurFormatKey; }
     161                 :          0 :     LanguageType        GetCurLanguage() const              { return eCurLanguage; }
     162                 :            : 
     163                 :            :                         /** Returns the name of Standard, General, ... for the
     164                 :            :                             current language. */
     165                 :            :     String              GetStandardName() const;
     166                 :            : 
     167                 :            :     String              GetComment4Entry(short nEntry);
     168                 :            :     short               GetCategory4Entry(short nEntry);
     169                 :            :     bool                GetUserDefined4Entry(short nEntry);
     170                 :            :     String              GetFormat4Entry(short nEntry);
     171                 :            :     void                SetComment4Entry(short nEntry,String aCommentString);
     172                 :            : 
     173                 :            :     void                SetCurrencySymbol(sal_uInt16 nPos);
     174                 :            :     sal_uInt32          GetCurrencySymbol();
     175                 :            :     sal_uInt16          FindCurrencyFormat( const String& rFmtString );
     176                 :            :     sal_uInt16          FindCurrencyFormat(const NfCurrencyEntry* pTmpCurrencyEntry,bool bTmpBanking);
     177                 :            :     void                SetCurCurrencyEntry(NfCurrencyEntry*);
     178                 :            :     short               GetListPos4Entry(sal_uInt32 nIdx);
     179                 :            :     short               GetListPos4Entry( const String& rFmtString );
     180                 :            : 
     181                 :            :     void                GetCurrencySymbols(std::vector<rtl::OUString>& rList, sal_uInt16* pPos );
     182                 :            :     void                GetCurrencySymbols(std::vector<rtl::OUString>& rList, bool bFlag );
     183                 :            : 
     184                 :            :     sal_uInt16          FindCurrencyTableEntry( const String& rFmtString, bool &bTestBanking );
     185                 :            :     bool                IsInTable(sal_uInt16 nPos, bool bTmpBanking,
     186                 :            :                             ::rtl::OUString const& rFmtString);
     187                 :            : 
     188                 :          0 :     void                SetUseStarFormat( bool bUse ) { bUseStarFormat = bUse; }
     189                 :            :     bool                IsUseStarFormat( void ) { return bUseStarFormat; }
     190                 :            : private:
     191                 :            :     static const double     DEFAULT_NUMVALUE;
     192                 :            : 
     193                 :            :     SvNumberFormatter*      pFormatter;
     194                 :            :     SvNumberFormatTable*    pCurFmtTable;
     195                 :            :     SvxNumberValueType      eValType;
     196                 :            :     String                  aValStr;
     197                 :            :     double                  nValNum;
     198                 :            :     bool                    bUndoAddList;
     199                 :            :     std::vector<sal_uInt32> aAddList;
     200                 :            :     std::vector<sal_uInt32> aDelList;
     201                 :            :     std::vector<sal_uInt32> aCurEntryList;
     202                 :            :     sal_uInt32              nCurFormatKey;
     203                 :            :     short                   nCurCategory;
     204                 :            :     LanguageType            eCurLanguage;
     205                 :            :     std::vector<sal_uInt16> aCurCurrencyList;
     206                 :            :     NfCurrencyEntry*        pCurCurrencyEntry;
     207                 :            :     bool                    bBankingSymbol;
     208                 :            :     sal_uInt16              nCurCurrencyEntryPos;
     209                 :            :     std::vector<String*>    aCurrencyFormatList;
     210                 :            :     bool                    bUseStarFormat;
     211                 :            : #ifdef _SVX_NUMFMTSH_CXX
     212                 :            :     SVX_DLLPRIVATE short FillEntryList_Impl( std::vector<String*>& rList );
     213                 :            :     SVX_DLLPRIVATE void  FillEListWithStd_Impl( std::vector<String*>& rList,sal_uInt16 aPrivCat, short &Pos);
     214                 :            :     SVX_DLLPRIVATE short FillEListWithFormats_Impl( std::vector<String*>& rList,short nSelPos,
     215                 :            :                                                        NfIndexTableOffset eOffsetStart,
     216                 :            :                                                        NfIndexTableOffset eOffsetEnd);
     217                 :            :     SVX_DLLPRIVATE short FillEListWithDateTime_Impl( std::vector<String*>& rList,short nSelPos);
     218                 :            :     SVX_DLLPRIVATE short FillEListWithCurrency_Impl( std::vector<String*>& rList,short nSelPos);
     219                 :            :     SVX_DLLPRIVATE short FillEListWithSysCurrencys( std::vector<String*>& rList,short nSelPos);
     220                 :            :     SVX_DLLPRIVATE short FillEListWithUserCurrencys( std::vector<String*>& rList,short nSelPos);
     221                 :            :     SVX_DLLPRIVATE short FillEListWithUsD_Impl( std::vector<String*>& rList, sal_uInt16 nPrivCat, short Pos );
     222                 :            : 
     223                 :            :     SVX_DLLPRIVATE ::std::vector<sal_uInt32>::iterator GetRemoved_Impl( size_t nKey );
     224                 :            :     SVX_DLLPRIVATE bool                                IsRemoved_Impl( size_t nKey );
     225                 :            :     SVX_DLLPRIVATE ::std::vector<sal_uInt32>::iterator GetAdded_Impl( size_t nKey );
     226                 :            :     SVX_DLLPRIVATE bool                                IsAdded_Impl( size_t nKey );
     227                 :            : 
     228                 :            :     SVX_DLLPRIVATE void  GetPreviewString_Impl( String& rString,
     229                 :            :                                                 Color*& rpColor );
     230                 :            :     SVX_DLLPRIVATE void  PosToCategory_Impl( sal_uInt16 nPos, short& rCategory );
     231                 :            :     SVX_DLLPRIVATE void  CategoryToPos_Impl( short nCategory, sal_uInt16& rPos );
     232                 :            : #endif
     233                 :            : };
     234                 :            : 
     235                 :            : 
     236                 :            : #endif
     237                 :            : 
     238                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10