[Libreoffice-commits] core.git: 8 commits - chart2/source offapi/com

Markus Mohrhard markus.mohrhard at collabora.co.uk
Sun Mar 9 11:29:21 PDT 2014


 chart2/source/controller/dialogs/DialogModel.cxx         |    4 
 chart2/source/controller/dialogs/Strings.src             |   10 ++
 chart2/source/controller/dialogs/dlg_PropertyMapping.cxx |   61 ++++++++++++++-
 chart2/source/controller/dialogs/dlg_PropertyMapping.hxx |   13 ++-
 chart2/source/controller/dialogs/tp_DataSource.cxx       |   22 ++++-
 chart2/source/inc/Strings.hrc                            |    5 -
 chart2/source/model/template/BarChartType.cxx            |   10 ++
 chart2/source/model/template/BarChartType.hxx            |    3 
 chart2/source/model/template/BubbleChartType.cxx         |   10 ++
 chart2/source/model/template/BubbleChartType.hxx         |    3 
 chart2/source/model/template/ChartType.cxx               |    6 +
 chart2/source/model/template/ChartType.hxx               |    3 
 chart2/source/model/template/ColumnChartType.cxx         |   10 ++
 chart2/source/model/template/ColumnChartType.hxx         |    3 
 chart2/source/model/template/PieChartType.cxx            |   10 ++
 chart2/source/model/template/PieChartType.hxx            |    3 
 chart2/source/model/template/ScatterChartType.cxx        |    6 -
 chart2/source/model/template/ScatterChartType.hxx        |    3 
 offapi/com/sun/star/chart2/XChartType.idl                |    6 +
 19 files changed, 169 insertions(+), 22 deletions(-)

New commits:
commit d7bb16fde85f42e36f35607b0bd7ccc6627952b7
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Mar 9 19:24:14 2014 +0100

    disable property mapping for unsupported chart types
    
    Change-Id: I1c7c3bebe71029787796c21706088784c4934954

diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index f15f2e1..11b0b7c 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -470,6 +470,12 @@ void DataSourceTabPage::fillRoleListBox()
         }
 
         m_pLB_ROLE->SetUpdateMode( sal_True );
+
+        if(pSeriesEntry->m_xChartType
+                ->getSupportedPropertyRoles().getLength() == 0)
+            m_pBtn_AddMapping->Disable();
+        else
+            m_pBtn_AddMapping->Enable();
     }
 }
 
commit 835c637d497a37d78b599669b54934d84e0daa4d
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Mar 9 19:19:56 2014 +0100

    the method is static
    
    Change-Id: Ie6953bbb4eca365124a3408f71ef43cb424ec343

diff --git a/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx b/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
index 45ae798..c3b4ccf 100644
--- a/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
+++ b/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
@@ -42,8 +42,7 @@ std::vector<OUString> getEntries()
 
 }
 
