core.git: editeng/source sw/qa
editeng/source/misc/svxacorr.cxx | 42 --- sw/qa/extras/uiwriter/data/tdf44293.fodt | 14 ++ sw/qa/extras/uiwriter/uiwriter8.cxx | 16 +++ 3 files changed, 68 insertions(+), 4 deletions(-) New commits: commit 7cc712eaa6757a461ac68532d77add2a49bd9181 Author: László Németh AuthorDate: Wed May 15 01:15:16 2024 +0200 Commit: László Németh CommitDate: Wed May 15 10:32:03 2024 +0200 tdf#44293 sw AutoCorrect: fix Portuguese ordinal indicators Add missing dot, support plural and alternative forms with 'r': – add missing dot: 1a -> 1.ª, 1o -> 1.º – support plural forms: 43as -> 43.ªˢ, 43os -> 43ºˢ - support alternative forms: 1ra -> 1.ª, 1ro -> 1.º, 43ras -> 43.ªˢ, 43ros -> 43.ºˢ Change-Id: Ibaeae958ca209edffb13f611ee8a71c80bf15a26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167649 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 12c63fc5f272..1597e523a766 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -507,28 +508,61 @@ bool SvxAutoCorrect::FnChgOrdinalNumber( if (bFoundEnd && isValidNumber) { sal_Int32 nNum = o3tl::toInt32(rTxt.subView(nSttPos, nNumEnd - nSttPos + 1)); +std::u16string_view sEnd = rTxt.subView(nNumEnd + 1, nEndPos - nNumEnd - 1); // Check if the characters after that number correspond to the ordinal suffix uno::Reference< i18n::XOrdinalSuffix > xOrdSuffix = i18n::OrdinalSuffix::create(comphelper::getProcessComponentContext()); -const uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix(nNum, rCC.getLanguageTag().getLocale()); -for (OUString const & sSuffix : aSuffixes) +uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix(nNum, rCC.getLanguageTag().getLocale()); + +// add extra suffixes for languages not handled by i18npool/ICU +if ( primary(eLang) == primary(LANGUAGE_PORTUGUESE) && +( nEndPos == nNumEnd + 3 || nEndPos == nNumEnd + 4 ) && +( sEnd[0] == 'a' || sEnd[0] == 'o' || sEnd[0] == 'r' ) ) { -std::u16string_view sEnd = rTxt.subView(nNumEnd + 1, nEndPos - nNumEnd - 1); + auto aExtendedSuffixes = comphelper::sequenceToContainer< std::vector >(aSuffixes); + aExtendedSuffixes.push_back("as"); // plural form of 'a' + aExtendedSuffixes.push_back("os"); // plural form of 'o' + aExtendedSuffixes.push_back("ra"); // alternative form of 'a' + aExtendedSuffixes.push_back("ro"); // alternative form of 'o' + aExtendedSuffixes.push_back("ras"); // alternative form of "as" + aExtendedSuffixes.push_back("ros"); // alternative form of "os" + aSuffixes = comphelper::containerToSequence(aExtendedSuffixes); +} +for (OUString const & sSuffix : aSuffixes) +{ if (sSuffix == sEnd) { // Check if the ordinal suffix has to be set as super script if (rCC.isLetter(sSuffix)) { +sal_Int32 nNumberChanged = 0; +sal_Int32 nSuffixChanged = 0; +// exceptions for Portuguese +// add missing dot: 1a -> 1.ª +// and remove optional 'r': 1ro -> 1.º +if ( primary(eLang) == primary(LANGUAGE_PORTUGUESE) ) +{ +if ( sSuffix.startsWith("r") ) +{ +rDoc.Delete( nNumEnd + 1, nNumEnd + 2 ); +nSuffixChanged = -1; +} +rDoc.Insert( nNumEnd + 1, "." ); +nNumberChanged = 1; +} + // Do the change SvxEscapementItem aSvxEscapementItem(DFLT_ESC_AUTO_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT); -rDoc.SetAttr(nNumEnd + 1, nEndPos, +rDoc.SetAttr(nNumEnd + 1 + nNumberChanged, +nEndPos + nNumberChanged + nSuffixChanged, SID_ATTR_CHAR_ESCAPEMENT, aSvxEscapementItem); bChg = true; +break; } } } diff --git a/sw/qa/extras/uiwriter/data/tdf44293.fodt
core.git: editeng/source sw/qa writerfilter/source
editeng/source/items/paraitem.cxx |2 sw/qa/extras/ooxmlexport/data/tdf160518_allowHyphenationAtTrackBottom.docx |binary sw/qa/extras/ooxmlexport/data/tdf160518_useWord2013TrackBottomHyphenation.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 64 ++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx |3 writerfilter/source/dmapper/PropertyIds.cxx |1 writerfilter/source/dmapper/PropertyIds.hxx |1 writerfilter/source/dmapper/SettingsTable.cxx | 17 ++ writerfilter/source/dmapper/SettingsTable.hxx |2 9 files changed, 85 insertions(+), 5 deletions(-) New commits: commit c8ee0e8f581b8a6e41b1a6b8aa4d40b442c1d463 Author: László Németh AuthorDate: Thu Apr 4 14:08:23 2024 +0200 Commit: László Németh CommitDate: Thu Apr 4 22:46:12 2024 +0200 tdf160518 DOCX: import hyphenation-keep to fix layout To fix layout interoperability, import DOCX compatSettings allowHyphenationAtTrackBottom and useWord2013TrackBottomHyphenation as hyphenation-keep setting "COLUMN", shifting last hyphenated lines of pages and columns, like MSO does. Follow-up to commit 9574a62add8e4901405e12117e75c86c2d2c2f21 "tdf#132599 cui offapi sw xmloff: implement hyphenate-keep". Change-Id: Ib2a06efc22a4f30d8f8be8a752460b09d09e97a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165798 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 3e99813f628d..4103fe2ea521 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -616,7 +616,7 @@ boolSvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) con bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { nMemberId &= ~CONVERT_TWIPS; -sal_Int16 nNewVal = 0; +sal_Int32 nNewVal = 0; // sal_Int32 needs for MID_HYPHEN_KEEP if( nMemberId != MID_IS_HYPHEN && nMemberId != MID_HYPHEN_NO_CAPS && nMemberId != MID_HYPHEN_NO_LAST_WORD ) diff --git a/sw/qa/extras/ooxmlexport/data/tdf160518_allowHyphenationAtTrackBottom.docx b/sw/qa/extras/ooxmlexport/data/tdf160518_allowHyphenationAtTrackBottom.docx new file mode 100644 index ..61e81cf1f539 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160518_allowHyphenationAtTrackBottom.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf160518_useWord2013TrackBottomHyphenation.docx b/sw/qa/extras/ooxmlexport/data/tdf160518_useWord2013TrackBottomHyphenation.docx new file mode 100644 index ..26acacc462b3 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160518_useWord2013TrackBottomHyphenation.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index a045a03407ff..c33275b62394 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include @@ -1424,6 +1426,68 @@ DECLARE_OOXMLEXPORT_TEST(testTdf159032, "tdf124795-5.docx") CPPUNIT_ASSERT_EQUAL(57, getPages()); } +DECLARE_OOXMLEXPORT_TEST(testTdf160518, "tdf160518_useWord2013TrackBottomHyphenation.docx") +{ +uno::Reference xHyphenator = LinguMgr::GetHyphenator(); +if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString( +return; + +// TODO: fix export too +if (isExported()) +return; +// This was 2 (without shifting last hyphenated line of the page) +CPPUNIT_ASSERT_EQUAL(3, getPages()); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf160518_compatible, "tdf160518_allowHyphenationAtTrackBottom.docx") +{ +uno::Reference xHyphenator = LinguMgr::GetHyphenator(); +if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString( +return; + +// TODO: fix export too +if (isExported()) +return; +// This is still 2 +CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf160518_ODT, "tdf160518_useWord2013TrackBottomHyphenation.docx") +{ +uno::Reference xHyphenator = LinguMgr::GetHyphenator(); +if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString( +return; + +// TODO: fix export too +if (isExported()) +return; +// This was 2 (without shifting last hyphenated line of the page) +CPPUNIT_ASSERT_EQUAL(3, getPages()); + +// check compatibility option in ODT export/import, too +saveAndReload("writer8"); + +CPPUNIT_ASSERT_EQUAL(3, getPages()); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf160518_ODT_compatible,
core.git: editeng/source sw/qa
editeng/source/editeng/impedit4.cxx |2 sw/qa/extras/uiwriter/data/tdf159049_LineBreakRTFClipboard.fodt | 300 ++ sw/qa/extras/uiwriter/uiwriter9.cxx | 35 + 3 files changed, 336 insertions(+), 1 deletion(-) New commits: commit c994f2491dd4e977f726f53de1953feff17c2227 Author: Regina Henschel AuthorDate: Tue Jan 9 21:41:40 2024 +0100 Commit: Regina Henschel CommitDate: Fri Jan 12 00:13:21 2024 +0100 tdf#159049 use RTF_LINE for EE_FEATURE_LINEBR for copy Copy of simple text uses ImpEditEngine::WriteItemAsRTF() method. Error was, that in case of a line break (' ') the string OOO_STRING_SVTOOLS_RTF_SL was written, but it needs to be the string OOO_STRING_SVTOOLS_RTF_LINE. Change-Id: I1c2ff2087c563b26e26d8768dfcfd1645be91d2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161842 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index b5151467079a..d63522a555c1 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -905,7 +905,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, break; case EE_FEATURE_LINEBR: { -rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_SL ); +rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_LINE ); } break; case EE_CHAR_KERNING: diff --git a/sw/qa/extras/uiwriter/data/tdf159049_LineBreakRTFClipboard.fodt b/sw/qa/extras/uiwriter/data/tdf159049_LineBreakRTFClipboard.fodt new file mode 100644 index ..22472c197053 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf159049_LineBreakRTFClipboard.fodt @@ -0,0 +1,300 @@ + + +http://openoffice.org/2004/office; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/200 4/writer" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:css3t="http://www.w3.org/TR/css3-text/; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:grddl="http://www.w3.org/2003/g/data-view#; office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + Regina Henschel2024-01-08T23:25:06.849002024-01-09T20:51:07.36300Regina HenschelPT18M48S8LOmyBuild/24.8.0.0.alpha0$Windows_X86_64 LibreOffice_project/00eae23267bf64e07cf057f828cd85f3c38ac669 + + + 0 + 0 + 21338 + 14543 + true + false + + + view2 + 11003 + 1000 + 0 + 0 + 21336 + 14542 + 0 + 1 + false + 100 + false + false + false + false + false + false + + + + + true + + false + false + false + false + true + 1 + true + false + false + false + + false + + false + false + false + Person + 0 + false + true + true + false + false + false + IDAnredeVornameNachname + 0 + + true + high-resolution + false + false + true + true + true + false + false + true + true + false + true + true + false + false + false + true + false + true + false + false + true + false + false + false + false + false + false + 757206 + 303919 + false + false + true + true + false + true + true + false + true + true + true + false + false + false + false + true + false + true + false + false + false + false + false + true + 0 + true + false + true + true + false + false + true + false + 0 + true + false + true + true + true + false + false +
[Libreoffice-commits] core.git: editeng/source sw/qa sw/source
editeng/source/editeng/impedit2.cxx |3 +-- sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt |1 + sw/qa/core/text/text.cxx | 13 +++-- sw/source/core/text/porlay.cxx |2 +- 4 files changed, 14 insertions(+), 5 deletions(-) New commits: commit 5526c523bc9fda890e15eacd45f280b0827f8ea0 Author: Khaled Hosny AuthorDate: Sat Jul 29 01:01:58 2023 +0300 Commit: Michael Stahl CommitDate: Mon Jul 31 12:32:17 2023 +0200 Fix surrogate pairs handling when tweaking script info Followup to: commit 3af30bafbedb8eb481024efb35cb7876c63d26dc Author: Khaled Hosny Date: Thu Jul 27 19:03:28 2023 +0300 sw: Handle surrogate pairs when tweaking script info and: commit d6efe8c302b81886706e18640148c51cf7883bbf Author: Khaled Hosny Date: Thu Jul 27 20:39:22 2023 +0300 tdf#112594: Group NNBSP with the Mongolian characters after it Change-Id: Ie273c457e4f3ed31a3372bc8eb0eb0055c1b97b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155053 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index d67c49b072b8..8d4960069cc8 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -1742,8 +1742,7 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) (nPrevChar == 0x202F /* NNBSP, tdf#112594 */ && u_getIntPropertyValue(nChar, UCHAR_SCRIPT) == USCRIPT_MONGOLIAN)) { ---nPos; -rTypes.back().nEndPos--; +rTypes.back().nEndPos = nPos = nPrevPos; break; } } diff --git a/sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt b/sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt index c14997a80741..5b54fc9e8601 100644 --- a/sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt +++ b/sw/qa/core/text/data/scriptinfo-surrogate-pairs.fodt @@ -287,6 +287,7 @@ 11◌ + 11퐀َ \ No newline at end of file diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index 9d9e99f8d99b..123be460df8c 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -1475,9 +1475,18 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testScriptinfosurrogatePairs) // Without the fix it fails with: // - Expected: 11 // - Actual : 11◌ -assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion[1]", "portion", u"11"); -assertXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwLinePortion[2]", "portion", +assertXPath(pXmlDoc, "//txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "portion", u"11"); +assertXPath(pXmlDoc, "//txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "portion", u"\u25CC\U00010EFD"); + +// Without the fix this would crash because we got a lone surrogate that +// can’t be converted to UTF-8, but if it were not for that it might fail +// with something like: +// - Expected: 11 +// - Actual : 11퐀 +assertXPath(pXmlDoc, "//txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "portion", u"11"); +assertXPath(pXmlDoc, "//txt[2]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "portion", +u"\U0001D400\u064E"); } CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf112594) diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 7d406a86df0c..567026d5b77a 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -1457,7 +1457,7 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& rNode, (nPrevChar == CHAR_NNBSP && u_getIntPropertyValue(nChar, UCHAR_SCRIPT) == USCRIPT_MONGOLIAN)) { ---nPos; +nPos = nPrevPos; } } m_ScriptChanges.emplace_back(TextFrameIndex(nPos), nScript);
[Libreoffice-commits] core.git: editeng/source sw/qa sw/source
editeng/source/editeng/impedit3.cxx |6 -- sw/qa/core/text/data/tdf129810.odt |binary sw/qa/core/text/text.cxx| 33 + sw/source/core/text/porlay.cxx |3 +++ 4 files changed, 40 insertions(+), 2 deletions(-) New commits: commit 4a92323b54e7d63a8bc0b8e62fdc6b31760dcd05 Author: Khaled Hosny AuthorDate: Fri Jun 23 19:10:49 2023 +0300 Commit: خالد حسني CommitDate: Sat Jun 24 01:01:18 2023 +0200 tdf#129810: Compress fullwidth CJK punctuation When compressions CJK punctuation, compress also full width versions to match Word behaviour. Change-Id: Ic35cfcbacca1974b7241d657f078148bac06478e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153530 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 7a82359e8851..510ab1624319 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -142,14 +142,16 @@ AsianCompressionFlags GetCharTypeForCompression( sal_Unicode cChar ) { case 0x3008: case 0x300A: case 0x300C: case 0x300E: case 0x3010: case 0x3014: case 0x3016: case 0x3018: -case 0x301A: case 0x301D: +case 0x301A: case 0x301D: case 0xFF09: case 0xFF3D: +case 0xFF5D: { return AsianCompressionFlags::PunctuationRight; } case 0x3001: case 0x3002: case 0x3009: case 0x300B: case 0x300D: case 0x300F: case 0x3011: case 0x3015: case 0x3017: case 0x3019: case 0x301B: case 0x301E: -case 0x301F: +case 0x301F: case 0xFF08: case 0xFF0C: case 0xFF0E: +case 0xFF1A: case 0xFF1B: case 0xFF3B: case 0xFF5B: { return AsianCompressionFlags::PunctuationLeft; } diff --git a/sw/qa/core/text/data/tdf129810.odt b/sw/qa/core/text/data/tdf129810.odt new file mode 100644 index ..b5a482b52caf Binary files /dev/null and b/sw/qa/core/text/data/tdf129810.odt differ diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index 96ffbf4e74a3..0997d64725b8 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -1424,6 +1425,38 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testParaUpperMarginFlyIntersect) CPPUNIT_ASSERT_EQUAL(521, nHeight); } +CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf129810) +{ +// Load the document, which embeds a CJK font. +createSwDoc("tdf129810.odt"); + +// Render the document to a metafile. +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwDocShell* pShell = pTextDoc->GetDocShell(); +std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); +CPPUNIT_ASSERT(xMetaFile); + +// Find the fist text array action +for (size_t nAction = 0; nAction < xMetaFile->GetActionSize(); nAction++) +{ +auto pAction = xMetaFile->GetAction(nAction); +if (pAction->GetType() == MetaActionType::TEXTARRAY) +{ +auto pTextArrayAction = static_cast(pAction); +auto pDXArray = pTextArrayAction->GetDXArray(); + +// There should be 13 chars on the first line +CPPUNIT_ASSERT_GREATER(size_t(13), pDXArray.size()); + +// Assert we are using the expected width for uncompressed chars +CPPUNIT_ASSERT_EQUAL(sal_Int32(720), pDXArray[0]); +// Assert we are using the expected width for compressed chars +CPPUNIT_ASSERT_EQUAL(sal_Int32(500), pDXArray[6] - pDXArray[5]); +break; +} +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 14ac23395dcf..4f15fbcccbf7 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -1481,6 +1481,7 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& rNode, case 0x3008: case 0x300A: case 0x300C: case 0x300E: case 0x3010: case 0x3014: case 0x3016: case 0x3018: case 0x301A: case 0x301D: +case 0xFF08: case 0xFF3B: case 0xFF5B: eState = SPECIAL_LEFT; break; // Right punctuation found @@ -1488,9 +1489,11 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& rNode, case 0x300D: case 0x300F: case 0x3011: case 0x3015: case 0x3017: case 0x3019: case 0x301B: case 0x301E: case 0x301F: +case 0xFF09: case 0xFF3D: case 0xFF5D: eState = SPECIAL_RIGHT; break; case 0x3001: case 0x3002: // Fullstop or comma +case 0xFF0C: case 0xFF0E: case 0xFF1A: case 0xFF1B: eState = SPECIAL_MIDDLE ; break;
[Libreoffice-commits] core.git: editeng/source sw/qa
editeng/source/misc/svxacorr.cxx| 102 sw/qa/extras/uiwriter/uiwriter6.cxx | 24 2 files changed, 82 insertions(+), 44 deletions(-) New commits: commit 075ecc1c31199d0fd0f930cf1b803b04a3b17ce8 Author: Mike Kaganski AuthorDate: Fri May 19 14:01:02 2023 +0300 Commit: Mike Kaganski CommitDate: Sat May 20 13:31:21 2023 +0200 tdf#155407: fix the second replacement in FnChgToEnEmDash It was broken from the beginning. The second replacement could look into a wrong string when checking if the characters around the "--" are eligible; it could use obsolete indices in the document, ignoring the previous replacement that changed the lendth of the text. This also replaces a use of char* to hold Unicode codepoints to pass to lcl_IsInAsciiArr, with an array of sal_Unicode (because all the checked values fit into it). Change-Id: I949630abc564fc0875be0b92228846497bb1a022 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152002 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index dfb1e6c0d726..318da6536df9 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -100,11 +100,13 @@ constexpr OUStringLiteral pXMLImplWordStart_ExcptLstStr = u"WordExceptList.xml"; constexpr OUStringLiteral pXMLImplCplStt_ExcptLstStr = u"SentenceExceptList.xml"; constexpr OUStringLiteral pXMLImplAutocorr_ListStr = u"DocumentList.xml"; -const char +// tdf#54409 check also typographical quotation marks in the case of skipped ASCII quotation marks +// Curious, why these \u0083\u0084\u0089\u0091\u0092\u0093\u0094 are handled as "begin characters"? +constexpr std::u16string_view /* also at these beginnings - Brackets and all kinds of begin characters */ -sImplSttSkipChars[] = "\"\'([{\x83\x84\x89\x91\x92\x93\x94", +sImplSttSkipChars = u"\"'([{\u2018\u2019\u201a\u201b\u201c\u201d\u201e\u201f\u0083\u0084\u0089\u0091\u0092\u0093\u0094", /* also at these ends - Brackets and all kinds of begin characters */ -sImplEndSkipChars[] = "\"\')]}\x83\x84\x89\x91\x92\x93\x94"; +sImplEndSkipChars = u"\"')]}\u2018\u2019\u201a\u201b\u201c\u201d\u201e\u201f\u0083\u0084\u0089\u0091\u0092\u0093\u0094"; static OUString EncryptBlockName_Imp(std::u16string_view rName); @@ -171,20 +173,12 @@ static bool lcl_IsSymbolChar( CharClass const & rCC, const OUString& rTxt, return false; } -static bool lcl_IsInAsciiArr( const char* pArr, const sal_Unicode c ) +static bool lcl_IsInArr(std::u16string_view arr, const sal_uInt32 c) { -// tdf#54409 check also typographical quotation marks in the case of skipped ASCII quotation marks -if ( 0x2018 <= c && c <= 0x201F && (pArr == sImplSttSkipChars || pArr == sImplEndSkipChars) ) -return true; - -bool bRet = false; -for( ; *pArr; ++pArr ) -if( *pArr == c ) -{ -bRet = true; -break; -} -return bRet; +for (const auto c1 : arr) +if (c1 == c) +return true; +return false; } SvxAutoCorrDoc::~SvxAutoCorrDoc() @@ -312,6 +306,8 @@ ACFlags SvxAutoCorrect::GetDefaultFlags() constexpr sal_Unicode cEmDash = 0x2014; constexpr sal_Unicode cEnDash = 0x2013; +constexpr OUStringLiteral sEmDash(u"\u2014"); +constexpr OUStringLiteral sEnDash(u"\u2013"); constexpr sal_Unicode cApostrophe = 0x2019; constexpr sal_Unicode cLeftDoubleAngleQuote = 0xAB; constexpr sal_Unicode cRightDoubleAngleQuote = 0xBB; @@ -485,10 +481,10 @@ bool SvxAutoCorrect::FnChgOrdinalNumber( CharClass& rCC = GetCharClass(eLang); for (; nSttPos < nEndPos; ++nSttPos) -if (!lcl_IsInAsciiArr(sImplSttSkipChars, rTxt[nSttPos])) +if (!lcl_IsInArr(sImplSttSkipChars, rTxt[nSttPos])) break; for (; nSttPos < nEndPos; --nEndPos) -if (!lcl_IsInAsciiArr(sImplEndSkipChars, rTxt[nEndPos - 1])) +if (!lcl_IsInArr(sImplEndSkipChars, rTxt[nEndPos - 1])) break; @@ -558,6 +554,7 @@ bool SvxAutoCorrect::FnChgToEnEmDash( // rTxt may refer to the frame text that will change in the calls to rDoc.Delete / rDoc.Insert; // keep a local copy for later use OUString aOrigTxt = rTxt; +sal_Int32 nFirstReplacementTextLengthChange = 0; // replace " - " or " --" with "enDash" if( 1 < nSttPos && 1 <= nEndPos - nSttPos ) @@ -570,7 +567,7 @@ bool SvxAutoCorrect::FnChgToEnEmDash( '-' == rTxt[ nSttPos+1 ]) { sal_Int32 n; -for( n = nSttPos+2; n < nEndPos && lcl_IsInAsciiArr( +for( n = nSttPos+2; n < nEndPos && lcl_IsInArr( sImplSttSkipChars,(cCh = rTxt[ n ])); ++n ) ; @@ -578,7 +575,7 @@ bool SvxAutoCorrect::FnChgToEnEmDash(
[Libreoffice-commits] core.git: editeng/source sw/qa
editeng/source/misc/svxacorr.cxx | 39 +++- sw/qa/extras/uiwriter/data/tdf151801.fodt | 260 ++ sw/qa/extras/uiwriter/uiwriter8.cxx | 49 + 3 files changed, 339 insertions(+), 9 deletions(-) New commits: commit 5f249506ff2eddeaac47d521509bf1dde0b58d01 Author: Fred Kruse AuthorDate: Sun Nov 13 18:37:31 2022 +0100 Commit: Miklos Vajna CommitDate: Fri Nov 25 11:08:12 2022 +0100 tdf#151801 solves bug for autocorrect non default quotes Regards German and some other languages. A bug in the mechanism to distingish between apostroph and single end quote is solved. Now, it works also for user defined quotes, like a single angle quote ('French' quote). Change-Id: Ib4beca7a4304d57d7fdf977c20cf62410be3d2c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142662 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index cf5d7474e49d..5e229ba10d24 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1280,7 +1280,7 @@ OUString SvxAutoCorrect::GetQuote( SvxAutoCorrDoc const & rDoc, sal_Int32 nInsPo // search preceding opening quote in the paragraph before the insert position static bool lcl_HasPrecedingChar( std::u16string_view rTxt, sal_Int32 nPos, -const sal_Unicode sPrecedingChar, const sal_Unicode* aStopChars ) +const sal_Unicode sPrecedingChar, const sal_Unicode sStopChar, const sal_Unicode* aStopChars ) { sal_Unicode cTmpChar; @@ -1289,6 +1289,9 @@ static bool lcl_HasPrecedingChar( std::u16string_view rTxt, sal_Int32 nPos, if ( cTmpChar == sPrecedingChar ) return true; +if ( cTmpChar == sStopChar ) +return false; + for ( const sal_Unicode* pCh = aStopChars; *pCh; ++pCh ) if ( cTmpChar == *pCh ) return false; @@ -1358,13 +1361,15 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, ( ( eLang == LANGUAGE_HUNGARIAN && lcl_HasPrecedingChar( rTxt, nInsPos, bSttQuote ? aStopDoubleAngleQuoteStart[0] : aStopDoubleAngleQuoteEnd[0], -bSttQuote ? aStopDoubleAngleQuoteStart + 1 : aStopDoubleAngleQuoteEnd + 1 ) ) || +bSttQuote ? aStopDoubleAngleQuoteStart[1] : aStopDoubleAngleQuoteEnd[1], +bSttQuote ? aStopDoubleAngleQuoteStart + 1 : aStopDoubleAngleQuoteEnd + 2 ) ) || ( eLang.anyOf( LANGUAGE_ROMANIAN, LANGUAGE_ROMANIAN_MOLDOVA ) && lcl_HasPrecedingChar( rTxt, nInsPos, bSttQuote ? aStopDoubleAngleQuoteStart[0] : aStopDoubleAngleQuoteEndRo[0], -bSttQuote ? aStopDoubleAngleQuoteStart + 1 : aStopDoubleAngleQuoteEndRo + 1 ) ) ) ) +bSttQuote ? aStopDoubleAngleQuoteStart[1] : aStopDoubleAngleQuoteEndRo[1], +bSttQuote ? aStopDoubleAngleQuoteStart + 1 : aStopDoubleAngleQuoteEndRo + 2 ) ) ) ) { LocaleDataWrapper& rLcl = GetLocaleDataWrapper( eLang ); // only if the opening double quotation mark is the default one @@ -1375,7 +1380,7 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, // tdf#128860 use apostrophe outside of second level quotation in Czech, German, Icelandic, // Slovak and Slovenian instead of the – in this case, bad – closing quotation mark U+2018. // tdf#123786 the same for Russian and Ukrainian -( ( eLang.anyOf ( +( eLang.anyOf ( LANGUAGE_CZECH, LANGUAGE_GERMAN, LANGUAGE_GERMAN_SWISS, @@ -1384,17 +1389,33 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, LANGUAGE_GERMAN_LIECHTENSTEIN, LANGUAGE_ICELANDIC, LANGUAGE_SLOVAK, - LANGUAGE_SLOVENIAN ) && -!lcl_HasPrecedingChar( rTxt, nInsPos, aStopSingleQuoteEnd[0], aStopSingleQuoteEnd + 1 ) ) || + LANGUAGE_SLOVENIAN ) ) ) +{ +sal_Unicode sStartChar = GetStartSingleQuote(); +sal_Unicode sEndChar = GetEndSingleQuote(); +if ( !sStartChar || !sEndChar ) { +LocaleDataWrapper& rLcl = GetLocaleDataWrapper(
[Libreoffice-commits] core.git: editeng/source sw/qa sw/source writerfilter/source
editeng/source/items/frmitems.cxx |3 + sw/qa/extras/odfexport/odfexport.cxx |2 sw/qa/extras/rtfexport/data/tdf129631_lostBorders3.rtf | 27 + sw/qa/extras/rtfexport/rtfexport4.cxx | 51 + sw/source/filter/ww8/rtfattributeoutput.cxx| 20 -- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 15 + 6 files changed, 110 insertions(+), 8 deletions(-) New commits: commit eca3ce35fe9a346965a32f42d02cb6d3f5a3982f Author: Michael Stahl AuthorDate: Wed Aug 10 14:04:44 2022 +0200 Commit: Michael Stahl CommitDate: Thu Aug 11 19:07:57 2022 +0200 tdf#129631 writerfilter,sw: RTF import of invalid border... ... and export of border on paragraph that clears the border from the paragraph style. The import problem is that a lone \brdrcf17 without any preceding keyword about which border it belongs to (as required by the EBNF in the RTF spec) is apparently handled by Word as overriding/clearing all paragraph borders that may be inherited from the paragraph style. The export problem is that a null SvxBorderLine isn't exported at all, but there needs to be a \brdrnone to override the definition from the style. There was also an API problem that the null SvxBorderLine is wrongly converted to a table::BorderLine2 with LineStyle SOLID. Change-Id: I5fa3857de2ef843f5194e12dd0c3e57bcf1ca52b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138089 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index c4c79dc0428b..35e1be7b094c 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1387,7 +1387,10 @@ table::BorderLine2 SvxBoxItem::SvxLineToLine(const SvxBorderLine* pLine, bool bC aLine.LineWidth = sal_uInt32( bConvert ? convertTwipToMm100( pLine->GetWidth( ) ) : pLine->GetWidth( ) ); } else +{ aLine.Color = aLine.InnerLineWidth = aLine.OuterLineWidth = aLine.LineDistance = 0; +aLine.LineStyle = table::BorderLineStyle::NONE; // 0 is SOLID! +} return aLine; } diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 25110963896e..ad65d884437b 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -,7 +,7 @@ DECLARE_ODFEXPORT_TEST(testCharacterBorder, "charborder.odt") table::BorderLine2(0xFF,0,37,0,14,37), // Top (fine dashed line) table::BorderLine2(0x99FF66,26,26,53,11,106), // Bottom table::BorderLine2(0xFF,9,26,9,12,71), // Left -table::BorderLine2(0,0,0,0,0,0)// Right +table::BorderLine2(0,0,0,0,table::BorderLineStyle::NONE,0) // Right }; sal_Int32 aDistances[4] = { 400 /*Top*/, 300 /*Bottom*/, 250 /*Left*/, 0 /*Right*/ }; diff --git a/sw/qa/extras/rtfexport/data/tdf129631_lostBorders3.rtf b/sw/qa/extras/rtfexport/data/tdf129631_lostBorders3.rtf new file mode 100644 index ..dba7db7dc8e5 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf129631_lostBorders3.rtf @@ -0,0 +1,27 @@ +{\rtf1\ansi\deff4\adeflang1025 +{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 Arial;}{\f3\froman\fprq2\fcharset0 Liberation Serif{\*\falt Times New Roman};}{\f4\froman\fprq0\fcharset0 Times New Roman;}{\f5\fnil\fprq2\fcharset0 DejaVu Sans;}} +{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red6\green154\blue46;} +{\stylesheet{\s0\snext0\dbch\af5\langfe2052\dbch\af4\afs24\alang1025\ql\widctlpar\ltrpar\hyphpar0\aspalpha\cf0\loch\f3\fs24\lang255\kerning1 Normal;} +{\*\cs15\snext15 CharShadow;} +{\*\cs16\sbasedon15\snext16 CharShadow-removed;} +{\s17\sbasedon0\snext18\dbch\af5\langfe2052\dbch\af4\afs28\alang1025\ql\widctlpar\sb240\sa120\keepn\ltrpar\cf0\loch\f4\fs28\lang255\kerning1 Heading;} +{\s18\sbasedon0\snext18\dbch\af5\langfe2052\dbch\af4\afs24\alang1025\sl276\slmult1\ql\widctlpar\sb0\sa140\ltrpar\cf0\loch\f3\fs24\lang255\kerning1 Text Body;} +{\s19\sbasedon18\snext19\dbch\af5\langfe2052\dbch\af4\afs24\alang1025\sl276\slmult1\ql\widctlpar\sb0\sa140\ltrpar\cf0\loch\f4\fs24\lang255\kerning1 List;} +{\s20\sbasedon0\snext20\dbch\af5\langfe2052\dbch\af4\afs24\alang1025\ai\ql\widctlpar\sb120\sa120\noline\ltrpar\cf0\loch\f4\fs24\lang255\i\kerning1 Caption;}
[Libreoffice-commits] core.git: editeng/source sw/qa sw/source
editeng/source/rtf/rtfitem.cxx |2 +- sw/qa/extras/uiwriter/uiwriter3.cxx |2 +- sw/source/uibase/dochdl/swdtflvr.cxx |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) New commits: commit a58701650c2dd7ad8514752d571aa2569690fe37 Author: Andrea Gelmini AuthorDate: Wed Apr 27 16:46:55 2022 +0200 Commit: Julien Nabet CommitDate: Wed Apr 27 19:42:03 2022 +0200 Fix typos Change-Id: I04c9c441a7e93cd998e99e4ede7d9894e14c364e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133519 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index bd75fe465567..1434657f7fdc 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -1114,7 +1114,7 @@ ATTR_SETEMPHASIS: } break; -// We expect these to be preceeded by a RTF_HYPHEN and +// We expect these to be preceded by a RTF_HYPHEN and // so normally are handled by the RTF_HYPHEN case, but // if they appear 'bare' in a document then safely skip // them here diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 0d06474d1c6d..91b16d045868 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -2647,7 +2647,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf148791) Scheduler::ProcessEventsToIdle(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); -// Paste as Rows Above results 4-row table with default table aligment +// Paste as Rows Above results 4-row table with default table alignment assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 4); assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[1]/cell[1]/txt/Text", "Portion", "hello"); assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[3]/cell[1]/txt/Text", "Portion", "hello"); diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index a6e0060978be..43cd6bba9717 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -1580,7 +1580,7 @@ bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, RndSt sal_Int32 nTableLevel = lcl_getLevel(aExpand, nIdx); // table rows repeated heading use extra indentation, too: // is always used here, and the first table with is not nested, -// if its indentation level is greater only by 1, than intentation level of the table +// if its indentation level is greater only by 1, than indentation level of the table bool bShifted = lcl_getLevel(aExpand, aExpand.indexOf("
[Libreoffice-commits] core.git: editeng/source sw/qa xmloff/source
editeng/source/items/numitem.cxx| 12 + sw/qa/uitest/data/tdf144578.odt |binary sw/qa/uitest/writer_tests7/tdf144578.py | 66 xmloff/source/style/xmlnumi.cxx |4 - 4 files changed, 79 insertions(+), 3 deletions(-) New commits: commit e6bf21d2d5efb231c877eb985997b28033198600 Author: Vasily Melenchuk AuthorDate: Mon Sep 27 13:40:41 2021 +0300 Commit: Vasily Melenchuk CommitDate: Mon Oct 4 15:29:45 2021 +0200 tdf#144578: numbering: generate include upper levels for UI In spite of used list format in ODF for UI we still need to show prefix/suffix (already was there) and included upper levels (done in this patch) for correct visualization of level properties. Moved initialization of ListLevel to later steps to avoid overriding of generated values for prefix, suffix and IncludeUpperLevel by some invalid values. Change-Id: I5d132426c06021ed526d16fb09276523105aa7b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122686 Tested-by: Jenkins Reviewed-by: Vasily Melenchuk diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 7348eb16df4d..ca454d92f894 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -621,7 +621,9 @@ void SvxNumberFormat::SetListFormat(std::optional oSet) sListFormat = oSet; -// For backward compatibility and UI we should create prefix/suffix also +// For backward compatibility and UI we should create something looking like +// a prefix, suffix and included levels also. This is not possible in general case +// since level format string is much more flexible. But for most cases is okay sal_Int32 nFirstReplacement = sListFormat->indexOf('%'); sal_Int32 nLastReplacement = sListFormat->lastIndexOf('%') + 1; if (nFirstReplacement > 0) @@ -630,6 +632,14 @@ void SvxNumberFormat::SetListFormat(std::optional oSet) if (nLastReplacement >= 0 && nLastReplacement < sListFormat->getLength()) // Everything beyond last '%' is a suffix sSuffix = sListFormat->copy(nLastReplacement); + +sal_uInt8 nPercents = 0; +for (sal_Int32 i = 0; i < sListFormat->getLength(); i++) +{ +if ((*sListFormat)[i] == '%') +nPercents++; +} +nInclUpperLevels = nPercents/2; } OUString SvxNumberFormat::GetListFormat(bool bIncludePrefixSuffix /*= true*/) const diff --git a/sw/qa/uitest/data/tdf144578.odt b/sw/qa/uitest/data/tdf144578.odt new file mode 100644 index ..d8f0f0f830ee Binary files /dev/null and b/sw/qa/uitest/data/tdf144578.odt differ diff --git a/sw/qa/uitest/writer_tests7/tdf144578.py b/sw/qa/uitest/writer_tests7/tdf144578.py new file mode 100644 index ..259b26ed8298 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf144578.py @@ -0,0 +1,66 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +import time + +class tdf144578(UITestCase): + +def test_tdf144578(self): +with self.ui_test.load_file(get_url_for_data_file("tdf144578.odt")) as writer_doc: +with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: +# Select level "1" +xLevelsTree = xDialog.getChild("level") +xLevel = xLevelsTree.getChild("0") +xLevel.executeAction("SELECT", tuple()) +# Check value for show upper levels +xSubLevels = xDialog.getChild("sublevelsnf") +self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "1") + +# Select level "2" +xLevel = xLevelsTree.getChild("1") +xLevel.executeAction("SELECT", tuple()) +# Check value for show upper levels +xSubLevels = xDialog.getChild("sublevelsnf") +self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "2") + +# Select level "3" +xLevel = xLevelsTree.getChild("2") +xLevel.executeAction("SELECT", tuple()) +# Check value for show upper levels +xSubLevels = xDialog.getChild("sublevelsnf") +self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "3") + +# Select level "3" +xLevel = xLevelsTree.getChild("3") +xLevel.executeAction("SELECT", tuple()) +# Check value for show upper levels +xSubLevels = xDialog.getChild("sublevelsnf") +
[Libreoffice-commits] core.git: editeng/source sw/qa sw/source writerfilter/source
editeng/source/items/frmitems.cxx|2 - sw/qa/core/layout/layout.cxx | 30 +++ sw/source/core/layout/paintfrm.cxx | 27 sw/source/filter/ww8/docxattributeoutput.cxx |9 writerfilter/source/dmapper/PropertyMap.cxx | 26 --- writerfilter/source/dmapper/PropertyMap.hxx |3 +- 6 files changed, 65 insertions(+), 32 deletions(-) New commits: commit ebceee31d92f04b58e795d02a26f62b717c47737 Author: Miklos Vajna AuthorDate: Mon Mar 1 10:37:49 2021 +0100 Commit: Miklos Vajna CommitDate: Mon Mar 1 20:56:03 2021 +0100 tdf#140342 sw layout: remove explicit gutter handling when positioning borders Word has two modes the specify border positions: the distance can be measured from the edge of the page or from text. Similar to how documents that have page borders but no gutter, page page border + gutter documents should be always measured "from text" by the layout. "From page" should be a concern for Word filters. "From page" was already working -- fix "from text" by changing the layout to do "from text" and then extending DOCX import/export to handle gutter while handling the "from page" page borders. This also requires allowing nominally negative top margins, because we want to have the gutter unchanged, but the border might want to be on the gutter area, which is only possible with a negative top margin. Change-Id: I7f2c9943357359e76cb554cb2a65b93a492e694b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111735 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 45cd825eab54..d010089b3052 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -725,7 +725,7 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } break; case MID_UP_MARGIN : -if(!(rVal >>= nVal) || nVal < 0) +if(!(rVal >>= nVal)) return false; SetUpper(static_cast(bConvert ? convertMm100ToTwip(nVal) : nVal)); break; diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index a9a738f26e1d..7cd052725639 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -357,6 +357,36 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMirrorMargin) CPPUNIT_ASSERT_EQUAL(nGutterTwips, nOldRight - nNewRight); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMarginPageBorder) +{ +// FIXME this is 3369 on macOS -- calculate this number dynamically? +#if !defined(MACOSX) +// Given a document with a non-0 gutter margin. +SwDoc* pDoc = createSwDoc(); +uno::Reference xStandard(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); +sal_Int32 nGutterMm100 = 2000; +xStandard->setPropertyValue("GutterMargin", uno::makeAny(nGutterMm100)); + +// When setting a left border. +table::BorderLine2 aBorder; +aBorder.LineWidth = 2; +aBorder.OuterLineWidth = 2; +xStandard->setPropertyValue("LeftBorder", uno::makeAny(aBorder)); + +// Then make sure border is at the left edge of the text area. +SwDocShell* pShell = pDoc->GetDocShell(); +std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); +MetafileXmlDump dumper; +xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 2565 +// - Actual : 1425 +// Where 2565 is close to the left edge of the text area (2553). +assertXPath(pXmlDoc, "//polyline[@style='solid']/point[1]", "x", "2565"); +#endif +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index ef69c5ff81ba..b3c940b87cea 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1289,33 +1289,6 @@ static void lcl_CalcBorderRect( SwRect , const SwFrame *pFrame, SwRectFn fnRect = pFrame->IsVertical() ? ( pFrame->IsVertLR() ? (pFrame->IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert ) : fnRectHori; -if (pFrame->IsPageFrame() && rAttrs.GetLRSpace()) -{ -tools::Long nGutterMargin = rAttrs.GetLRSpace()->GetGutterMargin(); -tools::Long nRightGutterMargin = rAttrs.GetLRSpace()->GetRightGutterMargin(); -const auto pPageFrame = static_cast(pFrame); -bool bGutterAtTop = pPageFrame->GetFormat()->getIDocumentSettingAccess().get( -DocumentSettingId::GUTTER_AT_TOP); -if (bGutterAtTop) -{ -// Paint the top border based on the top
[Libreoffice-commits] core.git: editeng/source sw/qa
editeng/source/misc/svxacorr.cxx |5 - sw/qa/extras/uiwriter/uiwriter.cxx | 10 ++ 2 files changed, 14 insertions(+), 1 deletion(-) New commits: commit d1be3d80d0ca5ccd7639ede379a1befc48dc73f2 Author: László Németh AuthorDate: Thu Feb 25 10:55:57 2021 +0100 Commit: László Németh CommitDate: Fri Feb 26 09:48:09 2021 +0100 tdf#134940 sw: fix AutoCorrect of arrow "-->" Fix bad replacement of "-->" with "–>" instead of "→" (i.e. premature replacement of "--" to n-dash) since '>' was added to IsAutoCorrectChar(). Regression from commit 57f07b1d7378d218648667c5b1315cc8ad905875 "tdf#133524 AutoCorrect: support double angle quotes". Change-Id: I06f0cddb48d13c8e230dab964f79f588799ed4ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111527 Tested-by: László Németh Reviewed-by: László Németh diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index a551188a4c66..ce1f788f593c 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1515,7 +1515,10 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, if( lcl_IsSymbolChar( rCC, rTxt, nCapLttrPos, nInsPos )) break; -if( IsAutoCorrFlag( ACFlags::Autocorrect ) ) +if( IsAutoCorrFlag( ACFlags::Autocorrect ) && +// tdf#134940 fix regression of arrow "-->" resulted by premature +// replacement of "--" since '>' was added to IsAutoCorrectChar() +'>' != cChar ) { // WARNING ATTENTION: rTxt is an alias of the text node's OUString // and becomes INVALID if ChgAutoCorrWord returns true! diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index e63329f03bd8..7495b9ab74ff 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -7870,6 +7870,16 @@ void SwUiWriterTest::testTdf133524() pWrtShell->AutoCorrect(corr, '"'); sReplaced += u".”"; CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); +// tdf#134940 avoid premature replacement of "--" in "-->" +pWrtShell->Insert(u" --"); +pWrtShell->AutoCorrect(corr, '>'); +OUString sReplaced2(sReplaced + u" -->"); +// This was "–>" instead of "-->" +CPPUNIT_ASSERT_EQUAL(sReplaced2, static_cast(pDoc->GetNodes()[nIndex])->GetText()); +pWrtShell->AutoCorrect(corr, ' '); +sReplaced += u" → "; +// This was "–>" instead of "→" +CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); } void SwUiWriterTest::testTdf133524_Romanian() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source sw/qa
editeng/source/editeng/impedit2.cxx | 29 ++- sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py | 39 2 files changed, 46 insertions(+), 22 deletions(-) New commits: commit 79bfb54665b1a8dc2b932318eb6915d300772cff Author: Justin Luth AuthorDate: Thu Dec 24 13:24:30 2020 +0300 Commit: Miklos Vajna CommitDate: Fri Jan 15 16:04:40 2021 +0100 tdf#137459 editeng: Ctrl+Del must only delete right If there was nothing else at the end of the paragraph, Ctrl+Del was acting like Ctrl+Backspace - it turned around and started deleting the earlier words. Instead, we need to keep deleting to the right, starting with the next paragraph. That's what Ctrl-Backspace does in reverse anyway. It looks like this was just a copy-paste mistake already seen at original import and the few times that people tried to fix up this area, they didn't notice that apparently? But then again, the code changes don't look that impressive either... [if x == 1, set x=1?] make UITest_writer_tests UITEST_TEST_NAME=\ tdf137459_editeng_ctrl-DEL.tdf137459.test_tdf137459 Change-Id: I0c2268f9f1a2102997b2e84b0b7a6d0e2da43b15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108265 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index d2596ebd9065..8ea35eb3e91f 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -2359,34 +2359,19 @@ EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, sal_uInt8 n else if ( nDelMode == DeleteMode::RestOfWord ) { aDelEnd = EndOfWord( aCurPos ); - if (aDelEnd.GetIndex() == aCurPos.GetIndex()) { const sal_Int32 nLen(aCurPos.GetNode()->Len()); - -// #i120020# when 0 == nLen, aDelStart needs to be adapted, not -// aDelEnd. This would (and did) lead to a wrong order in the -// ImpConnectParagraphs call later. -if(nLen) +// end of para? +if (aDelEnd.GetIndex() == nLen) { -// end of para? -if (aDelEnd.GetIndex() == nLen) -{ -aDelEnd = WordLeft( aCurPos ); -} -else // there's still sth to delete on the right -{ -aDelEnd = EndOfWord( WordRight( aCurPos ) ); -// if there'n no next word... -if (aDelEnd.GetIndex() == nLen ) -{ -aDelEnd.SetIndex( nLen ); -} -} +ContentNode* pNext = GetNextVisNode( aCurPos.GetNode() ); +if ( pNext ) +aDelEnd = EditPaM( pNext, 0 ); } -else +else // there's still something to delete on the right { -aDelStart = WordLeft(aCurPos); +aDelEnd = EndOfWord( WordRight( aCurPos ) ); } } } diff --git a/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py b/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py new file mode 100644 index ..1c8c1e54fef0 --- /dev/null +++ b/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py @@ -0,0 +1,39 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +import time +from uitest.uihelper.common import get_state_as_dict, type_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf137459(UITestCase): + +def test_tdf137459(self): + +xMainDoc = self.ui_test.create_doc_in_start_center("writer") + +xMainWindow = self.xUITest.getTopFocusWindow() + +xwriter_edit = xMainWindow.getChild("writer_edit") +# adding new Comment +self.xUITest.executeCommand(".uno:InsertAnnotation") +# wait until the comment is available +self.ui_test.wait_until_child_is_available(xMainWindow, 'Comment1') + +xComment1 = xMainWindow.getChild("Comment1") +sText = "Ctrl+Del should not delete BACKWARDS" +xComment1.executeAction("TYPE", mkPropertyValues({"TEXT": sText})) +self.assertEqual(get_state_as_dict(xComment1)["Text"], sText ) + +xComment1.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+DELETE"})) +
[Libreoffice-commits] core.git: editeng/source sw/qa
editeng/source/misc/svxacorr.cxx | 39 +++ sw/qa/extras/uiwriter/data/tdf133524_ro.fodt | 14 +++ sw/qa/extras/uiwriter/uiwriter.cxx | 54 --- 3 files changed, 85 insertions(+), 22 deletions(-) New commits: commit 99d4bf9446c392c3cf2877219c78917ca4d5dd87 Author: László Németh AuthorDate: Sat Jul 4 16:37:33 2020 +0200 Commit: László Németh CommitDate: Sun Jul 5 10:10:43 2020 +0200 tdf#133524 AutoCorrect: fix Romanian nested quotations typing " inside primary quotation marks: use the correct order of the double angle quotes: „... «quote» ...” Add also Aragonese, Asturian and Catalan to the "<<" and ">>" replacement. See commit 57f07b1d7378d218648667c5b1315cc8ad905875 (tdf#133524 AutoCorrect: support double angle quotes). Change-Id: I2e80cc45768eefa3eb62b446ca822ee6c46f7242 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97970 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 8b47ece89fae..9fc509483fa0 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -318,8 +318,10 @@ constexpr sal_Unicode cLeftSingleAngleQuote = 0x2039; constexpr sal_Unicode cRightSingleAngleQuote = 0x203A; // stop characters for searching preceding quotes // (the first character is also the opening quote we are looking for) -const sal_Unicode aStopDoubleAngleQuoteStart[] = { 0x201E, 0x201D, 0 }; // preceding ,, +const sal_Unicode aStopDoubleAngleQuoteStart[] = { 0x201E, 0x201D, 0x201C, 0 }; // preceding ,, const sal_Unicode aStopDoubleAngleQuoteEnd[] = { cRightDoubleAngleQuote, cLeftDoubleAngleQuote, 0x201D, 0x201E, 0 }; // preceding >> +// preceding << for Romanian, handle also alternative primary closing quotation mark U+201C +const sal_Unicode aStopDoubleAngleQuoteEndRo[] = { cLeftDoubleAngleQuote, cRightDoubleAngleQuote, 0x201D, 0x201E, 0x201C, 0 }; const sal_Unicode aStopSingleQuoteEnd[] = { 0x201A, 0x2018, 0x201C, 0x201E, 0 }; const sal_Unicode aStopSingleQuoteEndRuUa[] = { 0x201E, 0x201C, cRightDoubleAngleQuote, cLeftDoubleAngleQuote, 0 }; @@ -1212,7 +1214,12 @@ void SvxAutoCorrect::InsertQuote( SvxAutoCorrDoc& rDoc, sal_Int32 nInsPos, if ( eType == ACQuotes::DoubleAngleQuote ) { bool bSwiss = eLang == LANGUAGE_FRENCH_SWISS; -cRet = ( '<' == cInsChar || ('\"' == cInsChar && !bSttQuote) ) +// pressing " inside a quotation -> use second level angle quotes +bool bLeftQuote = '\"' == cInsChar && +// start position and Romanian OR +// not start position and Hungarian +bSttQuote == (eLang != LANGUAGE_HUNGARIAN); +cRet = ( '<' == cInsChar || bLeftQuote ) ? ( bSwiss ? cLeftSingleAngleQuote : cLeftDoubleAngleQuote ) : ( bSwiss ? cRightSingleAngleQuote : cRightDoubleAngleQuote ); } @@ -1347,13 +1354,23 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, { eType = ACQuotes::CapitalizeIAm; } -// tdf#133524 support << and >> in Hungarian and Romanian -else if ( !bSingle && nInsPos && eLang.anyOf( LANGUAGE_HUNGARIAN, LANGUAGE_ROMANIAN ) && -lcl_HasPrecedingChar( rTxt, nInsPos, +// tdf#133524 support >>Hungarian<< and <> secondary level quotations +else if ( !bSingle && nInsPos && +( ( eLang == LANGUAGE_HUNGARIAN && +lcl_HasPrecedingChar( rTxt, nInsPos, bSttQuote ? aStopDoubleAngleQuoteStart[0] : aStopDoubleAngleQuoteEnd[0], -bSttQuote ? aStopDoubleAngleQuoteStart + 1 : aStopDoubleAngleQuoteEnd + 1 ) ) +bSttQuote ? aStopDoubleAngleQuoteStart + 1 : aStopDoubleAngleQuoteEnd + 1 ) ) || + ( eLang.anyOf( +LANGUAGE_ROMANIAN, +LANGUAGE_ROMANIAN_MOLDOVA ) && +lcl_HasPrecedingChar( rTxt, nInsPos, +bSttQuote ? aStopDoubleAngleQuoteStart[0] : aStopDoubleAngleQuoteEndRo[0], +bSttQuote ? aStopDoubleAngleQuoteStart + 1 : aStopDoubleAngleQuoteEndRo + 1 ) ) ) ) { -eType = ACQuotes::DoubleAngleQuote; +LocaleDataWrapper& rLcl = GetLocaleDataWrapper( eLang ); +// only if the opening double quotation mark is the default one +if ( rLcl.getDoubleQuotationMarkStart() == OUStringChar(aStopDoubleAngleQuoteStart[0]) ) +eType = ACQuotes::DoubleAngleQuote;
[Libreoffice-commits] core.git: editeng/source sw/qa
editeng/source/misc/svxacorr.cxx | 30 +- sw/qa/extras/uiwriter/data/tdf123786.fodt | 14 ++ sw/qa/extras/uiwriter/uiwriter.cxx| 27 +++ 3 files changed, 62 insertions(+), 9 deletions(-) New commits: commit 8d4b6e5858935c4a32f89b9e09c5f1084d34a04c Author: László Németh AuthorDate: Thu Jun 25 10:54:41 2020 +0200 Commit: László Németh CommitDate: Fri Jun 26 09:03:19 2020 +0200 tdf#123786 AutoCorrect: fix apostrophe in Russian and Ukrainian at "Single quotes" replacement outside of second level quotations. For example: „quote' -> „quote‘ but now apostrophe' -> apostrophe’ instead of the bad apostrophe' -> apostrophe“ Change-Id: Iad69b7f88ab9677f25ee0f806d035e16cdebe29b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97096 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 58878e41f9fa..e8ae81f045d2 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -321,6 +321,7 @@ static constexpr sal_Unicode cRightSingleAngleQuote = 0x203A; const sal_Unicode aStopDoubleAngleQuoteStart[] = { 0x201E, 0x201D, 0 }; // preceding ,, const sal_Unicode aStopDoubleAngleQuoteEnd[] = { cRightDoubleAngleQuote, cLeftDoubleAngleQuote, 0x201D, 0x201E, 0 }; // preceding >> const sal_Unicode aStopSingleQuoteEnd[] = { 0x201A, 0x2018, 0x201C, 0x201E, 0 }; +const sal_Unicode aStopSingleQuoteEndRuUa[] = { 0x201E, 0x201C, cRightDoubleAngleQuote, cLeftDoubleAngleQuote, 0 }; SvxAutoCorrect::SvxAutoCorrect( const OUString& rShareAutocorrFile, const OUString& rUserAutocorrFile ) @@ -1355,19 +1356,30 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, { eType = ACQuotes::DoubleAngleQuote; } -// tdf#128860 use apostrophe outside of second level quotation in Czech, German, Icelandic, -// Slovak and Slovenian instead of the – in this case, bad – closing quotation mark U+2018. else if ( bSingle && nInsPos && !bSttQuote && -( primary(eLang) == primary(LANGUAGE_GERMAN) || eLang.anyOf ( - LANGUAGE_CZECH, - LANGUAGE_ICELANDIC, - LANGUAGE_SLOVAK, - LANGUAGE_SLOVENIAN ) ) && -!lcl_HasPrecedingChar( rTxt, nInsPos, aStopSingleQuoteEnd[0], aStopSingleQuoteEnd + 1 ) ) +// tdf#128860 use apostrophe outside of second level quotation in Czech, German, Icelandic, +// Slovak and Slovenian instead of the – in this case, bad – closing quotation mark U+2018. +// tdf#123786 the same for Russian and Ukrainian +( ( eLang.anyOf ( + LANGUAGE_CZECH, + LANGUAGE_GERMAN, + LANGUAGE_GERMAN_SWISS, + LANGUAGE_GERMAN_AUSTRIAN, + LANGUAGE_GERMAN_LUXEMBOURG, + LANGUAGE_GERMAN_LIECHTENSTEIN, + LANGUAGE_ICELANDIC, + LANGUAGE_SLOVAK, + LANGUAGE_SLOVENIAN ) && +!lcl_HasPrecedingChar( rTxt, nInsPos, aStopSingleQuoteEnd[0], aStopSingleQuoteEnd + 1 ) ) || + ( eLang.anyOf ( + LANGUAGE_RUSSIAN, + LANGUAGE_UKRAINIAN ) && +!lcl_HasPrecedingChar( rTxt, nInsPos, aStopSingleQuoteEndRuUa[0], aStopSingleQuoteEndRuUa + 1 ) ) ) ) { LocaleDataWrapper& rLcl = GetLocaleDataWrapper( eLang ); CharClass& rCC = GetCharClass( eLang ); -if ( rLcl.getQuotationMarkStart() == OUStringChar(aStopSingleQuoteEnd[0]) && +if ( ( rLcl.getQuotationMarkStart() == OUStringChar(aStopSingleQuoteEnd[0]) || + rLcl.getQuotationMarkStart() == OUStringChar(aStopSingleQuoteEndRuUa[0]) ) && // use apostrophe only after letters, not after digits or punctuation rCC.isLetter(rTxt, nInsPos-1) ) { diff --git a/sw/qa/extras/uiwriter/data/tdf123786.fodt b/sw/qa/extras/uiwriter/data/tdf123786.fodt new file mode 100644 index ..8eb85164bb5e --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf123786.fodt @@ -0,0 +1,14 @@ + +http://openoffice.org/2009/office;
[Libreoffice-commits] core.git: editeng/source sw/qa
editeng/source/misc/svxacorr.cxx |8 +++- sw/qa/extras/uiwriter/uiwriter.cxx |6 ++ 2 files changed, 13 insertions(+), 1 deletion(-) New commits: commit 967d1ba1f2a3f551c23ba4d9902632a0dc581224 Author: László Németh AuthorDate: Tue Jun 2 10:12:27 2020 +0200 Commit: László Németh CommitDate: Tue Jun 2 18:40:38 2020 +0200 tdf#132301 AutoCorrect: fix ’« in French qu’« word » instead of using the bad ’" -> ’» autocorrection. Also limit this for abbreviated single-letter form of French words ce, de, je, la, le, ne, me, te, se and si. See commit 8039c9eb27170a162830f0ecd2086010a7a5858f (tdf#38394 AutoCorrect: fix ’« in French l’« word »). Change-Id: I1761365d90ae3af3c9ab47a3a82bf0abbe1b32be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95345 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 51fdf5c30746..c776cb45aae7 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1326,7 +1326,13 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, // tdf#38394 use opening quotation mark << in French l'<> if ( !bSingle && !bSttQuote && cPrev == cApostrophe && primary(eLang) == primary(LANGUAGE_FRENCH) && -(nInsPos == 2 || (nInsPos > 2 && IsWordDelim( rTxt[ nInsPos-3 ] ))) ) +( ( ( nInsPos == 2 || ( nInsPos > 2 && IsWordDelim( rTxt[ nInsPos-3 ] ) ) ) && + // abbreviated form of ce, de, je, la, le, ne, me, te, se or si + OUString("cdjlnmtsCDJLNMTS").indexOf( rTxt[ nInsPos-2 ] ) > -1 ) || + ( ( nInsPos == 3 || (nInsPos > 3 && IsWordDelim( rTxt[ nInsPos-4 ] ) ) ) && + // abbreviated form of que + ( rTxt[ nInsPos-2 ] == 'u' || rTxt[ nInsPos-2 ] == 'U' ) && + ( rTxt[ nInsPos-3 ] == 'q' || rTxt[ nInsPos-3 ] == 'Q' ) ) ) ) { bSttQuote = true; } diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 92c4201bce24..bb0d12aa7804 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -7186,6 +7186,12 @@ void SwUiWriterTest::testTdf38394() sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); OUString sReplaced(u"l\u2019« "); CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); +// tdf#132301 autocorrect of qu'« +pWrtShell->Insert(u" qu\u2019"); +pWrtShell->AutoCorrect(corr, cChar); +nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); +sReplaced += u" qu\u2019« "; +CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); } void SwUiWriterTest::testTdf59666() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source sw/qa sw/source writerfilter/source
editeng/source/items/frmitems.cxx |2 sw/qa/extras/ooxmlexport/data/tdf129522_removeShadowStyle.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx| 23 ++ sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt |binary sw/qa/extras/ww8export/ww8export3.cxx | 23 ++ sw/source/filter/ww8/ww8par6.cxx |8 ++- writerfilter/source/dmapper/DomainMapper.cxx |8 ++- 7 files changed, 58 insertions(+), 6 deletions(-) New commits: commit 4ca73073a0d7c62b12a7354f76f8f80adc5d98c1 Author: Justin Luth AuthorDate: Sat Dec 21 16:10:03 2019 +0300 Commit: Miklos Vajna CommitDate: Fri Jan 3 12:13:12 2020 +0100 tdf#129522 SvxShadowItem/writerfilter: allow shadow_NONE overrides Both editeng and writerfilter were ignoring the case where NONE should override an inherited shadow location. Of course, this situation is very rare. Nearly all unit tests ran when asserting that eLocation is already NONE. The same is true for DOC, except that it is not affected by SvxShadowItem's PutValue problem (and neither is ODT). RTF is not even removing the borderlines themselves, so no point in worrying about the shadow for RTF. Change-Id: I7c1ae67270dde81915daee2f0282aa2074d2ec8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85658 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 718e87ee2e37..643f8b1db471 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1093,9 +1093,9 @@ bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if ( bRet ) { -// SvxShadowLocation eSet = SvxShadowLocation::NONE; switch( aShadow.Location ) { +case table::ShadowLocation_NONE: eLocation = SvxShadowLocation::NONE; break; case table::ShadowLocation_TOP_LEFT: eLocation = SvxShadowLocation::TopLeft; break; case table::ShadowLocation_TOP_RIGHT : eLocation = SvxShadowLocation::TopRight; break; case table::ShadowLocation_BOTTOM_LEFT : eLocation = SvxShadowLocation::BottomLeft ; break; diff --git a/sw/qa/extras/ooxmlexport/data/tdf129522_removeShadowStyle.odt b/sw/qa/extras/ooxmlexport/data/tdf129522_removeShadowStyle.odt new file mode 100644 index ..7ced9fc647c4 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129522_removeShadowStyle.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index fb93572bf725..216cdec15c3c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -79,6 +80,28 @@ DECLARE_OOXMLEXPORT_TEST(testTdf108350_noFontdefaults, "tdf108350_noFontdefaults //CPPUNIT_ASSERT_EQUAL_MESSAGE("Font size", 10.f, getProperty(xStyleProps, "CharHeight")); } +DECLARE_OOXMLEXPORT_TEST(testTdf129522_removeShadowStyle, "tdf129522_removeShadowStyle.odt") +{ +uno::Reference< container::XNameAccess > paragraphStyles = getStyles("ParagraphStyles"); +uno::Reference< beans::XPropertySet > xStyleProps(paragraphStyles->getByName("Shadow"), uno::UNO_QUERY_THROW); +table::ShadowFormat aShadow = getProperty(xStyleProps, "ParaShadowFormat"); +CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); + +// Shadows were inherited regardless of whether the style disabled them. +xStyleProps.set(paragraphStyles->getByName("Shadow-removed"), uno::UNO_QUERY_THROW); +aShadow = getProperty(xStyleProps, "ParaShadowFormat"); +CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location); + +uno::Reference< container::XNameAccess > characterStyles = getStyles("CharacterStyles"); +xStyleProps.set(characterStyles->getByName("CharShadow"), uno::UNO_QUERY_THROW); +aShadow = getProperty(xStyleProps, "CharShadowFormat"); +CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); + +xStyleProps.set(characterStyles->getByName("CharShadow-removed"), uno::UNO_QUERY_THROW); +aShadow = getProperty(xStyleProps, "CharShadowFormat"); +//CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location); +} + DECLARE_OOXMLIMPORT_TEST(testTdf125038, "tdf125038.docx") { OUString aActual = getParagraph(1)->getString(); diff --git a/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt b/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt new file mode 100644 index ..7ced9fc647c4 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt differ diff --git
[Libreoffice-commits] core.git: editeng/source sw/qa
editeng/source/misc/svxacorr.cxx |4 sw/qa/extras/uiwriter/uiwriter.cxx | 16 2 files changed, 20 insertions(+) New commits: commit 04ef45a6dd7692c6ee08769c4ac4a0e92a0b64b8 Author: László Németh AuthorDate: Sun Dec 29 17:46:56 2019 +0100 Commit: László Németh CommitDate: Tue Dec 31 12:52:04 2019 +0100 tdf#59666 AutoCorrect: don't capitalize single Greek letters in automatic sentence capitalization (except in Greek texts), to keep the requested lower case scientific and mathematical symbols. Change-Id: I0c658bb69fb90e7159665939f85f1fd99477c730 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85955 Reviewed-by: László Németh Tested-by: László Németh diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index b023c34ade72..f1a682b6d5fd 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -890,6 +890,10 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, lcl_IsInAsciiArr( ".-)>", *pDelim ) ) return; +// tdf#59666 don't capitalize single Greek letters (except in Greek texts) +if ( 1 == pDelim - pWordStt && 0x03B1 <= *pWordStt && *pWordStt <= 0x03C9 && eLang != LANGUAGE_GREEK ) +return; + if( !bAtStart ) // Still no beginning of a paragraph? { if (NonFieldWordDelim(*pStr)) diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 32fa64f16d45..db26e92aca24 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -363,6 +363,7 @@ public: void testTdf106164(); void testTdf54409(); void testTdf38394(); +void testTdf59666(); void testInconsistentBookmark(); CPPUNIT_TEST_SUITE(SwUiWriterTest); @@ -569,6 +570,7 @@ public: CPPUNIT_TEST(testTdf106164); CPPUNIT_TEST(testTdf54409); CPPUNIT_TEST(testTdf38394); +CPPUNIT_TEST(testTdf59666); CPPUNIT_TEST_SUITE_END(); private: @@ -7083,6 +7085,20 @@ void SwUiWriterTest::testTdf38394() CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); } +void SwUiWriterTest::testTdf59666() +{ +SwDoc* pDoc = createDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +// testing missing autocorrect of single Greek letters +SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); +pWrtShell->Insert(u"\u03C0"); +const sal_Unicode cChar = ' '; +pWrtShell->AutoCorrect(corr, cChar); +sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); +OUString sReplaced(u"\u03C0 "); +CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source sw/qa
editeng/source/misc/svxacorr.cxx |9 + sw/qa/extras/uiwriter/data/tdf38394.fodt | 52 +++ sw/qa/extras/uiwriter/uiwriter.cxx | 16 + 3 files changed, 77 insertions(+) New commits: commit 8039c9eb27170a162830f0ecd2086010a7a5858f Author: László Németh AuthorDate: Sun Dec 29 12:34:34 2019 +0100 Commit: László Németh CommitDate: Sun Dec 29 16:36:06 2019 +0100 tdf#38394 AutoCorrect: fix ’« in French l’« word » instead of using the bad ’" -> ’» autocorrection. Change-Id: I48adbb2e8ca8e786c7835ff186d4580e856cf3c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85945 Tested-by: Jenkins Reviewed-by: László Németh Tested-by: László Németh diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index f6db80ba0a25..b023c34ade72 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1282,6 +1282,15 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, lcl_IsInAsciiArr( "([{", cPrev ) || ( cEmDash == cPrev ) || ( cEnDash == cPrev ); +// tdf#38394 use opening quotation mark << in French l'<> +if ( !bSingle && !bSttQuote && cPrev == cApostrophe && +(nInsPos == 2 || (nInsPos > 2 && IsWordDelim( rTxt[ nInsPos-3 ] ))) ) +{ +const LanguageType eLang = GetDocLanguage( rDoc, nInsPos ); +if ( primary(eLang) == primary(LANGUAGE_FRENCH) ) +bSttQuote = true; +} +// tdf#108423 for capitalization of English i'm b_iApostrophe = bSingle && ( cPrev == 'i' ) && (( nInsPos == 1 ) || IsWordDelim( rTxt[ nInsPos-2 ] )); } diff --git a/sw/qa/extras/uiwriter/data/tdf38394.fodt b/sw/qa/extras/uiwriter/data/tdf38394.fodt new file mode 100644 index ..238bab7b7931 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf38394.fodt @@ -0,0 +1,52 @@ + + +http://www.w3.org/1999/xlink; xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oas is:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:ooow="http://openoffice.org/2004/writer; xmlns:oooc="http://openoffice.org/2004/calc; xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:rpt="http://openoffice.org/2005/report; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:officeooo="http://openoffice.org/2009/office; xmlns:tableooo="http://openoffice.org/2009/table; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names: experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + ms 2015-04-07T22:24:25.3740120802015-04-07T22:25:28.460806924ms PT1M3S1LibreOfficeDev/4.5.0.0.alpha0$Linux_X86_64 LibreOffice_project/52ae345470d8fa657817cf87b3e8e8c1b51bd7da + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 09f77700472f..32fa64f16d45 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -362,6 +362,7 @@ public: void testTdf108423(); void testTdf106164(); void testTdf54409(); +void testTdf38394(); void testInconsistentBookmark(); CPPUNIT_TEST_SUITE(SwUiWriterTest); @@ -567,6 +568,7 @@ public: CPPUNIT_TEST(testTdf108423); CPPUNIT_TEST(testTdf106164); CPPUNIT_TEST(testTdf54409); +CPPUNIT_TEST(testTdf38394);
[Libreoffice-commits] core.git: editeng/source sw/qa
editeng/source/misc/svxacorr.cxx |4 sw/qa/extras/uiwriter/uiwriter.cxx | 30 -- 2 files changed, 32 insertions(+), 2 deletions(-) New commits: commit 0d52da4637b563c175cd21d04a639160441436ef Author: László Németh AuthorDate: Wed Dec 25 18:07:11 2019 +0100 Commit: László Németh CommitDate: Sat Dec 28 18:26:47 2019 +0100 tdf#54409 fix AutoCorrect with Unicode quotation marks Now single or double typographical quotation marks don't break automatic correction of the quoted words. For example, ‘acn -> ‘can, acn’ -> can’, “acn” -> “can”. Change-Id: I7f895414be4c3bbc9a3914df83d93cf28b4311a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85812 Reviewed-by: László Németh Tested-by: László Németh diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index faea050bbe17..f6db80ba0a25 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -172,6 +172,10 @@ static bool lcl_IsSymbolChar( CharClass const & rCC, const OUString& rTxt, static bool lcl_IsInAsciiArr( const char* pArr, const sal_Unicode c ) { +// tdf#54409 check also typographical quotation marks in the case of skipped ASCII quotation marks +if ( 0x2018 <= c && c <= 0x201F && (pArr == sImplSttSkipChars || pArr == sImplEndSkipChars) ) +return true; + bool bRet = false; for( ; *pArr; ++pArr ) if( *pArr == c ) diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 3cba57e29251..09f77700472f 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -361,6 +361,7 @@ public: void testTdf51223(); void testTdf108423(); void testTdf106164(); +void testTdf54409(); void testInconsistentBookmark(); CPPUNIT_TEST_SUITE(SwUiWriterTest); @@ -565,6 +566,7 @@ public: CPPUNIT_TEST(testInconsistentBookmark); CPPUNIT_TEST(testTdf108423); CPPUNIT_TEST(testTdf106164); +CPPUNIT_TEST(testTdf54409); CPPUNIT_TEST_SUITE_END(); private: @@ -7037,8 +7039,32 @@ void SwUiWriterTest::testTdf106164() const sal_Unicode cChar = ' '; pWrtShell->AutoCorrect(corr, cChar); sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); -OUString sIApostrophe(u"We\u2019re "); -CPPUNIT_ASSERT_EQUAL(sIApostrophe, static_cast(pDoc->GetNodes()[nIndex])->GetText()); +OUString sReplaced(u"We\u2019re "); +CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); +} + +void SwUiWriterTest::testTdf54409() +{ +SwDoc* pDoc = createDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +// testing autocorrect of "tset -> "test with typographical double quotation mark U+201C +SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); +pWrtShell->Insert(u"\u201Ctset"); +const sal_Unicode cChar = ' '; +pWrtShell->AutoCorrect(corr, cChar); +sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); +OUString sReplaced(u"\u201Ctest "); +CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); +// testing autocorrect of test" -> test" with typographical double quotation mark U+201D +pWrtShell->Insert(u"and tset\u201D"); +pWrtShell->AutoCorrect(corr, cChar); +OUString sReplaced2(sReplaced + u"and test\u201D "); +CPPUNIT_ASSERT_EQUAL(sReplaced2, static_cast(pDoc->GetNodes()[nIndex])->GetText()); +// testing autocorrect of "tset" -> "test" with typographical double quotation mark U+201C and U+201D +pWrtShell->Insert(u"\u201Ctset\u201D"); +pWrtShell->AutoCorrect(corr, cChar); +OUString sReplaced3(sReplaced2 + u"\u201Ctest\u201D "); +CPPUNIT_ASSERT_EQUAL(sReplaced3, static_cast(pDoc->GetNodes()[nIndex])->GetText()); } CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source sw/qa
editeng/source/misc/svxacorr.cxx |3 ++- sw/qa/extras/uiwriter/uiwriter.cxx | 16 2 files changed, 18 insertions(+), 1 deletion(-) New commits: commit f6cf80c81043d84606a5b5f7d93ae958307a16d3 Author: László Németh AuthorDate: Fri Dec 20 19:35:38 2019 +0100 Commit: László Németh CommitDate: Sat Dec 21 16:22:09 2019 +0100 tdf#106164 AutoCorrect: capitalize words with apostrophe at sentence starting position, for example we’re -> We’re This worked only with ASCII apostrophe ('), and changing to default usage of typographical apostrophe (U+2019) broke this kind of capitalization from commit e6fade1ce133039d28369751b77ac8faff6e40cb (tdf#38395 enable smart apostrophe replacement by default). Change-Id: If582194364f77cfb9fc0f04a28ac79a08bb804ff Reviewed-on: https://gerrit.libreoffice.org/85630 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 58088523fb4e..faea050bbe17 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -304,6 +304,7 @@ ACFlags SvxAutoCorrect::GetDefaultFlags() static constexpr sal_Unicode cEmDash = 0x2014; static constexpr sal_Unicode cEnDash = 0x2013; +static constexpr sal_Unicode cApostrophe = 0x2019; SvxAutoCorrect::SvxAutoCorrect( const OUString& rShareAutocorrFile, const OUString& rUserAutocorrFile ) @@ -845,7 +846,7 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, } else if (pWordStt && !rCC.isDigit(aText, pStr - pStart)) { -if( lcl_IsInAsciiArr( "-'", *pStr ) && // These characters are allowed in words +if( (lcl_IsInAsciiArr( "-'", *pStr ) || *pStr == cApostrophe) && // These characters are allowed in words pWordStt - 1 == pStr && // Installation at beginning of paragraph. Replaced < by <= (#i38971#) (pStart + 1) <= pStr && diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 4790a602bbbf..dbd90d905a3b 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -360,6 +360,7 @@ public: void testTdf91801(); void testTdf51223(); void testTdf108423(); +void testTdf106164(); void testInconsistentBookmark(); CPPUNIT_TEST_SUITE(SwUiWriterTest); @@ -563,6 +564,7 @@ public: CPPUNIT_TEST(testTdf51223); CPPUNIT_TEST(testInconsistentBookmark); CPPUNIT_TEST(testTdf108423); +CPPUNIT_TEST(testTdf106164); CPPUNIT_TEST_SUITE_END(); private: @@ -7025,6 +7027,20 @@ void SwUiWriterTest::testTdf108423() CPPUNIT_ASSERT_EQUAL(sText, static_cast(pDoc->GetNodes()[nIndex])->GetText()); } +void SwUiWriterTest::testTdf106164() +{ +SwDoc* pDoc = createDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +// testing autocorrect of we're -> We're on start of first paragraph +SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); +pWrtShell->Insert(u"we\u2019re"); +const sal_Unicode cChar = ' '; +pWrtShell->AutoCorrect(corr, cChar); +sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); +OUString sIApostrophe(u"We\u2019re "); +CPPUNIT_ASSERT_EQUAL(sIApostrophe, static_cast(pDoc->GetNodes()[nIndex])->GetText()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source sw/qa sw/source
editeng/source/items/frmitems.cxx |8 +- sw/qa/extras/ooxmlexport/data/tdf112118.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx| 72 ++ sw/qa/extras/ww8export/data/tdf112118.doc |binary sw/qa/extras/ww8export/ww8export2.cxx | 68 sw/source/core/tox/ToxTabStopTokenHandler.cxx |4 - sw/source/filter/ww8/docxattributeoutput.cxx |4 - sw/source/filter/ww8/ww8atr.cxx |4 - sw/source/filter/ww8/ww8par6.cxx |2 9 files changed, 108 insertions(+), 54 deletions(-) New commits: commit 45f1b733e0f736f4db677ba1fd17695ac1009c9f Author: Mike KaganskiDate: Sat Mar 17 23:49:37 2018 +0300 tdf#112118: use correct border when calculating margin This is a longstanding (at least since 2000: already present in commit 7b0b5cdf) error where left border linespace was used when calculating right margin. It was copypasted from ww8 import to ooxml code verbatim. The problem only manifests itself when left and right border spacings are not the same; and since we had other errors in the borders import, that additional problem simply wasn't apparent. Also use scaled border width in border distance/margin calculations. Unit tests updated. Change-Id: I70961e1bde29471def69e1ef944ba2779cffe307 Reviewed-on: https://gerrit.libreoffice.org/51474 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 6b60d5a4ffaa..7339035a6500 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -2661,10 +2661,10 @@ void BorderDistancesToWord(const SvxBoxItem& rBox, const WordPageMargins& rMargi const SvxBorderLine* pLnR = rBox.GetLine(SvxBoxItemLine::RIGHT); // We need to take border widths into account -const long nWidthT = pLnT ? pLnT->GetWidth() : 0; -const long nWidthL = pLnL ? pLnL->GetWidth() : 0; -const long nWidthB = pLnB ? pLnB->GetWidth() : 0; -const long nWidthR = pLnR ? pLnR->GetWidth() : 0; +const long nWidthT = pLnT ? pLnT->GetScaledWidth() : 0; +const long nWidthL = pLnL ? pLnL->GetScaledWidth() : 0; +const long nWidthB = pLnB ? pLnB->GetScaledWidth() : 0; +const long nWidthR = pLnR ? pLnR->GetScaledWidth() : 0; // Resulting distances from text to borders const sal_Int32 nT2BT = pLnT ? nT : 0; diff --git a/sw/qa/extras/ooxmlexport/data/tdf112118.docx b/sw/qa/extras/ooxmlexport/data/tdf112118.docx index dc3e14ae82c7..3ddb06839492 100644 Binary files a/sw/qa/extras/ooxmlexport/data/tdf112118.docx and b/sw/qa/extras/ooxmlexport/data/tdf112118.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index ba89b63b2f6e..5990e635394a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -283,33 +283,63 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107035, "tdf107035.docx") DECLARE_OOXMLEXPORT_TEST(testTdf112118_DOCX, "tdf112118.docx") { +// The resulting left margin width (2081) differs from its DOC counterpart from ww8export2.cxx, +// because DOCX import does two conversions between mm/100 and twips on the route, loosing one +// twip on the road and arriving with a value that is 2 mm/100 less. I don't see an obvious way +// to avoid that. +struct { +const char* styleName; +struct { +const char* sideName; +sal_Int32 nMargin; +sal_Int32 nBorderDistance; +sal_Int32 nBorderWidth; +} sideParams[4]; +} styleParams[] = { // Margin (MS-style), border distance, border width +{ +"Standard", +{ +{ "Top", 496, 847, 159 },// 851 twip, 24 pt (from text), 4.5 pt +{ "Left", 2081, 706, 212 }, // 1701 twip, 20 pt (from text), 6.0 pt +{ "Bottom", 1401, 564, 35 }, // 1134 twip, 16 pt (from text), 1.0 pt +{ "Right", 3471, 423, 106 } // 2268 twip, 12 pt (from text), 3.0 pt +} +}, +{ +"Converted1", +{ +{ "Top", 847, 496, 159 },// 851 twip, 24 pt (from edge), 4.5 pt +{ "Left", 706, 2081, 212 }, // 1701 twip, 20 pt (from edge), 6.0 pt +{ "Bottom", 564, 1401, 35 }, // 1134 twip, 16 pt (from edge), 1.0 pt +{ "Right", 423, 3471, 106 } // 2268 twip, 12 pt (from edge), 3.0 pt +} +} +}; auto xStyles = getStyles("PageStyles"); -auto testProc = [&](const OUString& sStyleName, sal_Int32 nMargin, sal_Int32 nBorderDistance, -sal_Int16 nBorderWidth) + +for (const auto& style : styleParams) { -
[Libreoffice-commits] core.git: editeng/source sw/qa sw/source
editeng/source/misc/svxacorr.cxx |4 +++ sw/qa/extras/uiwriter/data/tdf83260-1.odt |binary sw/qa/extras/uiwriter/uiwriter.cxx| 35 ++ sw/source/filter/xml/swxml.cxx|5 4 files changed, 44 insertions(+) New commits: commit 1c8efde4daea648204e3ba19f8edc01ef3e548bd Author: Michael StahlDate: Wed Feb 14 12:57:49 2018 +0100 tdf#83260 sw: call CompressRedlines() in ODF import It's possible that an ODF document contains redlines that will be deduplicated by CompressRedlines(). If that happens during some editing operation, then a SwRedline will be deleted and the nodes array becomes smaller by at least 3 nodes; any Undo actions that were created prior to the operation that called CompressRedlines() will store invalid node indexes now and Undo will crash. So presumably it's a precondition of editing operations that CompressRedlines() is a no-op. Interestingly CompressRedlines() is also called from SwEditShell::Undo()/Redo(). Ensure it's a no-op later by calling CompressRedlines() immediately after load. (Hopefully this should also work for the Insert File case.) Add a test too. Change-Id: Iec8135cc60260ed5cfff05a196b5c92cc03265f9 Reviewed-on: https://gerrit.libreoffice.org/49721 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 1119879f178c..302c941b06b7 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1228,6 +1228,7 @@ OUString SvxAutoCorrect::GetQuote( SvxAutoCorrDoc const & rDoc, sal_Int32 nInsPo return sRet; } +// WARNING: rText may become invalid, see comment below void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, sal_Int32 nInsPos, sal_Unicode cChar, bool bInsert, bool& io_bNbspRunNext, vcl::Window const * pFrameWin ) @@ -1338,6 +1339,9 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, if( IsAutoCorrFlag( Autocorrect ) ) { +// WARNING ATTENTION: rTxt is an alias of the text node's OUString +// and becomes INVALID if ChgAutoCorrWord returns true! +// => use aPara/pPara to create a valid copy of the string! OUString aPara; OUString* pPara = IsAutoCorrFlag(CapitalStartSentence) ? : nullptr; diff --git a/sw/qa/extras/uiwriter/data/tdf83260-1.odt b/sw/qa/extras/uiwriter/data/tdf83260-1.odt new file mode 100644 index ..b6e144b57751 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf83260-1.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 8dee21388fbe..0a16a201ad1a 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -156,6 +156,7 @@ public: void testChineseConversionSimplifiedToTraditional(); void testFdo85554(); void testAutoCorr(); +void testTdf83260(); void testMergeDoc(); void testCreatePortions(); void testBookmarkUndo(); @@ -337,6 +338,7 @@ public: CPPUNIT_TEST(testChineseConversionSimplifiedToTraditional); CPPUNIT_TEST(testFdo85554); CPPUNIT_TEST(testAutoCorr); +CPPUNIT_TEST(testTdf83260); CPPUNIT_TEST(testMergeDoc); CPPUNIT_TEST(testCreatePortions); CPPUNIT_TEST(testBookmarkUndo); @@ -1424,6 +1426,39 @@ void SwUiWriterTest::testAutoCorr() CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getColumns()->getCount()); } +void SwUiWriterTest::testTdf83260() +{ +SwDoc* const pDoc(createDoc("tdf83260-1.odt")); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); +SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect()); + +// enabled but not shown +CPPUNIT_ASSERT(IDocumentRedlineAccess::IsHideChanges( +pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); +CPPUNIT_ASSERT(IDocumentRedlineAccess::IsRedlineOn( +pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); + CPPUNIT_ASSERT(!pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty()); + +// the document contains redlines that are combined with CompressRedlines() +// if that happens during AutoCorrect then indexes in Undo are off -> crash +pWrtShell->Insert("tset"); +pWrtShell->AutoCorrect(corr, u' '); +sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); +auto const nActions(rUndoManager.GetUndoActionCount()); +for (auto i = nActions; 0 < i; --i) +{ +rUndoManager.Undo(); +} +for (auto i = nActions; 0 < i; --i) +{ +rUndoManager.Redo(); +} +for (auto i = nActions; 0 < i; --i) +{ +rUndoManager.Undo(); +} +} + void
[Libreoffice-commits] core.git: editeng/source sw/qa
editeng/source/misc/svxacorr.cxx | 12 +--- sw/qa/extras/ooxmlimport/ooxmlimport.cxx |2 +- 2 files changed, 6 insertions(+), 8 deletions(-) New commits: commit 7edbe6529825f562e2eab0b7c19c8c0883ea4fea Author: Stephan BergmannDate: Tue Feb 7 13:03:13 2017 +0100 Clean up some OUString creation Change-Id: I62d312436432939d28aced7cfc4a018adbd94c8c diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 2f88ecc..fef8739 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -2124,12 +2124,11 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList() try { uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sShareAutoCorrFile, embed::ElementModes::READ ); -OUString aXMLWordListName( pXMLImplAutocorr_ListStr, strlen(pXMLImplAutocorr_ListStr), RTL_TEXTENCODING_MS_1252 ); -uno::Reference < io::XStream > xStrm = xStg->openStreamElement( aXMLWordListName, embed::ElementModes::READ ); +uno::Reference < io::XStream > xStrm = xStg->openStreamElement( pXMLImplAutocorr_ListStr, embed::ElementModes::READ ); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); xml::sax::InputSource aParserInput; -aParserInput.sSystemId = aXMLWordListName; +aParserInput.sSystemId = pXMLImplAutocorr_ListStr; aParserInput.aInputStream = xStrm->getInputStream(); // get parser @@ -2436,11 +2435,10 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl() bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SotStorage& rStg ) { -OUString sStrmName( pXMLImplAutocorr_ListStr, strlen(pXMLImplAutocorr_ListStr), RTL_TEXTENCODING_MS_1252 ); bool bRet = true, bRemove = !pAutocorr_List || pAutocorr_List->empty(); if( !bRemove ) { -tools::SvRef refList = rStg.OpenSotStream( sStrmName, +tools::SvRef refList = rStg.OpenSotStream( pXMLImplAutocorr_ListStr, ( StreamMode::READ | StreamMode::WRITE | StreamMode::SHARE_DENYWRITE ) ); if( refList.is() ) { @@ -2458,7 +2456,7 @@ bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SotStorage& rStg ) xWriter->setOutputStream(xOut); uno::Reference xHandler(xWriter, uno::UNO_QUERY); -rtl::Reference< SvXMLAutoCorrectExport > xExp( new SvXMLAutoCorrectExport( xContext, pAutocorr_List, sStrmName, xHandler ) ); +rtl::Reference< SvXMLAutoCorrectExport > xExp( new SvXMLAutoCorrectExport( xContext, pAutocorr_List, pXMLImplAutocorr_ListStr, xHandler ) ); xExp->exportDoc( XML_BLOCK_LIST ); @@ -2481,7 +2479,7 @@ bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SotStorage& rStg ) if( bRemove ) { -rStg.Remove( sStrmName ); +rStg.Remove( pXMLImplAutocorr_ListStr ); rStg.Commit(); } diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index ce71175..3797d90 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1389,7 +1389,7 @@ DECLARE_OOXMLIMPORT_TEST(testTdf101626, "tdf101626.docx") if (rProp.Name == "BulletChar") { // the bulletChar has to be 0x2d! -CPPUNIT_ASSERT_EQUAL(OUString("\x2d", 1, RTL_TEXTENCODING_UTF8), rProp.Value.get()); +CPPUNIT_ASSERT_EQUAL(OUString("\x2d"), rProp.Value.get()); return; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source sw/qa
editeng/source/editeng/impedit.hxx |2 + editeng/source/editeng/impedit5.cxx| 16 ++-- sw/qa/extras/tiledrendering/tiledrendering.cxx | 32 + 3 files changed, 48 insertions(+), 2 deletions(-) New commits: commit c86e89c5bb040786193f7b8bba8516ffa706a14a Author: Miklos VajnaDate: Tue Aug 2 19:35:05 2016 +0200 editeng: track view shells in SfxListUndoActions This is needed for e.g. tracking deletions by backspace in Writer shape text. Change-Id: I6f873872566313096c2c57f4a13ac2f1db67e77d Reviewed-on: https://gerrit.libreoffice.org/27807 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index cc7362e..f74d05a 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -685,6 +685,8 @@ private: void ImplUpdateOverflowingLineNum( sal_uInt32, sal_uInt32, sal_uInt32 ); SpellInfo * CreateSpellInfo( bool bMultipleDocs ); +/// Obtains a view shell ID from the active EditView. +sal_Int32 CreateViewShellId(); ImpEditEngine(EditEngine* pEditEngine, SfxItemPool* pPool); void InitDoc(bool bKeepParaAttribs); diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 4dc34fc..e360c0a 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -222,11 +222,23 @@ EditUndoSetAttribs* ImpEditEngine::CreateAttribUndo( EditSelection aSel, const S return pUndo; } +sal_Int32 ImpEditEngine::CreateViewShellId() +{ +sal_Int32 nRet = -1; + +const EditView* pEditView = pEditEngine ? pEditEngine->GetActiveView() : nullptr; +const OutlinerViewShell* pViewShell = pEditView ? pEditView->GetImpEditView()->GetViewShell() : nullptr; +if (pViewShell) +nRet = pViewShell->GetViewShellId(); + +return nRet; +} + void ImpEditEngine::UndoActionStart( sal_uInt16 nId, const ESelection& aSel ) { if ( IsUndoEnabled() && !IsInUndo() ) { -GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( nId ), OUString(), nId, -1 ); +GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( nId ), OUString(), nId, CreateViewShellId() ); DBG_ASSERT( !pUndoMarkSelection, "UndoAction SelectionMarker?" ); pUndoMarkSelection = new ESelection( aSel ); } @@ -236,7 +248,7 @@ void ImpEditEngine::UndoActionStart( sal_uInt16 nId ) { if ( IsUndoEnabled() && !IsInUndo() ) { -GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( nId ), OUString(), nId, -1 ); +GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( nId ), OUString(), nId, CreateViewShellId() ); DBG_ASSERT( !pUndoMarkSelection, "UndoAction SelectionMarker?" ); } } diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index cfb1cbe..b2b97bd 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -61,6 +61,7 @@ public: void testTextEditViewInvalidations(); void testUndoInvalidations(); void testShapeTextUndoShells(); +void testShapeTextUndoGroupShells(); CPPUNIT_TEST_SUITE(SwTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -87,6 +88,7 @@ public: CPPUNIT_TEST(testTextEditViewInvalidations); CPPUNIT_TEST(testUndoInvalidations); CPPUNIT_TEST(testShapeTextUndoShells); +CPPUNIT_TEST(testShapeTextUndoGroupShells); CPPUNIT_TEST_SUITE_END(); private: @@ -921,6 +923,36 @@ void SwTiledRenderingTest::testShapeTextUndoShells() comphelper::LibreOfficeKit::setActive(false); } +void SwTiledRenderingTest::testShapeTextUndoGroupShells() +{ +// Load a document and create a view. +comphelper::LibreOfficeKit::setActive(); +SwXTextDocument* pXTextDocument = createDoc("shape.fodt"); +sal_Int32 nView1 = SfxLokHelper::getView(); + +// Begin text edit. +SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); +SdrPage* pPage = pWrtShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); +SdrObject* pObject = pPage->GetObj(0); +SdrView* pView = pWrtShell->GetDrawView(); +pWrtShell->GetView().BeginTextEdit(pObject, pView->GetSdrPageView(), pWrtShell->GetWin()); +pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0); +pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0); +pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::BACKSPACE); +pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::BACKSPACE); + +// Make sure that the undo item remembers who created it. +SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc(); +sw::UndoManager&
[Libreoffice-commits] core.git: editeng/source sw/qa sw/source
editeng/source/items/frmitems.cxx| 56 ++- sw/qa/extras/htmlimport/data/PageAndParagraphFilled.html | 45 sw/qa/extras/htmlimport/htmlimport.cxx | 42 +++ sw/source/filter/html/parcss1.cxx| 12 ++- sw/source/filter/html/swhtml.cxx | 15 sw/source/filter/writer/wrt_fn.cxx | 45 +++- 6 files changed, 197 insertions(+), 18 deletions(-) New commits: commit 29dfcc7521311e547fc069466cc3edc9fcbdbe03 Author: Armin Le GrandDate: Mon Nov 23 16:17:37 2015 +0100 tdf#94088 add import of HTML inline graphics Related: fdo#63211 for saving. This one adds the import side, plus fallbacks to use the new FillStyle attributes in HTML im/export in a SvxBrushItem. Also added graphic import for inline graphics. Comment markers inserted at places where functionality may be added in the future when the new FillStyle attributes would be more used in this content. Unit test checks PageBackground and ParagraphBaground import. Change-Id: I3f198677db553ad198e0add3162603a4735398f1 Reviewed-on: https://gerrit.libreoffice.org/20129 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 5bb1766..10211e4 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -3904,7 +3904,6 @@ void SvxBrushItem::PurgeMedium() const DELETEZ( pImpl->pStream ); } - const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) const { if ( bLoadAgain && !maStrLink.isEmpty() && !pImpl->pGraphicObject ) @@ -3913,26 +3912,53 @@ const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) co if (SvtSecurityOptions().isUntrustedReferer(referer)) { return nullptr; } + +// tdf#94088 prepare graphic and state +Graphic aGraphic; +bool bGraphicLoaded = false; + +// try to create stream directly from given URL pImpl->pStream = utl::UcbStreamHelper::CreateStream( maStrLink, STREAM_STD_READ ); + +// tdf#94088 if we have a stream, try to load it directly as graphic if( pImpl->pStream && !pImpl->pStream->GetError() ) { -Graphic aGraphic; -int nRes; -pImpl->pStream->Seek( STREAM_SEEK_TO_BEGIN ); -nRes = GraphicFilter::GetGraphicFilter(). -ImportGraphic( aGraphic, maStrLink, *pImpl->pStream, - GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::DontSetLogsizeForJpeg ); - -if( nRes != GRFILTER_OK ) +if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, maStrLink, *pImpl->pStream, +GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::DontSetLogsizeForJpeg )) { -bLoadAgain = false; +bGraphicLoaded = true; } -else +} + +// tdf#94088 if no succeeded, try if the string (which is not epty) contains +// a 'data:' scheme url and try to load that (embedded graphics) +if(!bGraphicLoaded) +{ +INetURLObject aGraphicURL( maStrLink ); + +if( INetProtocol::Data == aGraphicURL.GetProtocol() ) { -pImpl->pGraphicObject = new GraphicObject; -pImpl->pGraphicObject->SetGraphic( aGraphic ); -const_cast < SvxBrushItem*> (this)->ApplyGraphicTransparency_Impl(); - } +std::unique_ptr const pStream(aGraphicURL.getData()); +if (pStream) +{ +if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *pStream)) +{ +bGraphicLoaded = true; + +// tdf#94088 delete the no longer needed data scheme URL which +// is potentially pretty // large, containing a base64 encoded copy of the graphic +const_cast< SvxBrushItem* >(this)->maStrLink.clear(); +} +} +} +} + +// tdf#94088 when we got a graphic, set it +if(bGraphicLoaded && GRAPHIC_NONE != aGraphic.GetType()) +{ +pImpl->pGraphicObject = new GraphicObject; +pImpl->pGraphicObject->SetGraphic( aGraphic ); +const_cast < SvxBrushItem*> (this)->ApplyGraphicTransparency_Impl(); } else { diff --git a/sw/qa/extras/htmlimport/data/PageAndParagraphFilled.html b/sw/qa/extras/htmlimport/data/PageAndParagraphFilled.html new file mode 100644 index 000..fbe1ff1 --- /dev/null