[Libreoffice-commits] core.git: Branch 'feature/chart-sidebar' - 259 commits - accessibility/inc accessibility/source animations/source avmedia/source basctl/Library_basctl.mk basctl/source basegfx/source basic/inc basic/qa basic/source bin/find-unused-defines.awk bin/gbuild-to-ide canvas/README canvas/source canvas/workben chart2/inc chart2/Library_chartcontroller.mk chart2/source chart2/uiconfig chart2/UIConfig_chart2.mk chart2/workbench comphelper/inc comphelper/qa comphelper/source compilerplugins/clang configure.ac connectivity/source connectivity/workben cppcanvas/source cpputools/source cui/source cui/uiconfig dbaccess/source desktop/inc desktop/source desktop/test desktop/win32 distro-configs/LibreOfficeLinux.conf distro-configs/LibreOfficeWin32.conf distro-configs/LibreOfficeWin64.conf editeng/source embeddedobj/test extensions/source external/bzip2 extras/source filter/qa filter/source forms/source formula/source fpicker/source fpicker/uiconfig framework/inc framework/source helpcontent 2 hwpfilter/source i18npool/inc include/animations include/avmedia include/basic include/comphelper include/connectivity include/dbaccess include/editeng include/filter include/formula include/LibreOfficeKit include/oox include/osl include/rtl include/salhelper include/sax include/sfx2 include/svl include/svtools include/svx include/unotools include/vbahelper include/vcl include/xmloff jurt/com libreofficekit/qa libreofficekit/source lingucomponent/source lotuswordpro/source odk/examples offapi/com offapi/UnoApi_offapi.mk officecfg/registry onlineupdate/Executable_mar.mk onlineupdate/Executable_updater.mk onlineupdate/source oox/inc oox/source pyuno/source qadevOOo/runner qadevOOo/tests readlicense_oo/docs readlicense_oo/license registry/source reportdesign/inc reportdesign/source RepositoryExternal.mk rsc/inc sal/inc sal/Library_sal.mk sal/osl sal/rtl sax/source scaddins/source sc/inc sc/qa scripting/source sc/sdi sc/source sc/uiconfig sdext/source sd/inc sd/Library_sd.mk sd/sdi sd /source sfx2/Library_sfx.mk sfx2/sdi sfx2/source shell/inc shell/source slideshow/source solenv/bin sot/qa sot/source starmath/inc starmath/source stoc/source svl/source svtools/source svx/Library_svx.mk svx/sdi svx/source svx/workben sw/inc sw/qa sw/source toolkit/source tools/source ucb/source udkapi/com unotools/source vbahelper/source vcl/inc vcl/osx vcl/source vcl/unx vcl/workben winaccessibility/source wizards/com writerfilter/inc writerfilter/source writerperfect/source xmloff/source xmlsecurity/inc xmlsecurity/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Thu Jul 23 16:47:27 PDT 2015
Rebased ref, commits from common ancestor:
commit 68c85852db3199968975edafc747317bc6a1c416
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Jul 24 00:52:42 2015 +0200
this nasty update cycle was causing many issues
Setting the property from the sidebar was causing the model to be
changed and therefore updating the sidebar again.
Change-Id: I9ca690ae05d4cb0f2ce16f905a29582cc9e86f64
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 72da2c9..6dcadd1 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -42,6 +42,24 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet(
return ObjectIdentifier::getObjectPropertySet(aCID, xModel);
}
+class PreventUpdate
+{
+public:
+ PreventUpdate(bool& bUpdate):
+ mbUpdate(bUpdate)
+ {
+ mbUpdate = false;
+ }
+
+ ~PreventUpdate()
+ {
+ mbUpdate = true;
+ }
+
+private:
+ bool& mbUpdate;
+};
+
}
VclPtr<vcl::Window> ChartAreaPanel::Create(
@@ -64,7 +82,8 @@ ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent,
svx::sidebar::AreaPropertyPanelBase(pParent, rxFrame),
mxModel(pController->getModel()),
mxListener(new ChartSidebarModifyListener(this)),
- mxSelectionListener(new ChartSidebarSelectionListener(this))
+ mxSelectionListener(new ChartSidebarSelectionListener(this)),
+ mbUpdate(true)
{
Initialize();
}
@@ -98,6 +117,7 @@ void ChartAreaPanel::Initialize()
void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& rItem)
{
+ PreventUpdate aProtector(mbUpdate);
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
if (!xPropSet.is())
return;
@@ -108,6 +128,7 @@ void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& rItem)
void ChartAreaPanel::setFillFloatTransparence(
const XFillFloatTransparenceItem& rItem)
{
+ PreventUpdate aProtector(mbUpdate);
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
if (!xPropSet.is())
return;
@@ -117,6 +138,7 @@ void ChartAreaPanel::setFillFloatTransparence(
void ChartAreaPanel::setFillStyle(const XFillStyleItem& rItem)
{
+ PreventUpdate aProtector(mbUpdate);
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
if (!xPropSet.is())
return;
@@ -139,6 +161,7 @@ void ChartAreaPanel::setFillStyleAndColor(const XFillStyleItem* pStyleItem,
void ChartAreaPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem,
const XFillGradientItem& rGradientItem)
{
+ PreventUpdate aProtector(mbUpdate);
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
if (!xPropSet.is())
return;
@@ -151,6 +174,7 @@ void ChartAreaPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem,
void ChartAreaPanel::setFillStyleAndHatch(const XFillStyleItem* pStyleItem,
const XFillHatchItem& rHatchItem)
{
+ PreventUpdate aProtector(mbUpdate);
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
if (!xPropSet.is())
return;
@@ -163,6 +187,7 @@ void ChartAreaPanel::setFillStyleAndHatch(const XFillStyleItem* pStyleItem,
void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem,
const XFillBitmapItem& rBitmapItem)
{
+ PreventUpdate aProtector(mbUpdate);
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
if (!xPropSet.is())
return;
@@ -174,6 +199,9 @@ void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem,
void ChartAreaPanel::updateData()
{
+ if (!mbUpdate)
+ return;
+
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
if (!xPropSet.is())
return;
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
index 6678fee..827f1c9 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
@@ -90,6 +90,7 @@ private:
void Initialize();
+ bool mbUpdate;
};
} } // end of namespace svx::sidebar
commit d30b33c857556ffc318e52b2b2940f82b9896ff8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jul 23 21:01:00 2015 +0200
temp
Change-Id: I73130922a773df353db509b0ea62d0013a1df292
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index 3b94efc..9db2ad5 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -473,7 +473,7 @@ void AreaPropertyPanelBase::DataChanged(
void AreaPropertyPanelBase::ImpUpdateTransparencies()
{
- if(mpTransparanceItem.get() && mpFloatTransparenceItem.get())
+ if(mpTransparanceItem.get() || mpFloatTransparenceItem.get())
{
bool bZeroValue(false);
@@ -601,7 +601,7 @@ void AreaPropertyPanelBase::updateFillTransparence(bool bDisabled, bool bDefault
}
else if(bDefault)
{
- if(pItem && (!mpTransparanceItem || *pItem != *mpTransparanceItem))
+ if(pItem)
{
mpTransparanceItem.reset(static_cast<SfxUInt16Item*>(pItem->Clone()));
}
@@ -629,7 +629,7 @@ void AreaPropertyPanelBase::updateFillFloatTransparence(bool bDisabled, bool bDe
if(bDefault)
{
- if(pItem && (!mpFloatTransparenceItem || *pItem != *mpFloatTransparenceItem))
+ if(pItem)
{
mpFloatTransparenceItem.reset(static_cast<XFillFloatTransparenceItem*>(pItem->Clone()));
}
commit f808eeb6b08ef4bb50d36c1359a1b7ce48e99da7
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jul 23 21:00:37 2015 +0200
update some area properties
Change-Id: Iab888226ef1b8f18a6cdfd0ddf58077405306510
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 5a3d4b6..72da2c9 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -66,6 +66,7 @@ ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent,
mxListener(new ChartSidebarModifyListener(this)),
mxSelectionListener(new ChartSidebarSelectionListener(this))
{
+ Initialize();
}
ChartAreaPanel::~ChartAreaPanel()
@@ -173,6 +174,19 @@ void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem,
void ChartAreaPanel::updateData()
{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ if (!xPropSet.is())
+ return;
+
+ css::drawing::FillStyle eFillStyle = css::drawing::FillStyle_SOLID;
+ xPropSet->getPropertyValue("FillStyle") >>= eFillStyle;
+ XFillStyleItem aFillStyleItem(eFillStyle);
+ updateFillStyle(false, true, &aFillStyleItem);
+
+ sal_uInt16 nFillTransparence = 0;
+ xPropSet->getPropertyValue("Transparency") >>= nFillTransparence;
+ SfxUInt16Item aTransparenceItem(0, nFillTransparence);
+ updateFillTransparence(false, true, &aTransparenceItem);
}
void ChartAreaPanel::modelInvalid()
commit 073b0d4596e9b2655a9cd082f9c021cc6c4ea34a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jul 23 16:47:49 2015 +0200
add selection change listener to area panel
Change-Id: I4e3f0c1c669ec1c584cc2d6932fd78e177effa89
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 897d8ad..5a3d4b6 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -63,7 +63,8 @@ ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent,
ChartController* pController):
svx::sidebar::AreaPropertyPanelBase(pParent, rxFrame),
mxModel(pController->getModel()),
- mxListener(new ChartSidebarModifyListener(this))
+ mxListener(new ChartSidebarModifyListener(this)),
+ mxSelectionListener(new ChartSidebarSelectionListener(this))
{
}
@@ -77,6 +78,10 @@ void ChartAreaPanel::dispose()
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+
AreaPropertyPanelBase::dispose();
}
@@ -84,6 +89,10 @@ void ChartAreaPanel::Initialize()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->addModifyListener(mxListener);
+
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
}
void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& rItem)
@@ -170,6 +179,16 @@ void ChartAreaPanel::modelInvalid()
{
}
+void ChartAreaPanel::selectionChanged(bool bCorrectType)
+{
+ if (bCorrectType)
+ updateData();
+}
+
+void ChartAreaPanel::SelectionInvalid()
+{
+}
+
void ChartAreaPanel::updateModel(
css::uno::Reference<css::frame::XModel> xModel)
{
@@ -180,6 +199,10 @@ void ChartAreaPanel::updateModel(
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener);
+
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
}
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
index 7a0875b..6678fee 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
@@ -29,6 +29,7 @@
#include <svx/sidebar/AreaPropertyPanelBase.hxx>
#include "ChartSidebarModifyListener.hxx"
+#include "ChartSidebarSelectionListener.hxx"
class XFillFloatTransparenceItem;
class XFillTransparenceItem;
@@ -47,7 +48,7 @@ namespace sidebar {
class ChartAreaPanel : public svx::sidebar::AreaPropertyPanelBase,
public sfx2::sidebar::SidebarModelUpdate,
public ChartSidebarModifyListenerParent,
- public sfx2::sidebar::SidebarModelUpdate
+ public ChartSidebarSelectionListenerParent
{
public:
static VclPtr<vcl::Window> Create(
@@ -72,9 +73,11 @@ public:
virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const XFillBitmapItem& rBitmapItem);
virtual void updateData() SAL_OVERRIDE;
-
virtual void modelInvalid() SAL_OVERRIDE;
+ virtual void selectionChanged(bool bCorrectType) SAL_OVERRIDE;
+ virtual void SelectionInvalid() SAL_OVERRIDE;
+
virtual void dispose() SAL_OVERRIDE;
virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
@@ -83,6 +86,7 @@ private:
css::uno::Reference<css::frame::XModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
+ css::uno::Reference<css::view::XSelectionChangeListener> mxSelectionListener;
void Initialize();
commit 04bff04ee3c79590e8f5a168d2dd6620a62426c2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jul 23 16:20:36 2015 +0200
add selection change listener
This finally allows us to handle the case where you switch between
objects of the same type.
Change-Id: Ic13e15e2a426d08995a577dfc1b7ee6f7da04f30
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index 198640e..2e03a7e 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -194,6 +194,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/sidebar/ChartErrorBarPanel \
chart2/source/controller/sidebar/ChartSeriesPanel \
chart2/source/controller/sidebar/ChartSidebarModifyListener \
+ chart2/source/controller/sidebar/ChartSidebarSelectionListener \
))
# Runtime dependency for unit-tests
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index ba1a5e7..a9dcae7 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -190,7 +190,8 @@ ChartAxisPanel::ChartAxisPanel(
: PanelLayout(pParent, "ChartAxisPanel", "modules/schart/ui/sidebaraxis.ui", rxFrame),
mxFrame(rxFrame),
mxModel(pController->getModel()),
- mxListener(new ChartSidebarModifyListener(this))
+ mxModifyListener(new ChartSidebarModifyListener(this)),
+ mxSelectionListener(new ChartSidebarSelectionListener(this, OBJECTTYPE_AXIS))
{
get(mpCBShowLabel, "checkbutton_show_label");
get(mpCBReverse, "checkbutton_reverse");
@@ -208,7 +209,11 @@ ChartAxisPanel::~ChartAxisPanel()
void ChartAxisPanel::dispose()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
+ xBroadcaster->removeModifyListener(mxModifyListener);
+
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
mpCBShowLabel.clear();
mpCBReverse.clear();
@@ -221,7 +226,11 @@ void ChartAxisPanel::dispose()
void ChartAxisPanel::Initialize()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->addModifyListener(mxListener);
+ xBroadcaster->addModifyListener(mxModifyListener);
+
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
updateData();
@@ -285,12 +294,26 @@ void ChartAxisPanel::updateModel(
css::uno::Reference<css::frame::XModel> xModel)
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
+ xBroadcaster->removeModifyListener(mxModifyListener);
mxModel = xModel;
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcasterNew->addModifyListener(mxListener);
+ xBroadcasterNew->addModifyListener(mxModifyListener);
+
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
+}
+
+void ChartAxisPanel::selectionChanged(bool bCorrectType)
+{
+ if (bCorrectType)
+ updateData();
+}
+
+void ChartAxisPanel::SelectionInvalid()
+{
}
IMPL_LINK(ChartAxisPanel, CheckBoxHdl, CheckBox*, pCheckbox)
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.hxx b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
index 5c1177f..c21fa33 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
@@ -17,8 +17,10 @@
#include <svx/sidebar/PanelLayout.hxx>
#include "ChartSidebarModifyListener.hxx"
+#include "ChartSidebarSelectionListener.hxx"
#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
class FixedText;
class ListBox;
@@ -34,7 +36,8 @@ class ChartAxisPanel : public PanelLayout,
public ::sfx2::sidebar::IContextChangeReceiver,
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface,
public sfx2::sidebar::SidebarModelUpdate,
- public ChartSidebarModifyListenerParent
+ public ChartSidebarModifyListenerParent,
+ public ChartSidebarSelectionListenerParent
{
public:
static VclPtr<vcl::Window> Create(
@@ -65,6 +68,9 @@ public:
virtual void updateData() SAL_OVERRIDE;
virtual void modelInvalid() SAL_OVERRIDE;
+ virtual void selectionChanged(bool bCorrectType) SAL_OVERRIDE;
+ virtual void SelectionInvalid() SAL_OVERRIDE;
+
virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
private:
@@ -77,7 +83,8 @@ private:
css::uno::Reference<css::frame::XFrame> mxFrame;
css::uno::Reference<css::frame::XModel> mxModel;
- css::uno::Reference<css::util::XModifyListener> mxListener;
+ css::uno::Reference<css::util::XModifyListener> mxModifyListener;
+ css::uno::Reference<css::view::XSelectionChangeListener> mxSelectionListener;
void Initialize();
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index 0cb9aee..644766d 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -291,7 +291,8 @@ ChartSeriesPanel::ChartSeriesPanel(
: PanelLayout(pParent, "ChartSeriesPanel", "modules/schart/ui/sidebarseries.ui", rxFrame),
mxFrame(rxFrame),
mxModel(pController->getModel()),
- mxListener(new ChartSidebarModifyListener(this))
+ mxListener(new ChartSidebarModifyListener(this)),
+ mxSelectionListener(new ChartSidebarSelectionListener(this, OBJECTTYPE_DATA_SERIES))
{
get(mpCBLabel, "checkbutton_label");
get(mpCBTrendline, "checkbutton_trendline");
@@ -317,6 +318,9 @@ void ChartSeriesPanel::dispose()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
mpCBLabel.clear();
mpCBTrendline.clear();
@@ -337,6 +341,9 @@ void ChartSeriesPanel::Initialize()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->addModifyListener(mxListener);
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
updateData();
@@ -422,6 +429,20 @@ void ChartSeriesPanel::updateModel(
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener);
+
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
+}
+
+void ChartSeriesPanel::selectionChanged(bool bCorrectType)
+{
+ if (bCorrectType)
+ updateData();
+}
+
+void ChartSeriesPanel::SelectionInvalid()
+{
}
IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, CheckBox*, pCheckBox)
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
index 10d73ee..156bbc7 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
@@ -25,8 +25,10 @@
#include <svx/sidebar/PanelLayout.hxx>
#include "ChartSidebarModifyListener.hxx"
+#include "ChartSidebarSelectionListener.hxx"
#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
class FixedText;
class ListBox;
@@ -42,7 +44,8 @@ class ChartSeriesPanel : public PanelLayout,
public ::sfx2::sidebar::IContextChangeReceiver,
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface,
public sfx2::sidebar::SidebarModelUpdate,
- public ChartSidebarModifyListenerParent
+ public ChartSidebarModifyListenerParent,
+ public ChartSidebarSelectionListenerParent
{
public:
static VclPtr<vcl::Window> Create(
@@ -73,6 +76,9 @@ public:
virtual void updateData() SAL_OVERRIDE;
virtual void modelInvalid() SAL_OVERRIDE;
+ virtual void selectionChanged(bool bCorrectType) SAL_OVERRIDE;
+ virtual void SelectionInvalid() SAL_OVERRIDE;
+
virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
private:
@@ -93,6 +99,7 @@ private:
css::uno::Reference<css::frame::XModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
+ css::uno::Reference<css::view::XSelectionChangeListener> mxSelectionListener;
void Initialize();
diff --git a/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx
new file mode 100644
index 0000000..1f435e1
--- /dev/null
+++ b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "ChartSidebarSelectionListener.hxx"
+
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/frame/XController.hpp>
+
+#include "ObjectIdentifier.hxx"
+
+namespace chart {
+namespace sidebar {
+
+ChartSidebarSelectionListenerParent::~ChartSidebarSelectionListenerParent()
+{
+}
+
+ChartSidebarSelectionListener::ChartSidebarSelectionListener(
+ ChartSidebarSelectionListenerParent* pParent):
+ mpParent(pParent),
+ mbAll(true),
+ meType()
+{
+}
+
+ChartSidebarSelectionListener::ChartSidebarSelectionListener(
+ ChartSidebarSelectionListenerParent* pParent,
+ ObjectType eType):
+ mpParent(pParent),
+ mbAll(false),
+ meType(eType)
+{
+}
+
+ChartSidebarSelectionListener::~ChartSidebarSelectionListener()
+{
+}
+
+void ChartSidebarSelectionListener::selectionChanged(const css::lang::EventObject& rEvent)
+ throw (::css::uno::RuntimeException, ::std::exception)
+{
+ (void)rEvent;
+ bool bCorrectObjectSelected = false;
+ if (mbAll)
+ bCorrectObjectSelected = true;
+
+ css::uno::Reference<css::frame::XController> xController(rEvent.Source, css::uno::UNO_QUERY);
+ if (!mbAll && xController.is())
+ {
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ {
+ css::uno::Any aAny = xSelectionSupplier->getSelection();
+ if (aAny.hasValue())
+ {
+ OUString aCID;
+ aAny >>= aCID;
+ ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+ bCorrectObjectSelected = eType == meType;
+ }
+ }
+ }
+
+ mpParent->selectionChanged(bCorrectObjectSelected);
+}
+
+void ChartSidebarSelectionListener::disposing(const css::lang::EventObject& /*rEvent*/)
+ throw (::css::uno::RuntimeException, ::std::exception)
+{
+ mpParent->SelectionInvalid();
+}
+
+} }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartSidebarSelectionListener.hxx b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.hxx
new file mode 100644
index 0000000..cfe90e7
--- /dev/null
+++ b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTSIDEBARSELECTIONLISTENER_HXX
+#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTSIDEBARSELECTIONLISTENER_HXX
+
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+#include "ObjectIdentifier.hxx"
+
+namespace chart {
+namespace sidebar {
+
+class ChartSidebarSelectionListenerParent
+{
+public:
+ virtual ~ChartSidebarSelectionListenerParent();
+
+ virtual void selectionChanged(bool bSelected) = 0;
+
+ virtual void SelectionInvalid() = 0;
+};
+
+class ChartSidebarSelectionListener : public cppu::WeakImplHelper1<css::view::XSelectionChangeListener>
+{
+public:
+
+ // listen to all chart selection changes
+ ChartSidebarSelectionListener(ChartSidebarSelectionListenerParent* pParent);
+ // only liste to the changes of eType
+ ChartSidebarSelectionListener(ChartSidebarSelectionListenerParent* pParent, ObjectType eType);
+ virtual ~ChartSidebarSelectionListener();
+
+ virtual void SAL_CALL selectionChanged(const css::lang::EventObject& rEvent)
+ throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE;
+
+ virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent)
+ throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE;
+
+private:
+ ChartSidebarSelectionListenerParent* mpParent;
+
+ bool mbAll;
+ ObjectType meType;
+};
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 22c0961f44960704e01720012e5e5a79a6100f10
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jul 23 01:20:45 2015 +0200
handle more than one chart with chart sidebar
Change-Id: I4998904a9273f2c67114a246d7f234843602573c
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 9c51cf5..138fc65 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -421,6 +421,7 @@ void SAL_CALL ChartController::attachFrame(
{
sfx2::sidebar::SidebarController* pSidebar = dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get());
sfx2::sidebar::SidebarController::registerSidebarForFrame(pSidebar, this);
+ pSidebar->updateModel(getModel());
}
if(m_xFrame.is()) //what happens, if we do have a Frame already??
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 945e505..897d8ad 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -170,6 +170,18 @@ void ChartAreaPanel::modelInvalid()
{
}
+void ChartAreaPanel::updateModel(
+ css::uno::Reference<css::frame::XModel> xModel)
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
+
+ mxModel = xModel;
+
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcasterNew->addModifyListener(mxListener);
+}
+
} }
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
index f5b45ae..7a0875b 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
@@ -12,6 +12,7 @@
#include <vcl/ctrl.hxx>
#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
#include <svx/xgrad.hxx>
#include <svx/itemwin.hxx>
#include <svx/xfillit0.hxx>
@@ -44,7 +45,9 @@ class ChartController;
namespace sidebar {
class ChartAreaPanel : public svx::sidebar::AreaPropertyPanelBase,
- public ChartSidebarModifyListenerParent
+ public sfx2::sidebar::SidebarModelUpdate,
+ public ChartSidebarModifyListenerParent,
+ public sfx2::sidebar::SidebarModelUpdate
{
public:
static VclPtr<vcl::Window> Create(
@@ -74,6 +77,8 @@ public:
virtual void dispose() SAL_OVERRIDE;
+ virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
+
private:
css::uno::Reference<css::frame::XModel> mxModel;
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index e6fa2e3..ba1a5e7 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -281,6 +281,18 @@ void ChartAxisPanel::modelInvalid()
{
}
+void ChartAxisPanel::updateModel(
+ css::uno::Reference<css::frame::XModel> xModel)
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
+
+ mxModel = xModel;
+
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcasterNew->addModifyListener(mxListener);
+}
+
IMPL_LINK(ChartAxisPanel, CheckBoxHdl, CheckBox*, pCheckbox)
{
OUString aCID = getCID(mxModel);
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.hxx b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
index 8737ab4..5c1177f 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
@@ -13,6 +13,7 @@
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
#include <svx/sidebar/PanelLayout.hxx>
#include "ChartSidebarModifyListener.hxx"
@@ -32,6 +33,7 @@ namespace sidebar {
class ChartAxisPanel : public PanelLayout,
public ::sfx2::sidebar::IContextChangeReceiver,
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface,
+ public sfx2::sidebar::SidebarModelUpdate,
public ChartSidebarModifyListenerParent
{
public:
@@ -63,6 +65,8 @@ public:
virtual void updateData() SAL_OVERRIDE;
virtual void modelInvalid() SAL_OVERRIDE;
+ virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
+
private:
//ui controls
VclPtr<CheckBox> mpCBShowLabel;
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 1cbec9e..fd498ff 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -451,6 +451,18 @@ void ChartElementsPanel::modelInvalid()
}
+void ChartElementsPanel::updateModel(
+ css::uno::Reference<css::frame::XModel> xModel)
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
+
+ mxModel = xModel;
+
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcasterNew->addModifyListener(mxListener);
+}
+
IMPL_LINK(ChartElementsPanel, CheckBoxHdl, CheckBox*, pCheckBox)
{
bool bChecked = pCheckBox->IsChecked();
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 32ffb7d..766915c 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -21,6 +21,7 @@
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
#include <svx/sidebar/PanelLayout.hxx>
#include "ChartSidebarModifyListener.hxx"
@@ -39,6 +40,7 @@ namespace sidebar {
class ChartElementsPanel : public PanelLayout,
public ::sfx2::sidebar::IContextChangeReceiver,
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface,
+ public sfx2::sidebar::SidebarModelUpdate,
public ChartSidebarModifyListenerParent
{
public:
@@ -70,6 +72,8 @@ public:
virtual void updateData() SAL_OVERRIDE;
virtual void modelInvalid() SAL_OVERRIDE;
+ virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
+
private:
//ui controls
VclPtr<CheckBox> mpCBTitle;
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index ccf7990..9a60f17 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -381,6 +381,18 @@ void ChartErrorBarPanel::modelInvalid()
{
}
+void ChartErrorBarPanel::updateModel(
+ css::uno::Reference<css::frame::XModel> xModel)
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
+
+ mxModel = xModel;
+
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcasterNew->addModifyListener(mxListener);
+}
+
IMPL_LINK_NOARG(ChartErrorBarPanel, RadioBtnHdl)
{
OUString aCID = getCID(mxModel);
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
index 84d4b9c..e9c102b 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
@@ -13,6 +13,7 @@
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
#include <svx/sidebar/PanelLayout.hxx>
#include "ChartSidebarModifyListener.hxx"
@@ -33,6 +34,7 @@ namespace sidebar {
class ChartErrorBarPanel : public PanelLayout,
public ::sfx2::sidebar::IContextChangeReceiver,
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface,
+ public sfx2::sidebar::SidebarModelUpdate,
public ChartSidebarModifyListenerParent
{
public:
@@ -64,6 +66,8 @@ public:
virtual void updateData() SAL_OVERRIDE;
virtual void modelInvalid() SAL_OVERRIDE;
+ virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
+
private:
//ui controls
VclPtr<RadioButton> mpRBPosAndNeg;
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index 483ae91..0cb9aee 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -269,7 +269,9 @@ OUString getCID(css::uno::Reference<css::frame::XModel> xModel)
return OUString();
uno::Any aAny = xSelectionSupplier->getSelection();
- assert(aAny.hasValue());
+ if (!aAny.hasValue())
+ return OUString();
+
OUString aCID;
aAny >>= aCID;
#ifdef DBG_UTIL
@@ -410,6 +412,18 @@ void ChartSeriesPanel::modelInvalid()
}
+void ChartSeriesPanel::updateModel(
+ css::uno::Reference<css::frame::XModel> xModel)
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
+
+ mxModel = xModel;
+
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcasterNew->addModifyListener(mxListener);
+}
+
IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, CheckBox*, pCheckBox)
{
bool bChecked = pCheckBox->IsChecked();
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
index 7c951f6..10d73ee 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
@@ -21,6 +21,7 @@
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
#include <svx/sidebar/PanelLayout.hxx>
#include "ChartSidebarModifyListener.hxx"
@@ -40,6 +41,7 @@ namespace sidebar {
class ChartSeriesPanel : public PanelLayout,
public ::sfx2::sidebar::IContextChangeReceiver,
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface,
+ public sfx2::sidebar::SidebarModelUpdate,
public ChartSidebarModifyListenerParent
{
public:
@@ -71,6 +73,8 @@ public:
virtual void updateData() SAL_OVERRIDE;
virtual void modelInvalid() SAL_OVERRIDE;
+ virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
+
private:
//ui controls
VclPtr<CheckBox> mpCBLabel;
diff --git a/include/sfx2/sidebar/ResourceManager.hxx b/include/sfx2/sidebar/ResourceManager.hxx
index 568b7f8..8708707 100644
--- a/include/sfx2/sidebar/ResourceManager.hxx
+++ b/include/sfx2/sidebar/ResourceManager.hxx
@@ -66,6 +66,8 @@ public:
void SetPanelOrderIndex(const OUString& rsPanelId, const sal_Int32 orderIndex);
+ void UpdateModel(css::uno::Reference<css::frame::XModel> xModel);
+
class DeckContextDescriptor
{
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index db0a9a1..00a53b3 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -156,6 +156,8 @@ public:
void notifyDeckTitle(const OUString& targetDeckId);
+ void updateModel(css::uno::Reference<css::frame::XModel> xModel);
+
private:
VclPtr<Deck> mpCurrentDeck;
diff --git a/include/sfx2/sidebar/SidebarModelUpdate.hxx b/include/sfx2/sidebar/SidebarModelUpdate.hxx
new file mode 100644
index 0000000..981f7fa
--- /dev/null
+++ b/include/sfx2/sidebar/SidebarModelUpdate.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_INCLUDE_SFX2_SIDEBAR_SIDEBARUPDATEMODEL_HXX
+#define INCLUDED_INCLUDE_SFX2_SIDEBAR_SIDEBARUPDATEMODEL_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+
+#include <sfx2/dllapi.h>
+
+namespace sfx2 { namespace sidebar {
+
+class SFX2_DLLPUBLIC SidebarModelUpdate
+{
+public:
+ virtual ~SidebarModelUpdate();
+ virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) = 0;
+};
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/SidebarPanelBase.hxx b/include/sfx2/sidebar/SidebarPanelBase.hxx
index e08f3c3..2001bd0 100644
--- a/include/sfx2/sidebar/SidebarPanelBase.hxx
+++ b/include/sfx2/sidebar/SidebarPanelBase.hxx
@@ -22,7 +22,7 @@
#include <sfx2/sidebar/EnumContext.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
-#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/compbase5.hxx>
#include <cppuhelper/basemutex.hxx>
#include <com/sun/star/frame/XController.hpp>
@@ -30,6 +30,7 @@
#include <com/sun/star/ui/XUIElement.hpp>
#include <com/sun/star/ui/XToolPanel.hpp>
#include <com/sun/star/ui/XSidebarPanel.hpp>
+#include <com/sun/star/ui/XUpdateModel.hpp>
#include <boost/noncopyable.hpp>
#include <boost/function.hpp>
@@ -43,10 +44,11 @@ namespace sfx2 { namespace sidebar {
namespace
{
-typedef cppu::WeakComponentImplHelper4<css::ui::XContextChangeEventListener,
+typedef cppu::WeakComponentImplHelper5<css::ui::XContextChangeEventListener,
css::ui::XUIElement,
css::ui::XToolPanel,
- css::ui::XSidebarPanel>
+ css::ui::XSidebarPanel,
+ css::ui::XUpdateModel>
SidebarPanelBaseInterfaceBase;
}
@@ -94,6 +96,10 @@ public:
virtual sal_Int32 SAL_CALL getMinimalWidth()
throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+ // XUpdateModel
+ virtual void updateModel(const css::uno::Reference<css::frame::XModel>& xModel)
+ throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
protected:
css::uno::Reference<css::frame::XFrame> mxFrame;
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index fd1b03a..0a915f4 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -4039,6 +4039,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/ui,\
XUIElementFactoryManager \
XUIElementFactoryRegistration \
XUIElementSettings \
+ XUpdateModel \
XUIFunctionListener \
))
$(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/ui/dialogs,\
diff --git a/offapi/com/sun/star/ui/XUpdateModel.idl b/offapi/com/sun/star/ui/XUpdateModel.idl
new file mode 100644
index 0000000..59b1f68
--- /dev/null
+++ b/offapi/com/sun/star/ui/XUpdateModel.idl
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __com_sun_star_ui_XUpdateModel_idl__
+#define __com_sun_star_ui_XUpdateModel_idl__
+
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/frame/XModel.idl>
+
+
+module com { module sun { module star { module ui {
+
+
+/** Internal interface to update the used css::frame::XModel
+ </p>
+*/
+
+interface XUpdateModel : com::sun::star::uno::XInterface
+{
+ void updateModel( [in] com::sun::star::frame::XModel xModel);
+};
+
+}; }; }; };
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index b56f7f5..faba426 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -251,6 +251,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/sidebar/SidebarChildWindow \
sfx2/source/sidebar/SidebarDockingWindow \
sfx2/source/sidebar/SidebarController \
+ sfx2/source/sidebar/SidebarModelUpdate \
sfx2/source/sidebar/SidebarPanelBase \
sfx2/source/sidebar/SidebarToolBox \
sfx2/source/sidebar/Accessible \
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index bce5bbc..28f9e68 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -29,6 +29,7 @@
#include <tools/diagnose_ex.h>
#include <com/sun/star/frame/ModuleManager.hpp>
+#include <com/sun/star/ui/XUpdateModel.hpp>
#include <map>
@@ -646,6 +647,24 @@ bool ResourceManager::IsDeckEnabled (
return false;
}
+void ResourceManager::UpdateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ for (DeckContainer::iterator itr = maDecks.begin(); itr != maDecks.end(); ++itr) {
+ if (!itr->mpDeck)
+ continue;
+
+ const SharedPanelContainer& rContainer = itr->mpDeck->GetPanels();
+
+ for (SharedPanelContainer::const_iterator it = rContainer.begin(); it != rContainer.end(); ++it) {
+ css::uno::Reference<css::ui::XUpdateModel> xPanel((*it)->GetPanelComponent(), css::uno::UNO_QUERY);
+ xPanel->updateModel(xModel);
+ }
+
+ }
+
+
+}
+
} } // end of namespace sfx2::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 2d86f65..8339127 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1252,6 +1252,11 @@ ResourceManager::PanelContextDescriptorContainer SidebarController::GetMatchingP
return aPanels;
}
+void SidebarController::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ mpResourceManager->UpdateModel(xModel);
+}
+
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/SidebarModelUpdate.cxx b/sfx2/source/sidebar/SidebarModelUpdate.cxx
new file mode 100644
index 0000000..91c423b
--- /dev/null
+++ b/sfx2/source/sidebar/SidebarModelUpdate.cxx
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
+
+namespace sfx2 { namespace sidebar {
+
+SidebarModelUpdate::~SidebarModelUpdate()
+{
+}
+
+} }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx
index a7ec830..c8d3992 100644
--- a/sfx2/source/sidebar/SidebarPanelBase.cxx
+++ b/sfx2/source/sidebar/SidebarPanelBase.cxx
@@ -20,6 +20,7 @@
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ILayoutableWindow.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
#include <sfx2/imagemgr.hxx>
#include <vcl/ctrl.hxx>
#include <vcl/layout.hxx>
@@ -203,6 +204,16 @@ sal_Int32 SAL_CALL SidebarPanelBase::getMinimalWidth () throw(css::uno::RuntimeE
return 0;
}
+void SAL_CALL SidebarPanelBase::updateModel(const css::uno::Reference<css::frame::XModel>& xModel)
+ throw(css::uno::RuntimeException, std::exception)
+{
+ SidebarModelUpdate* pModelUpdate = dynamic_cast<SidebarModelUpdate*>(mpControl.get());
+ if (!pModelUpdate)
+ return;
+
+ pModelUpdate->updateModel(xModel);
+}
+
} } // end of namespace sfx2::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 81017240ae85a7c8a59bbba56cc6a73eed9d0ad8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jul 23 00:44:48 2015 +0200
implement a few more methods
Change-Id: Ieab088f2ad48f313c913424c60a10b59de4e0bcb
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 13c4a7c..945e505 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -11,6 +11,9 @@
#include "ChartController.hxx"
+#include <svx/xfltrit.hxx>
+#include <svx/xflftrit.hxx>
+
namespace chart { namespace sidebar {
namespace {
@@ -83,14 +86,23 @@ void ChartAreaPanel::Initialize()
xBroadcaster->addModifyListener(mxListener);
}
-void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& /*rItem*/)
+void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& rItem)
{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ if (!xPropSet.is())
+ return;
+ xPropSet->setPropertyValue("Transparency", css::uno::makeAny(rItem.GetValue()));
}
-void ChartAreaPanel::setFillFloatTransparence(const XFillFloatTransparenceItem& /*rItem*/)
+void ChartAreaPanel::setFillFloatTransparence(
+ const XFillFloatTransparenceItem& rItem)
{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ if (!xPropSet.is())
+ return;
+ xPropSet->setPropertyValue("TransparencyGradientName", css::uno::makeAny(rItem.GetValue()));
}
void ChartAreaPanel::setFillStyle(const XFillStyleItem& rItem)
commit 2a92e50f9c06ba9e34ec728f778018c151ee29d3
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 21 19:01:26 2015 +0200
avoid crash with color listbox for now
Change-Id: I36ac6513546961ec8d8d1e9437a8ef88574acbf4
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index bf48573..3b94efc 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -207,7 +207,7 @@ IMPL_LINK(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox *, pToolBox)
mpLbFillAttr->Hide();
mpToolBoxColor->Show();
const OUString aTmpStr;
- const Color aColor = mpColorItem->GetColorValue();
+ const Color aColor = mpColorItem ? mpColorItem->GetColorValue() : COL_AUTO;
const XFillColorItem aXFillColorItem( aTmpStr, aColor );
// #i122676# change FillStyle and Color in one call
commit d8cfbff6a44d906de85505e66fb3d342c94ad8ea
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 21 19:01:06 2015 +0200
avoid a crash that occures sometimes
Change-Id: Iccbdfdb8a46b45b76756ff8080757db3770d691c
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 89eb74b..13c4a7c 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -23,7 +23,9 @@ OUString getCID(css::uno::Reference<css::frame::XModel> xModel)
return OUString();
css::uno::Any aAny = xSelectionSupplier->getSelection();
- assert(aAny.hasValue());
+ if (!aAny.hasValue())
+ return OUString();
+
OUString aCID;
aAny >>= aCID;
@@ -94,6 +96,9 @@ void ChartAreaPanel::setFillFloatTransparence(const XFillFloatTransparenceItem&
void ChartAreaPanel::setFillStyle(const XFillStyleItem& rItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ if (!xPropSet.is())
+ return;
+
xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(rItem.GetValue()));
}
@@ -101,6 +106,9 @@ void ChartAreaPanel::setFillStyleAndColor(const XFillStyleItem* pStyleItem,
const XFillColorItem& rColorItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ if (!xPropSet.is())
+ return;
+
if (pStyleItem)
xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
xPropSet->setPropertyValue("Color", css::uno::makeAny(rColorItem.GetValue()));
@@ -110,6 +118,9 @@ void ChartAreaPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem,
const XFillGradientItem& rGradientItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ if (!xPropSet.is())
+ return;
+
if (pStyleItem)
xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
xPropSet->setPropertyValue("GradientName", css::uno::makeAny(rGradientItem.GetValue()));
@@ -119,6 +130,9 @@ void ChartAreaPanel::setFillStyleAndHatch(const XFillStyleItem* pStyleItem,
const XFillHatchItem& rHatchItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ if (!xPropSet.is())
+ return;
+
if (pStyleItem)
xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
xPropSet->setPropertyValue("HatchName", css::uno::makeAny(rHatchItem.GetValue()));
@@ -128,6 +142,9 @@ void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem,
const XFillBitmapItem& rBitmapItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+ if (!xPropSet.is())
+ return;
+
if (pStyleItem)
xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
xPropSet->setPropertyValue("FillBitmapName", css::uno::makeAny(rBitmapItem.GetValue()));
commit 4026cab1088b957b8d28d89ef17b909f1419e615
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 21 19:00:37 2015 +0200
dispose all children
Change-Id: I96501640bc15836476eaa6ff7784ab299277ced9
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 3319bf5..89eb74b 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -71,6 +71,8 @@ void ChartAreaPanel::dispose()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
+
+ AreaPropertyPanelBase::dispose();
}
void ChartAreaPanel::Initialize()
commit 0f3ef88990eddf8b5d2b4500deee24aeab031bb3
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 21 18:11:08 2015 +0200
extract some code for reuse by chart2 sidebar
Change-Id: I44e2378dafa66f53588027cca56dc52cb4cec794
diff --git a/include/svx/sidebar/AreaPropertyPanelBase.hxx b/include/svx/sidebar/AreaPropertyPanelBase.hxx
index 45bda7d..3f7d574 100644
--- a/include/svx/sidebar/AreaPropertyPanelBase.hxx
+++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx
@@ -97,6 +97,14 @@ public:
virtual void setFillStyleAndHatch(const XFillStyleItem* pStyleItem, const XFillHatchItem& aHatchItem) = 0;
virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const XFillBitmapItem& aHatchItem) = 0;
+ void updateFillTransparence(bool bDisabled, bool bDefault, const SfxUInt16Item* pItem);
+ void updateFillFloatTransparence(bool bDisabled, bool bDefault, const XFillFloatTransparenceItem* pItem);
+ void updateFillStyle(bool bDisabled, bool bDefault, const XFillStyleItem* pItem);
+ void updateFillGradient(bool bDisabled, bool bDefault, const XFillGradientItem* pItem);
+ void updateFillHatch(bool bDisabled, bool bDefault, const XFillHatchItem* pItem);
+ void updateFillColor(bool bDefault, const XFillColorItem* pItem);
+ void updateFillBitmap(bool BDisabled, bool bDefault, const XFillBitmapItem* pItem);
+
protected:
sal_uInt16 meLastXFS;
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index 890abe3..bf48573 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -592,226 +592,248 @@ void AreaPropertyPanelBase::ImpUpdateTransparencies()
}
}
-void AreaPropertyPanelBase::NotifyItemUpdate(
- sal_uInt16 nSID,
- SfxItemState eState,
- const SfxPoolItem* pState,
- const bool /*bIsEnabled*/)
+void AreaPropertyPanelBase::updateFillTransparence(bool bDisabled, bool bDefault, const SfxUInt16Item* pItem)
{
- const bool bDisabled(SfxItemState::DISABLED == eState);
+ if (bDisabled)
+ {
+ mpTransparanceItem.reset();
+ return;
+ }
+ else if(bDefault)
+ {
+ if(pItem && (!mpTransparanceItem || *pItem != *mpTransparanceItem))
+ {
+ mpTransparanceItem.reset(static_cast<SfxUInt16Item*>(pItem->Clone()));
+ }
+ else
+ {
+ mpTransparanceItem.reset();
+ }
+ }
+ else
+ {
+ mpTransparanceItem.reset();
+ }
- switch(nSID)
+ // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem
+ ImpUpdateTransparencies();
+}
+
+void AreaPropertyPanelBase::updateFillFloatTransparence(bool bDisabled, bool bDefault, const XFillFloatTransparenceItem* pItem)
+{
+ if (bDisabled)
{
- case SID_ATTR_FILL_TRANSPARENCE:
- case SID_ATTR_FILL_FLOATTRANSPARENCE:
+ mpFloatTransparenceItem.reset();
+ return;
+ }
+
+ if(bDefault)
+ {
+ if(pItem && (!mpFloatTransparenceItem || *pItem != *mpFloatTransparenceItem))
+ {
+ mpFloatTransparenceItem.reset(static_cast<XFillFloatTransparenceItem*>(pItem->Clone()));
+ }
+ else
{
- bool bFillTransparenceChanged(false);
+ mpFloatTransparenceItem.reset();
+ }
+ }
+ else
+ {
+ mpFloatTransparenceItem.reset();
+ }
- if(SID_ATTR_FILL_TRANSPARENCE == nSID)
- {
- bFillTransparenceChanged = true;
+ // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem
+ ImpUpdateTransparencies();
+}
- if(eState >= SfxItemState::DEFAULT)
- {
- const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState);
+void AreaPropertyPanelBase::updateFillStyle(bool bDisabled, bool bDefault, const XFillStyleItem* pItem)
+{
+ if(bDisabled)
+ {
+ mpLbFillType->Disable();
+ mpColorTextFT->Disable();
+ mpLbFillType->SetNoSelection();
+ mpLbFillAttr->Show();
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
+ mpToolBoxColor->Hide();
+ meLastXFS = static_cast<sal_uInt16>(-1);
+ mpStyleItem.reset();
+ }
+ else if(bDefault && pItem)
+ {
+ mpStyleItem.reset(dynamic_cast< XFillStyleItem* >(pItem->Clone()));
+ mpLbFillType->Enable();
+ mpColorTextFT->Enable();
+ drawing::FillStyle eXFS = (drawing::FillStyle)mpStyleItem->GetValue();
+ meLastXFS = eXFS;
+ mpLbFillType->SelectEntryPos(sal::static_int_cast< sal_Int32 >(eXFS));
+
+ if(drawing::FillStyle_NONE == eXFS)
+ {
+ mpLbFillAttr->SetNoSelection();
+ mpLbFillAttr->Disable();
+ }
- if(pItem && (!mpTransparanceItem || *pItem != *mpTransparanceItem))
- {
- mpTransparanceItem.reset(static_cast<SfxUInt16Item*>(pItem->Clone()));
- }
- else
- {
- mpTransparanceItem.reset();
- }
- }
- else
- {
- mpTransparanceItem.reset();
- }
- }
- else // if(SID_ATTR_FILL_FLOATTRANSPARENCE == nSID)
- {
- bFillTransparenceChanged = true;
+ Update();
+ return;
+ }
- if(eState >= SfxItemState::DEFAULT)
- {
- const XFillFloatTransparenceItem* pItem = dynamic_cast< const XFillFloatTransparenceItem* >(pState);
+ mpLbFillType->SetNoSelection();
+ mpLbFillAttr->Show();
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
+ mpToolBoxColor->Hide();
+ meLastXFS = static_cast<sal_uInt16>(-1);
+ mpStyleItem.reset();
+}
- if(pItem && (!mpFloatTransparenceItem || *pItem != *mpFloatTransparenceItem))
- {
- mpFloatTransparenceItem.reset(static_cast<XFillFloatTransparenceItem*>(pItem->Clone()));
- }
- else
- {
- mpFloatTransparenceItem.reset();
- }
- }
- else
- {
- mpFloatTransparenceItem.reset();
- }
- }
+void AreaPropertyPanelBase::updateFillGradient(bool bDisabled, bool bDefault, const XFillGradientItem* pItem)
+{
+ if(bDefault)
+ {
+ mpFillGradientItem.reset(pItem ? static_cast<XFillGradientItem*>(pItem->Clone()) : 0);
+ }
- if(bFillTransparenceChanged)
- {
- // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem
- ImpUpdateTransparencies();
- }
- break;
+ if(mpStyleItem && drawing::FillStyle_GRADIENT == (drawing::FillStyle)mpStyleItem->GetValue())
+ {
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
+
+ if(bDefault)
+ {
+ mpLbFillAttr->Enable();
+ Update();
}
- case SID_ATTR_FILL_STYLE:
+ else if(bDisabled)
{
- if(bDisabled)
- {
- mpLbFillType->Disable();
- mpColorTextFT->Disable();
- mpLbFillType->SetNoSelection();
- mpLbFillAttr->Show();
- mpLbFillAttr->Disable();
- mpLbFillAttr->SetNoSelection();
- mpToolBoxColor->Hide();
- meLastXFS = static_cast<sal_uInt16>(-1);
- mpStyleItem.reset();
- }
- else if(eState >= SfxItemState::DEFAULT)
- {
- const XFillStyleItem* pItem = dynamic_cast< const XFillStyleItem* >(pState);
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
+ }
+ else
+ {
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+}
- if(pItem)
- {
- mpStyleItem.reset(dynamic_cast< XFillStyleItem* >(pItem->Clone()));
- mpLbFillType->Enable();
- mpColorTextFT->Enable();
- drawing::FillStyle eXFS = (drawing::FillStyle)mpStyleItem->GetValue();
- meLastXFS = eXFS;
- mpLbFillType->SelectEntryPos(sal::static_int_cast< sal_Int32 >(eXFS));
-
- if(drawing::FillStyle_NONE == eXFS)
- {
- mpLbFillAttr->SetNoSelection();
- mpLbFillAttr->Disable();
- }
+void AreaPropertyPanelBase::updateFillHatch(bool bDisabled, bool bDefault, const XFillHatchItem* pItem)
+{
+ if(bDefault)
+ {
+ mpHatchItem.reset(pItem ? static_cast<XFillHatchItem*>(pItem->Clone()) : 0);
+ }
- Update();
- break;
- }
- }
+ if(mpStyleItem && drawing::FillStyle_HATCH == (drawing::FillStyle)mpStyleItem->GetValue())
+ {
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
- mpLbFillType->SetNoSelection();
- mpLbFillAttr->Show();
+ if(bDefault)
+ {
+ mpLbFillAttr->Enable();
+ Update();
+ }
+ else if(bDisabled)
+ {
mpLbFillAttr->Disable();
mpLbFillAttr->SetNoSelection();
- mpToolBoxColor->Hide();
- meLastXFS = static_cast<sal_uInt16>(-1);
- mpStyleItem.reset();
- break;
}
- case SID_ATTR_FILL_COLOR:
+ else
{
- if(SfxItemState::DEFAULT == eState)
- {
- mpColorItem.reset(pState ? static_cast<XFillColorItem*>(pState->Clone()) : 0);
- }
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+}
- if(mpStyleItem && drawing::FillStyle_SOLID == (drawing::FillStyle)mpStyleItem->GetValue())
- {
- mpLbFillAttr->Hide();
- mpToolBoxColor->Show();
+void AreaPropertyPanelBase::updateFillColor(bool bDefault, const XFillColorItem* pItem)
+{
+ if(bDefault)
+ {
+ mpColorItem.reset(pItem ? static_cast<XFillColorItem*>(pItem->Clone()) : 0);
+ }
- Update();
- }
- break;
- }
- case SID_ATTR_FILL_GRADIENT:
- {
- if(SfxItemState::DEFAULT == eState)
- {
- mpFillGradientItem.reset(pState ? static_cast<XFillGradientItem*>(pState->Clone()) : 0);
- }
+ if(mpStyleItem && drawing::FillStyle_SOLID == (drawing::FillStyle)mpStyleItem->GetValue())
+ {
+ mpLbFillAttr->Hide();
+ mpToolBoxColor->Show();
- if(mpStyleItem && drawing::FillStyle_GRADIENT == (drawing::FillStyle)mpStyleItem->GetValue())
- {
- mpLbFillAttr->Show();
- mpToolBoxColor->Hide();
+ Update();
+ }
+}
- if(SfxItemState::DEFAULT == eState)
- {
- mpLbFillAttr->Enable();
- Update();
- }
- else if(SfxItemState::DISABLED == eState )
- {
- mpLbFillAttr->Disable();
- mpLbFillAttr->SetNoSelection();
- }
- else
- {
- mpLbFillAttr->SetNoSelection();
- }
- }
- break;
- }
- case SID_ATTR_FILL_HATCH:
- {
- if(SfxItemState::DEFAULT == eState)
- {
- mpHatchItem.reset(pState ? static_cast<XFillHatchItem*>(pState->Clone()) : 0);
- }
+void AreaPropertyPanelBase::updateFillBitmap(bool bDisabled, bool bDefault, const XFillBitmapItem* pItem)
+{
+ if(bDefault)
+ {
+ mpBitmapItem.reset(pItem ? static_cast<XFillBitmapItem*>(pItem->Clone()) : 0);
+ }
- if(mpStyleItem && drawing::FillStyle_HATCH == (drawing::FillStyle)mpStyleItem->GetValue())
- {
- mpLbFillAttr->Show();
- mpToolBoxColor->Hide();
+ if(mpStyleItem && drawing::FillStyle_BITMAP == (drawing::FillStyle)mpStyleItem->GetValue())
+ {
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
- if(SfxItemState::DEFAULT == eState)
- {
- mpLbFillAttr->Enable();
- Update();
- }
- else if(SfxItemState::DISABLED == eState )
- {
- mpLbFillAttr->Disable();
- mpLbFillAttr->SetNoSelection();
- }
- else
- {
- mpLbFillAttr->SetNoSelection();
- }
- }
- break;
+ if(bDefault)
+ {
+ mpLbFillAttr->Enable();
+ Update();
}
- case SID_ATTR_FILL_BITMAP:
+ else if(bDisabled)
{
- if(SfxItemState::DEFAULT == eState)
- {
- mpBitmapItem.reset(pState ? static_cast<XFillBitmapItem*>(pState->Clone()) : 0);
- }
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
+ }
+ else
+ {
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+}
- if(mpStyleItem && drawing::FillStyle_BITMAP == (drawing::FillStyle)mpStyleItem->GetValue())
- {
- mpLbFillAttr->Show();
- mpToolBoxColor->Hide();
+void AreaPropertyPanelBase::NotifyItemUpdate(
+ sal_uInt16 nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState,
+ const bool /*bIsEnabled*/)
+{
+ const bool bDisabled(SfxItemState::DISABLED == eState);
+ const bool bDefault(SfxItemState::DEFAULT == eState);
- if(SfxItemState::DEFAULT == eState)
- {
- mpLbFillAttr->Enable();
- Update();
- }
- else if(SfxItemState::DISABLED == eState )
- {
- mpLbFillAttr->Disable();
- mpLbFillAttr->SetNoSelection();
- }
- else
- {
- mpLbFillAttr->SetNoSelection();
- }
- }
- break;
- }
+ switch(nSID)
+ {
+ case SID_ATTR_FILL_TRANSPARENCE:
+ updateFillTransparence(bDisabled, bDefault,
+ static_cast<const SfxUInt16Item*>(pState));
+ break;
+ case SID_ATTR_FILL_FLOATTRANSPARENCE:
+ updateFillFloatTransparence(bDisabled, bDefault,
+ static_cast<const XFillFloatTransparenceItem*>(pState));
+ break;
+ case SID_ATTR_FILL_STYLE:
+ updateFillStyle(bDisabled, bDefault,
+ static_cast<const XFillStyleItem*>(pState));
+ break;
+ case SID_ATTR_FILL_COLOR:
+ updateFillColor(bDefault,
+ static_cast<const XFillColorItem*>(pState));
+ break;
+ case SID_ATTR_FILL_GRADIENT:
+ updateFillGradient(bDisabled, bDefault,
+ static_cast<const XFillGradientItem*>(pState));
+ break;
+ case SID_ATTR_FILL_HATCH:
+ updateFillHatch(bDisabled, bDefault,
+ static_cast<const XFillHatchItem*>(pState));
+ break;
+ case SID_ATTR_FILL_BITMAP:
+ updateFillBitmap(bDisabled, bDefault,
+ static_cast<const XFillBitmapItem*>(pState));
+ break;
case SID_GRADIENT_LIST:
{
- if(SfxItemState::DEFAULT == eState)
+ if(bDefault)
{
if(mpStyleItem && drawing::FillStyle_GRADIENT == (drawing::FillStyle)mpStyleItem->GetValue())
{
@@ -836,7 +858,7 @@ void AreaPropertyPanelBase::NotifyItemUpdate(
}
case SID_HATCH_LIST:
{
- if(SfxItemState::DEFAULT == eState)
+ if(bDefault)
{
if(mpStyleItem && drawing::FillStyle_HATCH == (drawing::FillStyle)mpStyleItem->GetValue())
{
@@ -861,7 +883,7 @@ void AreaPropertyPanelBase::NotifyItemUpdate(
}
case SID_BITMAP_LIST:
{
- if(SfxItemState::DEFAULT == eState)
+ if(bDefault)
{
if(mpStyleItem && drawing::FillStyle_BITMAP == (drawing::FillStyle)mpStyleItem->GetValue())
{
commit 928d8310e629f69e625a5474e1bf84932bb6a027
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 89fa0eb968de35bcfd3064c8dc1e4783d7db54c3
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 7f78eb84a22019f59bc1e2696c1d1c7841ae28a9
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 5e96e74d7d939d163ff18e2eeb5192a45d04f163
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)
commit a61342e3494c5a61b35a3d3c4f9d6bea533bcd56
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Jul 20 23:48:58 2015 +0200
fix the widget name
Change-Id: I889bf792dca59dca6750e4fb05d819a205f6ea21
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index b5e5443..7754371 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -58,7 +58,7 @@ const sal_Int32 AreaPropertyPanelBase::DEFAULT_BORDER = 0;
AreaPropertyPanelBase::AreaPropertyPanelBase(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame)
- : PanelLayout(pParent, "AreaPropertyPanelBase", "svx/ui/sidebararea.ui", rxFrame),
+ : PanelLayout(pParent, "AreaPropertyPanel", "svx/ui/sidebararea.ui", rxFrame),
meLastXFS(static_cast<sal_uInt16>(-1)),
mnLastPosGradient(0),
mnLastPosHatch(0),
commit faacf6d1144d9bcfe638fe460e15e01b80822fd8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Jul 20 23:46:27 2015 +0200
add skeleton for chart area sidebar panel
Change-Id: I5dc78fede2a51396086a8e4fde627c83c383de24
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index 85df1bc..198640e 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -188,6 +188,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/main/UndoCommandDispatch \
chart2/source/controller/main/UndoGuard \
chart2/source/controller/sidebar/Chart2PanelFactory \
+ chart2/source/controller/sidebar/ChartAreaPanel \
chart2/source/controller/sidebar/ChartAxisPanel \
chart2/source/controller/sidebar/ChartElementsPanel \
chart2/source/controller/sidebar/ChartErrorBarPanel \
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
index a81304b..d45ad84 100644
--- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
@@ -34,6 +34,7 @@
#include "ChartController.hxx"
#include "ChartAxisPanel.hxx"
#include "ChartErrorBarPanel.hxx"
+#include "ChartAreaPanel.hxx"
using namespace css::uno;
using ::rtl::OUString;
@@ -96,6 +97,8 @@ Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
pPanel = ChartAxisPanel::Create(pParentWindow, xFrame, pController);
else if (rsResourceURL.endsWith("/ErrorBarPanel"))
pPanel = ChartErrorBarPanel::Create(pParentWindow, xFrame, pController);
+ else if (rsResourceURL.endsWith("/AreaPanel"))
+ pPanel = ChartAreaPanel::Create(pParentWindow, xFrame, pController);
if (pPanel)
xElement = sfx2::sidebar::SidebarPanelBase::Create(
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
new file mode 100644
index 0000000..a4241c9
--- /dev/null
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "ChartAreaPanel.hxx"
+
+#include "ChartController.hxx"
+
+namespace chart { namespace sidebar {
+
+VclPtr<vcl::Window> ChartAreaPanel::Create(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController)
+{
+ if (pParent == NULL)
+ throw css::lang::IllegalArgumentException("no parent Window given to ChartAxisPanel::Create", NULL, 0);
+ if (!rxFrame.is())
+ throw css::lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", NULL, 1);
+
+ return VclPtr<ChartAreaPanel>::Create(
+ pParent, rxFrame, pController);
+}
+
+ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* /*pController*/):
+ svx::sidebar::AreaPropertyPanelBase(pParent, rxFrame)
+{
+}
+
+ChartAreaPanel::~ChartAreaPanel()
+{
+ disposeOnce();
+}
+
+void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& /*rItem*/)
+{
+
+}
+
+void ChartAreaPanel::setFillFloatTransparence(const XFillFloatTransparenceItem& /*rItem*/)
+{
+
+}
+
+void ChartAreaPanel::setFillStyle(const XFillStyleItem& /*rItem*/)
+{
+
+}
+
+void ChartAreaPanel::setFillStyleAndColor(const XFillStyleItem* /*pStyleItem*/,
+ const XFillColorItem& /*rColorItem*/)
+{
+
+}
+
+void ChartAreaPanel::setFillStyleAndGradient(const XFillStyleItem* /*pStyleItem*/,
+ const XFillGradientItem& /*rGradientItem*/)
+{
+
+}
+
+void ChartAreaPanel::setFillStyleAndHatch(const XFillStyleItem* /*pStyleItem*/,
+ const XFillHatchItem& /*rHatchItem*/)
+{
+
+}
+
+void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* /*pStyleItem*/,
+ const XFillBitmapItem& /*rBitmapItem*/)
+{
+
+}
+
+
+} }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
new file mode 100644
index 0000000..4f4ac8b
--- /dev/null
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTAREAPANEL_HXX
+#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTAREAPANEL_HXX
+
+#include <vcl/ctrl.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/itemwin.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/drawitem.hxx>
+#include <svx/sidebar/PanelLayout.hxx>
+#include <svl/intitem.hxx>
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <boost/scoped_ptr.hpp>
+
+#include <svx/sidebar/AreaPropertyPanelBase.hxx>
+
+class XFillFloatTransparenceItem;
+class XFillTransparenceItem;
+class XFillStyleItem;
+class XFillGradientItem;
+class XFillColorItem;
+class XFillHatchItem;
+class XFillBitmapItem;
+
+namespace chart {
+
+class ChartController;
+
+namespace sidebar {
+
+class ChartAreaPanel : public svx::sidebar::AreaPropertyPanelBase
+{
+public:
+ static VclPtr<vcl::Window> Create(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController);
+
+ // constructor/destuctor
+ ChartAreaPanel(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController);
+
+ virtual ~ChartAreaPanel();
+
+ virtual void setFillTransparence(const XFillTransparenceItem& rItem);
+ virtual void setFillFloatTransparence(const XFillFloatTransparenceItem& rItem);
+ virtual void setFillStyle(const XFillStyleItem& rItem);
+ virtual void setFillStyleAndColor(const XFillStyleItem* pStyleItem, const XFillColorItem& rColorItem);
+ virtual void setFillStyleAndGradient(const XFillStyleItem* pStyleItem, const XFillGradientItem& rGradientItem);
+ virtual void setFillStyleAndHatch(const XFillStyleItem* pStyleItem, const XFillHatchItem& rHatchItem);
+ virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const XFillBitmapItem& rBitmapItem);
+
+private:
+
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 886c8484190e197824e6e734697d4e746942abc5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Jul 20 23:14:02 2015 +0200
move header file to public include dir
we will need it in chart2 so make it available
Change-Id: I9ef1feebc2e0086e0647349b4e92f9fc9cdd4e8c
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.hxx b/include/svx/sidebar/AreaPropertyPanelBase.hxx
similarity index 98%
rename from svx/source/sidebar/area/AreaPropertyPanelBase.hxx
rename to include/svx/sidebar/AreaPropertyPanelBase.hxx
index 5abc15bd..45bda7d 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.hxx
+++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx
@@ -39,6 +39,7 @@
#include <svl/intitem.hxx>
#include <com/sun/star/ui/XUIElement.hpp>
#include <boost/scoped_ptr.hpp>
+#include <svx/svxdllapi.h>
class XFillFloatTransparenceItem;
class XFillTransparenceItem;
@@ -53,7 +54,7 @@ namespace svx { namespace sidebar {
class PopupContainer;
class AreaTransparencyGradientControl;
-class AreaPropertyPanelBase
+class SVX_DLLPUBLIC AreaPropertyPanelBase
: public PanelLayout,
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
diff --git a/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx b/include/svx/sidebar/AreaTransparencyGradientPopup.hxx
similarity index 100%
rename from svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx
rename to include/svx/sidebar/AreaTransparencyGradientPopup.hxx
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hxx b/svx/source/sidebar/area/AreaPropertyPanel.hxx
index ec805d7..135154c 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.hxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx
@@ -34,7 +34,7 @@
#include <com/sun/star/ui/XUIElement.hpp>
#include <boost/scoped_ptr.hpp>
-#include "AreaPropertyPanelBase.hxx"
+#include <svx/sidebar/AreaPropertyPanelBase.hxx>
class XFillFloatTransparenceItem;
class XFillTransparenceItem;
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index f13599c..b5e5443 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -21,7 +21,7 @@
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/ControlFactory.hxx>
-#include <AreaPropertyPanelBase.hxx>
+#include <svx/sidebar/AreaPropertyPanelBase.hxx>
#include <AreaPropertyPanel.hrc>
#include <svx/dialogs.hrc>
#include <svx/dialmgr.hxx>
@@ -37,6 +37,7 @@
#include <svx/svxitems.hrc>
#include <vcl/toolbox.hxx>
#include <svtools/toolbarmenu.hxx>
+#include <svx/tbcontrl.hxx>
#include <boost/bind.hpp>
diff --git a/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx b/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx
index 04151a8..76b2b28 100644
--- a/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx
+++ b/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "AreaTransparencyGradientControl.hxx"
-#include "AreaPropertyPanelBase.hxx"
+#include <svx/sidebar/AreaPropertyPanelBase.hxx>
#include "AreaPropertyPanel.hrc"
#include <svx/dialogs.hrc>
diff --git a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx
index 46477e5..fb01754 100644
--- a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx
+++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx
@@ -16,7 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "AreaTransparencyGradientPopup.hxx"
+#include <svx/sidebar/AreaTransparencyGradientPopup.hxx>
#include "AreaTransparencyGradientControl.hxx"
namespace svx { namespace sidebar {
commit a9e777ff7b4f586f2860aab51d2bf81db2e53862
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Jul 20 18:23:04 2015 +0200
split area property sidebar panel into two parts
The AreaPropertyPanelBase is independent from the dispatcher,
SfxBindings and some other sfx2 stuff. There are still a few open
points about some of the controls used but it is a step forward.
Change-Id: I8eed42522abb3d3efc46bad352da9cbaa0b88b12
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index 22216d6..339b502 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -186,6 +186,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/sidebar/paragraph/ParaLineSpacingPopup \
svx/source/sidebar/paragraph/ParaPropertyPanel \
svx/source/sidebar/area/AreaPropertyPanel \
+ svx/source/sidebar/area/AreaPropertyPanelBase \
svx/source/sidebar/area/AreaTransparencyGradientControl \
svx/source/sidebar/area/AreaTransparencyGradientPopup \
svx/source/sidebar/shadow/ShadowPropertyPanel \
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx
index 376dc4e..53836bc 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx
@@ -49,35 +49,11 @@ const char UNO_SIDEBARGRADIENT[] = ".uno:sidebargradient";
namespace svx { namespace sidebar {
-const sal_Int32 AreaPropertyPanel::DEFAULT_CENTERX = 50;
-const sal_Int32 AreaPropertyPanel::DEFAULT_CENTERY = 50;
-const sal_Int32 AreaPropertyPanel::DEFAULT_ANGLE = 0;
-const sal_Int32 AreaPropertyPanel::DEFAULT_STARTVALUE = 0;
-const sal_Int32 AreaPropertyPanel::DEFAULT_ENDVALUE = 16777215;
-const sal_Int32 AreaPropertyPanel::DEFAULT_BORDER = 0;
-
-
AreaPropertyPanel::AreaPropertyPanel(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
- : PanelLayout(pParent, "AreaPropertyPanel", "svx/ui/sidebararea.ui", rxFrame),
- meLastXFS(static_cast<sal_uInt16>(-1)),
- mnLastPosGradient(0),
- mnLastPosHatch(0),
- mnLastPosBitmap(0),
- mnLastTransSolid(50),
- maGradientLinear(),
- maGradientAxial(),
- maGradientRadial(),
- maGradientElliptical(),
- maGradientSquare(),
- maGradientRect(),
- mpStyleItem(),
- mpColorItem(),
- mpFillGradientItem(),
- mpHatchItem(),
- mpBitmapItem(),
+ : AreaPropertyPanelBase(pParent, rxFrame),
maStyleControl(SID_ATTR_FILL_STYLE, *pBindings, *this),
maColorControl(SID_ATTR_FILL_COLOR, *pBindings, *this),
maGradientControl(SID_ATTR_FILL_GRADIENT, *pBindings, *this),
@@ -88,27 +64,8 @@ AreaPropertyPanel::AreaPropertyPanel(
maBitmapListControl(SID_BITMAP_LIST, *pBindings, *this),
maFillTransparenceController(SID_ATTR_FILL_TRANSPARENCE, *pBindings, *this),
maFillFloatTransparenceController(SID_ATTR_FILL_FLOATTRANSPARENCE, *pBindings, *this),
- maImgAxial(SVX_RES(IMG_AXIAL)),
- maImgElli(SVX_RES(IMG_ELLI)),
- maImgQuad(SVX_RES(IMG_QUAD)),
- maImgRadial(SVX_RES(IMG_RADIAL)),
- maImgSquare(SVX_RES(IMG_SQUARE)),
- maImgLinear(SVX_RES(IMG_LINEAR)),
- maTrGrPopup(this, ::boost::bind(&AreaPropertyPanel::CreateTransparencyGradientControl, this, _1)),
- mpFloatTransparenceItem(),
- mpTransparanceItem(),
- mxFrame(rxFrame),
mpBindings(pBindings)
{
- get(mpColorTextFT, "filllabel");
- get(mpLbFillType, "fillstyle");
- get(mpLbFillAttr, "fillattr");
- get(mpTrspTextFT, "transparencylabel");
- get(mpToolBoxColor, "selectcolor");
- get(mpLBTransType, "transtype");
- get(mpMTRTransparent, "settransparency");
- get(mpBTNGradient, "selectgradient");
-
Initialize();
}
@@ -119,15 +76,6 @@ AreaPropertyPanel::~AreaPropertyPanel()
void AreaPropertyPanel::dispose()
{
- mpColorTextFT.clear();
- mpLbFillType.clear();
- mpLbFillAttr.clear();
- mpToolBoxColor.clear();
- mpTrspTextFT.clear();
- mpLBTransType.clear();
- mpMTRTransparent.clear();
- mpBTNGradient.clear();
-
maStyleControl.dispose();
maColorControl.dispose();
maGradientControl.dispose();
@@ -139,367 +87,11 @@ void AreaPropertyPanel::dispose()
maFillTransparenceController.dispose();
maFillFloatTransparenceController.dispose();
- PanelLayout::dispose();
+ AreaPropertyPanelBase::dispose();
}
void AreaPropertyPanel::Initialize()
{
- maGradientLinear.SetXOffset(DEFAULT_CENTERX);
- maGradientLinear.SetYOffset(DEFAULT_CENTERY);
- maGradientLinear.SetAngle(DEFAULT_ANGLE);
- maGradientLinear.SetStartColor(Color(DEFAULT_STARTVALUE));
- maGradientLinear.SetEndColor(Color(DEFAULT_ENDVALUE));
- maGradientLinear.SetBorder(DEFAULT_BORDER);
- maGradientLinear.SetGradientStyle(css::awt::GradientStyle_LINEAR);
-
- maGradientAxial = maGradientLinear;
- maGradientAxial.SetGradientStyle(css::awt::GradientStyle_AXIAL);
-
- maGradientRadial = maGradientLinear;
- maGradientRadial.SetGradientStyle(css::awt::GradientStyle_RADIAL);
-
- maGradientElliptical = maGradientLinear;
- maGradientElliptical.SetGradientStyle(css::awt::GradientStyle_ELLIPTICAL);
-
- maGradientSquare = maGradientLinear;
- maGradientSquare.SetGradientStyle(css::awt::GradientStyle_SQUARE);
-
- maGradientRect = maGradientLinear;
- maGradientRect.SetGradientStyle(css::awt::GradientStyle_RECT);
-
- mpLbFillType->SetAccessibleName(OUString( "Fill")); //wj acc
- mpLbFillAttr->SetAccessibleName(OUString( "Fill")); //wj acc
-
- Link<> aLink = LINK( this, AreaPropertyPanel, SelectFillTypeHdl );
- mpLbFillType->SetSelectHdl( aLink );
-
- aLink = LINK( this, AreaPropertyPanel, SelectFillAttrHdl );
- mpLbFillAttr->SetSelectHdl( aLink );
-
- mpLBTransType->SetSelectHdl(LINK(this, AreaPropertyPanel, ChangeTrgrTypeHdl_Impl));
- mpLBTransType->SetAccessibleName(OUString( "Transparency")); //wj acc
-
- mpMTRTransparent->SetValue( 50 );
- mpMTRTransparent->SetModifyHdl(LINK(this, AreaPropertyPanel, ModifyTransparentHdl_Impl));
- mpMTRTransparent->SetAccessibleName(OUString( "Transparency")); //wj acc
-
- const sal_uInt16 nIdGradient = mpBTNGradient->GetItemId(UNO_SIDEBARGRADIENT);
- mpBTNGradient->SetItemBits( nIdGradient, mpBTNGradient->GetItemBits( nIdGradient ) | ToolBoxItemBits::DROPDOWNONLY );
- Link<ToolBox *, void> aLink2 = LINK( this, AreaPropertyPanel, ClickTrGrHdl_Impl );
- mpBTNGradient->SetDropdownClickHdl( aLink2 );
- mpBTNGradient->SetSelectHdl( aLink2 );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list