[Libreoffice-commits] core.git: sc/inc sc/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Thu May 4 07:39:28 UTC 2017
sc/inc/PivotTableDataSequence.hxx | 31 +++++++++++++++----------
sc/source/ui/unoobj/PivotTableDataSequence.cxx | 7 +++--
2 files changed, 23 insertions(+), 15 deletions(-)
New commits:
commit 86b2c0c7642f0e87d534a9ff57f188ce08149473
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 3 16:57:27 2017 +0200
tdf#107097 fix missing values for categories when copying
We need to be careful what data we output to represent "no value"
as it could be mis-interpreted (for example Nan or empty string).
Change-Id: Ie5d85bd58118b0526750f387553dfd7a12b272a4
Reviewed-on: https://gerrit.libreoffice.org/37212
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/sc/inc/PivotTableDataSequence.hxx b/sc/inc/PivotTableDataSequence.hxx
index f5e508e6dbab..ec5062151c2a 100644
--- a/sc/inc/PivotTableDataSequence.hxx
+++ b/sc/inc/PivotTableDataSequence.hxx
@@ -36,26 +36,24 @@
namespace sc
{
-typedef cppu::WeakImplHelper<css::chart2::data::XDataSequence,
- css::chart2::data::XTextualDataSequence,
- css::chart2::data::XNumericalDataSequence,
- css::util::XCloneable,
- css::util::XModifyBroadcaster,
- css::beans::XPropertySet,
- css::lang::XServiceInfo>
- PivotTableDataSequence_Base;
+enum class ValueType
+{
+ Empty,
+ String,
+ Numeric
+};
struct ValueAndFormat
{
double m_fValue;
OUString m_aString;
- bool m_bIsValue;
+ ValueType m_eType;
sal_uInt32 m_nNumberFormat;
explicit ValueAndFormat()
: m_fValue(0.0)
, m_aString()
- , m_bIsValue(true)
+ , m_eType(ValueType::Empty)
, m_nNumberFormat(0)
{
rtl::math::setNan(&m_fValue);
@@ -64,20 +62,29 @@ struct ValueAndFormat
explicit ValueAndFormat(double fValue, sal_uInt32 nNumberFormat)
: m_fValue(fValue)
, m_aString()
- , m_bIsValue(true)
+ , m_eType(ValueType::Numeric)
, m_nNumberFormat(nNumberFormat)
{}
explicit ValueAndFormat(OUString const & rString)
: m_fValue(0.0)
, m_aString(rString)
- , m_bIsValue(false)
+ , m_eType(ValueType::String)
, m_nNumberFormat(0)
{
rtl::math::setNan(&m_fValue);
}
};
+typedef cppu::WeakImplHelper<css::chart2::data::XDataSequence,
+ css::chart2::data::XTextualDataSequence,
+ css::chart2::data::XNumericalDataSequence,
+ css::util::XCloneable,
+ css::util::XModifyBroadcaster,
+ css::beans::XPropertySet,
+ css::lang::XServiceInfo>
+ PivotTableDataSequence_Base;
+
class PivotTableDataSequence : public PivotTableDataSequence_Base, public SfxListener
{
public:
diff --git a/sc/source/ui/unoobj/PivotTableDataSequence.cxx b/sc/source/ui/unoobj/PivotTableDataSequence.cxx
index 8c41e90c6c70..812ad94e7046 100644
--- a/sc/source/ui/unoobj/PivotTableDataSequence.cxx
+++ b/sc/source/ui/unoobj/PivotTableDataSequence.cxx
@@ -78,10 +78,11 @@ uno::Sequence<uno::Any> SAL_CALL PivotTableDataSequence::getData()
size_t i = 0;
for (ValueAndFormat const & rItem : m_aData)
{
- if (rItem.m_bIsValue)
+ if (rItem.m_eType == ValueType::Numeric)
aSeq[i] <<= double(rItem.m_fValue);
- else
+ else if (rItem.m_eType == ValueType::String)
aSeq[i] <<= OUString(rItem.m_aString);
+
i++;
}
return aSeq;
@@ -119,7 +120,7 @@ uno::Sequence<OUString> SAL_CALL PivotTableDataSequence::getTextualData()
size_t i = 0;
for (ValueAndFormat const & rItem : m_aData)
{
- if (!rItem.m_bIsValue)
+ if (rItem.m_eType == ValueType::String)
aSeq[i] = rItem.m_aString;
i++;
}
More information about the Libreoffice-commits
mailing list