summaryrefslogtreecommitdiff
path: root/oox/source/vml
AgeCommit message (Collapse)Author
2021-02-14Move unit conversion code to o3tl, and unify on that in more placesMike Kaganski
This also allows to easily add more units, both of length and for other unit categories. The conversion for "Line" unit (312 twip) is questionable. Corresponding entries in aImplFactor in vcl/source/control/field.cxx were inconsistent (45/11 in; 10/13 pc; 156/10 pt). They were added without explanation in commit c85db626029fd8a5e0dfcb312937279df32339a0. I haven't found a spec of the unit (https://en.wikipedia.org/wiki/Line_(unit) is not specific). I used the definition based on "by pt", "by mm/100", "by char" (they all were consistent); "by pc" seems inverted; "by twip" was half as much. This accepted conversion makes unit test for tdf#79236 pass. Change-Id: Iae5a21d915fa8e934a1f47f8ba9f6df03b79a9fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110839 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-02-10Fix loplugin:stringliteralvarStephan Bergmann
...detection of OUString( const sal_Unicode * value, sal_Int32 length ) ctor. (On platforms where sal_Int32 is a typedef for int, an argument that already is of type int will not be wrapped in an ImplicitCastExpr to the sal_Int32 typedef.) Change-Id: Ifc5456a62d42c1acad76ea949549dc24bd67201a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110654 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-02-08Remove unneeded breaksAndrea Gelmini
Extending this: https://gerrit.libreoffice.org/c/core/+/110512 Change-Id: I1c5bfcddeb0f5619dc848bbf02408cf166bebc8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110521 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-02-08oox: prefix VML shapetype ids with _x0000_tMichael Stahl
Word 2013 refuses to even load a file that has a <v:shapetype id="shapetype_75"> on some form control shape, reporting a misleading error in a location far later when the top-level w:tbl that contains the shape ends. Using id="_x0000_t75" appears to work, so let's do that then. Couldn't find any documentation on why this is so. Change-Id: Ie22bb04244e24b00a1880544872ae8e281422405 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110493 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-01-02introduce Degree100 strong_int typeNoel
Change-Id: I78f837a1340be0ca5c49097f543a481b7b43a632 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108367 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-23add utility NbcRotate methodNoel Grandin
Change-Id: I66d016a22158f9f9ef68a80842e95e45516f0b4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108228 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-11Adapt the remaining OUString functions to std string_viewStephan Bergmann
...for LIBO_INTERNAL_ONLY. These had been missed by 1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take std::u16string_view parameters" because they did not match the multi-overload pattern that was addressed there, but they nevertheless benefit from being changed just as well (witness e.g. the various resulting changes from copy() to subView()). This showed a conversion from OStringChar to std::string_view to be missing (while the corresponding conversion form OUStringChar to std::u16string_view was already present). The improvement to loplugin:stringadd became necessary to fix > [CPT] compilerplugins/clang/test/stringadd.cxx > error: 'error' diagnostics expected but not seen: > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd] > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd] > 2 errors generated. Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-10tdf#41466 DOCX import: fix VML v:shape/v:textboxRegényi Balázs
VML v:shape/v:textbox element was imported only as a text frame, losing (otherwise recognized) preset shape geometry, i.e. replacing a callout bubble (wedgeRectCallout) and other special shapes with a plain rectangle. Thanks to Attila Bakos for the initial help. Change-Id: I03a608822ed54a20ed07406a08c3539e72958f5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105299 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2020-11-16replace std::max(std::min()) with std::clampNoel
Change-Id: I890d19f5e2177294dc1175c90c98b964347f9e85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105751 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-11disable O(U)String::concat for internal codeNoel Grandin
in favour of the more widely used, and better optimised, operator+ Change-Id: I6a1b37e0f3d253af1f7a0892443f59b620efea63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105523 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-30tdf#137642 VML shape import: fix alignment from top marginSzabolcs Toth
Use the new define PAGE_PRINT_AREA_TOP at import. Everything else is handled in the previous patches. Change-Id: Ie801ab71a33a657551dbc5bfb63d1491aaa73abd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104923 Tested-by: Jenkins Reviewed-by: Balazs Varga <varga.balazs3@nisz.hu>
2020-10-29tdf#137765 DOCX VML shape import: fix rotation handlingRegényi Balázs
Change-Id: I78c89d4f795a67ff44ae9cef9daf44bf9f1d5c8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104807 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2020-10-27tdf#137678 DOCX VML shape import: fix missing horizontal mirroringRegényi Balázs
The MirroredY property is set (in the CustomShapeGeometry property), but it is not supported for the LineShape by UNO, so we have to make the mirroring during importing. Change-Id: Iaa7e3a352598ad12c5e0d40b4fcd43fd197c4df9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104662 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2020-10-26tdf#97517 DOCX VML shape import: fix missing vertical mirroringRegényi Balázs
The MirroredX property is set (in the CustomShapeGeometry property), but it is not supported for the LineShape by UNO, so we have to make the mirroring during importing. Change-Id: I65a1f9a115a003c056ae31f4bc217206a0e6dcd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104656 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2020-10-06tdf#105875 DOCX VML shape import: fix missing rotationRegényi Balázs
Also to avoid bad resizing of the rotated shape, remove obsolete(?) code part from commit 0423a6741fc08a35b123556f9b10219d090ee42a (Import bezier curves from .docx.). Co-authored-by: Szabolcs Toth Change-Id: I77266ba65e558cf9e6dd0e1c37fad85abd038819 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103693 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2020-10-03loplugin:reducevarscope in ooxNoel
Change-Id: I6f2f91b821271415c4cec0eb1e694b00b3b2f59f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103836 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-09-22OUStringLiteral/OStringLiteral coverity PARSE_ERROR workaroundCaolán McNamara
do more like commit 121771e37f7e2de41cd5643475861062bf25627b Date: Mon Sep 21 09:17:54 2020 +0200 Make some OUStringLiteral vars constexpr cause coverity can live with that Change-Id: I9efd7f848289c4865997a44c6780373068422227 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103147 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-15tdf#103611 sw: fix vertical alignment to page bottom marginTibor Nagy
Allow to align objects to page bottom margin vertically in Position and Size settings. Fix also DOCX import of VML shapes. Co-authored-by: Attila Szűcs (NISZ) Change-Id: I78db2553ee9d963b18a2d580b1cbb76c1917ac0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102379 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2020-09-11tdf#135660 DOCX import: fix OLE icon wrap distanceDaniel Arato (NISZ)
The text wrap distance (also sometimes called "margin") of OLE VML icons used to be thrown away when a .docx file is opened. Change-Id: I79837421470dde5e68e916f87924b170ebf1d734 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102159 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2020-09-07tdf#135665 DOCX: import tight wrap setting of VML shapesDaniel Arato (NISZ)
The wrap setting that OOXML calls "tight" and LibreOffice calls "contour" (== true) was not supported by the import code, only the export. Change-Id: I48739ffaad48e28df05fd87a9b51a14238dc47e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101932 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2020-08-31tdf#97618 DOCX import: VML shape: fix missing square wrapRegényi Balázs
Co-authored-by: Szabolcs Tóth Change-Id: Ib9db4b0270ed7d4b3d47406f2384276cafdd7249 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101632 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2020-08-28Change OUStringLiteral from char[] to char16_t[]Stephan Bergmann
This is a prerequisite for making conversion from OUStringLiteral to OUString more efficient at least for C++20 (by replacing its internals with a constexpr- generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount, conditionally for C++20 for now). For a configure-wise bare-bones build on Linux, size reported by `du -bs instdir` grew by 118792 bytes from 1155636636 to 1155755428. In most places just a u"..." string literal prefix had to be added. In some places char const a[] = "..."; variables have been changed to char16_t, and a few places required even further changes to code (which prompted the addition of include/o3tl/string_view.hxx helper function o3tl::equalsIgnoreAsciiCase and the additional OUString::createFromAscii overload). For all uses of macros expanding to string literals, the relevant uses have been rewritten as u"" MACRO instead of changing the macro definitions. It should be possible to change at least some of those macro definitions (and drop the u"" from their call sites) in follow-up commits. Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-27tdf#135653 OOXML import: fix OLE background colorAttila Bakos
When importing a .docx file Writer used to ignore the 'filled' and 'fillcolor' attributes in the 'shape' tag belonging to an OLE object. Now both these are imported and displayed correctly. Co-authored-by: Daniel Arato (NISZ) Change-Id: I2e6b880d88e4c46af6f3f2316ee966bac1a1f2e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100922 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2020-08-18tdf#132555 PPTX VML import: handle stroke properties of image shapesMiklos Vajna
ComplexShape::implConvertAndInsert() returns early in the graphic object shape case, so stroke model is not applied at all. Also fix a problem in ShapeBase::finalizeFragmentImport(), where the shape type had no stroke, but the shape itself had, and the later should win. The warning in OleObjectGraphicDataContext::onCreateContext() now points out that <mc:AlternateContent> is ignored as a child of <a:graphicData>, which probably should be addressed at some stage, but it's not required to fix the missing stroke. Change-Id: I4ab43b4c6d40d9f43caad22b85f5b885fa8b4ef1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100952 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2020-08-13Remove some unused includesMiklos Vajna
Change-Id: Iea6b931b1f2328886354f70ad81a3e07367db717 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100669 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
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-01Upcoming improved loplugin:staticanonymous -> redundantstatic: ooxStephan Bergmann
Change-Id: I1c6a2852e4794529ec7d55ceae485196a8170e24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97617 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-24inline some use-once typedefsNoel Grandin
Change-Id: Idddba2f3fd05265b08dbc88edb6152d34a166052 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94730 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-18tdf#123622 DOCX VML import: fix relative horizontal alignmentTibor Nagy
Margin (left, right, inner, outer) alignments of VML shapes weren't handled. Co-authored-by: Attila Bakos (NISZ) Change-Id: I5f8ece64707a2d699b71d6151887db05ac39c4f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93723 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2020-05-15replace hard-coded "1.2" ODF version stringsMichael Stahl
Most of these are calls to DocumentDigitalSignatures::createWithVersion(), where it doesn't make a difference if "1.2" or "1.3" is passed in but maybe it will be different with "1.4". There is another ctor createDefault() which looks appropriate for non-ODF contexts and can also be used when no actual signing or verifying is done. In cases where there's an actual document its Storage has the version. Change-Id: Id636bbf965d9f96c7ed5f50774c509032525b2b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93091 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-05-10new loplugin:simplifypointertoboolNoel Grandin
Change-Id: Iff68e8f379614a6ab6a6e0d1bad18e70bc76d76a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91907 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-27Make upcasting css::uno::Reference ctor require complete typesStephan Bergmann
The main reason for the "home-grown" UpCast introduced with 904b3d1fceee5827076758ed2a81f80cb73493ca "Up-cast conversion constructor for css::uno::Reference" in 2013 was probably that we could not yet rely on C++11 std::is_base_of back then. A (welcome) side effect was that the derived class could be incomplete. However, specializations of UpCast relying on whether or not T2 is incomplete are obviously an ODR violation if the type is incomplete in some TUs and complete (and derived from T1) in others. And even if UpCast had internal linkage, it would still be brittle that its behavior depends on the completeness of T2 at the point of the template's instantiation, and not necessarily at the point of use. That means we should better base that ctor on std::is_base_of (which we can do now since 39a1edd6fec902ef378acce8af42c4d7fba280d0 "Make css::uno::Reference upcast ctor LIBO_INTERNAL_ONLY"), which causes a compilation error at least on Clang and GCC if the completeness requirements are not met. This change fixes all the cases where types need to be complete now, plus any resulting loplugin:referencecasting warnings ("the source reference is already a subtype of the destination reference"). Change-Id: Ieb9e3552e90adbf2c5a5af933dcb872e20661a2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92950 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-04-20tdf#78749 DOCX: import VML background imageAttila Bakos
of text boxes. DOCX relationship identifier wasn't handled earlier, only XLSX. Co-developer: Tibor Nagy Change-Id: I72f246e6f69d70d1e203087516ee93a57563f777 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91933 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2020-04-03loplugin:flatten in ooxNoel Grandin
Change-Id: Ia57944653fa10e864822518372acab83555e0f20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91618 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-31tdf#100751 DOCX VML shape import: fix arrow directionSzabolcs Toth
Flips along both the y- and x-axis weren't imported, resulting wrong direction of arrow and other shapes. Co-Author: Balázs Regényi Change-Id: Iac222ac2a6a6110289969c32b40828b83da0aefd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90646 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga991@gmail.com>
2020-03-20tdf#42949 Fix IWYU warnings in oox/source/[e-v]*/*cxxGabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I6cd335e3055ca1dcebcaf0b26ec843b1937f0bce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90773 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-03-17tdf#131118 VML import: fix size of non-autosize shapes containing textMiklos Vajna
Regression from commit b92293b3943423324064a8513c2e114d18817179 (tdf#103983 VML import: handle <v:textbox style="mso-fit-shape-to-text:t">, 2020-01-20), the problem was that in case we disable autosize too late, then the size will be already set during adding text to the shape. Do it before adding text, this way adding text won't change the shape size, so it'll be correct at the end of the import. Change-Id: I9410fc695c3edfa5089d845864bf237e71c533c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90592 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-03-03tdf#84399 VML import: map <v:shape o:spt="202"> to TextShapeMiklos Vajna
This partially reverts commit 81f9fe3a14f0fc99afbfa7ce3a26a9c7855d0919 (fdo#74401 VML groupshape import: only handle v:rect as TextShape, 2014-03-19), which wanted to map triangles to custom shapes. It was overlooked that we can have not only explicit rectangles and custom shapes, but also <v:shape> elements which have their shape type explicitly set to TextBox. The later is now again handled similar to rectangles. This keeps the triangle case working, but fixes the <v:shape o:spt="202"> case. We need to make this decision while parsing the XML, so some rework is needed to have earlier access to its container (group shape or draw page) and also to its shape type. Change-Id: I33a4b3cd03b0df5d93cffa19e7ea834113df2bdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89852 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-02-21Drop o3tl::optional wrapperStephan Bergmann
...now that macOS builds are guaranteed to have std::optional since 358146bbbd1b9775c12770fb5e497b6ec5adfc51 "Bump macOS build baseline to Xcode 11.3 and macOS 10.14.4". The change is done mostly mechanically with > for i in $(git grep -Fl optional); do > sed -i -e 's:<o3tl/optional\.hxx>\|\"o3tl/optional\.hxx\":<optional>:' \ > -e 's/\<o3tl::optional\>/std::optional/g' \ > -e 's/\<o3tl::make_optional\>/std::make_optional/g' "$i" > done > for i in $(git grep -Flw o3tl::nullopt); do > sed -i -e 's/\<o3tl::nullopt\>/std::nullopt/g' "$i" > done (though that causes some of the resulting #include <optional> to appear at different places relative to other includes than if they had been added manually), plus a few manual modifications: * adapt bin/find-unneeded-includes * adapt desktop/IwyuFilter_desktop.yaml * remove include/o3tl/optional.hxx * quote resulting "<"/">" as "&lt;"/"&gt;" in officecfg/registry/cppheader.xsl * and then solenv/clang-format/reformat-formatted-files Change-Id: I68833d9f7945e57aa2bc703349cbc5a56b342273 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89165 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-31new loplugin:namespaceindentationNoel Grandin
check indentation of braces in namespace decls, and the comments that often appear with them. This is my penance for messing up the indentation with clang-tidy-modernize-namespaces. As such I have limited it to new-style namespaces for now, and the check is off by default. Change-Id: I4db7f10a81c79bc0eece8f8e3ee564da8bc7f168 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87723 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-22avoid some unnecessary log warning messagesNoel Grandin
Change-Id: I72f839800b749bd5c90faea9f2fed25dd938bca4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87187 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-21tdf#103983 VML import: handle <v:textbox style="mso-fit-shape-to-text:t">Miklos Vajna
We used to always always set TextAutoGrowHeight to true, only do that when the matching VML attribute is detected, default to false. This helps the exporter, so it writes the correct markup on save of the bugdoc. Also adapt testGroupshapeChildRotation, which in practice tested the automatic height of the shape. The point of "auto" is that it changes as needed, hardcoding that value in a test is not a great idea. Rather test that the height is no longer automatic (there is no explicit markup in the file, and the default is false). Change-Id: Ie39408b7da53f4923a2ade503e520c704a86bcf4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87104 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-01-15clang-tidy modernize-concat-nested-namespace in ooxNoel Grandin
Change-Id: I9877be75e1f7dcefdf7172d05dfbb0a63d06ced1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86803 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-10use more std::make_sharedNoel Grandin
found using 'git grep', I tried using clang-tidy, but it only successfully found a tiny fraction of these Change-Id: I61c7d85105ff7a911722750e759d6641d578da33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86526 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-19sal_Char->char in oox..registryNoel Grandin
Change-Id: Icc7f2a32696c30317c1ee77ef39d682d5f5a80b9 Reviewed-on: https://gerrit.libreoffice.org/85512 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-03tdf#128429 VML import: let mso-layout-flow-alt:bottom-to-top imply verticalMiklos Vajna
Normally layout flow is set to vertical to denote TBRL, and then optionally there is a layout flow alt to denote BTLR, but the bugdoc shows that the first may be missing. So map to BTLR even in case only the alt layout flow is found in the file. Change-Id: I06fce738fca9aedc0de90ccebda3a24e99425326 Reviewed-on: https://gerrit.libreoffice.org/84275 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-12-01Introduce o3tl::optional as an alias for std::optionalStephan Bergmann
...with a boost::optional fallback for Xcode < 10 (as std::optional is only available starting with Xcode 10 according to <https://en.cppreference.com/w/cpp/compiler_support>, and our baseline for iOS and macOS is still Xcode 9.3 according to README.md). And mechanically rewrite all code to use o3tl::optional instead of boost::optional. One immediate benefit is that disabling -Wmaybe-uninitialized for GCC as per fed7c3deb3f4ec81f78967c2d7f3c4554398cb9d "Slience bogus -Werror=maybe-uninitialized" should no longer be necessary (and whose check happened to no longer trigger for GCC 10 trunk, even though that compiler would still emit bogus -Wmaybe-uninitialized for uses of boost::optional under --enable-optimized, which made me ponder whether this switch from boost::optional to std::optional would be a useful thing to do; I keep that configure.ac check for now, though, and will only remove it in a follow up commit). Another longer-term benefit is that the code is now already in good shape for an eventual switch to std::optional (a switch we would have done anyway once we no longer need to support Xcode < 10). Only desktop/qa/desktop_lib/test_desktop_lib.cxx heavily uses boost::property_tree::ptree::get_child_optional returning boost::optional, so let it keep using boost::optional for now. After a number of preceding commits have paved the way for this change, this commit is completely mechanical, done with > git ls-files -z | grep -vz -e '^bin/find-unneeded-includes$' -e '^configure.ac$' -e '^desktop/qa/desktop_lib/test_desktop_lib.cxx$' -e '^dictionaries$' -e '^external/' -e '^helpcontent2$' -e '^include/IwyuFilter_include.yaml$' -e '^sc/IwyuFilter_sc.yaml$' -e '^solenv/gdb/boost/optional.py$' -e '^solenv/vs/LibreOffice.natvis$' -e '^translations$' -e '\.svg$' | xargs -0 sed -i -E -e 's|\<boost(/optional)?/optional\.hpp\>|o3tl/optional.hxx|g' -e 's/\<boost(\s*)::(\s*)(make_)?optional\>/o3tl\1::\2\3optional/g' -e 's/\<boost(\s*)::(\s*)none\>/o3tl\1::\2nullopt/g' (before committing include/o3tl/optional.hxx, and relying on some GNU features). It excludes some files where mention of boost::optional et al should apparently not be changed (and the sub-repo directory stubs). It turned out that all uses of boost::none across the code base were in combination with boost::optional, so had all to be rewritten as o3tl::nullopt. Change-Id: Ibfd9f4b3d5a8aee6e6eed310b988c4e5ffd8b11b Reviewed-on: https://gerrit.libreoffice.org/84128 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-26nipick followup: add TOOLS_WARN_EXCEPTION to empty try-catchJustin Luth
followup for tdf#128153 docx/VML: apply style properties to shape text Change-Id: I2e1a057cfacb610d294ed106879af89482637a3a Reviewed-on: https://gerrit.libreoffice.org/83721 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-11-22tdf#128153 docx/VML: apply style properties to shape textJustin Luth
This replaces LO 4.3 commit 8766011bccfd0f12f8dd77d2f94eb16e2e8c3471 DOCX import: set document-level font size default based on default para style ...and is needed for tdf#118947, since bogus DEFAULT_VALUEs really hinder determining what a table style should override. Shape text should inherit the font size from the style that is specified. In many cases, it will not be specified, and therefore the default style was appropriate, but in cases where a style IS specified, then of course use that fontsize ... and every other character and paragraph property. HOWEVER, I only added the properties used in vml import for now, and I skipped asian/complex fontnames since VML only handles CharHeight, and not CharHeightAsian/Complex. -note: this does not affect direct formatting - it just sets default value at the shape level, not at the paragraph level. So far I have only looked at DOCX:VML - which satisfies the unit tests. There are other codepaths that lead to PushShapeContext though, and this should be easy to expand to other import situations. I've tried lots of asserts to find unit tests that should be modified, and so far they all seemed to point to VML - although round-tripping doesn't use VML and still requires at minimum the CharHeight property to be overridden, so limiting non-VML to that to maintain backward compatibility, and reduce regression footprint. Since we have to emulate here (since paragraph styles are not supported on Draw text), a perfect solution cannot possibly be found - specifically in cases where multiple paragraphs exist in one shape with different styles applied, or where some pararaphs apply a paragraph property and others do not. Compromise 1: For ambiguous paragraph styles, fallback to the default paragraph style. Rationale: Normally, most styles inherit from default and only change a couple of properties. So MOST of the properties will match the normal style. The chances that the default style will be correct are more likely than that some other random default would be. -note: no existing unit tests were ambiguous Compromise 2: Ideally, each paragraph could report whether it had DIRECT formatting, and the paragraphs could be walked through instead of the shapes. But I don't think that is reasonably possible in this SyncProperties situation. At first I had a grabbag framework setup that monitored when a paragraph property was set, and then skipped applying that property. But I later noticed that the PropertyState for paragraph properties actually did seem to reflect that - which is a better solution if it works properly. Regression potential: -for VML: should be limited to non-charheight properties where the default style sets some weird default, and an ambiguous style sets it back to the program default. Prior to this patch, the default style value wouldn't apply. On the flip side (and more likely scenario), non-ambiguous cases will use the correct value and look more like MSWord, as seen in many existing unit tests that now use corrected fonts. -for non-VML: should be none since I limit it to only CharHeight which was previously emulated by changing the program default. Change-Id: I8f1fb7ed01f990dbf998ebe04064c2645a68e1aa Reviewed-on: https://gerrit.libreoffice.org/81365 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-11-06loplugin:indentation find broken if statementsNoel Grandin
so I don't read the "then" block as being a sequential statements Change-Id: Ib2004acd3518bd4ebd2246f02a26c2c0a8bbab4c Reviewed-on: https://gerrit.libreoffice.org/82069 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>