core.git: Branch 'libreoffice-24-2' - sw/qa sw/source

2023-12-14 Thread Vojtěch Doležal (via logerrit)
 sw/qa/core/text/data/tdf158505.odt  |binary
 sw/qa/core/text/text.cxx|   12 
 sw/source/core/text/EnhancedPDFExportHelper.cxx |5 -
 sw/source/uibase/shells/textidx.cxx |6 ++
 4 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 347e8161ba38822de96851dd7ed92b7e85ac1943
Author: Vojtěch Doležal 
AuthorDate: Sat Dec 9 11:03:05 2023 +0100
Commit: Xisco Fauli 
CommitDate: Thu Dec 14 09:44:14 2023 +0100

tdf#158505 - Fix PDF export when bibliography is last paragraph

Change-Id: Iadafff97ba19d5c24be768238bddb4d684edde1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160509
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 94d18ea557a03c1f2d450454908787f7d3af8a6e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160646
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/core/text/data/tdf158505.odt 
b/sw/qa/core/text/data/tdf158505.odt
new file mode 100644
index ..c9a71033a2de
Binary files /dev/null and b/sw/qa/core/text/data/tdf158505.odt differ
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 7340a151d1f4..666e6d29f250 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -103,6 +103,18 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testSemiTransparentText)
 assertXPath(pXmlDoc, "//floattransparent"_ostr);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLastBibliographyPdfExport)
+{
+// Given a document with a bibliography as the last paragraph:
+createSwDoc("tdf158505.odt");
+
+// It should be possible to export to PDF:
+save("writer_pdf_Export");
+
+// Without the accompanying fix, the export to PDF would get stuck in an 
infinite loop
+CPPUNIT_ASSERT(true);
+}
+
 CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport)
 {
 // Given a document with a bibliography entry field:
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 2bf5ca3f883d..499dcc24178a 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -2825,7 +2825,10 @@ void 
SwEnhancedPDFExportHelper::ExportAuthorityEntryLinks()
 }
 }
 }
-mrSh.MovePara(GoNextPara, fnParaStart);
+if (!mrSh.MovePara(GoNextPara, fnParaStart))
+{ // Cursor is stuck in the TOX due to document ending 
immediately afterwards
+break;
+}
 }
 }
 }
diff --git a/sw/source/uibase/shells/textidx.cxx 
b/sw/source/uibase/shells/textidx.cxx
index 45d9df2c70b6..35642a73f198 100644
--- a/sw/source/uibase/shells/textidx.cxx
+++ b/sw/source/uibase/shells/textidx.cxx
@@ -127,6 +127,12 @@ void SwTextShell::ExecIdx(SfxRequest const )
 
rShell.GetCursor_()->GetPoint()->Assign(*pTableRowNode);
 rShell.UpdateTableOf(*pCurrentTOX);
 }
+else
+{
+// I think this ideally should be a pop-up warning, 
right?
+SAL_WARN("sw", "No matching bibliography mark found. "
+"This feature is only guaranteed to 
work if the bibliography table is up to date.");
+}
 }
 }
 


core.git: Branch 'libreoffice-7-6' - sw/qa sw/source

2023-12-13 Thread Vojtěch Doležal (via logerrit)
 sw/qa/core/text/data/tdf158505.odt  |binary
 sw/qa/core/text/text.cxx|   12 
 sw/source/core/text/EnhancedPDFExportHelper.cxx |5 -
 sw/source/uibase/shells/textidx.cxx |6 ++
 4 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 924fb10b2a7a513b6626610e12ff3a5d21aa492a
Author: Vojtěch Doležal 
AuthorDate: Sat Dec 9 11:03:05 2023 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Dec 13 20:27:18 2023 +0100

tdf#158505 - Fix PDF export when bibliography is last paragraph

Change-Id: Iadafff97ba19d5c24be768238bddb4d684edde1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160509
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 94d18ea557a03c1f2d450454908787f7d3af8a6e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160647
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/core/text/data/tdf158505.odt 
b/sw/qa/core/text/data/tdf158505.odt
new file mode 100644
index ..c9a71033a2de
Binary files /dev/null and b/sw/qa/core/text/data/tdf158505.odt differ
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index c68a0fa99cbe..0c90549e844e 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -103,6 +103,18 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testSemiTransparentText)
 assertXPath(pXmlDoc, "//floattransparent");
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLastBibliographyPdfExport)
+{
+// Given a document with a bibliography as the last paragraph:
+createSwDoc("tdf158505.odt");
+
+// It should be possible to export to PDF:
+save("writer_pdf_Export");
+
+// Without the accompanying fix, the export to PDF would get stuck in an 
infinite loop
+CPPUNIT_ASSERT(true);
+}
+
 CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport)
 {
 // Given a document with a bibliography entry field:
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 17750dc4f038..e9a7363c37cf 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -2722,7 +2722,10 @@ void 
SwEnhancedPDFExportHelper::ExportAuthorityEntryLinks()
 }
 }
 }
-mrSh.MovePara(GoNextPara, fnParaStart);
+if (!mrSh.MovePara(GoNextPara, fnParaStart))
+{ // Cursor is stuck in the TOX due to document ending 
immediately afterwards
+break;
+}
 }
 }
 }
diff --git a/sw/source/uibase/shells/textidx.cxx 
b/sw/source/uibase/shells/textidx.cxx
index 45d9df2c70b6..35642a73f198 100644
--- a/sw/source/uibase/shells/textidx.cxx
+++ b/sw/source/uibase/shells/textidx.cxx
@@ -127,6 +127,12 @@ void SwTextShell::ExecIdx(SfxRequest const )
 
rShell.GetCursor_()->GetPoint()->Assign(*pTableRowNode);
 rShell.UpdateTableOf(*pCurrentTOX);
 }
+else
+{
+// I think this ideally should be a pop-up warning, 
right?
+SAL_WARN("sw", "No matching bibliography mark found. "
+"This feature is only guaranteed to 
work if the bibliography table is up to date.");
+}
 }
 }
 


core.git: sw/qa sw/source

2023-12-13 Thread Vojtěch Doležal (via logerrit)
 sw/qa/core/text/data/tdf158505.odt  |binary
 sw/qa/core/text/text.cxx|   12 
 sw/source/core/text/EnhancedPDFExportHelper.cxx |5 -
 sw/source/uibase/shells/textidx.cxx |6 ++
 4 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 94d18ea557a03c1f2d450454908787f7d3af8a6e
Author: Vojtěch Doležal 
AuthorDate: Sat Dec 9 11:03:05 2023 +0100
Commit: Mike Kaganski 
CommitDate: Wed Dec 13 15:25:11 2023 +0100

tdf#158505 - Fix PDF export when bibliography is last paragraph

Change-Id: Iadafff97ba19d5c24be768238bddb4d684edde1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160509
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/qa/core/text/data/tdf158505.odt 
b/sw/qa/core/text/data/tdf158505.odt
new file mode 100644
index ..c9a71033a2de
Binary files /dev/null and b/sw/qa/core/text/data/tdf158505.odt differ
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 7340a151d1f4..666e6d29f250 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -103,6 +103,18 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testSemiTransparentText)
 assertXPath(pXmlDoc, "//floattransparent"_ostr);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLastBibliographyPdfExport)
+{
+// Given a document with a bibliography as the last paragraph:
+createSwDoc("tdf158505.odt");
+
+// It should be possible to export to PDF:
+save("writer_pdf_Export");
+
+// Without the accompanying fix, the export to PDF would get stuck in an 
infinite loop
+CPPUNIT_ASSERT(true);
+}
+
 CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport)
 {
 // Given a document with a bibliography entry field:
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 2bf5ca3f883d..499dcc24178a 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -2825,7 +2825,10 @@ void 
SwEnhancedPDFExportHelper::ExportAuthorityEntryLinks()
 }
 }
 }
-mrSh.MovePara(GoNextPara, fnParaStart);
+if (!mrSh.MovePara(GoNextPara, fnParaStart))
+{ // Cursor is stuck in the TOX due to document ending 
immediately afterwards
+break;
+}
 }
 }
 }
diff --git a/sw/source/uibase/shells/textidx.cxx 
b/sw/source/uibase/shells/textidx.cxx
index 45d9df2c70b6..35642a73f198 100644
--- a/sw/source/uibase/shells/textidx.cxx
+++ b/sw/source/uibase/shells/textidx.cxx
@@ -127,6 +127,12 @@ void SwTextShell::ExecIdx(SfxRequest const )
 
rShell.GetCursor_()->GetPoint()->Assign(*pTableRowNode);
 rShell.UpdateTableOf(*pCurrentTOX);
 }
+else
+{
+// I think this ideally should be a pop-up warning, 
right?
+SAL_WARN("sw", "No matching bibliography mark found. "
+"This feature is only guaranteed to 
work if the bibliography table is up to date.");
+}
 }
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - include/unotools officecfg/registry sw/inc sw/qa sw/source sw/uiconfig unotools/source

