summaryrefslogtreecommitdiff
path: root/svx/source/tbxctrls
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-06-19 15:02:49 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-09-03 18:25:52 +0200
commit79daf40ec696e0855d4a2894f048e44188cfbbb6 (patch)
tree96cb3ec48472c06961c1f4392ea6e1b560980555 /svx/source/tbxctrls
parentb094921089beeecb2333075e174c8b1fa6d1b812 (diff)
weld SvxAreaTabPage
which itself has 5 sub tab pages Change-Id: If71e91248b5771af4845ad6dba997ac4c7841b5d Reviewed-on: https://gerrit.libreoffice.org/56112 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/tbxctrls')
-rw-r--r--svx/source/tbxctrls/SvxPresetListBox.cxx78
1 files changed, 78 insertions, 0 deletions
diff --git a/svx/source/tbxctrls/SvxPresetListBox.cxx b/svx/source/tbxctrls/SvxPresetListBox.cxx
index fd320d81009c..d6ee0510a15a 100644
--- a/svx/source/tbxctrls/SvxPresetListBox.cxx
+++ b/svx/source/tbxctrls/SvxPresetListBox.cxx
@@ -130,4 +130,82 @@ IMPL_LINK(SvxPresetListBox, OnMenuItemSelected, Menu*, pMenu, bool)
return false;
}
+PresetListBox::PresetListBox(std::unique_ptr<weld::ScrolledWindow> pWindow)
+ : SvtValueSet(std::move(pWindow))
+ , nColCount(3)
+ , aIconSize(60, 64)
+{
+ SetEdgeBlending(true);
+ SetExtraSpacing(4);
+}
+
+void PresetListBox::Resize()
+{
+ DrawLayout();
+ WinBits aWinBits(GetStyle());
+ aWinBits |= WB_VSCROLL;
+ SetStyle(aWinBits);
+ SvtValueSet::Resize();
+}
+
+bool PresetListBox::ContextMenu(const Point& rPos)
+{
+ const sal_uInt16 nIndex = GetSelectedItemId();
+ if(nIndex > 0)
+ {
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDrawingArea(), "svx/ui/presetmenu.ui"));
+ std::unique_ptr<weld::Menu> xMenu(xBuilder->weld_menu("menu"));
+ OnMenuItemSelected(xMenu->popup_at_rect(GetDrawingArea(), tools::Rectangle(rPos, Size(1,1))));
+ return true;
+ }
+ return false;
+}
+
+void PresetListBox::DrawLayout()
+{
+ SetColCount(getColumnCount());
+ SetLineCount(5);
+}
+
+template< typename ListType, typename EntryType >
+void PresetListBox::FillPresetListBoxImpl(ListType & pList, sal_uInt32 nStartIndex)
+{
+ const Size aSize( GetIconSize() );
+ BitmapEx aBitmap;
+ for(long nIndex = 0; nIndex < pList.Count(); nIndex++, nStartIndex++)
+ {
+ aBitmap = pList.GetBitmapForPreview(nIndex, aSize);
+ EntryType* pItem = static_cast<EntryType*>( pList.Get(nIndex) );
+ InsertItem(nStartIndex, Image(aBitmap), pItem->GetName());
+ }
+}
+
+void PresetListBox::FillPresetListBox(XGradientList& pList, sal_uInt32 nStartIndex)
+{
+ FillPresetListBoxImpl< XGradientList, XGradientEntry>( pList, nStartIndex );
+}
+
+void PresetListBox::FillPresetListBox(XHatchList& pList, sal_uInt32 nStartIndex)
+{
+ FillPresetListBoxImpl< XHatchList, XHatchEntry>( pList, nStartIndex );
+}
+
+void PresetListBox::FillPresetListBox(XBitmapList& pList, sal_uInt32 nStartIndex)
+{
+ FillPresetListBoxImpl< XBitmapList, XBitmapEntry >( pList, nStartIndex );
+}
+
+void PresetListBox::FillPresetListBox(XPatternList& pList, sal_uInt32 nStartIndex)
+{
+ FillPresetListBoxImpl< XPatternList, XBitmapEntry >( pList, nStartIndex );
+}
+
+void PresetListBox::OnMenuItemSelected(const OString& rIdent)
+{
+ if (rIdent == "rename")
+ maRenameHdl.Call(this);
+ else if (rIdent == "delete")
+ maDeleteHdl.Call(this);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */