summaryrefslogtreecommitdiff
path: root/sc/source/filter/excel/xichart.cxx
diff options
context:
space:
mode:
authorBartosz Kosiorek <bartosz.kosiorek@tomtom.com>2018-02-07 02:57:30 +0100
committerBartosz Kosiorek <gang65@poczta.onet.pl>2018-02-08 08:08:26 +0100
commit274825b4180c81540cd0d1b22c5243f1b39fe4db (patch)
tree45542f31c25ef1eea82e033da856fc5ad2e7bd00 /sc/source/filter/excel/xichart.cxx
parentd761be572b6a49dff64db47bbdda309e7b984f95 (diff)
tdf#114168 If minor axis unit is automatic, then set it to 5
Based on OOXML implementation in MS Excel, if Minor axis Unit is set to automatic, then during chart import, LibreOffice should set Interval Count to 5, to mimic behaviour of MS Excel. Becaues default Interval Count for LibreOffice is 2, we need to override it to 5. With that solution, the Minor axis unit is preserved also after saving to .ods file format. During .xlsx export, if Interval Count is set to 5, then treat is as automatic axis unit. Change-Id: Iab9209fb3950ef73e79229329606363b528d35fe Reviewed-on: https://gerrit.libreoffice.org/49327 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'sc/source/filter/excel/xichart.cxx')
-rw-r--r--sc/source/filter/excel/xichart.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 28aece1b72b3..3fb920328116 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -3066,7 +3066,7 @@ void XclImpChValueRange::ReadChValueRange( XclImpStream& rStrm )
void XclImpChValueRange::Convert( ScaleData& rScaleData, bool bMirrorOrient ) const
{
// scaling algorithm
- bool bLogScale = ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_LOGSCALE );
+ const bool bLogScale = ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_LOGSCALE );
if( bLogScale )
rScaleData.Scaling = css::chart2::LogarithmicScaling::create( comphelper::getProcessComponentContext() );
else
@@ -3092,14 +3092,16 @@ void XclImpChValueRange::Convert( ScaleData& rScaleData, bool bMirrorOrient ) co
if( !bAutoMinor )
rIntervalCount <<= sal_Int32( 9 );
}
- else
+ else if( !bAutoMajor && !bAutoMinor && (0.0 < maData.mfMinorStep) && (maData.mfMinorStep <= maData.mfMajorStep) )
{
- if( !bAutoMajor && !bAutoMinor && (0.0 < maData.mfMinorStep) && (maData.mfMinorStep <= maData.mfMajorStep) )
- {
- double fCount = maData.mfMajorStep / maData.mfMinorStep + 0.5;
- if( (1.0 <= fCount) && (fCount < 1001.0) )
- rIntervalCount <<= static_cast< sal_Int32 >( fCount );
- }
+ double fCount = maData.mfMajorStep / maData.mfMinorStep + 0.5;
+ if( (1.0 <= fCount) && (fCount < 1001.0) )
+ rIntervalCount <<= static_cast< sal_Int32 >( fCount );
+ }
+ else if( bAutoMinor )
+ {
+ // tdf#114168 If minor unit is not set then set interval to 5, as MS Excel do.
+ rIntervalCount <<= static_cast< sal_Int32 >( 5 );
}
// reverse order