summaryrefslogtreecommitdiff
path: root/vcl
AgeCommit message (Collapse)Author
2022-05-03Use o3tl::make_unsigned in some placesStephan Bergmann
...where a signed and an unsigned value are compared, and the signed value has just been proven to be non-negative here Change-Id: I297d0f80b2b3e68ea7362de64c871d647ac07371 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133739 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-03Why cast from FontWeight to intStephan Bergmann
Change-Id: I2e283197024c89681dc123e77c05d593ccec4552 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133738 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-03add o3tl::equalsAsciiNoel Grandin
Change-Id: I042b8dcadbf7581de325c161763fe35aecde5ca2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133694 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-03optimize repeated calls for the same string in SalLayoutGlyphsCacheLuboš Luňák
It often happens that the entire text will be laid out in parts, so if the first call is a prefix and another one follows that, lay out the entire string and then use the glyph subset optimization. Doing this only for the second segment instead immediately for the prefix is more efficient, as sometimes there is only the prefix call and there's no call for the rest of the string. This also avoids failures in CppunitTest_sw_layoutwriter, as a number of tests such as testAbi11870 lay out only a prefix and doing a layout for the entire string leads to font fallback, on which CppunitTest_sw_layoutwriter aborts in PrintFontManager::Substitute(). Change-Id: I76554868ec7e8a79dd09709a247ad1d839291c06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133495 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-03Just use Any ctor instead of makeAny in vclStephan Bergmann
Change-Id: Ib9b588cd10154049a5493c1be16de72955ea6077 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133736 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-03remove the o3tl::lru_map "unlimited" hackLuboš Luňák
It didn't quite make sense before that maxsize == 0 meant no cleanup, and now with items optionally being count as having size more than 1 it makes even less sense to limit the size to max_size() of the containers. This comes from 16a338e173083954a9932a3a4005f17230, so instead make that special caller pass a large size, which in practice is the same. Change-Id: Id875862126200ba889211f6e4079ae5921f27650 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133690 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-02Silence -Werror=maybe-uninitializedStephan Bergmann
> vcl/source/helper/strhelper.cxx: In function ‘rtl::OString psp::WhitespaceToSpace(std::string_view)’: > vcl/source/helper/strhelper.cxx:365:9: error: ‘pBuffer[-1]’ may be used uninitialized [-Werror=maybe-uninitialized] > 365 | if( *pLeap == ' ' ) > | ^~~~~~ that hits at least with GCC 13 trunk now (and which actually is a false positive as far as I can tell) Change-Id: I69b96e4cf68f0ed20ac7d73014c164db792983a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133704 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-02Delete mnemonics for CJK translations on macOSxuenhua
'Cop~y' translated into Chinese is '复制(~Y)' But the mnemonics '(Y)' is useless on macOS. In English, 'Cop~y' with the '~' removed is the correct result. But in CJK should remove along with '(' and ')', not just only for mbMenuBar. Use the method MnemonicGenerator::EraseAllMnemonicChars already defined in vcl/mnemonic.hxx Change-Id: Ic37ce566923e3dea47535d187b1b3dba2088e960 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133572 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-02Reimplement IconView::PaintEntryMike Kaganski
Use spacing between top, bottom, icon and text (the case of sum of items heights greater than element height is not yet handled). Draw the background even when there's no text: that allows to center the icon in the item, and still have proper highlight of selected item. Change-Id: I5d5dd14060efd15beb0e69df859ecf1efe8a0287 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133612 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-05-02Related: tdf#148433 experiment with CAIRO_OPERATOR_EXCLUSIONCaolán McNamara
export SAL_DISABLE_CAIRO_DIFFERENCE=1 to experiment with this Change-Id: If0e5fee8c71ae3d2181b1e0b90bf9ecd6536ffc0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133671 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-02better for fix glyph font fallback with null characterLuboš Luňák
Text layout code already filters out unsuitable characters, the null character just wasn't included there because it's normally not expected to be present in text, only something broken like ofz34898-1.doc causes it. This basically reverts commit 3d7ca1bd1c4cc9d468ae214ecb497f71bad340f8. Change-Id: Ic29674d9507340c2a43098a88c0320d4253a0bf8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133689 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-02better cache size limit for vcl::text::TextLayoutCacheLuboš Luňák
This is not as important as SalLayoutGlyphsCache, as these should be smaller and less needed, but still, make sure to limit the memory the cache may use. Change-Id: I4051331f8c5254cb5723772bac4dd1bceb9a2a41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133674 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-02better cache size limit for SalLayoutGlyphsCacheLuboš Luňák
With just limit on the number of cached SalLayoutGlyphs instances the actual memory used could vary wildly depending on how long the text is. Change-Id: Ibcf6918e562e81276d21876c532838996e275bd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133673 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-02loplugin:stringviewparamStephan Bergmann
Change-Id: Ife277f789270f80a40cd711a9235e41bbb3384ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133686 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-01jsdialog: export symbol for buttonsSzymon Kłos
Change-Id: I412961bd59855dcb4204dfb917b30539dac0eac2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132756 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Tested-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133653 Tested-by: Jenkins
2022-05-01jsdialog: handle formulabar as textinputSzymon Kłos
mostly boilerplate code jsdialog changes: - added force parameter to sendAction - added support for key press/release and command events - moved ActionDataMap to jsdialog namespace for sharing formulabar changes: - added calls to send jsdialog messages with formula - added cursor moving support - on command event Change-Id: I714715133901941ba0758655e2d5907a3bae79f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133010 Reviewed-by: Mert Tumer <mert.tumer@collabora.com> Tested-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133652 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2022-05-01abort more writer layout tests if a font isn't foundCaolán McNamara
Change-Id: I4d94b60531505f2d5a493b4c51f4c9110d3a4517 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133633 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-01abort writer layout tests if a font isn't foundCaolán McNamara
if (the default) of --with-fonts is enabled then additionally restrict fontconfig to those "application" fonts so the linux ci can be used to safeguard that font and glyph fallback isn't in operation during the layout tests Change-Id: Ic7fc705827c8177b8367cf41f55cdd8ae002c1f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133523 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-01tdf#74331: 16bit "min-is-black" tiff not loaded correctlyCaolán McNamara
try an alternative fix git show -w is your friend here Change-Id: Ie9644f73431243ea0e9c6ef7f5c7ca4dadc7ed9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133638 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-01don't use an empty fontname, reuse the default from the virtual devCaolán McNamara
zero size font is odd, but that's as it was already Change-Id: Ib430f2ff2a53c21dc7d15d11377762ab336a61e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133660 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-01use more string_view in variousNoel Grandin
found by examining uses of OUString::copy() for likely places Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-01use string_view in WhitespaceToSpaceNoel Grandin
Change-Id: I64c63418ca51a09312083dab2432bcca0ea262a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133647 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-01SalLayoutGlyphsCache no longer needs to hash OutputDevice pointerLuboš Luňák
It seems now the cache key contains all the necessary info and results can be shared even between different OutputDevice instances, as long as they are "the same". Change-Id: I367322f469ab6713299f178a711a63065b245f9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132902 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-30split comphelper::string::strip functions into String and view versionNoel Grandin
which is more obvious, from the perspective of the caller, and lets us avoid creating a new String if nothing needs to be stripped Change-Id: I66a980eaf4aa818251bec49bdb16c2dddb0745e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-30new loplugin:stringviewdangleNoel Grandin
to find places where string_view is pointing into a temporary String Change-Id: Ib530b36f441e95d83d8f687d40a97516a0806721 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133656 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-30ofz#47104 Revert "tdf#74331: 16bit "min-is-black" tiff not loaded correctly"Caolán McNamara
This reverts commit bd1d0967920655ef85a2352259332f99fef6876e. Change-Id: I4f4c0aa7d779487b9f3b1da46e7b2e1070f2dba3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133637 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-04-30jsdialog: used for formulabarSzymon Kłos
- do not block painting - use welded wrappers to send JSON - don't send tunneled dialog Change-Id: I54c3cd02ab63bad4a50a3623a32f13b0c94a3595 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132757 Reviewed-by: Mert Tumer <mert.tumer@collabora.com> Tested-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133651 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2022-04-29add a cppunit test for EraseAllMnemonicCharsCaolán McNamara
Change-Id: Ib7a9d0250e855d4c80c7ce2d66df02eac0ab2e69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133618 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-04-29Fix Method EraseAllMnemonicChars bugxuenhua
MNEMONIC_RANGE_2_START and MNEMONIC_RANGE_2_END defined in 'core/include/vcl/mnemonic.hxx' are 'a' and 'z' This variable c is UpperCase, should be converted to lowercase, and thencompare with MNEMONIC_RANGE_2_START and MNEMONIC_RANGE_2_END. Change-Id: I721e293e88bf1b8260b7ea2dc39ae6a7fd4f3d79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133587 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-04-29use more string_view in INetURLObjectNoel Grandin
Change-Id: I4462f7cf4740fa4d1b129d76a0775f4250f41bbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133555 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-29hack for glyph subset being different because of space being RTLLuboš Luňák
This is a rather weird corner case than I can see only with JunitTest_svx_unoapi failing without this, when asking to lay out characters 7-9 from "paragraph 1" with layout mode set to RTL. Change-Id: Ic55e571a5934ea2b9de2f09b7c066abf014ac212 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133578 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-29don't try to find glyph font fallback for null characterLuboš Luňák
Change-Id: I53000b4da6e208774d5e8c23948474e2e9a1cf3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133561 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-28tdf#74331: vcl_filters: Add unittestXisco Fauli
Change-Id: Ia93f5f5f3ca5b4ddd51d68335af7f1c7b79b5c31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133551 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-04-28Fix typoAndrea Gelmini
Change-Id: I600199f87df8a211b2a27913bc1fe2340d315766 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133552 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-04-28add a hack to SalLayoutGlyphsImpl::cloneCharRange() for a strange glyphLuboš Luňák
Change-Id: Id4859982079f5f156b5e2d85598940ec8c936475 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133547 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-28use the same TextLayoutCache for the verifying callLuboš Luňák
Apparently not using it makes the ImplLayout() call treat everything as one run, which changes whether a glyph may get ALLOW_KASHIDA. Change-Id: I1a951dbc4242d1fe8e4ee5074d9f9ad1d80480be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133546 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-28don't cut a glyph subset inside a composed glyph #2Luboš Luňák
This is basically the same like 7b7d2f4a3e96e771e125c95a7d262b20f6dc9ecc, triggered by CppunitTest_sw_uiwriter3's testTdf104649 on Mac. Change-Id: Ibb3c33dd6924e8f0c8856185fc7fb7aeaaf72177 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133545 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-28tdf#74331: 16bit "min-is-black" tiff not loaded correctlyJulien Nabet
Since 16 bits part is well taken into account for photometric interpretation "RGB", just consider greyscale as subcase of rgb since greys are just "RGB" colors with same value for red, green and blue Finally, in ConvertScanline, nPhotometricInterpretation <= 1 (so "min is white" and "min is black") with nSamplesPerPixel = 1 corresponds to nDstBitsPerPixel = 8 here, so consider this specific case in the same block. The last piece to adjust is when calling SetPixel: nPhotometricInterpretation = 1 corresponds to the same case as nPhotometricInterpretation = 2 since RGB black is 0, nPhotometricInterpretation = 1 is minisblack so here too black is 0 Change-Id: I5c8e420f851ed6e31998c0698d86300aaa7c4b19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133251 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-04-28include LogicalFontInstance font scale in SalLayoutGlyphsCache keyLuboš Luňák
For some reason it may differ even if vcl::Font is the same. Without this ScExportTest2::testTdf66668 fails. Change-Id: I728a0848ac0420ce0d746134c7072f6ab59f2761 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133537 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-28make some LogicalFontInstance functions constLuboš Luňák
They call non-const GetHbFont() internally, but conceptually they are const. Change-Id: Idec7f06425383c5e78030c76da2c50f560bf64fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133536 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-28make SalLayoutGlyphsImpl::cloneCharRange() work for RTL runs tooLuboš Luňák
Glyphs are in the reverse order in this case, so the character positions for the wanted range must be treated that way. This improves e.g. the second attachment from tdf#112989. Unfortunately it's not that significant, as arabic glyphs are often unsafe to break at. Change-Id: I836ebff6282c420462c5cd5906d30d2e9431f218 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133494 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-28check kashida only if the flag is setLuboš Luňák
Change-Id: Ie508863c670e4b691bd30ac4d20ce479a569f793 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133531 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-28don't cut a glyph subset inside a composed glyphLuboš Luňák
A glyph may may composed from several characters, when asked to make a glyph subset for a character range, make sure the end of the range is not inside this character group. Change-Id: I41d82b432858a87e103dcb0d2fac6a11f25a32dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133530 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-28better debug font compare in SalLayoutGlyphsImplLuboš Luňák
The pointer comparison can be false even though the contents match. Change-Id: I584d30fdc7f311fd1a6058ae3cef98ce8b243f86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133529 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-27todo note about SalLayoutGlyphsCache possibly reusing different mapmodeLuboš Luňák
Change-Id: I68f23addb834b5c59564dda66f5bce1bb9a541bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133506 Tested-by: Luboš Luňák <l.lunak@collabora.com> Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-27make SalLayoutFlags match after makeGlyphsSubset()Luboš Luňák
SalLayoutFlags::BiDiStrong would be set by ImplLayout() if the entire subset had no RTL, but the entire string may not be that, so when creating a subset make sure to also set this flag. Similarly SalLayoutFlags::KashidaJustification should be set only if any glyph in the range has GlyphItemFlags::ALLOW_KASHIDA. Change-Id: I0aa2526f2fdd0c6a6b905ad0cb4040ee556529a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133502 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-27provide explicit function for hashing vcl::FontLuboš Luňák
It's cleaner than streaming the font and then hashing the result, and it's also faster. Change-Id: I6262e45362d386c21482f1e71be51912f123ee45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133500 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-27tdf#85610 sw: show tracked footnote insertion/deletionLászló Németh
also in the footnote area by formatting the footnote number there as the footnote index number in the main text (i.e. as anchor of the footnote). Previously deleted footnotes were shown as not deleted footnotes in Show Changes mode, also inserted footnotes lost their footnote number formatting (i.e. author color of the tracked change, and e.g. the default underline) after file saving. Note: for a working test, fix also MetafileXmlDump by removing the bad 0x01 from the XML dump, which resulted by the not expanded footnote index placeholder character. Change-Id: Ie003f4e19d2e2cee6f09d3b195db69fe5c10e405 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133503 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2022-04-27add string_view wrappers for rtl::math::stringToDoubleNoel Grandin
Change-Id: I114bec72cb933238675e539a8388a607226827cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133455 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-27ofz#47051 Out-of-memoryCaolán McNamara
Change-Id: Ie5276cfda3abe2f4787d2fa85d916449390ddda2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133497 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>