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

Generated by: LCOV version 1.10