summaryrefslogtreecommitdiff
path: root/include/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-11-04 13:07:44 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-11-04 17:14:26 +0000
commit760a198e697f3070a5e0e029e4eff7be220eb9cd (patch)
treeeb25c9ff7f9066239b9e22912a0010d826637acf /include/svx
parent8bea644d6117a49405e6426dc97214220fc869d1 (diff)
move ColorListBox beside sole thing that uses it
Change-Id: Ia458ded8881c415badd5d75bddad0daca57a1a25
Diffstat (limited to 'include/svx')
-rw-r--r--include/svx/dlgctrl.hxx69
1 files changed, 69 insertions, 0 deletions
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
{