-PropertyMappingDlg::PropertyMappingDlg(Window* pParent, uno::Reference< chart2::XChartType > xChartType,
-        DialogModel& rDialogModel)
+PropertyMappingDlg::PropertyMappingDlg(Window* pParent, uno::Reference< chart2::XChartType > xChartType )
     : ModalDialog(pParent, "PropertyMappingDialog",
         "modules/schart/ui/dlg_PropertyMapping.ui")
 {
@@ -55,7 +54,7 @@ PropertyMappingDlg::PropertyMappingDlg(Window* pParent, uno::Reference< chart2::
     uno::Sequence< OUString > aPropRoles = xChartType->getSupportedPropertyRoles();
     for(sal_Int32 i = 0, n = aPropRoles.getLength(); i < n; ++i)
     {
-        OUString aUIString = rDialogModel.ConvertRoleFromInternalToUI(aPropRoles[i]);
+        OUString aUIString = DialogModel::ConvertRoleFromInternalToUI(aPropRoles[i]);
         mpMappingTable->InsertEntry(aUIString);
     }
     mpBtnOk->SetClickHdl( LINK( this, PropertyMappingDlg, OkBtnHdl ) );
diff --git a/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx b/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
index 96d1e16..35dc8de 100644
--- a/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
+++ b/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
@@ -25,7 +25,7 @@ class PropertyMappingDlg : public ModalDialog
 public:
 
     PropertyMappingDlg(Window* pParent, com::sun::star::uno::Reference<
-            com::sun::star::chart2::XChartType > xChartType, DialogModel& rDialogModel);
+            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 76b1e85..f15f2e1 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -765,7 +765,7 @@ IMPL_LINK_NOARG( DataSourceTabPage, AddMappingHdl )
     if(!pSeriesEntry)
         return 0;
 
-    PropertyMappingDlg aDlg(this, pSeriesEntry->m_xChartType, m_rDialogModel);
+    PropertyMappingDlg aDlg(this, pSeriesEntry->m_xChartType);
     short aRet = aDlg.Execute();
     if(aRet == RET_OK)
     {
commit fc9c196df1fabcf71637cf10f63a87be65071056
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Mar 9 19:15:44 2014 +0100

    add property mapping to a few more chart types
    
    Change-Id: If02f865741524f74277b77615dea1bc71fb576eb

diff --git a/chart2/source/model/template/BarChartType.cxx b/chart2/source/model/template/BarChartType.cxx
index 2645c6c..00c0e53 100644
--- a/chart2/source/model/template/BarChartType.cxx
+++ b/chart2/source/model/template/BarChartType.cxx
@@ -53,6 +53,16 @@ OUString SAL_CALL BarChartType::getChartType()
     return CHART2_SERVICE_NAME_CHARTTYPE_BAR;
 }
 
+uno::Sequence< OUString > BarChartType::getSupportedPropertyRoles()
+    throw (uno::RuntimeException, std::exception)
+{
+    uno::Sequence< OUString > aPropRoles(2);
+    aPropRoles[0] = "FillColor";
+    aPropRoles[1] = "BorderColor";
+
+    return aPropRoles;
+}
+
 uno::Sequence< OUString > BarChartType::getSupportedServiceNames_Static()
 {
     uno::Sequence< OUString > aServices( 2 );
diff --git a/chart2/source/model/template/BarChartType.hxx b/chart2/source/model/template/BarChartType.hxx
index e04e882..4f6c980 100644
--- a/chart2/source/model/template/BarChartType.hxx
+++ b/chart2/source/model/template/BarChartType.hxx
@@ -44,6 +44,9 @@ protected:
     // ____ XChartType ____
     virtual OUString SAL_CALL getChartType()
         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);
 
     // ____ XCloneable ____
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
diff --git a/chart2/source/model/template/ColumnChartType.cxx b/chart2/source/model/template/ColumnChartType.cxx
index ccc0563..4357b6a 100644
--- a/chart2/source/model/template/ColumnChartType.cxx
+++ b/chart2/source/model/template/ColumnChartType.cxx
@@ -152,6 +152,16 @@ OUString SAL_CALL ColumnChartType::getChartType()
     return CHART2_SERVICE_NAME_CHARTTYPE_COLUMN;
 }
 
+uno::Sequence< OUString > ColumnChartType::getSupportedPropertyRoles()
+    throw (uno::RuntimeException, std::exception)
+{
+    uno::Sequence< OUString > aPropRoles(2);
+    aPropRoles[0] = "FillColor";
+    aPropRoles[1] = "BorderColor";
+
+    return aPropRoles;
+}
+
 // ____ OPropertySet ____
 uno::Any ColumnChartType::GetDefaultValue( sal_Int32 nHandle ) const
     throw(beans::UnknownPropertyException)
diff --git a/chart2/source/model/template/ColumnChartType.hxx b/chart2/source/model/template/ColumnChartType.hxx
index 3a03bba..dcfdf3e 100644
--- a/chart2/source/model/template/ColumnChartType.hxx
+++ b/chart2/source/model/template/ColumnChartType.hxx
@@ -44,6 +44,9 @@ protected:
     // ____ XChartType ____
     virtual OUString SAL_CALL getChartType()
         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);
 
     // ____ OPropertySet ____
     virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
diff --git a/chart2/source/model/template/PieChartType.cxx b/chart2/source/model/template/PieChartType.cxx
index 8fdd25d..1013359 100644
--- a/chart2/source/model/template/PieChartType.cxx
+++ b/chart2/source/model/template/PieChartType.cxx
@@ -195,6 +195,16 @@ Reference< chart2::XCoordinateSystem > SAL_CALL
     return xResult;
 }
 
+uno::Sequence< OUString > PieChartType::getSupportedPropertyRoles()
+    throw (uno::RuntimeException, std::exception)
+{
+    uno::Sequence< OUString > aPropRoles(2);
+    aPropRoles[0] = "FillColor";
+    aPropRoles[1] = "BorderColor";
+
+    return aPropRoles;
+}
+
 // ____ OPropertySet ____
 uno::Any PieChartType::GetDefaultValue( sal_Int32 nHandle ) const
     throw(beans::UnknownPropertyException)
