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

Caolán McNamara caolanm at redhat.com
Thu Jun 6 04:01:08 PDT 2013


 include/oox/drawingml/chart/converterbase.hxx         |    1 
 oox/source/drawingml/chart/titleconverter.cxx         |   21 ++++++++++++++++--
 writerfilter/source/dmapper/SdtHelper.cxx             |    5 ++--
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |    3 ++
 writerfilter/source/ooxml/OOXMLParserState.cxx        |    3 ++
 5 files changed, 29 insertions(+), 4 deletions(-)

New commits:
commit b5d93a58a7f4e23432f18da0946bac04027c23a8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 6 11:58:23 2013 +0100

    valgrind: uninit variable
    
    Change-Id: I5640291d9e221c9cffd7daec9d46a313fddfaf4e

diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx
index 031b70f..58c092f 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -62,8 +62,9 @@ awt::Size lcl_getOptimalWidth(StyleSheetTablePtr pStyleSheet, OUString& rDefault
     return awt::Size(nWidth + nBorder + nHeight, nHeight + nBorder);
 }
 
-SdtHelper::SdtHelper(DomainMapper_Impl& rDM_Impl):
-    m_rDM_Impl(rDM_Impl)
+SdtHelper::SdtHelper(DomainMapper_Impl& rDM_Impl)
+    : m_rDM_Impl(rDM_Impl)
+    , m_bHasElements(false)
 {
 }
 
commit fa671cecd4bb2f38a0a9171cfdbb56efddda1cfa
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 6 11:41:03 2013 +0100

    add some checks against NULL derefs
    
    Change-Id: I85fbf279991ee361ea081d92d9acc84d36677af1

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index f4a7924..205f821 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1335,6 +1335,9 @@ void OOXMLFastContextHandlerProperties::lcl_endFastElement
     {
         if (isForwardEvents())
         {
+            SAL_WARN_IF(!mpStream, "writerfilter", "no stream to set properties on");
+            if (!mpStream)
+                return;
             mpStream->props(mpPropertySet);
         }
     }
diff --git a/writerfilter/source/ooxml/OOXMLParserState.cxx b/writerfilter/source/ooxml/OOXMLParserState.cxx
index d8b562b..1b9b426 100644
--- a/writerfilter/source/ooxml/OOXMLParserState.cxx
+++ b/writerfilter/source/ooxml/OOXMLParserState.cxx
@@ -125,6 +125,9 @@ OOXMLDocument * OOXMLParserState::getDocument() const
 
 void OOXMLParserState::setXNoteId(const sal_Int32 nId)
 {
+    SAL_WARN_IF(!mpDocument, "writerfilter", "no document to set note id on");
+    if (!mpDocument)
+        return;
     mpDocument->setXNoteId(nId);
 }
 
commit 56ab9c1289ee284fe0f48e46101cbf55e24db1e2
Author: Jian Fang Zhang <zhangjf at apache.org>
Date:   Fri Sep 14 14:00:22 2012 +0000

    Resolves: #i119547# support the chart legend positon of top&&left...
    
    just set the Anchor to Alignment_TOP_RIGHT
    
    Found by: Shan Zhu
    Patch by: zhaoshzh
    Review by: zhangjf
    
    (cherry picked from commit 8de6941efffd22214da577ff637b2522e46c7fa5)
    
    Conflicts:
    	oox/inc/oox/drawingml/chart/converterbase.hxx
    	oox/source/drawingml/chart/titleconverter.cxx
    
    Change-Id: Iad1fe1af8f93e6904759c10a9c9206fd1f1aebbb

diff --git a/include/oox/drawingml/chart/converterbase.hxx b/include/oox/drawingml/chart/converterbase.hxx
index 21a0344..dea77de 100644
--- a/include/oox/drawingml/chart/converterbase.hxx
+++ b/include/oox/drawingml/chart/converterbase.hxx
@@ -140,6 +140,7 @@ public:
     bool                convertFromModel(
                             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
                             double fRotationAngle );
+    bool getAutoLayout(){return mrModel.mbAutoLayout;}
 };
 
 // ============================================================================
diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx
index 32fb37f..533db6a 100644
--- a/oox/source/drawingml/chart/titleconverter.cxx
+++ b/oox/source/drawingml/chart/titleconverter.cxx
@@ -31,7 +31,10 @@
 #include "oox/drawingml/chart/datasourceconverter.hxx"
 #include "oox/drawingml/chart/titlemodel.hxx"
 #include "oox/helper/containerhelper.hxx"
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/drawing/Alignment.hpp>
 
+#include "oox/drawingml/chart/modelbase.hxx"
 namespace oox {
 namespace drawingml {
 namespace chart {
@@ -41,6 +44,7 @@ namespace chart {
 using namespace ::com::sun::star::awt;
 using namespace ::com::sun::star::chart2;
 using namespace ::com::sun::star::chart2::data;
+using namespace ::com::sun::star::drawing;
 using namespace ::com::sun::star::uno;
 
 using ::oox::core::XmlFilterBase;
@@ -204,6 +208,8 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
         // predefined legend position and expansion
         cssc2::LegendPosition eLegendPos = cssc2::LegendPosition_CUSTOM;
         cssc::ChartLegendExpansion eLegendExpand = cssc::ChartLegendExpansion_CUSTOM;
+        RelativePosition eRelPos;
+        bool bTopRight=0;
         switch( mrModel.mnPosition )
         {
             case XML_l:
@@ -211,9 +217,16 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
                 eLegendExpand = cssc::ChartLegendExpansion_HIGH;
             break;
             case XML_r:
-            case XML_tr:    // top-right not supported
                 eLegendPos = cssc2::LegendPosition_LINE_END;
                 eLegendExpand = cssc::ChartLegendExpansion_HIGH;
+                break;
+            case XML_tr:    // top-right not supported
+                eLegendPos = LegendPosition_CUSTOM;
+                eRelPos.Primary = 1;
+                eRelPos.Secondary =0;
+                eRelPos.Anchor = Alignment_TOP_RIGHT;
+                bTopRight=1;
+
             break;
             case XML_t:
                 eLegendPos = cssc2::LegendPosition_PAGE_START;
@@ -224,7 +237,7 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
                 eLegendExpand = cssc::ChartLegendExpansion_WIDE;
             break;
         }
-
+        bool bManualLayout=false;
         // manual positioning and size
         if( mrModel.mxLayout.get() )
         {
@@ -232,11 +245,15 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
             // manual size needs ChartLegendExpansion_CUSTOM
             if( aLayoutConv.convertFromModel( aPropSet ) )
                 eLegendExpand = cssc::ChartLegendExpansion_CUSTOM;
+            bManualLayout = !aLayoutConv.getAutoLayout();
         }
 
         // set position and expansion properties
         aPropSet.setProperty( PROP_AnchorPosition, eLegendPos );
         aPropSet.setProperty( PROP_Expansion, eLegendExpand );
+
+        if(eLegendPos == LegendPosition_CUSTOM && 1 == bTopRight && bManualLayout==false)
+            aPropSet.setProperty( PROP_RelativePosition , makeAny(eRelPos));
     }
     catch( Exception& )
     {


More information about the Libreoffice-commits mailing list