[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - 5 commits - oox/source sc/inc sc/source sw/qa sw/source writerfilter/source xmloff/source
Eike Rathke
erack at redhat.com
Tue Dec 3 11:22:20 PST 2013
oox/source/ppt/pptgraphicshapecontext.cxx | 23 +++++++-
sc/inc/queryparam.hxx | 1
sc/source/core/data/dociter.cxx | 62 +++++++++++++++++++++-
sc/source/core/data/table3.cxx | 42 ++++++++++++++
sc/source/core/tool/queryparam.cxx | 5 +
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 11 +++
sw/source/filter/ww8/ww8par.cxx | 2
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 14 ++++
xmloff/source/text/XMLTextFrameContext.cxx | 12 +++-
9 files changed, 163 insertions(+), 9 deletions(-)
New commits:
commit 9c97888e825a0a0371ed824f89c7ab1d50ab9bbd
Author: Eike Rathke <erack at redhat.com>
Date: Wed Nov 27 23:43:09 2013 +0100
resolved fdo#71589 reimplemented horizontal range lookup
Regression introduced with ebdd9c300718bce454ef56a31d5d8fb699fc1822
(first eaea417bfdf8d06df2b7f2e42c904c32ce77e871) that removed the
bMixedComparison member from ScQueryParam under the false assumption
that is was only used to emulate a legacy Excel behavior. In fact it was
also needed to do the at least horizontal range lookup in sorted mixed
data, though didn't evaluate exactly the same conditions as Excel and
defined in ODFF.
Reimplemented a similar behavior for the new code structures but this
time also checking for the additional condtion that a query ByString
does not return the last numeric result and vice versa, which previously
was missing.
(cherry picked from commit f0701470858f57a855ba57c0c2283e52953db327)
Conflicts:
sc/source/core/data/dociter.cxx
Backported.
Change-Id: I46061777879ba5301bfcaca2d50cf87a994f93f2
Reviewed-on: https://gerrit.libreoffice.org/6839
Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
Tested-by: Kohei Yoshida <libreoffice at kohei.us>
diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index 26d2d1b..445c23c 100644
--- a/sc/inc/queryparam.hxx
+++ b/sc/inc/queryparam.hxx
@@ -36,6 +36,7 @@ struct ScQueryParamBase
bool bCaseSens;
bool bRegExp;
bool bDuplicate;
+ bool mbRangeLookup; ///< for spreadsheet functions like MATCH, LOOKUP, HLOOKUP, VLOOKUP
virtual ~ScQueryParamBase();
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index f8ba16f..e050e58 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1325,6 +1325,17 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( SCCOL& nFoundCol,
SCROW& nFoundRow, bool bSearchForEqualAfterMismatch,
bool bIgnoreMismatchOnLeadingStringsP )
{
+ // Set and automatically reset mpParam->mbRangeLookup when returning. We
+ // could use comphelper::FlagRestorationGuard, but really, that one is
+ // overengineered for this simple purpose here.
+ struct BoolResetter
+ {
+ bool& mr;
+ bool mb;
+ BoolResetter( bool& r, bool b ) : mr(r), mb(r) { r = b; }
+ ~BoolResetter() { mr = mb; }
+ } aRangeLookupResetter( mpParam->mbRangeLookup, true);
+
nFoundCol = MAXCOL+1;
nFoundRow = MAXROW+1;
SetStopOnMismatch( true ); // assume sorted keys
@@ -1333,7 +1344,22 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( SCCOL& nFoundCol,
bool bRegExp = mpParam->bRegExp && mpParam->GetEntry(0).GetQueryItem().meType == ScQueryEntry::ByString;
bool bBinary = !bRegExp && mpParam->bByRow && (mpParam->GetEntry(0).eOp ==
SC_LESS_EQUAL || mpParam->GetEntry(0).eOp == SC_GREATER_EQUAL);
- if (bBinary ? (BinarySearch() ? GetThis() : 0) : GetFirst())
+ bool bFound = false;
+ if (bBinary)
+ {
+ if (BinarySearch())
+ {
+ // BinarySearch() already positions correctly and only needs real
+ // query comparisons afterwards, skip the verification check below.
+ mpParam->mbRangeLookup = false;
+ bFound = GetThis();
+ }
+ }
+ else
+ {
+ bFound = GetFirst();
+ }
+ if (bFound)
{
// First equal entry or last smaller than (greater than) entry.
SCSIZE nColRowSave;
@@ -1351,9 +1377,43 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( SCCOL& nFoundCol,
{
// Step back to last in range and adjust position markers for
// GetNumberFormat() or similar.
+ SCCOL nColDiff = nCol - nFoundCol;
nCol = nFoundCol;
nRow = nFoundRow;
nColRow = nColRowSave;
+ if (mpParam->mbRangeLookup)
+ {
+ // Verify that the found entry does not only fulfill the range
+ // lookup but also the real query, i.e. not numeric was found
+ // if query is ByString and vice versa.
+ mpParam->mbRangeLookup = false;
+ // Step back the last field advance if GetNext() did one.
+ if (bAdvanceQuery && nColDiff)
+ {
+ SCSIZE nEntries = mpParam->GetEntryCount();
+ for (SCSIZE j=0; j < nEntries; ++j)
+ {
+ ScQueryEntry& rEntry = mpParam->GetEntry( j );
+ if (rEntry.bDoQuery)
+ {
+ if (rEntry.nField - nColDiff >= 0)
+ rEntry.nField -= nColDiff;
+ else
+ {
+ assert(!"FindEqualOrSortedLastInRange: rEntry.nField -= nColDiff < 0");
+ }
+ }
+ else
+ break; // for
+ }
+ }
+ // Check it.
+ if (!GetThis())
+ {
+ nFoundCol = MAXCOL+1;
+ nFoundRow = MAXROW+1;
+ }
+ }
}
}
if ( IsEqualConditionFulfilled() )
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index b61be80..73f952d 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1519,6 +1519,41 @@ public:
return std::pair<bool,bool>(bOk, bTestEqual);
}
+
+ // To be called only if both isQueryByValue() and isQueryByString()
+ // returned false and range lookup is wanted! In range lookup comparison
+ // numbers are less than strings. Nothing else is compared.
+ std::pair<bool,bool> compareByRangeLookup(
+ ScBaseCell* pCell, SCCOL nCol, SCROW nRow,
+ const ScQueryEntry& rEntry, const ScQueryEntry::Item& rItem)
+ {
+ bool bTestEqual = false;
+
+ if (rItem.meType == ScQueryEntry::ByString && rEntry.eOp != SC_LESS && rEntry.eOp != SC_LESS_EQUAL)
+ return std::pair<bool,bool>(false, bTestEqual);
+
+ if (rItem.meType != ScQueryEntry::ByString && rEntry.eOp != SC_GREATER && rEntry.eOp != SC_GREATER_EQUAL)
+ return std::pair<bool,bool>(false, bTestEqual);
+
+ if (pCell)
+ {
+ if (rItem.meType == ScQueryEntry::ByString)
+ {
+ if (pCell->GetCellType() == CELLTYPE_FORMULA && static_cast<ScFormulaCell*>(pCell)->GetErrCode())
+ // Error values are compared as string.
+ return std::pair<bool,bool>(false, bTestEqual);
+
+ return std::pair<bool,bool>(pCell->HasValueData(), bTestEqual);
+ }
+
+ return std::pair<bool,bool>(!pCell->HasValueData(), bTestEqual);
+ }
+
+ if (rItem.meType == ScQueryEntry::ByString)
+ return std::pair<bool,bool>(mrTab.HasValueData(nCol, nRow), bTestEqual);
+
+ return std::pair<bool,bool>(!mrTab.HasValueData(nCol, nRow), bTestEqual);
+ }
};
}
@@ -1582,6 +1617,13 @@ bool ScTable::ValidQuery(
aRes.first |= aThisRes.first;
aRes.second |= aThisRes.second;
}
+ else if (rParam.mbRangeLookup)
+ {
+ std::pair<bool,bool> aThisRes =
+ aEval.compareByRangeLookup(pCell, nCol, nRow, rEntry, *itr);
+ aRes.first |= aThisRes.first;
+ aRes.second |= aThisRes.second;
+ }
if (aRes.first && aRes.second)
break;
diff --git a/sc/source/core/tool/queryparam.cxx b/sc/source/core/tool/queryparam.cxx
index 826ea3e..781816a 100644
--- a/sc/source/core/tool/queryparam.cxx
+++ b/sc/source/core/tool/queryparam.cxx
@@ -61,7 +61,8 @@ ScQueryParamBase::ScQueryParamBase() :
bInplace(true),
bCaseSens(false),
bRegExp(false),
- bDuplicate(false)
+ bDuplicate(false),
+ mbRangeLookup(false)
{
for (size_t i = 0; i < MAXQUERY; ++i)
maEntries.push_back(new ScQueryEntry);
@@ -69,7 +70,7 @@ ScQueryParamBase::ScQueryParamBase() :
ScQueryParamBase::ScQueryParamBase(const ScQueryParamBase& r) :
bHasHeader(r.bHasHeader), bByRow(r.bByRow), bInplace(r.bInplace), bCaseSens(r.bCaseSens),
- bRegExp(r.bRegExp), bDuplicate(r.bDuplicate),
+ bRegExp(r.bRegExp), bDuplicate(r.bDuplicate), mbRangeLookup(r.mbRangeLookup),
maEntries(r.maEntries)
{
}
commit 8ba3dce0faeb9d03c1ab0b0d9b27cd8263ac3214
Author: Korrawit Pruegsanusak <detective.conan.1412 at gmail.com>
Date: Tue Nov 26 22:31:51 2013 +0700
fdo#71434: don't show master text if PlaceHolder types defined
I've added all of valid PlaceHolder types from
http://www.schemacentral.com/sc/ooxml/t-p_ST_PlaceholderType.html
(cherry picked from commit bb1213a740b3b3b2b1967639939dd7a72c6d4237)
Change-Id: I038fe43ff83699f92ff5eb9945bce12540058478
Reviewed-on: https://gerrit.libreoffice.org/6821
Reviewed-by: Muthu Subramanian K <muthusuba at gmail.com>
Tested-by: Muthu Subramanian K <muthusuba at gmail.com>
Reviewed-by: Thorsten Behrens <thb at documentfoundation.org>
Tested-by: Thorsten Behrens <thb at documentfoundation.org>
diff --git a/oox/source/ppt/pptgraphicshapecontext.cxx b/oox/source/ppt/pptgraphicshapecontext.cxx
index e21b9a1..fec7785 100644
--- a/oox/source/ppt/pptgraphicshapecontext.cxx
+++ b/oox/source/ppt/pptgraphicshapecontext.cxx
@@ -149,9 +149,26 @@ Reference< XFastContextHandler > PPTGraphicShapeContext::createFastChildContext(
if ( pPlaceholder.get() )
{
bool bUseText = true;
- // TODO: Check if pPlaceholder->getSubType is none (i.e. none explicitly specified)
- if( pPlaceholder->getSubType() == XML_obj )
- bUseText = false;
+ switch( pPlaceholder->getSubType() )
+ {
+ case XML_title :
+ case XML_body :
+ case XML_ctrTitle :
+ case XML_subTitle :
+ case XML_dt :
+ case XML_sldNum :
+ case XML_ftr :
+ case XML_hdr :
+ case XML_obj :
+ case XML_chart :
+ case XML_tbl :
+ case XML_clipArt :
+ case XML_dgm :
+ case XML_media :
+ case XML_sldImg :
+ case XML_pic :
+ bUseText = false;
+ }
mpShapePtr->applyShapeReference( *pPlaceholder.get(), bUseText );
PPTShape* pPPTShape = dynamic_cast< PPTShape* >( pPlaceholder.get() );
if ( pPPTShape )
commit c67def554218d6effd2a89a5c1e94e1c75e8467d
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Dec 2 23:28:20 2013 +0100
fdo#71450 fdo#71698: ODF import: fix frame name corner cases
Trying to set a name that is already in use will throw an exception (and
set a different, generated name); if there is actually no name in the
file then there's no point trying to set anything.
(regression from b69d152cfa1da868ba960345d72ba78f9f8e1b35)
Change-Id: Ie54d4a830cc23e2853a6efeb81f77dcc788192ea
(cherry picked from commit 8171e713e74e3d09e86592c28abfe05d0400c071)
Reviewed-on: https://gerrit.libreoffice.org/6907
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index 3ca7e86..745ff63 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -1291,12 +1291,20 @@ void XMLTextFrameContext_Impl::SetHyperlink( const OUString& rHRef,
void XMLTextFrameContext_Impl::SetName()
{
Reference<XNamed> xNamed(xPropSet, UNO_QUERY);
- if (xNamed.is())
+ if (!m_sOrigName.isEmpty() && xNamed.is())
{
OUString const name(xNamed->getName());
if (name != m_sOrigName)
{
- xNamed->setName(m_sOrigName);
+ try
+ {
+ xNamed->setName(m_sOrigName);
+ }
+ catch (uno::Exception const& e)
+ { // fdo#71698 document contains 2 frames with same draw:name
+ SAL_INFO("xmloff.text", "SetName(): exception setting \""
+ << m_sOrigName << "\": " << e.Message);
+ }
}
}
}
commit 0421757a26532013f7b9e504ca304fb758e493a7
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Dec 2 22:20:25 2013 +0100
fdo#71749: sw: WW8: don't loop on tables in footnotes
(regression from ee1db992b98378b5e2f5e9aa8af0e36c375e582f)
Change-Id: Id10b6fb8e9e3697b10a1df605cb48d94a55ad207
(cherry picked from commit 790896d9a557d34ea91d6e5926471de66503be7a)
Reviewed-on: https://gerrit.libreoffice.org/6905
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index bacc0fc..7663ef2 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2384,7 +2384,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp)
pPlcxMan->GetPap()->Restore( aSave );
}
}
- } while (nInTable < nCellLevel);
+ } while (!bFtnEdn && (nInTable < nCellLevel));
return bTableRowEnd;
}
commit 582c72493f12c143b8026d60e42a3ee473bbeb1c
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed Nov 20 13:39:18 2013 +0100
Related bnc#837302: Don't introduce a redlined delete and the end of doc.
Conflicts:
writerfilter/source/dmapper/DomainMapper_Impl.cxx
Change-Id: I5c3903a40b69867684707d33acbc92b1f80a93ec
Reviewed-on: https://gerrit.libreoffice.org/6898
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d7a5c8b..1372151 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -800,6 +800,17 @@ void Test::testBnc837302()
getRun(xParagraph, 3, "AAA");
// interestingly the 'Insert' is set on the _previous_ run
CPPUNIT_ASSERT_EQUAL(OUString("Insert"), getProperty<OUString>(getRun(xParagraph, 2), "RedlineType"));
+
+ // make sure we don't introduce a redlined delete in the 2nd paragraph
+ xParagraph = getParagraph(2);
+ OUString aProperty;
+ try
+ {
+ // throws when not present
+ aProperty = getProperty<OUString>(getRun(xParagraph, 1), "RedlineType");
+ }
+ catch (const beans::UnknownPropertyException&) {}
+ CPPUNIT_ASSERT_EQUAL(OUString(), aProperty);
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f633101..e8a160b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -318,7 +318,21 @@ void DomainMapper_Impl::RemoveLastParagraph( )
#else
if (xCursor->getString() == "\r\n")
#endif
+ {
+ uno::Reference<beans::XPropertySet> xDocProps(GetTextDocument(), uno::UNO_QUERY);
+ const OUString aRecordChanges("RecordChanges");
+ uno::Any aPreviousValue(xDocProps->getPropertyValue(aRecordChanges));
+
+ // disable redlining for this operation, otherwise we might
+ // end up with an unwanted recorded deletion
+ xDocProps->setPropertyValue(aRecordChanges, uno::Any(sal_False));
+
+ // delete
xCursor->setString(OUString());
+
+ // restore again
+ xDocProps->setPropertyValue(aRecordChanges, aPreviousValue);
+ }
}
}
catch( const uno::Exception& )
More information about the Libreoffice-commits
mailing list