2023-06-27 Thread Vojtěch Doležal (via logerrit)
 include/unotools/compatibility.hxx|1 
 officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs |6 
 sw/inc/IDocumentSettingAccess.hxx |2 
 sw/qa/core/text/data/tdf41652_legacy.fodt |  300 
-
 sw/qa/core/text/data/tdf41652_variableNBSPdisabled.fodt   |  301 
--
 sw/qa/core/text/data/tdf41652_variableNBSPenabled.fodt|  301 
--
 sw/qa/core/text/text.cxx  |   71 --
 sw/source/core/doc/DocumentSettingManager.cxx |   17 
 sw/source/core/inc/DocumentSettingManager.hxx |1 
 sw/source/core/text/porexp.cxx|   17 
 sw/source/filter/xml/xmlimp.cxx   |1 
 sw/source/ui/config/optcomp.cxx   |   17 
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   16 
 sw/uiconfig/swriter/ui/optcompatpage.ui   |1 
 unotools/source/config/compatibility.cxx  |2 
 15 files changed, 8 insertions(+), 1046 deletions(-)

New commits:
commit a344f4ef39e59b8be5007531b6dd776d156c297e
Author: Vojtěch Doležal 
AuthorDate: Thu Jun 22 19:13:48 2023 +0200
Commit: Mike Kaganski 
CommitDate: Tue Jun 27 09:45:47 2023 +0200

Revert variable width NBSP for 7.6

As discussed some time ago, the implementation is experimental and not 
ready for 7.6 at the moment.

Change-Id: I43d702dca883ec3c92ca5357a4e161dec2b9a55c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153467
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/include/unotools/compatibility.hxx 
b/include/unotools/compatibility.hxx
index ed7b0f9d52f3..d336ff3c2475 100644
--- a/include/unotools/compatibility.hxx
+++ b/include/unotools/compatibility.hxx
@@ -60,7 +60,6 @@ class SvtCompatibilityEntry
 MsWordTrailingBlanks,
 SubtractFlysAnchoredAtFlys,
 EmptyDbFieldHidesPara,
-UseVariableWidthNBSP,
 
 /// special entry: optcomp.cxx converts the other values to
 /// integers but not this one because it doesn't have its own
diff --git a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
index fc0919ae2a3a..68b369ba09fc 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
@@ -128,12 +128,6 @@
 
 true
   
-  
-
-  Render NBSP as having variable size, instead of having a fixed 
size
-
-false
-  
 
   
   
diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index f14ffb543b30..60f5bc7d9468 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -125,8 +125,6 @@ enum class DocumentSettingId
 // drop cap punctuation: smaller dashes, bullet, asterisks, quotation 
marks etc.
 // by extending the rounding box of the glyph to the baseline
 DROP_CAP_PUNCTUATION,
-// render NBSP as standard-space-width (prettier when justified)
-USE_VARIABLE_WIDTH_NBSP,
 };
 
 /** Provides access to settings of a document
diff --git a/sw/qa/core/text/data/tdf41652_legacy.fodt 
b/sw/qa/core/text/data/tdf41652_legacy.fodt
deleted file mode 100644
index 07761f24be72..
--- a/sw/qa/core/text/data/tdf41652_legacy.fodt
+++ /dev/null
@@ -1,300 +0,0 @@
-
-
-http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext: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:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 

[Libreoffice-commits] core.git: sw/source

2023-05-30 Thread Vojtěch Doležal (via logerrit)
 sw/source/core/text/porexp.cxx |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 8716f10f8a3b59ceb8b7673d6c5948b882830167
Author: Vojtěch Doležal 
AuthorDate: Sun May 28 03:10:07 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 30 11:25:15 2023 +0200

Fix gray shade for NBSPs

28675af broke field shading for NBSPs, showing it only when non-printing 
characters are enabled.

This commit reverts the behaviour to the original state, where field shade 
is independent on whether the non-printing characters are enabled.

Change-Id: Ica44937a82d6c3742716e9aa934ab87e7f8b5168
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152349
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx
index de435df5ae54..8fc8d7b17fc9 100644
--- a/sw/source/core/text/porexp.cxx
+++ b/sw/source/core/text/porexp.cxx
@@ -208,13 +208,14 @@ bool SwBlankPortion::Format( SwTextFormatInfo  )
 
 void SwBlankPortion::Paint( const SwTextPaintInfo  ) const
 {
+// Draw field shade (can be disabled individually)
+if (!m_bMulti) // No gray background for multiportion brackets
+rInf.DrawViewOpt(*this, PortionType::Blank);
+
 if (m_cChar == CHAR_HARDBLANK)
 {
 if (rInf.GetOpt().IsBlank())
 {
-// Draw background
-rInf.DrawViewOpt(*this, PortionType::Blank);
-
 // Draw tilde or degree sign
 OUString aMarker = 
(rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess()
 
.get(DocumentSettingId::USE_VARIABLE_WIDTH_NBSP)
@@ -243,9 +244,6 @@ void SwBlankPortion::Paint( const SwTextPaintInfo  ) 
const
 }
 else
 {
-if (!m_bMulti) // No gray background for multiportion brackets
-rInf.DrawViewOpt(*this, PortionType::Blank);
-
 SwExpandPortion::Paint(rInf);
 }
 }


[Libreoffice-commits] core.git: xmloff/source

2023-05-18 Thread Vojtěch Doležal (via logerrit)
 xmloff/source/chart/PropertyMaps.cxx   |  240 ++---
 xmloff/source/forms/elementexport.cxx  |   44 ++---
 xmloff/source/forms/property_meta_data.cxx |   19 --
 xmloff/source/style/xmlexppr.cxx   |   29 +--
 xmloff/source/transform/OOo2Oasis.cxx  |   58 +++
 xmloff/source/xforms/xformsapi.cxx |   25 +--
 xmloff/source/xforms/xformsexport.cxx  |  105 ++--
 7 files changed, 257 insertions(+), 263 deletions(-)

New commits:
commit 9ffaf2cbfb855390954380eb40ebd7415b26e067
Author: Vojtěch Doležal 
AuthorDate: Wed May 17 09:01:23 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 18 09:07:16 2023 +0200

Removed remaining macro concatenations from xmloff/

For PropertyMaps.cxx used:
(MAP_FULL\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_ENTRY\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_ENTRY_ODF12\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_ENTRY_ODF_EXT\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_ENTRY_ODF_EXT_IMPORT\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_CONTEXT\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_SPECIAL\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_SPECIAL_ODF12\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_
(MAP_SPECIAL_ODF13\( *[A-Za-z0-9_]+ *, *) => \1XML_NAMESPACE_

For xmlexppr.cxx used:
ENTRY\( *([A-Za-z0-9_]+) *\) => { GET_PROP_TYPE(XML_TYPE_PROP_\1), 
XML_\1_PROPERTIES }

For OOo2Oasis.cxx used:
(OOO_IMPORTER\( *)([A-Za-z]+) => \1xmloff_\2_get_implementation

For xformsapi.cxx used:
TOKEN_MAP_ENTRY\( *([A-Za-z0-9"]+) *, *([A-Za-z0-9_]+) *\) => { 
XML_NAMESPACE_\1, xmloff::token::XML_\2, xmloff::token::XML_\2 }

For xformsexport.cxx used:
TABLE_ENTRY\( *([A-Za-z0-9"_]+) *, *([A-Za-z0-9"_]+) *, 
*([A-Za-z0-9"_]+) *, *([A-Za-z0-9"_]+) *\) => { \1, XML_NAMESPACE_\2, 
xmloff::token::XML_\3, \4 }

elementexport.cxx and property_meta_data.cxx done by hand.

Change-Id: Ifb0c76a60f95e74ff1f9d596afdaff138c2228c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151867
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/xmloff/source/chart/PropertyMaps.cxx 
b/xmloff/source/chart/PropertyMaps.cxx
index ea40bd4c7e6b..964e317e780c 100644
--- a/xmloff/source/chart/PropertyMaps.cxx
+++ b/xmloff/source/chart/PropertyMaps.cxx
@@ -60,16 +60,16 @@ using namespace ::xmloff::token;
 using namespace css::chart2;
 
 
-#define MAP_FULL( ApiName, NameSpace, XMLTokenName, XMLType, ContextId, 
EarliestODFVersionForExport ) { ApiName, XML_NAMESPACE_##NameSpace, 
xmloff::token::XMLTokenName, XMLType|XML_TYPE_PROP_CHART, ContextId, 
EarliestODFVersionForExport, false }
-#define MAP_ENTRY( a, ns, nm, t ){ a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_010, false 
}
-#define MAP_ENTRY_ODF12( a, ns, nm, t )  { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_012, false 
}
+#define MAP_FULL( ApiName, NameSpace, XMLTokenName, XMLType, ContextId, 
EarliestODFVersionForExport ) { ApiName, NameSpace, 
xmloff::token::XMLTokenName, XMLType|XML_TYPE_PROP_CHART, ContextId, 
EarliestODFVersionForExport, false }
+#define MAP_ENTRY( a, ns, nm, t ){ a, ns, xmloff::token::nm, 
t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_010, false }
+#define MAP_ENTRY_ODF12( a, ns, nm, t )  { a, ns, xmloff::token::nm, 
t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_012, false }
 #define MAP_ENTRY_ODF13( a, ns, nm, t )  { a, ns, xmloff::token::nm, 
t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_013, false }
-#define MAP_ENTRY_ODF_EXT( a, ns, nm, t ){ a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, 
SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }
-#define MAP_ENTRY_ODF_EXT_IMPORT( a, ns, nm, t ) { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, 
SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, true }
-#define MAP_CONTEXT( a, ns, nm, t, c )   { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART, c, SvtSaveOptions::ODFSVER_010, false 
}
-#define MAP_SPECIAL( a, ns, nm, t, c )   { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, 
SvtSaveOptions::ODFSVER_010, false }
-#define MAP_SPECIAL_ODF12( a, ns, nm, t, c ) { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, 
SvtSaveOptions::ODFSVER_012, false }
-#define MAP_SPECIAL_ODF13( a, ns, nm, t, c ) { a, XML_NAMESPACE_##ns, 
xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, 
SvtSaveOptions::ODFSVER_013, false }
+#define MAP_ENTRY_ODF_EXT( a, ns, nm, t ){ a, ns, xmloff::token::nm, 
t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }
+#define 

[Libreoffice-commits] core.git: xmloff/source

2023-05-17 Thread Vojtěch Doležal (via logerrit)
 xmloff/source/transform/OOo2Oasis.cxx| 1180 +++
 xmloff/source/transform/Oasis2OOo.cxx| 1045 +++
 xmloff/source/transform/StyleOOoTContext.cxx |   56 -
 3 files changed, 992 insertions(+), 1289 deletions(-)

New commits:
commit 24b15bc11b57aaeb3961b26ab636c3cf2d18fddc
Author: Vojtěch Doležal 
AuthorDate: Tue May 16 09:02:45 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 17 08:48:43 2023 +0200

Removed more constant concatenations

Change-Id: I4fce6eeb6652914e1883037b41a2dc3c09a88ada
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151826
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/xmloff/source/transform/OOo2Oasis.cxx 
b/xmloff/source/transform/OOo2Oasis.cxx
index a11baa98a8e9..150de69aebc6 100644
--- a/xmloff/source/transform/OOo2Oasis.cxx
+++ b/xmloff/source/transform/OOo2Oasis.cxx
@@ -76,7 +76,7 @@ enum XMLUserDefinedTransformerAction
 }
 
 #define ENTRY3( n, l, a, p1, p2, p3 ) \
-{ XML_NAMESPACE_##n, XML_##l, a, p1, p2, p3 }
+{ n, l, a, p1, p2, p3 }
 #define ENTRY3QQN( n, l, a, n1, l1, n2, l2, p3 ) \
 ENTRY3( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), \
 XMLTransformerActionInit::QNameParam( n2, l2 ), p3 )
@@ -104,613 +104,447 @@ static constexpr sal_Int32 RENAME_ENTRY( XMLTokenEnum 
f, XMLTokenEnum s )
 XMLTransformerActionInit const aActionTable[] =
 {
 // remove office:class from  and 
-ENTRY0( OFFICE, DOCUMENT, XML_ETACTION_DOCUMENT ),
-ENTRY0( OFFICE, DOCUMENT_CONTENT, XML_ETACTION_DOCUMENT ),
-ENTRY0( OFFICE, DOCUMENT_STYLES, XML_ETACTION_DOCUMENT ),
-ENTRY0( OFFICE, DOCUMENT_SETTINGS, XML_ETACTION_DOCUMENT ),
-ENTRY1Q( OFFICE, AUTO_TEXT_EVENTS, XML_ETACTION_DOCUMENT_RENAME,
-  XML_NAMESPACE_OOO, XML_AUTO_TEXT_EVENTS),
+ENTRY0(  XML_NAMESPACE_OFFICE, XML_DOCUMENT, XML_ETACTION_DOCUMENT ),
+ENTRY0(  XML_NAMESPACE_OFFICE, XML_DOCUMENT_CONTENT, XML_ETACTION_DOCUMENT 
),
+ENTRY0(  XML_NAMESPACE_OFFICE, XML_DOCUMENT_STYLES, XML_ETACTION_DOCUMENT 
),
+ENTRY0(  XML_NAMESPACE_OFFICE, XML_DOCUMENT_SETTINGS, 
XML_ETACTION_DOCUMENT ),
+ENTRY1Q( XML_NAMESPACE_OFFICE, XML_AUTO_TEXT_EVENTS, 
XML_ETACTION_DOCUMENT_RENAME, XML_NAMESPACE_OOO, XML_AUTO_TEXT_EVENTS),
 
 // remove 
-ENTRY0( META, KEYWORDS, XML_ETACTION_COPY_CONTENT ),
+ENTRY0( XML_NAMESPACE_META, XML_KEYWORDS, XML_ETACTION_COPY_CONTENT ),
 
 // rename  to 
-ENTRY1Q( OFFICE, SCRIPT, XML_ETACTION_RENAME_ELEM,
-XML_NAMESPACE_OFFICE, XML_SCRIPTS ),
+ENTRY1Q( XML_NAMESPACE_OFFICE, XML_SCRIPT, XML_ETACTION_RENAME_ELEM, 
XML_NAMESPACE_OFFICE, XML_SCRIPTS ),
 
 // rename  to  and process attributes
-ENTRY2QN( OFFICE, SCRIPT_DATA, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
-XML_NAMESPACE_OFFICE, XML_SCRIPT,
-OOO_SCRIPT_ACTIONS ),
+ENTRY2QN( XML_NAMESPACE_OFFICE, XML_SCRIPT_DATA, 
XML_ETACTION_RENAME_ELEM_PROC_ATTRS, XML_NAMESPACE_OFFICE, XML_SCRIPT, 
OOO_SCRIPT_ACTIONS ),
 
 // rename  to 
-ENTRY1Q( SCRIPT, LIBRARIES, XML_ETACTION_RENAME_ELEM,
-XML_NAMESPACE_OOO, XML_LIBRARIES ),
+ENTRY1Q( XML_NAMESPACE_SCRIPT, XML_LIBRARIES, XML_ETACTION_RENAME_ELEM, 
XML_NAMESPACE_OOO, XML_LIBRARIES ),
 
 // rename  to  and process 
attributes
-ENTRY2QN( SCRIPT, LIBRARY_LINKED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
-XML_NAMESPACE_OOO, XML_LIBRARY_LINKED,
-OOO_SCRIPT_ACTIONS ),
+ENTRY2QN( XML_NAMESPACE_SCRIPT, XML_LIBRARY_LINKED, 
XML_ETACTION_RENAME_ELEM_PROC_ATTRS, XML_NAMESPACE_OOO, XML_LIBRARY_LINKED, 
OOO_SCRIPT_ACTIONS ),
 
 // rename  to  and process 
attributes
-ENTRY2QN( SCRIPT, LIBRARY_EMBEDDED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
-XML_NAMESPACE_OOO, XML_LIBRARY_EMBEDDED,
-OOO_SCRIPT_ACTIONS ),
+ENTRY2QN( XML_NAMESPACE_SCRIPT, XML_LIBRARY_EMBEDDED, 
XML_ETACTION_RENAME_ELEM_PROC_ATTRS, XML_NAMESPACE_OOO, XML_LIBRARY_EMBEDDED, 
OOO_SCRIPT_ACTIONS ),
 
 // rename  to  and process attributes
-ENTRY2QN( SCRIPT, MODULE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS,
-XML_NAMESPACE_OOO, XML_MODULE,
-OOO_SCRIPT_ACTIONS ),
+ENTRY2QN( XML_NAMESPACE_SCRIPT, XML_MODULE, 
XML_ETACTION_RENAME_ELEM_PROC_ATTRS, XML_NAMESPACE_OOO, XML_MODULE, 
OOO_SCRIPT_ACTIONS ),
 
 // rename  to 
-ENTRY1Q( SCRIPT, SOURCE_CODE, XML_ETACTION_RENAME_ELEM,
-XML_NAMESPACE_OOO, XML_SOURCE_CODE ),
+ENTRY1Q( XML_NAMESPACE_SCRIPT, XML_SOURCE_CODE, XML_ETACTION_RENAME_ELEM, 
XML_NAMESPACE_OOO, XML_SOURCE_CODE ),
 
 // rename  to ,
 // rename  to , process attrs
-ENTRY1Q( OFFICE, FONT_DECLS, XML_ETACTION_RENAME_ELEM,
-XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS ),
-ENTRY2QN( STYLE, FONT_DECL, 

[Libreoffice-commits] core.git: xmloff/source

2023-05-16 Thread Vojtěch Doležal (via logerrit)
 xmloff/source/text/txtprmap.cxx | 1163 
 1 file changed, 582 insertions(+), 581 deletions(-)

New commits:
commit 41d96a72fc0e0a9fa35b6ac88a389473f8baedaf
Author: Vojtěch Doležal 
AuthorDate: Mon May 15 23:31:29 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue May 16 12:17:37 2023 +0200

Removed constant concatenation macros from txtprmap.cxx

Removed concatenation from the macros, because due to them I wasn't able to 
find anything relevant with grep when searching for them.

Change-Id: Ic22d711d9e93bb89b402d141aa1ca3293bba866e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151819
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 5d8ef1d3471e..418d4e396ff2 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -33,13 +33,13 @@ using namespace ::com::sun::star::uno;
 using namespace ::xmloff::token;
 
 #define M_E_( a, p, l, t, c ) \
-{ a, XML_NAMESPACE_##p, XML_##l, t, c, SvtSaveOptions::ODFSVER_010, false }
+{ a, p, l, t, c, SvtSaveOptions::ODFSVER_010, false }
 
 #define M_EV_( a, p, l, t, c, v ) \
-{ a, XML_NAMESPACE_##p, XML_##l, t, c, v, false }
+{ a, p, l, t, c, v, false }
 
 #define M_ED_( a, p, l, t, c ) \
-{ a, XML_NAMESPACE_##p, XML_##l, (t) | MID_FLAG_DEFAULT_ITEM_EXPORT, c, 
SvtSaveOptions::ODFSVER_010, false }
+{ a, p, l, (t) | MID_FLAG_DEFAULT_ITEM_EXPORT, c, 
SvtSaveOptions::ODFSVER_010, false }
 
 // text properties
 #define MT_E( a, p, l, t, c ) \
@@ -90,7 +90,7 @@ using namespace ::xmloff::token;
 XMLPropertyMapEntry constexpr aXMLParaPropMap[] =
 {
 // RES_UNKNOWNATR_CONTAINER
-MP_E( PROP_ParaUserDefinedAttributes, TEXT, XMLNS, 
XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
+MP_E( PROP_ParaUserDefinedAttributes,  XML_NAMESPACE_TEXT, XML_XMLNS, 
XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
 
 // fill attributes for paragraph backgrounds
 // #i125045# moved to the front to be able to exclude these in 
lcl_txtprmap_getMap
@@ -118,187 +118,187 @@ XMLPropertyMapEntry constexpr aXMLParaPropMap[] =
 
 // RES_LR_SPACE
 // !!! DO NOT REORDER THE MARGINS !!!
-MP_E( PROP_ParaLeftMargin, FO, MARGIN, 
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARAMARGINALL ),
-MP_E( PROP_ParaLeftMarginRelative, FO, MARGIN, XML_TYPE_PERCENT16, 
CTF_PARAMARGINALL_REL ),
-MP_E( PROP_ParaLeftMargin, FO, MARGIN_LEFT,
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARALEFTMARGIN ),
-MP_E( PROP_ParaLeftMarginRelative, FO, MARGIN_LEFT,
XML_TYPE_PERCENT16, CTF_PARALEFTMARGIN_REL ),
-MP_E( PROP_ParaRightMargin,FO, MARGIN_RIGHT,   
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARARIGHTMARGIN ),
-MP_E( PROP_ParaRightMarginRelative,FO, MARGIN_RIGHT,   
XML_TYPE_PERCENT16, CTF_PARARIGHTMARGIN_REL ),
+MP_E( PROP_ParaLeftMargin,  XML_NAMESPACE_FO, XML_MARGIN,   
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARAMARGINALL ),
+MP_E( PROP_ParaLeftMarginRelative,  XML_NAMESPACE_FO, XML_MARGIN,   
XML_TYPE_PERCENT16, CTF_PARAMARGINALL_REL ),
+MP_E( PROP_ParaLeftMargin,  XML_NAMESPACE_FO, XML_MARGIN_LEFT,  
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARALEFTMARGIN ),
+MP_E( PROP_ParaLeftMarginRelative,  XML_NAMESPACE_FO, XML_MARGIN_LEFT,  
XML_TYPE_PERCENT16, CTF_PARALEFTMARGIN_REL ),
+MP_E( PROP_ParaRightMargin, XML_NAMESPACE_FO, XML_MARGIN_RIGHT, 
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARARIGHTMARGIN ),
+MP_E( PROP_ParaRightMarginRelative, XML_NAMESPACE_FO, XML_MARGIN_RIGHT, 
XML_TYPE_PERCENT16, CTF_PARARIGHTMARGIN_REL ),
 // RES_UL_SPACE
-MP_E( PROP_ParaTopMargin,  FO, MARGIN_TOP, 
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARATOPMARGIN ),
-MP_E( PROP_ParaTopMarginRelative,  FO, MARGIN_TOP, 
XML_TYPE_PERCENT16, CTF_PARATOPMARGIN_REL ),
-MP_E( PROP_ParaBottomMargin,   FO, MARGIN_BOTTOM,  
XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARABOTTOMMARGIN ),
-MP_E( PROP_ParaBottomMarginRelative,FO,MARGIN_BOTTOM,  
XML_TYPE_PERCENT16, CTF_PARABOTTOMMARGIN_REL ),
-MAP_ODF13( PROP_ParaContextMargin, XML_NAMESPACE_STYLE, 
XML_CONTEXTUAL_SPACING, XML_TYPE_BOOL|XML_TYPE_PROP_PARAGRAPH, 0 ),// ODF 
1.3 OFFICE-3767 and was written by LO<=4.2
-MAP_ODF13( PROP_ParaContextMargin, XML_NAMESPACE_LO_EXT, 
XML_CONTEXTUAL_SPACING, XML_TYPE_BOOL|XML_TYPE_PROP_PARAGRAPH, 0 ), // 
extension namespace
+MP_E( PROP_ParaTopMargin,XML_NAMESPACE_FO,XML_MARGIN_TOP,  
   XML_TYPE_MEASURE|MID_FLAG_MULTI_PROPERTY, CTF_PARATOPMARGIN ),
+MP_E( PROP_ParaTopMarginRelative,XML_NAMESPACE_FO,XML_MARGIN_TOP,  
   XML_TYPE_PERCENT16, CTF_PARATOPMARGIN_REL ),
+MP_E( PROP_ParaBottomMargin, XML_NAMESPACE_FO,

[Libreoffice-commits] core.git: include/xmloff schema/libreoffice sw/inc sw/qa sw/source sw/uiconfig xmloff/qa xmloff/source

2023-05-05 Thread Vojtěch Doležal (via logerrit)
 include/xmloff/xmltoken.hxx |2 
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |2 
 sw/inc/authfld.hxx  |   24 +++-
 sw/inc/helpids.h|4 
 sw/inc/strings.hrc  |2 
 sw/inc/toxe.hxx |3 
 sw/qa/core/text/text.cxx|6 -
 sw/source/core/fields/authfld.cxx   |   33 +-
 sw/source/core/text/EnhancedPDFExportHelper.cxx |   18 ++-
 sw/source/ui/index/cnttab.cxx   |2 
 sw/source/ui/index/swuiidxmrk.cxx   |   65 +++-
 sw/source/uibase/docvw/edtwin2.cxx  |9 -
 sw/source/uibase/shells/textsh1.cxx |   33 +++---
 sw/source/uibase/utlui/initui.cxx   |2 
 sw/source/uibase/wrtsh/wrtsh2.cxx   |   23 +---
 sw/uiconfig/swriter/ui/bibliofragment.ui|   41 +++
 xmloff/qa/unit/text.cxx |6 -
 xmloff/source/core/xmltoken.cxx |2 
 xmloff/source/text/txtflde.cxx  |   12 +-
 xmloff/source/text/txtfldi.cxx  |6 -
 xmloff/source/token/tokens.txt  |2 
 21 files changed, 152 insertions(+), 145 deletions(-)

New commits:
commit d543eb2d8e45999a3d8fa6134f0d98f08acb8037
Author: Vojtěch Doležal 
AuthorDate: Thu Apr 6 00:25:34 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 5 08:32:09 2023 +0200

Reworked bibliography mark link target to have user-selectable type

Without this change, havign no link is not possible, if the bibliography 
entry has URL.
This commit adds a select box for user to choose between target types 
(Entry URL, specific Target URL, None, bibliography table row)
The main features are that it also makes it more obvious to the user and 
makes it possible to easily extend target types in the future.

As for compatibility, files from before 7b99871635 are fully compatible 
without any hurdles, as missing property maps to the old behaviour.
Bibliography marks saved after 7b99871635 will also revert to the old 
behaviour, however no actual data (such as target URLs) will be lost.

Change-Id: Iad61dd8b4df337fa202f45d117313ee47ec20c05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150708
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 3ea2e7ee8335..09bb105d17e9 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3469,8 +3469,8 @@ namespace xmloff::token {
 XML_MARGIN_GUTTER,
 
 XML_LOCAL_URL,
+XML_TARGET_TYPE,
 XML_TARGET_URL,
-XML_USE_TARGET_URL,
 
 // Math ml
 XML_DIR,
diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng 
b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index a3900e4f31c7..5fe259dbd5e5 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -3262,8 +3262,8 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
 text:issn
 loext:local-url
 
+loext:target-type
 loext:target-url
-loext:use-target-url
   
   
 
diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 26e4843a6ad2..9aef5085cec6 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -167,6 +167,16 @@ class SW_DLLPUBLIC SwAuthorityField final : public SwField
 virtual std::unique_ptr Copy() const override;
 
 public:
+enum TargetType : sal_uInt16
+{
+UseDisplayURL   = 0,
+UseTargetURL= 1,
+None= 2,
+BibliographyTableRow= 3,
+// BibliographyTablePage   = 4, // TODO: implement
+};
+
+
 /// For internal use only, in general continue using ExpandField() instead.
 OUString ConditionalExpandAuthIdentifier(SwRootFrame const* pLayout) const;
 
@@ -199,13 +209,17 @@ public:
 OUString GetAuthority(const SwRootFrame *pLayout,
   const SwForm *pTOX = nullptr) const;
 
-bool UseTargetURL() const;
-
-bool HasURL() const;
+/**
+ * Returns which target should be used when the entry
+ *   (the standalone field, such as '[ASDF]', not in the table) is clicked.
+ */
+TargetType GetTargetType() const;
+/**
+ * Returns absolute target URL in case there is one (GetTargetType() 
should be checked).
+ *   If there isn't one, the result is undefined.
+ */
 OUString 

[Libreoffice-commits] core.git: sw/qa sw/sdi sw/source

2023-04-20 Thread Vojtěch Doležal (via logerrit)
 sw/qa/uibase/shells/data/protectedLinkCopy.fodt |  536 
 sw/qa/uibase/shells/shells.cxx  |   58 ++
 sw/sdi/_textsh.sdi  |1 
 sw/source/uibase/shells/textsh1.cxx |   37 -
 4 files changed, 612 insertions(+), 20 deletions(-)

New commits:
commit 9ce48c5992ca7ae2b68edfc1f558ccfa3289264d
Author: Vojtěch Doležal 
AuthorDate: Thu Apr 6 00:25:34 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Apr 20 08:35:57 2023 +0200

Allow Copy Hyperlink Location in protected fields

This change aims to make it possible to copy hyperlinks from protected 
fields.
That includes showing command and fixing it's broken behaviour, which 
wasn't detectable because it was hidden.

Change-Id: I119e7617fcd7261e437411c86d4c920931e9fe84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150070
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/uibase/shells/data/protectedLinkCopy.fodt 
b/sw/qa/uibase/shells/data/protectedLinkCopy.fodt
new file mode 100644
index ..495f7523764d
--- /dev/null
+++ b/sw/qa/uibase/shells/data/protectedLinkCopy.fodt
@@ -0,0 +1,536 @@
+
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext: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:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form: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:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2023-04-19T10:13:19.9403608712023-04-19T10:20:31.730384611PT7M24S1LibreOfficeDev/7.6.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/57ff98147490ea69eb2968bcaf75edfe72f88645
+ 
+  
+   0
+   0
+   26615
+   15436
+   true
+   false
+   
+
+ view2
+ 4807
+ 7195
+ 0
+ 0
+ 26614
+ 15434
+ 0
+ 1
+ false
+ 120
+ false
+ false
+ false
+ false
+ false
+ false
+
+   
+  
+  
+   true
+   false
+   true
+   false
+   true
+   false
+   false
+   true
+   false
+   0
+   false
+   true
+   false
+   false
+   false
+   false
+   true
+   false
+   false
+   
+   false
+   false
+   true
+   false
+   false
+   true
+   true
+   false
+   false
+   false
+   false
+   false
+   false
+   true
+   false
+   false
+   472471
+   false
+   
+   true
+   false
+   false
+   472471
+   true
+   false
+   false
+   false
+   1
+   true
+   true
+   false
+   false
+   true
+   false
+   false
+   true
+   true
+   true
+   false
+   true
+   0
+   
+   false
+   true
+   true
+   true
+   
+   0
+   true
+   false
+   false
+   false
+   high-resolution
+   true
+   true
+   false
+   false
+   true
+   false
+   false
+   false
+   false
+   true
+   
+   true
+   false
+   true
+   false
+   
+   false
+   false
+   false
+   true
+   false
+   false
+   false
+   false
+   false
+   false
+   false
+   false
+   false
+   false
+   0
+   true
+   false
+   
+   true
+  
+ 
+ 
+  
+   http://openoffice.org/2004/office; 
xmlns:xlink="http://www.w3.org/1999/xlink"/>
+  
+ 
+ 
+  
+  
+  
+  
+  
+  
+ 
+ 
+  
+   
+   
+
+   

[Libreoffice-commits] core.git: sw/qa

2023-04-12 Thread Vojtěch Doležal (via logerrit)
 sw/qa/core/text/text.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit b8cc40c906d4838b028e332e9dabbacba7f7c033
Author: Vojtěch Doležal 
AuthorDate: Tue Apr 4 17:15:20 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Apr 12 09:18:13 2023 +0200

Replaced ...ASSERT with ...ASSERT_GREATER in vwNBSP tests

Change-Id: I3d1584de37873ead53d317b033f3611974183c28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150025
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index d08ff598dd4c..b233d2ecf499 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -1239,7 +1239,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf41652NBSPWidth)
 }
 
 // Assert left aligned NBSP for the legacy file is larger than zero
-CPPUNIT_ASSERT(nSectionAfterNBSPX_legacy_leftAligned > 0);
+CPPUNIT_ASSERT_GREATER(sal_Int32(0), 
nSectionAfterNBSPX_legacy_leftAligned);
 // Assert both NBSPs have same width for the legacy file
 CPPUNIT_ASSERT_EQUAL(nSectionAfterNBSPX_legacy_leftAligned,
  nSectionAfterNBSPX_legacy_justified);
@@ -1253,8 +1253,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf41652NBSPWidth)
 CPPUNIT_ASSERT_EQUAL(nSectionAfterNBSPX_optionDisabled_leftAligned,
  nSectionAfterNBSPX_optionEnabled_leftAligned);
 // Assert justified NBSP is wider for the enabled file
-CPPUNIT_ASSERT(nSectionAfterNBSPX_optionDisabled_justified
-   < nSectionAfterNBSPX_optionEnabled_justified);
+CPPUNIT_ASSERT_GREATER(nSectionAfterNBSPX_optionDisabled_justified,
+   nSectionAfterNBSPX_optionEnabled_justified);
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: include/unotools officecfg/registry sw/inc sw/qa sw/source sw/uiconfig unotools/source

2023-04-04 Thread Vojtěch Doležal (via logerrit)
 include/unotools/compatibility.hxx|2 
 officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs |6 
 sw/inc/IDocumentSettingAccess.hxx |4 
 sw/qa/core/text/data/tdf41652_legacy.fodt |  300 
+
 sw/qa/core/text/data/tdf41652_variableNBSPdisabled.fodt   |  301 
++
 sw/qa/core/text/data/tdf41652_variableNBSPenabled.fodt|  301 
++
 sw/qa/core/text/text.cxx  |   71 ++
 sw/source/core/doc/DocumentSettingManager.cxx |   17 
 sw/source/core/inc/DocumentSettingManager.hxx |1 
 sw/source/core/text/porexp.cxx|   54 +
 sw/source/core/text/portxt.cxx|   10 
 sw/source/filter/xml/xmlimp.cxx   |3 
 sw/source/ui/config/optcomp.cxx   |   17 
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |   18 
 sw/uiconfig/swriter/ui/optcompatpage.ui   |1 
 unotools/source/config/compatibility.cxx  |5 
 16 files changed, 1096 insertions(+), 15 deletions(-)

New commits:
commit 28675af84ae8e2342bd78be3696dc09de6ce5cc5
Author: Vojtěch Doležal 
AuthorDate: Sat Mar 25 13:01:30 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Apr 4 08:23:18 2023 +0200

tdf#41652: Variable width NBSP

Adds a flag that when enabled (opt-in for both old and new documents) 
changes behaviour of NBSP to not be strictly fixed width.

This commit also implements this behaviour such that NBSP has always the 
width of a standard space (0x20) on the given line. This change is only 
noticeable when the paragraph is justified.

Lastly a tilde or a degree character is now shown in place of NBSP when 
nonprintable characters are enabled, since the gray field alone is not visible 
in many circumstances.

