69 Commits
Author SHA1 Message Date
Kevin Suo 90d22daf99 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
6cb1745c24 (tdf#142467: Update comments
with GCC bug ID, 2021-05-31)
due to a bug in gcc <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100797>.

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 <caolan.mcnamara@collabora.com>
2024-02-16 10:11:29 +01:00
Kevin Suo 89e032e9c4 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 2d1df9f3dc
(tdf#117276 sc: Show hidden filter elements as inactive elements)

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

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

commit 1953394837
(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 <xiscofauli@libreoffice.org>
Reviewed-by: Kevin Suo <suokunlong@126.com>
Tested-by: Kevin Suo <suokunlong@126.com>
2024-01-18 13:08:22 +01:00
Kevin Suo 34fe1610cb 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 <suokunlong@126.com>
2023-11-30 02:52:27 +01:00
Kevin Suo 6fffa9fdf2 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 <suokunlong@126.com>
2023-11-30 02:52:03 +01:00
Kevin Suo 22d8f33919 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 <suokunlong@126.com>
2023-11-29 08:21:45 +01:00
Kevin Suo 5589659829 tdf#157589 tdf#153969: Revert "sdext.pdfimport Writer: Do not visit...
... DrawElement twice in WriterXmlEmitter"

This reverts commit 9ea9d3ccc0.

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 <suokunlong@126.com>
2023-11-28 03:08:39 +01:00
Kevin Suo 83e58fc9f1 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 <sbergman@redhat.com>
2022-12-07 07:33:41 +00:00
Kevin Suo c9e961e680 "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 <suokunlong@126.com>
2022-12-06 03:42:27 +00:00
Kevin Suo 616c4c6bcb tdf#152083: sdext Pre-reverse the text for RTL in Writer pdfimport as well
Follow up to:
commit 3a2f0e4772
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 <noel.grandin@collabora.co.uk>
2022-12-04 20:00:08 +00:00
Kevin Suo 00bf67a99d 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 <noel.grandin@collabora.co.uk>
2022-12-04 14:56:40 +00:00
Kevin Suo 842e3b988a 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 <noel.grandin@collabora.co.uk>
2022-12-04 14:54:34 +00:00
Kevin Suo d423e18de7 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 <noel.grandin@collabora.co.uk>
2022-12-03 14:07:03 +00:00
Kevin Suo e788317bb5 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
69e9925ded.

The old PDFIProcessor::mirrorString() did two things:
1) Reverse the code points in the string. However, due to its use of iterateCodePoints(&i)
rather than iterateCodePoints(&i, -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 720a093461) to get the mirrored-image of
characters with the Bidi_Mirrored properties.

Stephan Bergmann restored the #1 in commit 50d73574b6
(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 <suokunlong@126.com>
2022-11-30 13:40:24 +01:00
Kevin Suo 3a2f0e4772 Resolves tdf#152083: Ligatures are incorrectly reversed in Draw pdf import
For the string "بسم الله الرحمن الرحیم", the xpdfimport generates the following drawChar tokens:
drawChar 438.500000 723.300000 446.744000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 م
drawChar 446.696000 723.300000 450.908000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 ی
drawChar 450.896000 723.300000 458.804000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 ح
drawChar 458.792000 723.300000 463.784000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 ر
drawChar 463.688000 723.300000 467.048000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 ل
drawChar 467.072000 723.300000 469.964000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 ا
drawChar 469.964000 723.300000 473.708000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000
drawChar 473.756000 723.300000 482.780000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 ن
drawChar 482.756000 723.300000 490.028000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 م
drawChar 490.040000 723.300000 497.948000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 ح
drawChar 497.936000 723.300000 502.928000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 ر
drawChar 502.928000 723.300000 506.288000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 ل
drawChar 506.312000 723.300000 509.204000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 ا
drawChar 509.108000 723.300000 512.852000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000
drawChar 512.900000 723.300000 527.216000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 الله
drawChar 527.204000 723.300000 530.948000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000
drawChar 530.996000 723.300000 539.240000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 م
drawChar 539.288000 723.300000 552.020000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 س
drawChar 551.888000 723.300000 555.236000 723.300000 1.000000 0.000000 0.000000 1.000000 12.000000 ب

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 69e9925ded, and
further improved by commit 50d73574b6).

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 <noel.grandin@collabora.co.uk>
2022-11-25 08:44:02 +01:00
Kevin Suo f078937179 tdf#138111: Fix apparent copy-paste error in ApiNameMap for sd style "A0"
As introduced in commit 99102d4263.

Change-Id: Iece8595a401df7bd5a514244d4a4fc825a49f9de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142819
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2022-11-22 14:55:18 +01:00
Kevin Suo bc48dbe08d 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 <noel.grandin@collabora.co.uk>
2022-11-20 12:00:08 +01:00
Kevin Suo 1bfb323801 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 <mike.kaganski@collabora.com>
2022-11-12 06:06:32 +01:00
Kevin Suo 1c11bfc042 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 <mike.kaganski@collabora.com>
Tested-by: Jenkins
2022-11-11 08:30:47 +01:00
Kevin Suo 9b80b2d614 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 <mike.kaganski@collabora.com>
Tested-by: Jenkins
2022-11-11 08:30:29 +01:00
Kevin Suo 875c27dc79 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 <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-11-09 21:24:29 +01:00
Kevin Suo c2e2997f45 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 <noel.grandin@collabora.co.uk>
2022-11-08 08:40:29 +01:00
Kevin Suo 9ea9d3ccc0 sdext.pdfimport Writer: Do not visit DrawElement twice in WriterXmlEmitter
Discovered when working on commit f6004e1c45.

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:

1    for( const auto& rxChild : elem.Children )
2    {
3        PageElement* pPage = dynamic_cast<PageElement*>(rxChild.get());
4        if( pPage )
5        {
6            for( auto child_it = pPage->Children.begin(); child_it != pPage->Children.end(); ++child_it )
7            {
8                if( dynamic_cast<DrawElement*>(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<DrawElement*>(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 <noel.grandin@collabora.co.uk>
2022-11-06 12:43:07 +01:00
Kevin Suo 5da75fcb40 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 <laurent.balland@mailo.fr>
2022-11-04 21:29:33 +01:00
Kevin Suo 5e3e507b1a Drop {PDFFilterResId, getResStr, XsltResId} and use FilterResId in "filter"
This is a followup to commit a97bae545d.

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 <noel.grandin@collabora.co.uk>
2022-10-24 12:41:00 +02:00
Kevin Suo 8ae0ce1bfa sdext.pdfimport: refactor this unit test and active it for Windows
This unit test was disabled for Windows build in commit fc45e54be6,
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 <noel.grandin@collabora.co.uk>
2022-10-24 09:13:11 +02:00
Kevin Suo a97bae545d 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 <noel.grandin@collabora.co.uk>
2022-10-23 17:56:22 +02:00
Kevin Suo f6004e1c45 tdf#151546: RTL text is reversed (Writer pdfimport)
This is a followup to commit 69e9925ded
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 <thorsten.behrens@allotropia.de>
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2022-10-19 21:34:13 +02:00
Kevin Suo 69e9925ded 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: Ifa210836f1d6666dd56205ff0d243adfb4114794
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141231
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2022-10-13 21:38:12 +02:00
Kevin Suo 244063d031 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 <rafael.palma.lima@gmail.com>
Reviewed-by: Laurent Balland <laurent.balland@mailo.fr>
2022-10-04 15:07:16 +02:00
Kevin Suo 22c7ce6c8e 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 <franklin@goodhorse.idv.tw>
Reviewed-by: Eike Rathke <erack@redhat.com>
2022-04-12 19:28:35 +02:00
Kevin Suo 24e6217c0a 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 <erack@redhat.com>
2022-02-07 18:52:40 +01:00
Kevin Suo bcf10015c5 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 <noel.grandin@collabora.co.uk>
2022-02-04 07:44:18 +01:00
Kevin Suo 2f60500990 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 <noel.grandin@collabora.co.uk>
2022-02-04 07:43:42 +01:00
Kevin Suo 7e380a76e1 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 <erack@redhat.com>
2022-01-27 14:00:51 +01:00
Kevin Suo 86cffd61c1 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 <vmiklos@collabora.com>
2022-01-03 08:35:21 +01:00
Kevin Suo 95a10c797b 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 <olivier.hallot@libreoffice.org>
2021-12-28 11:00:31 +01:00
Kevin Suo 885106479d 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 <olivier.hallot@libreoffice.org>
2021-12-28 10:59:52 +01:00
Kevin Suo 5d56a2301c 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 <erack@redhat.com>
2021-12-26 18:00:12 +01:00
Kevin Suo 918b62bea6 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 <erack@redhat.com>
2021-11-20 23:09:40 +01:00
Kevin Suo 1798edc6ba 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 <mike.kaganski@collabora.com>
2021-11-09 10:49:57 +01:00
Kevin Suo 4024673d69 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 <mike.kaganski@collabora.com>
Reviewed-by: Eike Rathke <erack@redhat.com>
2021-11-08 21:40:35 +01:00
Kevin Suo b9e43ab25f 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 <noel.grandin@collabora.co.uk>
2021-11-04 09:03:21 +01:00
Kevin Suo ac3266cccc This aParentName can be const
Change-Id: If3d94b7b8e9b10934b1be0771c4c85536bc750f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124642
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-03 14:35:18 +01:00
Kevin Suo 3b977328df 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 <noel.grandin@collabora.co.uk>
2021-11-01 13:44:48 +01:00
Kevin Suo a0c23b4090 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 24d8e4eaf4
Author: Kohei Yoshida
Date:   Thu Jul 28 00:46:55 2011 -0400
    Parse CSS in the <style> content and set number formats to cells.

However, this was broken since "selector_name" does not no
longer functions in the handler since upgrade to orcus 0.9:

commit edb38d702d
Author: David Tardon
Date:   Thu Jun 4 16:09:48 2015 +0200
    update to liborcus 0.9.1

And further the selector_name was then removed by the
following commitd due to loplugin:unreffun checks:

commit c76a8580c6
Author: Miklos Vajna
Date:   Fri Jun 5 12:29:36 2015 +0200
    sc: loplugin:unreffun

commit 9eeac5506b
Author: Miklos Vajna
Date:   Fri Jun 5 12:32:10 2015 +0200
    sc: another loplugin:unreffun

And then this was further broken by the following commit, in which
it removed the mrStyles of type "ScHTMLStyles" from the CSSHandler
class:

commit 5d86154f49
Author: Noel Grandin
Date:   Tue Sep 18 09:57:26 2018 +0200
    loplugin:unusedfields improve search for unused collection fields

This patch partially reverted those code, revised the
CSSHandler member functions to make it work. More handler
functions need to be implemented.

Note that this bug is still not resoved yet because the orcus
css parser does not accept css strings to include unquoted
non-ascii chars as property values. This will be addressed in
a separate patch.

Change-Id: I8883f5a9362d9476dbfa9a2eed283c6f5c18305d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123715
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-19 16:13:45 +02:00
Kevin Suo 2d486bac81 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 <noel.grandin@collabora.co.uk>
2021-10-11 09:08:37 +02:00
Kevin Suo 4eef83dc4a 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 <noel.grandin@collabora.co.uk>
2021-10-11 09:07:59 +02:00
Kevin Suo 6b93ee72df 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 <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-08 08:01:01 +02:00
Kevin Suo a175976980 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 <noel.grandin@collabora.co.uk>
2021-08-22 10:29:50 +02:00
Kevin Suo 2ee3d40764 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 da59686672
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 <noel.grandin@collabora.co.uk>
2021-07-26 08:28:20 +02:00
Kevin Suo 0708704161 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&oq=getNameWithoutSubsetTag&aqs=chrome..69i57.784j0j7&sourceid=chrome&ie=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 <rene@debian.org>
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-16 09:06:47 +02:00
Kevin Suo 12b57e4356 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 <noel.grandin@collabora.co.uk>
2021-07-14 18:55:47 +02:00
Kevin Suo b1ca6d3aae sdext.pdfimport: <text:s> and <text:tab> don't have "text:style-name" attribute
Per OpenDocument specs:
* The <text:s> element only has a "text:c" attribute.
* The <text:tab> 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 <noel.grandin@collabora.co.uk>
2021-07-14 18:53:44 +02:00
Kevin Suo 6a1de4f74e 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 <noel.grandin@collabora.co.uk>
2021-07-14 18:22:20 +02:00
Kevin Suo fe28633ee6 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 <style:text-properties>
 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 <noel.grandin@collabora.co.uk>
2021-07-14 09:07:09 +02:00
Kevin Suo cffd97193f 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 <noel.grandin@collabora.co.uk>
2021-07-12 20:21:49 +02:00
Kevin Suo da59686672 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 <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2021-07-12 10:57:27 +02:00
Kevin Suo 508ccbdb14 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 <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-12 10:55:05 +02:00
Kevin Suo 5d4b54a7e1 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 <olivier.hallot@libreoffice.org>
2021-06-19 12:55:26 +02:00
Kevin Suo c4809b7c4e 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 <olivier.hallot@libreoffice.org>
2021-05-31 18:18:39 +02:00
Kevin Suo cfca68e0f7 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 <olivier.hallot@libreoffice.org>
2021-05-31 16:45:00 +02:00
Kevin Suo 2eb811c5d7 Revert tdf#104278: text in Type frame in DocInformation...
...is not aligned left

This reverts commit 4987c82449, because it breaks
the feature of showing the customs document property in the DocInformation
dialog, see Caolan's comment in https://bugs.documentfoundation.org/show_bug.cgi?id=104278#c13

Change-Id: I859ad3a6fa08290d5158dd03c33adfa821d78131
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108497
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-01-03 12:17:19 +01:00
Kevin Suo 6b57cfb71a tdf#128463: Revert the change to license information
per comment by Tor Lillqvist in:
https://bugs.documentfoundation.org/show_bug.cgi?id=128463#c18

The Apache part of the license was added by commit
8c9cc54bd7 due to misunderstanding.

Change-Id: I861e7b13e1900de9287c768a4da8740fdb2e517f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108537
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-01 07:37:47 +01:00
Kevin Suo 8c9cc54bd7 tdf#128463: Rewrite NamedRanges.py to make it work when run from UI
This commit:
1. Updated the license header;
2. Added docstrings and notes to help the users to understand the API and code.
3. Make the code to create a new sheet named "data", define named ranges in it,
   modify the named range, define another named range, fill values in the cells
   related to the named ranges, the calcualte sum of each named range, and also
   calculate the difference between the two named ranges. The results are stored
   in the sheet named "information".
4. Cell alignment and background color methods are also used in this example.
5. Only show the parent function in the UI.

Change-Id: Iba6111dc3754f054deeb0baf902dbff1eb3bfa2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108530
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-31 08:47:32 +01:00
Kevin Suo 97d5144605 tdf#128463: Make SetCellColor python example actually do sth
The previous one, when run from within the application, gives a
runtime exception.

This commit rewrites this example to:
1. Hide the private function from the UI;
2. Create a new blank Calc file instead of operating directly in the existing file;
3. Set cell colors to draw a "LO" picture in the sheet.
4. Added docstrings and API reference links.

Change-Id: I120a3ede0629a5657fec18f1b0909dfc4bc7ad1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104720
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-31 08:46:15 +01:00
Kevin Suo 4987c82449 tdf#104278: text in Type frame in DocInformation is not aligned left
As we can see from sw/uiconfig/swriter/ui/flddocinfopage.ui, we have a GtkTreeView in GtkFrame "typeframe", without the following property:
<property name="show_expanders">False</property>

A GtkTreeView seems have a default indentation if show_expanders is True (which is the default), see:
https://developer.gnome.org/gtk3/stable/GtkTreeView.html#gtk-tree-view-set-show-expanders

A "expander" would look like this: https://python-gtk-3-tutorial.readthedocs.io/en/latest/expander.html

I do not see a reason why we should use an expander here in this dialog. As a result, setting show_expanders to False will solve the problem.

Change-Id: I29cbb13f8d57aeb502079f278e4b620d97d8f170
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108261
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2020-12-28 09:33:33 +01:00
Kevin Suo 8be0be8066 tdf#130275: Fields dialog is too tall
...which makes the OK/Cancel buttons invisible under small displays.
This commit changed the height of these widgets. Also I did some tweats to the UI file
and the width so that the edit dialog of these fields looks nicer (at least on my display).

Change-Id: I9f39727afd566d75db525c5a5cafe2eabb66d7ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107965
Tested-by: Jenkins
Tested-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2020-12-23 11:37:39 +01:00
Kevin Suo 2d1b5ecdf8 tdf#137393: Add "Noto {Sans, Serif} {SC,TC,HK,JP}" to the default font list
As per discussion in the bug report, in some systems these fonts are named as
"Noto {Sans, Serif} {SC,TC,HK,KR,JP}", instead of ""Noto {Sans, Serif} CJK
{SC,TC,HK,KR,JP}".

It is noted that the KR section has already been updated.

Also removed the non-mono fonts from zh_CN section.

Change-Id: I0e67b895649502780b8e5cdff2b7d6dade3ff6b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104222
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-10-17 16:37:35 +02:00
Kevin Suo 5fb0e0f68b Improve example python code in scripting.
* Modified the code to be more pythonic.
* If "len(theString) == 0", then "not theString" evaluates to True.
* "theString[0].isupper()" and "theString[1].isupper()" can be combined.
* Remove unused imported string module
* Wrap long lines
* run autopep8 to prettify
* ...

Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104136
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-10-10 14:11:27 +02:00