diff options
author | Eike Rathke <erack@redhat.com> | 2014-05-16 12:50:36 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-05-16 12:54:54 +0200 |
commit | 5ad020235a8d4dd60752e781622c22f0187b4e45 (patch) | |
tree | c05e357825b3d1390cd823bc5f4f7654e683fc15 /include/svx/langbox.hxx | |
parent | 5350520ec8da250f57dde664e95229c0e4d5a2ab (diff) |
introduce SvxLanguageBoxBase, SvxLanguageBox, SvxLanguageComboBox
In preparation of having a language box available as ComboBox to be able
to add language tags.
Change-Id: I5af5ea5bb06e558db1fcf9c0668be274d5cec04e
Diffstat (limited to 'include/svx/langbox.hxx')
-rw-r--r-- | include/svx/langbox.hxx | 90 |
1 files changed, 72 insertions, 18 deletions
diff --git a/include/svx/langbox.hxx b/include/svx/langbox.hxx index d5ca097e6059..7bc28f7e2921 100644 --- a/include/svx/langbox.hxx +++ b/include/svx/langbox.hxx @@ -23,6 +23,8 @@ #include <svx/svxdllapi.h> #include <vcl/image.hxx> #include <vcl/lstbox.hxx> +#include <vcl/combobox.hxx> +#include <boost/noncopyable.hpp> #define LANG_LIST_EMPTY 0x0000 @@ -47,11 +49,27 @@ // load language strings from resource SVX_DLLPUBLIC OUString GetDicInfoStr( const OUString& rName, const sal_uInt16 nLang, bool bNeg ); -class SVX_DLLPUBLIC SvxLanguageBox : public ListBox +class SVX_DLLPUBLIC SvxLanguageBoxBase : boost::noncopyable { public: + explicit SvxLanguageBoxBase( bool bCheck ); + virtual ~SvxLanguageBoxBase(); -private: + void SetLanguageList( sal_Int16 nLangList, + bool bHasLangNone, bool bLangNoneIsLangAll = false, + bool bCheckSpellAvail = false ); + + sal_Int32 InsertLanguage( const LanguageType eLangType, sal_Int32 nPos = LISTBOX_APPEND ); + sal_Int32 InsertDefaultLanguage( sal_Int16 nType, sal_Int32 nPos = LISTBOX_APPEND ); + sal_Int32 InsertSystemLanguage( sal_Int32 nPos = LISTBOX_APPEND ); + sal_Int32 InsertLanguage( const LanguageType eLangType, + bool bCheckEntry, sal_Int32 nPos = LISTBOX_APPEND ); + void RemoveLanguage( const LanguageType eLangType ); + void SelectLanguage( const LanguageType eLangType, bool bSelect = true ); + LanguageType GetSelectLanguage() const; + bool IsLanguageSelected( const LanguageType eLangType ) const; + +protected: Image m_aNotCheckedImage; Image m_aCheckedImage; OUString m_aAllString; @@ -61,27 +79,63 @@ private: bool m_bLangNoneIsLangAll; bool m_bWithCheckmark; - SVX_DLLPRIVATE void Init(); - SVX_DLLPRIVATE sal_Int32 ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked ); - SVX_DLLPRIVATE sal_Int32 ImplInsertLanguage(LanguageType, sal_Int32 nPos, sal_Int16 nType); + SVX_DLLPRIVATE void ImplLanguageBoxBaseInit(); + SVX_DLLPRIVATE sal_Int32 ImplInsertLanguage(LanguageType, sal_Int32 nPos, sal_Int16 nType); + SVX_DLLPRIVATE sal_Int32 ImplTypeToPos( LanguageType eType ) const; + + SVX_DLLPRIVATE virtual sal_Int32 ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked ) = 0; + SVX_DLLPRIVATE virtual void ImplRemoveEntryAt( sal_Int32 nPos ) = 0; + + SVX_DLLPRIVATE virtual void ImplClear() = 0; + SVX_DLLPRIVATE virtual sal_Int32 ImplInsertEntry( const OUString& rEntry, sal_Int32 nPos ) = 0; + SVX_DLLPRIVATE virtual void ImplSetEntryData( sal_Int32 nPos, void* pData ) = 0; + SVX_DLLPRIVATE virtual sal_Int32 ImplGetSelectEntryPos() const = 0; + SVX_DLLPRIVATE virtual void* ImplGetEntryData( sal_Int32 nPos ) const = 0; + SVX_DLLPRIVATE virtual void ImplSelectEntryPos( sal_Int32 nPos, bool bSelect ) = 0; + SVX_DLLPRIVATE virtual bool ImplIsEntryPosSelected( sal_Int32 nPos ) const = 0; + SVX_DLLPRIVATE virtual sal_Int32 ImplGetEntryCount() const = 0; +}; + +class SVX_DLLPUBLIC SvxLanguageBox : public ListBox, public SvxLanguageBoxBase +{ public: - SvxLanguageBox(Window* pParent, WinBits nBits, bool bCheck = false); + SvxLanguageBox( Window* pParent, WinBits nBits, bool bCheck = false ); virtual ~SvxLanguageBox(); - void SetLanguageList( sal_Int16 nLangList, - bool bHasLangNone, bool bLangNoneIsLangAll = false, - bool bCheckSpellAvail = false ); +private: + SVX_DLLPRIVATE virtual sal_Int32 ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked ); + SVX_DLLPRIVATE virtual void ImplRemoveEntryAt( sal_Int32 nPos ); - sal_Int32 InsertLanguage( const LanguageType eLangType, sal_Int32 nPos = LISTBOX_APPEND ); - sal_Int32 InsertDefaultLanguage( sal_Int16 nType, sal_Int32 nPos = LISTBOX_APPEND ); - sal_Int32 InsertSystemLanguage( sal_Int32 nPos = LISTBOX_APPEND ); - sal_Int32 InsertLanguage( const LanguageType eLangType, - bool bCheckEntry, sal_Int32 nPos = LISTBOX_APPEND ); - void RemoveLanguage( const LanguageType eLangType ); - void SelectLanguage( const LanguageType eLangType, bool bSelect = true ); - LanguageType GetSelectLanguage() const; - bool IsLanguageSelected( const LanguageType eLangType ) const; + SVX_DLLPRIVATE virtual void ImplClear(); + SVX_DLLPRIVATE virtual sal_Int32 ImplInsertEntry( const OUString& rEntry, sal_Int32 nPos ); + SVX_DLLPRIVATE virtual void ImplSetEntryData( sal_Int32 nPos, void* pData ); + SVX_DLLPRIVATE virtual sal_Int32 ImplGetSelectEntryPos() const; + SVX_DLLPRIVATE virtual void* ImplGetEntryData( sal_Int32 nPos ) const; + SVX_DLLPRIVATE virtual void ImplSelectEntryPos( sal_Int32 nPos, bool bSelect ); + SVX_DLLPRIVATE virtual bool ImplIsEntryPosSelected( sal_Int32 nPos ) const; + SVX_DLLPRIVATE virtual sal_Int32 ImplGetEntryCount() const; +}; + + +class SVX_DLLPUBLIC SvxLanguageComboBox : public ComboBox, public SvxLanguageBoxBase +{ +public: + SvxLanguageComboBox( Window* pParent, WinBits nBits, bool bCheck = false ); + virtual ~SvxLanguageComboBox(); + +private: + SVX_DLLPRIVATE virtual sal_Int32 ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked ); + SVX_DLLPRIVATE virtual void ImplRemoveEntryAt( sal_Int32 nPos ); + + SVX_DLLPRIVATE virtual void ImplClear(); + SVX_DLLPRIVATE virtual sal_Int32 ImplInsertEntry( const OUString& rEntry, sal_Int32 nPos ); + SVX_DLLPRIVATE virtual void ImplSetEntryData( sal_Int32 nPos, void* pData ); + SVX_DLLPRIVATE virtual sal_Int32 ImplGetSelectEntryPos() const; + SVX_DLLPRIVATE virtual void* ImplGetEntryData( sal_Int32 nPos ) const; + SVX_DLLPRIVATE virtual void ImplSelectEntryPos( sal_Int32 nPos, bool bSelect ); + SVX_DLLPRIVATE virtual bool ImplIsEntryPosSelected( sal_Int32 nPos ) const; + SVX_DLLPRIVATE virtual sal_Int32 ImplGetEntryCount() const; }; #endif |