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

Generated by: LCOV version 1.10