[Libreoffice-commits] core.git: Branch 'feature/chart-sidebar' - 5 commits - chart2/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Jul 15 07:11:20 PDT 2015
chart2/source/controller/main/ChartController.cxx | 3
chart2/source/controller/sidebar/ChartElementsPanel.cxx | 117 +++++++++++++++-
chart2/source/controller/sidebar/ChartElementsPanel.hxx | 13 -
3 files changed, 123 insertions(+), 10 deletions(-)
New commits:
commit 020ddb77fccd00b15ac5e65d92e44f9aec23154b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 16:10:19 2015 +0200
wire axis visiblity
Change-Id: Ide5fe06f7ba6f477fd1bdf5f408915a023319675
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index efb6acf..11039e8 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -55,6 +55,15 @@ enum class GridType
HOR_MINOR
};
+enum class AxisType
+{
+ X_MAIN,
+ Y_MAIN,
+ Z_MAIN,
+ X_SECOND,
+ Y_SECOND
+};
+
class ChartSidebarModifyListener : public cppu::WeakImplHelper1<css::util::XModifyListener>
{
public:
@@ -148,6 +157,26 @@ bool isGridVisible(css::uno::Reference<css::frame::XModel> xModel, GridType eTyp
return false;
}
+bool isAxisVisible(css::uno::Reference<css::frame::XModel> xModel, AxisType eType)
+{
+ Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
+ if(xDiagram.is())
+ {
+ sal_Int32 nDimensionIndex = 0;
+ if (eType == AxisType::Y_MAIN || eType == AxisType::Y_SECOND)
+ nDimensionIndex = 1;
+ else if (eType == AxisType::Z_MAIN)
+ nDimensionIndex = 2;
+
+ bool bMajor = !(eType == AxisType::X_SECOND || eType == AxisType::Y_SECOND);
+
+ bool bHasAxis = AxisHelper::isAxisShown(nDimensionIndex, bMajor, xDiagram);
+ return bHasAxis;
+ }
+ return false;
+
+}
+
}
ChartElementsPanel::ChartElementsPanel(
@@ -235,6 +264,11 @@ void ChartElementsPanel::updateData()
mpCB2ndYAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE));
mpCBGridVertical->Check(isGridVisible(mxModel, GridType::VERT_MAJOR));
mpCBGridHorizontal->Check(isGridVisible(mxModel, GridType::HOR_MAJOR));
+ mpCBXAxis->Check(isAxisVisible(mxModel, AxisType::X_MAIN));
+ mpCBYAxis->Check(isAxisVisible(mxModel, AxisType::Y_MAIN));
+ mpCBZAxis->Check(isAxisVisible(mxModel, AxisType::Z_MAIN));
+ mpCB2ndXAxis->Check(isAxisVisible(mxModel, AxisType::X_SECOND));
+ mpCB2ndYAxis->Check(isAxisVisible(mxModel, AxisType::Y_SECOND));
}
VclPtr<vcl::Window> ChartElementsPanel::Create (
commit ed572e7f34fe10065a853bd3cc3e32f08fa52935
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 15:49:55 2015 +0200
sidebar needs to listen to chart modifications
Change-Id: I3dd0ae1c1c7fe14ee08571e96b1804d5d9972e2c
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 546e6793..efb6acf 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -55,6 +55,44 @@ enum class GridType
HOR_MINOR
};
+class ChartSidebarModifyListener : public cppu::WeakImplHelper1<css::util::XModifyListener>
+{
+public:
+
+ ChartSidebarModifyListener(ChartElementsPanel* pParent);
+ virtual ~ChartSidebarModifyListener();
+
+ virtual void SAL_CALL modified(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:
+ ChartElementsPanel* mpParent;
+};
+
+ChartSidebarModifyListener::ChartSidebarModifyListener(ChartElementsPanel* pParent):
+ mpParent(pParent)
+{
+}
+
+ChartSidebarModifyListener::~ChartSidebarModifyListener()
+{
+}
+
+void ChartSidebarModifyListener::modified(const css::lang::EventObject& /*rEvent*/)
+ throw (::css::uno::RuntimeException, ::std::exception)
+{
+ mpParent->updateData();
+}
+
+void ChartSidebarModifyListener::disposing(const css::lang::EventObject& /*rEvent*/)
+ throw (::css::uno::RuntimeException, ::std::exception)
+{
+ mpParent->modelInvalid();
+}
+
ChartModel* getChartModel(css::uno::Reference<css::frame::XModel> xModel)
{
ChartModel* pModel = dynamic_cast<ChartModel*>(xModel.get());
@@ -121,7 +159,8 @@ ChartElementsPanel::ChartElementsPanel(
mxFrame(rxFrame),
maContext(),
mpBindings(pBindings),
- mxModel(pController->getModel())
+ mxModel(pController->getModel()),
+ mxListener(new ChartSidebarModifyListener(this))
{
get(mpCBTitle, "checkbutton_title");
get(mpCBSubtitle, "checkbutton_subtitle");
@@ -151,6 +190,9 @@ ChartElementsPanel::~ChartElementsPanel()
void ChartElementsPanel::dispose()
{
+
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
mpCBTitle.clear();
mpCBSubtitle.clear();
mpCBXAxis.clear();
@@ -174,11 +216,15 @@ void ChartElementsPanel::dispose()
void ChartElementsPanel::Initialize()
{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->addModifyListener(mxListener);
updateData();
}
void ChartElementsPanel::updateData()
{
+ SolarMutexGuard aGuard;
+
mpCBLegend->Check(isLegendVisible(mxModel));
mpCBTitle->Check(isTitleVisisble(mxModel, TitleHelper::MAIN_TITLE));
mpCBSubtitle->Check(isTitleVisisble(mxModel, TitleHelper::SUB_TITLE));
@@ -239,6 +285,11 @@ void ChartElementsPanel::NotifyItemUpdate(
}
}
+void ChartElementsPanel::modelInvalid()
+{
+
+}
+
}} // end of namespace ::chart::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 82a2665..297f157 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -22,7 +22,8 @@
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <svx/sidebar/PanelLayout.hxx>
-#include <boost/scoped_ptr.hpp>
+
+#include <com/sun/star/util/XModifyListener.hpp>
class FixedText;
class ListBox;
@@ -65,6 +66,10 @@ public:
SfxBindings* pBindings, ChartController* pController);
virtual ~ChartElementsPanel();
virtual void dispose() SAL_OVERRIDE;
+
+ void updateData();
+ void modelInvalid();
+
private:
//ui controls
VclPtr<CheckBox> mpCBTitle;
@@ -90,9 +95,9 @@ private:
SfxBindings* mpBindings;
css::uno::Reference<css::frame::XModel> mxModel;
+ css::uno::Reference<css::util::XModifyListener> mxListener;
void Initialize();
- void updateData();
};
} } // end of namespace ::chart::sidebar
commit 389b137b258de2066bb853070d0695a9e560141a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 13:35:54 2015 +0200
remove my accidently committed debug messages
Change-Id: Ia890837520b57291ae119de30dc7586b65e30b81
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 3175eea..0a0c051 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -422,7 +422,6 @@ void SAL_CALL ChartController::attachFrame(
m_apDropTargetHelper.reset();
}
{
- SAL_DEBUG("attached frame");
// calls to VCL
SolarMutexGuard aSolarGuard;
m_pChartWindow = VclPtr<ChartWindow>::Create(this,pParent,pParent?pParent->GetStyle():0);
@@ -817,7 +816,6 @@ void SAL_CALL ChartController::dispose()
m_xLayoutManagerEventBroadcaster.set( 0 );
}
- SAL_DEBUG("disposing");
m_xFrame.clear();
m_xUndoManager.clear();
@@ -936,7 +934,6 @@ void SAL_CALL ChartController::notifyClosing(
try
{
xFrameCloseable->close( sal_False /* DeliverOwnership */ );
- SAL_DEBUG("notifyClosing");
m_xFrame.clear();
}
catch( const util::CloseVetoException & )
commit a6ab9bc6c54a8c0bf98554b85a5a868a83fb736d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 13:35:08 2015 +0200
remove unused member variables
Change-Id: I2db9b587eea0569df5225171244cee545d6155df
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 399b0f9..82a2665 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -67,10 +67,6 @@ public:
virtual void dispose() SAL_OVERRIDE;
private:
//ui controls
- VclPtr<ListBox> mpLbCategory;
- VclPtr<ToolBox> mpTBCategory;
- VclPtr<NumericField> mpEdDecimals;
- VclPtr<NumericField> mpEdLeadZeroes;
VclPtr<CheckBox> mpCBTitle;
VclPtr<CheckBox> mpCBSubtitle;
VclPtr<CheckBox> mpCBXAxis;
commit 13568fe83e1c627d8a7ede5c002ec590ecd47d87
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Jul 15 13:28:48 2015 +0200
wire gridlines in chart elements panel
Change-Id: Ibf1e863d6cc469f0fcc42e0a6077cfa104b16ba1
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index c6ac57b..546e6793 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -34,6 +34,8 @@
#include "LegendHelper.hxx"
#include "TitleHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "AxisHelper.hxx"
#include "ChartModel.hxx"
@@ -45,6 +47,14 @@ namespace chart { namespace sidebar {
namespace {
+enum class GridType
+{
+ VERT_MAJOR,
+ VERT_MINOR,
+ HOR_MAJOR,
+ HOR_MINOR
+};
+
ChartModel* getChartModel(css::uno::Reference<css::frame::XModel> xModel)
{
ChartModel* pModel = dynamic_cast<ChartModel*>(xModel.get());
@@ -82,6 +92,24 @@ bool isTitleVisisble(css::uno::Reference<css::frame::XModel> xModel, TitleHelper
return TitleHelper::getTitle(eTitle, xModel).is();
}
+bool isGridVisible(css::uno::Reference<css::frame::XModel> xModel, GridType eType)
+{
+ Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel));
+ if(xDiagram.is())
+ {
+ sal_Int32 nDimensionIndex = 0;
+ if (eType == GridType::HOR_MAJOR || eType == GridType::HOR_MINOR)
+ nDimensionIndex = 1;
+ sal_Int32 nCooSysIndex = 0;
+
+ bool bMajor = (eType == GridType::HOR_MAJOR || eType == GridType::VERT_MAJOR);
+
+ bool bHasGrid = AxisHelper::isGridShown(nDimensionIndex, nCooSysIndex, bMajor, xDiagram);
+ return bHasGrid;
+ }
+ return false;
+}
+
}
ChartElementsPanel::ChartElementsPanel(
@@ -159,6 +187,8 @@ void ChartElementsPanel::updateData()
mpCBZAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::Z_AXIS_TITLE));
mpCB2ndXAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::SECONDARY_X_AXIS_TITLE));
mpCB2ndYAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE));
+ mpCBGridVertical->Check(isGridVisible(mxModel, GridType::VERT_MAJOR));
+ mpCBGridHorizontal->Check(isGridVisible(mxModel, GridType::HOR_MAJOR));
}
VclPtr<vcl::Window> ChartElementsPanel::Create (
More information about the Libreoffice-commits
mailing list