summaryrefslogtreecommitdiff
path: root/svgio/inc
AgeCommit message (Collapse)Author
2022-09-28use more string_view in svgioNoel Grandin
Change-Id: I30d2f02941673ce33febc4e0f563e77b80a585fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140707 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-23svgio: Simplify by using replaceAllXisco Fauli
Change-Id: Id805787c5b5a812c6fd4fbfe3c3b2905578ce3bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140482 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-09-23tdf#151118: svg: don't replace newline with space when xml:space="default"Xisco Fauli
Partially revert ddf695db44bcb23dc2f1459fd439f93c0b6d5f2a "tdf#151118: svg: fix handling of xml:space="preserve"" See discussion in https://gerrit.libreoffice.org/c/core/+/140404 Thanks to Mike Kaganski for spotting it Change-Id: Ifdd26b8de2f5cc392127f215e148599ae63036dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140444 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-09-22tdf#151118: svg: fix handling of xml:space="preserve"Xisco Fauli
This allows the code to be simplified a bit Change-Id: If42dd9d3ebd7860ece9ff78cb090ff1b07e1b432 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140404 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-09-21tdf#103888: Do not add a gap at the end of each text portionXisco Fauli
I can't think of any situation where it's needed Change-Id: I1c2c6ec3d22eb9263f3c3c20793d9fe3926b8d78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140351 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-07-29svgio: Add support for clip-rule="evenodd"Xisco Fauli
Change-Id: I028aa88bdd72b4f87526a3d1edabd612d7686571 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137577 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-07-15tdf#97539; if parent is css style, look one level upXisco Fauli
if the style attributes are set like <rect x="10" y="10" width="100" height="100" fill="#00D000" clip-path="url(#myClip)"/> it works, however, if it uses a css style like <rect x="10" y="10" width="100" height="100" style="fill:#00D000" clip-path="url(#myClip)"/> it fails to get the clipPath from the parent, because the css style is the direct parent, thus, check one level up Change-Id: Iff6df95c9fa9da4c2f1a986cca0ad82ab1494353 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137094 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-07-15svgio: simplify codeXisco Fauli
Change-Id: I100256b63fadeb4a0e4b8e4cbb67e58d2a1ce433 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137096 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-07-14svgio: factor out common codeXisco Fauli
Also skip spaces before the #, Something like xlink:href=" #target" is still valid Change-Id: Ia62e58ca31bfecd283776ec84fcc4bba1836afab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137074 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-07-13svgio: use href along with xlink:hrefXisco Fauli
xlink:href has been deprecated. See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href Change-Id: I622cd975c0bcc1a819831d7b9c867312ff59affa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137035 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-07-08tdf#149913: add support for auto-start-reverseXisco Fauli
See https://svgwg.org/svg2-draft/painting.html#OrientAttribute Change-Id: Iedcca7bc79a54333c0f80927364caec82ce61167 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136894 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-07-07tdf#149893: Color names are ASCII case-insensitiveXisco Fauli
See https://www.w3.org/TR/css-color-3/#html4 Change-Id: Ifdf887bad08ab606abef78fa8335bc49507f4a43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136879 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
2022-06-27clang-tidy modernize-pass-by-value in svgioNoel Grandin
Change-Id: I48283b202a0d5b9560a587daa4ebbf86367875ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136453 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-22tdf#149449 Don't ignore CSS class redefinition inside SVGsofftkp
Previously if a css class was redefined like so: .cls2,.cls3{fill:#fff;}.cls-2{opacity:0.1;} the second definition of .cls-2 would get ignored and opacity would remain 1. This patch keeps track of the names of each previously defined class and makes sure to append the future redefinition instead of ignoring it. Change-Id: I20b55aea247d11774cd743505a90f1466f622b1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136109 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-05-03add o3tl::matchIgnoreAsciiCaseNoel Grandin
Change-Id: Iad8e1ed256d84808404bf20ed7a16b05b3db5818 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133753 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-03Recheck modules sv* with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I25779cbfb1aa93c31d6e12ac95e136b3bdbbc058 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130403 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-12-24tdf#97663 SVGIO: Fix line spacing for <tspan>Hossein
tdf#97663 is a regression caused by the commit 701324a1e1f7e0c181ff1a50956ced686785ea53. The previous patch caused LO to forget the size of the font which was needed to calculate line height based on em units. em, px, pt, cm, in... https://www.w3.org/Style/Examples/007/units.en.html Accompanied with this fix is a unit test provided to avoid this issue in the future. The fix can be tested with: make CPPUNIT_TEST_NAME="testTdf97663" -sr \ CppunitTest_svgio The em_units.svg is opened with Firefox, Chrome and Inkscape and the rendering in LibreOffice is compatible with the rendering in these applications. Change-Id: Idaecd9fb18101f7925fe2a917f7fc3fe7257ebc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127130 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2021-11-11Use o3tl::convertMike Kaganski
Change-Id: I62239252efed514de7db88b4bea6f4d4d719fb17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125021 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-03loplugin:finalclassesNoel Grandin
Change-Id: I10ff73f89c965beb3cfb5fc3a40dd959d8f77aaa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124600 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-11loplugin:moveparam in svgioNoel Grandin
Change-Id: I4badd081340c9f8e8fcce97bd730f9c7da046382 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123426 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-24reduce copying in drawinglayerNoel Grandin
by passing PrimitiveContainer&& around. There are lots of place where we were preparing a local variable of type PrimitiveContainer, and then copying it someplace else, then throwing it away. Change-Id: Iacfd983640c9e55da25800ccc01734dfc8b4d64a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122527 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-22Extend loplugin:stringviewparam to starts/endsWith: svgioStephan Bergmann
Change-Id: Ia48465b86e6b2e5362b95a2b228414bfc6ac6490 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122481 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-08-22no need to use unique_ptr for B2DHomMatrixNoel Grandin
it is already a COW type Change-Id: Ide1dedfb8be7593bf45b0e78899450f04291f09e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120828 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-22no need to use unique_ptr for B2DPolygonNoel Grandin
it is already a COW type Change-Id: I86c4be9dd83b98eedf169c3b6668a7994204bca0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120827 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-22no need to use unique_ptr for B2DPolyPolygonNoel Grandin
it is already a COW type Change-Id: Iaf8bf1671781923555df3e43b0db78e87c2c5a87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120826 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-01svgio: convert enum to enum class in svgstyleattributes.hxxTomaž Vajngerl
Change-Id: I97ac8922f4d6b921c2ef862f2168d14b66d8fc53 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114958 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-05-01svgio: use pragma once in the header filesTomaž Vajngerl
Change-Id: I781e2083f4aab2e11bf78c3b941701ff7dd35772 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114957 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-05-01svgio: move isPositive to the SvgNumber header fileTomaž Vajngerl
Change-Id: I05c7d59000ac7f14a5d34ed30273379f6fc31677 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114955 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-05-01svgio: move SvgNumber to its own header fileTomaž Vajngerl
Change-Id: I3f65b73cf0dd21e9818fa3596664662e1aa52c8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114954 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-05-01convert enums to enum classes in svgnode.hxxTomaž Vajngerl
converted XmlSpace, Display Change-Id: I4aced2d7c2f6fcb4adc59949a6ac22d4ddd375a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114953 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-05-01convert enums to enum classes in svgtools.hxxTomaž Vajngerl
converted SvgUnits, NumberType, SvgUnit, SvgAlign Change-Id: I703b1d9396f42b3af1a36c683628e90161f2717d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114952 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-04-30svgio: change SVGToken enum to enum classTomaž Vajngerl
Change-Id: Ic2618c91b1793463b7ce0a42ec1db100d11acfa4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114898 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-04-12update PCHsCaolán McNamara
Change-Id: Id3728ac0011d3deed7e56081e3a854c7fa5336f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113959 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-03-21update pchesCaolán McNamara
Change-Id: I60e61133c305673bb305e41957f5414820c7c358 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112790 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-03-09Make sal/config.h the first in pchMike Kaganski
By convention, it should be the first include in C/CXX files; so use of pch should not break that. Change-Id: Ic329c5f39e8f48ad1778724368e262e48972342b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112123 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-03-06update pchesJulien Nabet
I just used ./bin/update_pch.sh Change-Id: I06a7f36eb4c511b8d6c6477fd87e57f0d9702457 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112097 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-02-23update pchesCaolán McNamara
Change-Id: I44424081b7f55710c4db7f10d1829de1ae08be76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111363 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-02-20loplugin:refcounting in svgioNoel
Change-Id: Id7669026fbe4b6cc92e2b137cba0c6c3c33f7712 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111259 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-08update pchesCaolán McNamara
Change-Id: Icf55ddda055d11b649e7607c2cdd8b6d6ddfefbc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110483 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-01-04loplugin:stringviewparam: operator +=Stephan Bergmann
Change-Id: I30ce1b5bd8fb168da7067c1967c5af2569df2653 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108512 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-04update pchesCaolán McNamara
Change-Id: I3e22c2000da03f6f3345353846213203993aa865 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107192 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-12-01tdf#42949 Fix new IWYU warnings in directories s*Gabor Kelemen
Except recently checked sc, sd, svx, sw Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ice1b86628e4f22a39f307b9c5fa567b6ab9d5acb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106917 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-12New loplugin:stringviewparamStephan Bergmann
...to "Find functions that take rtl::O[U]String parameters that can be generalized to take std::[u16]string_view instead." (Which in turn can avoid costly O[U]String constructions, see e.g. loplugin:stringview and subView.) Some of those functions' call sites, passing plain char string literals, needed to be adapted when converting them. Change-Id: I644ab546d7a0ce9e470ab9b3196e3e60d1e812bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105622 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-09-16Turn OUStringLiteral into a consteval'ed, static-refcound rtl_uStringStephan Bergmann
...from which an OUString can cheaply be instantiated. This is the OUString equivalent of 4b9e440c51be3e40326bc90c33ae69885bfb51e4 "Turn OStringLiteral into a consteval'ed, static-refcound rtl_String". Most remarks about that commit apply here too (this commit is just substantially bigger and a bit more complicated because there were so much more uses of OUStringLiteral than of OStringLiteral): The one downside is that OUStringLiteral now needs to be a template abstracting over the string length. But any uses for which that is a problem (e.g., as the element type of a container that would no longer be homogeneous, or in the signature of a function that shall not be turned into a template for one reason or another) can be replaced with std::u16string_view, without loss of efficiency compared to the original OUStringLiteral, and without loss of expressivity. The new OUStringLiteral ctor code would probably not be very efficient if it were ever executed at runtime, but it is intended to be only executed at compile time. Where available, C++20 "consteval" is used to statically ensure that. The intended use of the new OUStringLiteral is in all cases where an object that shall itself not be an OUString (e.g., because it shall be a global static variable for which the OUString ctor/dtor would be detrimental at library load/unload) must be converted to an OUString instance in at least one place. Other string literal abstractions could use std::u16string_view (or just plain char16_t const[N]), but interestingly OUStringLiteral might be more efficient than constexpr std::u16string_view even for such cases, as it should not need any relocations at library load time. For now, no existing uses of OUStringLiteral have been changed to some other abstraction (unless technically necessary as discussed above), and no additional places that would benefit from OUStringLiteral have been changed to use it. Global constexpr OUStringLiteral variables defined in an included file would be somewhat suboptimal, as each translation unit that uses them would create its own, unshared instance. The envisioned solution is to turn them into static data members of some class (and there may be a loplugin coming to find and fix affected places). Another approach that has been taken here in a few cases where such variables were only used in one .cxx anyway is to move their definitions from the .hxx into that one .cxx (in turn causing some files to become empty and get removed completely)---which also silenced some GCC -Werror=unused-variable if a variable from a .hxx was not used in some .cxx including it. To keep individual commits reasonably manageable, some consumers of OUStringLiteral in rtl/ustrbuf.hxx and rtl/ustring.hxx are left in a somewhat odd state for now, where they don't take advantage of OUStringLiteral's equivalence to rtl_uString, but just keep extracting its contents and copy it elsewhere. In follow-up commits, those consumers should be changed appropriately, making them treat OUStringLiteral like an rtl_uString or dropping the OUStringLiteral overload in favor of an existing (and cheap to use now) OUString overload, etc. In a similar vein, comparison operators between OUString and std::u16string_view have been added to the existing plethora of comparison operator overloads. It would be nice to eventually consolidate them, esp. with the overloads taking OUStringLiteral and/or char16_t const[N] string literals, but that appears tricky to get right without introducing new ambiguities. Also, a handful of places across the code base use comparisons between OUString and OUStringNumber, which are now ambiguous (converting the OUStringNumber to either OUString or std::u16string_view). For simplicity, those few places have manually been fixed for now by adding explicit conversion to std::u16string_view. Also some compilerplugins code needed to be adapted, and some of the compilerplugins/test cases have become irrelevant (and have been removed), as the tested code would no longer compile in the first place. sal/qa/rtl/strings/test_oustring_concat.cxx documents a workaround for GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96878> "Failed class template argument deduction in unevaluated, parenthesized context". That place, as well as uses of OUStringLiteral in extensions/source/abpilot/fieldmappingimpl.cxx and i18npool/source/localedata/localedata.cxx, which have been replaced with OUString::Concat (and which is arguably a better choice, anyway), also caused failures with at least Clang 5.0.2 (but would not have caused failures with at least recent Clang 12 trunk, so appear to be bugs in Clang that have meanwhile been fixed). Change-Id: I34174462a28f2000cfeb2d219ffd533a767920b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102222 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-13loplugin:stringstatic also look for local staticsNoel Grandin
Add some API to O*StringLiteral, to make it easier to use in some places that were using O*String Change-Id: I1fb93bd47ac2065c9220d509aad3f4320326d99e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100270 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-20compact namespace: svgioNoel Grandin
Change-Id: I249fbc53ac766c0491b956bb8618be6bfa24558c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99011 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-12update pchesCaolán McNamara
Change-Id: I75602277a5a26b012a12f2c4f4b7ff5bb663b0b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98474 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-05-10compact namespace in sal..svgioNoel Grandin
Change-Id: I7e70614ea5a1cb1a1dc0ef8e9fb6fd48e85c3562 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93904 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-26update pchesCaolán McNamara
Change-Id: I83a61da7dda6c72552eecd377f1c3744c92a797e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92909 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-04-22tdf#42949 Simplify use of rtl::math::approxEqual in include/basegfx/Gabor Kelemen
Turns out we can save about 500Mb of preprocessor input if we use rtl_math_approxEqual from rtl/math.h instead of its C++ wrapper rtl::math::approxEqual from rtl/math.hxx and manage the fallout accordingly. Before: bin/includebloat.awk | head sum total bytes included (excluding system headers): 19017296671 After: $ bin/includebloat.awk | head sum total bytes included (excluding system headers): 18535432672 Change-Id: I1691171f3a309405a7099882ad9989d147f59118 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92508 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>