diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/svtools/ctrlbox.hxx | 80 | ||||
-rw-r--r-- | include/svtools/svtools.hrc | 2 | ||||
-rw-r--r-- | include/svx/dlgctrl.hxx | 69 |
3 files changed, 69 insertions, 82 deletions
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index c1ad071123eb..28d1a3497888 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -42,17 +42,6 @@ typedef ::std::vector< FontMetric > ImplFontList; /************************************************************************* -Description -============ - -class ColorListBox - -Description - -Allows color selection - --------------------------------------------------------------------------- - class LineListBox Description @@ -141,75 +130,6 @@ FontList; FontNameBox; FontStyleBox; FontSizeMenu *************************************************************************/ -class SVT_DLLPUBLIC ColorListBox : public ListBox -{ - ImpColorList* pColorList; // separate liste, in case of user data are required from outside - Size aImageSize; - - using Window::ImplInit; - SVT_DLLPRIVATE void ImplInit(); - SVT_DLLPRIVATE void ImplDestroyColorEntries(); - -public: - ColorListBox( vcl::Window* pParent, - WinBits nWinStyle = WB_BORDER ); - virtual ~ColorListBox() override; - virtual void dispose() override; - - virtual void UserDraw( const UserDrawEvent& rUDEvt ) override; - - using ListBox::InsertEntry; - sal_Int32 InsertEntry( const OUString& rStr, - sal_Int32 nPos = LISTBOX_APPEND ); - sal_Int32 InsertEntry( const Color& rColor, const OUString& rStr, - sal_Int32 nPos = LISTBOX_APPEND ); - void InsertAutomaticEntryColor(const Color &rAutoColorValue); - bool IsAutomaticSelected() { return !GetSelectEntryPos(); } - using ListBox::RemoveEntry; - void RemoveEntry( sal_Int32 nPos ); - void Clear(); - void CopyEntries( const ColorListBox& rBox ); - - using ListBox::GetEntryPos; - sal_Int32 GetEntryPos( const Color& rColor ) const; - Color GetEntryColor( sal_Int32 nPos ) const; - - void SelectEntry( const OUString& rStr ) - { ListBox::SelectEntry( rStr ); } - void SelectEntry( const Color& rColor ); - Color GetSelectEntryColor() const; - using ListBox::IsEntrySelected; - - bool IsEntrySelected(const Color& rColor) const - { - sal_Int32 nPos = GetEntryPos( rColor ); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - return IsEntryPosSelected( nPos ); - else - return false; - } - -private: - ColorListBox( const ColorListBox& ) = delete; - ColorListBox& operator =( const ColorListBox& ) = delete; -}; - -inline void ColorListBox::SelectEntry( const Color& rColor ) -{ - sal_Int32 nPos = GetEntryPos( rColor ); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - ListBox::SelectEntryPos( nPos ); -} - -inline Color ColorListBox::GetSelectEntryColor() const -{ - sal_Int32 nPos = GetSelectEntryPos(); - Color aColor; - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - aColor = GetEntryColor( nPos ); - return aColor; -} - /** Class computing border widths shared between Line style listbox and the SvxBorderLine implementation. diff --git a/include/svtools/svtools.hrc b/include/svtools/svtools.hrc index 92cc8092ab7d..c149f8643c31 100644 --- a/include/svtools/svtools.hrc +++ b/include/svtools/svtools.hrc @@ -26,8 +26,6 @@ // various unsorted stuff -#define STR_SVT_AUTOMATIC_COLOR (RID_SVTOOLS_START+16) - #define STR_SVT_FILEVIEW_COLUMN_TITLE (RID_SVTOOLS_START + 20) #define STR_SVT_FILEVIEW_COLUMN_SIZE (RID_SVTOOLS_START + 21) #define STR_SVT_FILEVIEW_COLUMN_DATE (RID_SVTOOLS_START + 22) diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index 5a2c217862bd..64ec881c8112 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -207,6 +207,75 @@ public: /************************************************************************/ +class SAL_WARN_UNUSED SVX_DLLPUBLIC ColorListBox : public ListBox +{ + ImpColorList* pColorList; // separate liste, in case of user data are required from outside + Size aImageSize; + + using Window::ImplInit; + SVT_DLLPRIVATE void ImplInit(); + SVT_DLLPRIVATE void ImplDestroyColorEntries(); + +public: + ColorListBox( vcl::Window* pParent, + WinBits nWinStyle = WB_BORDER ); + virtual ~ColorListBox() override; + virtual void dispose() override; + + virtual void UserDraw( const UserDrawEvent& rUDEvt ) override; + + using ListBox::InsertEntry; + sal_Int32 InsertEntry( const OUString& rStr, + sal_Int32 nPos = LISTBOX_APPEND ); + sal_Int32 InsertEntry( const Color& rColor, const OUString& rStr, + sal_Int32 nPos = LISTBOX_APPEND ); + bool IsAutomaticSelected() { return !GetSelectEntryPos(); } + using ListBox::RemoveEntry; + void RemoveEntry( sal_Int32 nPos ); + void Clear(); + void CopyEntries( const ColorListBox& rBox ); + + using ListBox::GetEntryPos; + sal_Int32 GetEntryPos( const Color& rColor ) const; + Color GetEntryColor( sal_Int32 nPos ) const; + + void SelectEntry( const OUString& rStr ) + { ListBox::SelectEntry( rStr ); } + void SelectEntry( const Color& rColor ); + Color GetSelectEntryColor() const; + using ListBox::IsEntrySelected; + + bool IsEntrySelected(const Color& rColor) const + { + sal_Int32 nPos = GetEntryPos( rColor ); + if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + return IsEntryPosSelected( nPos ); + else + return false; + } + +private: + ColorListBox( const ColorListBox& ) = delete; + ColorListBox& operator =( const ColorListBox& ) = delete; +}; + +inline void ColorListBox::SelectEntry( const Color& rColor ) +{ + sal_Int32 nPos = GetEntryPos( rColor ); + if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + ListBox::SelectEntryPos( nPos ); +} + +inline Color ColorListBox::GetSelectEntryColor() const +{ + sal_Int32 nPos = GetSelectEntryPos(); + Color aColor; + if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + aColor = GetEntryColor( nPos ); + return aColor; +} + + class SAL_WARN_UNUSED SVX_DLLPUBLIC ColorLB : public ColorListBox { |