LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/unotools - intlwrapper.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 13 0.0 %
Date: 2012-12-27 Functions: 0 4 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             : #include "unotools/unotoolsdllapi.h"
      20             : 
      21             : #ifndef _UNOTOOLS_INTLWRAPPER_HXX
      22             : #define _UNOTOOLS_INTLWRAPPER_HXX
      23             : #include <unotools/charclass.hxx>
      24             : #include <unotools/localedatawrapper.hxx>
      25             : #include <unotools/calendarwrapper.hxx>
      26             : #include <unotools/collatorwrapper.hxx>
      27             : #include <i18npool/lang.h>
      28             : #include <i18npool/languagetag.hxx>
      29             : 
      30             : 
      31             : /**
      32             :     A wrapper of I18N wrappers. Using this is more expensive than using some
      33             :     single wrapper classes so use it only if you must pass a single pointer
      34             :     without knowing in advance what is needed, e.g. for
      35             :     SfxPoolItem::GetPresentation(). Remember that this wrapper was only created
      36             :     for convenience to bypass some oddities, if possible don't use it. <p>
      37             : 
      38             :     Implemented are only the const get...() methods of the wrappers, which are
      39             :     loaded on demand, for consistency reasons no change of locale is possible.
      40             :     Only default calendar and default collator are supported. <p>
      41             : 
      42             :     One exception though is the calendar wrapper: to be able to set a value and
      43             :     retrieve calendar values it is not const, so methods using this should
      44             :     reset the calendar to the previous value if it isn't sure where the
      45             :     IntlWrapper did come from. <p>
      46             :  */
      47             : class UNOTOOLS_DLLPUBLIC IntlWrapper
      48             : {
      49             : private:
      50             : 
      51             :             LanguageTag         maLanguageTag;
      52             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
      53             : 
      54             :             LocaleDataWrapper*  pLocaleData;
      55             :             CollatorWrapper*    pCollator;
      56             :             CollatorWrapper*    pCaseCollator;
      57             : 
      58             :             void                ImplNewLocaleData() const;
      59             :             void                ImplNewCollator( sal_Bool bCaseSensitive ) const;
      60             : 
      61             : 
      62             : public:
      63             :                                 IntlWrapper(
      64             :                                     const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext,
      65             :                                     const LanguageTag& rLanguageTag
      66             :                                     );
      67             :                                 IntlWrapper(
      68             :                                     const LanguageTag& rLanguageTag
      69             :                                     );
      70             :                                 ~IntlWrapper();
      71             : 
      72           0 :     const LanguageTag&          getLanguageTag() const { return maLanguageTag; }
      73             : 
      74           0 :     const LocaleDataWrapper*    getLocaleData() const
      75             :                                     {
      76           0 :                                         if ( !pLocaleData )
      77           0 :                                             ImplNewLocaleData();
      78           0 :                                         return pLocaleData;
      79             :                                     }
      80             :     /// case insensitive collator, simple IGNORE_CASE
      81           0 :     const CollatorWrapper*      getCollator() const
      82             :                                     {
      83           0 :                                         if ( !pCollator )
      84           0 :                                             ImplNewCollator( sal_False );
      85           0 :                                         return pCollator;
      86             :                                     }
      87             :     /// case sensitive collator
      88           0 :     const CollatorWrapper*      getCaseCollator() const
      89             :                                     {
      90           0 :                                         if ( !pCaseCollator )
      91           0 :                                             ImplNewCollator( sal_True );
      92           0 :                                         return pCaseCollator;
      93             :                                     }
      94             : };
      95             : 
      96             : #endif // _UNOTOOLS_INTLWRAPPER_HXX
      97             : 
      98             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10