core.git: chart2/source compilerplugins/clang

2024-02-16 Thread Kevin Suo (via logerrit)
 chart2/source/model/template/CandleStickChartType.hxx |4 +---
 compilerplugins/clang/fragiledestructor.cxx   |2 --
 2 files changed, 1 insertion(+), 5 deletions(-)

New commits:
commit 90d22daf99e3d07ba19b7d16f240ab53b0873d49
Author: Kevin Suo 
AuthorDate: Thu Feb 15 23:16:50 2024 +0800
Commit: Caolán McNamara 
CommitDate: Fri Feb 16 10:11:29 2024 +0100

tdf#142467: restore "final" in CandleStickChartType class

The "final" was removed in commit
e06f2bb00137655dbf6f0a8c8c2fc555720f4d3f (tdf#142467 crash on calling
'getInfoHelper' in final class, 2021-05-26)
and commit
6cb1745c24c7651050e30216860c539fa13cc0e2 (tdf#142467: Update comments
with GCC bug ID, 2021-05-31)
due to a bug in gcc .

Now it has been amost 3 years past and that gcc bug has long been fixed,
so it is time to restore the "final".

Change-Id: I7db9fe59209cfbae4c04bb3a91cd764db9a38d98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163447
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/chart2/source/model/template/CandleStickChartType.hxx 
b/chart2/source/model/template/CandleStickChartType.hxx
index e7610750758f..822422aac85f 100644
--- a/chart2/source/model/template/CandleStickChartType.hxx
+++ b/chart2/source/model/template/CandleStickChartType.hxx
@@ -23,9 +23,7 @@
 namespace chart
 {
 
-// see  "[10/11/12 
Regression] using
-// declaration causing virtual call with wrongly adjusted this pointer" before 
restoring 'final'
-class CandleStickChartType /* final */ : public ChartType
+class CandleStickChartType final : public ChartType
 {
 public:
 explicit CandleStickChartType();
diff --git a/compilerplugins/clang/fragiledestructor.cxx 
b/compilerplugins/clang/fragiledestructor.cxx
index f8ec76a561f8..10056684 100644
--- a/compilerplugins/clang/fragiledestructor.cxx
+++ b/compilerplugins/clang/fragiledestructor.cxx
@@ -51,8 +51,6 @@ public:
  return false;
 if (loplugin::isSamePathname(fn, SRCDIR 
"/sw/source/core/layout/ssfrm.cxx")) // ~SwFrame calling IsDeleteForbidden
  return false;
-if (loplugin::isSamePathname(fn, SRCDIR 
"/chart2/source/model/template/CandleStickChartType.cxx")) // to ignore 
 "[10/11/12 Regression] 
using declaration causing virtual call with wrongly adjusted this pointer" 
workaround
- return false;
 
 return true;
 }


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

2024-01-19 Thread Kevin Suo (via logerrit)
 sc/qa/uitest/autofilter2/tdf158314_EmptyError.py |   94 +++
 sc/source/core/data/column3.cxx  |4 
 sc/source/ui/view/gridwin.cxx|7 -
 3 files changed, 100 insertions(+), 5 deletions(-)

New commits:
commit 94b9579b25fe60d8c4c34a3379f06068a1fe6167
Author: Kevin Suo 
AuthorDate: Tue Jan 16 10:13:59 2024 +0800
Commit: Xisco Fauli 
CommitDate: Fri Jan 19 09:47:28 2024 +0100

tdf#158314: show Empty and Error entries as non-selected and inactive...

...when hidden by autofilter.

The "show hidden filter elements as inactive" feature was added and 
improved by:

commit 2d1df9f3dccc10f13b8585ad18afce1542ebc4d1
(tdf#117276 sc: Show hidden filter elements as inactive elements)

commit 2085e90fe8ac129bc4dbac4612d1ea7544335dae
(FilteredRow is not a property of the column, tdf#117276 follow-up)

commit 7321db3cadc8c0e4437ca04e5dcb652734ea9c26
(Related tdf#117276 sc: Show hidden filter elements as inactive elements)

commit 19533948370dc1ccd7334dbe1a8b7fc8330b10c0
(Name FilteredRow what it is, not hidden; tdf#117276 follow-up)

Those changes correctly made normal hidden filter elements as inactive,
but failed to do so for Empty and Error entries.

This patch shows the hidden Empty and Error entries as inactive and 
unselected.
Also, do not show the Empty entry at the top of the list in case it is 
inactive.

Change-Id: Ibcd758cebc0692b04b162cdfc3e06eceb86b17da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162166
Reviewed-by: Xisco Fauli 
Reviewed-by: Kevin Suo 
Tested-by: Kevin Suo 
(cherry picked from commit 89e032e9c4c51f52680c7d8bacf59ab2a34f2180)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162226
Tested-by: Xisco Fauli 

diff --git a/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py 
b/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py
new file mode 100644
index ..2ced88c80db3
--- /dev/null
+++ b/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py
@@ -0,0 +1,94 @@
+# -*- 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
+from uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import is_row_hidden
+
+# Bug 158314 - Autofilter dropdown list always shows "Empty" entry as active
+
+class tdf158314_EmptyEntries(UITestCase):
+def testTdf158314(self):
+with self.ui_test.create_doc_in_start_center("calc") as calcDoc:
+xCalcDoc = self.xUITest.getTopFocusWindow()
+xGridWin = xCalcDoc.getChild("grid_window")
+
+# Fill the sheet with test data
+enter_text_to_cell(xGridWin, "A1", "a")
+enter_text_to_cell(xGridWin, "A2", "1")
+enter_text_to_cell(xGridWin, "A3", "2")
+enter_text_to_cell(xGridWin, "A4", "3")
+enter_text_to_cell(xGridWin, "A5", "4")
+
+enter_text_to_cell(xGridWin, "B1", "b")
+enter_text_to_cell(xGridWin, "B2", "5")
+enter_text_to_cell(xGridWin, "B3", "")
+enter_text_to_cell(xGridWin, "B4", "=1/0")
+enter_text_to_cell(xGridWin, "B5", "8")
+
+# Select the data range and set autofilter
+xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": 
"A1:B5"}))
+self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+
+# Click the autofilter dropdown in column A
+xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+xTreeList = xCheckListMenu.getChild("check_list_box")
+
+#  Select the first entry only. Uncheck all other entries.
+for i in xTreeList.getChildren():
+if i != "0":
+xEntry = xTreeList.getChild(i)
+xEntry.executeAction("CLICK", tuple())
+
+xOkButton = xFloatWindow.getChild("ok")
+xOkButton.executeAction("CLICK", tuple())
+
+# Check that only row#2 is visible
+self.assertFalse(is_row_hidden(calcDoc, 1))
+self.assertTrue(is_row_hidden(calcDoc, 2))
+self.assertTrue(is_row_hidden(calcDoc, 3))
+self.assertTrue(is_row_hidden(calcDoc, 4))
+
+# Click the autofilter dropdown in column B
+xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": 

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

2024-01-18 Thread Kevin Suo (via logerrit)
 sc/qa/uitest/autofilter2/tdf158314_EmptyError.py |   94 +++
 sc/source/core/data/column3.cxx  |4 
 sc/source/ui/view/gridwin.cxx|7 -
 3 files changed, 100 insertions(+), 5 deletions(-)

New commits:
commit f14e942e84942b42956a058e737742f5d19daa96
Author: Kevin Suo 
AuthorDate: Tue Jan 16 10:13:59 2024 +0800
Commit: Xisco Fauli 
CommitDate: Thu Jan 18 17:21:23 2024 +0100

tdf#158314: show Empty and Error entries as non-selected and inactive...

...when hidden by autofilter.

The "show hidden filter elements as inactive" feature was added and 
improved by:

commit 2d1df9f3dccc10f13b8585ad18afce1542ebc4d1
(tdf#117276 sc: Show hidden filter elements as inactive elements)

commit 2085e90fe8ac129bc4dbac4612d1ea7544335dae
(FilteredRow is not a property of the column, tdf#117276 follow-up)

commit 7321db3cadc8c0e4437ca04e5dcb652734ea9c26
(Related tdf#117276 sc: Show hidden filter elements as inactive elements)

commit 19533948370dc1ccd7334dbe1a8b7fc8330b10c0
(Name FilteredRow what it is, not hidden; tdf#117276 follow-up)

Those changes correctly made normal hidden filter elements as inactive,
but failed to do so for Empty and Error entries.

This patch shows the hidden Empty and Error entries as inactive and 
unselected.
Also, do not show the Empty entry at the top of the list in case it is 
inactive.

Change-Id: Ibcd758cebc0692b04b162cdfc3e06eceb86b17da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162166
Reviewed-by: Xisco Fauli 
Reviewed-by: Kevin Suo 
Tested-by: Kevin Suo 
(cherry picked from commit 2e844921083ee45a36454ea3f03c1796439e4d16)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162224
Tested-by: Jenkins

diff --git a/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py 
b/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py
new file mode 100644
index ..2ced88c80db3
--- /dev/null
+++ b/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py
@@ -0,0 +1,94 @@
+# -*- 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
+from uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import is_row_hidden
+
+# Bug 158314 - Autofilter dropdown list always shows "Empty" entry as active
+
+class tdf158314_EmptyEntries(UITestCase):
+def testTdf158314(self):
+with self.ui_test.create_doc_in_start_center("calc") as calcDoc:
+xCalcDoc = self.xUITest.getTopFocusWindow()
+xGridWin = xCalcDoc.getChild("grid_window")
+
+# Fill the sheet with test data
+enter_text_to_cell(xGridWin, "A1", "a")
+enter_text_to_cell(xGridWin, "A2", "1")
+enter_text_to_cell(xGridWin, "A3", "2")
+enter_text_to_cell(xGridWin, "A4", "3")
+enter_text_to_cell(xGridWin, "A5", "4")
+
+enter_text_to_cell(xGridWin, "B1", "b")
+enter_text_to_cell(xGridWin, "B2", "5")
+enter_text_to_cell(xGridWin, "B3", "")
+enter_text_to_cell(xGridWin, "B4", "=1/0")
+enter_text_to_cell(xGridWin, "B5", "8")
+
+# Select the data range and set autofilter
+xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": 
"A1:B5"}))
+self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+
+# Click the autofilter dropdown in column A
+xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+xTreeList = xCheckListMenu.getChild("check_list_box")
+
+#  Select the first entry only. Uncheck all other entries.
+for i in xTreeList.getChildren():
+if i != "0":
+xEntry = xTreeList.getChild(i)
+xEntry.executeAction("CLICK", tuple())
+
+xOkButton = xFloatWindow.getChild("ok")
+xOkButton.executeAction("CLICK", tuple())
+
+# Check that only row#2 is visible
+self.assertFalse(is_row_hidden(calcDoc, 1))
+self.assertTrue(is_row_hidden(calcDoc, 2))
+self.assertTrue(is_row_hidden(calcDoc, 3))
+self.assertTrue(is_row_hidden(calcDoc, 4))
+
+# Click the autofilter dropdown in column B
+xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "1", 

core.git: sc/qa sc/source

2024-01-18 Thread Kevin Suo (via logerrit)
 sc/qa/uitest/autofilter2/tdf158314_EmptyError.py |   94 +++
 sc/source/core/data/column3.cxx  |4 
 sc/source/ui/view/gridwin.cxx|7 -
 3 files changed, 100 insertions(+), 5 deletions(-)

New commits:
commit 89e032e9c4c51f52680c7d8bacf59ab2a34f2180
Author: Kevin Suo 
AuthorDate: Tue Jan 16 10:13:59 2024 +0800
Commit: Kevin Suo 
CommitDate: Thu Jan 18 13:08:22 2024 +0100

tdf#158314: show Empty and Error entries as non-selected and inactive...

...when hidden by autofilter.

The "show hidden filter elements as inactive" feature was added and 
improved by:

commit 2d1df9f3dccc10f13b8585ad18afce1542ebc4d1
(tdf#117276 sc: Show hidden filter elements as inactive elements)

commit 2085e90fe8ac129bc4dbac4612d1ea7544335dae
(FilteredRow is not a property of the column, tdf#117276 follow-up)

commit 7321db3cadc8c0e4437ca04e5dcb652734ea9c26
(Related tdf#117276 sc: Show hidden filter elements as inactive elements)

commit 19533948370dc1ccd7334dbe1a8b7fc8330b10c0
(Name FilteredRow what it is, not hidden; tdf#117276 follow-up)

Those changes correctly made normal hidden filter elements as inactive,
but failed to do so for Empty and Error entries.

This patch shows the hidden Empty and Error entries as inactive and 
unselected.
Also, do not show the Empty entry at the top of the list in case it is 
inactive.

Change-Id: Ibcd758cebc0692b04b162cdfc3e06eceb86b17da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162166
Reviewed-by: Xisco Fauli 
Reviewed-by: Kevin Suo 
Tested-by: Kevin Suo 

diff --git a/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py 
b/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py
new file mode 100644
index ..2ced88c80db3
--- /dev/null
+++ b/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py
@@ -0,0 +1,94 @@
+# -*- 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
+from uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import is_row_hidden
+
+# Bug 158314 - Autofilter dropdown list always shows "Empty" entry as active
+
+class tdf158314_EmptyEntries(UITestCase):
+def testTdf158314(self):
+with self.ui_test.create_doc_in_start_center("calc") as calcDoc:
+xCalcDoc = self.xUITest.getTopFocusWindow()
+xGridWin = xCalcDoc.getChild("grid_window")
+
+# Fill the sheet with test data
+enter_text_to_cell(xGridWin, "A1", "a")
+enter_text_to_cell(xGridWin, "A2", "1")
+enter_text_to_cell(xGridWin, "A3", "2")
+enter_text_to_cell(xGridWin, "A4", "3")
+enter_text_to_cell(xGridWin, "A5", "4")
+
+enter_text_to_cell(xGridWin, "B1", "b")
+enter_text_to_cell(xGridWin, "B2", "5")
+enter_text_to_cell(xGridWin, "B3", "")
+enter_text_to_cell(xGridWin, "B4", "=1/0")
+enter_text_to_cell(xGridWin, "B5", "8")
+
+# Select the data range and set autofilter
+xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": 
"A1:B5"}))
+self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+
+# Click the autofilter dropdown in column A
+xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+xTreeList = xCheckListMenu.getChild("check_list_box")
+
+#  Select the first entry only. Uncheck all other entries.
+for i in xTreeList.getChildren():
+if i != "0":
+xEntry = xTreeList.getChild(i)
+xEntry.executeAction("CLICK", tuple())
+
+xOkButton = xFloatWindow.getChild("ok")
+xOkButton.executeAction("CLICK", tuple())
+
+# Check that only row#2 is visible
+self.assertFalse(is_row_hidden(calcDoc, 1))
+self.assertTrue(is_row_hidden(calcDoc, 2))
+self.assertTrue(is_row_hidden(calcDoc, 3))
+self.assertTrue(is_row_hidden(calcDoc, 4))
+
+# Click the autofilter dropdown in column B
+xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "1", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+xTreeList 

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

2023-11-29 Thread Kevin Suo (via logerrit)
 i18npool/source/localedata/data/zh_CN.xml |  110 +-
 1 file changed, 63 insertions(+), 47 deletions(-)

New commits:
commit 34fe1610cb98a7e57c6719a5d4f88d90a6c8752a
Author: Kevin Suo 
AuthorDate: Wed Nov 29 19:02:58 2023 +0800
Commit: Kevin Suo 
CommitDate: Thu Nov 30 02:52:27 2023 +0100

Sync LC_OutLineNumberingLevel of zh-CN with en-US locale

The previous order makes the UI tooltip does not match with the
numbering style shown, per tdf#148023.

Also add a commonly used Chinese-specific outline numbering style.
The other old styles with the Chapters and Sections etc are removed
because they are useless.

Change-Id: I585cd0e704af35125c7c38561f500e83f1a465dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160081
Tested-by: Jenkins
Reviewed-by: Kevin Suo 

diff --git a/i18npool/source/localedata/data/zh_CN.xml 
b/i18npool/source/localedata/data/zh_CN.xml
index 6a9439cadfb6..ff943c3d091e 100644
--- a/i18npool/source/localedata/data/zh_CN.xml
+++ b/i18npool/source/localedata/data/zh_CN.xml
@@ -446,61 +446,77 @@
  
   
   
-
-  
-  
-  
-  
-  
+ 
+  
+  
+  
+  
+  
+  
 
-
-  
-  
-  
-  
-  
+ 
+  
+  
+  
+  
+  
+  
 
-
-  
-  
-  
-  
-  
+ 
+  
+  
+  
+  
+  
+  
 
-
-  
-  
-  
-  
-  
+ 
+  
+  
+  
+  
+  
+  
 
-
-  
-  
-  
-  
-  
+ 
+  
+  
+  
+  
+  
+  
 
-
-  
-  
-  
-  
-  
+ 
+  
+  
+  
+  
+  
+  
 
-
-  
-  
-  
-  
-  
+ 
+  
+  
+  
+  
+  
+  
 
 
-  
-  
-  
-  
-  
+  
+  
+  
+  
+  
+  
+
+ 
+  
+  
+  
+  
+  
+  
 
   
 


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

2023-11-29 Thread Kevin Suo (via logerrit)
 i18npool/source/localedata/data/zh_CN.xml |   33 +++---
 1 file changed, 17 insertions(+), 16 deletions(-)

New commits:
commit 6fffa9fdf2ad2c93c319ab662d3993b89c0a24ba
Author: Kevin Suo 
AuthorDate: Wed Nov 29 17:04:58 2023 +0800
Commit: Kevin Suo 
CommitDate: Thu Nov 30 02:52:03 2023 +0100

tdf#152583 follow-up: Sync LC_NumberingLevel of zh-CN with en-US locale

The previous order makes the UI tooltip does not match with the
numbering style shown, per tdf#148023.

Also re-arrange the remaining Chinese-specific styles to make the most
commonly used ones come first.

Change-Id: I913180b1ca385e8a604b16b63ebfa130aca059c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160080
Tested-by: Jenkins
Reviewed-by: Kevin Suo 

diff --git a/i18npool/source/localedata/data/zh_CN.xml 
b/i18npool/source/localedata/data/zh_CN.xml
index 063be07c630e..6a9439cadfb6 100644
--- a/i18npool/source/localedata/data/zh_CN.xml
+++ b/i18npool/source/localedata/data/zh_CN.xml
@@ -427,22 +427,23 @@
 
   
   
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
   
   
 


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

2023-11-28 Thread Kevin Suo (via logerrit)
 i18npool/source/localedata/data/zh_CN.xml |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 22d8f339197b23348e401bb3e9dd7430110dfba6
Author: Kevin Suo 
AuthorDate: Wed Nov 29 11:27:17 2023 +0800
Commit: Kevin Suo 
CommitDate: Wed Nov 29 08:21:45 2023 +0100

tdf#152583: Add [1],[2],[3] numbering style for zh-CN locale

This adds the [1],[2],[3] style of numbering to the Simplified
Chinese locale data. This will show up when one clicks the
numbering toolbar icon.

Change-Id: I8b54746b431384e682f4161a3e99211b4147bad1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160059
Tested-by: Jenkins
Reviewed-by: Kevin Suo 

diff --git a/i18npool/source/localedata/data/zh_CN.xml 
b/i18npool/source/localedata/data/zh_CN.xml
index 1f33090d0ced..063be07c630e 100644
--- a/i18npool/source/localedata/data/zh_CN.xml
+++ b/i18npool/source/localedata/data/zh_CN.xml
@@ -431,6 +431,7 @@
  
  
  
+ 
  
  
  


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sdext/source

2023-11-28 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/writertreevisiting.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f52d8f004f7d70f89ee805c6f71f1791cac70c0f
Author: Kevin Suo 
AuthorDate: Wed Nov 22 16:11:33 2023 +0800
Commit: Xisco Fauli 
CommitDate: Tue Nov 28 09:46:57 2023 +0100

tdf#157589 tdf#153969: Revert "sdext.pdfimport Writer: Do not visit...

... DrawElement twice in WriterXmlEmitter"

This reverts commit 9ea9d3ccc0f8e4833e745d9655b61d42d6d8fe83.

The reason for the revert:
It causes regressions as indicated in tdf#157589 and tdf#153969.
That commit may be my misunderstanding of the code.

Change-Id: Idd188bf83721d309623a7f8484d064327a3a23af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159811
Tested-by: Jenkins
Reviewed-by: Kevin Suo 
(cherry picked from commit 5589659829f8a1cef8ca1c8a468732105bbe231b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159906
Reviewed-by: Xisco Fauli 

diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index a8331b87bfd2..ce8845447e7f 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -413,7 +413,7 @@ void WriterXmlEmitter::visit( DocumentElement& elem, const 
std::list< std::uniqu
 // only DrawElement types
 for( auto it = elem.Children.begin(); it != elem.Children.end(); ++it )
 {
-if( dynamic_cast(it->get()) != nullptr )
+if( dynamic_cast(it->get()) == nullptr )
 (*it)->visitedBy( *this, it );
 }
 


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

2023-11-27 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/writertreevisiting.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5589659829f8a1cef8ca1c8a468732105bbe231b
Author: Kevin Suo 
AuthorDate: Wed Nov 22 16:11:33 2023 +0800
Commit: Kevin Suo 
CommitDate: Tue Nov 28 03:08:39 2023 +0100

tdf#157589 tdf#153969: Revert "sdext.pdfimport Writer: Do not visit...

... DrawElement twice in WriterXmlEmitter"

This reverts commit 9ea9d3ccc0f8e4833e745d9655b61d42d6d8fe83.

The reason for the revert:
It causes regressions as indicated in tdf#157589 and tdf#153969.
That commit may be my misunderstanding of the code.

Change-Id: Idd188bf83721d309623a7f8484d064327a3a23af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159811
Tested-by: Jenkins
Reviewed-by: Kevin Suo 

diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index 7941f7d35709..9ecce8f48be4 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -413,7 +413,7 @@ void WriterXmlEmitter::visit( DocumentElement& elem, const 
std::list< std::uniqu
 // only DrawElement types
 for( auto it = elem.Children.begin(); it != elem.Children.end(); ++it )
 {
-if( dynamic_cast(it->get()) != nullptr )
+if( dynamic_cast(it->get()) == nullptr )
 (*it)->visitedBy( *this, it );
 }
 


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

2022-12-06 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/pdfiprocessor.hxx |1 +
 sdext/source/pdfimport/tree/drawtreevisiting.hxx |2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 83e58fc9f19a8da751cabdc0440aded62dc67fea
Author: Kevin Suo 
AuthorDate: Fri Dec 2 19:22:11 2022 +0800
Commit: Stephan Bergmann 
CommitDate: Wed Dec 7 07:33:41 2022 +

sdext: move the include of XComponentContext.hpp to where it is used

... and remove unsed include.

XComponentContext.hpp is used in pdfiprocessor.hxx but not in 
drawtreevisiting.hxx.
XMultiServiceFactory.hpp is not used drawtreevisiting.hxx.

Change-Id: Ic98cbcdcacd07cf2163e02ac569781f70edd953c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143570
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sdext/source/pdfimport/inc/pdfiprocessor.hxx 
b/sdext/source/pdfimport/inc/pdfiprocessor.hxx
index 7cbe7d7a5104..3fdc146716b3 100644
--- a/sdext/source/pdfimport/inc/pdfiprocessor.hxx
+++ b/sdext/source/pdfimport/inc/pdfiprocessor.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_PDFIPROCESSOR_HXX
 #define INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_PDFIPROCESSOR_HXX
 
+#include 
 #include 
 #include 
 #include 
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.hxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.hxx
index 81bfd927354b..e3ea8e537ff5 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.hxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.hxx
@@ -24,8 +24,6 @@
 
 #include 
 #include 
-#include 
-#include 
 
 namespace pdfi
 {


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

2022-12-05 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/genericelements.hxx  |4 +---
 sdext/source/pdfimport/tree/genericelements.cxx |4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

New commits:
commit c9e961e6803a70587bd4686d05abdd4ac11de434
Author: Kevin Suo 
AuthorDate: Mon Dec 5 17:37:39 2022 +0800
Commit: Kevin Suo 
CommitDate: Tue Dec 6 03:42:27 2022 +

"using namespace com::sun::star" -> css in header file

See Stephan Bergmann's comment the following change (thanks!):
https://gerrit.libreoffice.org/c/core/+/143598

Change-Id: I409b823439979c64cadcb582d8fb4dec4ff412b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143664
Tested-by: Jenkins
Reviewed-by: Kevin Suo 

diff --git a/sdext/source/pdfimport/inc/genericelements.hxx 
b/sdext/source/pdfimport/inc/genericelements.hxx
index 37b448d2b613..6d1459a1f032 100644
--- a/sdext/source/pdfimport/inc/genericelements.hxx
+++ b/sdext/source/pdfimport/inc/genericelements.hxx
@@ -32,8 +32,6 @@
 
 #include 
 
-using namespace com::sun::star;
-
 namespace pdfi
 {
 class XmlEmitter;
@@ -313,7 +311,7 @@ namespace pdfi
 { return std::make_shared(); }
 };
 
-bool isComplex(const uno::Reference& rBreakIterator, 
TextElement* const pTextElem);
+bool isComplex(const css::uno::Reference& 
rBreakIterator, TextElement* const pTextElem);
 }
 
 #endif
diff --git a/sdext/source/pdfimport/tree/genericelements.cxx 
b/sdext/source/pdfimport/tree/genericelements.cxx
index c3c816aecdf2..1d11cd0d914e 100644
--- a/sdext/source/pdfimport/tree/genericelements.cxx
+++ b/sdext/source/pdfimport/tree/genericelements.cxx
@@ -431,12 +431,12 @@ void DocumentElement::visitedBy( ElementTreeVisitor&  
rV
 rVisitor.visit(*this, rParentIt);
 }
 
-bool isComplex(const uno::Reference& rBreakIterator, 
TextElement* const pTextElem) {
+bool isComplex(const css::uno::Reference& 
rBreakIterator, TextElement* const pTextElem) {
 OUString str(pTextElem->Text.toString());
 for(int i=0; i< str.getLength(); i++)
 {
 sal_Int16 nType = rBreakIterator->getScriptType(str, i);
-if (nType == i18n::ScriptType::COMPLEX)
+if (nType == css::i18n::ScriptType::COMPLEX)
 {
 return true;
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sdext/source

2022-12-04 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 5aa8378eab3a05fdeee2cbe1056836dee4207b6e
Author: Kevin Suo 
AuthorDate: Sat Dec 3 19:54:59 2022 +0800
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Dec 5 01:06:37 2022 +

tdf#147246 sdext: font name returned by font descriptor may be...

... e.g. "NotoSerifCJKjp-Regular-VKana".

Change-Id: I9818579c7678b0dad5ec2d2217ae59d573de88b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143609
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 00bf67a99dcdb1549401f0b656e872e5c9762dc5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143582
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 1e096ccbc11d..5d2a2c0b6892 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -630,6 +630,10 @@ void LineParser::readFont()
 aResult.familyName = aResult.familyName.copy(7, 
aResult.familyName.getLength() - 7);
 parseFontFamilyName(aResult);
 }
+if (aResult.familyName.endsWithIgnoreAsciiCase("-VKana"))
+{
+parseFontFamilyName(aResult);
+}
 
 // Font weight
 if (aFontReadResult.GetWeight() == WEIGHT_THIN)


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

2022-12-04 Thread Kevin Suo (via logerrit)
 sdext/qa/unit/pdfimport.cxx|4 -
 sdext/source/pdfimport/tree/writertreevisiting.cxx |   62 -
 sdext/source/pdfimport/tree/writertreevisiting.hxx |3 +
 3 files changed, 65 insertions(+), 4 deletions(-)

New commits:
commit 616c4c6bcb5ddeb932cf1e154f0a1a79c6a8bd45
Author: Kevin Suo 
AuthorDate: Sat Dec 3 09:52:25 2022 +0800
Commit: Noel Grandin 
CommitDate: Sun Dec 4 20:00:08 2022 +

tdf#152083: sdext Pre-reverse the text for RTL in Writer pdfimport as well

Follow up to:
commit 3a2f0e4772e7b4646dd518b33aeafb6fd7025179
Author: Kevin Suo
Date:   Sun Nov 20 00:10:14 2022 +0800
Resolves tdf#152083: Ligatures are incorrectly reversed in Draw pdf 
import

The unit test is adjusted accordingly to reflect this change.

Change-Id: I051a76ed38f76ff92197e1dc87cbfa7151b8ac35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143606
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/qa/unit/pdfimport.cxx b/sdext/qa/unit/pdfimport.cxx
index bb09202897ec..0df6baae7e99 100644
--- a/sdext/qa/unit/pdfimport.cxx
+++ b/sdext/qa/unit/pdfimport.cxx
@@ -832,10 +832,10 @@ namespace
 xmlDocUniquePtr pXmlDoc2(xmlParseDoc(reinterpret_cast(aOutput2.getStr(;
 xpath = 
"string(//draw:frame[@draw:z-index='3'][1]/draw:text-box/text:p/text:span)";
 sContent = getXPathContent(pXmlDoc2, xpath).replaceAll("\n\n", " 
").replaceAll("\n", "");
-CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput2.getStr(), 
OUString(u"ٱلَّسَل"), sContent);
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput2.getStr(), 
OUString(u"ٱلسََّل"), sContent);
 xpath = 
"string(//draw:frame[@draw:z-index='2'][1]/draw:text-box/text:p/text:span)";
 sContent = getXPathContent(pXmlDoc2, xpath).replaceAll("\n\n", " 
").replaceAll("\n", "");
-CPPUNIT_ASSERT_EQUAL(true, sContent.match(u"اُم َعَلْيَك"));
+CPPUNIT_ASSERT_EQUAL(OUString(u"امُ عَلَيَْك"), sContent);
 xpath = 
"string(//draw:frame[last()]/draw:text-box/text:p/text:span)";
 sContent = getXPathContent(pXmlDoc2, xpath).replaceAll("\n\n", " 
").replaceAll("\n", "");
 CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput2.getStr(), 
OUString(u"中文测试,中文"), sContent);
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index de44dcf711b4..f6c9df0805d5 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -43,6 +43,15 @@ using namespace ::com::sun::star::uno;
 namespace pdfi
 {
 
+const Reference& WriterXmlOptimizer::GetBreakIterator()
+{
+if (!mxBreakIter.is())
+{
+mxBreakIter = BreakIterator::create(m_rProcessor.m_xContext);
+}
+return mxBreakIter;
+}
+
 const Reference< XCharacterClassification >& 
WriterXmlEmitter::GetCharacterClassification()
 {
 if ( !mxCharClass.is() )
@@ -815,6 +824,11 @@ void WriterXmlOptimizer::optimizeTextElements(Element& 
rParent)
 if( pCur )
 {
 TextElement* pNext = dynamic_cast(next->get());
+OUString str;
+bool bPara = strspn("ParagraphElement", typeid(rParent).name());
+ParagraphElement* pPara = 
dynamic_cast();
+if (bPara && pPara && isComplex(GetBreakIterator(), pCur))
+pPara->bRtl = true;
 if( pNext )
 {
 const GraphicsContext& rCurGC = 
m_rProcessor.getGraphicsContext( pCur->GCId );
@@ -872,8 +886,52 @@ void WriterXmlOptimizer::optimizeTextElements(Element& 
rParent)
 )
 {
 pCur->updateGeometryWith( pNext );
-// append text to current element
-pCur->Text.append( pNext->Text );
+if (pPara && pPara->bRtl)
+{
+// Tdf#152083: If RTL, reverse the text in pNext so 
that its correct order is
+// restored when the combined text is reversed in 
WriterXmlEmitter::visit.
+OUString tempStr;
+bool bNeedReverse=false;
+str = pNext->Text.toString();
+for (sal_Int32 i=0; i < str.getLength(); i++)
+{
+if (str[i] == u' ')
+{   // Space char (e.g. the space as in " م") 
needs special treatment.
+//   First, append the space char to pCur.
+pCur->Text.append(OUStringChar(str[i]));
+//   Then, check whether the tmpStr needs 
reverse, if so then reverse and append.
+if (bNeedReverse)
+{
+tempStr = 

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

2022-12-04 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 00bf67a99dcdb1549401f0b656e872e5c9762dc5
Author: Kevin Suo 
AuthorDate: Sat Dec 3 19:54:59 2022 +0800
Commit: Noel Grandin 
CommitDate: Sun Dec 4 14:56:40 2022 +

tdf#147246 sdext: font name returned by font descriptor may be...

... e.g. "NotoSerifCJKjp-Regular-VKana".

Change-Id: I9818579c7678b0dad5ec2d2217ae59d573de88b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143609
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index da506d9ceef8..e3e1c3aa8d04 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -630,6 +630,10 @@ void LineParser::readFont()
 aResult.familyName = aResult.familyName.copy(7, 
aResult.familyName.getLength() - 7);
 parseFontFamilyName(aResult);
 }
+if (aResult.familyName.endsWithIgnoreAsciiCase("-VKana"))
+{
+parseFontFamilyName(aResult);
+}
 
 // Font weight
 if (aFontReadResult.GetWeight() == WEIGHT_THIN)


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

2022-12-04 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/genericelements.hxx   |5 +
 sdext/source/pdfimport/tree/drawtreevisiting.cxx |   20 +++-
 sdext/source/pdfimport/tree/genericelements.cxx  |   15 ++-
 3 files changed, 22 insertions(+), 18 deletions(-)

New commits:
commit 842e3b988aca27d7c9f71ce1efc6653271cc3430
Author: Kevin Suo 
AuthorDate: Fri Dec 2 22:53:27 2022 +0800
Commit: Noel Grandin 
CommitDate: Sun Dec 4 14:54:34 2022 +

tdf#152083 related: make the isComplex check block as a separate function

This is used to check whether a TextElement is rtl. We will need this
in WriterXmlOptimizer::optimizeTextElements() as well, in a separate commit.

Change-Id: Iee2ff5990450421153bb7c5afe9526c555f2d0ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143598
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/inc/genericelements.hxx 
b/sdext/source/pdfimport/inc/genericelements.hxx
index 1fec2e6f4042..37b448d2b613 100644
--- a/sdext/source/pdfimport/inc/genericelements.hxx
+++ b/sdext/source/pdfimport/inc/genericelements.hxx
@@ -25,12 +25,15 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
 #include 
 
+using namespace com::sun::star;
+
 namespace pdfi
 {
 class XmlEmitter;
@@ -309,6 +312,8 @@ namespace pdfi
 static std::shared_ptr createDocumentElement()
 { return std::make_shared(); }
 };
+
+bool isComplex(const uno::Reference& rBreakIterator, 
TextElement* const pTextElem);
 }
 
 #endif
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 64aca46ce18b..b94a302a5583 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -682,17 +682,10 @@ void DrawXmlOptimizer::optimizeTextElements(Element& 
rParent)
 if( pCur )
 {
 TextElement* pNext = (*next)->dynCastAsTextElement();
-bool isComplex = false;
-OUString str(pCur->Text.toString());
-for(int i=0; i< str.getLength(); i++)
-{
-sal_Int16 nType = GetBreakIterator()->getScriptType( str, i );
-if (nType == css::i18n::ScriptType::COMPLEX)
-isComplex = true;
-}
+OUString str;
 bool bPara = strspn("ParagraphElement", typeid(rParent).name());
 ParagraphElement* pPara = 
dynamic_cast();
-if (bPara && pPara && isComplex)
+if (bPara && pPara && isComplex(GetBreakIterator(), pCur))
 pPara->bRtl = true;
 if( pNext )
 {
@@ -756,14 +749,7 @@ void DrawXmlOptimizer::optimizeTextElements(Element& 
rParent)
 pCur->Text.append( pNext->Text );
 }
 
-str = pCur->Text.toString();
-for(int i=0; i< str.getLength(); i++)
-{
-sal_Int16 nType = GetBreakIterator()->getScriptType( 
str, i );
-if (nType == css::i18n::ScriptType::COMPLEX)
-isComplex = true;
-}
-if (bPara && pPara && isComplex)
+if (bPara && pPara && isComplex(GetBreakIterator(), pCur))
 pPara->bRtl = true;
 // append eventual children to current element
 // and clear children (else the children just
diff --git a/sdext/source/pdfimport/tree/genericelements.cxx 
b/sdext/source/pdfimport/tree/genericelements.cxx
index 7f751e18ba5c..c3c816aecdf2 100644
--- a/sdext/source/pdfimport/tree/genericelements.cxx
+++ b/sdext/source/pdfimport/tree/genericelements.cxx
@@ -22,7 +22,8 @@
 #include 
 #include 
 
-
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -430,6 +431,18 @@ void DocumentElement::visitedBy( ElementTreeVisitor&   
   rV
 rVisitor.visit(*this, rParentIt);
 }
 
+bool isComplex(const uno::Reference& rBreakIterator, 
TextElement* const pTextElem) {
+OUString str(pTextElem->Text.toString());
+for(int i=0; i< str.getLength(); i++)
+{
+sal_Int16 nType = rBreakIterator->getScriptType(str, i);
+if (nType == i18n::ScriptType::COMPLEX)
+{
+return true;
+}
+}
+return false;
+}
 
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sdext/source

2022-12-03 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |2 +-
 sdext/source/pdfimport/tree/writertreevisiting.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c8f9e93d421207d0b48a80f003ba553b95dc3a98
Author: Kevin Suo 
AuthorDate: Sat Dec 3 18:43:02 2022 +0800
Commit: Caolán McNamara 
CommitDate: Sat Dec 3 16:12:18 2022 +

tdf#147246 sdext.pdfimport: "font-family-asia" -> "font-family-asian"

This was a typo which causes the asian font in pdf (e.g. Chinese)
always shown as the system default font on pdfimport.

Change-Id: Ic118f8585fb40dfc4bc5bc12651da95bc7961ae4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143607
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit d423e18de7c48df359d2d2d1b5b8f5cceac4d96a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143578
Reviewed-by: Caolán McNamara 

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index b19140a0beb9..95e2ce98566f 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -869,7 +869,7 @@ void DrawXmlFinalizer::visit( TextElement& elem, const 
std::list< std::unique_pt
 // TODO: tdf#143095: use system font name rather than PSName
 SAL_INFO("sdext.pdfimport", "The font used in xml is: " << 
rFont.familyName);
 aFontProps[ "fo:font-family" ] = rFont.familyName;
-aFontProps[ "style:font-family-asia" ] = rFont.familyName;
+aFontProps[ "style:font-family-asian" ] = rFont.familyName;
 aFontProps[ "style:font-family-complex" ] = rFont.familyName;
 
 // bold
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index cb312bf50d22..52f45ed577a3 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -976,7 +976,7 @@ void WriterXmlFinalizer::visit( TextElement& elem, const 
std::list< std::unique_
 // TODO: tdf#143095: use system font name rather than PSName
 SAL_INFO("sdext.pdfimport", "The font used in xml is: " << 
rFont.familyName);
 aFontProps[ "fo:font-family" ] = rFont.familyName;
-aFontProps[ "style:font-family-asia" ] = rFont.familyName;
+aFontProps[ "style:font-family-asian" ] = rFont.familyName;
 aFontProps[ "style:font-family-complex" ] = rFont.familyName;
 
 // bold


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

2022-12-03 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |2 +-
 sdext/source/pdfimport/tree/writertreevisiting.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d423e18de7c48df359d2d2d1b5b8f5cceac4d96a
Author: Kevin Suo 
AuthorDate: Sat Dec 3 18:43:02 2022 +0800
Commit: Noel Grandin 
CommitDate: Sat Dec 3 14:07:03 2022 +

tdf#147246 sdext.pdfimport: "font-family-asia" -> "font-family-asian"

This was a typo which causes the asian font in pdf (e.g. Chinese)
always shown as the system default font on pdfimport.

Change-Id: Ic118f8585fb40dfc4bc5bc12651da95bc7961ae4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143607
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 8338ba6dbfde..64aca46ce18b 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -878,7 +878,7 @@ void DrawXmlFinalizer::visit( TextElement& elem, const 
std::list< std::unique_pt
 // TODO: tdf#143095: use system font name rather than PSName
 SAL_INFO("sdext.pdfimport", "The font used in xml is: " << 
rFont.familyName);
 aFontProps[ "fo:font-family" ] = rFont.familyName;
-aFontProps[ "style:font-family-asia" ] = rFont.familyName;
+aFontProps[ "style:font-family-asian" ] = rFont.familyName;
 aFontProps[ "style:font-family-complex" ] = rFont.familyName;
 
 // bold
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index cc2cee18eb6a..de44dcf711b4 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -976,7 +976,7 @@ void WriterXmlFinalizer::visit( TextElement& elem, const 
std::list< std::unique_
 // TODO: tdf#143095: use system font name rather than PSName
 SAL_INFO("sdext.pdfimport", "The font used in xml is: " << 
rFont.familyName);
 aFontProps[ "fo:font-family" ] = rFont.familyName;
-aFontProps[ "style:font-family-asia" ] = rFont.familyName;
+aFontProps[ "style:font-family-asian" ] = rFont.familyName;
 aFontProps[ "style:font-family-complex" ] = rFont.familyName;
 
 // bold


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - i18nutil/source include/i18nutil sdext/CppunitTest_sdext_pdfimport.mk sdext/Executable_pdf2xml.mk sdext/Executable_pdfunzip.mk sdext/Library_

2022-11-30 Thread Kevin Suo (via logerrit)
 i18nutil/source/utility/unicode.cxx|6 ++
 include/i18nutil/unicode.hxx   |1 +
 sdext/CppunitTest_sdext_pdfimport.mk   |1 +
 sdext/Executable_pdf2xml.mk|1 +
 sdext/Executable_pdfunzip.mk   |1 +
 sdext/Library_pdfimport.mk |2 ++
 sdext/source/pdfimport/inc/pdfiprocessor.hxx   |2 +-
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |5 +
 sdext/source/pdfimport/tree/pdfiprocessor.cxx  |   17 -
 sdext/source/pdfimport/tree/writertreevisiting.cxx |5 +
 10 files changed, 39 insertions(+), 2 deletions(-)

New commits:
commit 0a19375b73b12885f9022d82cb51e9c268cc0d6a
Author: Kevin Suo 
AuthorDate: Mon Nov 21 23:32:53 2022 +0800
Commit: Stephan Bergmann 
CommitDate: Wed Nov 30 22:53:06 2022 +0100

tdf#104597 related: restore the mirroring of Bidi_Mirrored characters

The method PDFIProcessor::mirrorString() was removed, and
::comphelper::string::reverseString was used, by Kevin Suo in commit
69e9925ded584113e52f84ef0ed7c224079fa061.

The old PDFIProcessor::mirrorString() did two things:
1) Reverse the code points in the string. However, due to its use of 
iterateCodePoints()
rather than iterateCodePoints(, -1) (i.e. iterating in forward rather 
than reversed order),
the reverse was not functioning at all.
2) Use GetMirroredChar (i.e. the icu unicode u_charMirror() which was 
dropped in
commit 720a093461aadff044ac0b1b7b45cf3d416b3785) to get the mirrored-image 
of
characters with the Bidi_Mirrored properties.

Stephan Bergmann restored the #1 in commit 
50d73574b6c3d71f9a539c895a15d6fcda22390b
(by introducing comphelper::string::reverseCodePoints). However, the #2 was 
not restored.

I do not see a clear reason to drop #2 (at least this is an area I don't 
quite familiar
with), so it's better to restore it as well, in *this* commit, named as 
SubstituteBidiMirrored.

Conflicts:
i18nutil/source/utility/unicode.cxx
sdext/source/pdfimport/inc/pdfiprocessor.hxx

Change-Id: Ic263097938310e6e04f3b95bb12e4f4e834198f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143041
Tested-by: Jenkins
Reviewed-by: Kevin Suo 
(cherry picked from commit e788317bb58f4e4ad3bf57ee7b0e995cb4407ede)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143492
Reviewed-by: Stephan Bergmann 

diff --git a/i18nutil/source/utility/unicode.cxx 
b/i18nutil/source/utility/unicode.cxx
index 5e479989eae9..550f9e71b92f 100644
--- a/i18nutil/source/utility/unicode.cxx
+++ b/i18nutil/source/utility/unicode.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "unicode_data.h"
 #include 
@@ -96,6 +97,11 @@ unicode::getUnicodeDirection( const sal_Unicode ch ) {
 return r;
 }
 
+sal_uInt32 unicode::GetMirroredChar(sal_uInt32 nChar) {
+nChar = u_charMirror(nChar);
+return nChar;
+}
+
 #define bit(name)   (1U << name)
 
 #define UPPERMASK   bit(UnicodeType::UPPERCASE_LETTER)
diff --git a/include/i18nutil/unicode.hxx b/include/i18nutil/unicode.hxx
index 0ca14290981e..c14d22cecb66 100644
--- a/include/i18nutil/unicode.hxx
+++ b/include/i18nutil/unicode.hxx
@@ -43,6 +43,7 @@ public:
 static sal_Unicode getUnicodeScriptStart(css::i18n::UnicodeScript type);
 static sal_Unicode getUnicodeScriptEnd(css::i18n::UnicodeScript type);
 static sal_uInt8 getUnicodeDirection(const sal_Unicode ch);
+static sal_uInt32 GetMirroredChar(sal_uInt32);
 static bool isControl(const sal_Unicode ch);
 static bool isAlpha(const sal_Unicode ch);
 static bool isSpace(const sal_Unicode ch);
diff --git a/sdext/CppunitTest_sdext_pdfimport.mk 
b/sdext/CppunitTest_sdext_pdfimport.mk
index b2676d32002b..ee24b9aedde7 100644
--- a/sdext/CppunitTest_sdext_pdfimport.mk
+++ b/sdext/CppunitTest_sdext_pdfimport.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sdext_pdfimport,\
 unotest \
 tl \
 xo \
+i18nutil \
 ))
 
 $(eval $(call gb_CppunitTest_use_library_objects,sdext_pdfimport,pdfimport))
diff --git a/sdext/Executable_pdf2xml.mk b/sdext/Executable_pdf2xml.mk
index b2439164a1ed..81e00eca11c0 100644
--- a/sdext/Executable_pdf2xml.mk
+++ b/sdext/Executable_pdf2xml.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_Executable_use_libraries,pdf2xml,\
 sal \
 tl \
 xo \
+i18nutil \
 ))
 
 $(eval $(call gb_Executable_use_library_objects,pdf2xml,pdfimport))
diff --git a/sdext/Executable_pdfunzip.mk b/sdext/Executable_pdfunzip.mk
index 1fcca8a863d7..10c179336048 100644
--- a/sdext/Executable_pdfunzip.mk
+++ b/sdext/Executable_pdfunzip.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_Executable_use_libraries,pdfunzip,\
 vcl \
 tl \
 xo \
+i18nutil \
 ))
 
 $(eval $(call gb_Executable_use_library_objects,pdfunzip,pdfimport))
diff --git a/sdext/Library_pdfimport.mk 

[Libreoffice-commits] core.git: i18nutil/source include/i18nutil sdext/CppunitTest_sdext_pdfimport.mk sdext/Executable_pdf2xml.mk sdext/Executable_pdfunzip.mk sdext/Library_pdfimport.mk sdext/source

2022-11-30 Thread Kevin Suo (via logerrit)
 i18nutil/source/utility/unicode.cxx|5 +
 include/i18nutil/unicode.hxx   |1 +
 sdext/CppunitTest_sdext_pdfimport.mk   |1 +
 sdext/Executable_pdf2xml.mk|1 +
 sdext/Executable_pdfunzip.mk   |1 +
 sdext/Library_pdfimport.mk |2 ++
 sdext/source/pdfimport/inc/pdfiprocessor.hxx   |2 ++
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |5 +
 sdext/source/pdfimport/tree/pdfiprocessor.cxx  |   17 -
 sdext/source/pdfimport/tree/writertreevisiting.cxx |5 +
 10 files changed, 39 insertions(+), 1 deletion(-)

New commits:
commit e788317bb58f4e4ad3bf57ee7b0e995cb4407ede
Author: Kevin Suo 
AuthorDate: Mon Nov 21 23:32:53 2022 +0800
Commit: Kevin Suo 
CommitDate: Wed Nov 30 13:40:24 2022 +0100

tdf#104597 related: restore the mirroring of Bidi_Mirrored characters

The method PDFIProcessor::mirrorString() was removed, and
::comphelper::string::reverseString was used, by Kevin Suo in commit
69e9925ded584113e52f84ef0ed7c224079fa061.

The old PDFIProcessor::mirrorString() did two things:
1) Reverse the code points in the string. However, due to its use of 
iterateCodePoints()
rather than iterateCodePoints(, -1) (i.e. iterating in forward rather 
than reversed order),
the reverse was not functioning at all.
2) Use GetMirroredChar (i.e. the icu unicode u_charMirror() which was 
dropped in
commit 720a093461aadff044ac0b1b7b45cf3d416b3785) to get the mirrored-image 
of
characters with the Bidi_Mirrored properties.

Stephan Bergmann restored the #1 in commit 
50d73574b6c3d71f9a539c895a15d6fcda22390b
(by introducing comphelper::string::reverseCodePoints). However, the #2 was 
not restored.

I do not see a clear reason to drop #2 (at least this is an area I don't 
quite familiar
with), so it's better to restore it as well, in *this* commit, named as 
SubstituteBidiMirrored.

Change-Id: Ic263097938310e6e04f3b95bb12e4f4e834198f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143041
Tested-by: Jenkins
Reviewed-by: Kevin Suo 

diff --git a/i18nutil/source/utility/unicode.cxx 
b/i18nutil/source/utility/unicode.cxx
index 6e002aa69f18..730b5105d52c 100644
--- a/i18nutil/source/utility/unicode.cxx
+++ b/i18nutil/source/utility/unicode.cxx
@@ -97,6 +97,11 @@ unicode::getUnicodeDirection( const sal_Unicode ch ) {
 return r;
 }
 
+sal_uInt32 unicode::GetMirroredChar(sal_uInt32 nChar) {
+nChar = u_charMirror(nChar);
+return nChar;
+}
+
 #define bit(name)   (1U << name)
 
 #define UPPERMASK   bit(UnicodeType::UPPERCASE_LETTER)
diff --git a/include/i18nutil/unicode.hxx b/include/i18nutil/unicode.hxx
index ebe50ce90384..4d8a84b19c40 100644
--- a/include/i18nutil/unicode.hxx
+++ b/include/i18nutil/unicode.hxx
@@ -43,6 +43,7 @@ public:
 static sal_Unicode getUnicodeScriptStart(css::i18n::UnicodeScript type);
 static sal_Unicode getUnicodeScriptEnd(css::i18n::UnicodeScript type);
 static sal_uInt8 getUnicodeDirection(const sal_Unicode ch);
+static sal_uInt32 GetMirroredChar(sal_uInt32);
 static bool isControl(const sal_Unicode ch);
 static bool isAlpha(const sal_Unicode ch);
 static bool isSpace(const sal_Unicode ch);
diff --git a/sdext/CppunitTest_sdext_pdfimport.mk 
b/sdext/CppunitTest_sdext_pdfimport.mk
index 864fb7084c88..a16e1726bae9 100644
--- a/sdext/CppunitTest_sdext_pdfimport.mk
+++ b/sdext/CppunitTest_sdext_pdfimport.mk
@@ -34,6 +34,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sdext_pdfimport,\
 unotest \
 tl \
 xo \
+i18nutil \
 ))
 
 $(eval $(call gb_CppunitTest_use_library_objects,sdext_pdfimport,pdfimport))
diff --git a/sdext/Executable_pdf2xml.mk b/sdext/Executable_pdf2xml.mk
index b2439164a1ed..81e00eca11c0 100644
--- a/sdext/Executable_pdf2xml.mk
+++ b/sdext/Executable_pdf2xml.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_Executable_use_libraries,pdf2xml,\
 sal \
 tl \
 xo \
+i18nutil \
 ))
 
 $(eval $(call gb_Executable_use_library_objects,pdf2xml,pdfimport))
diff --git a/sdext/Executable_pdfunzip.mk b/sdext/Executable_pdfunzip.mk
index 1fcca8a863d7..10c179336048 100644
--- a/sdext/Executable_pdfunzip.mk
+++ b/sdext/Executable_pdfunzip.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_Executable_use_libraries,pdfunzip,\
 vcl \
 tl \
 xo \
+i18nutil \
 ))
 
 $(eval $(call gb_Executable_use_library_objects,pdfunzip,pdfimport))
diff --git a/sdext/Library_pdfimport.mk b/sdext/Library_pdfimport.mk
index b68c106268ae..dc1290cd0eb1 100644
--- a/sdext/Library_pdfimport.mk
+++ b/sdext/Library_pdfimport.mk
@@ -29,10 +29,12 @@ $(eval $(call gb_Library_use_libraries,pdfimport,\
 sal \
 tl \
 xo \
+i18nutil \
 ))
 
 $(eval $(call gb_Library_use_externals,pdfimport,\
boost_headers \
+icu_headers \
 zlib \
 $(if $(filter-out WNT 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sdext/source

2022-11-25 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/tests.cxx|   11 ++---
 sdext/source/pdfimport/tree/drawtreevisiting.cxx |   46 ++-
 2 files changed, 49 insertions(+), 8 deletions(-)

New commits:
commit 9c29107a2590e8ccc92e6ae6445beff186f38511
Author: Kevin Suo 
AuthorDate: Sun Nov 20 00:10:14 2022 +0800
Commit: Xisco Fauli 
CommitDate: Fri Nov 25 17:48:35 2022 +0100

Resolves tdf#152083: Ligatures are incorrectly reversed in Draw pdf import

For the string "بسم الله الرحمن الرحیم", the xpdfimport generates the 
following drawChar tokens:
drawChar 438.50 723.30 446.744000 723.30 1.00 0.00 
0.00 1.00 12.00 م
drawChar 446.696000 723.30 450.908000 723.30 1.00 0.00 
0.00 1.00 12.00 ی
drawChar 450.896000 723.30 458.804000 723.30 1.00 0.00 
0.00 1.00 12.00 ح
drawChar 458.792000 723.30 463.784000 723.30 1.00 0.00 
0.00 1.00 12.00 ر
drawChar 463.688000 723.30 467.048000 723.30 1.00 0.00 
0.00 1.00 12.00 ل
drawChar 467.072000 723.30 469.964000 723.30 1.00 0.00 
0.00 1.00 12.00 ا
drawChar 469.964000 723.30 473.708000 723.30 1.00 0.00 
0.00 1.00 12.00
drawChar 473.756000 723.30 482.78 723.30 1.00 0.00 
0.00 1.00 12.00 ن
drawChar 482.756000 723.30 490.028000 723.30 1.00 0.00 
0.00 1.00 12.00 م
drawChar 490.04 723.30 497.948000 723.30 1.00 0.00 
0.00 1.00 12.00 ح
drawChar 497.936000 723.30 502.928000 723.30 1.00 0.00 
0.00 1.00 12.00 ر
drawChar 502.928000 723.30 506.288000 723.30 1.00 0.00 
0.00 1.00 12.00 ل
drawChar 506.312000 723.30 509.204000 723.30 1.00 0.00 
0.00 1.00 12.00 ا
drawChar 509.108000 723.30 512.852000 723.30 1.00 0.00 
0.00 1.00 12.00
drawChar 512.90 723.30 527.216000 723.30 1.00 0.00 
0.00 1.00 12.00 الله
drawChar 527.204000 723.30 530.948000 723.30 1.00 0.00 
0.00 1.00 12.00
drawChar 530.996000 723.30 539.24 723.30 1.00 0.00 
0.00 1.00 12.00 م
drawChar 539.288000 723.30 552.02 723.30 1.00 0.00 
0.00 1.00 12.00 س
drawChar 551.888000 723.30 555.236000 723.30 1.00 0.00 
0.00 1.00 12.00 ب

Previously, all the above are combined to a single text frame in 
DrawXmlOptimizer::optimizeTextElements,
and then the text in the text frame is reversed (commit 
69e9925ded584113e52f84ef0ed7c224079fa061, and
further improved by commit 50d73574b6c3d71f9a539c895a15d6fcda22390b).

The problem is that, the single token "الله" was already in correct order. 
Thus when it is reversed
together with others, the order for itself would be wrong. Fix this by 
doing a pre-reverse.

The space char needs special treatment, as observed in 
tdf104597_textrun.pdf.

Change-Id: If0bd716cc2d68820436d0e3f0f161ffb9cb4397a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142978
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143280

diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 0c56014684d0..b569a1443869 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -798,15 +798,14 @@ namespace
 // Test for امُ عَلَيْكَ
 OString xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 14821.958333 
2159.23861112778)']/draw:text-box/text:p/text:span)";
 OUString sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"اُم 
َعَلْيَك"), sContent.replaceAll("\n\n", " ").replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"امُ 
عَلَيَْك"), sContent.replaceAll("\n\n", " ").replaceAll("\n", ""));
 
-// Test for ٱلسََّل . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
+// Test for ٱلسََّل . It appears in the 3rd frame, i.e. after the 
امُ عَلَيَْك which is in the 2nd frame (from left to right)
 // thus these two frames together appear as ٱلسََّل امُ عَلَيْكَ 
in Draw‬.
 // FIXME: Should be ٱلسَّلَامُ عَلَيْكَ (i.e. the two text frames 
should be merged into one so that the ل and the ا will show as لَا rather than 
ل ا)
-// Note: this is commented due to ٱلسََّل is currently shown as 
ٱلَّسَل and will be fixed in a separate commit.
-//xpath = 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sdext/source

2022-11-25 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/tests.cxx |   54 +-
 1 file changed, 28 insertions(+), 26 deletions(-)

New commits:
commit 0ea0c32b0405d0c082b4a96004b18d80c2f885ac
Author: Kevin Suo 
AuthorDate: Sat Nov 19 19:01:04 2022 +0800
Commit: Xisco Fauli 
CommitDate: Fri Nov 25 11:41:47 2022 +0100

sdext.pdfimport: Use string() in xpath for testTdf104597_textrun

...and remove the TODO comments.

Also, comment out the test for string ٱلسََّل which is related to 
tdf#152083 and will be fixed in a separate commit.

Change-Id: I075145be1ff58c16e976c710fbf8f55fc6752af1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142962
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143279

diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index eb1940361436..0c56014684d0 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -796,28 +796,33 @@ namespace
 xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
 
 // Test for امُ عَلَيْكَ
-// TODO: How to get the "عَلَيْكَ" in xpath, as shown after the 
 tag?
-OString xpath = 
"//draw:frame[@draw:transform='matrix(917. 0 0 917. 
14821.958333 2159.23861112778)']/draw:text-box/text:p/text:span";
-OUString sContent = getXPathContent(pXmlDoc, xpath); // 
u"\nا\nُ\nم\n"
-CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"اُم"), 
sContent.replaceAll("\n", ""));
-
-// Test for ٱلَّسَل‬ . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
-// thus these two frames together appear as ٱلَّسَل امُ عَلَيْكَ 
in Draw‬.
-xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 17420.17 
2159.23861112778)']/draw:text-box/text:p/text:span";
+OString xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 14821.958333 
2159.23861112778)']/draw:text-box/text:p/text:span)";
+OUString sContent = getXPathContent(pXmlDoc, xpath);
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"اُم 
َعَلْيَك"), sContent.replaceAll("\n\n", " ").replaceAll("\n", ""));
+
+// Test for ٱلسََّل . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
+// thus these two frames together appear as ٱلسََّل امُ عَلَيْكَ 
in Draw‬.
+// FIXME: Should be ٱلسَّلَامُ عَلَيْكَ (i.e. the two text frames 
should be merged into one so that the ل and the ا will show as لَا rather than 
ل ا)
+// Note: this is commented due to ٱلسََّل is currently shown as 
ٱلَّسَل and will be fixed in a separate commit.
+//xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 17420.17 
2159.23861112778)']/draw:text-box/text:p/text:span)";
+//sContent = getXPathContent(pXmlDoc, xpath);
+//CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"ٱلسََّل"), sContent.replaceAll("\n\n", " ").replaceAll("\n", ""));
+
+// Test for "LibreOffice RTL"
+xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 12779.375 5121.79583335)']/draw:text-box/text:p/text:span)";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"ٱلَّسَل"), sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"LibreOffice RTL"), sContent.replaceAll("\n\n", " ").replaceAll("\n", 
""));
 
