Kaydet (Commit) 56ab9c12 authored tarafından Jian Fang Zhang's avatar Jian Fang Zhang Kaydeden (comit) Caolán McNamara

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 8de6941e)

Conflicts:
	oox/inc/oox/drawingml/chart/converterbase.hxx
	oox/source/drawingml/chart/titleconverter.cxx

Change-Id: Iad1fe1af8f93e6904759c10a9c9206fd1f1aebbb
üst de726996
...@@ -140,6 +140,7 @@ public: ...@@ -140,6 +140,7 @@ public:
bool convertFromModel( bool convertFromModel(
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
double fRotationAngle ); double fRotationAngle );
bool getAutoLayout(){return mrModel.mbAutoLayout;}
}; };
// ============================================================================ // ============================================================================
......
...@@ -31,7 +31,10 @@ ...@@ -31,7 +31,10 @@
#include "oox/drawingml/chart/datasourceconverter.hxx" #include "oox/drawingml/chart/datasourceconverter.hxx"
#include "oox/drawingml/chart/titlemodel.hxx" #include "oox/drawingml/chart/titlemodel.hxx"
#include "oox/helper/containerhelper.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 oox {
namespace drawingml { namespace drawingml {
namespace chart { namespace chart {
...@@ -41,6 +44,7 @@ namespace chart { ...@@ -41,6 +44,7 @@ namespace chart {
using namespace ::com::sun::star::awt; using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::chart2; using namespace ::com::sun::star::chart2;
using namespace ::com::sun::star::chart2::data; using namespace ::com::sun::star::chart2::data;
using namespace ::com::sun::star::drawing;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using ::oox::core::XmlFilterBase; using ::oox::core::XmlFilterBase;
...@@ -204,6 +208,8 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram ) ...@@ -204,6 +208,8 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
// predefined legend position and expansion // predefined legend position and expansion
cssc2::LegendPosition eLegendPos = cssc2::LegendPosition_CUSTOM; cssc2::LegendPosition eLegendPos = cssc2::LegendPosition_CUSTOM;
cssc::ChartLegendExpansion eLegendExpand = cssc::ChartLegendExpansion_CUSTOM; cssc::ChartLegendExpansion eLegendExpand = cssc::ChartLegendExpansion_CUSTOM;
RelativePosition eRelPos;
bool bTopRight=0;
switch( mrModel.mnPosition ) switch( mrModel.mnPosition )
{ {
case XML_l: case XML_l:
...@@ -211,9 +217,16 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram ) ...@@ -211,9 +217,16 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
eLegendExpand = cssc::ChartLegendExpansion_HIGH; eLegendExpand = cssc::ChartLegendExpansion_HIGH;
break; break;
case XML_r: case XML_r:
case XML_tr: // top-right not supported
eLegendPos = cssc2::LegendPosition_LINE_END; eLegendPos = cssc2::LegendPosition_LINE_END;
eLegendExpand = cssc::ChartLegendExpansion_HIGH; 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; break;
case XML_t: case XML_t:
eLegendPos = cssc2::LegendPosition_PAGE_START; eLegendPos = cssc2::LegendPosition_PAGE_START;
...@@ -224,7 +237,7 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram ) ...@@ -224,7 +237,7 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
eLegendExpand = cssc::ChartLegendExpansion_WIDE; eLegendExpand = cssc::ChartLegendExpansion_WIDE;
break; break;
} }
bool bManualLayout=false;
// manual positioning and size // manual positioning and size
if( mrModel.mxLayout.get() ) if( mrModel.mxLayout.get() )
{ {
...@@ -232,11 +245,15 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram ) ...@@ -232,11 +245,15 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
// manual size needs ChartLegendExpansion_CUSTOM // manual size needs ChartLegendExpansion_CUSTOM
if( aLayoutConv.convertFromModel( aPropSet ) ) if( aLayoutConv.convertFromModel( aPropSet ) )
eLegendExpand = cssc::ChartLegendExpansion_CUSTOM; eLegendExpand = cssc::ChartLegendExpansion_CUSTOM;
bManualLayout = !aLayoutConv.getAutoLayout();
} }
// set position and expansion properties // set position and expansion properties
aPropSet.setProperty( PROP_AnchorPosition, eLegendPos ); aPropSet.setProperty( PROP_AnchorPosition, eLegendPos );
aPropSet.setProperty( PROP_Expansion, eLegendExpand ); aPropSet.setProperty( PROP_Expansion, eLegendExpand );
if(eLegendPos == LegendPosition_CUSTOM && 1 == bTopRight && bManualLayout==false)
aPropSet.setProperty( PROP_RelativePosition , makeAny(eRelPos));
} }
catch( Exception& ) catch( Exception& )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment