resolved fdo#86809 connect filter conditions correctly

Maybe since 0960ec3e1b all conditions of a
single filter stack were OR connected, regardless whether filter-and was
given in the file.

Change-Id: Ifb423ccc7deb42bb6bba0bfc810607633f2c342c
This commit is contained in:
Eike Rathke
2014-12-12 14:49:09 +01:00
parent 1a858eabef
commit b500e60b32

View File

@@ -178,12 +178,19 @@ bool ScXMLFilterContext::GetConnection()
// secondary item gets the current connection.
return rItem.mbOr;
// The next condition of this stack will get the current connection.
++rItem.mnCondCount;
if (maConnStack.size() < 2)
// There is no last stack. Likely the first condition in the first
// stack whose connection is not used.
return true;
// stack whose connection is not used. Default in
// ScQueryEntry::eConnect is SC_AND, so return false (AND instead of
// OR) here. Otherwise, when saving the document again, we'd write a
// uselessly stacked
// <table:filter-or><table:filter-and>...</table:filter-and></table:filter-or>
// for two conditions connected with AND.
return false;
++rItem.mnCondCount;
std::vector<ConnStackItem>::reverse_iterator itr = maConnStack.rbegin();
++itr;
return itr->mbOr; // connection of the last stack.