Kaydet (Commit) 1e9993be authored tarafından Markus Mohrhard's avatar Markus Mohrhard Kaydeden (comit) Markus Mohrhard

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

Change-Id: I7889dbddab603d7650d58a04f53e7c5fe38fcce2
üst caac9026
......@@ -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 ) );
......
......@@ -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();
......
......@@ -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)
{
......
......@@ -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)
{
......
......@@ -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,
......
......@@ -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)
{
......
......@@ -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(
......
......@@ -72,6 +72,12 @@ interface XChartType : com::sun::star::uno::XInterface
*/
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
which the label will be taken to identify the
DataSeries in dialogs or the legend.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment