summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2019-10-01 15:37:17 +0200
committerLászló Németh <nemeth@numbertext.org>2019-10-03 10:03:06 +0200
commit86e4d68e62c6291ef386b5fcf0f8912989f8e661 (patch)
tree656110c523f7afa3ea7901df9748d6bd6dde0005 /oox
parentb0f2e3880cde52f06913fea55187075fb2c54bba (diff)
tdf#127907 tdf#126724 Chart DOCX import: fix axis title position
Custom position of axis title reset to default when the document is opened in LibreOffice. Also fix tdf#126724 which was a regression from commit: 48480d4f19d2fb92ca4ae0527eec4753cdc439c0 (make tools::Rectangle::getBottom return 0 when empty) Note: The y coordinate of Y axis title position is still wrong because of another older bug. Change-Id: I449ad3b2252e05ab38d6752512d822c355ff8606 Reviewed-on: https://gerrit.libreoffice.org/79966 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/drawingml/chart/converterbase.hxx2
-rw-r--r--oox/source/drawingml/chart/converterbase.cxx15
2 files changed, 11 insertions, 6 deletions
diff --git a/oox/inc/drawingml/chart/converterbase.hxx b/oox/inc/drawingml/chart/converterbase.hxx
index 32e3e95d550e..6af038bb262f 100644
--- a/oox/inc/drawingml/chart/converterbase.hxx
+++ b/oox/inc/drawingml/chart/converterbase.hxx
@@ -85,6 +85,8 @@ protected:
getChartDocument() const;
/** Returns the position and size of the chart shape in 1/100 mm. */
const css::awt::Size& getChartSize() const;
+ /** Returns the default position and size of the chart shape in 1/100 mm. */
+ static css::awt::Size getDefaultPageSize() { return css::awt::Size(16000, 9000); }
/** Returns the object formatter. */
ObjectFormatter& getFormatter() const;
diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx
index 7f12741c568e..8acf77c619df 100644
--- a/oox/source/drawingml/chart/converterbase.cxx
+++ b/oox/source/drawingml/chart/converterbase.cxx
@@ -350,11 +350,10 @@ bool LayoutConverter::calcAbsRectangle( awt::Rectangle& orRect ) const
{
if( !mrModel.mbAutoLayout )
{
- awt::Size aChartSize=getChartSize();
+ awt::Size aChartSize = getChartSize();
if( aChartSize.Width <= 0 || aChartSize.Height <= 0 )
{
- aChartSize.Width = 16000;
- aChartSize.Height = 9000;
+ aChartSize = getDefaultPageSize();
}
orRect.X = lclCalcPosition( aChartSize.Width, mrModel.mfX, mrModel.mnXMode );
orRect.Y = lclCalcPosition( aChartSize.Height, mrModel.mfY, mrModel.mnYMode );
@@ -396,10 +395,14 @@ void LayoutConverter::convertFromModel( const Reference< XShape >& rxShape, doub
{
if( !mrModel.mbAutoLayout )
{
- const awt::Size& rChartSize = getChartSize();
+ awt::Size aChartSize = getChartSize();
+ if( aChartSize.Width <= 0 || aChartSize.Height <= 0 )
+ {
+ aChartSize = getDefaultPageSize();
+ }
awt::Point aShapePos(
- lclCalcPosition( rChartSize.Width, mrModel.mfX, mrModel.mnXMode ),
- lclCalcPosition( rChartSize.Height, mrModel.mfY, mrModel.mnYMode ) );
+ lclCalcPosition( aChartSize.Width, mrModel.mfX, mrModel.mnXMode ),
+ lclCalcPosition( aChartSize.Height, mrModel.mfY, mrModel.mnYMode ) );
if( (aShapePos.X >= 0) && (aShapePos.Y >= 0) )
{
// the call to XShape.getSize() may recalc the chart view