summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-03-09 19:02:03 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-03-09 19:27:49 +0100
commit1e9993be107905fdbcbf095b55bb2ae6a493600b (patch)
tree604a03670649bb8d7237a71dd5da9baa9a4ce237 /chart2
parentcaac9026f6532483e0ae1fa09a36a4fc0e92aa8a (diff)
don't hardcode property mapping, read them from chart2::XChartType
Change-Id: I7889dbddab603d7650d58a04f53e7c5fe38fcce2
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/dialogs/dlg_PropertyMapping.cxx11
-rw-r--r--chart2/source/controller/dialogs/dlg_PropertyMapping.hxx5
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx6
-rw-r--r--chart2/source/model/template/BubbleChartType.cxx10
-rw-r--r--chart2/source/model/template/BubbleChartType.hxx3
-rw-r--r--chart2/source/model/template/ChartType.cxx6
-rw-r--r--chart2/source/model/template/ChartType.hxx3
7 files changed, 36 insertions, 8 deletions
diff --git a/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx b/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
index 0f193b89f743..a10c84f31e97 100644
--- a/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
+++ b/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
@@ -9,6 +9,8 @@
#include "dlg_PropertyMapping.hxx"
+using namespace com::sun::star;
+
namespace chart {
namespace {
@@ -38,7 +40,7 @@ std::vector<OUString> getEntries()
}
-PropertyMappingDlg::PropertyMappingDlg(Window* pParent)
+PropertyMappingDlg::PropertyMappingDlg(Window* pParent, uno::Reference< chart2::XChartType > xChartType )
: ModalDialog(pParent, "PropertyMappingDialog",
"modules/schart/ui/dlg_PropertyMapping.ui")
{
@@ -47,11 +49,10 @@ PropertyMappingDlg::PropertyMappingDlg(Window* pParent)
get(mpBtnCancel, "cancel");
mpMappingTable->SetTabs( pListBoxTabs, MAP_APPFONT );
- std::vector<OUString> aEntries = getEntries();
- for(std::vector<OUString>::const_iterator itr = aEntries.begin(),
- itrEnd = aEntries.end(); itr != itrEnd; ++itr)
+ uno::Sequence< OUString > aPropRoles = xChartType->getSupportedPropertyRoles();
+ for(sal_Int32 i = 0, n = aPropRoles.getLength(); i < n; ++i)
{
- mpMappingTable->InsertEntry(*itr);
+ mpMappingTable->InsertEntry(aPropRoles[i]);
}
mpBtnOk->SetClickHdl( LINK( this, PropertyMappingDlg, OkBtnHdl ) );
mpBtnCancel->SetClickHdl( LINK( this, PropertyMappingDlg, CancelBtnHdl ) );
diff --git a/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx b/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
index e6a6b4bd44b3..0c20de5f5dca 100644
--- a/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
+++ b/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
@@ -14,13 +14,16 @@
#include <vcl/button.hxx>
#include <svtools/svtabbx.hxx>
+#include <com/sun/star/chart2/XChartType.hpp>
+
namespace chart {
class PropertyMappingDlg : public ModalDialog
{
public:
- PropertyMappingDlg(Window* pParent);
+ PropertyMappingDlg(Window* pParent, com::sun::star::uno::Reference<
+ com::sun::star::chart2::XChartType > xChartType);
OUString getSelectedEntry();
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index 12533aa437b0..f15f2e1e8bbd 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -761,7 +761,11 @@ IMPL_LINK( DataSourceTabPage, RangeUpdateDataHdl, Edit*, pEdit )
IMPL_LINK_NOARG( DataSourceTabPage, AddMappingHdl )
{
- PropertyMappingDlg aDlg(this);
+ SeriesEntry * pSeriesEntry = dynamic_cast< SeriesEntry * >( m_pLB_SERIES->FirstSelected());
+ if(!pSeriesEntry)
+ return 0;
+
+ PropertyMappingDlg aDlg(this, pSeriesEntry->m_xChartType);
short aRet = aDlg.Execute();
if(aRet == RET_OK)
{
diff --git a/chart2/source/model/template/BubbleChartType.cxx b/chart2/source/model/template/BubbleChartType.cxx
index 1b68d5b9fa4e..999fe504a5b9 100644
--- a/chart2/source/model/template/BubbleChartType.cxx
+++ b/chart2/source/model/template/BubbleChartType.cxx
@@ -167,7 +167,6 @@ uno::Sequence< OUString > SAL_CALL BubbleChartType::getSupportedMandatoryRoles()
throw (uno::RuntimeException, std::exception)
{
uno::Sequence< OUString > aMandRolesSeq(4);
- aMandRolesSeq.realloc( 4 );
aMandRolesSeq[0] = "label";
aMandRolesSeq[1] = "values-x";
aMandRolesSeq[2] = "values-y";
@@ -175,6 +174,15 @@ uno::Sequence< OUString > SAL_CALL BubbleChartType::getSupportedMandatoryRoles()
return aMandRolesSeq;
}
+uno::Sequence< OUString > SAL_CALL BubbleChartType::getSupportedPropertyRoles()
+ throw(com::sun::star::uno::RuntimeException, std::exception)
+{
+ uno::Sequence< OUString > aPropertyRoles(2);
+ aPropertyRoles[0] = "FillColor";
+ aPropertyRoles[1] = "BorderColor";
+ return aPropertyRoles;
+}
+
OUString SAL_CALL BubbleChartType::getRoleOfSequenceForSeriesLabel()
throw (uno::RuntimeException, std::exception)
{
diff --git a/chart2/source/model/template/BubbleChartType.hxx b/chart2/source/model/template/BubbleChartType.hxx
index 03de9dbd8c72..c6cec1fad8e4 100644
--- a/chart2/source/model/template/BubbleChartType.hxx
+++ b/chart2/source/model/template/BubbleChartType.hxx
@@ -48,6 +48,9 @@ protected:
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
getSupportedMandatoryRoles()
throw (::com::sun::star::uno::RuntimeException, std::exception);
+ virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
+ getSupportedPropertyRoles()
+ throw (::com::sun::star::uno::RuntimeException, std::exception);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL
createCoordinateSystem( ::sal_Int32 DimensionCount )
throw (::com::sun::star::lang::IllegalArgumentException,
diff --git a/chart2/source/model/template/ChartType.cxx b/chart2/source/model/template/ChartType.cxx
index fa652c892677..7c5857753596 100644
--- a/chart2/source/model/template/ChartType.cxx
+++ b/chart2/source/model/template/ChartType.cxx
@@ -122,6 +122,12 @@ Sequence< OUString > SAL_CALL ChartType::getSupportedOptionalRoles()
return Sequence< OUString >();
}
+Sequence< OUString > SAL_CALL ChartType::getSupportedPropertyRoles()
+ throw (uno::RuntimeException, std::exception)
+{
+ return Sequence< OUString >();
+}
+
OUString SAL_CALL ChartType::getRoleOfSequenceForSeriesLabel()
throw (uno::RuntimeException, std::exception)
{
diff --git a/chart2/source/model/template/ChartType.hxx b/chart2/source/model/template/ChartType.hxx
index f450aa3c3052..3e36bf8ed721 100644
--- a/chart2/source/model/template/ChartType.hxx
+++ b/chart2/source/model/template/ChartType.hxx
@@ -80,6 +80,9 @@ protected:
throw (::com::sun::star::uno::RuntimeException, std::exception);
virtual OUString SAL_CALL getRoleOfSequenceForSeriesLabel()
throw (::com::sun::star::uno::RuntimeException, std::exception);
+ virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
+ getSupportedPropertyRoles()
+ throw (::com::sun::star::uno::RuntimeException, std::exception);
// ____ XDataSeriesContainer ____
virtual void SAL_CALL addDataSeries(