diff --git a/chart2/source/model/template/PieChartType.hxx b/chart2/source/model/template/PieChartType.hxx
index aefd34c..c4bdfc1 100644
--- a/chart2/source/model/template/PieChartType.hxx
+++ b/chart2/source/model/template/PieChartType.hxx
@@ -49,6 +49,9 @@ protected:
         createCoordinateSystem( ::sal_Int32 DimensionCount )
         throw (::com::sun::star::lang::IllegalArgumentException,
                ::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);
 
     // ____ OPropertySet ____
     virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
commit 6d7514357bf50ab0555228db59bb1baa3f31ca03
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Mar 9 19:08:51 2014 +0100

    use localized names instead of the internal ones
    
    Change-Id: Idd5d5def2550f8ba98f4e8a8a17330a4b663862e

diff --git a/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx b/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
index a10c84f..45ae798 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"
 
+#include "DialogModel.hxx"
+
 using namespace com::sun::star;
 
 namespace chart {
@@ -40,7 +42,8 @@ std::vector<OUString> getEntries()
 
 }
 
-PropertyMappingDlg::PropertyMappingDlg(Window* pParent, uno::Reference< chart2::XChartType > xChartType )
+PropertyMappingDlg::PropertyMappingDlg(Window* pParent, uno::Reference< chart2::XChartType > xChartType,
+        DialogModel& rDialogModel)
     : ModalDialog(pParent, "PropertyMappingDialog",
         "modules/schart/ui/dlg_PropertyMapping.ui")
 {
@@ -52,7 +55,8 @@ PropertyMappingDlg::PropertyMappingDlg(Window* pParent, uno::Reference< chart2::
     uno::Sequence< OUString > aPropRoles = xChartType->getSupportedPropertyRoles();
     for(sal_Int32 i = 0, n = aPropRoles.getLength(); i < n; ++i)
     {
-        mpMappingTable->InsertEntry(aPropRoles[i]);
+        OUString aUIString = rDialogModel.ConvertRoleFromInternalToUI(aPropRoles[i]);
+        mpMappingTable->InsertEntry(aUIString);
     }
     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 0c20de5..96d1e16 100644
--- a/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
+++ b/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
@@ -18,12 +18,14 @@
 
 namespace chart {
 
+class DialogModel;
+
 class PropertyMappingDlg : public ModalDialog
 {
 public:
 
     PropertyMappingDlg(Window* pParent, com::sun::star::uno::Reference<
-            com::sun::star::chart2::XChartType > xChartType);
+            com::sun::star::chart2::XChartType > xChartType, DialogModel& rDialogModel);
 
     OUString getSelectedEntry();
 
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index f15f2e1..76b1e85 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -765,7 +765,7 @@ IMPL_LINK_NOARG( DataSourceTabPage, AddMappingHdl )
     if(!pSeriesEntry)
         return 0;
 
-    PropertyMappingDlg aDlg(this, pSeriesEntry->m_xChartType);
+    PropertyMappingDlg aDlg(this, pSeriesEntry->m_xChartType, m_rDialogModel);
     short aRet = aDlg.Execute();
     if(aRet == RET_OK)
     {
commit 1e9993be107905fdbcbf095b55bb2ae6a493600b
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Mar 9 19:02:03 2014 +0100

    don't hardcode property mapping, read them from chart2::XChartType
    
    Change-Id: I7889dbddab603d7650d58a04f53e7c5fe38fcce2

diff --git a/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx b/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
index 0f193b8..a10c84f 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 e6a6b4b..0c20de5 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 12533aa..f15f2e1 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 1b68d5b..999fe50 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 03de9db..c6cec1f 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 fa652c8..7c58577 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 f450aa3..3e36bf8 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(
diff --git a/offapi/com/sun/star/chart2/XChartType.idl b/offapi/com/sun/star/chart2/XChartType.idl
index f02b25b..5dfe21f 100644
--- a/offapi/com/sun/star/chart2/XChartType.idl
+++ b/offapi/com/sun/star/chart2/XChartType.idl
@@ -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.
commit caac9026f6532483e0ae1fa09a36a4fc0e92aa8a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Mar 9 18:45:58 2014 +0100

    improve the property mapping dialog
    
    Change-Id: I0dbb44febb058a3b33030aa1fa86d850e71eef48

diff --git a/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx b/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
index 8022c5d..0f193b8 100644
--- a/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
+++ b/chart2/source/controller/dialogs/dlg_PropertyMapping.cxx
@@ -13,12 +13,29 @@ namespace chart {
 
 namespace {
 
-static long pListBoxTabs[] =
+long pListBoxTabs[] =
 {
     3,
-    0, 0, 75
+    0, 75, 150
 };
 
+std::vector<OUString> getEntries()
+{
+    const char* pEntries[] =
+    {
+        "FillColor\tColor",
+        "BorderColor\tColor"
+    };
+
+    std::vector<OUString> aRet;
+    for(size_t i = 0; i < SAL_N_ELEMENTS(pEntries); ++i)
+    {
+        aRet.push_back(OUString::createFromAscii(pEntries[i]));
+    }
+
+    return aRet;
+}
+
 }
 
 PropertyMappingDlg::PropertyMappingDlg(Window* pParent)
@@ -26,8 +43,42 @@ PropertyMappingDlg::PropertyMappingDlg(Window* pParent)
         "modules/schart/ui/dlg_PropertyMapping.ui")
 {
     get(mpMappingTable, "LST_PROPERTY_MAPPING");
+    get(mpBtnOk, "ok");
+    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)
+    {
+        mpMappingTable->InsertEntry(*itr);
+    }
+    mpBtnOk->SetClickHdl( LINK( this, PropertyMappingDlg, OkBtnHdl ) );
+    mpBtnCancel->SetClickHdl( LINK( this, PropertyMappingDlg, CancelBtnHdl ) );
+}
+
+OUString PropertyMappingDlg::getSelectedEntry()
+{
+    if(mpMappingTable->GetSelectionCount())
+    {
+        SvTreeListEntry* pEntry = mpMappingTable->FirstSelected();
+        OUString aText = mpMappingTable->GetEntryText(pEntry, 0);
+        return aText;
+    }
+
+    return OUString();
+}
+
+IMPL_LINK_NOARG(PropertyMappingDlg, OkBtnHdl)
+{
+    EndDialog(RET_OK);
+    return 0;
+}
+
+IMPL_LINK_NOARG(PropertyMappingDlg, CancelBtnHdl)
+{
+    EndDialog(RET_CANCEL);
+    return 0;
 }
 
 }
diff --git a/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx b/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
index 3240a30..e6a6b4b 100644
--- a/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
+++ b/chart2/source/controller/dialogs/dlg_PropertyMapping.hxx
@@ -11,6 +11,7 @@
 #define CHART2_PROPERTY_MAPPING_HXX
 
 #include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
 #include <svtools/svtabbx.hxx>
 
 namespace chart {
@@ -25,7 +26,12 @@ public:
 
 private:
 
+    DECL_LINK( OkBtnHdl, void* );
+    DECL_LINK( CancelBtnHdl, void* );
+
     SvTabListBox* mpMappingTable;
+    Button* mpBtnOk;
+    Button* mpBtnCancel;
 };
 
 }
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index 60cf54b..12533aa 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -762,9 +762,13 @@ IMPL_LINK( DataSourceTabPage, RangeUpdateDataHdl, Edit*, pEdit )
 IMPL_LINK_NOARG( DataSourceTabPage, AddMappingHdl )
 {
     PropertyMappingDlg aDlg(this);
-    aDlg.Execute();
-    OUString aNewMappingName = "FillColor";
-    m_pLB_ROLE->InsertEntry( lcl_GetRoleLBEntry( aNewMappingName, OUString()));
+    short aRet = aDlg.Execute();
+    if(aRet == RET_OK)
+    {
+        OUString aNewMappingName = aDlg.getSelectedEntry();
+        if(!aNewMappingName.isEmpty())
+            m_pLB_ROLE->InsertEntry( lcl_GetRoleLBEntry( aNewMappingName, OUString()));
+    }
 
     return 0;
 }
commit bc338f4afc4126b37b3183182016ff4173cadeb8
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Mar 9 17:53:24 2014 +0100

    improve the handling of property mapping sequences
    
    Change-Id: I4ddd656a41ab975786ce6e5cd05597f6b773b334

diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
index b88581f..45f57c9 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -94,6 +94,8 @@ OUString lcl_ConvertRole( const OUString & rRoleString, bool bFromInternalToUI )
         aTranslationMap[ "values-x" ] =     ::chart::SchResId( STR_DATA_ROLE_X ).toString();
         aTranslationMap[ "values-y" ] =     ::chart::SchResId( STR_DATA_ROLE_Y ).toString();
         aTranslationMap[ "values-size" ] =  ::chart::SchResId( STR_DATA_ROLE_SIZE ).toString();
+        aTranslationMap[ "FillColor" ] =    ::chart::SchResId( STR_PROPERTY_ROLE_FILLCOLOR ).toString();
+        aTranslationMap[ "BorderColor" ] =  ::chart::SchResId( STR_PROPERTY_ROLE_BORDERCOLOR ).toString();
     }
 
     if( bFromInternalToUI )
@@ -216,7 +218,7 @@ struct lcl_RolesWithRangeAppend : public
                 {
                     OUString aRole;
                     Reference< beans::XPropertySet > xProp( xSeq, uno::UNO_QUERY_THROW );
-                    if( xProp->getPropertyValue( "Role") >>= aRole )
+                    if( xProp->getPropertyValue( "Role" ) >>= aRole )
                     {
                         m_rDestCnt.insert(
                             tContainerType::value_type(
diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src
index 6e5d565..4b0f3e3 100644
--- a/chart2/source/controller/dialogs/Strings.src
+++ b/chart2/source/controller/dialogs/Strings.src
@@ -16,6 +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 "Strings.hrc"
 
 String STR_DLG_CHART_WIZARD
@@ -599,7 +600,14 @@ String STR_TEXT_DIRECTION_SUPER
     Text [ en-US ] = "Use superordinate object settings";
 };
 
+String STR_PROPERTY_ROLE_FILLCOLOR
+{
+    Text [ en-US ] = "Fill Color";
+};
 
-
+String STR_PROPERTY_ROLE_BORDERCOLOR
+{
+    Text [ en-US ] = "Border Color";
+};
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc
index ae5c320..15c1ca8 100644
--- a/chart2/source/inc/Strings.hrc
+++ b/chart2/source/inc/Strings.hrc
@@ -22,8 +22,7 @@
 // this includes no link dependency
 #include <svl/solar.hrc>
 
-//next free is 303
-
+//next free is 305
 
 //chart types
 //see Strings_ChartTypes.src
@@ -111,6 +110,8 @@
 #define STR_DATA_ROLE_MAX                   (RID_APP_START + 249)
 #define STR_DATA_ROLE_CATEGORIES            (RID_APP_START + 260)
 #define STR_DATA_ROLE_SIZE                  (RID_APP_START + 284)
+#define STR_PROPERTY_ROLE_FILLCOLOR         (RID_APP_START + 303)
+#define STR_PROPERTY_ROLE_BORDERCOLOR       (RID_APP_START + 304)
 
 #define STR_DATA_UNNAMED_SERIES             (RID_APP_START + 250)
 #define STR_DATA_UNNAMED_SERIES_WITH_INDEX  (RID_APP_START + 251)
commit 4b9d59dbbbac29748b78b8b47c21fd3426e71e55
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Mar 9 14:04:46 2014 +0100

    no need for overwriting this method
    
    Change-Id: I8d81f9f7d80ceabd85077acd3239069988be3586

diff --git a/chart2/source/model/template/ScatterChartType.cxx b/chart2/source/model/template/ScatterChartType.cxx
index 2a569bb..9f33147 100644
--- a/chart2/source/model/template/ScatterChartType.cxx
+++ b/chart2/source/model/template/ScatterChartType.cxx
@@ -223,12 +223,6 @@ uno::Sequence< OUString > SAL_CALL ScatterChartType::getSupportedMandatoryRoles(
     return aMandRolesSeq;
 }
 
-uno::Sequence< OUString > SAL_CALL ScatterChartType::getSupportedOptionalRoles()
-    throw (uno::RuntimeException, std::exception)
-{
-    return uno::Sequence< OUString >();
-}
-
 // ____ OPropertySet ____
 uno::Any ScatterChartType::GetDefaultValue( sal_Int32 nHandle ) const
     throw(beans::UnknownPropertyException)
diff --git a/chart2/source/model/template/ScatterChartType.hxx b/chart2/source/model/template/ScatterChartType.hxx
index 9f28410..378966d 100644
--- a/chart2/source/model/template/ScatterChartType.hxx
+++ b/chart2/source/model/template/ScatterChartType.hxx
@@ -52,9 +52,6 @@ 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
-        getSupportedOptionalRoles()
-        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,


More information about the Libreoffice-commits mailing list