LCOV - code coverage report
Current view: top level - include/svx - langbox.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 3 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 5 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             : #ifndef INCLUDED_SVX_LANGBOX_HXX
      20             : #define INCLUDED_SVX_LANGBOX_HXX
      21             : 
      22             : #include <com/sun/star/uno/Sequence.hxx>
      23             : #include <svx/svxdllapi.h>
      24             : #include <vcl/image.hxx>
      25             : #include <vcl/lstbox.hxx>
      26             : #include <vcl/combobox.hxx>
      27             : #include <o3tl/typed_flags_set.hxx>
      28             : 
      29             : 
      30             : enum class SvxLanguageListFlags
      31             : {
      32             :     EMPTY             = 0x0000,
      33             :     ALL               = 0x0001,
      34             :     WESTERN           = 0x0002,
      35             :     CTL               = 0x0004,
      36             :     CJK               = 0x0008,
      37             :     FBD_CHARS         = 0x0010,
      38             :     SPELL_AVAIL       = 0x0020,
      39             :     HYPH_AVAIL        = 0x0040,
      40             :     THES_AVAIL        = 0x0080,
      41             :     ONLY_KNOWN        = 0x0100,  // list only locales provided by I18N
      42             :     SPELL_USED        = 0x0200,
      43             :     HYPH_USED         = 0x0400,
      44             :     THES_USED         = 0x0800,
      45             :     ALSO_PRIMARY_ONLY = 0x1000,  // Do not exclude primary-only
      46             :                                  // languages that do not form a
      47             :                                  // locale, such as Arabic as
      48             :                                  // opposed to Arabic-Egypt.
      49             : };
      50             : namespace o3tl
      51             : {
      52             :     template<> struct typed_flags<SvxLanguageListFlags> : is_typed_flags<SvxLanguageListFlags, 0x1fff> {};
      53             : }
      54             : 
      55             : // load language strings from resource
      56             : SVX_DLLPUBLIC OUString    GetDicInfoStr( const OUString& rName, const sal_uInt16 nLang, bool bNeg );
      57             : 
      58             : class SVX_DLLPUBLIC SvxLanguageBoxBase
      59             : {
      60             : private:
      61             :     SvxLanguageBoxBase(const SvxLanguageBoxBase&) SAL_DELETED_FUNCTION;
      62             :     SvxLanguageBoxBase& operator=(const SvxLanguageBoxBase&) SAL_DELETED_FUNCTION;
      63             : public:
      64             :     explicit SvxLanguageBoxBase( bool bCheck );
      65             :     virtual ~SvxLanguageBoxBase();
      66             : 
      67             :     void            SetLanguageList( SvxLanguageListFlags nLangList,
      68             :                             bool bHasLangNone, bool bLangNoneIsLangAll = false,
      69             :                             bool bCheckSpellAvail = false );
      70             : 
      71             :     sal_Int32       InsertLanguage( const LanguageType eLangType, sal_Int32  nPos = LISTBOX_APPEND );
      72             :     sal_Int32       InsertDefaultLanguage( sal_Int16 nType, sal_Int32  nPos = LISTBOX_APPEND );
      73             :     sal_Int32       InsertSystemLanguage( sal_Int32  nPos = LISTBOX_APPEND );
      74             :     sal_Int32       InsertLanguage( const LanguageType eLangType,
      75             :                                     bool bCheckEntry, sal_Int32  nPos = LISTBOX_APPEND );
      76             :     void            RemoveLanguage( const LanguageType eLangType );
      77             :     void            SelectLanguage( const LanguageType eLangType, bool bSelect = true );
      78             :     LanguageType    GetSelectLanguage() const;
      79             :     bool            IsLanguageSelected( const LanguageType eLangType ) const;
      80             : 
      81             :     void                SetNoSelectionLBB();
      82             :     void                HideLBB();
      83             :     void                DisableLBB();
      84             :     void                SaveValueLBB();
      85             :     sal_Int32           GetSelectEntryPosLBB( sal_Int32 nSelIndex = 0 ) const;
      86             :     void*               GetEntryDataLBB( sal_Int32  nPos ) const;
      87             :     sal_Int32           GetSavedValueLBB() const;
      88             : 
      89             : protected:
      90             :     Image                   m_aNotCheckedImage;
      91             :     Image                   m_aCheckedImage;
      92             :     OUString                m_aAllString;
      93             :     com::sun::star::uno::Sequence< sal_Int16 >  *m_pSpellUsedLang;
      94             :     SvxLanguageListFlags    m_nLangList;
      95             :     bool                    m_bHasLangNone;
      96             :     bool                    m_bLangNoneIsLangAll;
      97             :     bool                    m_bWithCheckmark;
      98             : 
      99             :     SVX_DLLPRIVATE void                 ImplLanguageBoxBaseInit();
     100             :     SVX_DLLPRIVATE sal_Int32            ImplInsertLanguage(LanguageType, sal_Int32 nPos, sal_Int16 nType);
     101             :     SVX_DLLPRIVATE sal_Int32            ImplTypeToPos( LanguageType eType ) const;
     102             : 
     103             :     SVX_DLLPRIVATE virtual sal_Int32    ImplInsertImgEntry( const OUString& rEntry, sal_Int32  nPos, bool bChecked ) = 0;
     104             :     SVX_DLLPRIVATE virtual void         ImplRemoveEntryAt( sal_Int32 nPos ) = 0;
     105             : 
     106             :     SVX_DLLPRIVATE virtual void         ImplClear() = 0;
     107             :     SVX_DLLPRIVATE virtual sal_Int32    ImplInsertEntry( const OUString& rEntry, sal_Int32 nPos ) = 0;
     108             :     SVX_DLLPRIVATE virtual void         ImplSetEntryData( sal_Int32 nPos, void* pData ) = 0;
     109             :     SVX_DLLPRIVATE virtual sal_Int32    ImplGetSelectEntryPos( sal_Int32 nSelIndex = 0 ) const = 0;
     110             :     SVX_DLLPRIVATE virtual void*        ImplGetEntryData( sal_Int32 nPos ) const = 0;
     111             :     SVX_DLLPRIVATE virtual void         ImplSelectEntryPos( sal_Int32 nPos, bool bSelect ) = 0;
     112             :     SVX_DLLPRIVATE virtual bool         ImplIsEntryPosSelected( sal_Int32 nPos ) const = 0;
     113             :     SVX_DLLPRIVATE virtual sal_Int32    ImplGetEntryPos( const void* pData ) const = 0;
     114             :     SVX_DLLPRIVATE virtual sal_Int32    ImplGetEntryCount() const = 0;
     115             :     SVX_DLLPRIVATE virtual void         ImplSetNoSelection() = 0;
     116             :     SVX_DLLPRIVATE virtual void         ImplHide() = 0;
     117             :     SVX_DLLPRIVATE virtual void         ImplDisable() = 0;
     118             :     SVX_DLLPRIVATE virtual void         ImplSaveValue() = 0;
     119             :     SVX_DLLPRIVATE virtual sal_Int32    ImplGetSavedValue() const = 0;
     120             : };
     121             : 
     122             : 
     123           0 : class SVX_DLLPUBLIC SvxLanguageBox : public ListBox, public SvxLanguageBoxBase
     124             : {
     125             : public:
     126             :     SvxLanguageBox( vcl::Window* pParent, WinBits nBits, bool bCheck = false );
     127             : 
     128             : private:
     129             :     SVX_DLLPRIVATE virtual sal_Int32    ImplInsertImgEntry( const OUString& rEntry, sal_Int32  nPos, bool bChecked ) SAL_OVERRIDE;
     130             :     SVX_DLLPRIVATE virtual void         ImplRemoveEntryAt( sal_Int32 nPos ) SAL_OVERRIDE;
     131             : 
     132             :     SVX_DLLPRIVATE virtual void         ImplClear() SAL_OVERRIDE;
     133             :     SVX_DLLPRIVATE virtual sal_Int32    ImplInsertEntry( const OUString& rEntry, sal_Int32 nPos ) SAL_OVERRIDE;
     134             :     SVX_DLLPRIVATE virtual void         ImplSetEntryData( sal_Int32 nPos, void* pData ) SAL_OVERRIDE;
     135             :     SVX_DLLPRIVATE virtual sal_Int32    ImplGetSelectEntryPos( sal_Int32 nSelIndex = 0 ) const SAL_OVERRIDE;
     136             :     SVX_DLLPRIVATE virtual void*        ImplGetEntryData( sal_Int32 nPos ) const SAL_OVERRIDE;
     137             :     SVX_DLLPRIVATE virtual void         ImplSelectEntryPos( sal_Int32 nPos, bool bSelect ) SAL_OVERRIDE;
     138             :     SVX_DLLPRIVATE virtual bool         ImplIsEntryPosSelected( sal_Int32 nPos ) const SAL_OVERRIDE;
     139             :     SVX_DLLPRIVATE virtual sal_Int32    ImplGetEntryPos( const void* pData ) const SAL_OVERRIDE;
     140             :     SVX_DLLPRIVATE virtual sal_Int32    ImplGetEntryCount() const SAL_OVERRIDE;
     141             :     SVX_DLLPRIVATE virtual void         ImplSetNoSelection() SAL_OVERRIDE;
     142             :     SVX_DLLPRIVATE virtual void         ImplHide() SAL_OVERRIDE;
     143             :     SVX_DLLPRIVATE virtual void         ImplDisable() SAL_OVERRIDE;
     144             :     SVX_DLLPRIVATE virtual void         ImplSaveValue() SAL_OVERRIDE;
     145             :     SVX_DLLPRIVATE virtual sal_Int32    ImplGetSavedValue() const SAL_OVERRIDE;
     146             : };
     147             : 
     148             : 
     149           0 : class SVX_DLLPUBLIC SvxLanguageComboBox : public ComboBox, public SvxLanguageBoxBase
     150             : {
     151             : public:
     152             :     SvxLanguageComboBox( vcl::Window* pParent, WinBits nBits, bool bCheck = false );
     153             : 
     154             :     enum EditedAndValid
     155             :     {
     156             :         EDITED_NO,
     157             :         EDITED_VALID,
     158             :         EDITED_INVALID
     159             :     };
     160             : 
     161           0 :     EditedAndValid      GetEditedAndValid() const { return meEditedAndValid;}
     162             :     sal_Int32           SaveEditedAsEntry();
     163             : 
     164             : 
     165             : private:
     166             :     sal_Int32       mnSavedValuePos;
     167             :     EditedAndValid  meEditedAndValid;
     168             : 
     169             :     SVX_DLLPRIVATE virtual sal_Int32    ImplInsertImgEntry( const OUString& rEntry, sal_Int32  nPos, bool bChecked ) SAL_OVERRIDE;
     170             :     SVX_DLLPRIVATE virtual void         ImplRemoveEntryAt( sal_Int32 nPos ) SAL_OVERRIDE;
     171             : 
     172             :     SVX_DLLPRIVATE virtual void         ImplClear() SAL_OVERRIDE;
     173             :     SVX_DLLPRIVATE virtual sal_Int32    ImplInsertEntry( const OUString& rEntry, sal_Int32 nPos ) SAL_OVERRIDE;
     174             :     SVX_DLLPRIVATE virtual void         ImplSetEntryData( sal_Int32 nPos, void* pData ) SAL_OVERRIDE;
     175             :     SVX_DLLPRIVATE virtual sal_Int32    ImplGetSelectEntryPos( sal_Int32 nSelIndex = 0 ) const SAL_OVERRIDE;
     176             :     SVX_DLLPRIVATE virtual void*        ImplGetEntryData( sal_Int32 nPos ) const SAL_OVERRIDE;
     177             :     SVX_DLLPRIVATE virtual void         ImplSelectEntryPos( sal_Int32 nPos, bool bSelect ) SAL_OVERRIDE;
     178             :     SVX_DLLPRIVATE virtual bool         ImplIsEntryPosSelected( sal_Int32 nPos ) const SAL_OVERRIDE;
     179             :     SVX_DLLPRIVATE virtual sal_Int32    ImplGetEntryPos( const void* pData ) const SAL_OVERRIDE;
     180             :     SVX_DLLPRIVATE virtual sal_Int32    ImplGetEntryCount() const SAL_OVERRIDE;
     181             :     SVX_DLLPRIVATE virtual void         ImplSetNoSelection() SAL_OVERRIDE;
     182             :     SVX_DLLPRIVATE virtual void         ImplHide() SAL_OVERRIDE;
     183             :     SVX_DLLPRIVATE virtual void         ImplDisable() SAL_OVERRIDE;
     184             :     SVX_DLLPRIVATE virtual void         ImplSaveValue() SAL_OVERRIDE;
     185             :     SVX_DLLPRIVATE virtual sal_Int32    ImplGetSavedValue() const SAL_OVERRIDE;
     186             : 
     187             :     DECL_LINK( EditModifyHdl, SvxLanguageComboBox* );
     188             : };
     189             : 
     190             : #endif
     191             : 
     192             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11