don't hardcode property mapping, read them from chart2::XChartType

Change-Id: I7889dbddab603d7650d58a04f53e7c5fe38fcce2
This commit is contained in:
Markus Mohrhard
2014-03-09 19:02:03 +01:00
committed by Markus Mohrhard
parent caac9026f6
commit 1e9993be10
8 changed files with 42 additions and 8 deletions

View File

@@ -9,6 +9,8 @@
#include "dlg_PropertyMapping.hxx" #include "dlg_PropertyMapping.hxx"
using namespace com::sun::star;
namespace chart { namespace chart {
namespace { 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", : ModalDialog(pParent, "PropertyMappingDialog",
"modules/schart/ui/dlg_PropertyMapping.ui") "modules/schart/ui/dlg_PropertyMapping.ui")
{ {
@@ -47,11 +49,10 @@ PropertyMappingDlg::PropertyMappingDlg(Window* pParent)
get(mpBtnCancel, "cancel"); get(mpBtnCancel, "cancel");
mpMappingTable->SetTabs( pListBoxTabs, MAP_APPFONT ); mpMappingTable->SetTabs( pListBoxTabs, MAP_APPFONT );
std::vector<OUString> aEntries = getEntries(); uno::Sequence< OUString > aPropRoles = xChartType->getSupportedPropertyRoles();
for(std::vector<OUString>::const_iterator itr = aEntries.begin(), for(sal_Int32 i = 0, n = aPropRoles.getLength(); i < n; ++i)
itrEnd = aEntries.end(); itr != itrEnd; ++itr)
{ {
mpMappingTable->InsertEntry(*itr); mpMappingTable->InsertEntry(aPropRoles[i]);
} }
mpBtnOk->SetClickHdl( LINK( this, PropertyMappingDlg, OkBtnHdl ) ); mpBtnOk->SetClickHdl( LINK( this, PropertyMappingDlg, OkBtnHdl ) );
mpBtnCancel->SetClickHdl( LINK( this, PropertyMappingDlg, CancelBtnHdl ) ); mpBtnCancel->SetClickHdl( LINK( this, PropertyMappingDlg, CancelBtnHdl ) );

View File

@@ -14,13 +14,16 @@
#include <vcl/button.hxx> #include <vcl/button.hxx>
#include <svtools/svtabbx.hxx> #include <svtools/svtabbx.hxx>
#include <com/sun/star/chart2/XChartType.hpp>
namespace chart { namespace chart {
class PropertyMappingDlg : public ModalDialog class PropertyMappingDlg : public ModalDialog
{ {
public: public:
PropertyMappingDlg(Window* pParent); PropertyMappingDlg(Window* pParent, com::sun::star::uno::Reference<
com::sun::star::chart2::XChartType > xChartType);
OUString getSelectedEntry(); OUString getSelectedEntry();

View File

@@ -761,7 +761,11 @@ IMPL_LINK( DataSourceTabPage, RangeUpdateDataHdl, Edit*, pEdit )
IMPL_LINK_NOARG( DataSourceTabPage, AddMappingHdl ) 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(); short aRet = aDlg.Execute();
if(aRet == RET_OK) if(aRet == RET_OK)
{ {

View File

@@ -167,7 +167,6 @@ uno::Sequence< OUString > SAL_CALL BubbleChartType::getSupportedMandatoryRoles()
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
uno::Sequence< OUString > aMandRolesSeq(4); uno::Sequence< OUString > aMandRolesSeq(4);
aMandRolesSeq.realloc( 4 );
aMandRolesSeq[0] = "label"; aMandRolesSeq[0] = "label";
aMandRolesSeq[1] = "values-x"; aMandRolesSeq[1] = "values-x";
aMandRolesSeq[2] = "values-y"; aMandRolesSeq[2] = "values-y";
@@ -175,6 +174,15 @@ uno::Sequence< OUString > SAL_CALL BubbleChartType::getSupportedMandatoryRoles()
return aMandRolesSeq; 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() OUString SAL_CALL BubbleChartType::getRoleOfSequenceForSeriesLabel()
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {

View File

@@ -48,6 +48,9 @@ protected:
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
getSupportedMandatoryRoles() getSupportedMandatoryRoles()
throw (::com::sun::star::uno::RuntimeException, std::exception); 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 virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL
createCoordinateSystem( ::sal_Int32 DimensionCount ) createCoordinateSystem( ::sal_Int32 DimensionCount )
throw (::com::sun::star::lang::IllegalArgumentException, throw (::com::sun::star::lang::IllegalArgumentException,

View File

@@ -122,6 +122,12 @@ Sequence< OUString > SAL_CALL ChartType::getSupportedOptionalRoles()
return Sequence< OUString >(); return Sequence< OUString >();
} }
Sequence< OUString > SAL_CALL ChartType::getSupportedPropertyRoles()
throw (uno::RuntimeException, std::exception)
{
return Sequence< OUString >();
}
OUString SAL_CALL ChartType::getRoleOfSequenceForSeriesLabel() OUString SAL_CALL ChartType::getRoleOfSequenceForSeriesLabel()
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {

View File

@@ -80,6 +80,9 @@ protected:
throw (::com::sun::star::uno::RuntimeException, std::exception); throw (::com::sun::star::uno::RuntimeException, std::exception);
virtual OUString SAL_CALL getRoleOfSequenceForSeriesLabel() virtual OUString SAL_CALL getRoleOfSequenceForSeriesLabel()
throw (::com::sun::star::uno::RuntimeException, std::exception); 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 ____ // ____ XDataSeriesContainer ____
virtual void SAL_CALL addDataSeries( virtual void SAL_CALL addDataSeries(

View File

@@ -72,6 +72,12 @@ interface XChartType : com::sun::star::uno::XInterface
*/ */
sequence< string > getSupportedOptionalRoles(); sequence< string > getSupportedOptionalRoles();
/** Returns a sequence with supported property mapping roles.
<p>An example for a property mappong role is FillColor.</p>
*/
sequence< string > getSupportedPropertyRoles();
/** Returns the role of the XLabeledDataSequence of /** Returns the role of the XLabeledDataSequence of
which the label will be taken to identify the which the label will be taken to identify the
DataSeries in dialogs or the legend. DataSeries in dialogs or the legend.