-// Test for "LibreOffice LTR"
-// TODO: How to get the "LTR" as shown after the  tag?
-xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 12779.375 5121.79583335)']/draw:text-box/text:p/text:span";
+// Test for "LibreOffice LTR (test)"
+xpath = 
"string(//draw:frame[last()-1]/draw:text-box/text:p/text:span[last()])";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"LibreOffice"), sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"LibreOffice LTR (test)"), sContent.replaceAll("\n\n", " 
").replaceAll("\n", ""));
 
 /* Test for Chinese characters */
 // Use last() instead of matrix below, because the matrix may be 
different on different OS due to fallback of Chinese fonts.
-xpath = "//draw:frame[last()]/draw:text-box/text:p/text:span";
+xpath = 

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

2022-11-24 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/tests.cxx|   11 ++---
 sdext/source/pdfimport/tree/drawtreevisiting.cxx |   46 ++-
 2 files changed, 49 insertions(+), 8 deletions(-)

New commits:
commit 3a2f0e4772e7b4646dd518b33aeafb6fd7025179
Author: Kevin Suo 
AuthorDate: Sun Nov 20 00:10:14 2022 +0800
Commit: Noel Grandin 
CommitDate: Fri Nov 25 08:44:02 2022 +0100

Resolves tdf#152083: Ligatures are incorrectly reversed in Draw pdf import

For the string "بسم الله الرحمن الرحیم", the xpdfimport generates the 
following drawChar tokens:
drawChar 438.50 723.30 446.744000 723.30 1.00 0.00 
0.00 1.00 12.00 م
drawChar 446.696000 723.30 450.908000 723.30 1.00 0.00 
0.00 1.00 12.00 ی
drawChar 450.896000 723.30 458.804000 723.30 1.00 0.00 
0.00 1.00 12.00 ح
drawChar 458.792000 723.30 463.784000 723.30 1.00 0.00 
0.00 1.00 12.00 ر
drawChar 463.688000 723.30 467.048000 723.30 1.00 0.00 
0.00 1.00 12.00 ل
drawChar 467.072000 723.30 469.964000 723.30 1.00 0.00 
0.00 1.00 12.00 ا
drawChar 469.964000 723.30 473.708000 723.30 1.00 0.00 
0.00 1.00 12.00
drawChar 473.756000 723.30 482.78 723.30 1.00 0.00 
0.00 1.00 12.00 ن
drawChar 482.756000 723.30 490.028000 723.30 1.00 0.00 
0.00 1.00 12.00 م
drawChar 490.04 723.30 497.948000 723.30 1.00 0.00 
0.00 1.00 12.00 ح
drawChar 497.936000 723.30 502.928000 723.30 1.00 0.00 
0.00 1.00 12.00 ر
drawChar 502.928000 723.30 506.288000 723.30 1.00 0.00 
0.00 1.00 12.00 ل
drawChar 506.312000 723.30 509.204000 723.30 1.00 0.00 
0.00 1.00 12.00 ا
drawChar 509.108000 723.30 512.852000 723.30 1.00 0.00 
0.00 1.00 12.00
drawChar 512.90 723.30 527.216000 723.30 1.00 0.00 
0.00 1.00 12.00 الله
drawChar 527.204000 723.30 530.948000 723.30 1.00 0.00 
0.00 1.00 12.00
drawChar 530.996000 723.30 539.24 723.30 1.00 0.00 
0.00 1.00 12.00 م
drawChar 539.288000 723.30 552.02 723.30 1.00 0.00 
0.00 1.00 12.00 س
drawChar 551.888000 723.30 555.236000 723.30 1.00 0.00 
0.00 1.00 12.00 ب

Previously, all the above are combined to a single text frame in 
DrawXmlOptimizer::optimizeTextElements,
and then the text in the text frame is reversed (commit 
69e9925ded584113e52f84ef0ed7c224079fa061, and
further improved by commit 50d73574b6c3d71f9a539c895a15d6fcda22390b).

The problem is that, the single token "الله" was already in correct order. 
Thus when it is reversed
together with others, the order for itself would be wrong. Fix this by 
doing a pre-reverse.

The space char needs special treatment, as observed in 
tdf104597_textrun.pdf.

Change-Id: If0bd716cc2d68820436d0e3f0f161ffb9cb4397a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142978
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index c199c2cc4547..7c10c85b29a5 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -798,15 +798,14 @@ namespace
 // Test for امُ عَلَيْكَ
 OString xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 14821.958333 
2159.23861112778)']/draw:text-box/text:p/text:span)";
 OUString sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"اُم 
َعَلْيَك"), sContent.replaceAll("\n\n", " ").replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"امُ 
عَلَيَْك"), sContent.replaceAll("\n\n", " ").replaceAll("\n", ""));
 
-// Test for ٱلسََّل . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
+// Test for ٱلسََّل . It appears in the 3rd frame, i.e. after the 
امُ عَلَيَْك which is in the 2nd frame (from left to right)
 // thus these two frames together appear as ٱلسََّل امُ عَلَيْكَ 
in Draw‬.
 // FIXME: Should be ٱلسَّلَامُ عَلَيْكَ (i.e. the two text frames 
should be merged into one so that the ل and the ا will show as لَا rather than 
ل ا)
-// Note: this is commented due to ٱلسََّل is currently shown as 
ٱلَّسَل and will be fixed in a separate commit.
-//xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 17420.17 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sdext/source

2022-11-24 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/testdocs/testSpace.pdf |binary
 sdext/source/pdfimport/test/tests.cxx  |   38 +
 sdext/source/pdfimport/tree/writertreevisiting.cxx |   28 +--
 3 files changed, 63 insertions(+), 3 deletions(-)

New commits:
commit 4b7fa212b438f6e89196fbdd5d58c38862a35d7d
Author: Kevin Suo 
AuthorDate: Wed Oct 19 19:08:27 2022 +0800
Commit: Kevin Suo 
CommitDate: Thu Nov 24 17:05:16 2022 +0100

sdext.pdfimport - Wirter: add handling for continuous space characters

This was done for Draw in sdext/source/pdfimport/tree/drawtreevisiting.cxx,
but was not done for Writer. Without this, continuous spaces in PDF will
show only one space on pdfimport using the Writer pdfimport filter.

Change-Id: I2279d9b1750e07f5743aeba80a3fd553bc037d13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141527
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit c2e2997f452b93b400d541c2d0b2ee396a889007)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142312
Reviewed-by: Kevin Suo 

diff --git a/sdext/source/pdfimport/test/testdocs/testSpace.pdf 
b/sdext/source/pdfimport/test/testdocs/testSpace.pdf
new file mode 100644
index ..3c94f31ea15b
Binary files /dev/null and b/sdext/source/pdfimport/test/testdocs/testSpace.pdf 
differ
diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index fe2f659aeb7f..eb1940361436 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -841,6 +841,43 @@ namespace
 #endif
 }
 
+void testSpaces()
+{
+#if HAVE_FEATURE_POPPLER
+rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
+xAdaptor->setTreeVisitorFactory(createWriterTreeVisitorFactory());
+
+OString aOutput;
+
xAdaptor->odfConvert(m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/testSpace.pdf"),
+new OutputWrapString(aOutput),
+nullptr);
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
+
+// Space test: there are 10 spaces, each space is expressed as a 
,
+// thus the 10th text:s should exist and the attribute "text:c" 
should be "1".
+OString xpath = 
"//draw:frame[@draw:z-index='1'][1]/draw:text-box/text:p/text:span/text:s[10]";
+OUString  sContent = getXPath(pXmlDoc, xpath, "c");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString("1"), 
sContent);
+
+// Tab test: there are 10 tabs. Text before and after the tabs are 
shown in different draw frames.
+// With the Liberation Serif font, the horizontal position of the 
first frame is 20.03mm and the
+// second frame is 94.12mm.
+xpath = "//draw:frame[@draw:z-index='2'][1]";
+sContent = getXPath(pXmlDoc, xpath, "transform");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString("translate( 20.03mm 25.05mm )"), sContent);
+xpath = "//draw:frame[@draw:z-index='3'][1]";
+sContent = getXPath(pXmlDoc, xpath, "transform");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString("translate( 94.12mm 25.05mm )"), sContent);
+
+// Non-breaking space test: there are 10 NBSpaces, which are 
treated as the same as normal space in PDF,
+// thus each is expressed as a .
+// The 10th text:s should exist and the attribute "text:c" should 
be "1".
+xpath = 
"//draw:frame[@draw:z-index='4'][1]/draw:text-box/text:p/text:span/text:s[10]";
+sContent = getXPath(pXmlDoc, xpath, "c");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString("1"), 
sContent);
+#endif
+}
+
 CPPUNIT_TEST_SUITE(PDFITest);
 CPPUNIT_TEST(testXPDFParser);
 CPPUNIT_TEST(testOdfWriterExport);
@@ -853,6 +890,7 @@ namespace
 CPPUNIT_TEST(testTdf78427_FontWeight_MyraidProSemibold);
 CPPUNIT_TEST(testTdf143959_nameFromFontFile);
 CPPUNIT_TEST(testTdf104597_textrun);
+CPPUNIT_TEST(testSpaces);
 CPPUNIT_TEST_SUITE_END();
 };
 
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index d3ea6cc05320..060990f003b9 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -81,7 +81,11 @@ void WriterXmlEmitter::visit( TextElement& elem, const 
std::list< std::unique_pt
 if( elem.Text.isEmpty() )
 return;
 
-PropertyMap aProps;
+PropertyMap aProps = {};
+const sal_Unicode strSpace = 0x0020;
+const sal_Unicode strNbSpace = 0x00A0;
+const sal_Unicode tabSpace = 0x0009;
+
 if( elem.StyleId != -1 )
 {
 aProps[ OUString( 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sdext/source

2022-11-24 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/writertreevisiting.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 588e59cc36475ded243ce4fd9062473cddd2c016
Author: Kevin Suo 
AuthorDate: Sun Oct 23 19:10:29 2022 +0800
Commit: Kevin Suo 
CommitDate: Thu Nov 24 17:04:06 2022 +0100

sdext.pdfimport Writer: Do not visit DrawElement twice in WriterXmlEmitter

Discovered when working on commit f6004e1c457ddab5e0c91e6159875d25130b108a.

To reproduce, you can print the content of aOutput2 above the line:

https://opengrok.libreoffice.org/xref/core/sdext/source/pdfimport/test/tests.cxx?r=f6004e1c#836,
and then you get the xml content as shown in:
https://bugs.documentfoundation.org/attachment.cgi?id=183217,
in which you can see that there are duplicated draw:frame(s) with identical 
draw:z-index.

To dig into the problem, you may take a look at the following code block:

1for( const auto& rxChild : elem.Children )
2{
3PageElement* pPage = dynamic_cast(rxChild.get());
4if( pPage )
5{
6for( auto child_it = pPage->Children.begin(); child_it != 
pPage->Children.end(); ++child_it )
7{
8if( dynamic_cast(child_it->get()) != nullptr 
)
9(*child_it)->visitedBy( *this, child_it );
10   }
11   }
12   }
13
14   for( auto it = elem.Children.begin(); it != elem.Children.end(); ++it )
15   {
16   if( dynamic_cast(it->get()) != nullptr )
17   (*it)->visitedBy( *this, it );
18   }

In the for loop in lines 1:12:
* "elem" is a "DocumentElement" which is derived from "Element". It's 
childen are PageElement(s).
* "pPage" is a "PageElement" which is also derived from "Element". It's 
childen are DrawElement(s).
* "child_it", as in the for loop in lines 6:10, is a "DrawElement" which is 
derived from
"GraphicalElement", whereas "GraphicalElement" is derived from "Element".
In this block, the code goes through each of the pages and visit the 
DrawElements there.

The code in lines 14:18 seems to assume that, a DrawElement, in addition to 
be a child of
PageElement, may also be a child of DocumentElement. See the comment in 
souce code.
Yes, it may be. For such DrawElement(s), the visiting is done in lines 
14:18 separately.

Note that The above code uses dynamic_cast to determine whether a node is a 
DrawElement or not.

The problem is that, in determining whether the node during the 2nd 
visiting is a DrawElement,
it accidently used "== nullptr". This may be an inadvertent error. If the 
dynamic_cast is a nullprt,
then it is not a DrawElement and the visiting should not be done there.

Resolve this by using "!= nullptr" in the second dynamic_cast checking.

Change-Id: I066100e98039d505d8b10c390954e014b78cff4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141680
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit fc2fb95fdb4262792e94afe61b784c8ae71d171e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142313
Reviewed-by: Kevin Suo 

diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index af16cde5a599..d3ea6cc05320 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -382,7 +382,7 @@ void WriterXmlEmitter::visit( DocumentElement& elem, const 
std::list< std::uniqu
 // only DrawElement types
 for( auto it = elem.Children.begin(); it != elem.Children.end(); ++it )
 {
-if( dynamic_cast(it->get()) == nullptr )
+if( dynamic_cast(it->get()) != nullptr )
 (*it)->visitedBy( *this, it );
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sd/source

2022-11-22 Thread Kevin Suo (via logerrit)
 sd/source/core/stlsheet.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 349d682cb03cab54f06fa7a014884368df0e9fba
Author: Kevin Suo 
AuthorDate: Thu Nov 17 12:10:31 2022 +0800
Commit: Xisco Fauli 
CommitDate: Tue Nov 22 21:19:22 2022 +0100

tdf#138111: Fix apparent copy-paste error in ApiNameMap for sd style "A0"

As introduced in commit 99102d4263189d347c7a7d0df8fd782e8c4c8ad5.

Change-Id: Iece8595a401df7bd5a514244d4a4fc825a49f9de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142819
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 
(cherry picked from commit f078937179c4490df273b95cc8c29a216f9184ba)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143067
Reviewed-by: Xisco Fauli 

diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 619614e7a2a6..db061922ba9c 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -590,7 +590,7 @@ struct ApiNameMap
 { std::u16string_view(u"Title A4"), HID_POOLSHEET_A4_TITLE },
 { std::u16string_view(u"Heading A4"), HID_POOLSHEET_A4_HEADLINE },
 { std::u16string_view(u"Text A4"), HID_POOLSHEET_A4_TEXT },
-{ std::u16string_view(u"A4"), HID_POOLSHEET_A0 },
+{ std::u16string_view(u"A0"), HID_POOLSHEET_A0 },
 { std::u16string_view(u"Title A0"), HID_POOLSHEET_A0_TITLE },
 { std::u16string_view(u"Heading A0"), HID_POOLSHEET_A0_HEADLINE },
 { std::u16string_view(u"Text A0"), HID_POOLSHEET_A0_TEXT },


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

2022-11-22 Thread Kevin Suo (via logerrit)
 sd/source/core/stlsheet.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f078937179c4490df273b95cc8c29a216f9184ba
Author: Kevin Suo 
AuthorDate: Thu Nov 17 12:10:31 2022 +0800
Commit: Heiko Tietze 
CommitDate: Tue Nov 22 14:55:18 2022 +0100

tdf#138111: Fix apparent copy-paste error in ApiNameMap for sd style "A0"

As introduced in commit 99102d4263189d347c7a7d0df8fd782e8c4c8ad5.

Change-Id: Iece8595a401df7bd5a514244d4a4fc825a49f9de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142819
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 

diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 14a0b13dd15c..1c11e5fea39d 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -598,7 +598,7 @@ struct ApiNameMap
 { std::u16string_view(u"Title A4"), HID_POOLSHEET_A4_TITLE },
 { std::u16string_view(u"Heading A4"), HID_POOLSHEET_A4_HEADLINE },
 { std::u16string_view(u"Text A4"), HID_POOLSHEET_A4_TEXT },
-{ std::u16string_view(u"A4"), HID_POOLSHEET_A0 },
+{ std::u16string_view(u"A0"), HID_POOLSHEET_A0 },
 { std::u16string_view(u"Title A0"), HID_POOLSHEET_A0_TITLE },
 { std::u16string_view(u"Heading A0"), HID_POOLSHEET_A0_HEADLINE },
 { std::u16string_view(u"Text A0"), HID_POOLSHEET_A0_TEXT },


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

2022-11-20 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/testdocs/testTdf152083_rtl-ligatures.pdf |binary
 sdext/source/pdfimport/test/tests.cxx|   54 
+-
 2 files changed, 28 insertions(+), 26 deletions(-)

New commits:
commit bc48dbe08db537f41e42839a0493317298606413
Author: Kevin Suo 
AuthorDate: Sat Nov 19 19:01:04 2022 +0800
Commit: Noel Grandin 
CommitDate: Sun Nov 20 12:00:08 2022 +0100

sdext.pdfimport: Use string() in xpath for testTdf104597_textrun

...and remove the TODO comments.

Also, comment out the test for string ٱلسََّل which is related to 
tdf#152083 and will be fixed in a separate commit.

Change-Id: I075145be1ff58c16e976c710fbf8f55fc6752af1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142962
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git 
a/sdext/source/pdfimport/test/testdocs/testTdf152083_rtl-ligatures.pdf 
b/sdext/source/pdfimport/test/testdocs/testTdf152083_rtl-ligatures.pdf
new file mode 100644
index ..635004c2e302
Binary files /dev/null and 
b/sdext/source/pdfimport/test/testdocs/testTdf152083_rtl-ligatures.pdf differ
diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 786815941445..c199c2cc4547 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -796,28 +796,33 @@ namespace
 xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
 
 // Test for امُ عَلَيْكَ
-// TODO: How to get the "عَلَيْكَ" in xpath, as shown after the 
 tag?
-OString xpath = 
"//draw:frame[@draw:transform='matrix(917. 0 0 917. 
14821.958333 2159.23861112778)']/draw:text-box/text:p/text:span";
-OUString sContent = getXPathContent(pXmlDoc, xpath); // 
u"\nا\nُ\nم\n"
-CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"اُم"), 
sContent.replaceAll("\n", ""));
-
-// Test for ٱلَّسَل‬ . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
-// thus these two frames together appear as ٱلَّسَل امُ عَلَيْكَ 
in Draw‬.
-xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 17420.17 
2159.23861112778)']/draw:text-box/text:p/text:span";
+OString xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 14821.958333 
2159.23861112778)']/draw:text-box/text:p/text:span)";
+OUString sContent = getXPathContent(pXmlDoc, xpath);
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"اُم 
َعَلْيَك"), sContent.replaceAll("\n\n", " ").replaceAll("\n", ""));
+
+// Test for ٱلسََّل . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
+// thus these two frames together appear as ٱلسََّل امُ عَلَيْكَ 
in Draw‬.
+// FIXME: Should be ٱلسَّلَامُ عَلَيْكَ (i.e. the two text frames 
should be merged into one so that the ل and the ا will show as لَا rather than 
ل ا)
+// Note: this is commented due to ٱلسََّل is currently shown as 
ٱلَّسَل and will be fixed in a separate commit.
+//xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 17420.17 
2159.23861112778)']/draw:text-box/text:p/text:span)";
+//sContent = getXPathContent(pXmlDoc, xpath);
+//CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"ٱلسََّل"), sContent.replaceAll("\n\n", " ").replaceAll("\n", ""));
+
+// Test for "LibreOffice RTL"
+xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 12779.375 5121.79583335)']/draw:text-box/text:p/text:span)";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"ٱلَّسَل"), sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"LibreOffice RTL"), sContent.replaceAll("\n\n", " ").replaceAll("\n", 
""));
 
