[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - 3 commits - chart2/source include/oox oox/source sc/source

Muthu Subramanian sumuthu at suse.com
Thu Oct 17 04:37:10 PDT 2013


 chart2/source/view/axes/VCartesianAxis.cxx |    8 ++++++++
 include/oox/core/xmlfilterbase.hxx         |    3 +++
 oox/source/drawingml/shape.cxx             |   15 +++++++++++++++
 sc/source/filter/inc/excelfilter.hxx       |    1 +
 sc/source/filter/inc/workbookhelper.hxx    |    4 +++-
 sc/source/filter/oox/excelfilter.cxx       |    5 +++++
 sc/source/filter/oox/workbookhelper.cxx    |   21 ++++++++++++++++++---
 7 files changed, 53 insertions(+), 4 deletions(-)

New commits:
commit 1328bc86b724980ceee39f5a38bcb6f1989ff2da
Author: Muthu Subramanian <sumuthu at suse.com>
Date:   Tue Jul 9 14:00:21 2013 +0530

    n#819822: Crash fix, check validity.

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index a929262..64a7ab5 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -717,7 +717,7 @@ void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >&
                     {
                         Reference< chart2::data::XDataReceiver > xDataRec( xChartDoc, UNO_QUERY );
                         Reference< chart2::data::XDataSource > xData( xDataRec->getUsedData(), UNO_QUERY );
-                        if( xData->getDataSequences()[0]->getValues()->getData().getLength() <= 0 )
+                        if( xData->getDataSequences().getLength() <= 0 || xData->getDataSequences()[0]->getValues()->getData().getLength() <= 0 )
                         {
                             rFilter.useInternalChartDataTable( true );
                             rFilter.getChartConverter()->convertFromModel( rFilter, aModel, xChartDoc, xExternalPage, mxShape->getPosition(), mxShape->getSize() );
commit 4db2664536d5d442775f05c4e013f04405b13150
Author: Muthu Subramanian <sumuthu at suse.com>
Date:   Tue Jul 9 13:31:16 2013 +0530

    n#819822: XLSX Chart import with internal data table.
    
    When the import with xlsx ranges fail - try with
    internal data table.

diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx
index 4b5c1e0..5bddea4 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -90,6 +90,9 @@ public:
         converter object, that should be global per imported document. */
     virtual ::oox::drawingml::chart::ChartConverter* getChartConverter() = 0;
 
+    /** Helper to switch chart data table - specifically for xlsx imports */
+     virtual void useInternalChartDataTable( bool /*bInternal*/ ) { }
+
     /** Has to be implemented by each filter to return the table style list. */
     virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() = 0;
 
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 9715973..a929262 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -52,6 +52,7 @@
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <com/sun/star/document/XActionLockable.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
 
 using namespace ::oox::core;
 using namespace ::com::sun::star;
@@ -710,7 +711,21 @@ void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >&
                 if( !mxChartShapeInfo->mbEmbedShapes )
                     xExternalPage = rxShapes;
                 if( rFilter.getChartConverter() )
+                {
                     rFilter.getChartConverter()->convertFromModel( rFilter, aModel, xChartDoc, xExternalPage, mxShape->getPosition(), mxShape->getSize() );
+                    if( !xChartDoc->hasInternalDataProvider() )
+                    {
+                        Reference< chart2::data::XDataReceiver > xDataRec( xChartDoc, UNO_QUERY );
+                        Reference< chart2::data::XDataSource > xData( xDataRec->getUsedData(), UNO_QUERY );
+                        if( xData->getDataSequences()[0]->getValues()->getData().getLength() <= 0 )
+                        {
+                            rFilter.useInternalChartDataTable( true );
+                            rFilter.getChartConverter()->convertFromModel( rFilter, aModel, xChartDoc, xExternalPage, mxShape->getPosition(), mxShape->getSize() );
+                            rFilter.useInternalChartDataTable( false );
+                        }
+                    }
+
+                }
             }
             catch( Exception& )
             {
diff --git a/sc/source/filter/inc/excelfilter.hxx b/sc/source/filter/inc/excelfilter.hxx
index fc108c3..de7d6df 100644
--- a/sc/source/filter/inc/excelfilter.hxx
+++ b/sc/source/filter/inc/excelfilter.hxx
@@ -61,6 +61,7 @@ public:
     virtual ::oox::vml::Drawing* getVmlDrawing();
     virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles();
     virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
+    virtual void useInternalChartDataTable( bool bInternal );
 
     virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rDescriptor ) throw( ::com::sun::star::uno::RuntimeException );
 
diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx
index fa1ce19..f4ce1cc 100644
--- a/sc/source/filter/inc/workbookhelper.hxx
+++ b/sc/source/filter/inc/workbookhelper.hxx
@@ -23,6 +23,7 @@
 #include <boost/shared_ptr.hpp>
 #include <rtl/ref.hxx>
 #include "oox/helper/storagebase.hxx"
+#include "oox/drawingml/chart/chartconverter.hxx"
 #include "biffhelper.hxx"
 #include "rangenam.hxx"
 
@@ -144,6 +145,7 @@ public:
     void                setCurrentSheetIndex( sal_Int16 nSheet );
     /** Final conversion after importing the workbook. */
     void                finalizeWorkbookImport();
+    void                useInternalChartDataTable( bool bInternal );
 
     // document model ---------------------------------------------------------
     ScDocument& getScDocument() const;
@@ -248,7 +250,7 @@ public:
     /** Returns the converter for string to cell address/range conversion. */
     AddressConverter&   getAddressConverter() const;
     /** Returns the chart object converter. */
-    ExcelChartConverter* getChartConverter() const;
+    oox::drawingml::chart::ChartConverter* getChartConverter() const;
     /** Returns the page and print settings converter. */
     PageSettingsConverter& getPageSettingsConverter() const;
 
diff --git a/sc/source/filter/oox/excelfilter.cxx b/sc/source/filter/oox/excelfilter.cxx
index b54d09c..333e3a5 100644
--- a/sc/source/filter/oox/excelfilter.cxx
+++ b/sc/source/filter/oox/excelfilter.cxx
@@ -157,6 +157,11 @@ const TableStyleListPtr ExcelFilter::getTableStyles()
     return WorkbookHelper( getWorkbookGlobals() ).getChartConverter();
 }
 
+void ExcelFilter::useInternalChartDataTable( bool bInternal )
+{
+    return WorkbookHelper( getWorkbookGlobals() ).useInternalChartDataTable( bInternal );
+}
+
 GraphicHelper* ExcelFilter::implCreateGraphicHelper() const
 {
     return new ExcelGraphicHelper( getWorkbookGlobals() );
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 09c6947..8a180eb 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -178,6 +178,8 @@ public:
     Reference< XDatabaseRange > createUnnamedDatabaseRangeObject( const CellRangeAddress& rRangeAddr ) const;
     /** Creates and returns a com.sun.star.style.Style object for cells or pages. */
     Reference< XStyle > createStyleObject( OUString& orStyleName, bool bPageStyle ) const;
+    /** Helper to switch chart data table - specifically for xlsx imports */
+    void useInternalChartDataTable( bool bInternal );
 
     // buffers ----------------------------------------------------------------
 
@@ -218,7 +220,7 @@ public:
     /** Returns the converter for string to cell address/range conversion. */
     inline AddressConverter& getAddressConverter() const { return *mxAddrConverter; }
     /** Returns the chart object converter. */
-    inline ExcelChartConverter* getChartConverter() const { return mxChartConverter.get(); }
+    inline oox::drawingml::chart::ChartConverter* getChartConverter() const { return mxChartConverter.get(); }
     /** Returns the page/print settings converter. */
     inline PageSettingsConverter& getPageSettingsConverter() const { return *mxPageSettConverter; }
 
@@ -262,7 +264,7 @@ private:
     typedef ::std::auto_ptr< FormulaParser >            FormulaParserPtr;
     typedef ::std::auto_ptr< UnitConverter >            UnitConvPtr;
     typedef ::std::auto_ptr< AddressConverter >         AddressConvPtr;
-    typedef ::std::auto_ptr< ExcelChartConverter >      ExcelChartConvPtr;
+    typedef ::std::auto_ptr< oox::drawingml::chart::ChartConverter >      ExcelChartConvPtr;
     typedef ::std::auto_ptr< PageSettingsConverter >    PageSettConvPtr;
     typedef ::std::auto_ptr< BiffCodecHelper >          BiffCodecHelperPtr;
 
@@ -507,6 +509,14 @@ Reference< XStyle > WorkbookGlobals::createStyleObject( OUString& orStyleName, b
     return xStyle;
 }
 
+void WorkbookGlobals::useInternalChartDataTable( bool bInternal )
+{
+    if( bInternal )
+        mxChartConverter.reset( new oox::drawingml::chart::ChartConverter() );
+    else
+        mxChartConverter.reset( new ExcelChartConverter( *this ) );
+}
+
 // BIFF specific --------------------------------------------------------------
 
 // private --------------------------------------------------------------------
@@ -897,11 +907,16 @@ AddressConverter& WorkbookHelper::getAddressConverter() const
     return mrBookGlob.getAddressConverter();
 }
 
-ExcelChartConverter* WorkbookHelper::getChartConverter() const
+oox::drawingml::chart::ChartConverter* WorkbookHelper::getChartConverter() const
 {
     return mrBookGlob.getChartConverter();
 }
 
+void WorkbookHelper::useInternalChartDataTable( bool bInternal )
+{
+    mrBookGlob.useInternalChartDataTable( bInternal );
+}
+
 PageSettingsConverter& WorkbookHelper::getPageSettingsConverter() const
 {
     return mrBookGlob.getPageSettingsConverter();
commit e3af0e4f7d3d4921cc984bf00416de4ceda3dc97
Author: Muthu Subramanian <sumuthu at suse.com>
Date:   Thu Jun 27 18:46:47 2013 +0530

    n#820273: Multilevel labels are rotated.
    
    It looks odd when multilevel labels are rotated as well.
    This patch resets the rotation values for outer labels.

diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 5e193ac..6d0e7b6 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -1529,6 +1529,14 @@ void VCartesianAxis::updatePositions()
                         ,static_cast<sal_Int32>(aTickScreenPos2D.getY()));
 
                     double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
+                    if( nDepth > 0 )
+                    {
+                        /* Multi-level Labels: default to 0 or 90 */
+                        if( pTickFactory2D->isHorizontalAxis() )
+                            fRotationAngleDegree = 0.0;
+                        else
+                            fRotationAngleDegree = 90;
+                    }
 
                     // #i78696# use mathematically correct rotation now
                     const double fRotationAnglePi(fRotationAngleDegree * (F_PI / -180.0));


More information about the Libreoffice-commits mailing list