sal/qa/osl/file/osl_File.cxx | 5 sc/inc/editutil.hxx | 4 sc/source/core/tool/editutil.cxx | 75 +++++++--- sc/source/ui/view/gridwin4.cxx | 34 ++++ starmath/source/parse.cxx | 8 + writerfilter/CppunitTest_writerfilter_dmapper.mk | 1 writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx | 23 +++ writerfilter/qa/cppunittests/dmapper/data/create-date-preserve.docx |binary writerfilter/source/dmapper/DomainMapper_Impl.cxx | 7 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx | 4 10 files changed, 136 insertions(+), 25 deletions(-)
New commits: commit 61404bca5af9072b99c69a605077f0f4f6b54661 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Feb 8 20:30:20 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Feb 9 10:18:59 2021 +0100 report what value was found in message Change-Id: I512cedcd46f829b97b62a57d90d5a4a81d024d66 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110562 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index 30ef0e322eeb..b0a550b9d136 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -253,7 +253,6 @@ static void createTestDirectory(const OUString& basename, const OUString& dirnam static void deleteTestDirectory(const OUString& dirname) { OUString aPathURL = dirname.copy(0); - osl::FileBase::RC nError; if (!isURL(dirname)) osl::FileBase::getFileURLFromSystemPath(dirname, aPathURL); // convert if not full qualified URL @@ -261,10 +260,10 @@ static void deleteTestDirectory(const OUString& dirname) if (testDir.isOpen()) testDir.close(); // close if still open. - nError = Directory::remove(aPathURL); + osl::FileBase::RC nError = Directory::remove(aPathURL); OString strError = "In deleteTestDirectory function: remove Directory " + - OUStringToOString(aPathURL, RTL_TEXTENCODING_ASCII_US); + OUStringToOString(aPathURL, RTL_TEXTENCODING_ASCII_US) + " -> result: " + OString::number(nError); CPPUNIT_ASSERT_MESSAGE(strError.getStr(), (osl::FileBase::E_None == nError) || (nError == osl::FileBase::E_NOENT)); } commit 439f386602299bfbe05efee3a00cc7614d6ecdef Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Feb 5 17:14:07 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Feb 9 10:07:26 2021 +0100 ofz#30330 recursion too deep Change-Id: Iaa3961cd6501f45c93bf02a42da7816d0b83097f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110489 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 41a6d482cf8f..b4541fea8bb7 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -1314,6 +1314,8 @@ std::unique_ptr<SmNode> SmParser::DoSum() { DepthProtect aDepthGuard(m_nParseDepth); + int nDepthLimit = m_nParseDepth; + auto xFirst = DoProduct(); while (TokenInGroup(TG::Sum)) { @@ -1322,7 +1324,13 @@ std::unique_ptr<SmNode> SmParser::DoSum() auto xThird = DoProduct(); xSNode->SetSubNodes(std::move(xFirst), std::move(xSecond), std::move(xThird)); xFirst = std::move(xSNode); + + ++m_nParseDepth; + DepthProtect bDepthGuard(m_nParseDepth); } + + m_nParseDepth = nDepthLimit; + return xFirst; } commit d87fcadc242881c39d3c49c85b9d5ef83ec6dde4 Author: Dennis Francis <dennis.fran...@collabora.com> AuthorDate: Tue Jan 19 14:46:48 2021 +0530 Commit: Dennis Francis <dennis.fran...@collabora.com> CommitDate: Tue Feb 9 09:55:34 2021 +0100 lok: Take indent and margins into account ... when painting tiles with edit-text content. Conflicts: sc/source/core/tool/editutil.cxx Change-Id: I31199c18ed5aab005d56241046a9f7109691db99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109755 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tor Lillqvist <t...@collabora.com> (cherry picked from commit bc025dac6ce3301f5798e8ada4fee07b415de76a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110619 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.fran...@collabora.com> diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx index d760faf5c53e..4efadface0f4 100644 --- a/sc/inc/editutil.hxx +++ b/sc/inc/editutil.hxx @@ -84,6 +84,10 @@ public: const Fraction& rX, const Fraction& rY, bool bPrintTwips = false ); tools::Rectangle GetEditArea( const ScPatternAttr* pPattern, bool bForceToTop ); + tools::Long GetIndent(const ScPatternAttr* pPattern) const; + void GetMargins(const ScPatternAttr* pPattern, tools::Long& nLeftMargin, tools::Long& nTopMargin, + tools::Long& nRightMargin, tools::Long& BottomMargin) const; + }; class ScEditAttrTester diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index 523c92e275d2..c567e36b7b55 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -278,6 +278,39 @@ OUString ScEditUtil::GetCellFieldValue( return aRet; } +tools::Long ScEditUtil::GetIndent(const ScPatternAttr* pPattern) const +{ + if (!pPattern) + pPattern = pDoc->GetPattern( nCol, nRow, nTab ); + + if ( pPattern->GetItem(ATTR_HOR_JUSTIFY).GetValue() == + SvxCellHorJustify::Left ) + { + tools::Long nIndent = pPattern->GetItem(ATTR_INDENT).GetValue(); + if (!bInPrintTwips) + nIndent = static_cast<tools::Long>(nIndent * nPPTX); + return nIndent; + } + + return 0; +} + +void ScEditUtil::GetMargins(const ScPatternAttr* pPattern, tools::Long& nLeftMargin, tools::Long& nTopMargin, + tools::Long& nRightMargin, tools::Long& nBottomMargin) const +{ + if (!pPattern) + pPattern = pDoc->GetPattern( nCol, nRow, nTab ); + + const SvxMarginItem* pMargin = &pPattern->GetItem(ATTR_MARGIN); + if (!pMargin) + return; + + nLeftMargin = bInPrintTwips ? pMargin->GetLeftMargin() : static_cast<tools::Long>(pMargin->GetLeftMargin() * nPPTX); + nRightMargin = bInPrintTwips ? pMargin->GetRightMargin() : static_cast<tools::Long>(pMargin->GetRightMargin() * nPPTX); + nTopMargin = bInPrintTwips ? pMargin->GetTopMargin() : static_cast<tools::Long>(pMargin->GetTopMargin() * nPPTY); + nBottomMargin = bInPrintTwips ? pMargin->GetBottomMargin() : static_cast<tools::Long>(pMargin->GetBottomMargin() * nPPTY); +} + tools::Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, bool bForceToTop ) { // bForceToTop = always align to top, for editing @@ -316,24 +349,36 @@ tools::Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, bool bF nCellY += static_cast<tools::Long>(pDoc->GetScaledRowHeight( nRow+1, nRow+nCountY-1, nTab, nPPTY)); } - const SvxMarginItem* pMargin = &pPattern->GetItem(ATTR_MARGIN); - sal_uInt16 nIndent = 0; - if ( pPattern->GetItem(ATTR_HOR_JUSTIFY).GetValue() == - SvxCellHorJustify::Left ) - nIndent = pPattern->GetItem(ATTR_INDENT).GetValue(); - tools::Long nDifX = pMargin->GetLeftMargin() + nIndent; - if (!bInPrintTwips) - nDifX = static_cast<tools::Long>( nDifX * nPPTX ); + tools::Long nRightMargin = 0; + tools::Long nTopMargin = 0; + tools::Long nBottomMargin = 0; + tools::Long nDifX = 0; + { + tools::Long nLeftMargin = 0; + bool bInPrintTwipsOrig = bInPrintTwips; + bInPrintTwips = true; + tools::Long nIndent = GetIndent(pPattern); + GetMargins(pPattern, nLeftMargin, nTopMargin, nRightMargin, nBottomMargin); + bInPrintTwips = bInPrintTwipsOrig; + // Here rounding may be done only on the sum, ie nDifX, + // so need to get margin and indent in twips. + nDifX = nLeftMargin + nIndent; + if (!bInPrintTwips) + { + nDifX = static_cast<tools::Long>(nDifX * nPPTX); + nRightMargin = static_cast<tools::Long>(nRightMargin * nPPTX); + nTopMargin = static_cast<tools::Long>(nTopMargin * nPPTY); + nBottomMargin = static_cast<tools::Long>(nBottomMargin * nPPTY); + } + } + + aStartPos.AdjustX(nDifX * nLayoutSign ); - nCellX -= nDifX + (bInPrintTwips ? pMargin->GetRightMargin() : - static_cast<tools::Long>( pMargin->GetRightMargin() * nPPTX )); // due to line feed, etc. + nCellX -= nDifX + nRightMargin; // due to line feed, etc. // align vertical position to the one in the table tools::Long nDifY; - tools::Long nTopMargin = pMargin->GetTopMargin(); - if (!bInPrintTwips) - nTopMargin = static_cast<tools::Long>( nTopMargin * nPPTY ); SvxCellVerJustify eJust = pPattern->GetItem(ATTR_VER_JUSTIFY).GetValue(); // asian vertical is always edited top-aligned @@ -357,9 +402,7 @@ tools::Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, bool bF // font color doesn't matter here pPattern->GetFont( aFont, SC_AUTOCOL_BLACK, pDev, &aZoomY ); pDev->SetFont(aFont); - nTextHeight = pDev->GetTextHeight() + nTopMargin + - (bInPrintTwips ? pMargin->GetBottomMargin() : - static_cast<tools::Long>( pMargin->GetBottomMargin() * nPPTY )); + nTextHeight = pDev->GetTextHeight() + nTopMargin + nBottomMargin; } pDev->SetMapMode(aMode); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index c5230e949fea..c95bc00f701a 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -274,6 +274,25 @@ static void lcl_DrawHighlight( ScOutputData& rOutputData, const ScViewData& rVie } } +// Calculates top-left offset to be applied based on margins and indent. +static void lcl_GetEditAreaTLOffset(tools::Long& nOffsetX, tools::Long& nOffsetY, const ScAddress& rAddr, + const ScViewData& rViewData, ScDocument& rDoc) +{ + tools::Long nLeftMargin = 0; + tools::Long nTopMargin = 0; + tools::Long nIndent = 0; + tools::Long nDummy = 0; + ScEditUtil aEUtil(&rDoc, rAddr.Col(), rAddr.Row(), rAddr.Tab(), + Point(0, 0), nullptr, rViewData.GetPPTX(), + rViewData.GetPPTY(), Fraction(1.0), Fraction(1.0), + false /* bPrintTwips */); + const ScPatternAttr* pPattern = rDoc.GetPattern(rAddr); + nIndent = aEUtil.GetIndent(pPattern); + aEUtil.GetMargins(pPattern, nLeftMargin, nTopMargin, nDummy, nDummy); + nOffsetX = nIndent + nLeftMargin; + nOffsetY = nTopMargin; +} + void ScGridWindow::DoInvertRect( const tools::Rectangle& rPixel ) { if ( rPixel == aInvertRect ) @@ -1051,8 +1070,11 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI rDevice.DrawRect(rDevice.PixelToLogic(aBackground)); tools::Rectangle aEditRect(aBackground); - aEditRect.AdjustLeft(1); - aEditRect.AdjustTop(1); + tools::Long nOffsetX = 0, nOffsetY = 0; + // Get top-left offset because of margin and indent. + lcl_GetEditAreaTLOffset(nOffsetX, nOffsetY, ScAddress(nCol1, nRow1, nTab), mrViewData, rDoc); + aEditRect.AdjustLeft(nOffsetX + 1); + aEditRect.AdjustTop(nOffsetY + 1); // EditView has an 'output area' which is used to clip the 'paint area' we provide below. // So they need to be in the same coordinates/units. This is tied to the mapmode of the gridwin @@ -1148,8 +1170,12 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI if (bIsTiledRendering) { tools::Rectangle aEditRect(aBackground); - aEditRect.AdjustLeft(1); - aEditRect.AdjustTop(1); + tools::Long nOffsetX = 0, nOffsetY = 0; + // Get top-left offset because of margin and indent. + lcl_GetEditAreaTLOffset(nOffsetX, nOffsetY, ScAddress(nCol1, nRow1, mrViewData.GetTabNo()), mrViewData, rDoc); + aEditRect.AdjustLeft(nOffsetX + 1); + aEditRect.AdjustTop(nOffsetY + 1); + // EditView has an 'output area' which is used to clip the paint area we provide below. // So they need to be in the same coordinates/units. This is tied to the mapmode of the gridwin // attached to the EditView, so we have to change its mapmode too (temporarily). We save the commit 3bc70b74befd2cad85e40c913467b60d0407fbfe Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Feb 8 17:05:28 2021 +0000 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Feb 9 09:02:47 2021 +0100 default to CertificateValidity::INVALID so if CertGetCertificateChain fails we don't want validity to be css::security::CertificateValidity::VALID which is what the old default of 0 equates to notably commit 1e0bc66d16aee28ce8bd9582ea32178c63841902 Date: Thu Nov 5 16:55:26 2009 +0100 jl137: #103420# better logging turned the nss equivalent of SecurityEnvironment_NssImpl::verifyCertificate from 0 to CertificateValidity::INVALID like this change does Change-Id: I5350dbc22d1b9b378da2976d3b0abd728f1f4c27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110589 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx index 1540db695b54..c21158695d70 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx @@ -752,7 +752,7 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::verifyCertificate( const uno::Reference< css::security::XCertificate >& aCert, const uno::Sequence< uno::Reference< css::security::XCertificate > >& seqCerts) { - sal_Int32 validity = 0; + sal_Int32 validity = css::security::CertificateValidity::INVALID; PCCERT_CHAIN_CONTEXT pChainContext = nullptr; PCCERT_CONTEXT pCertContext = nullptr; @@ -896,7 +896,7 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::verifyCertificate( } else { - SAL_INFO("xmlsecurity.xmlsec", "CertGetCertificateChaine failed."); + SAL_INFO("xmlsecurity.xmlsec", "CertGetCertificateChain failed."); } } commit 3b928391b3398c1113e675ea6a542d05d9611e0a Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Feb 8 21:03:04 2021 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Feb 9 09:02:18 2021 +0100 tdf#134592 DOCX import: preserve formatting of CREATEDATE fields The create date of a document doesn't really change, so we can only loose if the cached result of the field is not preserved. Change-Id: I0105d9c5bb9a06cacc1f5fed2a10b6626fa80fd7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110596 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/writerfilter/CppunitTest_writerfilter_dmapper.mk b/writerfilter/CppunitTest_writerfilter_dmapper.mk index 7fe8b9035d3d..48b4ee87e087 100644 --- a/writerfilter/CppunitTest_writerfilter_dmapper.mk +++ b/writerfilter/CppunitTest_writerfilter_dmapper.mk @@ -33,6 +33,7 @@ $(eval $(call gb_CppunitTest_use_libraries,writerfilter_dmapper, \ sal \ test \ unotest \ + vcl \ )) $(eval $(call gb_CppunitTest_use_sdk_api,writerfilter_dmapper)) diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx b/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx index 6cd688975bd1..ef4c8ed40fb0 100644 --- a/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx @@ -19,6 +19,8 @@ #include <com/sun/star/text/XTextTablesSupplier.hpp> #include <com/sun/star/text/XTextTable.hpp> +#include <vcl/scheduler.hxx> + using namespace ::com::sun::star; namespace @@ -189,6 +191,27 @@ CPPUNIT_TEST_FIXTURE(Test, testFieldIfInsideIf) // i.e. some of the inner fields escaped outside the outer field. CPPUNIT_ASSERT_EQUAL(OUString("25"), xCell->getString()); } + +CPPUNIT_TEST_FIXTURE(Test, testCreateDatePreserve) +{ + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "create-date-preserve.docx"; + getComponent() = loadFromDesktop(aURL); + // Trigger idle layout. + Scheduler::ProcessEventsToIdle(); + uno::Reference<text::XTextDocument> xTextDocument(getComponent(), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); + uno::Reference<container::XEnumerationAccess> xPortionEnumAccess(xParaEnum->nextElement(), + uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xPortionEnum = xPortionEnumAccess->createEnumeration(); + uno::Reference<text::XTextRange> xPortion(xPortionEnum->nextElement(), uno::UNO_QUERY); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 7/7/2020 10:11:00 AM + // - Actual : 07/07/2020 + // i.e. the formatting of the create date field was lost. + CPPUNIT_ASSERT_EQUAL(OUString("7/7/2020 10:11:00 AM"), xPortion->getString()); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/qa/cppunittests/dmapper/data/create-date-preserve.docx b/writerfilter/qa/cppunittests/dmapper/data/create-date-preserve.docx new file mode 100644 index 000000000000..4a587ce0d2ef Binary files /dev/null and b/writerfilter/qa/cppunittests/dmapper/data/create-date-preserve.docx differ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 05e82a975173..c3cbbcb2a2b9 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6258,6 +6258,13 @@ void DomainMapper_Impl::SetFieldResult(OUString const& rResult) xFieldProperties->setPropertyValue( getPropertyName(bHasContent && sValue.isEmpty()? PROP_CONTENT : PROP_CURRENT_PRESENTATION), uno::makeAny( rResult )); + + if (xServiceInfo->supportsService( + "com.sun.star.text.TextField.DocInfo.CreateDateTime")) + { + // Creation time is const, don't try to update it. + xFieldProperties->setPropertyValue("IsFixed", uno::makeAny(true)); + } } } catch( const beans::UnknownPropertyException& ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits