summaryrefslogtreecommitdiff
path: root/oox/source/drawingml/chart/titleconverter.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/drawingml/chart/titleconverter.cxx')
-rw-r--r--oox/source/drawingml/chart/titleconverter.cxx38
1 files changed, 14 insertions, 24 deletions
diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx
index fdc4969f7c5e..8163241e5a31 100644
--- a/oox/source/drawingml/chart/titleconverter.cxx
+++ b/oox/source/drawingml/chart/titleconverter.cxx
@@ -27,7 +27,7 @@
#include "oox/drawingml/chart/titleconverter.hxx"
-#include <com/sun/star/chart2/LegendExpansion.hpp>
+#include <com/sun/star/chart/ChartLegendExpansion.hpp>
#include <com/sun/star/chart2/LegendPosition.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/XFormattedString.hpp>
@@ -198,6 +198,7 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
{
if( rxDiagram.is() ) try
{
+ namespace cssc = ::com::sun::star::chart;
namespace cssc2 = ::com::sun::star::chart2;
// create the legend
@@ -211,46 +212,35 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
// predefined legend position and expansion
cssc2::LegendPosition eLegendPos = cssc2::LegendPosition_CUSTOM;
- cssc2::LegendExpansion eLegendExpand = cssc2::LegendExpansion_HIGH;
+ cssc::ChartLegendExpansion eLegendExpand = cssc::ChartLegendExpansion_CUSTOM;
switch( mrModel.mnPosition )
{
case XML_l:
eLegendPos = cssc2::LegendPosition_LINE_START;
- eLegendExpand = cssc2::LegendExpansion_HIGH;
+ eLegendExpand = cssc::ChartLegendExpansion_HIGH;
break;
case XML_r:
+ case XML_tr: // top-right not supported
eLegendPos = cssc2::LegendPosition_LINE_END;
- eLegendExpand = cssc2::LegendExpansion_HIGH;
+ eLegendExpand = cssc::ChartLegendExpansion_HIGH;
break;
case XML_t:
eLegendPos = cssc2::LegendPosition_PAGE_START;
- eLegendExpand = cssc2::LegendExpansion_WIDE;
+ eLegendExpand = cssc::ChartLegendExpansion_WIDE;
break;
case XML_b:
eLegendPos = cssc2::LegendPosition_PAGE_END;
- eLegendExpand = cssc2::LegendExpansion_WIDE;
- break;
- case XML_tr:
- eLegendPos = cssc2::LegendPosition_LINE_END; // top-right not supported
- eLegendExpand = cssc2::LegendExpansion_HIGH;
+ eLegendExpand = cssc::ChartLegendExpansion_WIDE;
break;
}
- // manual positioning
- LayoutModel& rLayout = mrModel.mxLayout.getOrCreate();
- LayoutConverter aLayoutConv( *this, rLayout );
- aLayoutConv.convertFromModel( aPropSet );
- Rectangle aLegendRect;
- if( aLayoutConv.calcAbsRectangle( aLegendRect ) )
+ // manual positioning and size
+ if( mrModel.mxLayout.get() )
{
- // #i71697# it is not possible to set the size directly, do some magic here
- double fRatio = static_cast< double >( aLegendRect.Width ) / aLegendRect.Height;
- if( fRatio > 1.5 )
- eLegendExpand = cssc2::LegendExpansion_WIDE;
- else if( fRatio < 0.75 )
- eLegendExpand = cssc2::LegendExpansion_HIGH;
- else
- eLegendExpand = cssc2::LegendExpansion_BALANCED;
+ LayoutConverter aLayoutConv( *this, *mrModel.mxLayout );
+ // manual size needs ChartLegendExpansion_CUSTOM
+ if( aLayoutConv.convertFromModel( aPropSet ) )
+ eLegendExpand = cssc::ChartLegendExpansion_CUSTOM;
}
// set position and expansion properties