summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-01-23 16:37:15 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2019-01-24 18:25:10 +0100
commitadbb6d9bbb1164d43b12594a1e99a5bece31cae6 (patch)
tree5d0bd80ab334f6746fce01d62dbc6f128e8599b1 /forms
parent33f6848dc5abe71471b08dc6a8946feaa2d75ffc (diff)
fix load/save of forms with HAVING
Since commit 2b1d6f0d3b0b025148c81986ba7f109659d838af Date: Sun Jul 30 17:57:14 2017 +0200 tdf#96370 rework filtering to be aware of WHERE vs HAVING clause (1) the code was saving PROPERTY_FILTER and PROPERTY_SORT, but loading PROPERTY_FILTER and PROPERTY_HAVINGCLAUSE (2) the loading code was not putting the properties into m_xAggregateSet So I fixed the load/save mismatch, put the properties into the right location, and added the HAVING property, which meant I needed to do a version bump. I will note that this is somewhat of a backwards/forwards compatibility mess - the commit referenced above added new fields in the middle of the output stream, which means that older versions of LO will not be able to properly load forms generated after that commit. Change-Id: I9a13877b29d7c6bc5e6d014cfbcefd3069ddc4b5 Reviewed-on: https://gerrit.libreoffice.org/66830 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
Diffstat (limited to 'forms')
-rw-r--r--forms/source/component/DatabaseForm.cxx34
1 files changed, 21 insertions, 13 deletions
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index ee43255d9e2b..ab58fae4ddf6 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -3752,7 +3752,7 @@ void SAL_CALL ODatabaseForm::write(const Reference<XObjectOutputStream>& _rxOutS
OFormComponents::write(_rxOutStream);
// version
- _rxOutStream->writeShort(0x0004);
+ _rxOutStream->writeShort(0x0005);
// Name
_rxOutStream << m_sName;
@@ -3830,18 +3830,15 @@ void SAL_CALL ODatabaseForm::write(const Reference<XObjectOutputStream>& _rxOutS
_rxOutStream->writeShort(static_cast<sal_Int16>(m_eNavigation));
OUString sFilter;
- OUString sHaving;
- OUString sOrder;
+ OUString sSort;
if (m_xAggregateSet.is())
{
m_xAggregateSet->getPropertyValue(PROPERTY_FILTER) >>= sFilter;
// version 4
- m_xAggregateSet->getPropertyValue(PROPERTY_HAVINGCLAUSE) >>= sHaving;
- m_xAggregateSet->getPropertyValue(PROPERTY_SORT) >>= sOrder;
+ m_xAggregateSet->getPropertyValue(PROPERTY_SORT) >>= sSort;
}
_rxOutStream << sFilter;
- _rxOutStream << sOrder;
-
+ _rxOutStream << sSort;
// version 3
sal_uInt16 nAnyMask = 0;
@@ -3859,6 +3856,12 @@ void SAL_CALL ODatabaseForm::write(const Reference<XObjectOutputStream>& _rxOutS
::cppu::enum2int(nRealCycle, m_aCycle);
_rxOutStream->writeShort(static_cast<sal_Int16>(nRealCycle));
}
+
+ // version 5
+ OUString sHaving;
+ if (m_xAggregateSet.is())
+ m_xAggregateSet->getPropertyValue(PROPERTY_HAVINGCLAUSE) >>= sHaving;
+ _rxOutStream << sHaving;
}
@@ -3935,16 +3938,14 @@ void SAL_CALL ODatabaseForm::read(const Reference<XObjectInputStream>& _rxInStre
m_eNavigation = static_cast<NavigationBarMode>(_rxInStream->readShort());
_rxInStream >> sAggregateProp;
- setPropertyValue(PROPERTY_FILTER, makeAny(sAggregateProp));
+ if (m_xAggregateSet.is())
+ m_xAggregateSet->setPropertyValue(PROPERTY_FILTER, makeAny(sAggregateProp));
if(nVersion > 3)
{
_rxInStream >> sAggregateProp;
- setPropertyValue(PROPERTY_HAVINGCLAUSE, makeAny(sAggregateProp));
+ if (m_xAggregateSet.is())
+ m_xAggregateSet->setPropertyValue(PROPERTY_SORT, makeAny(sAggregateProp));
}
-
- _rxInStream >> sAggregateProp;
- if (m_xAggregateSet.is())
- m_xAggregateSet->setPropertyValue(PROPERTY_SORT, makeAny(sAggregateProp));
}
sal_uInt16 nAnyMask = 0;
@@ -3961,6 +3962,13 @@ void SAL_CALL ODatabaseForm::read(const Reference<XObjectInputStream>& _rxInStre
}
if (m_xAggregateSet.is())
m_xAggregateSet->setPropertyValue(PROPERTY_APPLYFILTER, makeAny((nAnyMask & DONTAPPLYFILTER) == 0));
+
+ if(nVersion > 4)
+ {
+ _rxInStream >> sAggregateProp;
+ if (m_xAggregateSet.is())
+ m_xAggregateSet->setPropertyValue(PROPERTY_HAVINGCLAUSE, makeAny(sAggregateProp));
+ }
}