-// Test for "LibreOffice LTR"
-// TODO: How to get the "LTR" as shown after the  tag?
-xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 12779.375 5121.79583335)']/draw:text-box/text:p/text:span";
+// Test for "LibreOffice LTR (test)"
+xpath = 
"string(//draw:frame[last()-1]/draw:text-box/text:p/text:span[last()])";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"LibreOffice"), sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"LibreOffice LTR (test)"), sContent.replaceAll("\n\n", " 
").replaceAll("\n", ""));
 
 /* Test for 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-16 Thread Kevin Suo (via logerrit)
 sw/source/ui/misc/pggrid.cxx |   52 ---
 1 file changed, 39 insertions(+), 13 deletions(-)

New commits:
commit b9534138d604a30e9c73d0819a0dacee0b3178b9
Author: Kevin Suo 
AuthorDate: Thu Nov 10 16:07:41 2022 +0800
Commit: Caolán McNamara 
CommitDate: Wed Nov 16 20:34:41 2022 +0100

tdf#151988: Enable "Characters per line" and "Character width" when 
switch...

... back to grid type "lines and characters".

Also enable "Snap to characters" for grid type "lines and characters" and 
disbale it
for grid types "lines only" and "no grid".

Change-Id: I101c8d80a79798fc6c992da766c658c3ba8802dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142513
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit f4fbd3ca939fbf70eee110e4c601a5e7eeade714)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142621
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 263009f26290..18f66cc08c1a 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -468,20 +468,43 @@ IMPL_LINK(SwTextGridPage, GridTypeHdl, weld::Toggleable&, 
rButton, void)
 if (!rButton.get_active())
 return;
 
-const bool bNoGrid = m_xNoGridRB.get() == 
-m_xLayoutFL->set_sensitive(!bNoGrid);
-m_xDisplayFL->set_sensitive(!bNoGrid);
-
-//one special case
-if (!bNoGrid)
+if (m_xNoGridRB.get() == )
+{
+// GRID_NONE mode:
+//   "Layout" and "Display" sections should all be disabled.
+m_xLayoutFL->set_sensitive(false);
+m_xDisplayFL->set_sensitive(false);
+}
+else
+{
+// GRID_LINES_ONLY or GRID_LINES_CHARS mode:
+//   "Layout" and "Display" sections should all be enabled;
+//   DisplayGridHdl should be executed;
+m_xLayoutFL->set_sensitive(true);
+m_xDisplayFL->set_sensitive(true);
 DisplayGridHdl(*m_xDisplayCB);
+}
 
-bool bEnable = m_xCharsGridRB.get() == 
-m_xSnapToCharsCB->set_sensitive(bEnable);
-
-bEnable = m_xLinesGridRB.get() == 
-if (bEnable && !m_bSquaredMode)
+if (m_xCharsGridRB.get() == )
+{
+// GRID_LINES_CHARS mode:
+//   "Snap to character" should be enabled;
+//   "Characters per line" should be enabled;
+//   "Characters range" should be enabled;
+m_xSnapToCharsCB->set_sensitive(true);
+m_xCharsPerLineFT->set_sensitive(true);
+m_xCharsPerLineNF->set_sensitive(true);
+m_xCharsRangeFT->set_sensitive(true);
+m_xCharWidthFT->set_sensitive(true);
+m_xCharWidthMF->set_sensitive(true);
+}
+else
 {
+// GRID_NONE or GRID_LINES_ONLY mode:
+//   "Snap to character" should be disabled;
+//   "Characters per line" should be disabled;
+//   "Characters range" should be disabled;
+m_xSnapToCharsCB->set_sensitive(false);
 m_xCharsPerLineFT->set_sensitive(false);
 m_xCharsPerLineNF->set_sensitive(false);
 m_xCharsRangeFT->set_sensitive(false);
@@ -489,9 +512,12 @@ IMPL_LINK(SwTextGridPage, GridTypeHdl, weld::Toggleable&, 
rButton, void)
 m_xCharWidthMF->set_sensitive(false);
 }
 
-//recalc which dependencies are sensitive
-if (!bNoGrid)
+if (m_xNoGridRB.get() != )
+{
+// GRID_LINES_ONLY or GRID_LINES_CHARS mode: (additionally)
+//   TextSizeChangedHdl should be executed to recalculate which 
dependencies are sensitive.
 TextSizeChangedHdl(*m_xTextSizeMF);
+}
 
 GridModifyHdl();
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-12 Thread Kevin Suo (via logerrit)
 sw/source/ui/misc/pggrid.cxx |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit ea8a74ae6881f5ecacc6743b18c03ce3e759779a
Author: Kevin Suo 
AuthorDate: Thu Nov 10 10:19:08 2022 +0800
Commit: Caolán McNamara 
CommitDate: Sat Nov 12 12:04:49 2022 +0100

tdf#151979: fix crash in Text Grid dialog when switching active view

GetActiveView() may return a nullptr when previously we are in Calc
window and then click the controls on the writer dialog.

Change-Id: Ia4dcd58b19c40a3e6cd0a791b7645d5fd2dcb9f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142508
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins
(cherry picked from commit 9b80b2d6140d1aad240f10755105e49d678b98f1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142529
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index f849f6dcc48a..263009f26290 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -152,10 +152,13 @@ bool SwTextGridPage::FillItemSet(SfxItemSet *rSet)
 
 // draw ticks of ruler
 SwView * pView = ::GetActiveView();
-if ( m_bHRulerChanged )
-pView->GetHRuler().DrawTicks();
-if ( m_bVRulerChanged )
-pView->GetVRuler().DrawTicks();
+if (pView)
+{
+if ( m_bHRulerChanged )
+pView->GetHRuler().DrawTicks();
+if ( m_bVRulerChanged )
+pView->GetVRuler().DrawTicks();
+}
 return bRet;
 }
 
@@ -247,7 +250,7 @@ void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
 rSet.Put(aGridItem);
 
 SwView * pView = ::GetActiveView();
-if ( aGridItem.GetGridType() != GRID_NONE )
+if (pView && aGridItem.GetGridType() != GRID_NONE)
 {
 if ( aGridItem.GetGridType() == GRID_LINES_CHARS )
 {


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

2022-11-11 Thread Kevin Suo (via logerrit)
 sw/source/ui/misc/pggrid.cxx |   52 ---
 1 file changed, 39 insertions(+), 13 deletions(-)

New commits:
commit 1bfb323801b9c88879b5948b16d47cdbbee87ab9
Author: Kevin Suo 
AuthorDate: Thu Nov 10 16:07:41 2022 +0800
Commit: Mike Kaganski 
CommitDate: Sat Nov 12 06:06:32 2022 +0100

tdf#151988: Enable "Characters per line" and "Character width" when 
switch...

... back to grid type "lines and characters".

Also enable "Snap to characters" for grid type "lines and characters" and 
disbale it
for grid types "lines only" and "no grid".

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

diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 2e9f99e9d538..4d26eead12d9 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -468,20 +468,43 @@ IMPL_LINK(SwTextGridPage, GridTypeHdl, weld::Toggleable&, 
rButton, void)
 if (!rButton.get_active())
 return;
 
-const bool bNoGrid = m_xNoGridRB.get() == 
-m_xLayoutFL->set_sensitive(!bNoGrid);
-m_xDisplayFL->set_sensitive(!bNoGrid);
-
-//one special case
-if (!bNoGrid)
+if (m_xNoGridRB.get() == )
+{
+// GRID_NONE mode:
+//   "Layout" and "Display" sections should all be disabled.
+m_xLayoutFL->set_sensitive(false);
+m_xDisplayFL->set_sensitive(false);
+}
+else
+{
+// GRID_LINES_ONLY or GRID_LINES_CHARS mode:
+//   "Layout" and "Display" sections should all be enabled;
+//   DisplayGridHdl should be executed;
+m_xLayoutFL->set_sensitive(true);
+m_xDisplayFL->set_sensitive(true);
 DisplayGridHdl(*m_xDisplayCB);
+}
 
-bool bEnable = m_xCharsGridRB.get() == 
-m_xSnapToCharsCB->set_sensitive(bEnable);
-
-bEnable = m_xLinesGridRB.get() == 
-if (bEnable && !m_bSquaredMode)
+if (m_xCharsGridRB.get() == )
+{
+// GRID_LINES_CHARS mode:
+//   "Snap to character" should be enabled;
+//   "Characters per line" should be enabled;
+//   "Characters range" should be enabled;
+m_xSnapToCharsCB->set_sensitive(true);
+m_xCharsPerLineFT->set_sensitive(true);
+m_xCharsPerLineNF->set_sensitive(true);
+m_xCharsRangeFT->set_sensitive(true);
+m_xCharWidthFT->set_sensitive(true);
+m_xCharWidthMF->set_sensitive(true);
+}
+else
 {
+// GRID_NONE or GRID_LINES_ONLY mode:
+//   "Snap to character" should be disabled;
+//   "Characters per line" should be disabled;
+//   "Characters range" should be disabled;
+m_xSnapToCharsCB->set_sensitive(false);
 m_xCharsPerLineFT->set_sensitive(false);
 m_xCharsPerLineNF->set_sensitive(false);
 m_xCharsRangeFT->set_sensitive(false);
@@ -489,9 +512,12 @@ IMPL_LINK(SwTextGridPage, GridTypeHdl, weld::Toggleable&, 
rButton, void)
 m_xCharWidthMF->set_sensitive(false);
 }
 
-//recalc which dependencies are sensitive
-if (!bNoGrid)
+if (m_xNoGridRB.get() != )
+{
+// GRID_LINES_ONLY or GRID_LINES_CHARS mode: (additionally)
+//   TextSizeChangedHdl should be executed to recalculate which 
dependencies are sensitive.
 TextSizeChangedHdl(*m_xTextSizeMF);
+}
 
 GridModifyHdl();
 }


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

2022-11-10 Thread Kevin Suo (via logerrit)
 sw/source/ui/misc/pggrid.cxx |   73 ++-
 1 file changed, 38 insertions(+), 35 deletions(-)

New commits:
commit 1c11bfc0420245ee19ff9ef1f09eaac79bae53e1
Author: Kevin Suo 
AuthorDate: Thu Nov 10 16:26:14 2022 +0800
Commit: Mike Kaganski 
CommitDate: Fri Nov 11 08:30:47 2022 +0100

Fix code block indent in SwTextGridPage::PutGridItem

Use 4 spaces rather than 8.

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

diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 545694643b81..2e9f99e9d538 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -227,39 +227,39 @@ DeactivateRC SwTextGridPage::DeactivatePage( SfxItemSet* )
 
 void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
 {
-SwTextGridItem aGridItem;
-aGridItem.SetGridType(m_xNoGridRB->get_active() ? GRID_NONE :
-m_xLinesGridRB->get_active() ? GRID_LINES_ONLY : GRID_LINES_CHARS 
);
-aGridItem.SetSnapToChars(m_xSnapToCharsCB->get_active());
-aGridItem.SetLines( static_cast< sal_uInt16 
>(m_xLinesPerPageNF->get_value()) );
-aGridItem.SetBaseHeight( static_cast< sal_uInt16 >(
-m_bRubyUserValue ? m_nRubyUserValue :
-
m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP))) );
-// Tdf#151544: set ruby height from the value get from UI only when in 
square page mode.
-// When in normal mode, the ruby height should be zero.
-if (m_bSquaredMode)
-
aGridItem.SetRubyHeight(static_cast(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP;
-else
-aGridItem.SetRubyHeight(0);
-aGridItem.SetBaseWidth( static_cast< sal_uInt16 
>(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FieldUnit::TWIP))) );
-aGridItem.SetRubyTextBelow(m_xRubyBelowCB->get_active());
-aGridItem.SetSquaredMode(m_bSquaredMode);
-aGridItem.SetDisplayGrid(m_xDisplayCB->get_active());
-aGridItem.SetPrintGrid(m_xPrintCB->get_active());
-aGridItem.SetColor(m_xColorLB->GetSelectEntryColor());
-rSet.Put(aGridItem);
-
-SwView * pView = ::GetActiveView();
-if (pView && aGridItem.GetGridType() != GRID_NONE)
+SwTextGridItem aGridItem;
+aGridItem.SetGridType(m_xNoGridRB->get_active() ? GRID_NONE :
+m_xLinesGridRB->get_active() ? GRID_LINES_ONLY : GRID_LINES_CHARS );
+aGridItem.SetSnapToChars(m_xSnapToCharsCB->get_active());
+aGridItem.SetLines( static_cast< sal_uInt16 
>(m_xLinesPerPageNF->get_value()) );
+aGridItem.SetBaseHeight( static_cast< sal_uInt16 >(
+m_bRubyUserValue ? m_nRubyUserValue :
+
m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP))) );
+// Tdf#151544: set ruby height from the value get from UI only when in 
square page mode.
+// When in normal mode, the ruby height should be zero.
+if (m_bSquaredMode)
+
aGridItem.SetRubyHeight(static_cast(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP;
+else
+aGridItem.SetRubyHeight(0);
+aGridItem.SetBaseWidth( static_cast< sal_uInt16 
>(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FieldUnit::TWIP))) );
+aGridItem.SetRubyTextBelow(m_xRubyBelowCB->get_active());
+aGridItem.SetSquaredMode(m_bSquaredMode);
+aGridItem.SetDisplayGrid(m_xDisplayCB->get_active());
+aGridItem.SetPrintGrid(m_xPrintCB->get_active());
+aGridItem.SetColor(m_xColorLB->GetSelectEntryColor());
+rSet.Put(aGridItem);
+
+SwView * pView = ::GetActiveView();
+if (pView && aGridItem.GetGridType() != GRID_NONE)
+{
+if ( aGridItem.GetGridType() == GRID_LINES_CHARS )
 {
-if ( aGridItem.GetGridType() == GRID_LINES_CHARS )
-{
-m_bHRulerChanged = true;
-}
-m_bVRulerChanged = true;
-
pView->GetHRuler().SetCharWidth(m_xCharWidthMF->get_value(FieldUnit::MM));
-
pView->GetVRuler().SetLineHeight(m_xTextSizeMF->get_value(FieldUnit::MM));
+m_bHRulerChanged = true;
 }
+m_bVRulerChanged = true;
+
pView->GetHRuler().SetCharWidth(m_xCharWidthMF->get_value(FieldUnit::MM));
+
pView->GetVRuler().SetLineHeight(m_xTextSizeMF->get_value(FieldUnit::MM));
+}
 }
 
 void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet)
commit 9b80b2d6140d1aad240f10755105e49d678b98f1
Author: Kevin Suo 
AuthorDate: Thu Nov 10 10:19:08 2022 +0800
Commit: Mike Kaganski 
CommitDate: Fri Nov 11 08:30:29 2022 +0100

tdf#151979: fix crash in Text Grid dialog when switching active view

GetActiveView() may return a nullptr when previously we are in Calc
window and then click the controls on the writer dialog.


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-10 Thread Kevin Suo (via logerrit)
 sw/source/ui/misc/pggrid.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit e6b070d3da4a3be84fa84d0b8c447d58be6d8923
Author: Kevin Suo 
AuthorDate: Thu Nov 3 23:26:28 2022 +0800
Commit: Caolán McNamara 
CommitDate: Thu Nov 10 20:53:39 2022 +0100

tdf#151544: Page grid: ruby height should be zero when not in square page 
mode

Ruby height is used to show the ruby line in square page mode only (e.g. to 
show the
Pinyin etc above or below base line). When not in square page mode (i.e., 
when in
normal mode), the ruby height should be zero.

The code was trying to set the ruby height to zero by using the following:
m_xRubySizeMF->set_value(0, FieldUnit::TWIP);
and then pass this to aGridItem.SetRubyHeight in 
SwTextGridPage::PutGridItem.
However, there seems to be always a conversion loss, thus each line will 
have a tiny
ruby height, which makes the vertical space not enough to hold the desired 
number
of lines on the page.

Fix this by setting ruby height to zero directly in 
SwTextGridPage::PutGridItem if
we are not in square page mode.

Change-Id: I24a74b96c12eb58e46e163e2a9c73b540023ab39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142243
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 875c27dc7975de9b007a215fe1d6f171b4ef090e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142514

diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index db3ade6edb6b..f849f6dcc48a 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -232,7 +232,12 @@ void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
 aGridItem.SetBaseHeight( static_cast< sal_uInt16 >(
 m_bRubyUserValue ? m_nRubyUserValue :
 
m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP))) );
-aGridItem.SetRubyHeight( static_cast< sal_uInt16 
>(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP))) );
+// Tdf#151544: set ruby height from the value get from UI only when in 
square page mode.
+// When in normal mode, the ruby height should be zero.
+if (m_bSquaredMode)
+
aGridItem.SetRubyHeight(static_cast(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP;
+else
+aGridItem.SetRubyHeight(0);
 aGridItem.SetBaseWidth( static_cast< sal_uInt16 
>(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FieldUnit::TWIP))) );
 aGridItem.SetRubyTextBelow(m_xRubyBelowCB->get_active());
 aGridItem.SetSquaredMode(m_bSquaredMode);
@@ -385,7 +390,6 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, 
weld::SpinButton&, rField, void)
 assert(nValue && "div-by-zero");
 auto nHeight = m_aPageSize.Height() / nValue;
 m_xTextSizeMF->set_value(m_xTextSizeMF->normalize(nHeight), 
FieldUnit::TWIP);
-m_xRubySizeMF->set_value(0, FieldUnit::TWIP);
 SetLinesOrCharsRanges( *m_xLinesRangeFT , 
m_xLinesPerPageNF->get_max() );
 
 m_nRubyUserValue = nHeight;


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

2022-11-09 Thread Kevin Suo (via logerrit)
 sw/source/ui/misc/pggrid.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 875c27dc7975de9b007a215fe1d6f171b4ef090e
Author: Kevin Suo 
AuthorDate: Thu Nov 3 23:26:28 2022 +0800
Commit: Caolán McNamara 
CommitDate: Wed Nov 9 21:24:29 2022 +0100

tdf#151544: Page grid: ruby height should be zero when not in square page 
mode

Ruby height is used to show the ruby line in square page mode only (e.g. to 
show the
Pinyin etc above or below base line). When not in square page mode (i.e., 
when in
normal mode), the ruby height should be zero.

The code was trying to set the ruby height to zero by using the following:
m_xRubySizeMF->set_value(0, FieldUnit::TWIP);
and then pass this to aGridItem.SetRubyHeight in 
SwTextGridPage::PutGridItem.
However, there seems to be always a conversion loss, thus each line will 
have a tiny
ruby height, which makes the vertical space not enough to hold the desired 
number
of lines on the page.

Fix this by setting ruby height to zero directly in 
SwTextGridPage::PutGridItem if
we are not in square page mode.

Change-Id: I24a74b96c12eb58e46e163e2a9c73b540023ab39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142243
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index db3ade6edb6b..f849f6dcc48a 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -232,7 +232,12 @@ void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
 aGridItem.SetBaseHeight( static_cast< sal_uInt16 >(
 m_bRubyUserValue ? m_nRubyUserValue :
 
m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP))) );
-aGridItem.SetRubyHeight( static_cast< sal_uInt16 
>(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP))) );
+// Tdf#151544: set ruby height from the value get from UI only when in 
square page mode.
+// When in normal mode, the ruby height should be zero.
+if (m_bSquaredMode)
+
aGridItem.SetRubyHeight(static_cast(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP;
+else
+aGridItem.SetRubyHeight(0);
 aGridItem.SetBaseWidth( static_cast< sal_uInt16 
>(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FieldUnit::TWIP))) );
 aGridItem.SetRubyTextBelow(m_xRubyBelowCB->get_active());
 aGridItem.SetSquaredMode(m_bSquaredMode);
@@ -385,7 +390,6 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, 
weld::SpinButton&, rField, void)
 assert(nValue && "div-by-zero");
 auto nHeight = m_aPageSize.Height() / nValue;
 m_xTextSizeMF->set_value(m_xTextSizeMF->normalize(nHeight), 
FieldUnit::TWIP);
-m_xRubySizeMF->set_value(0, FieldUnit::TWIP);
 SetLinesOrCharsRanges( *m_xLinesRangeFT , 
m_xLinesPerPageNF->get_max() );
 
 m_nRubyUserValue = nHeight;


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

2022-11-07 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/testdocs/testSpace.pdf |binary
 sdext/source/pdfimport/test/tests.cxx  |   38 +
 sdext/source/pdfimport/tree/writertreevisiting.cxx |   28 +--
 3 files changed, 63 insertions(+), 3 deletions(-)

New commits:
commit c2e2997f452b93b400d541c2d0b2ee396a889007
Author: Kevin Suo 
AuthorDate: Wed Oct 19 19:08:27 2022 +0800
Commit: Noel Grandin 
CommitDate: Tue Nov 8 08:40:29 2022 +0100

sdext.pdfimport - Wirter: add handling for continuous space characters

This was done for Draw in sdext/source/pdfimport/tree/drawtreevisiting.cxx,
but was not done for Writer. Without this, continuous spaces in PDF will
show only one space on pdfimport using the Writer pdfimport filter.

Change-Id: I2279d9b1750e07f5743aeba80a3fd553bc037d13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141527
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/test/testdocs/testSpace.pdf 
b/sdext/source/pdfimport/test/testdocs/testSpace.pdf
new file mode 100644
index ..3c94f31ea15b
Binary files /dev/null and b/sdext/source/pdfimport/test/testdocs/testSpace.pdf 
differ
diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 71661ae9e6d5..786815941445 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -841,6 +841,43 @@ namespace
 #endif
 }
 
+void testSpaces()
+{
+#if HAVE_FEATURE_POPPLER
+rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
+xAdaptor->setTreeVisitorFactory(createWriterTreeVisitorFactory());
+
+OString aOutput;
+
xAdaptor->odfConvert(m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/testSpace.pdf"),
+new OutputWrapString(aOutput),
+nullptr);
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
+
+// Space test: there are 10 spaces, each space is expressed as a 
,
+// thus the 10th text:s should exist and the attribute "text:c" 
should be "1".
+OString xpath = 
"//draw:frame[@draw:z-index='1'][1]/draw:text-box/text:p/text:span/text:s[10]";
+OUString  sContent = getXPath(pXmlDoc, xpath, "c");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString("1"), 
sContent);
+
+// Tab test: there are 10 tabs. Text before and after the tabs are 
shown in different draw frames.
+// With the Liberation Serif font, the horizontal position of the 
first frame is 20.03mm and the
+// second frame is 94.12mm.
+xpath = "//draw:frame[@draw:z-index='2'][1]";
+sContent = getXPath(pXmlDoc, xpath, "transform");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString("translate( 20.03mm 25.05mm )"), sContent);
+xpath = "//draw:frame[@draw:z-index='3'][1]";
+sContent = getXPath(pXmlDoc, xpath, "transform");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString("translate( 94.12mm 25.05mm )"), sContent);
+
+// Non-breaking space test: there are 10 NBSpaces, which are 
treated as the same as normal space in PDF,
+// thus each is expressed as a .
+// The 10th text:s should exist and the attribute "text:c" should 
be "1".
+xpath = 
"//draw:frame[@draw:z-index='4'][1]/draw:text-box/text:p/text:span/text:s[10]";
+sContent = getXPath(pXmlDoc, xpath, "c");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString("1"), 
sContent);
+#endif
+}
+
 CPPUNIT_TEST_SUITE(PDFITest);
 CPPUNIT_TEST(testXPDFParser);
 CPPUNIT_TEST(testOdfWriterExport);
@@ -853,6 +890,7 @@ namespace
 CPPUNIT_TEST(testTdf78427_FontWeight_MyraidProSemibold);
 CPPUNIT_TEST(testTdf143959_nameFromFontFile);
 CPPUNIT_TEST(testTdf104597_textrun);
+CPPUNIT_TEST(testSpaces);
 CPPUNIT_TEST_SUITE_END();
 };
 
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index deabf365088b..510689be1588 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -81,7 +81,11 @@ void WriterXmlEmitter::visit( TextElement& elem, const 
std::list< std::unique_pt
 if( elem.Text.isEmpty() )
 return;
 
-PropertyMap aProps;
+PropertyMap aProps = {};
+const sal_Unicode strSpace = 0x0020;
+const sal_Unicode strNbSpace = 0x00A0;
+const sal_Unicode tabSpace = 0x0009;
+
 if( elem.StyleId != -1 )
 {
 aProps[ OUString( "text:style-name" ) ] =
@@ -111,8 +115,26 @@ void WriterXmlEmitter::visit( TextElement& elem, const 
std::list< std::unique_pt
 str = 

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

2022-11-06 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/writertreevisiting.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9ea9d3ccc0f8e4833e745d9655b61d42d6d8fe83
Author: Kevin Suo 
AuthorDate: Sun Oct 23 19:10:29 2022 +0800
Commit: Noel Grandin 
CommitDate: Sun Nov 6 12:43:07 2022 +0100

sdext.pdfimport Writer: Do not visit DrawElement twice in WriterXmlEmitter

Discovered when working on commit f6004e1c457ddab5e0c91e6159875d25130b108a.

To reproduce, you can print the content of aOutput2 above the line:

https://opengrok.libreoffice.org/xref/core/sdext/source/pdfimport/test/tests.cxx?r=f6004e1c#836,
and then you get the xml content as shown in:
https://bugs.documentfoundation.org/attachment.cgi?id=183217,
in which you can see that there are duplicated draw:frame(s) with identical 
draw:z-index.

To dig into the problem, you may take a look at the following code block:

1for( const auto& rxChild : elem.Children )
2{
3PageElement* pPage = dynamic_cast(rxChild.get());
4if( pPage )
5{
6for( auto child_it = pPage->Children.begin(); child_it != 
pPage->Children.end(); ++child_it )
7{
8if( dynamic_cast(child_it->get()) != nullptr 
)
9(*child_it)->visitedBy( *this, child_it );
10   }
11   }
12   }
13
14   for( auto it = elem.Children.begin(); it != elem.Children.end(); ++it )
15   {
16   if( dynamic_cast(it->get()) != nullptr )
17   (*it)->visitedBy( *this, it );
18   }

In the for loop in lines 1:12:
* "elem" is a "DocumentElement" which is derived from "Element". It's 
childen are PageElement(s).
* "pPage" is a "PageElement" which is also derived from "Element". It's 
childen are DrawElement(s).
* "child_it", as in the for loop in lines 6:10, is a "DrawElement" which is 
derived from
"GraphicalElement", whereas "GraphicalElement" is derived from "Element".
In this block, the code goes through each of the pages and visit the 
DrawElements there.

The code in lines 14:18 seems to assume that, a DrawElement, in addition to 
be a child of
PageElement, may also be a child of DocumentElement. See the comment in 
souce code.
Yes, it may be. For such DrawElement(s), the visiting is done in lines 
14:18 separately.

Note that The above code uses dynamic_cast to determine whether a node is a 
DrawElement or not.

The problem is that, in determining whether the node during the 2nd 
visiting is a DrawElement,
it accidently used "== nullptr". This may be an inadvertent error. If the 
dynamic_cast is a nullprt,
then it is not a DrawElement and the visiting should not be done there.

Resolve this by using "!= nullptr" in the second dynamic_cast checking.

Change-Id: I066100e98039d505d8b10c390954e014b78cff4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141680
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index 2ece5307bd53..deabf365088b 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -382,7 +382,7 @@ void WriterXmlEmitter::visit( DocumentElement& elem, const 
std::list< std::uniqu
 // only DrawElement types
 for( auto it = elem.Children.begin(); it != elem.Children.end(); ++it )
 {
-if( dynamic_cast(it->get()) == nullptr )
+if( dynamic_cast(it->get()) != nullptr )
 (*it)->visitedBy( *this, it );
 }
 


[Libreoffice-commits] core.git: extras/CustomTarget_templates.mk extras/Package_templates.mk extras/source include/sfx2 sfx2/inc sfx2/source

2022-11-04 Thread Kevin Suo (via logerrit)
 extras/CustomTarget_templates.mk   |2 
 extras/Package_templates.mk|1 
 extras/source/templates/l10n/zh_CN_ott_normal/META-INF/manifest.xml|8 
 extras/source/templates/l10n/zh_CN_ott_normal/Thumbnails/thumbnail.png |binary
 extras/source/templates/l10n/zh_CN_ott_normal/content.xml  |   15 
 extras/source/templates/l10n/zh_CN_ott_normal/meta.xml |   10 
 extras/source/templates/l10n/zh_CN_ott_normal/mimetype |1 
 extras/source/templates/l10n/zh_CN_ott_normal/styles.xml   |  446 
++
 include/sfx2/strings.hrc   |1 
 sfx2/inc/doctempl.hrc  |3 
 sfx2/inc/strings.hxx   |1 
 sfx2/source/doc/doctempl.cxx   |2 
 sfx2/source/doc/doctemplates.cxx   |3 
 13 files changed, 491 insertions(+), 2 deletions(-)

New commits:
commit 5da75fcb400579d11430ec3d4c29b4646797fc5c
Author: Kevin Suo 
AuthorDate: Fri Sep 30 18:03:13 2022 +0800
Commit: Laurent Balland 
CommitDate: Fri Nov 4 21:29:33 2022 +0100

Templates: tdf#86483: Add "Localization" category and add a template for 
zh_CN

This patch adds a new template category named "Localization", to be used for
templates created by our l10n team for each locale, so that languages which
requires special layout or formatting (such as CJK or CTL) can have their 
own
templates bundled by default.

This patch aslo adds a (general purpose) Writer template for the Simplified
Chinese language. Chinese language, by convention, need to format the
document to have the first line of the paragraph be indented by 2 
characters.
The font size, line spacing, paragraph margin etc also need special 
treatment.
If the Chinese users start writing using the current default Writer 
template,
they need to adjust the style formatting every time to meet their needs.
Although this template can be provided as an "extension" on the extension
website, in practice very few people will go to the extension website and
look for such templates.

Such bundled templates can also be added by other l10n teams. The
extras/README.md will be updated in a separate patch to include 
documentation
on how to add such templates and have their template names translatable on
weblate.

This does not completely resolve the issue in tdf#86483, which requests to
"Implement different default templates per locale". However, with this 
patch,
we are a step closer to set a choosen template when the user switch to a
certain UI.

Change-Id: Ic295482354f343e981eb20908907bd6a945b7120
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140802
Tested-by: Jenkins
Reviewed-by: Laurent Balland 

diff --git a/extras/CustomTarget_templates.mk b/extras/CustomTarget_templates.mk
index 3b7e8884f488..c6bea14a27df 100644
--- a/extras/CustomTarget_templates.mk
+++ b/extras/CustomTarget_templates.mk
@@ -36,6 +36,8 @@ extras_TEMPLATES_XMLFILES := \
offimisc/Businesscard-with-logo/settings.xml \

offimisc/Businesscard-with-logo/Pictures/120101F400A0108F3F06.png \
draw/bpmn/meta.xml \
+   l10n/zh_CN_ott_normal/meta.xml \
+   l10n/zh_CN_ott_normal/content.xml \
 
 # param: style-base (e.g. Modern)
 extras_TEMPLATES_XMLFILES_RELATIVE = $(subst $(1)/,,$(filter 
$(1)/%,$(extras_TEMPLATES_XMLFILES)))
diff --git a/extras/Package_templates.mk b/extras/Package_templates.mk
index e618b646030d..af119188339a 100644
--- a/extras/Package_templates.mk
+++ b/extras/Package_templates.mk
@@ -19,6 +19,7 @@ $(eval $(call 
gb_Package_add_files_with_dir,extras_templates,$(LIBO_SHARE_FOLDER
styles/Modern.ott \
styles/Simple.ott \
draw/bpmn.otg \
+   l10n/zh_CN_ott_normal.ott \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git 
a/extras/source/templates/l10n/zh_CN_ott_normal/META-INF/manifest.xml 
b/extras/source/templates/l10n/zh_CN_ott_normal/META-INF/manifest.xml
new file mode 100644
index ..301ca9d330d4
--- /dev/null
+++ b/extras/source/templates/l10n/zh_CN_ott_normal/META-INF/manifest.xml
@@ -0,0 +1,8 @@
+
+
+ 
+ 
+ 
+ 
+ 
+
diff --git 
a/extras/source/templates/l10n/zh_CN_ott_normal/Thumbnails/thumbnail.png 
b/extras/source/templates/l10n/zh_CN_ott_normal/Thumbnails/thumbnail.png
new file mode 100644
index ..d223e8b09881
Binary files /dev/null and 
b/extras/source/templates/l10n/zh_CN_ott_normal/Thumbnails/thumbnail.png differ
diff --git a/extras/source/templates/l10n/zh_CN_ott_normal/content.xml 
b/extras/source/templates/l10n/zh_CN_ott_normal/content.xml
new file mode 100644
index ..56ccdc140998
--- /dev/null
+++ 

[Libreoffice-commits] core.git: Branch 'feature/cib_contract891c' - 15 commits - configure.ac download.lst external/curl external/libxml2 external/poppler external/zlib sc/source sdext/Executable_xpdf

2022-11-04 Thread Kevin Suo (via logerrit)
Rebased ref, commits from common ancestor:
commit a6cfedd505e688b36165da182a5aa6e3887a781b
Author: Kevin Suo 
AuthorDate: Sat Jul 10 11:47:39 2021 +0800
Commit: Thorsten Behrens 
CommitDate: Fri Nov 4 15:24:54 2022 +0100

tdf#78427 sdext.pdfimport: No need to read a font file for the purpose of...

...determining the bold/italic/underline etc.

The purpose for reading a font file is that in case the font attributes 
determined by the xpdfimport process is not enough, then we use the lo core 
font classes which read in the font file and then determine whether it is bold, 
italic etc.
However, while this works in some cases, it does not work in many cases 
when the font file was actually a subset and a toUnicode map is followed in the 
PDF, see tdf#78427.
In addition, in case the information collected from the xpdfimport process 
is enough, there is no need to read the font file.

This commit removes the read of font file part. Also, this commit uses 
gfxFont->getNameWithoutSubsetTag() to get the font name with the subset tags 
removed, thus simplified the code in wrapper.cxx while also improves performace 
as the remove of subset tags is only run when the font is a subset (the 
previous code did this for all the font names).

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118733
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
(cherry picked from commit da59686672fd2bc98f8cb28d5f04dc978b50ac13)

restore compatibility with older popplers

with poppler 20.09:


/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:
 In member function 'int
 pdfi::PDFOutDev::parseFont(long long int, GfxFont*, 
GfxState*) const':

/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:438:39:
 error: 'class
 GfxFont' has no member named 'getNameWithoutSubsetTag'


https://www.google.com/search?q=getNameWithoutSubsetTag=getNameWithoutSubsetTag=chrome..69i57.784j0j7=chrome=UTF-8
 suggests it was added in 20.12

Change-Id: I4eacd2d740cb689ff9b3c6cab59376e01b1ba162
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118977
Tested-by: René Engelhard 
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 07087041610ca8351d764c838ae07fa58f3bdf9e)

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index a31e78cb1100..7978bde801be 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -500,12 +500,6 @@ void Parser::parseFontFamilyName( FontAttributes& rResult )
 
 const sal_Unicode* pCopy = rResult.familyName.getStr();
 sal_Int32 nLen = rResult.familyName.getLength();
-// parse out truetype subsets (e.g. BA+Thorndale)
-if( nLen > 8 && pCopy[6] == '+' )
-{
-pCopy += 7;
-nLen -= 7;
-}
 
 // TODO: Looks like this block needs to be refactored
 while( nLen )
@@ -627,52 +621,6 @@ void Parser::readFont()
 
 // extract textual attributes (bold, italic in the name, etc.)
 parseFontFamilyName(aResult);
-// need to read font file?
-if( nFileLen )
-{
-uno::Sequence aFontFile(nFileLen);
-readBinaryData( aFontFile );
-
-awt::FontDescriptor aFD;
-uno::Sequence< uno::Any > aArgs(1);
-aArgs[0] <<= aFontFile;
-
-try
-{
-uno::Reference< beans::XMaterialHolder > xMat(
-
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
-"com.sun.star.awt.FontIdentificator", aArgs, m_xContext ),
-uno::UNO_QUERY );
-if( xMat.is() )
-{
-uno::Any aRes( xMat->getMaterial() );
-if( aRes >>= aFD )
-{
-if (!aFD.Name.isEmpty())
-{
-aResult.familyName = aFD.Name;
-parseFontFamilyName(aResult);
-}
-aResult.isBold  = (aFD.Weight > 100.0);
-aResult.isItalic= (aFD.Slant == awt::FontSlant_OBLIQUE 
||
-   aFD.Slant == awt::FontSlant_ITALIC 
);
-aResult.isUnderline = false;
-aResult.size= 0;
-}
-}
-}
-catch( uno::Exception& )
-{
-}
-
-if( aResult.familyName.isEmpty() )
-{
-// last fallback
-aResult.familyName  = "Arial";
-aResult.isUnderline = false;
-}
-
-}
 
 if (!m_xDev)
 m_xDev.disposeAndReset(VclPtr::Create());
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sdext/source

2022-11-01 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/tests.cxx  |   30 ++---
 sdext/source/pdfimport/tree/writertreevisiting.cxx |   46 +++--
 sdext/source/pdfimport/tree/writertreevisiting.hxx |4 +
 3 files changed, 70 insertions(+), 10 deletions(-)

New commits:
commit 6b724fd0355f33226b8657110459968aa1be02ea
Author: Kevin Suo 
AuthorDate: Sat Oct 15 19:43:54 2022 +0800
Commit: Xisco Fauli 
CommitDate: Tue Nov 1 15:52:51 2022 +0100

tdf#151546: RTL text is reversed (Writer pdfimport)

This is a followup to commit 69e9925ded584113e52f84ef0ed7c224079fa061
for the fix of tdf#104597.

The Writer pdf import filter code is similar than the Draw part.
However, many fixes to the Draw part was not done in the Writer part 
historically.

This patch ports the fix of text run in the Draw part to the Writer
part. There is a todo related to continuous spaces issue which should
be fixed separately.

Also use CPPUNIT_ASSERT_EQUAL_MESSAGE for the output of xml content
instread of using std::cout, in case of unit test failure.

Change-Id: Id013700524750e6e5283d85eeab72d8075f16f1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141420
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit f6004e1c457ddab5e0c91e6159875d25130b108a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141927
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index a520569c4164..fe2f659aeb7f 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -793,36 +793,54 @@ namespace
 new OutputWrapString(aOutput),
 nullptr));
 
-// std::cout << aOutput << std::endl;
 xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
 
 // Test for امُ عَلَيْكَ
 // TODO: How to get the "عَلَيْكَ" in xpath, as shown after the 
 tag?
 OString xpath = 
"//draw:frame[@draw:transform='matrix(917. 0 0 917. 
14821.958333 2159.23861112778)']/draw:text-box/text:p/text:span";
 OUString sContent = getXPathContent(pXmlDoc, xpath); // 
u"\nا\nُ\nم\n"
-CPPUNIT_ASSERT_EQUAL(OUString(u"اُم"), sContent.replaceAll("\n", 
""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"اُم"), 
sContent.replaceAll("\n", ""));
 
 // Test for ٱلَّسَل‬ . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
 // thus these two frames together appear as ٱلَّسَل امُ عَلَيْكَ 
in Draw‬.
 xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 17420.17 
2159.23861112778)']/draw:text-box/text:p/text:span";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL(OUString(u"ٱلَّسَل"), 
sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"ٱلَّسَل"), sContent.replaceAll("\n", ""));
 
 // Test for "LibreOffice LTR"
 // TODO: How to get the "LTR" as shown after the  tag?
 xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 12779.375 5121.79583335)']/draw:text-box/text:p/text:span";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL(OUString(u"LibreOffice"), 
sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"LibreOffice"), sContent.replaceAll("\n", ""));
 
 /* Test for Chinese characters */
 // Use last() instead of matrix below, because the matrix may be 
different on different OS due to fallback of Chinese fonts.
 xpath = "//draw:frame[last()]/draw:text-box/text:p/text:span";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL(OUString(u"中文测试,中文"), 
sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"中文测试,中文"), sContent.replaceAll("\n", ""));
+
+// Test pdf text run in the Writer PDF import filter
+xAdaptor->setTreeVisitorFactory(createWriterTreeVisitorFactory());
+OString aOutput2;
+
xAdaptor->odfConvert(m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf"),
+new OutputWrapString(aOutput2),
+nullptr);
+// FIXME: the same draw:frame is duplicated in the xml output,
+// e.g. there are two draw:frame with draw:z-index="3" with the 
same content.
+xmlDocUniquePtr pXmlDoc2(xmlParseDoc(reinterpret_cast(aOutput2.getStr(;
+xpath = 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sdext/source

2022-11-01 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf |binary
 sdext/source/pdfimport/test/tests.cxx  |   44 +
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |   17 +
 sdext/source/pdfimport/tree/pdfiprocessor.cxx  |   18 -
 4 files changed, 48 insertions(+), 31 deletions(-)

New commits:
commit bcb4fef4e321c6c0f1f9edd05b2f18ddb34792ed
Author: Kevin Suo 
AuthorDate: Tue Oct 11 10:04:16 2022 +0800
Commit: Xisco Fauli 
CommitDate: Tue Nov 1 11:17:40 2022 +0100

sdext.pdfimport: resolves tdf#104597: RTL script text runs are reversed

For the simple Arabic string: ٱلسَّلَامُ عَلَيْك, the xpdfimport binary 
generates the
follwing (drawchar) sequences:
كَ
يْ
لَ
عَ
مُ
ا
لَ
سَّ
ل
ٱ
(i.e., in reversed order, one character by one character).

Before this patch, after pdfimport the text shows up as لَسَّلٱ كَيْلَعَ 
مُا, which is reversed.

It was surposed to combine these characters into text frames in
DrawXmlOptimizer::optimizeTextElements(Element& rParent) 
(sdext/source/pdfimport/\
tree/drawtreevisiting.cxx:677), but actually it was not combined 
successfully there.
The single characters were then passed to 
sdext/source/pdfimport/tree/drawtreevisiting\
.cxx:105, one by one, in the hope that the strings could be mirrored. The 
mirroring
failed, because one single character, even after mirroring, always equals 
itself.

The DrawXmlOptimizer::optimizeTextElements failed to combine the characters 
into
one text frame, because the condition:
(rCurGC.Transformation == rNextGC.Transformation || notTransformed(rNextGC))
would never be true, as at least its horizontal position is different. A 
further analysis
indicates that we do not need to check the transformation here at all, as 
this is an
optimizer for a TextElement and in case a character is transformed then it 
would already
be in a different draw element (thus will never be combined with this 
TextElement).

After the fix of DrawXmlOptimizer::optimizeTextElements which now 
successfully
combines the characters, there is another issue in the old 
PDFIProcessor::mirrorString
function. It seems to mirror the characters within a word, but if a string 
contains
two words, then the two words are not successfully switched (e.g. for 
string "abc def"
it produces "cba fed" rather than "fed cba"),  which is not suitable for
the case of RTL which requires all the characters been reversed. Fix this 
by using
comphelper::string::reverseString.

Change-Id: Ifa210836f1ddd56205ff0d243adfb4114794
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141231
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 69e9925ded584113e52f84ef0ed7c224079fa061)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141319
Reviewed-by: Xisco Fauli 

diff --git a/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf 
b/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf
new file mode 100644
index ..dcee96aa3169
Binary files /dev/null and 
b/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf differ
diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 77d98999d0d3..a520569c4164 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -780,6 +781,48 @@ namespace
  getXPath(pXmlDoc, xpath, "font-weight"));
 }
 
+void testTdf104597_textrun()
+{
+#if HAVE_FEATURE_POPPLER
+rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
+xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
+
+OString aOutput;
+CPPUNIT_ASSERT_MESSAGE("Converting PDF to ODF XML",
+
xAdaptor->odfConvert(m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf"),
+new OutputWrapString(aOutput),
+nullptr));
+
+// std::cout << aOutput << std::endl;
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
+
+// Test for امُ عَلَيْكَ
+// TODO: How to get the "عَلَيْكَ" in xpath, as shown after the 
 tag?
+OString xpath = 
"//draw:frame[@draw:transform='matrix(917. 0 0 917. 
14821.958333 2159.23861112778)']/draw:text-box/text:p/text:span";
+OUString sContent = getXPathContent(pXmlDoc, xpath); // 
u"\nا\nُ\nم\n"
+CPPUNIT_ASSERT_EQUAL(OUString(u"اُم"), sContent.replaceAll("\n", 
""));
+
+// Test for ٱلَّسَل‬ . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which 

[Libreoffice-commits] core.git: Branch 'feature/cib_contract57d' - 3 commits - sdext/source

2022-10-30 Thread Kevin Suo (via logerrit)
Rebased ref, commits from common ancestor:
commit 55bd739f985758b044e1705713de1fc80f82f8af
Author: Kevin Suo 
AuthorDate: Sat Jul 10 11:47:39 2021 +0800
Commit: Thorsten Behrens 
CommitDate: Sun Oct 30 13:46:11 2022 +0100

tdf#78427 sdext.pdfimport: No need to read a font file for the purpose of...

...determining the bold/italic/underline etc.

The purpose for reading a font file is that in case the font attributes 
determined by the xpdfimport process is not enough, then we use the lo core 
font classes which read in the font file and then determine whether it is bold, 
italic etc.
However, while this works in some cases, it does not work in many cases 
when the font file was actually a subset and a toUnicode map is followed in the 
PDF, see tdf#78427.
In addition, in case the information collected from the xpdfimport process 
is enough, there is no need to read the font file.

This commit removes the read of font file part. Also, this commit uses 
gfxFont->getNameWithoutSubsetTag() to get the font name with the subset tags 
removed, thus simplified the code in wrapper.cxx while also improves performace 
as the remove of subset tags is only run when the font is a subset (the 
previous code did this for all the font names).

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118733
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
(cherry picked from commit da59686672fd2bc98f8cb28d5f04dc978b50ac13)

restore compatibility with older popplers

with poppler 20.09:


/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:
 In member function 'int
 pdfi::PDFOutDev::parseFont(long long int, GfxFont*, 
GfxState*) const':

/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:438:39:
 error: 'class
 GfxFont' has no member named 'getNameWithoutSubsetTag'


https://www.google.com/search?q=getNameWithoutSubsetTag=getNameWithoutSubsetTag=chrome..69i57.784j0j7=chrome=UTF-8
 suggests it was added in 20.12

Change-Id: I4eacd2d740cb689ff9b3c6cab59376e01b1ba162
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118977
Tested-by: René Engelhard 
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 07087041610ca8351d764c838ae07fa58f3bdf9e)