Change-Id: Iabb30b5930ced62691cc4304f60c5e6dc886ed61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149576
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/unotools/compatibility.hxx 
b/include/unotools/compatibility.hxx
index 72017812ab8b..ed7b0f9d52f3 100644
--- a/include/unotools/compatibility.hxx
+++ b/include/unotools/compatibility.hxx
@@ -60,6 +60,8 @@ class SvtCompatibilityEntry
 MsWordTrailingBlanks,
 SubtractFlysAnchoredAtFlys,
 EmptyDbFieldHidesPara,
+UseVariableWidthNBSP,
+
 /// special entry: optcomp.cxx converts the other values to
 /// integers but not this one because it doesn't have its own
 /// checkbox, so keep it at the end!
diff --git a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
index 68b369ba09fc..fc0919ae2a3a 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
@@ -128,6 +128,12 @@
 
 true
   
+  
+
+  Render NBSP as having variable size, instead of having a fixed 
size
+
+false
+  
 
   
   
diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index b392b43e378d..c05e5d54df4b 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -126,7 +126,9 @@ enum class DocumentSettingId
 NO_NUMBERING_SHOW_FOLLOWBY,
 // drop cap punctuation: smaller dashes, bullet, asterisks, quotation 
marks etc.
 // by extending the rounding box of the glyph to the baseline
-DROP_CAP_PUNCTUATION
+DROP_CAP_PUNCTUATION,
+// render NBSP as standard-space-width (prettier when justified)
+USE_VARIABLE_WIDTH_NBSP,
 };
 
 /** Provides access to settings of a document
diff --git a/sw/qa/core/text/data/tdf41652_legacy.fodt 
b/sw/qa/core/text/data/tdf41652_legacy.fodt
new file mode 100644
index ..07761f24be72
--- /dev/null
+++ b/sw/qa/core/text/data/tdf41652_legacy.fodt
@@ -0,0 +1,300 @@
+
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 

[Libreoffice-commits] core.git: sw/qa sw/source

2023-03-10 Thread Vojtěch Doležal (via logerrit)
 sw/qa/core/text/text.cxx  |   95 ++
 sw/source/core/fields/authfld.cxx |5 ++
 2 files changed, 100 insertions(+)

New commits:
commit 531a462f3110b70a6ba56db336dffbb270276013
Author: Vojtěch Doležal 
AuthorDate: Wed Mar 8 18:15:50 2023 +0100
Commit: Miklos Vajna 
CommitDate: Fri Mar 10 14:57:59 2023 +

Make sure new bibliography actions work even with tab stops

Change-Id: Ibe7fb7f3608eb734c670501b7d83fca0a5d68946
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148486
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 7ace4df111c6..9047e5a2160b 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -11,6 +11,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -289,6 +290,100 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testBibliographyUrlPdfExport5)
 CPPUNIT_ASSERT(pPdfPage->hasLinks());
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport6)
+{
+// Given a document with a bibliography entry field:
+std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get();
+if (!pPDFium)
+{
+return;
+}
+createSwDoc();
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+
+// Create a bibliography mark
+uno::Reference xField(
+xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), 
uno::UNO_QUERY);
+uno::Sequence aFields = {
+comphelper::makePropertyValue("BibiliographicType", 
text::BibliographyDataType::WWW),
+comphelper::makePropertyValue("Identifier", OUString("AT")),
+comphelper::makePropertyValue("Author", OUString("AuthorName")),
+comphelper::makePropertyValue("Title", OUString("Title")),
+comphelper::makePropertyValue("UseTargetURL", OUString("true")),
+};
+xField->setPropertyValue("Fields", uno::Any(aFields));
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xText = xTextDocument->getText();
+uno::Reference xCursor = xText->createTextCursor();
+uno::Reference xContent(xField, uno::UNO_QUERY);
+xText->insertTextContent(xCursor, xContent, /*bAbsorb=*/false);
+
+// Create a bibliography table.
+uno::Reference xTable(
+xFactory->createInstance("com.sun.star.text.Bibliography"), 
uno::UNO_QUERY);
+xCursor->gotoEnd(/*bExpand=*/false);
+xText->insertControlCharacter(xCursor, 
text::ControlCharacter::APPEND_PARAGRAPH,
+  /*bAbsorb=*/false);
+xText->insertTextContent(xCursor, xTable, /*bAbsorb=*/false);
+
+// Set formatting for AUTH_TYPE_WWW to include tab stop
+uno::Reference xTableAsPropertySet(xTable, 
uno::UNO_QUERY_THROW);
+uno::Reference aAllPatterns(
+xTableAsPropertySet->getPropertyValue("LevelFormat"), uno::UNO_QUERY);
+
+uno::Sequence> aFormattingPattern
+= { {
+comphelper::makePropertyValue("TokenType", 
OUString("TokenBibliographyDataField")),
+comphelper::makePropertyValue("BibliographyDataField",
+  
text::BibliographyDataField::AUTHOR),
+comphelper::makePropertyValue("CharacterStyleName", 
OUString("")),
+},
+{
+comphelper::makePropertyValue("TokenType", 
OUString("TokenTabStop")),
+comphelper::makePropertyValue("TabStopRightAligned", true),
+comphelper::makePropertyValue("CharacterStyleName", 
OUString("")),
+},
+{
+comphelper::makePropertyValue("TokenType", 
OUString("TokenBibliographyDataField")),
+comphelper::makePropertyValue("BibliographyDataField",
+  
text::BibliographyDataField::TITLE),
+comphelper::makePropertyValue("CharacterStyleName", 
OUString("")),
+},
+{
+comphelper::makePropertyValue("TokenType", 
OUString("TokenTabStop")),
+comphelper::makePropertyValue("TabStopRightAligned", false),
+comphelper::makePropertyValue("TabStopFillCharacter", 
OUString(".")),
+comphelper::makePropertyValue("CharacterStyleName", 
OUString("")),
+},
+{
+comphelper::makePropertyValue("TokenType", 
OUString("TokenText")),
+comphelper::makePropertyValue("Text", OUString("FixedText")),
+comphelper::makePropertyValue("CharacterStyleName", 
OUString("")),
+} };
+
+aAllPatterns->replaceByIndex(AUTH_TYPE_WWW + 1, 
uno::Any(aFormattingPattern));
+xTableAsPropertySet->setPropertyValue("LevelFormat", 
uno::Any(aAllPatterns));
+
+// Update the table
+uno::Reference xTableIndex(xTable, uno::UNO_QUERY);
+xTableIndex->update();
+
+// Assert the table updated correctly
+OUString 

[Libreoffice-commits] core.git: schema/libreoffice xmloff/source

2023-03-10 Thread Vojtěch Doležal (via logerrit)
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |4 ++--
 xmloff/source/text/txtflde.cxx  |3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 61d55b67b02a74456a407b84fcba82d8c39bc697
Author: Vojtěch Doležal 
AuthorDate: Thu Mar 9 17:23:09 2023 +0100
Commit: Miklos Vajna 
CommitDate: Fri Mar 10 08:54:49 2023 +

Moved target-url and use-target-url into loext namespace

Change-Id: I4307a20f34543d4a187b5e59f117b43371f6f6fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148559
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng 
b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index ccf6cc9f6541..f0f84bd3fd40 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -3212,8 +3212,8 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
 text:issn
 loext:local-url
 
-text:target-url
-text:use-target-url
+loext:target-url
+loext:use-target-url
   
   
 
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 71093e61420a..67e9137cc615 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -2713,7 +2713,8 @@ void XMLTextFieldExport::ProcessBibliographyData(
 sStr = GetExport().GetRelativeReference(sStr);
 }
 sal_uInt16 nPrefix = XML_NAMESPACE_TEXT;
-if (eElement == XML_LOCAL_URL)
+if (eElement == XML_LOCAL_URL || eElement == XML_TARGET_URL
+|| eElement == XML_USE_TARGET_URL)
 {
 nPrefix = XML_NAMESPACE_LO_EXT;
 }


[Libreoffice-commits] core.git: schema/libreoffice xmloff/qa

2023-03-08 Thread Vojtěch Doležal (via logerrit)
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |3 
 xmloff/qa/unit/text.cxx |   46 
 2 files changed, 49 insertions(+)

New commits:
commit d704f57a3dc87302ba75ae0c2904ad46e734d027
Author: Vojtěch Doležal 
AuthorDate: Tue Mar 7 11:35:04 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Mar 8 08:06:38 2023 +

Bibliography Marks: Added tests for target-url and use-target-url

Change-Id: Iaebc9224beac1705bc2399358e414f526ad46e13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148392
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng 
b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index 6266dbded22f..ccf6cc9f6541 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -3211,6 +3211,9 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
 text:isbn
 text:issn
 loext:local-url
+
+text:target-url
+text:use-target-url
   
   
 
diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
index ded7196be09b..3b47ce11a397 100644
--- a/xmloff/qa/unit/text.cxx
+++ b/xmloff/qa/unit/text.cxx
@@ -127,6 +127,52 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, 
testBibliographyLocalUrl)
 CPPUNIT_ASSERT_EQUAL(OUString("file:///home/me/test.pdf"), aActual);
 }
 
+CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBibliographyTargetURL1)
+{
+// Given a document with a biblio field, with non-empty LocalURL:
+mxComponent = loadFromDesktop("private:factory/swriter");
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xField(
+xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), 
uno::UNO_QUERY);
+uno::Sequence aFields = {
+comphelper::makePropertyValue("Identifier", OUString("AT")),
+comphelper::makePropertyValue("URL", 
OUString("https://display.url/test1.pdf#page=1;)),
+comphelper::makePropertyValue("TargetURL", 
OUString("https://target.url/test2.pdf#page=2;)),
+comphelper::makePropertyValue("UseTargetURL", OUString("true")),
+};
+xField->setPropertyValue("Fields", uno::Any(aFields));
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xText = xTextDocument->getText();
+uno::Reference xCursor = xText->createTextCursor();
+uno::Reference xContent(xField, uno::UNO_QUERY);
+xText->insertTextContent(xCursor, xContent, /*bAbsorb=*/false);
+
+// When invoking ODT export + import on it:
+saveAndReload("writer8");
+
+// Then make sure that URL, TargetURL and UseTargetURL are preserved and 
independent:
+xTextDocument.set(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xParaEnumAccess(xTextDocument->getText(),
+  
uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+uno::Reference 
xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
+uno::Reference xPortionEnum = 
xPara->createEnumeration();
+uno::Reference xPortion(xPortionEnum->nextElement(), 
uno::UNO_QUERY);
+xField.set(xPortion->getPropertyValue("TextField"), uno::UNO_QUERY);
+comphelper::SequenceAsHashMap aMap(xField->getPropertyValue("Fields"));
+
+CPPUNIT_ASSERT(aMap.find("URL") != aMap.end());
+CPPUNIT_ASSERT_EQUAL(OUString("https://display.url/test1.pdf#page=1;),
+ aMap["URL"].get());
+
+CPPUNIT_ASSERT(aMap.find("TargetURL") != aMap.end());
+CPPUNIT_ASSERT_EQUAL(OUString("https://target.url/test2.pdf#page=2;),
+ aMap["TargetURL"].get());
+
+CPPUNIT_ASSERT(aMap.find("UseTargetURL") != aMap.end());
+CPPUNIT_ASSERT_EQUAL(OUString("true"), 
aMap["UseTargetURL"].get());
+}
+
 CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCommentTableBorder)
 {
 // Without the accompanying fix in place, this failed to load, as a 
comment that started in a


[Libreoffice-commits] core.git: include/xmloff sw/inc sw/qa sw/source sw/uiconfig vcl/source xmloff/source

2023-03-06 Thread Vojtěch Doležal (via logerrit)
 include/xmloff/xmltoken.hxx |2 
 sw/inc/authfld.hxx  |5 
 sw/inc/helpids.h|2 
 sw/inc/strings.hrc  |2 
 sw/inc/toxe.hxx |2 
 sw/qa/core/text/text.cxx|  154 
 sw/source/core/fields/authfld.cxx   |   30 
 sw/source/core/fields/fldbas.cxx|   10 -
 sw/source/core/text/EnhancedPDFExportHelper.cxx |  149 +++
 sw/source/ui/index/cnttab.cxx   |2 
 sw/source/ui/index/swuiidxmrk.cxx   |   34 +
 sw/source/uibase/docvw/edtwin2.cxx  |   10 +
 sw/source/uibase/shells/textsh1.cxx |   14 +-
 sw/source/uibase/utlui/initui.cxx   |2 
 sw/source/uibase/wrtsh/wrtsh2.cxx   |   74 ++-
 sw/uiconfig/swriter/ui/bibliofragment.ui|   24 +++
 vcl/source/gdi/pdfwriter_impl.cxx   |7 -
 xmloff/source/core/xmltoken.cxx |2 
 xmloff/source/text/txtflde.cxx  |   10 +
 xmloff/source/text/txtfldi.cxx  |8 +
 xmloff/source/token/tokens.txt  |2 
 21 files changed, 495 insertions(+), 50 deletions(-)

New commits:
commit 7b99871635cd48c2a8a1d0afbd7afc60a45cc2ff
Author: Vojtěch Doležal 
AuthorDate: Mon Feb 27 08:52:35 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Mar 7 07:12:31 2023 +

tdf#153396 - Bibliography marks improvements

Adds option to separate function of "URL" into (listed) "URL" and "Target 
URL" to allow for more flexibility (in that case if target URL is empty, 
bibliography mark hyperlink leads to bibliography table row if possible)
When writing tests also found and fixed bug where exporting new file with 
anchor link bibliography mark crashes LO.

Change-Id: Ic1b5c8c9590c0338dcfc4fa3a981142bddae0113
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147868
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 7c6cea0482d3..5262f3b3ab5e 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3465,6 +3465,8 @@ namespace xmloff::token {
 XML_MARGIN_GUTTER,
 
 XML_LOCAL_URL,
+XML_TARGET_URL,
+XML_USE_TARGET_URL,
 
 // Math ml
 XML_DIR,
diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index def78f913e14..26e4843a6ad2 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -199,8 +199,13 @@ public:
 OUString GetAuthority(const SwRootFrame *pLayout,
   const SwForm *pTOX = nullptr) const;
 
+bool UseTargetURL() const;
+
 bool HasURL() const;
 OUString GetAbsoluteURL() const;
+
+bool HasTargetURL() const;
+OUString GetAbsoluteTargetURL() const;
 /**
  * Returns full URI for the URL, relative if specified
  * \param   bRelative   whether the path should be relative (when dealing 
with local files)
diff --git a/sw/inc/helpids.h b/sw/inc/helpids.h
index 65c49e22f311..78f52fd436ea 100644
--- a/sw/inc/helpids.h
+++ b/sw/inc/helpids.h
@@ -76,6 +76,8 @@ inline constexpr OStringLiteral HID_EDIT_FORMULA = 
"SW_HID_EDIT_FORMULA";
 #define HID_AUTH_FIELD_CUSTOM5  
"SW_HID_AUTH_FIELD_CUSTOM5"
 #define HID_AUTH_FIELD_ISBN 
"SW_HID_AUTH_FIELD_ISBN"
 #define HID_AUTH_FIELD_LOCAL_URL
"SW_HID_AUTH_FIELD_LOCAL_URL"
+#define HID_AUTH_FIELD_TARGET_URL   
"SW_HID_AUTH_FIELD_TARGET_URL"
+#define HID_AUTH_FIELD_USE_TARGET_URL   
"SW_HID_AUTH_FIELD_USE_TARGET_URL"
 
 inline constexpr OStringLiteral HID_BUSINESS_FMT_PAGE = 
"SW_HID_BUSINESS_FMT_PAGE";
 inline constexpr OStringLiteral HID_BUSINESS_FMT_PAGE_CONT = 
"SW_HID_BUSINESS_FMT_PAGE_CONT";
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 96e58d395164..8af6eef01a4d 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -816,6 +816,8 @@
 #define STR_AUTH_FIELD_CUSTOM5  NC_("STR_AUTH_FIELD_CUSTOM5", 
"User-defined5")
 #define STR_AUTH_FIELD_ISBN NC_("STR_AUTH_FIELD_ISBN", 
"ISBN")
 #define STR_AUTH_FIELD_LOCAL_URL
NC_("STR_AUTH_FIELD_LOCAL_URL", "Local copy")
+#define STR_AUTH_FIELD_TARGET_URL   
NC_("STR_AUTH_FIELD_TARGET_URL", "Target URL")
+#define STR_AUTH_FIELD_USE_TARGET_URL   
NC_("STR_AUTH_FIELD_USE_TARGET_URL", "Use Target URL as hyperlink")
 
 #define STR_IDXMRK_EDIT NC_("STR_IDXMRK_EDIT", "Edit 
Index Entry")
 #define STR_IDXMRK_INSERT   NC_("STR_IDXMRK_INSERT", 
"Insert Index Entry")
diff --git a/sw/inc/toxe.hxx b/sw/inc/toxe.hxx
index b2f08e66c320..05084c84c2e8 100644
--- a/sw/inc/toxe.hxx
+++ b/sw/inc/toxe.hxx
@@ 

[Libreoffice-commits] core.git: sw/source

2023-02-16 Thread Vojtěch Doležal (via logerrit)
 sw/source/uibase/shells/textidx.cxx |  101 
 1 file changed, 92 insertions(+), 9 deletions(-)

New commits:
commit 2db9105add49d2d5918717d423e91b60ceb5e838
Author: Vojtěch Doležal 
AuthorDate: Tue Feb 14 11:28:59 2023 +0100
Commit: Miklos Vajna 
CommitDate: Thu Feb 16 08:48:59 2023 +

tdf#72955 - Modified Bibliography entry dialog to work inside bibl. table

Change-Id: I5d4072e136eb321f92973ca8e3cd749e4ce06bd5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147001
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/uibase/shells/textidx.cxx 
b/sw/source/uibase/shells/textidx.cxx
index 299de33d1490..29904eef54f7 100644
--- a/sw/source/uibase/shells/textidx.cxx
+++ b/sw/source/uibase/shells/textidx.cxx
@@ -35,23 +35,103 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 void SwTextShell::ExecIdx(SfxRequest const )
 {
-const SfxItemSet *pArgs = rReq.GetArgs();
+const SfxItemSet* pArgs = rReq.GetArgs();
 const SfxPoolItem* pItem = nullptr;
 const sal_uInt16 nSlot = rReq.GetSlot();
-if(pArgs)
-   pArgs->GetItemState(nSlot, false,  );
+if (pArgs)
+pArgs->GetItemState(nSlot, false, );
 
 SfxViewFrame* pVFrame = GetView().GetViewFrame();
 
-switch( nSlot )
+switch (nSlot)
 {
-case FN_EDIT_AUTH_ENTRY_DLG :
+case FN_EDIT_AUTH_ENTRY_DLG:
 {
-SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-ScopedVclPtr 
pDlg(pFact->CreateSwAutoMarkDialog(GetView().GetFrameWeld(), GetShell()));
-pDlg->Execute();
+SwWrtShell& rShell = GetShell();
+
+const bool bWasViewLocked = rShell.IsViewLocked();
+rShell.LockView(true);
+
+if (const SwField* const pCurrentField = rShell.GetCurField();
+!rShell.HasReadonlySel() && pCurrentField != nullptr
+&& pCurrentField->GetTyp()->Which() == 
SwFieldIds::TableOfAuthorities)
+{
+// Since the cursor is on a bibliography mark (e.g. "[1]"), 
open the edit dialog as usual
+SwAbstractDialogFactory* pFact = 
SwAbstractDialogFactory::Create();
+ScopedVclPtr pDlg(
+pFact->CreateSwAutoMarkDialog(GetView().GetFrameWeld(), 
rShell));
+pDlg->Execute();
+}
+else if (const SwTOXBase* const pCurrentTOX = rShell.GetCurTOX();
+ pCurrentTOX != nullptr && pCurrentTOX->GetType() == 
TOX_AUTHORITIES
+ && (rShell.GetCursor()->GetPoint()->GetNode()
+.FindSectionNode()->GetSection().GetType()
+ == SectionType::ToxContent))
+{
+// Since the cursor is in the bibliography table, find the 
first mark that would match the given row
+const SwNode* const pTableRowNode = 
()->GetPoint()->GetNode();
+const OUString& rTableRowText
+= static_cast(pTableRowNode)->GetText();
+
+const SwFieldType* pAuthField
+= rShell.GetDoc()->getIDocumentFieldsAccess().GetFieldType(
+SwFieldIds::TableOfAuthorities, OUString(), false);
+
+if (pAuthField)
+{
+bool bMatchingMarkFound = false;
+{
+std::vector vFields;
+pAuthField->GatherFields(vFields);
+for (auto pFormatField : vFields)
+{
+if (const SwField* pIteratedField = nullptr;
+pFormatField != nullptr
+&& (pIteratedField = pFormatField->GetField()) 
!= nullptr
+&& (pIteratedField->GetTyp()->Which()
+== SwFieldIds::TableOfAuthorities))
+{
+OUString sMarkText
+= static_cast(pIteratedField)
+  ->GetAuthority(rShell.GetLayout(),
+ 
>GetTOXForm());
+
+if (sMarkText == rTableRowText)
+{
+// Since the text generated from the mark 
would match the given row
+//  move cursor to it, set 
bMatchingMarkFound and break
+rShell.GotoFormatField(*pFormatField);
+bMatchingMarkFound = true;
+break;
+}
+}
+}
+}
+
+if (bMatchingMarkFound)
+{
+   

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

2023-02-14 Thread Vojtěch Doležal (via logerrit)
 sw/inc/authfld.hxx |   19 +-
 sw/qa/core/fields/fields.cxx   |4 -
 sw/source/core/fields/authfld.cxx  |  111 ++---
 sw/source/core/inc/txmsrt.hxx  |2 
 sw/source/core/tox/txmsrt.cxx  |2 
 sw/source/uibase/docvw/edtwin2.cxx |   11 +--
 6 files changed, 115 insertions(+), 34 deletions(-)

New commits:
commit a3a151ccfbb7560f7e96523efa350b174888f359
Author: Vojtěch Doležal 
AuthorDate: Mon Feb 13 00:51:59 2023 +0100
Commit: Mike Kaganski 
CommitDate: Wed Feb 15 07:19:08 2023 +

Refactored SwAuthorityField::GetAuthority

The current version takes pointer to too complex of a structure, does some 
insane (and completely pointless) const_casting with it, and isn't very 
practically usable due to only supporting calculation for format of a default 
TOX. This refactor solves all these issues.

Change-Id: I582be2ecdbd83650c0c30ee9df786feffdc6cb99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147000
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Reviewed-by: Mike Kaganski 

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 764aa42190b6..f708457748d9 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -19,6 +19,8 @@
 #ifndef INCLUDED_SW_INC_AUTHFLD_HXX
 #define INCLUDED_SW_INC_AUTHFLD_HXX
 
+#include 
+
 #include "swdllapi.h"
 #include "fldbas.hxx"
 #include "toxe.hxx"
@@ -31,6 +33,7 @@
 
 class SwTOXInternational;
 class SwTextAttr;
+class SwForm;
 
 class SwAuthEntry final : public salhelper::SimpleReferenceObject
 {
@@ -186,11 +189,23 @@ public:
 
 virtual OUString GetDescription() const override;
 
-/// Returns the line matching the source's default row in the ToX.
-OUString GetAuthority(const SwTextAttr* pTextAttr, const SwRootFrame* 
pLayout) const;
+/**
+ * Returns the line matching the source's default row in the ToX.
+ *
+ * \param   pLayout layout to be used
+ * \param   pTOXbibliography table to take the format of the 
string from
+ * \return  entry formated as the appropriate authority type 
in the table
+ */
+OUString GetAuthority(const SwRootFrame *pLayout,
+  const SwForm *pTOX = nullptr) const;
 
 bool HasURL() const;
 OUString GetAbsoluteURL() const;
+/**
+ * Returns full URI for the URL, relative if specified
+ * \param   bRelative   whether the path should be relative (when dealing 
with local files)
+ */
+OUString GetURI(bool bRelative) const;
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx
index 6f1fd79ee582..7282d2027088 100644
--- a/sw/qa/core/fields/fields.cxx
+++ b/sw/qa/core/fields/fields.cxx
@@ -61,10 +61,8 @@ CPPUNIT_TEST_FIXTURE(Test, testAuthorityTooltip)
 auto pField = dynamic_cast(
 SwCursorShell::GetFieldAtCursor(pCursor, 
/*bIncludeInputFieldAtStart=*/true));
 CPPUNIT_ASSERT(pField);
-SwTextNode* pTextNode = pCursor->GetPointNode().GetTextNode();
-const SwTextAttr* pTextAttr = pTextNode->GetSwpHints().Get(0);
 const SwRootFrame* pLayout = pWrtShell->GetLayout();
-OUString aTooltip = pField->GetAuthority(pTextAttr, pLayout);
+OUString aTooltip = pField->GetAuthority(pLayout);
 
 // Without the accompanying fix in place, generating this tooltip text was 
not possible without
 // first inserting an empty bibliography table into the document.
diff --git a/sw/source/core/fields/authfld.cxx 
b/sw/source/core/fields/authfld.cxx
index 8a6212e22738..44d1e39dd3ae 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -17,14 +17,18 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+
 #include 
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,6 +51,7 @@
 #include 
 
 #include 
+#include 
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
@@ -559,31 +564,31 @@ OUString SwAuthorityField::GetDescription() const
 return SwResId(STR_AUTHORITY_ENTRY);
 }
 
-OUString SwAuthorityField::GetAuthority(const SwTextAttr* pTextAttr,
-const SwRootFrame* pLayout) const
+OUString SwAuthorityField::GetAuthority(const SwRootFrame* pLayout, const 
SwForm* pTOX) const
 {
 OUString aText;
 
-SwForm aForm(TOX_AUTHORITIES);
-if (!pTextAttr)
+std::unique_ptr pDefaultTOX;
+if (!pTOX)
 {
-return aText;
+pDefaultTOX = std::make_unique(TOX_AUTHORITIES);
+pTOX = pDefaultTOX.get();
 }
 
-auto& rFormatField = 
const_cast(pTextAttr->GetFormatField());
-SwTextField* pTextField = rFormatField.GetTextField();
-if (!pTextField)
-{
-return aText;
-}
-
-const SwTextNode& rNode = pTextField->GetTextNode();
-const auto pFieldType =