summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-12-20 11:30:07 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-12-20 16:53:21 +0100
commit1af23f2679b34f0631cf77d457ed4da3836ab214 (patch)
treebec68a8620ce9b0feed73496adf46eb728bebbb9
parent8c0a015f7f4a007b1cb6ac293838d75741f8ae0a (diff)
weld DefaultShapesPanel
Change-Id: I7bdd1e15f525fad99394f4ca4360bf7e1339b33a Reviewed-on: https://gerrit.libreoffice.org/85594 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/svtools/valueset.hxx3
-rw-r--r--svtools/source/control/valueset.cxx8
-rw-r--r--svx/source/inc/DefaultShapesPanel.hxx41
-rw-r--r--svx/source/sidebar/shapes/DefaultShapesPanel.cxx88
-rw-r--r--svx/uiconfig/ui/defaultshapespanel.ui35
5 files changed, 110 insertions, 65 deletions
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
index eb3ad8d80cf8..cc56488e4c01 100644
--- a/include/svtools/valueset.hxx
+++ b/include/svtools/valueset.hxx
@@ -429,7 +429,7 @@ private:
sal_uInt16 mnFirstLine;
sal_uInt16 mnSpacing;
DrawFrameStyle mnFrameStyle;
- Color const maColor;
+ Color maColor;
OUString maText;
WinBits mnStyle;
Link<SvtValueSet*,void> maDoubleClickHdl;
@@ -553,6 +553,7 @@ public:
void* GetItemData( sal_uInt16 nItemId ) const;
void SetItemText( sal_uInt16 nItemId, const OUString& rStr );
OUString GetItemText( sal_uInt16 nItemId ) const;
+ void SetColor( const Color& rColor );
bool IsColor() const
{
return maColor.GetTransparency() == 0;
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 6b8802ac159a..946c27a6d957 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -3981,4 +3981,12 @@ Image SvtValueSet::GetItemImage(sal_uInt16 nItemId) const
return Image();
}
+void SvtValueSet::SetColor(const Color& rColor)
+{
+ maColor = rColor;
+ mbFormat = true;
+ if (IsReallyVisible() && IsUpdateMode())
+ Invalidate();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/inc/DefaultShapesPanel.hxx b/svx/source/inc/DefaultShapesPanel.hxx
index 6c7f7c99735e..1b3f036dabcb 100644
--- a/svx/source/inc/DefaultShapesPanel.hxx
+++ b/svx/source/inc/DefaultShapesPanel.hxx
@@ -19,13 +19,10 @@
#ifndef INCLUDED_SVX_SOURCE_INC_DEFAULTSHAPESPANEL_HXX
#define INCLUDED_SVX_SOURCE_INC_DEFAULTSHAPESPANEL_HXX
-#include <vcl/ctrl.hxx>
#include <com/sun/star/frame/XFrame.hpp>
-
-#include <map>
#include <svx/sidebar/PanelLayout.hxx>
-#include <vcl/layout.hxx>
#include <svtools/valueset.hxx>
+#include <map>
#include "ShapesUtil.hxx"
using namespace css;
@@ -50,25 +47,35 @@ public:
virtual void dispose() override;
private:
- VclPtr<ValueSet> mpLineArrowSet;
- VclPtr<ValueSet> mpCurveSet;
- VclPtr<ValueSet> mpConnectorSet;
- VclPtr<ValueSet> mpBasicShapeSet;
- VclPtr<ValueSet> mpSymbolShapeSet;
- VclPtr<ValueSet> mpBlockArrowSet;
- VclPtr<ValueSet> mpFlowchartSet;
- VclPtr<ValueSet> mpCalloutSet;
- VclPtr<ValueSet> mpStarSet;
- VclPtr<ValueSet> mp3DObjectSet;
+ std::unique_ptr<SvtValueSet> mxLineArrowSet;
+ std::unique_ptr<weld::CustomWeld> mxLineArrowSetWin;
+ std::unique_ptr<SvtValueSet> mxCurveSet;
+ std::unique_ptr<weld::CustomWeld> mxCurveSetWin;
+ std::unique_ptr<SvtValueSet> mxConnectorSet;
+ std::unique_ptr<weld::CustomWeld> mxConnectorSetWin;
+ std::unique_ptr<SvtValueSet> mxBasicShapeSet;
+ std::unique_ptr<weld::CustomWeld> mxBasicShapeSetWin;
+ std::unique_ptr<SvtValueSet> mxSymbolShapeSet;
+ std::unique_ptr<weld::CustomWeld> mxSymbolShapeSetWin;
+ std::unique_ptr<SvtValueSet> mxBlockArrowSet;
+ std::unique_ptr<weld::CustomWeld> mxBlockArrowSetWin;
+ std::unique_ptr<SvtValueSet> mxFlowchartSet;
+ std::unique_ptr<weld::CustomWeld> mxFlowchartSetWin;
+ std::unique_ptr<SvtValueSet> mxCalloutSet;
+ std::unique_ptr<weld::CustomWeld> mxCalloutSetWin;
+ std::unique_ptr<SvtValueSet> mxStarSet;
+ std::unique_ptr<weld::CustomWeld> mxStarSetWin;
+ std::unique_ptr<SvtValueSet> mx3DObjectSet;
+ std::unique_ptr<weld::CustomWeld> mx3DObjectSetWin;
+
Reference< XFrame > mxFrame;
- std::map<VclPtr<ValueSet>, std::map<sal_uInt16, OUString>> mpShapesSetMap;
+ std::map<SvtValueSet*, std::map<sal_uInt16, OUString>> mpShapesSetMap;
void populateShapes();
void Initialize();
- DECL_LINK( ShapeSelectHdl, ValueSet*, void );
+ DECL_LINK( ShapeSelectHdl, SvtValueSet*, void );
};
-
} } // end of namespace sd::sidebar
#endif
diff --git a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
index 09685b182251..04c855169296 100644
--- a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
+++ b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
@@ -28,20 +28,30 @@ namespace svx { namespace sidebar {
DefaultShapesPanel::DefaultShapesPanel (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame)
- : PanelLayout(pParent, "DefaultShapesPanel", "svx/ui/defaultshapespanel.ui", rxFrame),
- SvxShapeCommandsMap(),
- mxFrame(rxFrame)
+ : PanelLayout(pParent, "DefaultShapesPanel", "svx/ui/defaultshapespanel.ui", rxFrame, true)
+ , SvxShapeCommandsMap()
+ , mxLineArrowSet(new SvtValueSet(nullptr))
+ , mxLineArrowSetWin(new weld::CustomWeld(*m_xBuilder, "LinesArrows", *mxLineArrowSet))
+ , mxCurveSet(new SvtValueSet(nullptr))
+ , mxCurveSetWin(new weld::CustomWeld(*m_xBuilder, "Curves", *mxCurveSet))
+ , mxConnectorSet(new SvtValueSet(nullptr))
+ , mxConnectorSetWin(new weld::CustomWeld(*m_xBuilder, "Connectors", *mxConnectorSet))
+ , mxBasicShapeSet(new SvtValueSet(nullptr))
+ , mxBasicShapeSetWin(new weld::CustomWeld(*m_xBuilder, "BasicShapes", *mxBasicShapeSet))
+ , mxSymbolShapeSet(new SvtValueSet(nullptr))
+ , mxSymbolShapeSetWin(new weld::CustomWeld(*m_xBuilder, "SymbolShapes", *mxSymbolShapeSet))
+ , mxBlockArrowSet(new SvtValueSet(nullptr))
+ , mxBlockArrowSetWin(new weld::CustomWeld(*m_xBuilder, "BlockArrows", *mxBlockArrowSet))
+ , mxFlowchartSet(new SvtValueSet(nullptr))
+ , mxFlowchartSetWin(new weld::CustomWeld(*m_xBuilder, "Flowcharts", *mxFlowchartSet))
+ , mxCalloutSet(new SvtValueSet(nullptr))
+ , mxCalloutSetWin(new weld::CustomWeld(*m_xBuilder, "Callouts", *mxCalloutSet))
+ , mxStarSet(new SvtValueSet(nullptr))
+ , mxStarSetWin(new weld::CustomWeld(*m_xBuilder, "Stars", *mxStarSet))
+ , mx3DObjectSet(new SvtValueSet(nullptr))
+ , mx3DObjectSetWin(new weld::CustomWeld(*m_xBuilder, "3DObjects", *mx3DObjectSet))
+ , mxFrame(rxFrame)
{
- get(mpLineArrowSet, "LinesArrows");
- get(mpCurveSet, "Curves");
- get(mpConnectorSet, "Connectors");
- get(mpBasicShapeSet, "BasicShapes");
- get(mpSymbolShapeSet, "SymbolShapes");
- get(mpBlockArrowSet, "BlockArrows");
- get(mpFlowchartSet, "Flowcharts");
- get(mpCalloutSet, "Callouts");
- get(mpStarSet, "Stars");
- get(mp3DObjectSet, "3DObjects");
Initialize();
}
@@ -67,16 +77,16 @@ DefaultShapesPanel::~DefaultShapesPanel()
void DefaultShapesPanel::Initialize()
{
mpShapesSetMap = decltype(mpShapesSetMap){
- { mpLineArrowSet, mpLineShapes },
- { mpCurveSet, mpCurveShapes },
- { mpConnectorSet, mpConnectorShapes },
- { mpBasicShapeSet, mpBasicShapes },
- { mpSymbolShapeSet, mpSymbolShapes },
- { mpBlockArrowSet, mpBlockArrowShapes },
- { mpFlowchartSet, mpFlowchartShapes },
- { mpCalloutSet, mpCalloutShapes },
- { mpStarSet, mpStarShapes },
- { mp3DObjectSet, mp3DShapes }
+ { mxLineArrowSet.get(), mpLineShapes },
+ { mxCurveSet.get(), mpCurveShapes },
+ { mxConnectorSet.get(), mpConnectorShapes },
+ { mxBasicShapeSet.get(), mpBasicShapes },
+ { mxSymbolShapeSet.get(), mpSymbolShapes },
+ { mxBlockArrowSet.get(), mpBlockArrowShapes },
+ { mxFlowchartSet.get(), mpFlowchartShapes },
+ { mxCalloutSet.get(), mpCalloutShapes },
+ { mxStarSet.get(), mpStarShapes },
+ { mx3DObjectSet.get(), mp3DShapes }
};
populateShapes();
for(auto& aSetMap: mpShapesSetMap)
@@ -89,20 +99,30 @@ void DefaultShapesPanel::Initialize()
void DefaultShapesPanel::dispose()
{
mpShapesSetMap.clear();
- mpLineArrowSet.clear();
- mpCurveSet.clear();
- mpConnectorSet.clear();
- mpBasicShapeSet.clear();
- mpSymbolShapeSet.clear();
- mpBlockArrowSet.clear();
- mpFlowchartSet.clear();
- mpCalloutSet.clear();
- mpStarSet.clear();
- mp3DObjectSet.clear();
+ mxLineArrowSetWin.reset();
+ mxLineArrowSet.reset();
+ mxCurveSetWin.reset();
+ mxCurveSet.reset();
+ mxConnectorSetWin.reset();
+ mxConnectorSet.reset();
+ mxBasicShapeSetWin.reset();
+ mxBasicShapeSet.reset();
+ mxSymbolShapeSetWin.reset();
+ mxSymbolShapeSet.reset();
+ mxBlockArrowSetWin.reset();
+ mxBlockArrowSet.reset();
+ mxFlowchartSetWin.reset();
+ mxFlowchartSet.reset();
+ mxCalloutSetWin.reset();
+ mxCalloutSet.reset();
+ mxStarSetWin.reset();
+ mxStarSet.reset();
+ mx3DObjectSetWin.reset();
+ mx3DObjectSet.reset();
PanelLayout::dispose();
}
-IMPL_LINK(DefaultShapesPanel, ShapeSelectHdl, ValueSet*, rValueSet, void)
+IMPL_LINK(DefaultShapesPanel, ShapeSelectHdl, SvtValueSet*, rValueSet, void)
{
for(auto& aSetMap : mpShapesSetMap)
{
diff --git a/svx/uiconfig/ui/defaultshapespanel.ui b/svx/uiconfig/ui/defaultshapespanel.ui
index ba8c7250aa7d..4abb6e0391f5 100644
--- a/svx/uiconfig/ui/defaultshapespanel.ui
+++ b/svx/uiconfig/ui/defaultshapespanel.ui
@@ -2,16 +2,15 @@
<!-- Generated with glade 3.22.1 -->
<interface domain="svx">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
<object class="GtkGrid" id="DefaultShapesPanel">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="row_homogeneous">True</property>
- <property name="column_homogeneous">True</property>
+ <property name="hexpand">True</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="hexpand">True</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
@@ -33,10 +32,11 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
- <object class="svtlo-ValueSet" id="LinesArrows">
+ <object class="GtkDrawingArea" id="LinesArrows">
<property name="height_request">50</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
</child>
</object>
@@ -70,10 +70,11 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
- <object class="svtlo-ValueSet" id="Curves">
+ <object class="GtkDrawingArea" id="Curves">
<property name="height_request">50</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
</child>
</object>
@@ -107,10 +108,11 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
- <object class="svtlo-ValueSet" id="Connectors">
+ <object class="GtkDrawingArea" id="Connectors">
<property name="height_request">50</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
</child>
</object>
@@ -144,10 +146,11 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
- <object class="svtlo-ValueSet" id="BasicShapes">
+ <object class="GtkDrawingArea" id="BasicShapes">
<property name="height_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
</child>
</object>
@@ -181,10 +184,11 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
- <object class="svtlo-ValueSet" id="SymbolShapes">
+ <object class="GtkDrawingArea" id="SymbolShapes">
<property name="height_request">75</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
</child>
</object>
@@ -218,10 +222,11 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
- <object class="svtlo-ValueSet" id="BlockArrows">
+ <object class="GtkDrawingArea" id="BlockArrows">
<property name="height_request">125</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
</child>
</object>
@@ -255,10 +260,11 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
- <object class="svtlo-ValueSet" id="Flowcharts">
+ <object class="GtkDrawingArea" id="Flowcharts">
<property name="height_request">125</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
</child>
</object>
@@ -292,10 +298,11 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
- <object class="svtlo-ValueSet" id="Callouts">
+ <object class="GtkDrawingArea" id="Callouts">
<property name="height_request">50</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
</child>
</object>
@@ -329,10 +336,11 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
- <object class="svtlo-ValueSet" id="Stars">
+ <object class="GtkDrawingArea" id="Stars">
<property name="height_request">50</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
</child>
</object>
@@ -366,10 +374,11 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
- <object class="svtlo-ValueSet" id="3DObjects">
+ <object class="GtkDrawingArea" id="3DObjects">
<property name="height_request">50</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
</object>
</child>
</object>