Conflicts:
sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index f91612a5a201..b4a10780741d 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -499,12 +499,6 @@ void Parser::parseFontFamilyName( FontAttributes& rResult )
 
 const sal_Unicode* pCopy = rResult.familyName.getStr();
 sal_Int32 nLen = rResult.familyName.getLength();
-// parse out truetype subsets (e.g. BA+Thorndale)
-if( nLen > 8 && pCopy[6] == '+' )
-{
-pCopy += 7;
-nLen -= 7;
-}
 
 // TODO: Looks like this block needs to be refactored
 while( nLen )
@@ -626,52 +620,6 @@ void Parser::readFont()
 
 // extract textual attributes (bold, italic in the name, etc.)
 parseFontFamilyName(aResult);
-// need to read font file?
-if( nFileLen )
-{
-uno::Sequence aFontFile(nFileLen);
-readBinaryData( aFontFile );
-
-awt::FontDescriptor aFD;
-uno::Sequence< uno::Any > aArgs(1);
-aArgs[0] <<= aFontFile;
-
-try
-{
-uno::Reference< beans::XMaterialHolder > xMat(
-
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
-"com.sun.star.awt.FontIdentificator", aArgs, m_xContext ),
-uno::UNO_QUERY );
-if( xMat.is() )
-{
-uno::Any aRes( xMat->getMaterial() );
-if( aRes >>= aFD )
-{
-if (!aFD.Name.isEmpty())
-{
-aResult.familyName = aFD.Name;
-parseFontFamilyName(aResult);
-}
-aResult.isBold  = (aFD.Weight > 100.0);
-aResult.isItalic= (aFD.Slant == awt::FontSlant_OBLIQUE 
||
-   aFD.Slant == awt::FontSlant_ITALIC 
);
-aResult.isUnderline = false;
-aResult.size= 0;
-}
-}
-}
-catch( uno::Exception& )
-{
-}
-
-if( aResult.familyName.isEmpty() )
-{
-// last fallback
-aResult.familyName  = "Arial";
-aResult.isUnderline = false;
-}
-
-}
 
 if (!m_xDev)
 m_xDev.disposeAndReset(VclPtr::Create());
diff --git 

[Libreoffice-commits] core.git: Branch 'feature/cib_contract57d' - 3 commits - sdext/source

2022-10-30 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx|   52 -
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |   53 +++---
 sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx|   10 +++
 3 files changed, 57 insertions(+), 58 deletions(-)

New commits:
commit db5713a0f6caed83badebf29b2f7bb8ef09579e9
Author: Kevin Suo 
AuthorDate: Sat Jul 10 11:47:39 2021 +0800
Commit: Thorsten Behrens 
CommitDate: Sun Oct 30 12:49:07 2022 +0100

tdf#78427 sdext.pdfimport: No need to read a font file for the purpose of...

...determining the bold/italic/underline etc.

The purpose for reading a font file is that in case the font attributes 
determined by the xpdfimport process is not enough, then we use the lo core 
font classes which read in the font file and then determine whether it is bold, 
italic etc.
However, while this works in some cases, it does not work in many cases 
when the font file was actually a subset and a toUnicode map is followed in the 
PDF, see tdf#78427.
In addition, in case the information collected from the xpdfimport process 
is enough, there is no need to read the font file.

This commit removes the read of font file part. Also, this commit uses 
gfxFont->getNameWithoutSubsetTag() to get the font name with the subset tags 
removed, thus simplified the code in wrapper.cxx while also improves performace 
as the remove of subset tags is only run when the font is a subset (the 
previous code did this for all the font names).

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118733
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
(cherry picked from commit da59686672fd2bc98f8cb28d5f04dc978b50ac13)

restore compatibility with older popplers

with poppler 20.09:


/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:
 In member function 'int
 pdfi::PDFOutDev::parseFont(long long int, GfxFont*, 
GfxState*) const':

/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:438:39:
 error: 'class
 GfxFont' has no member named 'getNameWithoutSubsetTag'


https://www.google.com/search?q=getNameWithoutSubsetTag=getNameWithoutSubsetTag=chrome..69i57.784j0j7=chrome=UTF-8
 suggests it was added in 20.12

Change-Id: I4eacd2d740cb689ff9b3c6cab59376e01b1ba162
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118977
Tested-by: René Engelhard 
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 07087041610ca8351d764c838ae07fa58f3bdf9e)

Conflicts:
sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index f91612a5a201..b4a10780741d 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -499,12 +499,6 @@ void Parser::parseFontFamilyName( FontAttributes& rResult )
 
 const sal_Unicode* pCopy = rResult.familyName.getStr();
 sal_Int32 nLen = rResult.familyName.getLength();
-// parse out truetype subsets (e.g. BA+Thorndale)
-if( nLen > 8 && pCopy[6] == '+' )
-{
-pCopy += 7;
-nLen -= 7;
-}
 
 // TODO: Looks like this block needs to be refactored
 while( nLen )
@@ -626,52 +620,6 @@ void Parser::readFont()
 
 // extract textual attributes (bold, italic in the name, etc.)
 parseFontFamilyName(aResult);
-// need to read font file?
-if( nFileLen )
-{
-uno::Sequence aFontFile(nFileLen);
-readBinaryData( aFontFile );
-
-awt::FontDescriptor aFD;
-uno::Sequence< uno::Any > aArgs(1);
-aArgs[0] <<= aFontFile;
-
-try
-{
-uno::Reference< beans::XMaterialHolder > xMat(
-
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
-"com.sun.star.awt.FontIdentificator", aArgs, m_xContext ),
-uno::UNO_QUERY );
-if( xMat.is() )
-{
-uno::Any aRes( xMat->getMaterial() );
-if( aRes >>= aFD )
-{
-if (!aFD.Name.isEmpty())
-{
-aResult.familyName = aFD.Name;
-parseFontFamilyName(aResult);
-}
-aResult.isBold  = (aFD.Weight > 100.0);
-aResult.isItalic= (aFD.Slant == awt::FontSlant_OBLIQUE 
||
-   aFD.Slant == awt::FontSlant_ITALIC 
);
-aResult.isUnderline = false;
-aResult.size= 0;
-}
-}
-}
-catch( uno::Exception& )
-{
-}
-
-if( aResult.familyName.isEmpty() )
-{
-// 

[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - 2 commits - sdext/source

2022-10-29 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx|   52 --
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |   26 ++---
 2 files changed, 18 insertions(+), 60 deletions(-)

New commits:
commit 0a03bf027eed9a952ac242a79a79711948228584
Author: Kevin Suo 
AuthorDate: Sat Jul 10 11:47:39 2021 +0800
Commit: Thorsten Behrens 
CommitDate: Sun Oct 30 00:22:25 2022 +0200

tdf#78427 sdext.pdfimport: No need to read a font file for the purpose of...

...determining the bold/italic/underline etc.

The purpose for reading a font file is that in case the font attributes 
determined by the xpdfimport process is not enough, then we use the lo core 
font classes which read in the font file and then determine whether it is bold, 
italic etc.
However, while this works in some cases, it does not work in many cases 
when the font file was actually a subset and a toUnicode map is followed in the 
PDF, see tdf#78427.
In addition, in case the information collected from the xpdfimport process 
is enough, there is no need to read the font file.

This commit removes the read of font file part. Also, this commit uses 
gfxFont->getNameWithoutSubsetTag() to get the font name with the subset tags 
removed, thus simplified the code in wrapper.cxx while also improves performace 
as the remove of subset tags is only run when the font is a subset (the 
previous code did this for all the font names).

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118733
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
(cherry picked from commit da59686672fd2bc98f8cb28d5f04dc978b50ac13)

restore compatibility with older popplers

with poppler 20.09:


/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:
 In member function 'int
 pdfi::PDFOutDev::parseFont(long long int, GfxFont*, 
GfxState*) const':

/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:438:39:
 error: 'class
 GfxFont' has no member named 'getNameWithoutSubsetTag'


https://www.google.com/search?q=getNameWithoutSubsetTag=getNameWithoutSubsetTag=chrome..69i57.784j0j7=chrome=UTF-8
 suggests it was added in 20.12

Change-Id: I4eacd2d740cb689ff9b3c6cab59376e01b1ba162
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118977
Tested-by: René Engelhard 
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 07087041610ca8351d764c838ae07fa58f3bdf9e)

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 7d3d68901e37..2d4ad4cd5763 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -494,12 +494,6 @@ void Parser::parseFontFamilyName( FontAttributes& rResult )
 
 const sal_Unicode* pCopy = rResult.familyName.getStr();
 sal_Int32 nLen = rResult.familyName.getLength();
-// parse out truetype subsets (e.g. BA+Thorndale)
-if( nLen > 8 && pCopy[6] == '+' )
-{
-pCopy += 7;
-nLen -= 7;
-}
 
 // TODO: Looks like this block needs to be refactored
 while( nLen )
@@ -621,52 +615,6 @@ void Parser::readFont()
 
 // extract textual attributes (bold, italic in the name, etc.)
 parseFontFamilyName(aResult);
-// need to read font file?
-if( nFileLen )
-{
-uno::Sequence aFontFile(nFileLen);
-readBinaryData( aFontFile );
-
-awt::FontDescriptor aFD;
-uno::Sequence< uno::Any > aArgs(1);
-aArgs[0] <<= aFontFile;
-
-try
-{
-uno::Reference< beans::XMaterialHolder > xMat(
-
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
-"com.sun.star.awt.FontIdentificator", aArgs, m_xContext ),
-uno::UNO_QUERY );
-if( xMat.is() )
-{
-uno::Any aRes( xMat->getMaterial() );
-if( aRes >>= aFD )
-{
-if (!aFD.Name.isEmpty())
-{
-aResult.familyName = aFD.Name;
-parseFontFamilyName(aResult);
-}
-aResult.isBold  = (aFD.Weight > 100.0);
-aResult.isItalic= (aFD.Slant == awt::FontSlant_OBLIQUE 
||
-   aFD.Slant == awt::FontSlant_ITALIC 
);
-aResult.isUnderline = false;
-aResult.size= 0;
-}
-}
-}
-catch( uno::Exception& )
-{
-}
-
-if( aResult.familyName.isEmpty() )
-{
-// last fallback
-aResult.familyName  = "Arial";
-aResult.isUnderline = false;
-}
-
-}
 
 if (!m_xDev)
 

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

2022-10-24 Thread Kevin Suo (via logerrit)
 filter/source/pdf/impdialog.cxx  |   22 ---
 filter/source/pdf/pdfexport.cxx  |4 --
 filter/source/t602/t602filter.cxx|   16 ++--
 filter/source/t602/t602filter.hxx|4 --
 filter/source/xsltdialog/xmlfiltercommon.hxx |2 -
 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx |   38 ---
 filter/source/xsltdialog/xmlfiltertabdialog.cxx  |3 -
 7 files changed, 32 insertions(+), 57 deletions(-)

New commits:
commit 5e3e507b1a68f5b9883337f1e55c54c2fc9de9fc
Author: Kevin Suo 
AuthorDate: Mon Oct 24 10:42:05 2022 +0800
Commit: Noel Grandin 
CommitDate: Mon Oct 24 12:41:00 2022 +0200

Drop {PDFFilterResId, getResStr, XsltResId} and use FilterResId in "filter"

This is a followup to commit a97bae545d72d8b19f39aa9280c0f284c79d0f6c.

Previously different areas within the "filter" module used their own 
"*ResId" code
to get the translated string. They did the same thing without any 
difference in
purpose and implementation.

Unify this to use FilterResId instead.

Change-Id: Idccf74601a89b5786e1f61a04631436147710bb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141692
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index f5f128fbb508..eaa3385ab16f 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -42,11 +41,6 @@
 #include 
 #include 
 
-static OUString PDFFilterResId(TranslateId aId)
-{
-return Translate::get(aId, Translate::Create("flt"));
-}
-
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
@@ -863,7 +857,7 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, 
TogglePDFVersionOrUniversalAccessibilityHa
 {
 std::unique_ptr 
xBox(Application::CreateMessageDialog(m_xContainer.get(),
   VclMessageType::Warning, 
VclButtonsType::Ok,
-  
PDFFilterResId(STR_WARN_PASSWORD_PDFA)));
+  
FilterResId(STR_WARN_PASSWORD_PDFA)));
 xBox->run();
 }
 }
@@ -1114,10 +1108,10 @@ void ImpPDFTabViewerPage::SetFilterConfigItem( const  
ImpPDFTabDialog* pParent )
 /// The Security preferences tab page
 ImpPDFTabSecurityPage::ImpPDFTabSecurityPage(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& i_rCoreSet)
 : SfxTabPage(pPage, pController, "filter/ui/pdfsecuritypage.ui", 
"PdfSecurityPage", _rCoreSet)
-, msUserPwdTitle( PDFFilterResId( STR_PDF_EXPORT_UDPWD ) )
+, msUserPwdTitle( FilterResId( STR_PDF_EXPORT_UDPWD ) )
 , mbHaveOwnerPassword( false )
 , mbHaveUserPassword( false )
-, msOwnerPwdTitle( PDFFilterResId( STR_PDF_EXPORT_ODPWD ) )
+, msOwnerPwdTitle( FilterResId( STR_PDF_EXPORT_ODPWD ) )
 , mxPbSetPwd(m_xBuilder->weld_button("setpassword"))
 , mxUserPwdSet(m_xBuilder->weld_widget("userpwdset"))
 , mxUserPwdUnset(m_xBuilder->weld_widget("userpwdunset"))
@@ -1485,19 +1479,19 @@ ImplErrorDialog::ImplErrorDialog(weld::Window* pParent, 
const std::setappend(PDFFilterResId(STR_WARN_TRANSP_PDFA), 
PDFFilterResId(STR_WARN_TRANSP_PDFA_SHORT), "dialog-warning");
+m_xErrors->append(FilterResId(STR_WARN_TRANSP_PDFA), 
FilterResId(STR_WARN_TRANSP_PDFA_SHORT), "dialog-warning");
 break;
 case vcl::PDFWriter::Warning_Transparency_Omitted_PDF13:
-m_xErrors->append(PDFFilterResId(STR_WARN_TRANSP_VERSION), 
PDFFilterResId(STR_WARN_TRANSP_VERSION_SHORT), "dialog-warning");
+m_xErrors->append(FilterResId(STR_WARN_TRANSP_VERSION), 
FilterResId(STR_WARN_TRANSP_VERSION_SHORT), "dialog-warning");
 break;
 case vcl::PDFWriter::Warning_FormAction_Omitted_PDFA:
-m_xErrors->append(PDFFilterResId(STR_WARN_FORMACTION_PDFA), 
PDFFilterResId(STR_WARN_FORMACTION_PDFA_SHORT), "dialog-warning");
+m_xErrors->append(FilterResId(STR_WARN_FORMACTION_PDFA), 
FilterResId(STR_WARN_FORMACTION_PDFA_SHORT), "dialog-warning");
 break;
 case vcl::PDFWriter::Warning_Transparency_Converted:
-m_xErrors->append(PDFFilterResId(STR_WARN_TRANSP_CONVERTED), 
PDFFilterResId(STR_WARN_TRANSP_CONVERTED_SHORT), "dialog-warning");
+m_xErrors->append(FilterResId(STR_WARN_TRANSP_CONVERTED), 
FilterResId(STR_WARN_TRANSP_CONVERTED_SHORT), "dialog-warning");
 break;
 case vcl::PDFWriter::Error_Signature_Failed:
-m_xErrors->append(PDFFilterResId(STR_ERR_PDF_EXPORT_ABORTED), 
PDFFilterResId(STR_ERR_SIGNATURE_FAILED), "dialog-error");
+m_xErrors->append(FilterResId(STR_ERR_PDF_EXPORT_ABORTED), 

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

2022-10-24 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/tests.cxx |   28 +++-
 1 file changed, 11 insertions(+), 17 deletions(-)

New commits:
commit 8ae0ce1bfa9fe6fa7fa54bafb5541c3f78d9e9b5
Author: Kevin Suo 
AuthorDate: Fri Oct 21 00:40:19 2022 +0800
Commit: Noel Grandin 
CommitDate: Mon Oct 24 09:13:11 2022 +0200

sdext.pdfimport: refactor this unit test and active it for Windows

This unit test was disabled for Windows build in commit 
fc45e54be6ba5d4685ae4ef3c3ea696fc99cccd4,
due to the "crashes on the windows jenkins boxes".

In this patch, I:
1. Rename the test name to show its purpose for easier reading;
2. Test the whole string all at once using xpath, rather than use indexOf().
   This way we can not only test the existance of the characters, but also
   the order they appear.
3. Activate it for Windows build and hope it passes on Jenkins.
4. Remove the std::cout debug code, and use CPPUNIT_ASSERT_EQUAL_MESSAGE
   instead, so that the xml content (i.e. aOutput) is only shown when the
   assertion fails.
5. Move the test document to testdocs directory.

Change-Id: I39084eb4ddc451ecac5183213b7e6166facf617b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141601
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/test/testTdf141709.pdf 
b/sdext/source/pdfimport/test/testdocs/testTdf141709_chinesechar.pdf
similarity index 100%
rename from sdext/source/pdfimport/test/testTdf141709.pdf
rename to sdext/source/pdfimport/test/testdocs/testTdf141709_chinesechar.pdf
diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 7cff15a36d0f..71661ae9e6d5 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -556,32 +556,26 @@ namespace
 #endif
 }
 
-void testTdf141709()
+void testTdf141709_chinesechar()
 {
 // this test crashes on the windows jenkins boxes, but no-one can catch it 
locally
-#if HAVE_FEATURE_POPPLER && !defined(_WIN32)
+#if HAVE_FEATURE_POPPLER
 rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
 xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
 
 OString aOutput;
 CPPUNIT_ASSERT_MESSAGE("Exporting to ODF",
-
xAdaptor->odfConvert(m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testTdf141709.pdf"),
+
xAdaptor->odfConvert(m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/testTdf141709_chinesechar.pdf"),
 new OutputWrapString(aOutput),
 nullptr));
-std::cout << aOutput << std::endl;
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
 // This ensures that the imported text contains all of the 
characters
-CPPUNIT_ASSERT(aOutput.indexOf("敏") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("捷") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("的") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("狐") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("狸") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("跨") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("过") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("慵") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("懒") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("的") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("狗") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("。") != -1);
+OString xpath = 
"//draw:frame[@draw:z-index='3'][1]/draw:text-box/text:p/text:span[1]";
+OUString  sContent = getXPathContent(pXmlDoc, 
xpath).replaceAll("\n", "");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"敏捷的狐狸跨过慵懒的"), sContent);
+xpath = 
"//draw:frame[@draw:z-index='4'][1]/draw:text-box/text:p/text:span[1]";
+sContent = getXPathContent(pXmlDoc, xpath).replaceAll("\n", "");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"狗。"), 
sContent);
 #endif
 }
 
@@ -854,7 +848,7 @@ namespace
 CPPUNIT_TEST(testTdf96993);
 CPPUNIT_TEST(testTdf98421);
 CPPUNIT_TEST(testTdf105536);
-CPPUNIT_TEST(testTdf141709);
+CPPUNIT_TEST(testTdf141709_chinesechar);
 CPPUNIT_TEST(testTdf78427_FontFeatures);
 CPPUNIT_TEST(testTdf78427_FontWeight_MyraidProSemibold);
 CPPUNIT_TEST(testTdf143959_nameFromFontFile);


[Libreoffice-commits] core.git: filter/inc filter/Library_xmlfa.mk filter/source

2022-10-23 Thread Kevin Suo (via logerrit)
 filter/Library_xmlfa.mk |5 +
 filter/inc/strings.hrc  |   12 
 filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx |6 --
 3 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit a97bae545d72d8b19f39aa9280c0f284c79d0f6c
Author: Kevin Suo 
AuthorDate: Sat Oct 22 14:15:35 2022 +0800
Commit: Noel Grandin 
CommitDate: Sun Oct 23 17:56:22 2022 +0200

tdf#151697: Use localized string for "Loading" and "Saving" in status bar

Change-Id: I51967950839e7384e8f31178a70bd944d6f9059c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141662
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/filter/Library_xmlfa.mk b/filter/Library_xmlfa.mk
index 35a2dd9ff9b6..e1157cca3059 100644
--- a/filter/Library_xmlfa.mk
+++ b/filter/Library_xmlfa.mk
@@ -25,6 +25,11 @@ $(eval $(call gb_Library_use_external,xmlfa,boost_headers))
 
 $(eval $(call gb_Library_use_sdk_api,xmlfa))
 
+$(eval $(call gb_Library_set_include,xmlfa,\
+   $$(INCLUDE) \
+   -I$(SRCDIR)/filter/inc \
+))
+
 $(eval $(call gb_Library_use_libraries,xmlfa,\
comphelper \
cppuhelper \
diff --git a/filter/inc/strings.hrc b/filter/inc/strings.hrc
index eecfdb33e2d0..a8454956f385 100644
--- a/filter/inc/strings.hrc
+++ b/filter/inc/strings.hrc
@@ -19,6 +19,9 @@
 
 #pragma once
 
+#include 
+#include 
+
 #define NC_(Context, String) TranslateId(Context, reinterpret_cast(u8##String))
 
 #define STR_UNKNOWN_APPLICATION NC_("STR_UNKNOWN_APPLICATION", 
"Unknown")
@@ -73,4 +76,13 @@
 #define STR_ERR_SIGNATURE_FAILED
NC_("STR_ERR_SIGNATURE_FAILED", "Signature generation failed")
 #define STR_ERR_PDF_EXPORT_ABORTED  
NC_("STR_ERR_PDF_EXPORT_ABORTED", "PDF export aborted")
 
+// Progress bar status indicator when importing or exporting
+#define STR_FILTER_DOC_LOADING  NC_("STR_FILTER_DOC_LOADING", 
"Loading: ")
+#define STR_FILTER_DOC_SAVING   NC_("STR_FILTER_DOC_SAVING", 
"Saving: ")
+
+static inline OUString FilterResId(TranslateId aId)
+{
+return Translate::get(aId, Translate::Create("flt"));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx 
b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
index 11686e7c919e..525f567b67c0 100644
--- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
@@ -43,6 +43,8 @@
 #include 
 #include 
 
+#include 
+
 using namespace comphelper;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
@@ -67,7 +69,7 @@ bool XmlFilterAdaptor::importImpl( const Sequence< 
css::beans::PropertyValue >&
 utl::MediaDescriptor::PROP_STATUSINDICATOR, Reference< 
XStatusIndicator >()));
 
 if (xStatusIndicator.is()){
-xStatusIndicator->start( "Loading :", 4);
+xStatusIndicator->start(FilterResId(STR_FILTER_DOC_LOADING), 4);
 }
 
 OUString aBaseURI;
@@ -233,7 +235,7 @@ bool XmlFilterAdaptor::exportImpl( const Sequence< 
css::beans::PropertyValue >&
 utl::MediaDescriptor::PROP_STATUSINDICATOR, Reference< 
XStatusIndicator >()));
 
 if (xStatusIndicator.is())
-   xStatusIndicator->start( "Saving :", 3);
+   xStatusIndicator->start(FilterResId(STR_FILTER_DOC_SAVING), 3);
 
 // Set up converter bridge.
 Reference< css::xml::XExportFilter > 
xConverter(mxContext->getServiceManager()->createInstanceWithContext( 
udConvertClass, mxContext ), UNO_QUERY);


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

2022-10-19 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/tests.cxx  |   30 ++---
 sdext/source/pdfimport/tree/writertreevisiting.cxx |   46 +++--
 sdext/source/pdfimport/tree/writertreevisiting.hxx |4 +
 3 files changed, 70 insertions(+), 10 deletions(-)

New commits:
commit f6004e1c457ddab5e0c91e6159875d25130b108a
Author: Kevin Suo 
AuthorDate: Sat Oct 15 19:43:54 2022 +0800
Commit: Thorsten Behrens 
CommitDate: Wed Oct 19 21:34:13 2022 +0200

tdf#151546: RTL text is reversed (Writer pdfimport)

This is a followup to commit 69e9925ded584113e52f84ef0ed7c224079fa061
for the fix of tdf#104597.

The Writer pdf import filter code is similar than the Draw part.
However, many fixes to the Draw part was not done in the Writer part 
historically.

This patch ports the fix of text run in the Draw part to the Writer
part. There is a todo related to continuous spaces issue which should
be fixed separately.

Also use CPPUNIT_ASSERT_EQUAL_MESSAGE for the output of xml content
instread of using std::cout, in case of unit test failure.

Change-Id: Id013700524750e6e5283d85eeab72d8075f16f1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141420
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 25c12a23901c..7cff15a36d0f 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -799,36 +799,54 @@ namespace
 new OutputWrapString(aOutput),
 nullptr));
 
-// std::cout << aOutput << std::endl;
 xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
 
 // Test for امُ عَلَيْكَ
 // TODO: How to get the "عَلَيْكَ" in xpath, as shown after the 
 tag?
 OString xpath = 
"//draw:frame[@draw:transform='matrix(917. 0 0 917. 
14821.958333 2159.23861112778)']/draw:text-box/text:p/text:span";
 OUString sContent = getXPathContent(pXmlDoc, xpath); // 
u"\nا\nُ\nم\n"
-CPPUNIT_ASSERT_EQUAL(OUString(u"اُم"), sContent.replaceAll("\n", 
""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"اُم"), 
sContent.replaceAll("\n", ""));
 
 // Test for ٱلَّسَل‬ . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
 // thus these two frames together appear as ٱلَّسَل امُ عَلَيْكَ 
in Draw‬.
 xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 17420.17 
2159.23861112778)']/draw:text-box/text:p/text:span";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL(OUString(u"ٱلَّسَل"), 
sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"ٱلَّسَل"), sContent.replaceAll("\n", ""));
 
 // Test for "LibreOffice LTR"
 // TODO: How to get the "LTR" as shown after the  tag?
 xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 12779.375 5121.79583335)']/draw:text-box/text:p/text:span";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL(OUString(u"LibreOffice"), 
sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"LibreOffice"), sContent.replaceAll("\n", ""));
 
 /* Test for Chinese characters */
 // Use last() instead of matrix below, because the matrix may be 
