summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorJian Fang Zhang <zhangjf@apache.org>2012-09-14 14:00:22 +0000
committerJian Fang Zhang <zhangjf@apache.org>2012-09-14 14:00:22 +0000
commit8de6941efffd22214da577ff637b2522e46c7fa5 (patch)
treec58e6ae4023ebe8bbcc31029fb412ad3b59d21ec /oox
parentd6870e145cc7373a422b414c31380cc1399e64cc (diff)
#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
Notes
Notes: merged as: 56ab9c1289ee284fe0f48e46101cbf55e24db1e2
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/drawingml/chart/converterbase.hxx1
-rw-r--r--oox/source/drawingml/chart/titleconverter.cxx21
2 files changed, 20 insertions, 2 deletions
diff --git a/oox/inc/oox/drawingml/chart/converterbase.hxx b/oox/inc/oox/drawingml/chart/converterbase.hxx
index 1ba2745c06cf..8f73da72dae1 100644
--- a/oox/inc/oox/drawingml/chart/converterbase.hxx
+++ b/oox/inc/oox/drawingml/chart/converterbase.hxx
@@ -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;}
};
// ============================================================================
diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx
index 3419c9c07941..b8279005b175 100644
--- a/oox/source/drawingml/chart/titleconverter.cxx
+++ b/oox/source/drawingml/chart/titleconverter.cxx
@@ -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( 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:
@@ -216,9 +222,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;
@@ -229,7 +242,7 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
eLegendExpand = cssc::ChartLegendExpansion_WIDE;
break;
}
-
+ bool bManualLayout=false;
// manual positioning and size
if( mrModel.mxLayout.get() )
{
@@ -237,11 +250,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& )
{