incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhan...@apache.org
Subject svn commit: r1384809 - in /incubator/ooo/trunk/main/oox: inc/oox/drawingml/chart/converterbase.hxx source/drawingml/chart/titleconverter.cxx
Date Fri, 14 Sep 2012 15:00:23 GMT
Author: zhangjf
Date: Fri Sep 14 15:00:22 2012
New Revision: 1384809

URL: http://svn.apache.org/viewvc?rev=1384809&view=rev
Log:
#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

Modified:
    incubator/ooo/trunk/main/oox/inc/oox/drawingml/chart/converterbase.hxx
    incubator/ooo/trunk/main/oox/source/drawingml/chart/titleconverter.cxx

Modified: incubator/ooo/trunk/main/oox/inc/oox/drawingml/chart/converterbase.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/oox/inc/oox/drawingml/chart/converterbase.hxx?rev=1384809&r1=1384808&r2=1384809&view=diff
==============================================================================
--- incubator/ooo/trunk/main/oox/inc/oox/drawingml/chart/converterbase.hxx (original)
+++ incubator/ooo/trunk/main/oox/inc/oox/drawingml/chart/converterbase.hxx Fri Sep 14 15:00:22
2012
@@ -142,6 +142,7 @@ public:
     bool                convertFromModel(
                             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape
>& rxShape,
                             double fRotationAngle );
+	bool getAutoLayout(){return mrModel.mbAutoLayout;}
 };
 
 // ============================================================================

Modified: incubator/ooo/trunk/main/oox/source/drawingml/chart/titleconverter.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/oox/source/drawingml/chart/titleconverter.cxx?rev=1384809&r1=1384808&r2=1384809&view=diff
==============================================================================
--- incubator/ooo/trunk/main/oox/source/drawingml/chart/titleconverter.cxx (original)
+++ incubator/ooo/trunk/main/oox/source/drawingml/chart/titleconverter.cxx Fri Sep 14 15:00:22
2012
@@ -35,7 +35,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 {
@@ -49,6 +52,7 @@ using namespace ::com::sun::star::uno;
 
 using ::oox::core::XmlFilterBase;
 using ::rtl::OUString;
+using namespace ::com::sun::star::drawing;
 
 // ============================================================================
 
@@ -209,6 +213,8 @@ void LegendConverter::convertFromModel( 
         // 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:
@@ -216,9 +222,16 @@ void LegendConverter::convertFromModel( 
                 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;
@@ -229,19 +242,23 @@ void LegendConverter::convertFromModel( 
                 eLegendExpand = cssc::ChartLegendExpansion_WIDE;
             break;
         }
-
+        bool bManualLayout=false;
         // manual positioning and size
-        if( mrModel.mxLayout.get() )
+        if( mrModel.mxLayout.get() ) 
         {
             LayoutConverter aLayoutConv( *this, *mrModel.mxLayout );
             // 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& )
     {



Mime
View raw message