different on different OS due to fallback of Chinese fonts.
 xpath = "//draw:frame[last()]/draw:text-box/text:p/text:span";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL(OUString(u"中文测试,中文"), 
sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"中文测试,中文"), sContent.replaceAll("\n", ""));
+
+// Test pdf text run in the Writer PDF import filter
+xAdaptor->setTreeVisitorFactory(createWriterTreeVisitorFactory());
+OString aOutput2;
+
xAdaptor->odfConvert(m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf"),
+new OutputWrapString(aOutput2),
+nullptr);
+// FIXME: the same draw:frame is duplicated in the xml output,
+// e.g. there are two draw:frame with draw:z-index="3" with the 
same content.
+xmlDocUniquePtr pXmlDoc2(xmlParseDoc(reinterpret_cast(aOutput2.getStr(;
+xpath = 
"//draw:frame[@draw:z-index='3'][1]/draw:text-box/text:p/text:span";
+sContent = getXPathContent(pXmlDoc2, xpath).replaceAll("\n", "");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput2.getStr(), 
OUString(u"ٱلَّسَل"), 

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

2022-10-13 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf |binary
 sdext/source/pdfimport/test/tests.cxx  |   44 +
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |   17 +
 sdext/source/pdfimport/tree/pdfiprocessor.cxx  |   18 -
 4 files changed, 48 insertions(+), 31 deletions(-)

New commits:
commit 69e9925ded584113e52f84ef0ed7c224079fa061
Author: Kevin Suo 
AuthorDate: Tue Oct 11 10:04:16 2022 +0800
Commit: Thorsten Behrens 
CommitDate: Thu Oct 13 21:38:12 2022 +0200

sdext.pdfimport: resolves tdf#104597: RTL script text runs are reversed

For the simple Arabic string: ٱلسَّلَامُ عَلَيْك, the xpdfimport binary 
generates the
follwing (drawchar) sequences:
كَ
يْ
لَ
عَ
مُ
ا
لَ
سَّ
ل
ٱ
(i.e., in reversed order, one character by one character).

Before this patch, after pdfimport the text shows up as لَسَّلٱ كَيْلَعَ 
مُا, which is reversed.

It was surposed to combine these characters into text frames in
DrawXmlOptimizer::optimizeTextElements(Element& rParent) 
(sdext/source/pdfimport/\
tree/drawtreevisiting.cxx:677), but actually it was not combined 
successfully there.
The single characters were then passed to 
sdext/source/pdfimport/tree/drawtreevisiting\
.cxx:105, one by one, in the hope that the strings could be mirrored. The 
mirroring
failed, because one single character, even after mirroring, always equals 
itself.

The DrawXmlOptimizer::optimizeTextElements failed to combine the characters 
into
one text frame, because the condition:
(rCurGC.Transformation == rNextGC.Transformation || notTransformed(rNextGC))
would never be true, as at least its horizontal position is different. A 
further analysis
indicates that we do not need to check the transformation here at all, as 
this is an
optimizer for a TextElement and in case a character is transformed then it 
would already
be in a different draw element (thus will never be combined with this 
TextElement).

After the fix of DrawXmlOptimizer::optimizeTextElements which now 
successfully
combines the characters, there is another issue in the old 
PDFIProcessor::mirrorString
function. It seems to mirror the characters within a word, but if a string 
contains
two words, then the two words are not successfully switched (e.g. for 
string "abc def"
it produces "cba fed" rather than "fed cba"),  which is not suitable for
the case of RTL which requires all the characters been reversed. Fix this 
by using
comphelper::string::reverseString.

Change-Id: Ifa210836f1ddd56205ff0d243adfb4114794
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141231
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf 
b/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf
new file mode 100644
index ..dcee96aa3169
Binary files /dev/null and 
b/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf differ
diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 193ec2227620..25c12a23901c 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -786,6 +787,48 @@ namespace
 #endif
 }
 
+void testTdf104597_textrun()
+{
+#if HAVE_FEATURE_POPPLER
+rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
+xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
+
+OString aOutput;
+CPPUNIT_ASSERT_MESSAGE("Converting PDF to ODF XML",
+
xAdaptor->odfConvert(m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf"),
+new OutputWrapString(aOutput),
+nullptr));
+
+// std::cout << aOutput << std::endl;
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
+
+// Test for امُ عَلَيْكَ
+// TODO: How to get the "عَلَيْكَ" in xpath, as shown after the 
 tag?
+OString xpath = 
"//draw:frame[@draw:transform='matrix(917. 0 0 917. 
14821.958333 2159.23861112778)']/draw:text-box/text:p/text:span";
+OUString sContent = getXPathContent(pXmlDoc, xpath); // 
u"\nا\nُ\nم\n"
+CPPUNIT_ASSERT_EQUAL(OUString(u"اُم"), sContent.replaceAll("\n", 
""));
+
+// Test for ٱلَّسَل‬ . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
+// thus these two frames together appear as ٱلَّسَل امُ عَلَيْكَ 
in Draw‬.
+xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sfx2/source

2022-10-04 Thread Kevin Suo (via logerrit)
 sfx2/source/doc/doctempl.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit e2b9f3ea1ba70f07c3db56a331d6b926c8facb81
Author: Kevin Suo 
AuthorDate: Fri Sep 30 14:21:10 2022 +0800
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Oct 5 05:34:34 2022 +0200

Templates: Make localized names for "Simple" and "BPMN" show on the UI

Currently there are 32 localized template name strings defined in:
include/sfx2/strings.hrc. However, in sfx2/source/doc/doctempl.cxx
only 30 were used. This makes STR_TEMPLATE_NAME31 ("Simple") and
STR_TEMPLATE_NAME32 ("BPMN"), although already localized, not show up
on the Template Manager UI.

This patch adds these two strings in the sfx2/source/doc/doctempl.cxx,
so that they properly show as localized strings on the UI.

Change-Id: I64bb28cfe0a4d3b4b41c9114de7223014f6a3cfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140785
Tested-by: Jenkins
Reviewed-by: Rafael Lima 
Reviewed-by: Laurent Balland 
(cherry picked from commit 244063d03117119d048376c84e22cf47c4abd250)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140956
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Adolfo Jayme Barrientos 

diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index f464ab66f4a3..ebf2ddce4a1f 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -492,7 +492,9 @@ OUString SfxDocumentTemplates::ConvertResourceString(const 
OUString& rString)
 STR_TEMPLATE_NAME27_DEF,
 STR_TEMPLATE_NAME28_DEF,
 STR_TEMPLATE_NAME29_DEF,
-STR_TEMPLATE_NAME30_DEF
+STR_TEMPLATE_NAME30_DEF,
+STR_TEMPLATE_NAME31_DEF,
+STR_TEMPLATE_NAME32_DEF,
 };
 
 TranslateId STR_TEMPLATE_NAME[] =
@@ -526,7 +528,9 @@ OUString SfxDocumentTemplates::ConvertResourceString(const 
OUString& rString)
 STR_TEMPLATE_NAME27,
 STR_TEMPLATE_NAME28,
 STR_TEMPLATE_NAME29,
-STR_TEMPLATE_NAME30
+STR_TEMPLATE_NAME30,
+STR_TEMPLATE_NAME31,
+STR_TEMPLATE_NAME32,
 };
 
 static_assert(SAL_N_ELEMENTS(aTemplateNames) == 
SAL_N_ELEMENTS(STR_TEMPLATE_NAME));


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sfx2/source

2022-10-04 Thread Kevin Suo (via logerrit)
 sfx2/source/doc/doctempl.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit ddd45141f5d20dcba22a379797be62eab7b93d73
Author: Kevin Suo 
AuthorDate: Fri Sep 30 14:21:10 2022 +0800
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Oct 5 05:33:44 2022 +0200

Templates: Make localized names for "Simple" and "BPMN" show on the UI

Currently there are 32 localized template name strings defined in:
include/sfx2/strings.hrc. However, in sfx2/source/doc/doctempl.cxx
only 30 were used. This makes STR_TEMPLATE_NAME31 ("Simple") and
STR_TEMPLATE_NAME32 ("BPMN"), although already localized, not show up
on the Template Manager UI.

This patch adds these two strings in the sfx2/source/doc/doctempl.cxx,
so that they properly show as localized strings on the UI.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140785
Tested-by: Jenkins
Reviewed-by: Rafael Lima 
Reviewed-by: Laurent Balland 
(cherry picked from commit 244063d03117119d048376c84e22cf47c4abd250)

Conflicts:
sfx2/source/doc/doctempl.cxx

Change-Id: I64bb28cfe0a4d3b4b41c9114de7223014f6a3cfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140945
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index a7fcb4c8b3fd..edb401aa7363 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -492,7 +492,9 @@ OUString SfxDocumentTemplates::ConvertResourceString(const 
OUString& rString)
 u"" STR_TEMPLATE_NAME27_DEF,
 u"" STR_TEMPLATE_NAME28_DEF,
 u"" STR_TEMPLATE_NAME29_DEF,
-u"" STR_TEMPLATE_NAME30_DEF
+u"" STR_TEMPLATE_NAME30_DEF,
+u"" STR_TEMPLATE_NAME31_DEF,
+u"" STR_TEMPLATE_NAME32_DEF,
 };
 
 TranslateId STR_TEMPLATE_NAME[] =
@@ -526,7 +528,9 @@ OUString SfxDocumentTemplates::ConvertResourceString(const 
OUString& rString)
 STR_TEMPLATE_NAME27,
 STR_TEMPLATE_NAME28,
 STR_TEMPLATE_NAME29,
-STR_TEMPLATE_NAME30
+STR_TEMPLATE_NAME30,
+STR_TEMPLATE_NAME31,
+STR_TEMPLATE_NAME32,
 };
 
 static_assert(SAL_N_ELEMENTS(aTemplateNames) == 
SAL_N_ELEMENTS(STR_TEMPLATE_NAME));


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

2022-10-04 Thread Kevin Suo (via logerrit)
 sfx2/source/doc/doctempl.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 244063d03117119d048376c84e22cf47c4abd250
Author: Kevin Suo 
AuthorDate: Fri Sep 30 14:21:10 2022 +0800
Commit: Laurent Balland 
CommitDate: Tue Oct 4 15:07:16 2022 +0200

Templates: Make localized names for "Simple" and "BPMN" show on the UI

Currently there are 32 localized template name strings defined in:
include/sfx2/strings.hrc. However, in sfx2/source/doc/doctempl.cxx
only 30 were used. This makes STR_TEMPLATE_NAME31 ("Simple") and
STR_TEMPLATE_NAME32 ("BPMN"), although already localized, not show up
on the Template Manager UI.

This patch adds these two strings in the sfx2/source/doc/doctempl.cxx,
so that they properly show as localized strings on the UI.

Change-Id: I64bb28cfe0a4d3b4b41c9114de7223014f6a3cfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140785
Tested-by: Jenkins
Reviewed-by: Rafael Lima 
Reviewed-by: Laurent Balland 

diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index 4d08e3030359..2699f7adaa14 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -493,7 +493,9 @@ OUString SfxDocumentTemplates::ConvertResourceString(const 
OUString& rString)
 STR_TEMPLATE_NAME27_DEF,
 STR_TEMPLATE_NAME28_DEF,
 STR_TEMPLATE_NAME29_DEF,
-STR_TEMPLATE_NAME30_DEF
+STR_TEMPLATE_NAME30_DEF,
+STR_TEMPLATE_NAME31_DEF,
+STR_TEMPLATE_NAME32_DEF,
 };
 
 TranslateId STR_TEMPLATE_NAME[] =
@@ -527,7 +529,9 @@ OUString SfxDocumentTemplates::ConvertResourceString(const 
OUString& rString)
 STR_TEMPLATE_NAME27,
 STR_TEMPLATE_NAME28,
 STR_TEMPLATE_NAME29,
-STR_TEMPLATE_NAME30
+STR_TEMPLATE_NAME30,
+STR_TEMPLATE_NAME31,
+STR_TEMPLATE_NAME32,
 };
 
 static_assert(SAL_N_ELEMENTS(aTemplateNames) == 
SAL_N_ELEMENTS(STR_TEMPLATE_NAME));


