openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1498356 - in /openoffice/trunk/main/chart2/source: inc/InternalDataProvider.hxx tools/ChartModelHelper.cxx tools/InternalDataProvider.cxx
Date Mon, 01 Jul 2013 10:43:34 GMT
Author: alg
Date: Mon Jul  1 10:43:33 2013
New Revision: 1498356

URL: http://svn.apache.org/r1498356
Log:
i120559 Corrected load for charts without RangeString bu twith local row-oriented data

Modified:
    openoffice/trunk/main/chart2/source/inc/InternalDataProvider.hxx
    openoffice/trunk/main/chart2/source/tools/ChartModelHelper.cxx
    openoffice/trunk/main/chart2/source/tools/InternalDataProvider.cxx

Modified: openoffice/trunk/main/chart2/source/inc/InternalDataProvider.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/chart2/source/inc/InternalDataProvider.hxx?rev=1498356&r1=1498355&r2=1498356&view=diff
==============================================================================
--- openoffice/trunk/main/chart2/source/inc/InternalDataProvider.hxx (original)
+++ openoffice/trunk/main/chart2/source/inc/InternalDataProvider.hxx Mon Jul  1 10:43:33 2013
@@ -75,8 +75,13 @@ class InternalDataProvider :
 {
 public:
     explicit InternalDataProvider(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext
> & _xContext);
-    explicit InternalDataProvider( const ::com::sun::star::uno::Reference<
-                                       ::com::sun::star::chart2::XChartDocument > &
xChartDoc, bool bConnectToModel );
+    
+    // #120559# allow handing over a default for data orientation (DataInColumns) that will
+    // be used when no data is available
+    explicit InternalDataProvider( 
+        const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument
> & xChartDoc, 
+        bool bConnectToModel, 
+        bool bDefaultDataInColumns );
     explicit InternalDataProvider( const InternalDataProvider & rOther );
 	virtual ~InternalDataProvider();
 

Modified: openoffice/trunk/main/chart2/source/tools/ChartModelHelper.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/chart2/source/tools/ChartModelHelper.cxx?rev=1498356&r1=1498355&r2=1498356&view=diff
==============================================================================
--- openoffice/trunk/main/chart2/source/tools/ChartModelHelper.cxx (original)
+++ openoffice/trunk/main/chart2/source/tools/ChartModelHelper.cxx Mon Jul  1 10:43:33 2013
@@ -43,6 +43,9 @@
 // header for define DBG_ASSERT
 #include <tools/debug.hxx>
 
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+
 //.............................................................................
 namespace chart
 {
@@ -59,7 +62,35 @@ uno::Reference< chart2::data::XRangeHigh
 uno::Reference< chart2::data::XDataProvider > ChartModelHelper::createInternalDataProvider(
     const uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc,
bool bConnectToModel )
 {
-    return new InternalDataProvider( xChartDoc, bConnectToModel );
+    bool bDefaultDataInColumns(true);
+
+    // #120559# Try to access the current state of "DataRowSource" fo rthe chart data and
+    // use it as default for creating a new InternalDataProvider
+    if(xChartDoc.is())
+    {
+        ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDocument >
xDoc(xChartDoc, uno::UNO_QUERY);
+
+        if(xDoc.is())
+        {
+            ::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram > aDiagram
= xDoc->getDiagram();
+
+            if(aDiagram.is())
+            {
+                ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet
> xProp(aDiagram, uno::UNO_QUERY);
+
+                if(xProp.is())
+                {
+                    ::com::sun::star::chart::ChartDataRowSource aDataRowSource(::com::sun::star::chart::ChartDataRowSource_COLUMNS);
+
+                    xProp->getPropertyValue( ::rtl::OUString::createFromAscii("DataRowSource"))
>>= aDataRowSource;
+
+                    bDefaultDataInColumns = (::com::sun::star::chart::ChartDataRowSource_COLUMNS
== aDataRowSource);
+                }
+            }
+        }
+    }
+
+    return new InternalDataProvider( xChartDoc, bConnectToModel, bDefaultDataInColumns );
 }
 
 uno::Reference< XDiagram > ChartModelHelper::findDiagram( const uno::Reference<
frame::XModel >& xModel )

Modified: openoffice/trunk/main/chart2/source/tools/InternalDataProvider.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/chart2/source/tools/InternalDataProvider.cxx?rev=1498356&r1=1498355&r2=1498356&view=diff
==============================================================================
--- openoffice/trunk/main/chart2/source/tools/InternalDataProvider.cxx (original)
+++ openoffice/trunk/main/chart2/source/tools/InternalDataProvider.cxx Mon Jul  1 10:43:33
2013
@@ -337,8 +337,11 @@ InternalDataProvider::InternalDataProvid
     : m_bDataInColumns( true )
 {}
 
-InternalDataProvider::InternalDataProvider( const Reference< chart2::XChartDocument >
& xChartDoc, bool bConnectToModel )
-    : m_bDataInColumns( true )
+InternalDataProvider::InternalDataProvider( 
+    const Reference< chart2::XChartDocument > & xChartDoc, 
+    bool bConnectToModel,
+    bool bDefaultDataInColumns)
+:   m_bDataInColumns( bDefaultDataInColumns )
 {
     try
     {
@@ -353,7 +356,15 @@ InternalDataProvider::InternalDataProvid
                 bool bFirstCellAsLabel = true;
                 bool bHasCategories = true;
                 uno::Sequence< sal_Int32 > aSequenceMapping;
-                DataSourceHelper::detectRangeSegmentation( xChartModel, aRangeString, aSequenceMapping,
m_bDataInColumns, bFirstCellAsLabel, bHasCategories );
+                const bool bSomethingDetected(
+                    DataSourceHelper::detectRangeSegmentation( 
+                        xChartModel, aRangeString, aSequenceMapping, m_bDataInColumns, bFirstCellAsLabel,
bHasCategories ));
+
+                // #120559# if no data was available, restore default
+                if(!bSomethingDetected && m_bDataInColumns != bDefaultDataInColumns)
+                {
+                    m_bDataInColumns = bDefaultDataInColumns;
+                }
             }
 
             // categories



Mime
View raw message