From ad19098226d4eb4899572b79564d3ff95290e7aa Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 12 Jan 2023 14:24:11 +0100 Subject: [PATCH] tdf#152952 sw: don't hyphenate URLs by default New compatibility flag HyphenateURLs, disabled by default for Word interop and enabled for old ODT documents. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145415 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit de2b1a3a22a0a3bf5dfdd44c57c09e1fd0ba39d2) CppunitTest_sw_layoutwriter2: fix testTdf152952_compat with en-only hyph dict The bugdoc had German text, but the test was only checking for an English hyphenation dictionary, so adapt the bugdoc. Also, now that the text is English, it's hyphenated a little bit differently, so adapt the asserts. The point is that it's still hyphenated. (cherry picked from commit cb3027f90fc7bc1de9eb7cf200b17da49ca064d5) Change-Id: I1496819599deb5ed0fd736698d269ab9a22167fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145438 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sw/inc/IDocumentSettingAccess.hxx | 1 + sw/qa/extras/layout/data/Hyphenated-link.fodt | 254 ++++++++++++++++++++++++++ sw/qa/extras/layout/data/Hyphenated-link.rtf | 41 +++++ sw/qa/extras/layout/layout2.cxx | 26 +++ sw/source/core/doc/DocumentSettingManager.cxx | 9 + sw/source/core/inc/DocumentSettingManager.hxx | 1 + sw/source/core/text/guess.cxx | 30 +++ sw/source/filter/ww8/ww8par.cxx | 1 + sw/source/filter/xml/xmlimp.cxx | 10 + sw/source/uibase/uno/SwXDocumentSettings.cxx | 18 ++ writerfilter/source/filter/WriterFilter.cxx | 1 + 11 files changed, 392 insertions(+) create mode 100644 sw/qa/extras/layout/data/Hyphenated-link.fodt create mode 100644 sw/qa/extras/layout/data/Hyphenated-link.rtf diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 1f81ead70645..e891a2b8c058 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -92,6 +92,7 @@ enum class DocumentSettingId EMPTY_DB_FIELD_HIDES_PARA, // tdf#129448: Auto first-line indent should not be effected by line space AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE, + HYPHENATE_URLS, ///< tdf#152952 // COMPATIBILITY FLAGS END BROWSE_MODE, HTML_MODE, diff --git a/sw/qa/extras/layout/data/Hyphenated-link.fodt b/sw/qa/extras/layout/data/Hyphenated-link.fodt new file mode 100644 index 000000000000..300c2491bf2d --- /dev/null +++ b/sw/qa/extras/layout/data/Hyphenated-link.fodt @@ -0,0 +1,254 @@ + + + Gabor Kelemen LO2023-01-09T23:24:002023-01-09T23:25:003PT3SLibreOfficeDev/7.4.5.0.0$Linux_X86_64 LibreOffice_project/f2d3658697f22090ee138cebda4d10c3ede21230Gábor Kelemen2010 + + + 0 + 0 + 0 + 0 + true + false + + + false + false + false + true + true + true + true + true + false + 0 + false + false + false + true + false + false + true + true + false + false + false + true + true + true + false + false + false + false + false + false + false + true + true + false + true + false + false + false + false + true + 0 + 1 + true + true + + high-resolution + true + + + false + false + true + false + true + true + true + false + true + + true + 1180787 + + true + false + true + true + 0 + + false + false + false + true + false + true + 0 + true + false + true + true + true + false + false + true + + false + false + true + false + true + false + false + false + false + false + false + true + 1180787 + false + false + true + false + false + true + false + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NNNNNNNNNN NNNNNNNNNNNNNNN https://example.com/xxxxxxx/testtesttesttest/hyphenate/testtesttest + + + diff --git a/sw/qa/extras/layout/data/Hyphenated-link.rtf b/sw/qa/extras/layout/data/Hyphenated-link.rtf new file mode 100644 index 000000000000..bc3555e16c18 --- /dev/null +++ b/sw/qa/extras/layout/data/Hyphenated-link.rtf @@ -0,0 +1,41 @@ +{\rtf1\adeflang1025\ansi\ansicpg1250\uc1\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang1038\deflangfe1038\themelang1038\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};} +{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;} +{\f38\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0502040204020203}Segoe UI;}{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma{\*\falt Times New Roman};}{\f40\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;} +{\f41\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Liberation Serif{\*\falt Times New Roman};}{\f42\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Liberation Sans{\*\falt Arial};} +{\f43\fbidi \fswiss\fcharset134\fprq2{\*\panose 020b0503020204020204}Microsoft YaHei;}{\f45\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0602030504020204}Lucida Sans;} +{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};} +{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};} +}{\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;\red5\green99\blue193;}{\*\defchp \fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa160\sl259\slmult1 +\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 +\fs24\lang1031\langfe3079\kerning1\cgrid\langnp1031\langfenp3079 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive Default Paragraph Font;}{\*\cs32 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \f0\ul\cf17 \sbasedon10 Internet Link;} +}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0 +\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author Gabor Kelemen LO}{\operator G\'e1bor Kelemen2010}{\creatim\yr2023\mo1\dy9\hr23\min24}{\revtim\yr2023\mo1\dy9\hr23\min25}{\version3}{\edmins3}{\nofpages1}{\nofwords103}{\nofchars712} +{\nofcharsws814}{\vern57455}} +\paperw11906\paperh16838\margl1418\margr1418\margt1134\margb1134\gutter0\ltrsect +\deftab708\widowctrl\ftnbj\aenddoc\hyphhotz425\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0 +\showxmlerrors0\hyphauto1\formshade\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0{\*\ftnsep \ltrpar \pard\plain \ltrpar +\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1031\langfe3079\kerning1\cgrid\langnp1031\langfenp3079 {\rtlch\fcs1 \af0 \ltrch\fcs0 +\lang1038\langfe1038\kerning0\loch\af41\hich\af41\dbch\af31505\langnp1038\langfenp1038 \chftnsep }{\rtlch\fcs1 \af0 \ltrch\fcs0 +\par }}{\*\ftnsepc \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1031\langfe3079\kerning1\cgrid\langnp1031\langfenp3079 {\rtlch\fcs1 \af0 \ltrch\fcs0 +\chftnsepc +\par }}{\*\aftnsep \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1031\langfe3079\kerning1\cgrid\langnp1031\langfenp3079 {\rtlch\fcs1 \af0 \ltrch\fcs0 +\chftnsep +\par }}{\*\aftnsepc \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1031\langfe3079\kerning1\cgrid\langnp1031\langfenp3079 {\rtlch\fcs1 \af0 \ltrch\fcs0 + \chftnsepc +\par }}\ltrpar \sectd \ltrsect\sbknone\linex0\headery709\footery737\colsx708\titlepg\sectunlocked1\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3 +\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}} +{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain \ltrpar +\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe3079\kerning1\cgrid\langnp1033\langfenp3079 {\rtlch\fcs1 \af0 \ltrch\fcs0 \fs20 NNNNNNNNNN NNNNNNNNNNNNNNN } +{\field{\*\fldinst {\rtlch\fcs1 \af0 \ltrch\fcs0 HYPERLINK "https://example.com/" }{\rtlch\fcs1 \af0 \ltrch\fcs0 {\*\datafield +00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90b42000000680074007400700073003a002f002f007700770077002e00770065006c0074002e00640065002f000000795881f43b1d7f48af2c825dc485276300000000a5ab0003}}}{\fldrslt {\rtlch\fcs1 \af0 +\ltrch\fcs0 \ul\cf17 https://example.com/xxxxxxx/testtesttesttest/hyphenate/testtesttest}}}\sectd \ltrsect\sbknone\linex0\headery709\footery737\colsx708\titlepg\sectunlocked1\sectdefaultcl\sftnbj {\rtlch\fcs1 \af0 \ltrch\fcs0 + +\par }\pard \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1031\langfe1038\langfenp1038 Napoleon III. (franz\'f6sisch Napol\'e9 +on III; * 20. April 1808 in Paris; \'86 9. Januar 1873 in Chislehurst bei London) war unter seinem Geburtsnamen Charles-Louis-Napol\'e9on Bonaparte (auch Louis-Napol\'e9on Bonaparte) w\'e4hrend der Zweiten Republik von 1848 bis 1852 franz\'f6 +sischer Staatspr\'e4sident und von 1852 bis 1870 als Napoleon\~III. Kaiser der Franzosen. Mit dem Staatsstreich vom 2. Dezember 1851 hatte der aus einer Volkswahl hervorgegangene Pr\'e4sident eine Diktatur errichte +t. Ein Jahr darauf (1852) proklamierte er sich zum Kaiser und sein Land zum Zweiten Kaiserreich. Das Parlament wurde weitgehend entmachtet und erhielt erst ganz am Ende seiner Herrschaft wieder etwas mehr Kompetenzen.}{\rtlch\fcs1 \af0 \ltrch\fcs0 + +\par } +} diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 33196e019d86..0b528753aa9a 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -654,6 +654,32 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf151954) assertXPath(pXmlDoc, "/root/page[1]/body/txt", 2); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf152952) +{ + createSwDoc("Hyphenated-link.rtf"); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + // URL should not be hyphenated + assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "portion", + " NNNNNNNNNN NNNNNNNNNNNNNNN "); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]", "portion", + "https://example.com/xxxxxxx/testtesttesttest/hyphenate/testtesttest "); +} + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf152952_compat) +{ + uno::Reference xHyphenator = LinguMgr::GetHyphenator(); + if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString()))) + return; + + createSwDoc("Hyphenated-link.fodt"); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + // URL hyphenated for backward compatibility + assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "portion", + " NNNNNNNNNN NNNNNNNNNNNNNNN https://example.com/xxxxxxx/testtesttesttest/hyphen"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]", "portion", + "ate/testtesttest "); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInFootnote) { createSwDoc("tdf85610.fodt"); diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 9dbea91ac4a0..da04446c1271 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -247,6 +247,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const case DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND: return mbFootnoteInColumnToPageEnd; case DocumentSettingId::AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE: return mbAutoFirstLineIndentDisregardLineSpace; + case DocumentSettingId::HYPHENATE_URLS: return mbHyphenateURLs; case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML: return mbWrapAsCharFlysLikeInOOXML; case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: return mbNoNumberingShowFollowBy; case DocumentSettingId::DROP_CAP_PUNCTUATION: return mbDropCapPunctuation; @@ -428,6 +429,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo mbAutoFirstLineIndentDisregardLineSpace = value; break; + case DocumentSettingId::HYPHENATE_URLS: + mbHyphenateURLs = value; + break; + case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML: mbWrapAsCharFlysLikeInOOXML = value; break; @@ -1035,6 +1040,10 @@ void sw::DocumentSettingManager::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(mbFootnoteInColumnToPageEnd).getStr())); + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbHyphenateURLs")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), + BAD_CAST(OString::boolean(mbHyphenateURLs).getStr())); + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mnImagePreferredDPI")); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(mnImagePreferredDPI).getStr())); diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx index 0cde949ecf94..07a12e3f1a6b 100644 --- a/sw/source/core/inc/DocumentSettingManager.hxx +++ b/sw/source/core/inc/DocumentSettingManager.hxx @@ -174,6 +174,7 @@ class DocumentSettingManager final : bool mbFootnoteInColumnToPageEnd; sal_Int32 mnImagePreferredDPI; bool mbAutoFirstLineIndentDisregardLineSpace; + bool mbHyphenateURLs = false; // If this is on as_char flys wrapping will be handled the same like in Word bool mbWrapAsCharFlysLikeInOOXML; bool mbNoNumberingShowFollowBy; diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index 23b7319b5b14..7902e5a8e2c9 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include "porfld.hxx" #include #include @@ -234,6 +235,35 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf, } } + if (!rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get( + DocumentSettingId::HYPHENATE_URLS)) + { + // check URL from preceding space - similar to what AutoFormat does + const CharClass& rCC = GetAppCharClass(); + sal_Int32 begin(m_nCutPos == TextFrameIndex(COMPLETE_STRING) ? rInf.GetText().getLength() : sal_Int32(m_nCutPos)); + sal_Int32 end(begin); + for (; 0 < begin; --begin) + { + sal_Unicode cChar = rInf.GetText()[begin - 1]; + if (cChar == CH_BLANK || cChar == CH_FULL_BLANK || cChar == CH_SIX_PER_EM) + { + break; + } + } + for (; end < rInf.GetText().getLength(); ++end) + { + sal_Unicode cChar = rInf.GetText()[end]; + if (cChar == CH_BLANK || cChar == CH_FULL_BLANK || cChar == CH_SIX_PER_EM) + { + break; + } + } + if (!URIHelper::FindFirstURLInText(rInf.GetText(), begin, end, rCC).isEmpty()) + { + bHyph = false; + } + } + // search start of the last word, if needed if ( bHyph ) { diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index dca389d937a8..448057636fab 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1891,6 +1891,7 @@ void SwWW8ImplReader::ImportDop() m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE, true); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::CONTINUOUS_ENDNOTES, true); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY, true); + // rely on default for HYPHENATE_URLS=false // COMPATIBILITY FLAGS END diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 01c22fa9ec30..2cb58cf2aa47 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1306,6 +1306,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bool bEmptyDbFieldHidesPara = false; bool bCollapseEmptyCellPara = false; bool bAutoFirstLineIndentDisregardLineSpace = false; + bool bHyphenateURLs = false; bool bDropCapPunctuation = false; const PropertyValue* currentDatabaseDataSource = nullptr; @@ -1400,6 +1401,10 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bCollapseEmptyCellPara = true; else if (rValue.Name == "AutoFirstLineIndentDisregardLineSpace") bAutoFirstLineIndentDisregardLineSpace = true; + else if (rValue.Name == "HyphenateURLs") + { + bHyphenateURLs = true; + } else if ( rValue.Name == "DropCapPunctuation" ) bDropCapPunctuation = true; } @@ -1564,6 +1569,11 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC if (!bAutoFirstLineIndentDisregardLineSpace) xProps->setPropertyValue("AutoFirstLineIndentDisregardLineSpace", Any(false)); + if (!bHyphenateURLs) + { + xProps->setPropertyValue("HyphenateURLs", Any(true)); + } + // LO 7.4 and previous versions had different drop cap punctuation: very long dashes. // In order to keep backwards compatibility, DropCapPunctuation option is written to .odt // files, and the default for new documents is 'true'. Files without this option diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index 2f53b0f1aff3..9ce8dda4d5fd 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -152,6 +152,7 @@ enum SwDocumentSettingsPropertyHandles HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND, HANDLE_IMAGE_PREFERRED_DPI, HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE, + HANDLE_HYPHENATE_URLS, HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS, HANDLE_NO_NUMBERING_SHOW_FOLLOWBY, HANDLE_DROP_CAP_PUNCTUATION @@ -253,6 +254,7 @@ static rtl::Reference lcl_createSettingsInfo() { OUString("FootnoteInColumnToPageEnd"), HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND, cppu::UnoType::get(), 0 }, { OUString("ImagePreferredDPI"), HANDLE_IMAGE_PREFERRED_DPI, cppu::UnoType::get(), 0 }, { OUString("AutoFirstLineIndentDisregardLineSpace"), HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE, cppu::UnoType::get(), 0 }, + { OUString("HyphenateURLs"), HANDLE_HYPHENATE_URLS, cppu::UnoType::get(), 0 }, { OUString("WordLikeWrapForAsCharFlys"), HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS, cppu::UnoType::get(), 0 }, { OUString("NoNumberingShowFollowBy"), HANDLE_NO_NUMBERING_SHOW_FOLLOWBY, cppu::UnoType::get(), 0 }, { OUString("DropCapPunctuation"), HANDLE_DROP_CAP_PUNCTUATION, cppu::UnoType::get(), 0 }, @@ -1056,6 +1058,16 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf } } break; + case HANDLE_HYPHENATE_URLS: + { + bool bTmp; + if (rValue >>= bTmp) + { + mpDoc->getIDocumentSettingAccess().set( + DocumentSettingId::HYPHENATE_URLS, bTmp); + } + } + break; case HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS: { bool bTmp; @@ -1602,6 +1614,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf DocumentSettingId::AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE); } break; + case HANDLE_HYPHENATE_URLS: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get( + DocumentSettingId::HYPHENATE_URLS); + } + break; case HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS: { rValue <<= mpDoc->getIDocumentSettingAccess().get( diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 1975f04de115..3ac82d766c6a 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -333,6 +333,7 @@ void WriterFilter::setTargetDocument(const uno::Reference& xDo xSettings->setPropertyValue("DisableOffPagePositioning", uno::Any(true)); xSettings->setPropertyValue("WordLikeWrapForAsCharFlys", uno::Any(true)); xSettings->setPropertyValue("DropCapPunctuation", uno::Any(true)); + // rely on default for HyphenateURLs=false } void WriterFilter::setSourceDocument(const uno::Reference& xDoc) -- 2.11.4.GIT