[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-4+backports' - sdext/source

2022-09-15 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx|   52 --
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |   18 +++---
 2 files changed, 10 insertions(+), 60 deletions(-)

New commits:
commit 020931b82a0226f6167969bd5ea28262092ce23d
Author: Kevin Suo 
AuthorDate: Sat Jul 10 11:47:39 2021 +0800
Commit: Thorsten Behrens 
CommitDate: Thu Sep 15 22:12:39 2022 +0200

tdf#78427 sdext.pdfimport: No need to read a font file for the purpose of...

...determining the bold/italic/underline etc.

The purpose for reading a font file is that in case the font attributes 
determined by the xpdfimport process is not enough, then we use the lo core 
font classes which read in the font file and then determine whether it is bold, 
italic etc.
However, while this works in some cases, it does not work in many cases 
when the font file was actually a subset and a toUnicode map is followed in the 
PDF, see tdf#78427.
In addition, in case the information collected from the xpdfimport process 
is enough, there is no need to read the font file.

This commit removes the read of font file part. Also, this commit uses 
gfxFont->getNameWithoutSubsetTag() to get the font name with the subset tags 
removed, thus simplified the code in wrapper.cxx while also improves performace 
as the remove of subset tags is only run when the font is a subset (the 
previous code did this for all the font names).

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118733
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
(cherry picked from commit da59686672fd2bc98f8cb28d5f04dc978b50ac13)

restore compatibility with older popplers

with poppler 20.09:


/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:
 In member function 'int
 pdfi::PDFOutDev::parseFont(long long int, GfxFont*, 
GfxState*) const':

/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:438:39:
 error: 'class
 GfxFont' has no member named 'getNameWithoutSubsetTag'


https://www.google.com/search?q=getNameWithoutSubsetTag=getNameWithoutSubsetTag=chrome..69i57.784j0j7=chrome=UTF-8
 suggests it was added in 20.12

Change-Id: I4eacd2d740cb689ff9b3c6cab59376e01b1ba162
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118977
Tested-by: René Engelhard 
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 07087041610ca8351d764c838ae07fa58f3bdf9e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140010
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 3d36e77110be..ad25b2edd85b 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -486,12 +486,6 @@ void Parser::parseFontFamilyName( FontAttributes& rResult )
 
 const sal_Unicode* pCopy = rResult.familyName.getStr();
 sal_Int32 nLen = rResult.familyName.getLength();
-// parse out truetype subsets (e.g. BA+Thorndale)
-if( nLen > 8 && pCopy[6] == '+' )
-{
-pCopy += 7;
-nLen -= 7;
-}
 
 // TODO: Looks like this block needs to be refactored
 while( nLen )
@@ -613,52 +607,6 @@ void Parser::readFont()
 
 // extract textual attributes (bold, italic in the name, etc.)
 parseFontFamilyName(aResult);
-// need to read font file?
-if( nFileLen )
-{
-uno::Sequence aFontFile(nFileLen);
-readBinaryData( aFontFile );
-
-awt::FontDescriptor aFD;
-uno::Sequence< uno::Any > aArgs(1);
-aArgs[0] <<= aFontFile;
-
-try
-{
-uno::Reference< beans::XMaterialHolder > xMat(
-
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
-"com.sun.star.awt.FontIdentificator", aArgs, m_xContext ),
-uno::UNO_QUERY );
-if( xMat.is() )
-{
-uno::Any aRes( xMat->getMaterial() );
-if( aRes >>= aFD )
-{
-if (!aFD.Name.isEmpty())
-{
-aResult.familyName = aFD.Name;
-parseFontFamilyName(aResult);
-}
-aResult.isBold  = (aFD.Weight > 100.0);
-aResult.isItalic= (aFD.Slant == awt::FontSlant_OBLIQUE 
||
-   aFD.Slant == awt::FontSlant_ITALIC 
);
-aResult.isUnderline = false;
-aResult.size= 0;
-}
-}
-}
-catch( uno::Exception& )
-{
-}
-
-if( aResult.familyName.isEmpty() )
-{
-// last fallback
-

[Libreoffice-commits] core.git: officecfg/registry

2022-04-12 Thread Kevin Suo (via logerrit)
 officecfg/registry/data/org/openoffice/VCL.xcu |   24 
 1 file changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 22c7ce6c8e7d5b7f8b37ad6c519c2b8ca4853724
Author: Kevin Suo 
AuthorDate: Sun Jan 23 14:57:41 2022 +0800
Commit: Eike Rathke 
CommitDate: Tue Apr 12 19:28:35 2022 +0200

UI Workaround for tdf#146653: change localized Source Han {Sans,Serif} CN...

...to Source Han Sans CN Normal and Source Han Serif CN Medium for 
Simplified Chinese UI, so that
the font shown is not bold.

Tranditional Chinese and Japanese settings are not touched. It is up to the
zh-TW and JA l10n team to decide whether to apply the same change.

This does not resolve the bug itself, but makes the UI usable when the
system has Source Han Sans CN or Source Han Serif CN fonts installed,
so that the default font used is normal weight rather than bold.

Change-Id: I52753448d886854d92ba8a26d8b03bf42522735f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128798
Tested-by: Jenkins
Reviewed-by: Franklin Weng 
Reviewed-by: Eike Rathke 

diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu 
b/officecfg/registry/data/org/openoffice/VCL.xcu
index 632da84ebbcf..bfe914aef2e7 100644
--- a/officecfg/registry/data/org/openoffice/VCL.xcu
+++ b/officecfg/registry/data/org/openoffice/VCL.xcu
@@ -261,19 +261,19 @@
 思源黑体 HW;Source Han Sans HW SC;Noto Sans Mono CJK 
SC;新宋体;NSimSun;Liberation Mono;Menlo;Courier New;Monospaced
   
   
-思源黑体;Source Han Sans SC;思源黑体 CN;Source Han Sans CN;Noto Sans 
SC;Noto Sans CJK SC;微软雅黑;Microsoft Yahei;新宋体;NSimSun;萍方-简;PingFang 
SC;华文细黑;STXihei;Arial Unicode MS;Tahoma
+思源黑体 Normal;Source Han Sans SC;思源黑体 CN Normal;Source Han Sans 
CN;Noto Sans SC;Noto Sans CJK SC;微软雅黑;Microsoft Yahei;新宋体;NSimSun;萍方-简;PingFang 
SC;华文细黑;STXihei;Arial Unicode MS;Tahoma
   
   
-思源黑体;Source Han Sans SC;思源黑体 CN;Source Han Sans CN;Noto Sans 
SC;Noto Sans CJK SC;微软雅黑;Microsoft Yahei;新宋体;NSimSun;萍方-简;PingFang 
SC;华文细黑;STXihei;Arial Unicode MS;Tahoma
+思源黑体 Normal;Source Han Sans SC;思源黑体 CN Normal;Source Han Sans 
CN;Noto Sans SC;Noto Sans CJK SC;微软雅黑;Microsoft Yahei;新宋体;NSimSun;萍方-简;PingFang 
SC;华文细黑;STXihei;Arial Unicode MS;Tahoma
   
   
-思源黑体;Source Han Sans SC;思源黑体 CN;Source Han Sans CN;Noto Sans 
SC;Noto Sans CJK SC;微软雅黑;Microsoft Yahei;新宋体;NSimSun;萍方-简;PingFang 
SC;华文细黑;STXihei;Arial Unicode MS;Tahoma
+思源黑体 Normal;Source Han Sans SC;思源黑体 CN Normal;Source Han Sans 
CN;Noto Sans SC;Noto Sans CJK SC;微软雅黑;Microsoft Yahei;新宋体;NSimSun;萍方-简;PingFang 
SC;华文细黑;STXihei;Arial Unicode MS;Tahoma
   
   
-思源黑体;Source Han Sans SC;思源黑体 CN;Source Han Sans CN;Noto Sans 
SC;Noto Sans CJK SC;微软雅黑;Microsoft Yahei;新宋体;NSimSun;萍方-简;PingFang 
SC;华文细黑;STXihei;Arial Unicode MS;Tahoma
+思源黑体 Normal;Source Han Sans SC;思源黑体 CN Normal;Source Han Sans 
CN;Noto Sans SC;Noto Sans CJK SC;微软雅黑;Microsoft Yahei;新宋体;NSimSun;萍方-简;PingFang 
SC;华文细黑;STXihei;Arial Unicode MS;Tahoma
   
   
-思源宋体;Source Han Serif SC;思源宋体 CN;Source Han Serif CN;Noto Serif 
SC;Noto Serif CJK SC;新宋体;NSimSun;宋体;SimSun;华文宋体;Songti SC;STSong;Arial Unicode 
MS;Tahoma
+思源宋体 Medium;Source Han Serif SC;思源宋体 CN Medium;Source Han Serif 
CN;Noto Serif SC;Noto Serif CJK SC;新宋体;NSimSun;宋体;SimSun;华文宋体;Songti 
SC;STSong;Arial Unicode MS;Tahoma
   
   
 思源黑体 HW;Source Han Sans HW SC;Noto Sans Mono CJK 
SC;新宋体;NSimSun;Liberation Mono;Menlo;Courier New;Monospaced
@@ -282,7 +282,7 @@
 思源黑体 HW;Source Han Sans HW SC;Noto Sans Mono CJK 
SC;新宋体;NSimSun;Liberation Mono;Menlo;Courier New;Monospaced
   
   
-思源黑体;Source Han Sans SC;思源黑体 CN;Source Han Sans CN;Noto Sans 
SC;Noto Sans CJK SC;微软雅黑;Microsoft Yahei;新宋体;NSimSun;宋体;SimSun;萍方-简;PingFang 
SC;华文细黑;STXihei;Segoe UI;Tahoma;San Francisco;Lucida Grande;Sans Serif
+思源黑体 Normal;Source Han Sans SC;思源黑体 CN Normal;Source Han Sans 
CN;Noto Sans SC;Noto Sans CJK SC;微软雅黑;Microsoft 
Yahei;新宋体;NSimSun;宋体;SimSun;萍方-简;PingFang SC;华文细黑;STXihei;Segoe UI;Tahoma;San 
Francisco;Lucida Grande;Sans Serif
   
 
 
@@ -377,19 +377,19 @@
 思源黑体 HW;Source Han Sans HW SC;思源黑体 CN;Source Han Sans CN;Noto 
Sans Mono CJK SC;新宋体;NSimSun;Liberation Mono;Menlo;Courier 
New;Monospaced
   
   
-思源黑体;Source Han Sans SC;思源黑体 CN;Source Han Sans CN;Noto Sans 
SC;Noto Sans CJK SC;微软雅黑;Microsoft Yahei;新宋体;NSimSun;萍方-简;PingFang 
SC;华文细黑;STXihei;Arial Unicode MS;Tahoma
+思源黑体 Normal;Source Han Sans SC;思源黑体 CN Normal;Source Han Sans 
CN;Noto Sans SC;Noto Sans CJK SC;微软雅黑;Microsoft Yahei;新宋体;NSimSun;萍方-简;PingFang 
SC;华文细黑;STXihei;Arial Unicode MS;Tahoma
   
   
-思源黑体;Source Han Sans SC;思源黑体 CN;Source Han Sans CN;Noto Sans 
SC;Noto Sans CJK SC;微软雅黑;Microsoft Yahei;新宋体;NSimSun;萍方-简;PingFang 
SC;华文细黑;STXihei;Arial Unicode MS;Tahoma
+思源黑体 Normal;Source Han 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sdext/source

2022-02-08 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/wrapper.hxx |   12 
 sdext/source/pdfimport/wrapper/wrapper.cxx |   26 +-
 2 files changed, 37 insertions(+), 1 deletion(-)

New commits:
commit bb5a8696dc85723e324d1201acd3f68c32220e24
Author: Kevin Suo 
AuthorDate: Sat Jan 29 21:44:36 2022 +0800
Commit: Xisco Fauli 
CommitDate: Tue Feb 8 11:52:32 2022 +0100

sdext.pdfimport tdf#137128: Recognize more font name and weight...

...values from the embeded 'PS' font names.

Change-Id: I8465a6b1d845ce626848112f0a735a9ee3696e5c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129136
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit bcf10015c5d12d363d0be9f6da25092c83112692)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129430
Reviewed-by: Michael Stahl 

diff --git a/sdext/source/pdfimport/inc/wrapper.hxx 
b/sdext/source/pdfimport/inc/wrapper.hxx
index 9f25e1b7290b..94cc2b24327d 100644
--- a/sdext/source/pdfimport/inc/wrapper.hxx
+++ b/sdext/source/pdfimport/inc/wrapper.hxx
@@ -58,16 +58,28 @@ namespace pdfi
 // and they are checked from the suffix, thus the order matters.
 // e.g. for "TimesNewRomanPS-BoldItalic", to get "TimesNewRoman", you 
should
 //  first have "Italic", and then "Bold", then "-", and then "PS".
+"-VKana",
 "MT",
 "PS",
 "PSMT",
 "Regular",
+"Normal",
+"Book",
+"Medium",
+"ExtraBold",
+"UltraBold",
+"ExtraLight",
+"UltraLight",
 "Bold",
+"Heavy",
+"Black",
 "Italic",
 "Oblique",
 "Bold", //BoldItalic, BoldOblique
 "Light",
+"Thin",
 "Semibold",
+"-Roman",
 "Reg",
 "VKana",
 "-",
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 0560826d5727..cfa256f0acfa 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -492,7 +492,15 @@ void LineParser::parseFontFamilyName( FontAttributes& 
rResult )
 {
 rResult.familyName = 
rResult.familyName.replaceAll(fontAttributesSuffix, "");
 SAL_INFO("sdext.pdfimport", rResult.familyName);
-if (fontAttributesSuffix == u"Bold")
+if (fontAttributesSuffix == u"Heavy" || fontAttributesSuffix == 
u"Black")
+{
+rResult.fontWeight = u"900";
+}
+else if (fontAttributesSuffix == u"ExtraBold" || 
fontAttributesSuffix == u"UltraBold")
+{
+rResult.fontWeight = u"800";
+}
+else if (fontAttributesSuffix == u"Bold")
 {
 rResult.fontWeight = u"bold";
 }
@@ -500,10 +508,26 @@ void LineParser::parseFontFamilyName( FontAttributes& 
rResult )
 {
 rResult.fontWeight = u"600";
 }
+else if (fontAttributesSuffix == u"Medium")
+{
+rResult.fontWeight = u"500";
+}
+else if (fontAttributesSuffix == u"Normal" || fontAttributesSuffix 
== u"Regular" || fontAttributesSuffix == u"Book")
+{
+rResult.fontWeight = u"400";
+}
 else if (fontAttributesSuffix == u"Light")
 {
 rResult.fontWeight = u"300";
 }
+else if (fontAttributesSuffix == u"ExtraLight" || 
fontAttributesSuffix == u"UltraLight")
+{
+rResult.fontWeight = u"200";
+}
+else if (fontAttributesSuffix == u"Thin")
+{
+rResult.fontWeight = u"100";
+}
 
 if ( (fontAttributesSuffix == "Italic") or (fontAttributesSuffix 
== "Oblique") )
 {


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

2022-02-07 Thread Kevin Suo (via logerrit)
 i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |   10 
++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 24e6217c0abdaed703a077e77881ad6e8b4f6f0e
Author: Kevin Suo 
AuthorDate: Sat Jan 29 16:35:12 2022 +0800
Commit: Eike Rathke 
CommitDate: Mon Feb 7 18:52:40 2022 +0100

tdf#77803: Use NATNUM12 and NATNUM4 for Chinese Numberring

For Chinese, format code NATNUM7 and NATNUM8 are "short lower
case text" and "short upper case text", respectively, see [1].
We need full lower and full upper here for numbering purpose, not
"short" form. E.g. for number 100, we need "一百" (lower case)
and "壹佰" (upper case), rather than "百" which is in short form.

Use NATNUM12 for chinese lower, and NATNUM5 for Chinese upper.
See bug 147054 for the reason why we do not use NATNUM4 for Chinese lower.

[1] https://help.libreoffice.org/latest/en-US/text/shared/01/05020301.html

Change-Id: I69c93d62f1026117a6d403ade63a9abfbe5c73f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129143
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git 
a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx 
b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index 831b502a2771..bb1303ad8844 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -752,15 +752,15 @@ DefaultNumberingProvider::makeNumberingString( const 
Sequence

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

2022-02-03 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/wrapper.hxx |   12 
 sdext/source/pdfimport/wrapper/wrapper.cxx |   26 +-
 2 files changed, 37 insertions(+), 1 deletion(-)

New commits:
commit bcf10015c5d12d363d0be9f6da25092c83112692
Author: Kevin Suo 
AuthorDate: Sat Jan 29 21:44:36 2022 +0800
Commit: Noel Grandin 
CommitDate: Fri Feb 4 07:44:18 2022 +0100

sdext.pdfimport tdf#137128: Recognize more font name and weight...

...values from the embeded 'PS' font names.

Change-Id: I8465a6b1d845ce626848112f0a735a9ee3696e5c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129136
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/inc/wrapper.hxx 
b/sdext/source/pdfimport/inc/wrapper.hxx
index 9f25e1b7290b..94cc2b24327d 100644
--- a/sdext/source/pdfimport/inc/wrapper.hxx
+++ b/sdext/source/pdfimport/inc/wrapper.hxx
@@ -58,16 +58,28 @@ namespace pdfi
 // and they are checked from the suffix, thus the order matters.
 // e.g. for "TimesNewRomanPS-BoldItalic", to get "TimesNewRoman", you 
should
 //  first have "Italic", and then "Bold", then "-", and then "PS".
+"-VKana",
 "MT",
 "PS",
 "PSMT",
 "Regular",
+"Normal",
+"Book",
+"Medium",
+"ExtraBold",
+"UltraBold",
+"ExtraLight",
+"UltraLight",
 "Bold",
+"Heavy",
+"Black",
 "Italic",
 "Oblique",
 "Bold", //BoldItalic, BoldOblique
 "Light",
+"Thin",
 "Semibold",
+"-Roman",
 "Reg",
 "VKana",
 "-",
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 0560826d5727..cfa256f0acfa 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -492,7 +492,15 @@ void LineParser::parseFontFamilyName( FontAttributes& 
rResult )
 {
 rResult.familyName = 
rResult.familyName.replaceAll(fontAttributesSuffix, "");
 SAL_INFO("sdext.pdfimport", rResult.familyName);
-if (fontAttributesSuffix == u"Bold")
+if (fontAttributesSuffix == u"Heavy" || fontAttributesSuffix == 
u"Black")
+{
+rResult.fontWeight = u"900";
+}
+else if (fontAttributesSuffix == u"ExtraBold" || 
fontAttributesSuffix == u"UltraBold")
+{
+rResult.fontWeight = u"800";
+}
+else if (fontAttributesSuffix == u"Bold")
 {
 rResult.fontWeight = u"bold";
 }
@@ -500,10 +508,26 @@ void LineParser::parseFontFamilyName( FontAttributes& 
rResult )
 {
 rResult.fontWeight = u"600";
 }
+else if (fontAttributesSuffix == u"Medium")
+{
+rResult.fontWeight = u"500";
+}
+else if (fontAttributesSuffix == u"Normal" || fontAttributesSuffix 
== u"Regular" || fontAttributesSuffix == u"Book")
+{
+rResult.fontWeight = u"400";
+}
 else if (fontAttributesSuffix == u"Light")
 {
 rResult.fontWeight = u"300";
 }
+else if (fontAttributesSuffix == u"ExtraLight" || 
fontAttributesSuffix == u"UltraLight")
+{
+rResult.fontWeight = u"200";
+}
+else if (fontAttributesSuffix == u"Thin")
+{
+rResult.fontWeight = u"100";
+}
 
 if ( (fontAttributesSuffix == "Italic") or (fontAttributesSuffix 
== "Oblique") )
 {


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

2022-02-03 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/genericelements.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 2f605009907166d509ccd1dcb6385e5cd456e3e4
Author: Kevin Suo 
AuthorDate: Mon Jul 12 09:11:15 2021 +0800
Commit: Noel Grandin 
CommitDate: Fri Feb 4 07:43:42 2022 +0100

sdext.pdfimport: these SAL_WARN should be SAL_INFO

SAL_WARN should be some message which showns where the program
runs abnormally. Normal debugging output code should be SAL_INFO,
and if you have set it to SAL_WARN for easy debugging you should
set it back to SAL_INFO or delete those lines when submit.
Otherwise our dbgutil terminal will be flood with unrelated
messages

Change-Id: I0767bfbeb7a21f208be12208009ccda8b6c72bab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118763
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/tree/genericelements.cxx 
b/sdext/source/pdfimport/tree/genericelements.cxx
index b02e2c0a727d..2c394c973bf0 100644
--- a/sdext/source/pdfimport/tree/genericelements.cxx
+++ b/sdext/source/pdfimport/tree/genericelements.cxx
@@ -156,8 +156,8 @@ void PolyPolyElement::visitedBy( ElementTreeVisitor&
  rV
 #if OSL_DEBUG_LEVEL > 0
 void PolyPolyElement::emitStructure( int nLevel)
 {
-SAL_WARN( "sdext", std::string(nLevel, ' ') << "<" << typeid( *this 
).name() << " " << this << ">" );
-SAL_WARN( "sdext", "path=" );
+SAL_INFO( "sdext", std::string(nLevel, ' ') << "<" << typeid( *this 
).name() << " " << this << ">" );
+SAL_INFO( "sdext", "path=" );
 int nPoly = PolyPoly.count();
 for( int i = 0; i < nPoly; i++ )
 {
@@ -169,11 +169,11 @@ void PolyPolyElement::emitStructure( int nLevel)
 basegfx::B2DPoint aPoint = aPoly.getB2DPoint( n );
 buff.append( " (" + OUString::number(aPoint.getX()) + "," + 
OUString::number(aPoint.getY()) + ")");
 }
-SAL_WARN( "sdext", "" << buff.makeStringAndClear() );
+SAL_INFO( "sdext", "" << buff.makeStringAndClear() );
 }
 for (auto const& child : Children)
 child->emitStructure( nLevel+1 );
-SAL_WARN( "sdext", std::string(nLevel, ' ') << "");
+SAL_INFO( "sdext", std::string(nLevel, ' ') << "");
 }
 #endif
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - i18npool/inc

2022-01-30 Thread Kevin Suo (via logerrit)
 i18npool/inc/bullet.h |   32 +++-
 1 file changed, 31 insertions(+), 1 deletion(-)

New commits:
commit 3db1a060a033a2f84bdf798bed3c7e2515a498ce
Author: Kevin Suo 
AuthorDate: Thu Jan 27 10:28:10 2022 +0800
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Jan 30 19:38:01 2022 +0100

Add CIRCLED NUMBER TWENTY ONE through CIRCLED NUMBER FIFTY to numbring list

Previously we only supported CIRCLED NUMBER ONE through CIRCLED NUMBER 
TWENTY.
Unicode already has CIRCLED NUMBER TWENTY ONE through CIRCLED NUMBER FIFTY.
This improves Circled Numbering, especially for CJK.
E.g. ➀, ➁, ➂, ... ㉑, ㉒, ㉓, ... ㊽, ㊾, ㊿.

Change-Id: I7c4c851f03522fef9d44163da7450cf69aab3889
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129015
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 7e380a76e1f0faa90fdf8f0575053d4a1ca6e1de)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129069
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/i18npool/inc/bullet.h b/i18npool/inc/bullet.h
index 67ea0f7d2600..403d197d2c88 100644
--- a/i18npool/inc/bullet.h
+++ b/i18npool/inc/bullet.h
@@ -239,7 +239,37 @@ const sal_Unicode table_CircledNumber[] = {
 0x2470, // CIRCLED NUMBER SEVENTEEN
 0x2471, // CIRCLED NUMBER EIGHTEEN
 0x2472, // CIRCLED NUMBER NINETEEN
-0x2473  // CIRCLED NUMBER TWENTY
+0x2473, // CIRCLED NUMBER TWENTY
+0x3251, // CIRCLED NUMBER TWENTY ONE
+0x3252, // CIRCLED NUMBER TWENTY TWO
+0x3253, // CIRCLED NUMBER TWENTY THREE
+0x3254, // CIRCLED NUMBER TWENTY FOUR
+0x3255, // CIRCLED NUMBER TWENTY FIVE
+0x3256, // CIRCLED NUMBER TWENTY SIX
+0x3257, // CIRCLED NUMBER TWENTY SEVEN
+0x3258, // CIRCLED NUMBER TWENTY EIGHT
+0x3259, // CIRCLED NUMBER TWENTY NINE
+0x325A, // CIRCLED NUMBER THIRTY
+0x325B, // CIRCLED NUMBER THIRTY ONE
+0x325C, // CIRCLED NUMBER THIRTY TWO
+0x325D, // CIRCLED NUMBER THIRTY THREE
+0x325E, // CIRCLED NUMBER THIRTY FOUR
+0x325F, // CIRCLED NUMBER THIRTY FIVE
+0x32B1, // CIRCLED NUMBER THIRTY SIX
+0x32B2, // CIRCLED NUMBER THIRTY SEVEN
+0x32B3, // CIRCLED NUMBER THIRTY EIGHT
+0x32B4, // CIRCLED NUMBER THIRTY NINE
+0x32B5, // CIRCLED NUMBER FORTY
+0x32B6, // CIRCLED NUMBER FORTY ONE
+0x32B7, // CIRCLED NUMBER FORTY TWO
+0x32B8, // CIRCLED NUMBER FORTY THREE
+0x32B9, // CIRCLED NUMBER FORTY FOUR
+0x32BA, // CIRCLED NUMBER FORTY FIVE
+0x32BB, // CIRCLED NUMBER FORTY SIX
+0x32BC, // CIRCLED NUMBER FORTY SEVEN
+0x32BD, // CIRCLED NUMBER FORTY EIGHT
+0x32BE, // CIRCLED NUMBER FORTY NINE
+0x32BF // CIRCLED NUMBER FIFTY
 };
 
 const sal_Unicode table_HangulJamo_ko[] = {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - i18npool/inc

2022-01-29 Thread Kevin Suo (via logerrit)
 i18npool/inc/bullet.h |   32 +++-
 1 file changed, 31 insertions(+), 1 deletion(-)

New commits:
commit db43ac9b5303954437b53a447efe17fefa4e2b8f
Author: Kevin Suo 
AuthorDate: Thu Jan 27 10:28:10 2022 +0800
Commit: Caolán McNamara 
CommitDate: Sat Jan 29 14:32:37 2022 +0100

Add CIRCLED NUMBER TWENTY ONE through CIRCLED NUMBER FIFTY to numbring list

Previously we only supported CIRCLED NUMBER ONE through CIRCLED NUMBER 
TWENTY.
Unicode already has CIRCLED NUMBER TWENTY ONE through CIRCLED NUMBER FIFTY.
This improves Circled Numbering, especially for CJK.
E.g. ➀, ➁, ➂, ... ㉑, ㉒, ㉓, ... ㊽, ㊾, ㊿.

Change-Id: I7c4c851f03522fef9d44163da7450cf69aab3889
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129015
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 7e380a76e1f0faa90fdf8f0575053d4a1ca6e1de)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129068
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/i18npool/inc/bullet.h b/i18npool/inc/bullet.h
index 67ea0f7d2600..403d197d2c88 100644
--- a/i18npool/inc/bullet.h
+++ b/i18npool/inc/bullet.h
@@ -239,7 +239,37 @@ const sal_Unicode table_CircledNumber[] = {
 0x2470, // CIRCLED NUMBER SEVENTEEN
 0x2471, // CIRCLED NUMBER EIGHTEEN
 0x2472, // CIRCLED NUMBER NINETEEN
-0x2473  // CIRCLED NUMBER TWENTY
+0x2473, // CIRCLED NUMBER TWENTY
+0x3251, // CIRCLED NUMBER TWENTY ONE
+0x3252, // CIRCLED NUMBER TWENTY TWO
+0x3253, // CIRCLED NUMBER TWENTY THREE
+0x3254, // CIRCLED NUMBER TWENTY FOUR
+0x3255, // CIRCLED NUMBER TWENTY FIVE
+0x3256, // CIRCLED NUMBER TWENTY SIX
+0x3257, // CIRCLED NUMBER TWENTY SEVEN
+0x3258, // CIRCLED NUMBER TWENTY EIGHT
+0x3259, // CIRCLED NUMBER TWENTY NINE
+0x325A, // CIRCLED NUMBER THIRTY
+0x325B, // CIRCLED NUMBER THIRTY ONE
+0x325C, // CIRCLED NUMBER THIRTY TWO
+0x325D, // CIRCLED NUMBER THIRTY THREE
+0x325E, // CIRCLED NUMBER THIRTY FOUR
+0x325F, // CIRCLED NUMBER THIRTY FIVE
+0x32B1, // CIRCLED NUMBER THIRTY SIX
+0x32B2, // CIRCLED NUMBER THIRTY SEVEN
+0x32B3, // CIRCLED NUMBER THIRTY EIGHT
+0x32B4, // CIRCLED NUMBER THIRTY NINE
+0x32B5, // CIRCLED NUMBER FORTY
+0x32B6, // CIRCLED NUMBER FORTY ONE
+0x32B7, // CIRCLED NUMBER FORTY TWO
+0x32B8, // CIRCLED NUMBER FORTY THREE
+0x32B9, // CIRCLED NUMBER FORTY FOUR
+0x32BA, // CIRCLED NUMBER FORTY FIVE
+0x32BB, // CIRCLED NUMBER FORTY SIX
+0x32BC, // CIRCLED NUMBER FORTY SEVEN
+0x32BD, // CIRCLED NUMBER FORTY EIGHT
+0x32BE, // CIRCLED NUMBER FORTY NINE
+0x32BF // CIRCLED NUMBER FIFTY
 };
 
 const sal_Unicode table_HangulJamo_ko[] = {


[Libreoffice-commits] core.git: i18npool/inc

2022-01-27 Thread Kevin Suo (via logerrit)
 i18npool/inc/bullet.h |   32 +++-
 1 file changed, 31 insertions(+), 1 deletion(-)

New commits:
commit 7e380a76e1f0faa90fdf8f0575053d4a1ca6e1de
Author: Kevin Suo 
AuthorDate: Thu Jan 27 10:28:10 2022 +0800
Commit: Eike Rathke 
CommitDate: Thu Jan 27 14:00:51 2022 +0100

Add CIRCLED NUMBER TWENTY ONE through CIRCLED NUMBER FIFTY to numbring list

Previously we only supported CIRCLED NUMBER ONE through CIRCLED NUMBER 
TWENTY.
Unicode aready has CIRCLED NUMBER TWENTY ONE through CIRCLED NUMBER FIFTY.
This improves Circled Numbering, especially for CJK.
E.g. ➀, ➁, ➂, ... ㉑, ㉒, ㉓, ... ㊽, ㊾, ㊿.

Change-Id: I7c4c851f03522fef9d44163da7450cf69aab3889
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129015
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/i18npool/inc/bullet.h b/i18npool/inc/bullet.h
index 67ea0f7d2600..403d197d2c88 100644
--- a/i18npool/inc/bullet.h
+++ b/i18npool/inc/bullet.h
@@ -239,7 +239,37 @@ const sal_Unicode table_CircledNumber[] = {
 0x2470, // CIRCLED NUMBER SEVENTEEN
 0x2471, // CIRCLED NUMBER EIGHTEEN
 0x2472, // CIRCLED NUMBER NINETEEN
-0x2473  // CIRCLED NUMBER TWENTY
+0x2473, // CIRCLED NUMBER TWENTY
+0x3251, // CIRCLED NUMBER TWENTY ONE
+0x3252, // CIRCLED NUMBER TWENTY TWO
+0x3253, // CIRCLED NUMBER TWENTY THREE
+0x3254, // CIRCLED NUMBER TWENTY FOUR
+0x3255, // CIRCLED NUMBER TWENTY FIVE
+0x3256, // CIRCLED NUMBER TWENTY SIX
+0x3257, // CIRCLED NUMBER TWENTY SEVEN
+0x3258, // CIRCLED NUMBER TWENTY EIGHT
+0x3259, // CIRCLED NUMBER TWENTY NINE
+0x325A, // CIRCLED NUMBER THIRTY
+0x325B, // CIRCLED NUMBER THIRTY ONE
+0x325C, // CIRCLED NUMBER THIRTY TWO
+0x325D, // CIRCLED NUMBER THIRTY THREE
+0x325E, // CIRCLED NUMBER THIRTY FOUR
+0x325F, // CIRCLED NUMBER THIRTY FIVE
+0x32B1, // CIRCLED NUMBER THIRTY SIX
+0x32B2, // CIRCLED NUMBER THIRTY SEVEN
+0x32B3, // CIRCLED NUMBER THIRTY EIGHT
+0x32B4, // CIRCLED NUMBER THIRTY NINE
+0x32B5, // CIRCLED NUMBER FORTY
+0x32B6, // CIRCLED NUMBER FORTY ONE
+0x32B7, // CIRCLED NUMBER FORTY TWO
+0x32B8, // CIRCLED NUMBER FORTY THREE
+0x32B9, // CIRCLED NUMBER FORTY FOUR
+0x32BA, // CIRCLED NUMBER FORTY FIVE
+0x32BB, // CIRCLED NUMBER FORTY SIX
+0x32BC, // CIRCLED NUMBER FORTY SEVEN
+0x32BD, // CIRCLED NUMBER FORTY EIGHT
+0x32BE, // CIRCLED NUMBER FORTY NINE
+0x32BF // CIRCLED NUMBER FIFTY
 };
 
 const sal_Unicode table_HangulJamo_ko[] = {


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

2022-01-02 Thread Kevin Suo (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx  |2 
 sw/qa/core/text/data/firstLineIndent-withFlag.fodt |   31 
 sw/qa/core/text/text.cxx   |   25 +++
 sw/source/core/doc/DocumentSettingManager.cxx  |9 ++
 sw/source/core/inc/DocumentSettingManager.hxx  |1 
 sw/source/core/text/itrcrsr.cxx|   73 +++--
 sw/source/filter/xml/xmlimp.cxx|6 +
 sw/source/uibase/uno/SwXDocumentSettings.cxx   |   18 +
 8 files changed, 130 insertions(+), 35 deletions(-)

New commits:
commit 86cffd61c1f01a18f4016bb09c8d63a581f5cded
Author: Kevin Suo 
AuthorDate: Mon Nov 22 00:01:34 2021 +0800
Commit: Miklos Vajna 
CommitDate: Mon Jan 3 08:35:21 2022 +0100

tdf#129448: Auto first-line indent should not be effected by line space

Previously, if you set the first line indent to auto, then if you change
the line height, the first line indent will also change. I do not see a
reason to change the first line indent value in case of change in line
spacing, even for English language.

Some languages (e.g. Chinese) may have set the auto first line indent
to be 2 characters of the current font, but if the first line indent
changes when line height changes, then this 2-character rule is not 
possible.

For compatibility with old documents, a compatability flag
'AutoFirstLineIndentDisregardLineSpace' is added in this patch, thus this
patch only has effect to new ODF documents. DOC/DOCX documents will also
benefit from this patch, no matter old or new, because, as Miklos Vajna
has pointed out, Word does not have the auto first line height feature.

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

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 11bef9d2729d..7de8674c4d0f 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -90,6 +90,8 @@ enum class DocumentSettingId
 // tdf#112443 disable off-page content positioning
 DISABLE_OFF_PAGE_POSITIONING,
 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,
 // COMPATIBILITY FLAGS END
 BROWSE_MODE,
 HTML_MODE,
diff --git a/sw/qa/core/text/data/firstLineIndent-withFlag.fodt 
b/sw/qa/core/text/data/firstLineIndent-withFlag.fodt
new file mode 100644
index ..069b960b9d6f
--- /dev/null
+++ b/sw/qa/core/text/data/firstLineIndent-withFlag.fodt
@@ -0,0 +1,31 @@
+
+
+ 
+  
+   true
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+  
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+ 
+ 
+  
+   LibreOffice is a free and powerful office 
suite, and a successor to OpenOffice.org (commonly known as OpenOffice). Its 
clean interface and feature-rich tools help you unleash your creativity and 
enhance your productivity. LibreOffice is one of the friendliest and 
fastest-growing projects in the free and open source software world.
+   LibreOffice is a free and powerful office 
suite, and a successor to OpenOffice.org (commonly known as OpenOffice). Its 
clean interface and feature-rich tools help you unleash your creativity and 
enhance your productivity. LibreOffice is one of the friendliest and 
fastest-growing projects in the free and open source software world.
+  
+ 
+
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 6832ad2cb436..a7c6bc7838a6 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -176,6 +176,31 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLineWidth)
 CPPUNIT_ASSERT_GREATER(static_cast(65536), nNewLeft - nOldLeft);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testChineseAutoFirstLineIndent)
+{
+// The test document contains two simple multi-line paragraph. For both 
paragraphs, the first line indent
+// is set to 'auto'. Line spacing is 100% for the 1st paragraph and 200% 
for the 2nd paragraph.
+// Also, there is a "AutoFirstLineIndentDisregardLineSpace" capability 
flag set in the document.
+createSwDoc(DATA_DIRECTORY, "firstLineIndent-withFlag.fodt");
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// Get the line width of the first line for the 1st paragrapsh.
+sal_Int32 nFirstLineWidth
+= getXPath(pXmlDoc, 
"//body/txt[1]/SwParaPortion[1]/SwLineLayout[1]/SwLinePortion[1]",
+   "width")
+  .toInt32();
+// Get the line width of the first line for the 2nd paragrapsh.
+sal_Int32 nSecondLineWidth
+= getXPath(pXmlDoc, 
"//body/txt[2]/SwParaPortion[1]/SwLineLayout[1]/SwLinePortion[1]",
+   "width")
+  .toInt32();
+
+// Tdf#129448: the changing of line-height should not affect the auto 
first line indent.
+// As a result, the first 

[Libreoffice-commits] core.git: helpcontent2

2021-12-28 Thread Kevin Suo (via logerrit)
 helpcontent2 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 95a10c797b2d0dfc14c15ec24341437dac5e9b03
Author: Kevin Suo 
AuthorDate: Tue Dec 28 18:00:31 2021 +0800
Commit: Gerrit Code Review 
CommitDate: Tue Dec 28 11:00:31 2021 +0100

Update git submodules

* Update helpcontent2 from branch 'master'
  to 4251a294d02ab5ae1c136b7bd90ba5c69bf8cce5
  - Fix the error message for sc error code 524 "Error: Not a valid 
reference"

The error message on the UI is:
NC_("STR_LONG_ERR_NO_REF", "Error: Not a valid reference")

rather than "invalid references".

Change-Id: I86c1bb0d950fd30654c82d80011164eec25da43b
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/127514
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/helpcontent2 b/helpcontent2
index 7b309ae94782..4251a294d02a 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit 7b309ae9478219e6d6423b8caa94bfed7a39b0a0
+Subproject commit 4251a294d02ab5ae1c136b7bd90ba5c69bf8cce5


[Libreoffice-commits] help.git: source/text

2021-12-28 Thread Kevin Suo (via logerrit)
 source/text/scalc/05/0214.xhp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4251a294d02ab5ae1c136b7bd90ba5c69bf8cce5
Author: Kevin Suo 
AuthorDate: Sun Dec 26 21:43:58 2021 +0800
Commit: Olivier Hallot 
CommitDate: Tue Dec 28 11:00:29 2021 +0100

Fix the error message for sc error code 524 "Error: Not a valid reference"

The error message on the UI is:
NC_("STR_LONG_ERR_NO_REF", "Error: Not a valid reference")

rather than "invalid references".

Change-Id: I86c1bb0d950fd30654c82d80011164eec25da43b
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/127514
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/source/text/scalc/05/0214.xhp 
b/source/text/scalc/05/0214.xhp
index 71fc1858c..4a54582a7 100644
--- a/source/text/scalc/05/0214.xhp
+++ b/source/text/scalc/05/0214.xhp
@@ -301,7 +301,7 @@
524#REF!
 
 
-invalid 
references (instead of Err:524 cell displays #REF!)
+Not a valid 
reference (instead of Err:524 cell displays #REF!)
 
 



[Libreoffice-commits] core.git: helpcontent2

2021-12-28 Thread Kevin Suo (via logerrit)
 helpcontent2 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 885106479d2e5b9fdf6b63dd90cbd757ad747044
Author: Kevin Suo 
AuthorDate: Tue Dec 28 17:59:52 2021 +0800
Commit: Gerrit Code Review 
CommitDate: Tue Dec 28 10:59:52 2021 +0100

Update git submodules

* Update helpcontent2 from branch 'master'
  to 7b309ae9478219e6d6423b8caa94bfed7a39b0a0
  - Fix the error message for sc error code 519 "Error: No value"

See https://gerrit.libreoffice.org/c/core/+/127512

Change-Id: If45d0aaedf6077434c8d548324bbcb4e9b441c50
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/127513
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/helpcontent2 b/helpcontent2
index be4d585fabb3..7b309ae94782 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit be4d585fabb320f67407d492ecb74218fd4c08a3
+Subproject commit 7b309ae9478219e6d6423b8caa94bfed7a39b0a0


[Libreoffice-commits] help.git: source/text

2021-12-28 Thread Kevin Suo (via logerrit)
 source/text/scalc/05/0214.xhp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7b309ae9478219e6d6423b8caa94bfed7a39b0a0
Author: Kevin Suo 
AuthorDate: Sun Dec 26 20:46:55 2021 +0800
Commit: Olivier Hallot 
CommitDate: Tue Dec 28 10:59:51 2021 +0100

Fix the error message for sc error code 519 "Error: No value"

See https://gerrit.libreoffice.org/c/core/+/127512

Change-Id: If45d0aaedf6077434c8d548324bbcb4e9b441c50
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/127513
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/source/text/scalc/05/0214.xhp 
b/source/text/scalc/05/0214.xhp
index 583047ee5..71fc1858c 100644
--- a/source/text/scalc/05/0214.xhp
+++ b/source/text/scalc/05/0214.xhp
@@ -245,7 +245,7 @@
519#VALUE!
 
 
-   No result (instead of Err:519 cell displays 
#VALUE!)
+   No value (instead of Err:519 cell displays 
#VALUE!)
 
 
The formula yields a value that does not correspond to the 
definition; or a cell that is referenced in the formula contains text instead 
of a number.i63264


[Libreoffice-commits] core.git: sc/inc

2021-12-26 Thread Kevin Suo (via logerrit)
 sc/inc/globstr.hrc |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5d56a2301ca00b21dff110b0f11677cf80dff04e
Author: Kevin Suo 
AuthorDate: Sun Dec 26 20:27:06 2021 +0800
Commit: Eike Rathke 
CommitDate: Sun Dec 26 18:00:12 2021 +0100

sc-error-codes: STR_LONG_ERR_NO_VALUE should be "Error: No value"

rather than Error: Wrong data type.

STR_LONG_ERR_NO_VALUE was marked as "Error: Wrong data type" in
the source code. It was translated in the en_US UI as "Error:
No result", which seems to be intentionally. This causes confusion
for other languages.

This error code is used for case FormulaError::NoValue and this
FormulaError enum entry is used in various places, most of them
indicates that it is used because of no value is returned.

"Wrong data type" should be a reason why there was "no value"
returned, thus "Wrong data type" should be a subset of "No value",
but anyway STR_LONG_ERR_NO_VALUE != "Wrong data type".

Change-Id: Ie0e355ba02e9800fca2263744ed74ada700bfbeb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127512
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 44776504b47e..793d3cb95d55 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -216,7 +216,7 @@
 /* ERROR.TYPE( #DIV/0! ) == 2 */
 #define STR_LONG_ERR_DIV_ZERO   NC_("STR_LONG_ERR_DIV_ZERO", 
"Error: Division by zero")
 /* ERROR.TYPE( #VALUE! ) == 3 */
-#define STR_LONG_ERR_NO_VALUE   NC_("STR_LONG_ERR_NO_VALUE", 
"Error: Wrong data type")
+#define STR_LONG_ERR_NO_VALUE   NC_("STR_LONG_ERR_NO_VALUE", 
"Error: No value")
 /* ERROR.TYPE( #REF! ) == 4 */
 #define STR_LONG_ERR_NO_REF NC_("STR_LONG_ERR_NO_REF", 
"Error: Not a valid reference")
 /* ERROR.TYPE( #NAME! ) == 5 */


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - i18npool/source

2021-11-23 Thread Kevin Suo (via logerrit)
 i18npool/source/localedata/data/zh_CN.xml |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9c0b3697084cdda149705789365f63e8293e0092
Author: Kevin Suo 
AuthorDate: Fri Nov 19 16:13:09 2021 +0800
Commit: Eike Rathke 
CommitDate: Tue Nov 23 14:54:25 2021 +0100

Change aboveWord and belowWord for Simplified Chinese locale

Per Wechat discussion by our Simplified Chinese l10n team.

上方 and 下方 are written languages which are more suitable for
cross-reference context, while 上面 and 下面 are spoken languages.
Also in this way they are consistent with MS Word.

Change-Id: Iccf8c330b2e5a04be3916b810a29ea0d62f26225
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125533
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 918b62bea6cf82ce952c8d225dcabd4d08a2abf7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125461

diff --git a/i18npool/source/localedata/data/zh_CN.xml 
b/i18npool/source/localedata/data/zh_CN.xml
index 814c6db9ba48..1f33090d0ced 100644
--- a/i18npool/source/localedata/data/zh_CN.xml
+++ b/i18npool/source/localedata/data/zh_CN.xml
@@ -418,8 +418,8 @@
   第2季度
   第3季度
   第4季度
-  上面
-  下面
+  上方
+  下方
   Q1
   Q2
   Q3


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

2021-11-20 Thread Kevin Suo (via logerrit)
 i18npool/source/localedata/data/zh_CN.xml |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 918b62bea6cf82ce952c8d225dcabd4d08a2abf7
Author: Kevin Suo 
AuthorDate: Fri Nov 19 16:13:09 2021 +0800
Commit: Eike Rathke 
CommitDate: Sat Nov 20 23:09:40 2021 +0100

Change aboveWord and belowWord for Simplified Chinese locale

Per Wechat discussion by our Simplified Chinese l10n team.

上方 and 下方 are written languages which are more suitable for
cross-reference context, while 上面 and 下面 are spoken languages.
Also in this way they are consistent with MS Word.

Change-Id: Iccf8c330b2e5a04be3916b810a29ea0d62f26225
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125533
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/i18npool/source/localedata/data/zh_CN.xml 
b/i18npool/source/localedata/data/zh_CN.xml
index 814c6db9ba48..1f33090d0ced 100644
--- a/i18npool/source/localedata/data/zh_CN.xml
+++ b/i18npool/source/localedata/data/zh_CN.xml
@@ -418,8 +418,8 @@
   第2季度
   第3季度
   第4季度
-  上面
-  下面
+  上方
+  下方
   Q1
   Q2
   Q3


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

2021-11-09 Thread Kevin Suo (via logerrit)
 sc/source/filter/orcus/interface.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1798edc6bacf678aef20f9cff46c26acb93abb66
Author: Kevin Suo 
AuthorDate: Wed Nov 3 19:50:40 2021 +0800
Commit: Mike Kaganski 
CommitDate: Tue Nov 9 10:49:57 2021 +0100

Remove this hard-coded "Default" style name in Calc

Replace it with the defined SC_STYLE_PROG_STANDARD macro.

Hard-coded style names can cause problems such as tdf#134161.

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

diff --git a/sc/source/filter/orcus/interface.cxx 
b/sc/source/filter/orcus/interface.cxx
index 1bcc914a0ada..674c2cfe7c8f 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -1510,7 +1510,7 @@ ScOrcusStyles::xf::xf():
 }
 
 ScOrcusStyles::cell_style::cell_style():
-maParentName("Default"),
+maParentName(OUString(SC_STYLE_PROG_STANDARD)),
 mnXFId(0),
 mnBuiltInId(0)
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/inc sc/source

2021-11-09 Thread Kevin Suo (via logerrit)
 sc/inc/stylehelper.hxx   |4 +++-
 sc/source/filter/orcus/interface.cxx |5 -
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 482d5bfe2ffc9d03a7849b61fc7f2c0998d5feaa
Author: Kevin Suo 
AuthorDate: Wed Nov 3 14:16:52 2021 +0800
Commit: Mike Kaganski 
CommitDate: Tue Nov 9 10:49:10 2021 +0100

tdf#139205: Keep hierarchical structure of localized default styles in Calc

The default cell styles (when creating a new Calc document), as returned by 
orcus
parsing, are built-in English names, as defined in sc/res/xml/styles.xml. 
These
names can be localized. On non-English UI, all these (localized) styles 
names
will be forced to use the localized "Default" as their parent because there 
is
no such non-localized parents in the localized style tree on UI.

In this patch, I added SC_DLLPUBLIC to 
ScStyleNameConversion::ProgrammaticToDisplayName,
then used this function to convert the parent style name to the (localized) 
UI name.

Change-Id: I3689211a10c60a5e7b2b273b6c15a4da92f0d633
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124556
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-by: Eike Rathke 
(cherry picked from commit 4024673d69475191ba221fd0db2e595bf796d4fd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124855

diff --git a/sc/inc/stylehelper.hxx b/sc/inc/stylehelper.hxx
index 53ff810952ae..9b56db2acd1b 100644
--- a/sc/inc/stylehelper.hxx
+++ b/sc/inc/stylehelper.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include 
+#include "scdllapi.h"
 
 enum class SfxStyleFamily;
 
@@ -27,7 +28,8 @@ class ScStyleNameConversion
 {
 public:
 static OUString DisplayToProgrammaticName(const OUString& rDispName, 
SfxStyleFamily nType);
-static OUString ProgrammaticToDisplayName(const OUString& rProgName, 
SfxStyleFamily nType);
+static SC_DLLPUBLIC OUString ProgrammaticToDisplayName(const OUString& 
rProgName,
+   SfxStyleFamily 
nType);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/orcus/interface.cxx 
b/sc/source/filter/orcus/interface.cxx
index 78b9563bc842..24a7ba03f8aa 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -47,6 +47,7 @@
 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -2177,7 +2178,9 @@ size_t ScOrcusStyles::commit_cell_style()
 
 ScStyleSheetPool* pPool = mrFactory.getDoc().getDoc().GetStyleSheetPool();
 SfxStyleSheetBase& rBase = pPool->Make(maCurrentCellStyle.maName, 
SfxStyleFamily::Para);
-rBase.SetParent(maCurrentCellStyle.maParentName);
+// Need to convert the parent name to localized UI name, see tdf#139205.
+
rBase.SetParent(ScStyleNameConversion::ProgrammaticToDisplayName(maCurrentCellStyle.maParentName,
+ 
SfxStyleFamily::Para));
 SfxItemSet& rSet = rBase.GetItemSet();
 
 xf& rXf = maCellStyleXfs[maCurrentCellStyle.mnXFId];


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - sc/inc sc/source

2021-11-08 Thread Kevin Suo (via logerrit)
 sc/inc/stylehelper.hxx   |4 +++-
 sc/source/filter/orcus/interface.cxx |5 -
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit c274eeaa46206a42b3356d18f7a0d6dc5fb92cda
Author: Kevin Suo 
AuthorDate: Wed Nov 3 14:16:52 2021 +0800
Commit: Andras Timar 
CommitDate: Mon Nov 8 22:13:05 2021 +0100

tdf#139205: Keep hierarchical structure of localized default styles in Calc

The default cell styles (when creating a new Calc document), as returned by 
orcus
parsing, are built-in English names, as defined in sc/res/xml/styles.xml. 
These
names can be localized. On non-English UI, all these (localized) styles 
names
will be forced to use the localized "Default" as their parent because there 
is
no such non-localized parents in the localized style tree on UI.

In this patch, I added SC_DLLPUBLIC to 
ScStyleNameConversion::ProgrammaticToDisplayName,
then used this function to convert the parent style name to the (localized) 
UI name.

Change-Id: I3689211a10c60a5e7b2b273b6c15a4da92f0d633
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124556
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-by: Eike Rathke 

diff --git a/sc/inc/stylehelper.hxx b/sc/inc/stylehelper.hxx
index 68e6d252b03c..c847df28e9f8 100644
--- a/sc/inc/stylehelper.hxx
+++ b/sc/inc/stylehelper.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SC_INC_STYLEHELPER_HXX
 
 #include 
+#include "scdllapi.h"
 
 enum class SfxStyleFamily;
 
@@ -28,7 +29,8 @@ class ScStyleNameConversion
 {
 public:
 static OUString DisplayToProgrammaticName(const OUString& rDispName, 
SfxStyleFamily nType);
-static OUString ProgrammaticToDisplayName(const OUString& rProgName, 
SfxStyleFamily nType);
+static SC_DLLPUBLIC OUString ProgrammaticToDisplayName(const OUString& 
rProgName,
+   SfxStyleFamily 
nType);
 };
 
 #endif
diff --git a/sc/source/filter/orcus/interface.cxx 
b/sc/source/filter/orcus/interface.cxx
index 7bf9bd059def..a42b71f46ee6 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -47,6 +47,7 @@
 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -2179,7 +2180,9 @@ size_t ScOrcusStyles::commit_cell_style()
 
 ScStyleSheetPool* pPool = mrFactory.getDoc().getDoc().GetStyleSheetPool();
 SfxStyleSheetBase& rBase = pPool->Make(maCurrentCellStyle.maName, 
SfxStyleFamily::Para);
-rBase.SetParent(maCurrentCellStyle.maParentName);
+// Need to convert the parent name to localized UI name, see tdf#139205.
+
rBase.SetParent(ScStyleNameConversion::ProgrammaticToDisplayName(maCurrentCellStyle.maParentName,
+ 
SfxStyleFamily::Para));
 SfxItemSet& rSet = rBase.GetItemSet();
 
 xf& rXf = maCellStyleXfs[maCurrentCellStyle.mnXFId];


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

2021-11-08 Thread Kevin Suo (via logerrit)
 sc/inc/stylehelper.hxx   |4 +++-
 sc/source/filter/orcus/interface.cxx |5 -
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 4024673d69475191ba221fd0db2e595bf796d4fd
Author: Kevin Suo 
AuthorDate: Wed Nov 3 14:16:52 2021 +0800
Commit: Eike Rathke 
CommitDate: Mon Nov 8 21:40:35 2021 +0100

tdf#139205: Keep hierarchical structure of localized default styles in Calc

The default cell styles (when creating a new Calc document), as returned by 
orcus
parsing, are built-in English names, as defined in sc/res/xml/styles.xml. 
These
names can be localized. On non-English UI, all these (localized) styles 
names
will be forced to use the localized "Default" as their parent because there 
is
no such non-localized parents in the localized style tree on UI.

In this patch, I added SC_DLLPUBLIC to 
ScStyleNameConversion::ProgrammaticToDisplayName,
then used this function to convert the parent style name to the (localized) 
UI name.

Change-Id: I3689211a10c60a5e7b2b273b6c15a4da92f0d633
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124556
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-by: Eike Rathke 

diff --git a/sc/inc/stylehelper.hxx b/sc/inc/stylehelper.hxx
index 63189ccd6c77..e11fcef97c8e 100644
--- a/sc/inc/stylehelper.hxx
+++ b/sc/inc/stylehelper.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include 
+#include "scdllapi.h"
 
 //  conversion programmatic <-> display (visible) name
 //  currently, the core always has the visible names
@@ -46,7 +47,8 @@ class ScStyleNameConversion
 {
 public:
 static OUString DisplayToProgrammaticName(const OUString& rDispName, 
SfxStyleFamily nType);
-static OUString ProgrammaticToDisplayName(const OUString& rProgName, 
SfxStyleFamily nType);
+static SC_DLLPUBLIC OUString ProgrammaticToDisplayName(const OUString& 
rProgName,
+   SfxStyleFamily 
nType);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/orcus/interface.cxx 
b/sc/source/filter/orcus/interface.cxx
index 63926a72fc59..1bcc914a0ada 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -49,6 +49,7 @@
 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -2176,7 +2177,9 @@ size_t ScOrcusStyles::commit_cell_style()
 
 ScStyleSheetPool* pPool = mrFactory.getDoc().getDoc().GetStyleSheetPool();
 SfxStyleSheetBase& rBase = pPool->Make(maCurrentCellStyle.maName, 
SfxStyleFamily::Para);
-rBase.SetParent(maCurrentCellStyle.maParentName);
+// Need to convert the parent name to localized UI name, see tdf#139205.
+
rBase.SetParent(ScStyleNameConversion::ProgrammaticToDisplayName(maCurrentCellStyle.maParentName,
+ 
SfxStyleFamily::Para));
 SfxItemSet& rSet = rBase.GetItemSet();
 
 xf& rXf = maCellStyleXfs[maCurrentCellStyle.mnXFId];


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

2021-11-04 Thread Kevin Suo (via logerrit)
 sc/inc/stylehelper.hxx  |   19 +++
 sc/source/core/tool/stylehelper.cxx |   19 ---
 2 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit b9e43ab25fe2d93c2487fd33ed3c0f583009b968
Author: Kevin Suo 
AuthorDate: Wed Nov 3 19:44:45 2021 +0800
Commit: Noel Grandin 
CommitDate: Thu Nov 4 09:03:21 2021 +0100

Move these SC_STYLE_PROG_* and SC_PIVOT_STYLE_PROG_* constexpr to header

so that they can be reused in other parts of the code base.

Need to change them to inline to avoid "defined but not used" compiling 
error.

Change-Id: I44de7c2ebbc9ae57c229f89faf69a788013d7816
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124643
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/stylehelper.hxx b/sc/inc/stylehelper.hxx
index 53ff810952ae..63189ccd6c77 100644
--- a/sc/inc/stylehelper.hxx
+++ b/sc/inc/stylehelper.hxx
@@ -21,6 +21,25 @@
 
 #include 
 
+//  conversion programmatic <-> display (visible) name
+//  currently, the core always has the visible names
+//  the api is required to use programmatic names for default styles
+//  these programmatic names must never change!
+
+inline constexpr OUStringLiteral SC_STYLE_PROG_STANDARD = u"Default";
+inline constexpr OUStringLiteral SC_STYLE_PROG_RESULT = u"Result";
+inline constexpr OUStringLiteral SC_STYLE_PROG_RESULT1 = u"Result2";
+inline constexpr OUStringLiteral SC_STYLE_PROG_HEADING = u"Heading";
+inline constexpr OUStringLiteral SC_STYLE_PROG_HEADING1 = u"Heading1";
+inline constexpr OUStringLiteral SC_STYLE_PROG_REPORT = u"Report";
+
+inline constexpr OUStringLiteral SC_PIVOT_STYLE_PROG_INNER = u"Pivot Table 
Value";
+inline constexpr OUStringLiteral SC_PIVOT_STYLE_PROG_RESULT = u"Pivot Table 
Result";
+inline constexpr OUStringLiteral SC_PIVOT_STYLE_PROG_CATEGORY = u"Pivot Table 
Category";
+inline constexpr OUStringLiteral SC_PIVOT_STYLE_PROG_TITLE = u"Pivot Table 
Title";
+inline constexpr OUStringLiteral SC_PIVOT_STYLE_PROG_FIELDNAME = u"Pivot Table 
Field";
+inline constexpr OUStringLiteral SC_PIVOT_STYLE_PROG_TOP = u"Pivot Table 
Corner";
+
 enum class SfxStyleFamily;
 
 class ScStyleNameConversion
diff --git a/sc/source/core/tool/stylehelper.cxx 
b/sc/source/core/tool/stylehelper.cxx
index 7caab7580dec..e9a920500e79 100644
--- a/sc/source/core/tool/stylehelper.cxx
+++ b/sc/source/core/tool/stylehelper.cxx
@@ -29,25 +29,6 @@
 #include 
 #include 
 
-//  conversion programmatic <-> display (visible) name
-//  currently, the core always has the visible names
-//  the api is required to use programmatic names for default styles
-//  these programmatic names must never change!
-
-constexpr OUStringLiteral SC_STYLE_PROG_STANDARD = u"Default";
-constexpr OUStringLiteral SC_STYLE_PROG_RESULT = u"Result";
-constexpr OUStringLiteral SC_STYLE_PROG_RESULT1 = u"Result2";
-constexpr OUStringLiteral SC_STYLE_PROG_HEADING = u"Heading";
-constexpr OUStringLiteral SC_STYLE_PROG_HEADING1 = u"Heading1";
-constexpr OUStringLiteral SC_STYLE_PROG_REPORT = u"Report";
-
-constexpr OUStringLiteral SC_PIVOT_STYLE_PROG_INNER = u"Pivot Table Value";
-constexpr OUStringLiteral SC_PIVOT_STYLE_PROG_RESULT = u"Pivot Table Result";
-constexpr OUStringLiteral SC_PIVOT_STYLE_PROG_CATEGORY = u"Pivot Table 
Category";
-constexpr OUStringLiteral SC_PIVOT_STYLE_PROG_TITLE = u"Pivot Table Title";
-constexpr OUStringLiteral SC_PIVOT_STYLE_PROG_FIELDNAME = u"Pivot Table Field";
-constexpr OUStringLiteral SC_PIVOT_STYLE_PROG_TOP = u"Pivot Table Corner";
-
 namespace {
 
 struct ScDisplayNameMap


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

2021-11-03 Thread Kevin Suo (via logerrit)
 sc/source/filter/orcus/interface.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ac32663b65d1bfc1319d55fb0d1b35e96f65
Author: Kevin Suo 
AuthorDate: Wed Nov 3 19:38:16 2021 +0800
Commit: Mike Kaganski 
CommitDate: Wed Nov 3 14:35:18 2021 +0100

This aParentName can be const

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

diff --git a/sc/source/filter/orcus/interface.cxx 
b/sc/source/filter/orcus/interface.cxx
index 65ace1c123ed..0947b5dd650c 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -2160,7 +2160,7 @@ void ScOrcusStyles::set_cell_style_builtin(size_t index)
 
 void ScOrcusStyles::set_cell_style_parent_name(const char* s, size_t n)
 {
-OUString aParentName(s, n, 
mrFactory.getGlobalSettings().getTextEncoding());
+const OUString aParentName(s, n, 
mrFactory.getGlobalSettings().getTextEncoding());
 maCurrentCellStyle.maParentName = aParentName;
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-01 Thread Kevin Suo (via logerrit)
 sc/source/filter/orcus/interface.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 836e37bac767ce6eea4b0e0c9342976e8238cc46
Author: Kevin Suo 
AuthorDate: Mon Nov 1 14:15:19 2021 +0800
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 17:20:38 2021 +0100

tdf#138475: also set font size/weight/posture for CJK/CTL languages...

when parsing the default Calc styles.

As an initial matter, orcus currently does not support XML_font_size_asian,
XML_font_size_complex, XML_font_weight_asian, XML_font_weight_complex etc 
in:

https://gitlab.com/orcus/orcus/-/blob/master/src/liborcus/odf_styles_context.cpp#L128

While this need to be improved by Orcus, actually in Calc we provide
the default font attributes in sc/res/xml/styles.xml and it makes no
sense to set different font size/weight/posture for each language type.
As a result we apply the same font attributes of latin to all these
languages.

Change-Id: I1b105fecce45aa22c6b72e15305e25dc6669d2cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124536
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 3b977328dfbe613d925dc52c22e36b7e15a34ada)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124472
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/filter/orcus/interface.cxx 
b/sc/source/filter/orcus/interface.cxx
index 35fb72548a4c..78b9563bc842 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -1360,9 +1360,13 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& 
rSet) const
 {
 FontItalic eItalic = mbItalic ? ITALIC_NORMAL : ITALIC_NONE;
 rSet.Put(SvxPostureItem(eItalic, ATTR_FONT_POSTURE));
+rSet.Put(SvxPostureItem(eItalic, ATTR_CJK_FONT_POSTURE));
+rSet.Put(SvxPostureItem(eItalic, ATTR_CTL_FONT_POSTURE));
 
 FontWeight eWeight = mbBold ? WEIGHT_BOLD : WEIGHT_NORMAL;
 rSet.Put(SvxWeightItem(eWeight, ATTR_FONT_WEIGHT));
+rSet.Put(SvxWeightItem(eWeight, ATTR_CJK_FONT_WEIGHT));
+rSet.Put(SvxWeightItem(eWeight, ATTR_CTL_FONT_WEIGHT));
 
 rSet.Put( SvxColorItem(maColor, ATTR_FONT_COLOR));
 
@@ -1370,6 +1374,8 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& 
rSet) const
 rSet.Put( SvxFontItem( FAMILY_DONTKNOW, maName, maName, 
PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, ATTR_FONT ));
 
 rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_FONT_HEIGHT));
+rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_CJK_FONT_HEIGHT));
+rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_CTL_FONT_HEIGHT));
 }
 
 if (mbHasUnderlineAttr)


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

2021-11-01 Thread Kevin Suo (via logerrit)
 sc/source/filter/orcus/interface.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 3b977328dfbe613d925dc52c22e36b7e15a34ada
Author: Kevin Suo 
AuthorDate: Mon Nov 1 14:15:19 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Nov 1 13:44:48 2021 +0100

tdf#138475: also set font size/weight/posture for CJK/CTL languages...

when parsing the default Calc styles.

As an initial matter, orcus currently does not support XML_font_size_asian,
XML_font_size_complex, XML_font_weight_asian, XML_font_weight_complex etc 
in:

https://gitlab.com/orcus/orcus/-/blob/master/src/liborcus/odf_styles_context.cpp#L128

While this need to be improved by Orcus, actually in Calc we provide
the default font attributes in sc/res/xml/styles.xml and it makes no
sense to set different font size/weight/posture for each language type.
As a result we apply the same font attributes of latin to all these
languages.

Change-Id: I1b105fecce45aa22c6b72e15305e25dc6669d2cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124536
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/source/filter/orcus/interface.cxx 
b/sc/source/filter/orcus/interface.cxx
index f809edb816cd..65ace1c123ed 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -1362,9 +1362,13 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& 
rSet) const
 {
 FontItalic eItalic = mbItalic ? ITALIC_NORMAL : ITALIC_NONE;
 rSet.Put(SvxPostureItem(eItalic, ATTR_FONT_POSTURE));
+rSet.Put(SvxPostureItem(eItalic, ATTR_CJK_FONT_POSTURE));
+rSet.Put(SvxPostureItem(eItalic, ATTR_CTL_FONT_POSTURE));
 
 FontWeight eWeight = mbBold ? WEIGHT_BOLD : WEIGHT_NORMAL;
 rSet.Put(SvxWeightItem(eWeight, ATTR_FONT_WEIGHT));
+rSet.Put(SvxWeightItem(eWeight, ATTR_CJK_FONT_WEIGHT));
+rSet.Put(SvxWeightItem(eWeight, ATTR_CTL_FONT_WEIGHT));
 
 rSet.Put( SvxColorItem(maColor, ATTR_FONT_COLOR));
 
@@ -1372,6 +1376,8 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& 
rSet) const
 rSet.Put( SvxFontItem( FAMILY_DONTKNOW, maName, maName, 
PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, ATTR_FONT ));
 
 rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_FONT_HEIGHT));
+rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_CJK_FONT_HEIGHT));
+rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_CTL_FONT_HEIGHT));
 }
 
 if (mbHasUnderlineAttr)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/qa sc/source

2021-10-22 Thread Kevin Suo (via logerrit)
 sc/qa/unit/data/xlsx/tdf130104_indent.xlsx |binary
 sc/qa/unit/subsequent_export-test2.cxx |   91 +
 sc/source/filter/excel/xeextlst.cxx|2 
 sc/source/filter/excel/xestyle.cxx |   15 ++--
 sc/source/filter/excel/xlroot.cxx  |9 ++
 sc/source/filter/inc/xestyle.hxx   |2 
 sc/source/filter/inc/xlroot.hxx|9 +-
 sc/source/filter/oox/stylesbuffer.cxx  |4 -
 8 files changed, 119 insertions(+), 13 deletions(-)

New commits:
commit 7982723a2943d8dcfc533a507880ab5991a04908
Author: Kevin Suo 
AuthorDate: Mon Oct 4 23:11:30 2021 +0800
Commit: Mike Kaganski 
CommitDate: Fri Oct 22 08:29:21 2021 +0200

tdf#130104 - FILESAVE XLSX: cell indent increased on each save

