[Libreoffice-commits] core.git: 3 commits - include/xmloff oox/source xmloff/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Mon Mar 10 06:58:29 PDT 2014


 include/xmloff/xmltoken.hxx                  |    2 +
 oox/source/drawingml/graphicshapecontext.cxx |   14 +++++---
 xmloff/source/chart/SchXMLExport.cxx         |   45 +++++++++++++++++++++++++--
 xmloff/source/core/xmltoken.cxx              |    2 +
 4 files changed, 56 insertions(+), 7 deletions(-)

New commits:
commit 5b12e2bb76d8e9af30672cc34b884c54b5e639f5
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon Mar 10 14:56:26 2014 +0100

    fix OOXML strict chart import
    
    Change-Id: I84a2fd575ced64d4774147063f13ebb8605c100f

diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx
index 3f45f4b..ebd2028 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -122,17 +122,21 @@ ContextHandlerRef GraphicalObjectFrameContext::onCreateContext( sal_Int32 aEleme
         case XML_graphicData :          // CT_GraphicalObjectData
         {
             OUString sUri( rAttribs.getString( XML_uri ).get() );
-            if ( sUri == "http://schemas.openxmlformats.org/presentationml/2006/ole" )
+            if ( sUri == "http://schemas.openxmlformats.org/presentationml/2006/ole" ||
+                    sUri == "http://purl.oclc.org/ooxml/presentationml/ole" )
                 return new OleObjectGraphicDataContext( *this, mpShapePtr );
-            else if ( sUri == "http://schemas.openxmlformats.org/drawingml/2006/diagram" )
+            else if ( sUri == "http://schemas.openxmlformats.org/drawingml/2006/diagram" ||
+                    sUri == "http://purl.oclc.org/ooxml/drawingml/diagram" )
                 return new DiagramGraphicDataContext( *this, mpShapePtr );
-            else if ( sUri == "http://schemas.openxmlformats.org/drawingml/2006/chart" )
+            else if ( sUri == "http://schemas.openxmlformats.org/drawingml/2006/chart" ||
+                    sUri == "http://purl.oclc.org/ooxml/drawingml/chart" )
                 return new ChartGraphicDataContext( *this, mpShapePtr, mbEmbedShapesInChart );
-            else if ( sUri.equalsAscii( "http://schemas.openxmlformats.org/drawingml/2006/table" ) )
+            else if ( sUri == "http://schemas.openxmlformats.org/drawingml/2006/table" ||
+                    sUri == "http://purl.oclc.org/ooxml/drawingml/table" )
                 return new table::TableContext( *this, mpShapePtr );
             else
             {
-                OSL_TRACE( "OOX: Ignore graphicsData of %s", OUSTRING_TO_CSTR( sUri ) );
+                SAL_WARN("oox", "OOX: Ignore graphicsData of :" << sUri );
                 return 0;
             }
         }
commit 37b437dcd686de72e6c78703f351a56e23aef073
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon Mar 10 01:01:24 2014 +0100

    support export of property mapping
    
    Change-Id: I9529eedb9c9c002bfc2fee638938082cef59f185

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 39a6dc9..83d766d 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3212,6 +3212,8 @@ namespace xmloff { namespace token {
 
         XML_MARGIN, // #i117001#
 
+        XML_PROPERTY_MAPPING,
+
         // regina, ODF1.2 additional symbols in charts
         XML_STAR,
         XML_ASTERISK,
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index fd0b08c..6c369ac 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -207,6 +207,11 @@ public:
         const ::com::sun::star::awt::Size & rPageSize,
         sal_Bool bExportContent,
         sal_Bool bHasTwoYAxes );
+
+    void exportPropertyMapping(
+        const com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataSource > & xSource,
+        Sequence< OUString >& rSupportedMappings );
+
     void exportCandleStickSeries(
         const ::com::sun::star::uno::Sequence<
             ::com::sun::star::uno::Reference<
@@ -2874,6 +2879,13 @@ void SchXMLExportHelper_Impl::exportSeries(
                         uno::Reference< beans::XPropertySet >( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ),
                         nSeriesLength, xNewDiagram, bExportContent );
 
+                    const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+                    if( bExportContent && nCurrentODFVersion > SvtSaveOptions::ODFVER_012 )//do not export to ODF 1.2 or older
+                    {
+                        Sequence< OUString > aSupportedMappings = aCTSeq[nCTIdx]->getSupportedPropertyRoles();
+                        exportPropertyMapping( xSource, aSupportedMappings );
+                    }
+
                     // close series element
                     delete pSeries;
                 }
@@ -2883,6 +2895,36 @@ void SchXMLExportHelper_Impl::exportSeries(
     }
 }
 
+void SchXMLExportHelper_Impl::exportPropertyMapping(
+    const Reference< chart2::data::XDataSource > & xSource, Sequence< OUString >& rSupportedMappings )
+{
+    Reference< chart2::XChartDocument > xNewDoc( mrExport.GetModel(), uno::UNO_QUERY );
+    Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeqCnt(
+            xSource->getDataSequences());
+
+    for(sal_Int32 i = 0, n = rSupportedMappings.getLength(); i < n; ++i)
+    {
+        Reference< chart2::data::XLabeledDataSequence > xSequence( lcl_getDataSequenceByRole( aSeqCnt, rSupportedMappings[i] ) );
+        if(xSequence.is())
+        {
+            Reference< chart2::data::XDataSequence > xValues( xSequence->getValues() );
+            if( xValues.is())
+            {
+                mrExport.AddAttribute( XML_NAMESPACE_LO_EXT, XML_PROPERTY, rSupportedMappings[i]);
+                mrExport.AddAttribute( XML_NAMESPACE_LO_EXT, XML_CELL_RANGE_ADDRESS,
+                        lcl_ConvertRange(
+                            xValues->getSourceRangeRepresentation(),
+                            xNewDoc ));
+                SvXMLElementExport( mrExport, XML_NAMESPACE_LO_EXT, XML_PROPERTY_MAPPING, sal_True, sal_True );
+
+                // register range for data table export
+                m_aDataSequencesToExport.push_back( tLabelValuesDataPair(
+                            (uno::Reference< chart2::data::XDataSequence >)0, xValues ));
+            }
+        }
+    }
+}
+
 void SchXMLExportHelper_Impl::exportRegressionCurve(
     const Reference< chart2::XDataSeries >& xSeries,
     const awt::Size& rPageSize,
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 56148dc..47c871a 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3212,6 +3212,8 @@ namespace xmloff { namespace token {
 
         TOKEN( "margin", XML_MARGIN),
 
+        TOKEN( "propertry-mapping", XML_PROPERTY_MAPPING),
+
         // regina, ODF1.2 additional symbols in charts
         TOKEN( "star",                         XML_STAR ),
         TOKEN( "asterisk",                     XML_ASTERISK ),
commit b595df2012d897f0dce4c203a6231a0d8402b068
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Mar 9 21:54:28 2014 +0100

    unnecessary null pointer check before delete
    
    Change-Id: I16d48a501353b45e2d6c8cc0de49f3da0709eabe

diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index bd98517..fd0b08c 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -2875,8 +2875,7 @@ void SchXMLExportHelper_Impl::exportSeries(
                         nSeriesLength, xNewDiagram, bExportContent );
 
                     // close series element
-                    if( pSeries )
-                        delete pSeries;
+                    delete pSeries;
                 }
             }
             aPropertyStates.clear();


More information about the Libreoffice-commits mailing list