[Libreoffice-commits] core.git: Branch 'feature/chart-sidebar' - 4 commits - chart2/source svx/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Tue Jul 21 06:04:49 PDT 2015
chart2/source/controller/sidebar/ChartAreaPanel.cxx | 89 ++++++++++++++++----
chart2/source/controller/sidebar/ChartAreaPanel.hxx | 16 +++
chart2/source/tools/FillProperties.cxx | 24 +++++
svx/source/sidebar/area/AreaPropertyPanelBase.cxx | 6 -
4 files changed, 116 insertions(+), 19 deletions(-)
New commits:
commit 379d26cff4bb6e8519786506e812a417e9b627fc
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 21 15:03:48 2015 +0200
handle some of the property changes correctly in area panel
Change-Id: I107245f52504c6dc059554346e00402534cf6243
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index a4241c9..3319bf5 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -13,6 +13,32 @@
namespace chart { namespace sidebar {
+namespace {
+
+OUString getCID(css::uno::Reference<css::frame::XModel> xModel)
+{
+ css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
+ if (!xSelectionSupplier.is())
+ return OUString();
+
+ css::uno::Any aAny = xSelectionSupplier->getSelection();
+ assert(aAny.hasValue());
+ OUString aCID;
+ aAny >>= aCID;
+
+ return aCID;
+}
+
+css::uno::Reference<css::beans::XPropertySet> getPropSet(
+ css::uno::Reference<css::frame::XModel> xModel)
+{
+ OUString aCID = getCID(xModel);
+ return ObjectIdentifier::getObjectPropertySet(aCID, xModel);
+}
+
+}
+
VclPtr<vcl::Window> ChartAreaPanel::Create(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
@@ -29,8 +55,10 @@ VclPtr<vcl::Window> ChartAreaPanel::Create(
ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
- ChartController* /*pController*/):
- svx::sidebar::AreaPropertyPanelBase(pParent, rxFrame)
+ ChartController* pController):
+ svx::sidebar::AreaPropertyPanelBase(pParent, rxFrame),
+ mxModel(pController->getModel()),
+ mxListener(new ChartSidebarModifyListener(this))
{
}
@@ -39,43 +67,76 @@ ChartAreaPanel::~ChartAreaPanel()
disposeOnce();
}
-void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& /*rItem*/)
+void ChartAreaPanel::dispose()
{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
+}
+void ChartAreaPanel::Initialize()
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->addModifyListener(mxListener);
}
-void ChartAreaPanel::setFillFloatTransparence(const XFillFloatTransparenceItem& /*rItem*/)
+void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& /*rItem*/)
{
}
-void ChartAreaPanel::setFillStyle(const XFillStyleItem& /*rItem*/)
+void ChartAreaPanel::setFillFloatTransparence(const XFillFloatTransparenceItem& /*rItem*/)
{
}
-void ChartAreaPanel::setFillStyleAndColor(const XFillStyleItem* /*pStyleItem*/,
- const XFillColorItem& /*rColorItem*/)
+void ChartAreaPanel::setFillStyle(const XFillStyleItem& rItem)
{
-
+ css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(rItem.GetValue()));
}
-void ChartAreaPanel::setFillStyleAndGradient(const XFillStyleItem* /*pStyleItem*/,
- const XFillGradientItem& /*rGradientItem*/)
+void ChartAreaPanel::setFillStyleAndColor(const XFillStyleItem* pStyleItem,
+ const XFillColorItem& rColorItem)
{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ if (pStyleItem)
+ xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
+ xPropSet->setPropertyValue("Color", css::uno::makeAny(rColorItem.GetValue()));
+}
+void ChartAreaPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem,
+ const XFillGradientItem& rGradientItem)
+{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ if (pStyleItem)
+ xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
+ xPropSet->setPropertyValue("GradientName", css::uno::makeAny(rGradientItem.GetValue()));
}
-void ChartAreaPanel::setFillStyleAndHatch(const XFillStyleItem* /*pStyleItem*/,
- const XFillHatchItem& /*rHatchItem*/)
+void ChartAreaPanel::setFillStyleAndHatch(const XFillStyleItem* pStyleItem,
+ const XFillHatchItem& rHatchItem)
{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ if (pStyleItem)
+ xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
+ xPropSet->setPropertyValue("HatchName", css::uno::makeAny(rHatchItem.GetValue()));
+}
+void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem,
+ const XFillBitmapItem& rBitmapItem)
+{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ if (pStyleItem)
+ xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
+ xPropSet->setPropertyValue("FillBitmapName", css::uno::makeAny(rBitmapItem.GetValue()));
}
-void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* /*pStyleItem*/,
- const XFillBitmapItem& /*rBitmapItem*/)
+void ChartAreaPanel::updateData()
{
+}
+void ChartAreaPanel::modelInvalid()
+{
}
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
index 4f4ac8b..f5b45ae 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
@@ -27,6 +27,8 @@
#include <svx/sidebar/AreaPropertyPanelBase.hxx>
+#include "ChartSidebarModifyListener.hxx"
+
class XFillFloatTransparenceItem;
class XFillTransparenceItem;
class XFillStyleItem;
@@ -41,7 +43,8 @@ class ChartController;
namespace sidebar {
-class ChartAreaPanel : public svx::sidebar::AreaPropertyPanelBase
+class ChartAreaPanel : public svx::sidebar::AreaPropertyPanelBase,
+ public ChartSidebarModifyListenerParent
{
public:
static VclPtr<vcl::Window> Create(
@@ -65,8 +68,19 @@ public:
virtual void setFillStyleAndHatch(const XFillStyleItem* pStyleItem, const XFillHatchItem& rHatchItem);
virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const XFillBitmapItem& rBitmapItem);
+ virtual void updateData() SAL_OVERRIDE;
+
+ virtual void modelInvalid() SAL_OVERRIDE;
+
+ virtual void dispose() SAL_OVERRIDE;
+
private:
+ css::uno::Reference<css::frame::XModel> mxModel;
+ css::uno::Reference<css::util::XModifyListener> mxListener;
+
+ void Initialize();
+
};
} } // end of namespace svx::sidebar
commit c0474f56b8c292b877cbb3753d987b2fee54de9d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 21 15:01:57 2015 +0200
provide some common fill property name aliases
They are mapped to the same entry as the exisiting ones but make it much
easier to select the correct property name.
Change-Id: I6f334284825c809f50a35c4566889b01950734ce
diff --git a/chart2/source/tools/FillProperties.cxx b/chart2/source/tools/FillProperties.cxx
index 5316984..123275f 100644
--- a/chart2/source/tools/FillProperties.cxx
+++ b/chart2/source/tools/FillProperties.cxx
@@ -44,6 +44,14 @@ void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector< ::com::s
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
+ Property( "Color",
+ FillProperties::PROP_FILL_COLOR,
+ cppu::UnoType<sal_Int32>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID // "maybe auto"
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
Property( "FillColor",
FillProperties::PROP_FILL_COLOR,
cppu::UnoType<sal_Int32>::get(),
@@ -67,6 +75,14 @@ void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector< ::com::s
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
+ Property( "GradientName",
+ FillProperties::PROP_FILL_GRADIENT_NAME,
+ cppu::UnoType<OUString>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
Property( "FillGradientName",
FillProperties::PROP_FILL_GRADIENT_NAME,
cppu::UnoType<OUString>::get(),
@@ -82,6 +98,14 @@ void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector< ::com::s
| beans::PropertyAttribute::MAYBEVOID ));
rOutProperties.push_back(
+ Property( "HatchName",
+ FillProperties::PROP_FILL_HATCH_NAME,
+ cppu::UnoType<OUString>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
Property( "FillHatchName",
FillProperties::PROP_FILL_HATCH_NAME,
cppu::UnoType<OUString>::get(),
commit c728702af5398747a58360e76662f32ee7660e28
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 21 02:28:46 2015 +0200
these two are exclusive
Change-Id: I98cf55f9b39f79fb844c57eef137093eb79ca958
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index 033b9e3..890abe3 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -673,8 +673,7 @@ void AreaPropertyPanelBase::NotifyItemUpdate(
meLastXFS = static_cast<sal_uInt16>(-1);
mpStyleItem.reset();
}
-
- if(eState >= SfxItemState::DEFAULT)
+ else if(eState >= SfxItemState::DEFAULT)
{
const XFillStyleItem* pItem = dynamic_cast< const XFillStyleItem* >(pState);
commit a76cecc94ef5e25665dbbcbb5f920be03f802b1a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 21 00:51:02 2015 +0200
better way to handle unused argument
Change-Id: I32d0ac824aab9cfd2f7994aa81b63206dd6a5a9a
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index 7754371..033b9e3 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -596,9 +596,8 @@ void AreaPropertyPanelBase::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState,
- const bool bIsEnabled)
+ const bool /*bIsEnabled*/)
{
- (void)bIsEnabled;
const bool bDisabled(SfxItemState::DISABLED == eState);
switch(nSID)
More information about the Libreoffice-commits
mailing list