In OOXML, 1 indent = 3 space char width.

-
The Old Method:
-

XLSX Import:

As per the line:
sal_Int32 nIndent = getUnitConverter().scaleToMm100( 3.0 * 
maModel.mnIndent, Unit::Space );
assume the width of space char is 88, then:
If the OOXML indent is 1, then nIndent would be 264.5, and casted to 264.
If the OOXML indent is 2, then nIndent would be 528.5, and casted to 528.
If the OOXML indent is 3, then nIndent would be 792.5, and casted to 792.
...

Also, as Mike Kaganski has pointed out, we use twips in sc indent 
internally, thus it is wrong to convert to Mm100 unit here.

XLSX Export:

As per the line:
nTmpIndent = (nTmpIndent + 100) / 200;
Assume we did not edit the document upon open, and simply save it. Now:
If our indent is 264, then the calculated OOXML indent would be 1.82, and 
then casted to 1, while the expected value is 1.
If our indent is 528, then the calculated OOXML indent would be 3.14, and 
then casted to 3, while the expected value is 2.
If our indent is 792, then the calculated OOXML indent would be 4.46, and 
then casted to 4, while the expected value is 3.
...

Then if you reopen the saved xlsx file with Calc, the increament of indent 
continues on each save which causes serious
format loss.

Most importantly, if you change the indent of cells using the Calc toolbar 
indent icon, one-click would be 10pt = 200 twips,
see defined macro SC_INDENT_STEP. This causes a mess when you change the 
indent in an xlsx document.

-
The New Method
-

In this patch, I have changed the XLSX import to convert the excel indent 
unit to 3-spaces-width *in twips*.
Then, per code advice from Mike Kaganski, as a mirror operation, I have 
changed the XLSX export logic to detect the width
of the space char (which *should* be the same as the one detected at the 
time of xlsx import), and use this width to convert
the indent in twips unit to excel unit. This way, the indent will remain 
the same on xlsx export.

-
TODO:
-

1. On xlsx import of the file tdf130104_indent.xlsx, the default font (i.e. 
font for the "Normal" style) is "Times New Roman".
However, when the UI locale is set to Simplified Chinese and "Asian" option 
is enabled in Tools->Options->Language Settigns->
Languages->"Default Languages for Documents", upon resave as xlsx, the 
default font for the document is changed to "Noto Sans CJK SC"
on my system, which causes the space-width detected to be different from 
the width detected on xlsx import. This seems to be another
bug, see tdf#131349. (Luckily the unit test in this patch passes, this is 
because the change of space width resulted from the change
in default font is very small thus the conversion is not impacted.)

2. The UI part need to be improved, so that after xlsx import, if the user 
hit the "Increase Indent" or "Decrease Indent" toolar
icon to change the indent, Calc should be able to detect that we are 
operating in an xlsx file, thus the "increment" should
be 3 * width of space char, rather than the current SC_INDENT_STEP. Also, 
the if the user changes the default font of the xlsx
document, the Calc should recalculate the indent for each cell to reflect 
the possible change in width of space char.

