summaryrefslogtreecommitdiff
path: root/chart2/source/tools/AxisHelper.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-06-13 11:12:50 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-06-19 14:46:56 -0400
commit1d38cb365543924f9c50014e6b2227e77de1d0c9 (patch)
tree1e77d0d2f82330f16c09cda60864824397d132c4 /chart2/source/tools/AxisHelper.cxx
parent2538e30ccc2e98de92de5157ca523fdb347eb537 (diff)
fdo#71076, fdo#71767: Preserve number formats when charts are copied.
Change-Id: If5ae8852152012483237e7602e56a0c46ea8748a
Diffstat (limited to 'chart2/source/tools/AxisHelper.cxx')
-rw-r--r--chart2/source/tools/AxisHelper.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
index 48a3a72e76ca..acc757071ff6 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -143,7 +143,16 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
Reference< chart2::XChartDocument > xChartDoc( xNumberFormatsSupplier, uno::UNO_QUERY );
Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
- if( xProp.is() && !( xProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey ) )
+ if (!xProp.is())
+ return 0;
+
+ bool bLinkToSource = true;
+ xProp->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource;
+ xProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey;
+
+ sal_Int32 nOldNumberFormat = nNumberFormatKey;
+
+ if (bLinkToSource)
{
bool bFormatSet = false;
//check whether we have a percent scale -> use percent format
@@ -316,7 +325,11 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
}
}
}
+
+ if (nOldNumberFormat != nNumberFormatKey)
+ xProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::makeAny(nNumberFormatKey));
}
+
return nNumberFormatKey;
}