Change-Id: I5f7a4ecbcd93079d1c19db3b0b641dda949f6fbf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123111
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 
(cherry picked from commit 6b93ee72df1aa42d1a3482ffc396bd0c23134f8b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123872
Tested-by: Jenkins

diff --git a/sc/qa/unit/data/xlsx/tdf130104_indent.xlsx 
b/sc/qa/unit/data/xlsx/tdf130104_indent.xlsx
new file mode 100644
index ..9cb1e78e4587
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf130104_indent.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test2.cxx 
b/sc/qa/unit/subsequent_export-test2.cxx
index cc266e5a2bc0..361ab683a7f3 100644
--- a/sc/qa/unit/subsequent_export-test2.cxx
+++ 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-10-20 Thread Kevin Suo (via logerrit)
 sc/source/filter/html/htmlpars.cxx |   96 -
 sc/source/filter/inc/htmlpars.hxx  |2 
 2 files changed, 55 insertions(+), 43 deletions(-)

New commits:
commit a25f615a103f6ed3c2d4c35d2eacdd828b75854e
Author: Kevin Suo 
AuthorDate: Sat Oct 16 11:07:13 2021 +0800
Commit: Noel Grandin 
CommitDate: Wed Oct 20 08:35:45 2021 +0200

tdf#96499 sc htmlimport: fix broken CSSHandler so that...

...ScHTMLStyles can handle those MSO-Number-Formats again.

The CSSHandler was added by the following commit, after which the
sc htmlimport can parse the CSS stylesheets and set number formats
of table cells accordingly:

commit 24d8e4eaf4543c5b39b9e816d8514525b098827d
Author: Kohei Yoshida
Date:   Thu Jul 28 00:46:55 2011 -0400
Parse CSS in the 

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

2021-10-19 Thread Kevin Suo (via logerrit)
 sc/source/filter/html/htmlpars.cxx |   96 -
 sc/source/filter/inc/htmlpars.hxx  |2 
 2 files changed, 55 insertions(+), 43 deletions(-)

New commits:
commit a0c23b40905d7b59caf46fc8887864ab35142522
Author: Kevin Suo 
AuthorDate: Sat Oct 16 11:07:13 2021 +0800
Commit: Noel Grandin 
CommitDate: Tue Oct 19 16:13:45 2021 +0200

tdf#96499 sc htmlimport: fix broken CSSHandler so that...

...ScHTMLStyles can handle those MSO-Number-Formats again.

The CSSHandler was added by the following commit, after which the
sc htmlimport can parse the CSS stylesheets and set number formats
of table cells accordingly:

commit 24d8e4eaf4543c5b39b9e816d8514525b098827d
Author: Kohei Yoshida
Date:   Thu Jul 28 00:46:55 2011 -0400
Parse CSS in the 

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

2021-10-11 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx |  113 +++--
 1 file changed, 46 insertions(+), 67 deletions(-)

New commits:
commit 2d486bac81e06c64d13c647f35d3f4affbeb183e
Author: Kevin Suo 
AuthorDate: Mon Oct 11 12:29:00 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Oct 11 09:08:37 2021 +0200

tdf#143959 sdext.pdfimport: call vcl::Font::identifyFont directly

Previously the unittest testTdf143959_nameFromFontFile did not
fail even if the fixing code in wrapper.cxx is removed.
That was because the "if (xHolder.is())" condition is always false
in the unittest run, which suggests that the calling of
com.sun.star.awt.FontIdentificator through the uno did not work
in some circumstances. See comments in:
https://gerrit.libreoffice.org/c/core/+/120815

In this patch, we call the vcl::Font::identifyFont directly rather
than through the uno calling. This is proven to work in both the
manual and unittest running.

Change-Id: I6334bca2defaa27cf6ac72af3d621fbb59e57980
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123358
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 4de5a8516297..4d1f328d6f34 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -484,14 +484,14 @@ e.g., TimesNewRoman -> Times New Roman
 */
 void LineParser::parseFontFamilyName( FontAttributes& rResult )
 {
-SAL_WARN("sdext.pdfimport", "Processing " << rResult.familyName << " ---");
+SAL_INFO("sdext.pdfimport", "Processing " << rResult.familyName << " ---");
 rResult.familyName = rResult.familyName.trim();
 for (const OUString& fontAttributesSuffix: fontAttributesSuffixes)
 {
 if ( rResult.familyName.endsWith(fontAttributesSuffix) )
 {
 rResult.familyName = 
rResult.familyName.replaceAll(fontAttributesSuffix, "");
-SAL_WARN("sdext.pdfimport", rResult.familyName);
+SAL_INFO("sdext.pdfimport", rResult.familyName);
 if (fontAttributesSuffix == u"Bold")
 {
 rResult.fontWeight = u"bold";
@@ -579,7 +579,7 @@ void LineParser::readFont()
 sFontWeight = u"800";
 else if (nFontWeight == 9) // W900, Black
 sFontWeight = u"900";
-SAL_WARN("sdext.pdfimport", "Font weight passed from xpdfimport is: " << 
sFontWeight);
+SAL_INFO("sdext.pdfimport", "Font weight passed from xpdfimport is: " << 
sFontWeight);
 
 FontAttributes aResult( OStringToOUString( aFontName, 
RTL_TEXTENCODING_UTF8 ),
 sFontWeight,
@@ -602,79 +602,58 @@ void LineParser::readFont()
 uno::Sequence aFontFile(nFileLen);
 readBinaryData(aFontFile);  // Read fontFile.
 
-uno::Sequence aArgs(1);
-awt::FontDescriptor aFontDescriptor;
-aArgs[0] <<= aFontFile;
+vcl::Font aFontReadResult = 
vcl::Font::identifyFont(aFontFile.getArray(), nFileLen);
+SAL_INFO("sdext.pdfimport", "familyName: " << 
aFontReadResult.GetFamilyName());
 
-try
+if (!aFontReadResult.GetFamilyName().isEmpty()) // font detection 
successful
 {
-uno::Reference xHolder(
-
m_parser.m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
-"com.sun.star.awt.FontIdentificator", aArgs, 
m_parser.m_xContext),
-uno::UNO_QUERY);
-if (xHolder.is())
-{
-uno::Any aFontReadResult(xHolder->getMaterial());
-aFontReadResult >>= aFontDescriptor;
-if (!aFontDescriptor.Name.isEmpty())
-{
-// Family name
-aResult.familyName = aFontDescriptor.Name;
-SAL_INFO("sdext.pdfimport", aResult.familyName);
-// tdf#143959: there are cases when the family name 
returned by font descriptor
-// is like "AA+TimesNewRoman,Bold". In this case, use 
the font name
-// determined by parseFontFamilyName instead, but still 
determine the font
-// attributes (bold italic etc) from the font descriptor.
-if (aResult.familyName.getLength() > 7 and 
aResult.familyName.indexOf(u"+", 6) == 6)
-{
-aResult.familyName = aResult.familyName.copy(7, 
aResult.familyName.getLength() - 7);
-parseFontFamilyName(aResult);
-}
-
-// Font weight
-if (aFontDescriptor.Weight == 
com::sun::star::awt::FontWeight::THIN)
-aResult.fontWeight = u"100";
-else if (aFontDescriptor.Weight == 
com::sun::star::awt::FontWeight::ULTRALIGHT)
-aResult.fontWeight = 

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

2021-10-11 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/contentsink.hxx |   
12 -
 sdext/source/pdfimport/inc/pdfihelper.hxx  |   
 2 
 sdext/source/pdfimport/inc/wrapper.hxx |   
 1 
 sdext/source/pdfimport/test/testdocs/tdf78427-MyraidPro-Semibold-Light.pdf 
|binary
 sdext/source/pdfimport/test/tests.cxx  |   
65 +--
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |   
 9 -
 sdext/source/pdfimport/tree/pdfiprocessor.cxx  |   
 4 
 sdext/source/pdfimport/tree/writertreevisiting.cxx |   
20 +-
 sdext/source/pdfimport/wrapper/wrapper.cxx |   
88 --
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx  |   
 4 
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx  |   
12 -
 11 files changed, 158 insertions(+), 59 deletions(-)

New commits:
commit 4eef83dc4a8879f21ee6c98226510ac728bc317a
Author: Kevin Suo 
AuthorDate: Sun Oct 10 21:25:58 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Oct 11 09:07:59 2021 +0200

sdext.pdfimport tdf#78427: Add support for more Font Weight features

...e.g. Thin, Extra-Light, Light, Semi-Bold, Bold, Extra-Bold and Black.

Previously the xpdfimport code passes the isBold value which is bool value.
sdext.pdfimport accepted this value from the xpdfimport output and check
whether a font is bold or not. However, there are many other FontWeight
features more than a "bold".

This patch changes the isBold to the GfxFont::Weight type, and changed the
sdext.pdfimport isBold bool type (in FontAttributes) to an OUString 
fontWeight.
The value for the fontWeight is set according to the GfxFont::Weight passed
by xpdfimport, and then this fontWeight is passed to the ODF xml generation
stage and used there directly.

Now the Semibold and Light (as shown in the unittest file) can be currectly
handled. However, for other weights the parseFontFamilyName still need to
be updated, but before doing that I plan to refector this function as the
current logic is very difficult for maintennance.

Change-Id: If2ce5f0f41c83843d8a6aeb30134b3faf99ba877
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123339
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/inc/contentsink.hxx 
b/sdext/source/pdfimport/inc/contentsink.hxx
index dbe1b0e08808..9d016a7e2a3e 100644
--- a/sdext/source/pdfimport/inc/contentsink.hxx
+++ b/sdext/source/pdfimport/inc/contentsink.hxx
@@ -48,14 +48,14 @@ namespace pdfi
 {
 struct FontAttributes
 {
-FontAttributes( const OUString& familyName_,
-bool isBold_,
+FontAttributes( const OUString&  familyName_,
+const OUString&  sFontWeight,
 bool isItalic_,
 bool isUnderline_,
 double   size_,
 double   ascent_) :
 familyName(familyName_),
-isBold(isBold_),
+fontWeight(sFontWeight),
 isItalic(isItalic_),
 isUnderline(isUnderline_),
 isOutline(false),
@@ -65,7 +65,7 @@ namespace pdfi
 
 FontAttributes() :
 familyName(),
-isBold(false),
+fontWeight(u"normal"),
 isItalic(false),
 isUnderline(false),
 isOutline(false),
@@ -74,7 +74,7 @@ namespace pdfi
 {}
 
 OUStringfamilyName;
-boolisBold;
+OUStringfontWeight;
 boolisItalic;
 boolisUnderline;
 boolisOutline;
@@ -84,7 +84,7 @@ namespace pdfi
 bool operator==(const FontAttributes& rFont) const
 {
 return familyName == rFont.familyName &&
-!isBold == !rFont.isBold &&
+fontWeight == rFont.fontWeight &&
 !isItalic == !rFont.isItalic &&
 !isUnderline == !rFont.isUnderline &&
 !isOutline == !rFont.isOutline &&
diff --git a/sdext/source/pdfimport/inc/pdfihelper.hxx 
b/sdext/source/pdfimport/inc/pdfihelper.hxx
index aa3a22bd2b67..6b663b203e62 100644
--- a/sdext/source/pdfimport/inc/pdfihelper.hxx
+++ b/sdext/source/pdfimport/inc/pdfihelper.hxx
@@ -82,7 +82,7 @@ namespace pdfi
 {
 std::size_t seed = 0;
 o3tl::hash_combine(seed, rFont.familyName.hashCode());
-o3tl::hash_combine(seed, rFont.isBold);
+o3tl::hash_combine(seed, rFont.fontWeight);
 o3tl::hash_combine(seed, rFont.isItalic);
 o3tl::hash_combine(seed, 

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

2021-10-08 Thread Kevin Suo (via logerrit)
 sc/qa/unit/data/xlsx/tdf130104_indent.xlsx |binary
 sc/qa/unit/subsequent_export_test2.cxx |   91 +
 sc/source/filter/excel/xeextlst.cxx|2 
 sc/source/filter/excel/xestyle.cxx |   15 ++--
 sc/source/filter/excel/xlroot.cxx  |9 ++
 sc/source/filter/inc/xestyle.hxx   |2 
 sc/source/filter/inc/xlroot.hxx|9 +-
 sc/source/filter/oox/stylesbuffer.cxx  |4 -
 8 files changed, 119 insertions(+), 13 deletions(-)

New commits:
commit 6b93ee72df1aa42d1a3482ffc396bd0c23134f8b
Author: Kevin Suo 
AuthorDate: Mon Oct 4 23:11:30 2021 +0800
Commit: Mike Kaganski 
CommitDate: Fri Oct 8 08:01:01 2021 +0200

tdf#130104 - FILESAVE XLSX: cell indent increased on each save

In OOXML, 1 indent = 3 space char width.

-
The Old Method:
-

XLSX Import:

As per the line:
sal_Int32 nIndent = getUnitConverter().scaleToMm100( 3.0 * 
maModel.mnIndent, Unit::Space );
assume the width of space char is 88, then:
If the OOXML indent is 1, then nIndent would be 264.5, and casted to 264.
If the OOXML indent is 2, then nIndent would be 528.5, and casted to 528.
If the OOXML indent is 3, then nIndent would be 792.5, and casted to 792.
...

Also, as Mike Kaganski has pointed out, we use twips in sc indent 
internally, thus it is wrong to convert to Mm100 unit here.

XLSX Export:

As per the line:
nTmpIndent = (nTmpIndent + 100) / 200;
Assume we did not edit the document upon open, and simply save it. Now:
If our indent is 264, then the calculated OOXML indent would be 1.82, and 
then casted to 1, while the expected value is 1.
If our indent is 528, then the calculated OOXML indent would be 3.14, and 
then casted to 3, while the expected value is 2.
If our indent is 792, then the calculated OOXML indent would be 4.46, and 
then casted to 4, while the expected value is 3.
...

Then if you reopen the saved xlsx file with Calc, the increament of indent 
continues on each save which causes serious
format loss.

Most importantly, if you change the indent of cells using the Calc toolbar 
indent icon, one-click would be 10pt = 200 twips,
see defined macro SC_INDENT_STEP. This causes a mess when you change the 
indent in an xlsx document.

-
The New Method
-

In this patch, I have changed the XLSX import to convert the excel indent 
unit to 3-spaces-width *in twips*.
Then, per code advice from Mike Kaganski, as a mirror operation, I have 
changed the XLSX export logic to detect the width
of the space char (which *should* be the same as the one detected at the 
time of xlsx import), and use this width to convert
the indent in twips unit to excel unit. This way, the indent will remain 
the same on xlsx export.

-
TODO:
-

1. On xlsx import of the file tdf130104_indent.xlsx, the default font (i.e. 
font for the "Normal" style) is "Times New Roman".
However, when the UI locale is set to Simplified Chinese and "Asian" option 
is enabled in Tools->Options->Language Settigns->
Languages->"Default Languages for Documents", upon resave as xlsx, the 
default font for the document is changed to "Noto Sans CJK SC"
on my system, which causes the space-width detected to be different from 
the width detected on xlsx import. This seems to be another
bug, see tdf#131349. (Luckily the unit test in this patch passes, this is 
because the change of space width resulted from the change
in default font is very small thus the conversion is not impacted.)

2. The UI part need to be improved, so that after xlsx import, if the user 
hit the "Increase Indent" or "Decrease Indent" toolar
icon to change the indent, Calc should be able to detect that we are 
operating in an xlsx file, thus the "increment" should
be 3 * width of space char, rather than the current SC_INDENT_STEP. Also, 
the if the user changes the default font of the xlsx
document, the Calc should recalculate the indent for each cell to reflect 
the possible change in width of space char.

Change-Id: I5f7a4ecbcd93079d1c19db3b0b641dda949f6fbf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123111
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/sc/qa/unit/data/xlsx/tdf130104_indent.xlsx 
b/sc/qa/unit/data/xlsx/tdf130104_indent.xlsx
new file mode 100644
index ..9cb1e78e4587
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf130104_indent.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 0f62be048b4c..336b3ca7e167 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -208,6 +208,7 @@ public:
 void testTdf142264ManyChartsToXLSX();
 void testTdf143929MultiColumnToODS();
 void 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sdext/source

2021-08-25 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit 7c2d2f8fbc8b5751121c7c69dbc0f764ec4cc35e
Author: Kevin Suo 
AuthorDate: Sat Aug 21 17:37:52 2021 +0800
Commit: Michael Stahl 
CommitDate: Wed Aug 25 15:09:21 2021 +0200

tdf#143959 sdext.pdfimport: fix font name with subtag

as returned by the font descriptor when reading the font file.

Change-Id: I376b887e6356e765f669b41c43776f78f94c3623
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120815
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120896
Reviewed-by: Kevin Suo 
Reviewed-by: Michael Stahl 

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index a887160eb56c..2f837988d94d 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -675,6 +675,15 @@ void LineParser::readFont()
 if (!aFontDescriptor.Name.isEmpty())
 {
 aResult.familyName = aFontDescriptor.Name;
+// tdf#143959: there are cases when the family name 
returned by font descriptor
+// is like "AA+TimesNewRoman,Bold". In this case, use 
the font name
+// determined by parseFontFamilyName instead, but still 
determine the font
+// attributes (bold italic etc) from the font descriptor.
+if (aResult.familyName.getLength() > 7 and 
aResult.familyName.indexOf(u"+", 6) == 6)
+{
+aResult.familyName = aResult.familyName.copy(7, 
aResult.familyName.getLength() - 7);
+parseFontFamilyName(aResult);
+}
 aResult.isBold = (aFontDescriptor.Weight > 100.0);
 aResult.isItalic = (aFontDescriptor.Slant == 
awt::FontSlant_OBLIQUE ||
 aFontDescriptor.Slant == 
awt::FontSlant_ITALIC);


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

2021-08-22 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/testdocs/testTdf143959.pdf |binary
 sdext/source/pdfimport/test/tests.cxx  |   34 +
 sdext/source/pdfimport/wrapper/wrapper.cxx |9 
 3 files changed, 43 insertions(+)

New commits:
commit a1759769804a7f3b9895b481229d497a9eb4c70a
Author: Kevin Suo 
AuthorDate: Sat Aug 21 17:37:52 2021 +0800
Commit: Noel Grandin 
CommitDate: Sun Aug 22 10:29:50 2021 +0200

tdf#143959 sdext.pdfimport: fix font name with subtag

as returned by the font descriptor when reading the font file.

Change-Id: I376b887e6356e765f669b41c43776f78f94c3623
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120815
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/test/testdocs/testTdf143959.pdf 
b/sdext/source/pdfimport/test/testdocs/testTdf143959.pdf
new file mode 100644
index ..594e734a5629
Binary files /dev/null and 
b/sdext/source/pdfimport/test/testdocs/testTdf143959.pdf differ
diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index cb8416d71b21..f47fa459a03c 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -710,6 +710,39 @@ namespace
 assertXPath(pXmlDoc, xpath, "text-outline", "true");
 }
 
+void testTdf143959_nameFromFontFile()
+{
+rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
+xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
+
+OString aOutput;
+CPPUNIT_ASSERT_MESSAGE("Converting PDF to ODF XML",
+   xAdaptor->odfConvert( 
m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/testTdf143959.pdf"),
+new 
OutputWrapString(aOutput),
+nullptr ));
+
+//std::cout << aOutput << std::endl;
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
+
+/* Test for the 1st text paragraph */
+OUString styleName = getXPath(pXmlDoc, 
"//draw:frame[2]//text:span[1]", "style-name");
+OString xpath = 
"//office:automatic-styles/style:style[@style:name=\"" +
+OUStringToOString(styleName,  RTL_TEXTENCODING_UTF8) +
+"\"]/style:text-properties";
+CPPUNIT_ASSERT_EQUAL(OUString("TimesNewRoman"),
+ getXPath(pXmlDoc, xpath, 
"font-family").replaceAll(u" ", u""));
+
+/* Test for the "TOTAL ESTA HOJA USD" paragraph" */
+styleName = getXPath(pXmlDoc, 
"//draw:frame[last()-1]//text:span[1]", "style-name");
+xpath = "//office:automatic-styles/style:style[@style:name=\"" +
+OUStringToOString(styleName,  RTL_TEXTENCODING_UTF8) +
+"\"]/style:text-properties";
+CPPUNIT_ASSERT_EQUAL(OUString("TimesNewRoman"),
+ getXPath(pXmlDoc, xpath, 
"font-family").replaceAll(u" ", u""));
+CPPUNIT_ASSERT_EQUAL(OUString("bold"),
+ getXPath(pXmlDoc, xpath, "font-weight"));
+}
+
 CPPUNIT_TEST_SUITE(PDFITest);
 CPPUNIT_TEST(testXPDFParser);
 CPPUNIT_TEST(testOdfWriterExport);
@@ -719,6 +752,7 @@ namespace
 CPPUNIT_TEST(testTdf105536);
 CPPUNIT_TEST(testTdf141709);
 CPPUNIT_TEST(testFontFeatures);
+CPPUNIT_TEST(testTdf143959_nameFromFontFile);
 CPPUNIT_TEST_SUITE_END();
 };
 
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 7cf30241c5ee..2efdab6f8553 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -584,6 +584,15 @@ void LineParser::readFont()
 if (!aFontDescriptor.Name.isEmpty())
 {
 aResult.familyName = aFontDescriptor.Name;
+// tdf#143959: there are cases when the family name 
returned by font descriptor
+// is like "AA+TimesNewRoman,Bold". In this case, use 
the font name
+// determined by parseFontFamilyName instead, but still 
determine the font
+// attributes (bold italic etc) from the font descriptor.
+if (aResult.familyName.getLength() > 7 and 
aResult.familyName.indexOf(u"+", 6) == 6)
+{
+aResult.familyName = aResult.familyName.copy(7, 
aResult.familyName.getLength() - 7);
+parseFontFamilyName(aResult);
+}
 aResult.isBold = (aFontDescriptor.Weight > 100.0);
 aResult.isItalic = (aFontDescriptor.Slant == 
awt::FontSlant_OBLIQUE ||
 

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

2021-07-26 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx|   97 +++---
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |5 
 2 files changed, 89 insertions(+), 13 deletions(-)

New commits:
commit 2ee3d4076481262c1e3014dc9341cdf3d1922ff7
Author: Kevin Suo 
AuthorDate: Sat Jul 17 14:25:45 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Jul 26 08:28:20 2021 +0200

sdext.pdfimport: Restore to read font file for the determination...

of font attributes, as suggested by Mike Kaganski in
https://gerrit.libreoffice.org/c/core/+/118977.

This partially reverts da59686672fd2bc98f8cb28d5f04dc978b50ac13
but did some modification of the previous code with some
explanationary comments.

Change-Id: I224d9e717bf374a90f4834cbd9e11bf1138b41ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119090
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index e22fe0aeca72..ffa29b1f7b7b 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -503,25 +504,36 @@ void LineParser::parseFontFamilyName( FontAttributes& 
rResult )
 
 void LineParser::readFont()
 {
-OString aFontName;
+/*
+xpdf line is like (separated by space):
+updateFont  
  
+updateFont 14   100  0 
1200.00   23068TimesNewRomanPSMT
+
+If nEmbedSize > 0, then a fontFile is followed as a stream.
+*/
+
+OStringaFontName;
 sal_Int64  nFontID;
 sal_Int32  nIsEmbedded, nIsBold, nIsItalic, nIsUnderline, nFileLen;
 double nSize;
 
-readInt64(nFontID);
-readInt32(nIsEmbedded);
-readInt32(nIsBold);
-readInt32(nIsItalic);
-readInt32(nIsUnderline);
-readDouble(nSize);
-readInt32(nFileLen);
+readInt64(nFontID); // read FontID
+readInt32(nIsEmbedded); // read isEmbedded
+readInt32(nIsBold); // read isBold
+readInt32(nIsItalic);   // read isItalic
+readInt32(nIsUnderline);// read isUnderline
+readDouble(nSize);  // read TransformedFontSize
+readInt32(nFileLen);// read nEmbedSize
 
 nSize = nSize < 0.0 ? -nSize : nSize;
-aFontName = lcl_unescapeLineFeeds( m_aLine.subView( m_nCharIndex ) );
+// Read FontName. From the current position to the end (any white spaces 
will be included).
+aFontName = lcl_unescapeLineFeeds(m_aLine.subView(m_nCharIndex));
 
 // name gobbles up rest of line
 m_nCharIndex = std::string_view::npos;
 
+// Check if this font is already in our font map list.
+// If yes, update the font size and skip.
 Parser::FontMapType::const_iterator pFont( 
m_parser.m_aFontMap.find(nFontID) );
 if( pFont != m_parser.m_aFontMap.end() )
 {
@@ -534,16 +546,75 @@ void LineParser::readFont()
 }
 
 // yet unknown font - get info and add to map
-FontAttributes aResult( OStringToOUString( aFontName,
-RTL_TEXTENCODING_UTF8 ),
+FontAttributes aResult( OStringToOUString( aFontName, 
RTL_TEXTENCODING_UTF8 ),
 nIsBold != 0,
 nIsItalic != 0,
 nIsUnderline != 0,
 nSize,
 1.0);
 
-// extract textual attributes (bold, italic in the name, etc.)
-parseFontFamilyName(aResult);
+/* The above font attributes (fontName, bold, italic) are based on
+   xpdf line output and may not be reliable. To get correct attributes,
+   we do the following:
+1. Read the embeded font file and determine the attributes based on the
+   font file.
+2. If we failed to read the font file, or empty result is returned, then
+   determine the font attributes from the font name.
+3. If all these attemps have failed, then use a fallback font.
+*/
+if (nFileLen > 0)
+{
+uno::Sequence aFontFile(nFileLen);
+readBinaryData(aFontFile);  // Read fontFile.
+
+uno::Sequence aArgs(1);
+awt::FontDescriptor aFontDescriptor;
+aArgs[0] <<= aFontFile;
+
+try
+{
+uno::Reference xHolder(
+
m_parser.m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+"com.sun.star.awt.FontIdentificator", aArgs, 
m_parser.m_xContext),
+uno::UNO_QUERY);
+if (xHolder.is())
+{
+uno::Any aFontReadResult(xHolder->getMaterial());
+aFontReadResult >>= aFontDescriptor;
+if (!aFontDescriptor.Name.isEmpty())
+{
+aResult.familyName = aFontDescriptor.Name;
+aResult.isBold = 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sdext/source

2021-07-23 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx|   97 +++---
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |5 
 2 files changed, 89 insertions(+), 13 deletions(-)

New commits:
commit 0ebe806d011b7084b49dd038f3521a03bc935f8c
Author: Kevin Suo 
AuthorDate: Sat Jul 17 14:25:45 2021 +0800
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Jul 23 14:53:03 2021 +0200

sdext.pdfimport: Restore to read font file for the determination...

of font attributes, as suggested by Mike Kaganski in
https://gerrit.libreoffice.org/c/core/+/118977.

This partially reverts da59686672fd2bc98f8cb28d5f04dc978b50ac13
but did some modification of the previous code with some
explanationary comments.

Change-Id: I224d9e717bf374a90f4834cbd9e11bf1138b41ff
(cherry picked from commit a91d373837550fbde9c6ba8ca0f43aa8603d86f2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119118
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index ae4903526c65..a887160eb56c 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -594,25 +595,36 @@ void LineParser::parseFontFamilyName( FontAttributes& 
rResult )
 
 void LineParser::readFont()
 {
-OString aFontName;
+/*
+xpdf line is like (separated by space):
+updateFont  
  
+updateFont 14   100  0 
1200.00   23068TimesNewRomanPSMT
+
+If nEmbedSize > 0, then a fontFile is followed as a stream.
+*/
+
+OStringaFontName;
 sal_Int64  nFontID;
 sal_Int32  nIsEmbedded, nIsBold, nIsItalic, nIsUnderline, nFileLen;
 double nSize;
 
-readInt64(nFontID);
-readInt32(nIsEmbedded);
-readInt32(nIsBold);
-readInt32(nIsItalic);
-readInt32(nIsUnderline);
-readDouble(nSize);
-readInt32(nFileLen);
+readInt64(nFontID); // read FontID
+readInt32(nIsEmbedded); // read isEmbedded
+readInt32(nIsBold); // read isBold
+readInt32(nIsItalic);   // read isItalic
+readInt32(nIsUnderline);// read isUnderline
+readDouble(nSize);  // read TransformedFontSize
+readInt32(nFileLen);// read nEmbedSize
 
 nSize = nSize < 0.0 ? -nSize : nSize;
-aFontName = lcl_unescapeLineFeeds( m_aLine.subView( m_nCharIndex ) );
+// Read FontName. From the current position to the end (any white spaces 
will be included).
+aFontName = lcl_unescapeLineFeeds(m_aLine.subView(m_nCharIndex));
 
 // name gobbles up rest of line
 m_nCharIndex = std::string_view::npos;
 
+// Check if this font is already in our font map list.
+// If yes, update the font size and skip.
 Parser::FontMapType::const_iterator pFont( 
m_parser.m_aFontMap.find(nFontID) );
 if( pFont != m_parser.m_aFontMap.end() )
 {
@@ -625,16 +637,75 @@ void LineParser::readFont()
 }
 
 // yet unknown font - get info and add to map
-FontAttributes aResult( OStringToOUString( aFontName,
-RTL_TEXTENCODING_UTF8 ),
+FontAttributes aResult( OStringToOUString( aFontName, 
RTL_TEXTENCODING_UTF8 ),
 nIsBold != 0,
 nIsItalic != 0,
 nIsUnderline != 0,
 nSize,
 1.0);
 
-// extract textual attributes (bold, italic in the name, etc.)
-parseFontFamilyName(aResult);
+/* The above font attributes (fontName, bold, italic) are based on
+   xpdf line output and may not be reliable. To get correct attributes,
+   we do the following:
+1. Read the embeded font file and determine the attributes based on the
+   font file.
+2. If we failed to read the font file, or empty result is returned, then
+   determine the font attributes from the font name.
+3. If all these attemps have failed, then use a fallback font.
+*/
+if (nFileLen > 0)
+{
+uno::Sequence aFontFile(nFileLen);
+readBinaryData(aFontFile);  // Read fontFile.
+
+uno::Sequence aArgs(1);
+awt::FontDescriptor aFontDescriptor;
+aArgs[0] <<= aFontFile;
+
+try
+{
+uno::Reference xHolder(
+
m_parser.m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+"com.sun.star.awt.FontIdentificator", aArgs, 
m_parser.m_xContext),
+uno::UNO_QUERY);
+if (xHolder.is())
+{
+uno::Any aFontReadResult(xHolder->getMaterial());
+aFontReadResult >>= aFontDescriptor;
+if (!aFontDescriptor.Name.isEmpty())
+{
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sdext/source

2021-07-16 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 4137f07b9b2a26faeafec4f5ee815f16adcec396
Author: Kevin Suo 
AuthorDate: Thu Jul 15 12:56:43 2021 +0200
Commit: Caolán McNamara 
CommitDate: Fri Jul 16 10:15:47 2021 +0200

restore compatibility with older popplers

with poppler 20.09:


/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:
 In member function 'int
 pdfi::PDFOutDev::parseFont(long long int, GfxFont*, 
GfxState*) const':

/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:438:39:
 error: 'class
 GfxFont' has no member named 'getNameWithoutSubsetTag'


https://www.google.com/search?q=getNameWithoutSubsetTag=getNameWithoutSubsetTag=chrome..69i57.784j0j7=chrome=UTF-8
 suggests it was added in 20.12

Change-Id: I4eacd2d740cb689ff9b3c6cab59376e01b1ba162
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118977
Tested-by: René Engelhard 
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 07087041610ca8351d764c838ae07fa58f3bdf9e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118929
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index d8b73f621a09..bc313f76ecc4 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -432,10 +432,15 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* 
gfxFont, GfxState* state )
 FontAttributes aNewFont;
 int nSize = 0;
 
-#if POPPLER_CHECK_VERSION(0, 64, 0)
-const
-#endif
+#if POPPLER_CHECK_VERSION(20, 12, 0)
 std::string familyName = gfxFont->getNameWithoutSubsetTag();
+#else
+std::string familyName = gfxFont->getName()->toStr();
+if (familyName.length() > 7 && familyName.at(6) == '+')
+{
+familyName = familyName.substr(7);
+}
+#endif
 if( familyName != "" )
 {
 aNewFont.familyName.clear();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-16 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 07087041610ca8351d764c838ae07fa58f3bdf9e
Author: Kevin Suo 
AuthorDate: Thu Jul 15 12:56:43 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 16 09:06:47 2021 +0200

restore compatibility with older popplers

with poppler 20.09:


/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:
 In member function 'int
 pdfi::PDFOutDev::parseFont(long long int, GfxFont*, 
GfxState*) const':

/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:438:39:
 error: 'class
 GfxFont' has no member named 'getNameWithoutSubsetTag'


https://www.google.com/search?q=getNameWithoutSubsetTag=getNameWithoutSubsetTag=chrome..69i57.784j0j7=chrome=UTF-8
 suggests it was added in 20.12

Change-Id: I4eacd2d740cb689ff9b3c6cab59376e01b1ba162
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118977
Tested-by: René Engelhard 
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index d8b73f621a09..bc313f76ecc4 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -432,10 +432,15 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* 
gfxFont, GfxState* state )
 FontAttributes aNewFont;
 int nSize = 0;
 
-#if POPPLER_CHECK_VERSION(0, 64, 0)
-const
-#endif
+#if POPPLER_CHECK_VERSION(20, 12, 0)
 std::string familyName = gfxFont->getNameWithoutSubsetTag();
+#else
+std::string familyName = gfxFont->getName()->toStr();
+if (familyName.length() > 7 && familyName.at(6) == '+')
+{
+familyName = familyName.substr(7);
+}
+#endif
 if( familyName != "" )
 {
 aNewFont.familyName.clear();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sdext/CppunitTest_sdext_pdfimport.mk sdext/source

2021-07-14 Thread Kevin Suo (via logerrit)
 sdext/CppunitTest_sdext_pdfimport.mk  |1 
 sdext/source/pdfimport/test/testdocs/testFontFeatures.pdf |binary
 sdext/source/pdfimport/test/tests.cxx |  136 +-
 3 files changed, 136 insertions(+), 1 deletion(-)

New commits:
commit 12b57e43563a643dd653d78f3e2877ef75998d82
Author: Kevin Suo 
AuthorDate: Wed Jul 14 23:59:35 2021 +0800
Commit: Noel Grandin 
CommitDate: Wed Jul 14 18:55:47 2021 +0200

tdf#78427 tdf#81481 sdext.pdfimport: added unittest

Change-Id: Ia112762f0ece1be589997f6b9be336424603a1c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118947
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/CppunitTest_sdext_pdfimport.mk 
b/sdext/CppunitTest_sdext_pdfimport.mk
index 87a917f8d81d..b2676d32002b 100644
--- a/sdext/CppunitTest_sdext_pdfimport.mk
+++ b/sdext/CppunitTest_sdext_pdfimport.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_CppunitTest_set_include,sdext_pdfimport,\
 $(eval $(call gb_CppunitTest_use_externals,sdext_pdfimport,\
 boost_headers \
 zlib \
+libxml2 \
 ))
 
 $(eval $(call gb_CppunitTest_use_libraries,sdext_pdfimport,\
diff --git a/sdext/source/pdfimport/test/testdocs/testFontFeatures.pdf 
b/sdext/source/pdfimport/test/testdocs/testFontFeatures.pdf
new file mode 100644
index ..0405d95f8425
Binary files /dev/null and 
b/sdext/source/pdfimport/test/testdocs/testFontFeatures.pdf differ
diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 7611511aa92a..cb8416d71b21 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -448,8 +449,13 @@ namespace
 bool  m_bImageSeen;
 };
 
-class PDFITest : public test::BootstrapFixture
+class PDFITest : public test::BootstrapFixture, public XmlTestTools
 {
+protected:
+virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) 
override
+{
+XmlTestTools::registerODFNamespaces(pXmlXPathCtx);
+};
 public:
 void testXPDFParser()
 {
@@ -577,6 +583,133 @@ namespace
 #endif
 }
 
+void testFontFeatures() // tdf#78427
+{
+rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
+xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
+
+OString aOutput;
+CPPUNIT_ASSERT_MESSAGE("Converting PDF to ODF XML",
+   xAdaptor->odfConvert( 
m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/testFontFeatures.pdf"),
+new 
OutputWrapString(aOutput),
+nullptr ));
+std::cout << aOutput << std::endl;
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
+//CPPUNIT_ASSERT(pXmlDoc);
+
+/* Test for the 1st paragraph */
+OUString styleName = getXPath(pXmlDoc, 
"//draw:frame[1]//text:span[1]", "style-name");
+OString xpath = 
"//office:automatic-styles/style:style[@style:name=\"" +
+OUStringToOString(styleName,  RTL_TEXTENCODING_UTF8) +
+"\"]/style:text-properties";
+// the font-weight and  font-style should be normal (e.g., no such 
attribute)
+assertXPathNoAttribute(pXmlDoc, xpath, "font-weight");
+assertXPathNoAttribute(pXmlDoc, xpath, "font-style");
+
+/* Test for the 2nd paragraph */
+styleName = getXPath(pXmlDoc, "//draw:frame[2]//text:span[1]", 
"style-name");
+xpath = "//office:automatic-styles/style:style[@style:name=\"" +
+OUStringToOString(styleName,  RTL_TEXTENCODING_UTF8) +
+"\"]/style:text-properties";
+// there should be a font-weight="bold", but no font-style italic
+assertXPath(pXmlDoc, xpath, "font-weight", "bold");
+assertXPathNoAttribute(pXmlDoc, xpath, "font-style");
+
+/* Test for the 3rd paragraph */
+styleName = getXPath(pXmlDoc, "//draw:frame[3]//text:span[1]", 
"style-name");
+xpath = "//office:automatic-styles/style:style[@style:name=\"" +
+OUStringToOString(styleName,  RTL_TEXTENCODING_UTF8) +
+"\"]/style:text-properties";
+// there should be a font-style="italic", but no font-weight bold
+assertXPathNoAttribute(pXmlDoc, xpath, "font-weight");
+assertXPath(pXmlDoc, xpath, "font-style", "italic");
+
+/* Test for the 4th paragraph */
+styleName = getXPath(pXmlDoc, "//draw:frame[4]//text:span[1]", 
"style-name");
+xpath = 

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

2021-07-14 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/drawtreevisiting.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit b1ca6d3aae3b75ec3e5c1ef17d582bcec01fc7eb
Author: Kevin Suo 
AuthorDate: Wed Jul 14 09:44:30 2021 +0800
Commit: Noel Grandin 
CommitDate: Wed Jul 14 18:53:44 2021 +0200

sdext.pdfimport:  and  don't have "text:style-name" 
attribute

Per OpenDocument specs:
* The  element only has a "text:c" attribute.
* The  element only has a text:tab-ref attribute.

seen in the SAL_WARN message:
warn:xmloff:221658:221658:xmloff/source/text/txtparai.cxx:137: unknown 
attribute urn:oasis:names:tc:opendocument:xmlns:text:1.0 text:style-name 
value=text13
...

Change-Id: I02a29ac2c9f9db026caec19238cd97111ce587c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118946
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 69f70001f6d6..d5ce02ad89bf 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -126,6 +126,7 @@ void DrawXmlEmitter::visit( TextElement& elem, const 
std::list< std::unique_ptr<
 
 m_rEmitContext.rEmitter.beginTag( "text:span", aProps );
 
+aProps = {};
 for(int i=0; i< elem.Text.getLength(); i++)
 {
 OUString strToken=  str.copy(i,1) ;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-14 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/wrapper.hxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 6a1de4f74e2510029313771d2751b6cd59141acf
Author: Kevin Suo 
AuthorDate: Tue Jul 13 15:13:45 2021 +0800
Commit: Noel Grandin 
CommitDate: Wed Jul 14 18:22:20 2021 +0200

tdf#78427 sdext.pdfimport: more bold/italic/Oblique fixes

e.g. the PDF in tdf#107812.
Also added notes to the fontAttributesSuffixes list.

Change-Id: I4a4dcba2d9369c6b09168a18784d2f6e7d08793d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118832
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/inc/wrapper.hxx 
b/sdext/source/pdfimport/inc/wrapper.hxx
index 918f976ee817..12476a01aa1c 100644
--- a/sdext/source/pdfimport/inc/wrapper.hxx
+++ b/sdext/source/pdfimport/inc/wrapper.hxx
@@ -54,21 +54,25 @@ namespace pdfi
 const OUString&rFilterOptions );
 
 const OUString fontAttributesSuffixes[] = {
+// Note: for performance consideration, each one listed here is 
evaluated once,
+// and they are checked from the suffix, thus the order matters.
+// e.g. for "TimesNewRomanPS-BoldItalic", to get "TimesNewRoman", you 
should
+//  first have "Italic", and then "Bold", then "-", and then "PS".
 "MT",
 "PS",
 "PSMT",
 "Regular",
 "Bold",
 "Italic",
-"Bold",
 "Oblique",
+"Bold", //BoldItalic, BoldObique
 "Light",
 "Reg",
 "VKana",
 "-",
 ",",
 ";",
-"PS",
+"PS", // e.g. TimesNewRomanPS-BoldMT
 };
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-14 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |   15 ++-
 sdext/source/pdfimport/tree/pdfiprocessor.cxx  |   15 ++-
 sdext/source/pdfimport/tree/writertreevisiting.cxx |   28 +
 3 files changed, 41 insertions(+), 17 deletions(-)

New commits:
commit fe28633ee6edc5986220c934dfb04aa7b0d065ad
Author: Kevin Suo 
AuthorDate: Wed Jun 30 18:17:36 2021 +0800
Commit: Noel Grandin 
CommitDate: Wed Jul 14 09:07:09 2021 +0200

tdf81484 Draw and Writer pdf import: SimSun bold font is shown as "outline"

Case 1: As discussed in the bug report, SimSun does not have a
 "bold" font. In PDF it uses fill+stroke rendering mode (i.e.,
 Text Render Mode is 2), see CoreTextStyle::CoreTextStyle, as a
 faux bold (fake bold) feature. For faux bold, the text render
 fill color is the same as the stroke color.

Case 2: Also, it is noted that if you apply real "outline"
 characters in Writer and export to PDF, on Draw PDF import
 the text render mode is also 2, but the text render fill color
 is different than the stroke color.
 However, I would argue that for this case on PDF export Writer
 should set the render mode as 1, not 2, per PDF specs, which is
 another issue to be improved.

The old code treated all these two cases as "outline".

This patch:
1) treats render mode 2 as faux bold if the stroke color is the
 same as the fill color; and
2) still treat it as outline if the fill color and stroke color
 are different.

This way, the real outline remains as outline characters while
 the faux bold (fake bold) becomes bold again on pdf import.

This patch Also fixed some incorrect use of 
 attributes per OpenDocument specification.

This patch depends on change-ID I50a510ab9e5483f859ea2a767ea977ea3f065a2e
 which guesses the bold/italic if the font indentifaction had failed
 for whatever reason.

Change-Id: Idabb22ea9b01ba53733c3acbd9de843790ebe8ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118156
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index ebce9efc896b..69f70001f6d6 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -16,8 +16,7 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-
-
+#include 
 #include 
 #include 
 #include 
@@ -828,23 +827,28 @@ void DrawXmlFinalizer::visit( TextElement& elem, const 
std::list< std::unique_pt
 PropertyMap aFontProps;
 
 // family name
+// TODO: tdf#143095: use system font name rather than PSName
+SAL_INFO("sdext.pdfimport", "The font used in xml is: " << 
rFont.familyName);
 aFontProps[ "fo:font-family" ] = rFont.familyName;
+aFontProps[ "style:font-family-asia" ] = rFont.familyName;
 aFontProps[ "style:font-family-complex" ] = rFont.familyName;
 
 // bold
 if( rFont.isBold )
 {
 aFontProps[ "fo:font-weight" ] = "bold";
-aFontProps[ "fo:font-weight-asian" ]   = "bold";
+aFontProps[ "style:font-weight-asian" ]   = "bold";
 aFontProps[ "style:font-weight-complex" ] = "bold";
 }
+
 // italic
 if( rFont.isItalic )
 {
 aFontProps[ "fo:font-style" ] = "italic";
-aFontProps[ "fo:font-style-asian" ]   = "italic";
+aFontProps[ "style:font-style-asian" ]   = "italic";
 aFontProps[ "style:font-style-complex" ] = "italic";
 }
+
 // underline
 if( rFont.isUnderline )
 {
@@ -852,11 +856,10 @@ void DrawXmlFinalizer::visit( TextElement& elem, const 
std::list< std::unique_pt
 aFontProps[ "style:text-underline-width" ]  = "auto";
 aFontProps[ "style:text-underline-color" ]  = "font-color";
 }
+
 // outline
 if( rFont.isOutline )
-{
 aFontProps[ "style:text-outline" ]  = "true";
-}
 
 // size
 SetFontsizeProperties(aFontProps, rFont.size);
diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx 
b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
index ed2eaf6510b9..d63ab04e97fd 100644
--- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx
+++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
@@ -147,7 +147,20 @@ void PDFIProcessor::setFont( const FontAttributes& i_rFont 
)
 FontAttributes aChangedFont( i_rFont );
 GraphicsContext& rGC=getCurrentContext();
 // for text render modes, please see PDF reference manual
-aChangedFont.isOutline = ( (rGC.TextRenderMode == 1) || (rGC. 
TextRenderMode == 2) );
+if (rGC.TextRenderMode == 1)
+{
+aChangedFont.isOutline = true;
+}
+else if (rGC.TextRenderMode == 2)
+{
+// tdf#81484: faux bold is represented as "stroke+fill" (while using 
the 

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

2021-07-12 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/wrapper.hxx |   18 +++
 sdext/source/pdfimport/wrapper/wrapper.cxx |  147 +
 2 files changed, 46 insertions(+), 119 deletions(-)

New commits:
commit cffd97193f7468f770368559d5a5c58bd0bb2327
Author: Kevin Suo 
AuthorDate: Sun Jul 11 14:49:54 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Jul 12 20:21:49 2021 +0200

tdf#78427 sdext.pdfimport: refactor the conversion of font family names

Simplify the code and hopefully improves performance.

The previous code used a long for loop within which it used many duplicated 
parseFontRemoveSuffix. That for loop was simply intended to remove the font 
family name suffixes. However, the rResult.familyName is a OUString and this 
type already has the function of removing suffixes which is more efficient.
Also, defined a list of suffixes to be removed in the header file. New 
suffixes can be easily added to this list.

Change-Id: Idfa11cfe60e2e34a1f7456d29562a89eb3de7662
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118734
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/inc/wrapper.hxx 
b/sdext/source/pdfimport/inc/wrapper.hxx
index 68e383de6a1a..918f976ee817 100644
--- a/sdext/source/pdfimport/inc/wrapper.hxx
+++ b/sdext/source/pdfimport/inc/wrapper.hxx
@@ -52,6 +52,24 @@ namespace pdfi
 const css::uno::Reference<
   css::uno::XComponentContext >&
xContext,
 const OUString&rFilterOptions );
+
+const OUString fontAttributesSuffixes[] = {
+"MT",
+"PS",
+"PSMT",
+"Regular",
+"Bold",
+"Italic",
+"Bold",
+"Oblique",
+"Light",
+"Reg",
+"VKana",
+"-",
+",",
+";",
+"PS",
+};
 }
 
 #endif // INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_WRAPPER_HXX
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index ae4903526c65..e22fe0aeca72 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -165,20 +165,14 @@ public:
 };
 
 class LineParser {
-Parser & m_parser;
-OString   m_aLine;
+Parser  & m_parser;
+OString m_aLine;
 
-static sal_Int32 parseFontCheckForString(const sal_Unicode* pCopy, 
sal_Int32 nCopyLen,
-  const char* pAttrib, sal_Int32 
nAttribLen,
-  FontAttributes& rResult, bool bItalic, 
bool bBold);
-static sal_Int32 parseFontRemoveSuffix(const sal_Unicode* pCopy, sal_Int32 
nCopyLen,
-  const char* pAttrib, sal_Int32 nAttribLen);
-static void  parseFontFamilyName( FontAttributes& aResult );
-
-void   readInt32( sal_Int32& o_Value );
-void   readInt64( sal_Int64& o_Value );
-void   readDouble( double& o_Value );
-void   readBinaryData( uno::Sequence& rBuf );
+static void parseFontFamilyName( FontAttributes& aResult );
+voidreadInt32( sal_Int32& o_Value );
+voidreadInt64( sal_Int64& o_Value );
+voidreadDouble( double& o_Value );
+voidreadBinaryData( uno::Sequence& rBuf );
 
 uno::Sequence readImageImpl();
 
@@ -477,119 +471,34 @@ rendering::ARGBColor LineParser::readColor()
 return aRes;
 }
 
-sal_Int32 LineParser::parseFontCheckForString(
-const sal_Unicode* pCopy, sal_Int32 nCopyLen,
-const char* pAttrib, sal_Int32 nAttribLen,
-FontAttributes& rResult, bool bItalic, bool bBold)
-{
-if (nCopyLen < nAttribLen)
-return 0;
-for (sal_Int32 i = 0; i < nAttribLen; ++i)
-{
-sal_uInt32 nCode = pAttrib[i];
-if (rtl::toAsciiLowerCase(pCopy[i]) != nCode
-&& rtl::toAsciiUpperCase(pCopy[i]) != nCode)
-return 0;
-}
-rResult.isItalic |= bItalic;
-rResult.isBold |= bBold;
-return nAttribLen;
-}
-
-sal_Int32 LineParser::parseFontRemoveSuffix(
-const sal_Unicode* pCopy, sal_Int32 nCopyLen,
-const char* pAttrib, sal_Int32 nAttribLen)
-{
-if (nCopyLen < nAttribLen)
-return 0;
-for (sal_Int32 i = 0; i < nAttribLen; ++i)
-if ( pCopy[nCopyLen - nAttribLen + i] != pAttrib[i] )
-return 0;
-return nAttribLen;
-}
+/* Parse and convert the font family name (passed from xpdfimport) to correct 
font names
+e.g. TimesNewRomanPSMT-> TimesNewRoman
+  TimesNewRomanPS-BoldMT   -> TimesNewRoman
+  TimesNewRomanPS-BoldItalicMT -> TimesNewRoman
+During the conversion, also apply the font features (bold italic etc) to the 
result.
 
+TODO: Further convert the font names to real font names in the system rather 
than the PS names.
+e.g., TimesNewRoman -> Times New Roman
+*/
 void LineParser::parseFontFamilyName( 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sdext/source

2021-07-12 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx|   52 --
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |9 +--
 2 files changed, 3 insertions(+), 58 deletions(-)

New commits:
commit ac3207d3b2c3b6580de14132fd12e9c6fedc6502
Author: Kevin Suo 
AuthorDate: Sat Jul 10 11:47:39 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Jul 12 18:46:36 2021 +0200

tdf#78427 sdext.pdfimport: No need to read a font file for the purpose of...

...determining the bold/italic/underline etc.

The purpose for reading a font file is that in case the font attributes 
determined by the xpdfimport process is not enough, then we use the lo core 
font classes which read in the font file and then determine whether it is bold, 
italic etc.
However, while this works in some cases, it does not work in many cases 
when the font file was actually a subset and a toUnicode map is followed in the 
PDF, see tdf#78427.
In addition, in case the information collected from the xpdfimport process 
is enough, there is no need to read the font file.

This commit removes the read of font file part. Also, this commit uses 
gfxFont->getNameWithoutSubsetTag() to get the font name with the subset tags 
removed, thus simplified the code in wrapper.cxx while also improves performace 
as the remove of subset tags is only run when the font is a subset (the 
previous code did this for all the font names).

Change-Id: I94c1ad8e743abfab81cf0a46da178d4d8b212427
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118733
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
(cherry picked from commit c8d4ced79eaad886d6e863a52d70c24ca9d4be48)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118724

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 2221f1ebe33f..ae4903526c65 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -514,12 +514,6 @@ void LineParser::parseFontFamilyName( FontAttributes& 
rResult )
 
 const sal_Unicode* pCopy = rResult.familyName.getStr();
 sal_Int32 nLen = rResult.familyName.getLength();
-// parse out truetype subsets (e.g. BA+Thorndale)
-if( nLen > 8 && pCopy[6] == '+' )
-{
-pCopy += 7;
-nLen -= 7;
-}
 
 // TODO: Looks like this block needs to be refactored
 while( nLen )
@@ -641,52 +635,6 @@ void LineParser::readFont()
 
 // extract textual attributes (bold, italic in the name, etc.)
 parseFontFamilyName(aResult);
-// need to read font file?
-if( nFileLen )
-{
-uno::Sequence aFontFile(nFileLen);
-readBinaryData( aFontFile );
-
-awt::FontDescriptor aFD;
-uno::Sequence< uno::Any > aArgs(1);
-aArgs[0] <<= aFontFile;
-
-try
-{
-uno::Reference< beans::XMaterialHolder > xMat(
-
m_parser.m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
-"com.sun.star.awt.FontIdentificator", aArgs, 
m_parser.m_xContext ),
-uno::UNO_QUERY );
-if( xMat.is() )
-{
-uno::Any aRes( xMat->getMaterial() );
-if( aRes >>= aFD )
-{
-if (!aFD.Name.isEmpty())
-{
-aResult.familyName = aFD.Name;
-parseFontFamilyName(aResult);
-}
-aResult.isBold  = (aFD.Weight > 100.0);
-aResult.isItalic= (aFD.Slant == awt::FontSlant_OBLIQUE 
||
-   aFD.Slant == awt::FontSlant_ITALIC 
);
-aResult.isUnderline = false;
-aResult.size= 0;
-}
-}
-}
-catch( uno::Exception& )
-{
-}
-
-if( aResult.familyName.isEmpty() )
-{
-// last fallback
-aResult.familyName  = "Arial";
-aResult.isUnderline = false;
-}
-
-}
 
 if (!m_parser.m_xDev)
 m_parser.m_xDev.disposeAndReset(VclPtr::Create());
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index 16ad04bf660a..d8b73f621a09 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -435,11 +435,11 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* 
gfxFont, GfxState* state )
 #if POPPLER_CHECK_VERSION(0, 64, 0)
 const
 #endif
-GooString* pFamily = gfxFont->getName();
-if( pFamily )
+std::string familyName = gfxFont->getNameWithoutSubsetTag();
+if( familyName != "" )
 {
 aNewFont.familyName.clear();
-aNewFont.familyName.append( gfxFont->getName() );
+aNewFont.familyName.append( familyName );
 }

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

2021-07-12 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx|   52 --
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |9 +--
 2 files changed, 3 insertions(+), 58 deletions(-)

New commits:
commit da59686672fd2bc98f8cb28d5f04dc978b50ac13
Author: Kevin Suo 
AuthorDate: Sat Jul 10 11:47:39 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Jul 12 10:57:27 2021 +0200

tdf#78427 sdext.pdfimport: No need to read a font file for the purpose of...

...determining the bold/italic/underline etc.

The purpose for reading a font file is that in case the font attributes 
determined by the xpdfimport process is not enough, then we use the lo core 
font classes which read in the font file and then determine whether it is bold, 
italic etc.
However, while this works in some cases, it does not work in many cases 
when the font file was actually a subset and a toUnicode map is followed in the 
PDF, see tdf#78427.
In addition, in case the information collected from the xpdfimport process 
is enough, there is no need to read the font file.

This commit removes the read of font file part. Also, this commit uses 
gfxFont->getNameWithoutSubsetTag() to get the font name with the subset tags 
removed, thus simplified the code in wrapper.cxx while also improves performace 
as the remove of subset tags is only run when the font is a subset (the 
previous code did this for all the font names).

Change-Id: I94c1ad8e743abfab81cf0a46da178d4d8b212427
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118733
Reviewed-by: Noel Grandin 
Tested-by: Jenkins

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 2221f1ebe33f..ae4903526c65 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -514,12 +514,6 @@ void LineParser::parseFontFamilyName( FontAttributes& 
rResult )
 
 const sal_Unicode* pCopy = rResult.familyName.getStr();
 sal_Int32 nLen = rResult.familyName.getLength();
-// parse out truetype subsets (e.g. BA+Thorndale)
-if( nLen > 8 && pCopy[6] == '+' )
-{
-pCopy += 7;
-nLen -= 7;
-}
 
 // TODO: Looks like this block needs to be refactored
 while( nLen )
@@ -641,52 +635,6 @@ void LineParser::readFont()
 
 // extract textual attributes (bold, italic in the name, etc.)
 parseFontFamilyName(aResult);
-// need to read font file?
-if( nFileLen )
-{
-uno::Sequence aFontFile(nFileLen);
-readBinaryData( aFontFile );
-
-awt::FontDescriptor aFD;
-uno::Sequence< uno::Any > aArgs(1);
-aArgs[0] <<= aFontFile;
-
-try
-{
-uno::Reference< beans::XMaterialHolder > xMat(
-
m_parser.m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
-"com.sun.star.awt.FontIdentificator", aArgs, 
m_parser.m_xContext ),
-uno::UNO_QUERY );
-if( xMat.is() )
-{
-uno::Any aRes( xMat->getMaterial() );
-if( aRes >>= aFD )
-{
-if (!aFD.Name.isEmpty())
-{
-aResult.familyName = aFD.Name;
-parseFontFamilyName(aResult);
-}
-aResult.isBold  = (aFD.Weight > 100.0);
-aResult.isItalic= (aFD.Slant == awt::FontSlant_OBLIQUE 
||
-   aFD.Slant == awt::FontSlant_ITALIC 
);
-aResult.isUnderline = false;
-aResult.size= 0;
-}
-}
-}
-catch( uno::Exception& )
-{
-}
-
-if( aResult.familyName.isEmpty() )
-{
-// last fallback
-aResult.familyName  = "Arial";
-aResult.isUnderline = false;
-}
-
-}
 
 if (!m_parser.m_xDev)
 m_parser.m_xDev.disposeAndReset(VclPtr::Create());
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index 16ad04bf660a..d8b73f621a09 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -435,11 +435,11 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* 
gfxFont, GfxState* state )
 #if POPPLER_CHECK_VERSION(0, 64, 0)
 const
 #endif
-GooString* pFamily = gfxFont->getName();
-if( pFamily )
+std::string familyName = gfxFont->getNameWithoutSubsetTag();
+if( familyName != "" )
 {
 aNewFont.familyName.clear();
-aNewFont.familyName.append( gfxFont->getName() );
+aNewFont.familyName.append( familyName );
 }
 else
 {
@@ -786,9 +786,6 @@ void PDFOutDev::updateFont(GfxState *state)
 aEsc.data() );
 }
 printf( 

[Libreoffice-commits] core.git: g

2021-07-12 Thread Kevin Suo (via logerrit)
 g |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 508ccbdb14ecdebf1aee2110e91f83768ab387f0
Author: Kevin Suo 
AuthorDate: Sat Jun 26 17:42:52 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Jul 12 10:55:05 2021 +0200

Add "--progress" agument to the ./g command

Newer version of git has a --progress option to show the progress when 
running "git submodule update". This is useful in our ./g command expecially 
when we are building the code with l10n languages enabled and the network 
connection is slow. Without this I do not see where I am for the update process 
and may think it have died.

Change-Id: I4c9e1e9bccbd8e6ca2ea2b44f5b6d6d90cad1506
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117922
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 

diff --git a/g b/g
index 918292eb3ee6..8b733fc878c6 100755
--- a/g
+++ b/g
@@ -222,7 +222,7 @@ do_checkout()
 fi
 done
 if [ -f .gitmodules ] ; then
-git submodule update
+git submodule update --progress
 if [ -n "$branch" ] ; then
 git submodule foreach git checkout -b "${branch}" HEAD || return $?
 fi
@@ -243,7 +243,7 @@ do_reset()
 {
 git reset "$@" || return $?
 if [ -f .gitmodules ] ; then
-git submodule update || return $?
+git submodule update --progress || return $?
 else
 # now that is the nasty case we moved prior to submodules
 # delete the submodules left over if any
@@ -277,9 +277,9 @@ do_init_modules()
 done
 for module in $SUBMODULES_CONFIGURED ; do
 if [ -n "$REFERENCED_GIT" ] ; then
-git submodule update --reference 
"$REFERENCED_GIT/.git/modules/$module" "$module" || return $?
+git submodule update --reference 
"$REFERENCED_GIT/.git/modules/$module" --progress "$module" || return $?
 else
-git submodule update "$module" || return $?
+git submodule update --progress "$module" || return $?
 fi
 done
 return 0
@@ -359,7 +359,7 @@ case "$COMMAND" in
 do_init_modules && refresh_all_hooks
 ;;
 fetch)
-(git fetch "$@" && git submodule foreach git fetch "$@" ) && git 
submodule update
+(git fetch "$@" && git submodule foreach git fetch "$@" ) && git 
submodule update --progress
 
 ;;
 grep)
@@ -367,7 +367,7 @@ case "$COMMAND" in
 do_git_cmd "${COMMAND}" "$@"
 ;;
 pull)
-git pull "$@" && git submodule update && refresh_all_hooks
+git pull "$@" && git submodule update --progress && refresh_all_hooks
 ;;
 push)
 git submodule foreach git push "$@"
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sfx2/classification sfx2/Package_classification.mk

2021-06-19 Thread Kevin Suo (via logerrit)
 sfx2/Package_classification.mk|1 
 sfx2/classification/example_zh-CN.xml |   89 ++
 2 files changed, 90 insertions(+)

New commits:
commit 5d4b54a7e1b78598501ad86c855d662652be7c8e
Author: Kevin Suo 
AuthorDate: Wed Jun 16 15:55:57 2021 +0800
Commit: Olivier Hallot 
CommitDate: Sat Jun 19 12:55:26 2021 +0200

Update of TSCP example file for Simplified Chinese (zh-CN)

See l10n discussion in:
https://listarchives.libreoffice.org/global/l10n/2021/msg00193.html

Change-Id: I8ced7f4128b6e633d35770759fa4b82e03356084
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117285
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/sfx2/Package_classification.mk b/sfx2/Package_classification.mk
index 71684f4b1800..c76e07d17fd0 100644
--- a/sfx2/Package_classification.mk
+++ b/sfx2/Package_classification.mk
@@ -17,6 +17,7 @@ $(eval $(call 
gb_Package_add_files,sfx2_classification,$(LIBO_SHARE_FOLDER)/clas
classification/example_nl-NL.xml \
classification/example_pt-BR.xml \
classification/example_sl-SI.xml \
+   classification/example_zh-CN.xml \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sfx2/classification/example_zh-CN.xml 
b/sfx2/classification/example_zh-CN.xml
new file mode 100644
index ..43acce556ca1
--- /dev/null
+++ b/sfx2/classification/example_zh-CN.xml
@@ -0,0 +1,89 @@
+
+
+
+TSCP 示例策略授权
+
+TSCP 示例策略
+
+urn:example:tscp:1
+
+
+
+
+
+
+UK-Cabinet
+0
+
+
+
+
+
+
+Document: Header
+
+保密等级:一般性商务
+
+
+
+UK-Cabinet
+1
+
+
+
+
+
+
+Document: Header
+
+保密等级:保密
+
+
+Document: Footer
+
+此处的内容被标记为“保密”。未经许可,请勿对外披露。
+
+
+Document: Watermark
+
+保密
+
+
+
+UK-Cabinet
+2
+
+
+
+
+
+
+Document: Header
+
+保密等级:内部专用
+
+
+Document: Footer
+
+此处的内容被标记为“内部专用”。未经许可,请勿对外披露。
+
+
+Document: Watermark
+
+内部专用
+
+
+
+UK-Cabinet
+3
+
+
+
+
+
+
+
+
+
+
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: helpcontent2

2021-05-31 Thread Kevin Suo (via logerrit)
 helpcontent2 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c4809b7c4e7f198464293e36d7f04cafe93597fc
Author: Kevin Suo 
AuthorDate: Tue Jun 1 00:18:39 2021 +0800
Commit: Gerrit Code Review 
CommitDate: Mon May 31 18:18:39 2021 +0200

Update git submodules

* Update helpcontent2 from branch 'master'
  to e36e33937f9cda7fde9ab56f9eb25f6f549700c7
  - tdf#142531: fix help css for Simplified Chinese display on Linux

The font "system-ui" may cause trouble in some system, although it may 
look good in several systems.
See e.g. https://infinnie.github.io/blog/2017/systemui.html.

This change removes the "system-ui" font from the list, still put 
"Segoe UI" before any others, but moves "sans-serif" forward so that it falls 
back to the UI font in most linux distros.

Tested on Win10 and this does not impact the display for English or 
Chinese, but really improves a lot on Linux (Fedora 32 for me).

Change-Id: I1cba731cb846d1dc8c708b12510167c48de539e5
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/116487
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/helpcontent2 b/helpcontent2
index 226a545d3366..e36e33937f9c 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit 226a545d33667a0c9526593a5182ac0a849933e2
+Subproject commit e36e33937f9cda7fde9ab56f9eb25f6f549700c7
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] help.git: help3xsl/default.css

2021-05-31 Thread Kevin Suo (via logerrit)
 help3xsl/default.css |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e36e33937f9cda7fde9ab56f9eb25f6f549700c7
Author: Kevin Suo 
AuthorDate: Mon May 31 23:34:25 2021 +0800
Commit: Olivier Hallot 
CommitDate: Mon May 31 18:18:39 2021 +0200

tdf#142531: fix help css for Simplified Chinese display on Linux

The font "system-ui" may cause trouble in some system, although it may look 
good in several systems.
See e.g. https://infinnie.github.io/blog/2017/systemui.html.

This change removes the "system-ui" font from the list, still put "Segoe 
UI" before any others, but moves "sans-serif" forward so that it falls back to 
the UI font in most linux distros.

Tested on Win10 and this does not impact the display for English or 
Chinese, but really improves a lot on Linux (Fedora 32 for me).

Change-Id: I1cba731cb846d1dc8c708b12510167c48de539e5
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/116487
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/help3xsl/default.css b/help3xsl/default.css
index 29cb0f010..2eff6c39f 100644
--- a/help3xsl/default.css
+++ b/help3xsl/default.css
@@ -40,7 +40,7 @@ h6,
 .listitem,
 .listitemintable,
 .tablecontent {
-font-family: -apple-system, system-ui, "Segoe UI", Roboto, Ubuntu, 
Cantarell, "Noto Sans", "DejaVu Sans", "Lucida Grande", "Helvetica Neue", 
Helvetica, Arial, sans-serif, FreeSerif, NanumGothic, "Noto Sans Tibetan", 
Taprom;
+font-family: -apple-system, "Segoe UI", sans-serif, Roboto, Ubuntu, 
Cantarell, "Noto Sans", "DejaVu Sans", "Lucida Grande", "Helvetica Neue", 
Helvetica, Arial, FreeSerif, NanumGothic, "Noto Sans Tibetan", Taprom;
 }
 .input {
 background-color: rgba(0,0,0,0.04);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] help.git: help3xsl/default.css helpers/convertfilters.py source/text

2021-05-31 Thread Kevin Suo (via logerrit)
 help3xsl/default.css|6 
 helpers/convertfilters.py   |  235 +++-
 source/text/shared/guide/convertfilters.xhp | 1401 ++--
 3 files changed, 696 insertions(+), 946 deletions(-)

New commits:
commit 226a545d33667a0c9526593a5182ac0a849933e2
Author: Kevin Suo 
AuthorDate: Sun May 30 20:39:31 2021 +0800
Commit: Olivier Hallot 
CommitDate: Mon May 31 16:45:00 2021 +0200

tdf#142417: Improve convertfilters.py and add API Names column

This commit involves two parts:
1. Improved the convertfilters.py helper script to make sure
 the generated convertfilters.xhp file is complete, accurate
 and containing no duplicated entries, and also add codes
 to also generate API Names column, as discussed in tdf#142417.
 Importantly, the code is modified to generate fixed IDs,
 rather than the previously random IDs or sequential IDs which
 may make the PO translation strings to show fuzzy when the
 file is re-generated.
2. This helper script is run and the convertfilters.xhp is
 updated.
3. The default css is modified to better display the page.
 There is no need to set overflow=auto for the DisplayArea,
 otherwise the scrollbar goes to the bottom of that area which
 is not visible. Also added a css class to display smaller
 fonts for the table.

Change-Id: I8a5c73c9d6a0c0b44fc7db6cb67b140bfeb8b4be
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/116405
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/help3xsl/default.css b/help3xsl/default.css
index ce1dd77f8..29cb0f010 100644
--- a/help3xsl/default.css
+++ b/help3xsl/default.css
@@ -196,8 +196,6 @@ table {
 background: #FEFEFE;
 box-shadow: rgba(0,0,0,0.08) 0 1px 5px 0;
 border-collapse: collapse;
-margin-left: auto;
-margin-right: auto;
 }
 table, th, td {
 border-top: 0;
@@ -216,6 +214,10 @@ table, th, td {
 vertical-align:top;
 }
 
+.table_font_small {
+font-size: 0.98rem;
+}
+
 h1,
 h2,
 h3,
diff --git a/helpers/convertfilters.py b/helpers/convertfilters.py
old mode 100644
new mode 100755
index 209a78c1d..dcb25af00
--- a/helpers/convertfilters.py
+++ b/helpers/convertfilters.py
@@ -6,106 +6,173 @@
 # 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/.
 #
-# Run this in instdir/share/registry/
+# This script is used to generate the convertfilters.xhp file located
+# in helpcontent2/source/text/shared/guide.
+#
+# Run this script followed by the path of instdir/share/registry/
+# i.e.: ./convertfilters.py /path/to/source/core/instdir/share/registry
+# 
 # Requires Python 3.6 or greater.
 
+import os
 import sys
 import random
 import time
 from math import floor
 from lxml import etree
 
+output_file_path = os.path.join(os.path.dirname(sys.argv[0]), 
"convertfilters.xhp")
+try:
+registry_dir = sys.argv[1]
+except IndexError:
+print("Usage: ./convertfilters.py 
/path/to/source/core/instdir/share/registry")
+sys.exit(1)
+
+if not os.path.exists(registry_dir):
+print(f"{registry_dir} does not exist. Make sure you have built the core 
repo before running this script")
+sys.exit(1)
+
 modules = 
["writer.xcd","calc.xcd","impress.xcd","draw.xcd","math.xcd","base.xcd","graphicfilter.xcd"]
 
-def rdm(prefix):
-return prefix + "_id" + str(floor(random.random() * 1000) + 1) + 
str(int(time.time()))
+def gen_id(apiname):
+'''This function accepts module name and an API Name of the filter, and 
then generate 
+a unique ID. API Names are used since they are unique within the page.
+
+Do not use random numbers or sequence-count numbers here since it will 
cause all words to be "fuzzy" in PO files
+when the xhp file is regenerated.
+'''
+apiname = apiname.replace(" ", "_")
+apiname = apiname.replace("(", "_")
+apiname = apiname.replace(")", "_")
+apiname = apiname.replace("/", "_")
+
+return apiname
 
-output = ""
-output += f'\n'
-output += f'\n'
-output += f'\n'
-output += f'\n'
-output += f'\n'
-output += f'File Conversion Filters 
Tables\n'
-output += f'/text/shared/guide/convertfilters.xhp\n'
-output += f'\n\n\n'
-output += f'\n'
-output += f'\n'
-output += f'filters;document conversion\n'
-output += f'document conversion;filters\n'
-output += f'convert-to;filters\n'
-output += f'command line document 
conversion;filters\n'
-output += f'module file filters\n'
-output += f'\n'
-output += f'File 
Conversion Filter Names\n'
-output += f'Tables with filter 
names for command line document conversion.\n'
-output += f'\n'
-output += f'Filter 
nameMedia 
typeFile name 
extensions\n'
+output = '''
+
+
+
+
+File Conversion Filters Tables
+/text/shared/guide/convertfilters.xhp
+
+
+
+
+
+filters;document conversion
+document conversion;filters
+convert-to;filters
+command 

[Libreoffice-commits] core.git: 2 commits - helpcontent2 translations

2021-05-31 Thread Kevin Suo (via logerrit)
 helpcontent2 |2 +-
 translations |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit cfca68e0f70f6b9fa54f32cc21585c073677229b
Author: Kevin Suo 
AuthorDate: Mon May 31 22:45:00 2021 +0800
Commit: Gerrit Code Review 
CommitDate: Mon May 31 16:45:00 2021 +0200

Update git submodules

* Update helpcontent2 from branch 'master'
  to 226a545d33667a0c9526593a5182ac0a849933e2
  - tdf#142417: Improve convertfilters.py and add API Names column

This commit involves two parts:
1. Improved the convertfilters.py helper script to make sure
 the generated convertfilters.xhp file is complete, accurate
 and containing no duplicated entries, and also add codes
 to also generate API Names column, as discussed in tdf#142417.
 Importantly, the code is modified to generate fixed IDs,
 rather than the previously random IDs or sequential IDs which
 may make the PO translation strings to show fuzzy when the
 file is re-generated.
2. This helper script is run and the convertfilters.xhp is
 updated.
3. The default css is modified to better display the page.
 There is no need to set overflow=auto for the DisplayArea,
 otherwise the scrollbar goes to the bottom of that area which
 is not visible. Also added a css class to display smaller
 fonts for the table.

Change-Id: I8a5c73c9d6a0c0b44fc7db6cb67b140bfeb8b4be
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/116405
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/helpcontent2 b/helpcontent2
index 8ca38307bd81..226a545d3366 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit 8ca38307bd81fbb37a664dd848fd1fda2c2b4181
+Subproject commit 226a545d33667a0c9526593a5182ac0a849933e2
commit cf23ebbbc356aa676077494585781ba6e8f937ba
Author: Christian Lohmaier 
AuthorDate: Mon May 31 16:40:33 2021 +0200
Commit: Gerrit Code Review 
CommitDate: Mon May 31 16:40:33 2021 +0200

Update git submodules

* Update translations from branch 'master'
  to 387ea1005f554dadedc7073e947bbd93dfa38c25
  - update translations for master

and force-fix errors using pocheck

Change-Id: I5a54db2572738c26858f69eba71239fa9474f0a4

diff --git a/translations b/translations
index 48ffdf216a07..387ea1005f55 16
--- a/translations
+++ b/translations
@@ -1 +1 @@
-Subproject commit 48ffdf216a07738135223c4f95e9f942be8a5dd9
+Subproject commit 387ea1005f554dadedc7073e947bbd93dfa38c25
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   >