summaryrefslogtreecommitdiff
path: root/oox
AgeCommit message (Collapse)Author
2022-06-18o3tl: ensure that the initializer of enumarray contains enough elementsMichael Stahl
Currently this silently succeeds. Turns out oox already contains some too-short initializers, let's guess the missing properties are all invalid. One downside of the templated parameter pack approach in the enumarray ctor, as witnessed in vcl/win/window/salframe.cxx, is that argument types can no longer be implicitly deduced and thus need to be spelled explicitly now in certain cases. There were also three uses of enumarry with V being unsigned short (aka sal_uInt16) that started to cause narrowing conversion errors now and needed to be adapted: In editeng/source/uno/unonrule.cxx the obvious fix was to use the proper type for V. In sw/source/core/unocore/unosett.cxx with its odd mix of saL_Int16 and USHRT_MAX, lets keep things that way for now (probably awaiting later clean up) and use casts to avoid the implicit narrowing. And in sw/source/filter/ww8/wrtw8esh.cxx the ESCHER_Prop_* values, while presumably conceptionally of type sal_uInt16, are plain #defines (thus of type int), so rather than changing V to int it looked more consistent to explicitly cast the ESCHER_Prop_* vlaues to sal_uInt16. (And in tools/source/fsys/urlobj.cxx the poor loplugin:redundantfcast started to unhelpfully kick in for (only) the first argument now.) Change-Id: If06c29e673ec7e565e283c6f447889cf1f777cb7 Co-authored-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135970 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-17tdf#134210: Reimplement cropping from srcRect and fillRectMike Kaganski
This avoids the scaling after the crop, since scaling is performed anyway when applying BitmapMode_STRETCH. This improves resulting bitmap quality. Also consider the "crop to zero" case (when the sum of cropped parts is equal to 100%). In that case, just use an empty graphic as the fill bitmap. This makes the differences between srcRect and fillRect processing explicit, simplifies the code, avoids extra rounding inaccuracies, and takes care of the edge cases that were considered in commit 2859ec288f2c1323ea3123d82cb1684b349ff598 Author Miklos Vajna <vmiklos@collabora.com> Date Wed Jun 15 15:52:18 2022 +0200 oox: fix div by zero in lclCalculateCropPercentage() The change in SdImportTest2::testTdf134210 is because we now don't scale the cropped image. The previous value was an interpolated color, while the new value is the actual color of pixel [0, 41] of the original image. Change-Id: I24fa9928cff32bcaa6a7b3e34def14700fddd7ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135917 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-06-16tdf#128150 Add OOXML import/export for "use background fill"Samuel Mehrbrodt
and allow editing this fill property in area dlg Change-Id: Ic63ba11e9d499d4a0fb22f6739587e3e25140b8f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134406 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2022-06-16Correct parsing of ST_PercentageMike Kaganski
Change-Id: I227b2abd493d3a4ce6f4e4dcd256aa29653fdce0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135886 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-06-15oox: fix div by zero in lclCalculateCropPercentage()Miklos Vajna
Similar to what oox::vml::ShapeType::getAbsRectangle() already does. Crashreport signature: Fatal signal received: SIGFPE code: 1 for address: 0x7fcd55eeff59 program/libooxlo.so oox::drawingml::GraphicProperties::pushToPropMap(oox::PropertyMap&, oox::GraphicHelper const&, bool, bool) const oox/source/drawingml/fillproperties.cxx:103 Change-Id: I0f82cbc955d9e60bad103682638b07153a5589e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135910 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-06-13crashtesting: assert seen on loading forum-mso-en-2633.pptxCaolán McNamara
probably since: commit 855a56fea4561135a63cb729d7a625a950b210e7 Date: Fri May 13 08:12:17 2022 +0200 tdf#148965 PPTX import: fix internal hyperlinks on shapes Change-Id: I920cbbb5544cbe9d76f37b3d524c9ccebd426132 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135682 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-06-08tdf148321: convert OOXML inset values to text distance valuesTomaž Vajngerl
Inset values for top, bottom are calcualted differently in OOXML and need to be coverted on import to the text distance LO values, that place the text relative to the shape correctly. At export, the values can be converted back to the OOXML inset compatible values, but the values are not always converted back to the same values as the conversion is not bijective, however they do render the same. This also adds the test for the conversion when importing and checks that the exported values are expected. Change-Id: Ic64eec1a2a80ddad997f916da3e87dc30aaa12be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135463 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-05-31tdf#147991 PPTX export: fix bullet indent regressionAttila Bakos (NISZ)
Instead of exporting the inherited master slide indent values of the placeholders, export 0 indent value for removed/disabled bullets to fix interoperability. Regression from commit f57cfddb51b7d7409b7b425dc200aa73406a13bd "tdf#145162 PPTX export: fix extra bullet regression". Change-Id: Icbf823adc07f19fd10d1a60da9cff17616a2aef6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135025 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2022-05-31Revert 6eeb0942c35f07dfbadb13f35fc6aa3703dac945Thorsten Behrens
Change-Id: I096f25d38f19fb728110e209a189f89a8e8d402f
2022-05-30tdf#149128 PPTX export: fix <stCxn> and <endCxn> connector propertiesTibor Nagy
to avoid of detaching connections between shapes, when these connections were created in Impress. Change-Id: I1bc90bb8a408546b303b70bcfb27d3549d5e72d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134940 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2022-05-27tdf#148965 PPTX import: fix internal hyperlinks on shapesTibor Nagy
Locale dependent code path resulted broken hyperlinks on shapes in a non-English build. Change-Id: I045bbe4246ab5336e2b967bf252b5fbca5b17706 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134266 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2022-05-27tdf#149124 PPTX import: fix broken connectors in grouped shapesTibor Nagy
Previously connector lines of grouped shapes were detached after the import losing the original layout (without ungrouping and moving the shapes). Change-Id: I660629d9d1c2cb0ab68de275ca5406f4c48e9145 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134943 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2022-05-25Advanced Diagram support: Isolated IDiagramHelper, selection visualizationArmin Le Grand (Allotropia)
Moved and isolated IDiagramHelper to own file to get SdrObjGroup smaller and less dependent again, all places adapted. isDiagram() now available at SdrObject directly, adapted and have less places which need to cast for SdrObjGroup for check. Started to add SdrHdl/selection visualization to seleced Diagram. Only as a start, will need to be extended to look good/better, plus evtl. functionality in handles/UI. Corrected error(s) found by failing UnitTests More clang-notes (static, namespace) I nneeded to follow Change-Id: If4675b3270d3ee30259fce49deb017dbbaf5c0c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134825 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2022-05-24Use 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: I20600d61a5d59d739bc1bee838c0038e4611aec2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134875 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-23tdf#66228 PPTX export: fix lost U-shaped connectorsTibor Nagy
which were replaced with straight connector lines. The "Line Connector" has no equivalent in OOXML. So far it has been saved as a "Straight connector". In most cases, the better solution is to change it to "Standard connector", keeping the original layout with U-shaped connectors. Change-Id: I9d6b6174d0556ba2478c6a9837c500b3cc794c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134284 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2022-05-18Remove 1 ImportGraphic methodJulien Nabet
and replace its only use in Shape::renderDiagramToGraphic (oox/source/drawingml/shape.cxx) by an existing one. It became quite useless since 2876a0f79f94cdd139cc8fa40669acde9674bf8c (2020/03/03) graphic: remove preview when importing with GraphicFilter Change-Id: Iec3b13d85297bbe7cbfefe91a2a88e33e53d506b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134503 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-05-14use more string_view in ooxNoel Grandin
Change-Id: I7c6d201cfbfb577ef53e685df245997e5ec8f134 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134299 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-13add SvStream::ReadLine(OStringBuffer... to reduce OString allocationNoel Grandin
and use it where possible Change-Id: I3efc7a642f73661ce606c917c0323ba9948521c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134265 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-12tdf#148961 sd theme: add PPTX export for shape fill color effectsMiklos Vajna
Which allows taking the fill color theme index from the model even in case there are effects. Previously effects meant reading from the grab-bag, and only the no-effect case read the color theme index from the doc model. Change-Id: Ib50c3128b971a388f14ad721ed7f73043916a736 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134208 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-05-11Advanced Diagram support: UNDO/REDO support for Diagram DataModelArmin Le Grand (Allotropia)
Added support for UNDO/REDO for changes in Diagram ModelData. This is currenly applied/used in the DiagramDialog for it's Add/Remove actions (also supports Cancel of that dialog 1st time ever). But it is defined more general to add/support manipulating actions like clone/change_text etc. Also the UI/dialog at he end will not be/stay modal, so this is a test implemenation how to use it. It uses an extract/apply mechanism to get/set the Diagram ModelData at/for the UNDO action. That may be expanded as needed for additional data in he future. It may also be considered to modify the Connection/Point ModelData to shared_ptr internally completely to avoid copying these at all. OTOH it is not that much data to handle at all. Change-Id: I4702ed908b79a476177fe66c0e3284898c6adda5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134118 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2022-05-10tdf#147919 PPTX export: fix curved and bent connector shapeTibor Nagy
by calculating and exporting adjustment values to avoid of connector lines with bad turns overlapping the connected shapes. Change-Id: I0441508f4fe98b3482e2955df5f41f2cfc2ffb4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134109 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2022-05-07Revert "tdf#147919 PPTX export: fix curved and bent connector shape"Stephan Bergmann
This reverts commit 1f8c6efbfea10997f188962d036f5c7db4c13f8a, as it caues > warn:legacy.tools:12871:12871:tools/source/generic/poly.cxx:1581: Polygon::[]: nPos >= nPoints > ================================================================= > ==12871==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000445080 at pc 0x7f6303ec7854 bp 0x7ffd23271600 sp 0x7ffd232715f8 > READ of size 8 at 0x603000445080 thread T0 > #0 0x7f6303ec7853 in Point::X() const /include/tools/gen.hxx:83:51 > #1 0x7f63045baaa1 in oox::drawingml::lcl_GetConnectorAdjustValue(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> const&, tools::Polygon, com::sun::star::drawing::ConnectorType, std::__debug::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >&) /oox/source/export/shapes.cxx:1556:27 > #2 0x7f63045b731f in oox::drawingml::ShapeExport::WriteConnectorShape(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> const&) /oox/source/export/shapes.cxx:1701:13 > #3 0x7f63045984e7 in oox::drawingml::ShapeExport::WriteShape(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> const&) /oox/source/export/shapes.cxx:1956:5 > #4 0x7f62b399ad3b in oox::core::PowerPointExport::WriteShapeTree(std::shared_ptr<sax_fastparser::FastSerializerHelper> const&, PageType, bool) /sd/source/filter/eppt/pptx-epptooxml.cxx:1658:22 during CppunitTest_sd_export_tests-ooxml3 CPPUNIT_TEST_NAME=SdOOXMLExportTest3::testTdf114848 (<https://ci.libreoffice.org/job/lo_ubsan/2388/consoleFull#-1714579836d893063f-7f3d-4b7e-b56f-4e0f225817cd>) Change-Id: I7eab9d3ef8e6604a57d3e59a77905edf6ce6e6ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133870 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-06tdf#148929 sd theme: limit PPTX import for shape fill effects to lum mod/offMiklos Vajna
Regression from 30735bdb5a0a81619000fdd24b2d0fbf45687f01 (sd theme: add PPTX import for shape fill color effects, 2022-04-27), the bugdoc's A2 cell lost its tinting (its background color is no longer lighter than A1) after saving back to PPTX + import again. The code assumed that in case a fill color has effects, it can only be luminance offset or modulation, since that's what the PowerPoint UI generates when setting a fill color explicitly. This did not take the table style case into account, which uses tinting to make a color lighter. Fix the problem by not importing the theme index / effects if tinting is used -- the current doc model is limited to theme index + lum mod/off with effects. This limitation can be removed while text color / fill color effects are not limited to lum mod/off, but also support tinting/shading. Change-Id: I382cc0067518cc262e261a462999170cb7db261b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133908 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-05-05loplugin:unusedvariableplusNoel Grandin
Change-Id: Id93086be1224b6f6bf0bdaa1d50b4f289099027e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133876 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-05ofz#47239 Heap-use-after-freeCaolán McNamara
since commit 9bb83eefc1a1dda5c48efc5d09ef4a6840bf8b58 Date: Tue May 3 16:30:20 2022 +0200 use more string_view in oox::vml::ConversionHelper ==169915== Invalid read of size 2 ==169915== at 0x484E2C0: memmove (vg_replace_strmem.c:1382) ==169915== by 0x49D0EE6: char16_t* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<char16_t>(char16_t const*, char16_t const*, char16_t*) (stl_algobase.h:431) ==169915== by 0x49D0E94: char16_t* std::__copy_move_a2<false, char16_t const*, char16_t*>(char16_t const*, char16_t const*, char16_t*) (stl_algobase.h:494) ==169915== by 0x49D0E64: char16_t* std::__copy_move_a1<false, char16_t const*, char16_t*>(char16_t const*, char16_t const*, char16_t*) (stl_algobase.h:522) ==169915== by 0x49D0E03: char16_t* std::__copy_move_a<false, char16_t const*, char16_t*>(char16_t const*, char16_t const*, char16_t*) (stl_algobase.h:530) ==169915== by 0x49D0D84: char16_t* std::copy<char16_t const*, char16_t*>(char16_t const*, char16_t const*, char16_t*) (stl_algobase.h:619) ==169915== by 0x49D0C2E: void rtl::str::Copy<char16_t>(char16_t*, char16_t const*, int) (strtmpl.hxx:122) ==169915== by 0x49CF83E: void rtl::str::newFromStr_WithLength<_rtl_uString, char16_t>(_rtl_uString**, char16_t const*, int, int) (strtmpl.hxx:955) ==169915== by 0x49E3A44: rtl_uString_newFromStr_WithLength (ustring.cxx:1238) ==169915== by 0x2B76A771: rtl::OUString::operator=(std::basic_string_view<char16_t, std::char_traits<char16_t> >) (ustring.hxx:653) ==169915== by 0x2BC69DB4: oox::vml::TextBoxContext::TextBoxContext(oox::core::ContextHandler2Helper const&, oox::vml::TextBox&, oox::AttributeList const&, oox::GraphicHelper const&) (vmltextboxcontext.cxx:199) ==169915== by 0x2BC46E5A: oox::vml::ShapeContext::onCreateContext(int, oox::AttributeList const&) (vmlshapecontext.cxx:555) ==169915== Address 0x267e1264 is 52 bytes inside a block of size 68 free'd ==169915== at 0x48470E4: free (vg_replace_malloc.c:872) ==169915== by 0x49CFB73: void rtl::str::release<_rtl_uString>(_rtl_uString*) (strtmpl.hxx:879) ==169915== by 0x49CF8B4: void rtl::str::newFromStr_WithLength<_rtl_uString, char16_t>(_rtl_uString**, char16_t const*, int, int) (strtmpl.hxx:966) ==169915== by 0x49E3A44: rtl_uString_newFromStr_WithLength (ustring.cxx:1238) ==169915== by 0x2B76A771: rtl::OUString::operator=(std::basic_string_view<char16_t, std::char_traits<char16_t> >) (ustring.hxx:653) ==169915== by 0x2BC69C87: oox::vml::TextBoxContext::TextBoxContext(oox::core::ContextHandler2Helper const&, oox::vml::TextBox&, oox::AttributeList const&, oox::GraphicHelper const&) (vmltextboxcontext.cxx:194) ==169915== by 0x2BC46E5A: oox::vml::ShapeContext::onCreateContext(int, oox::AttributeList const&) (vmlshapecontext.cxx:555) ==169915== by 0x2BC47AE0: oox::vml::RectangleShapeContext::onCreateContext(int, oox::AttributeList const&) (vmlshapecontext.cxx:715) ==169915== by 0x2BC47B24: non-virtual thunk to oox::vml::RectangleShapeContext::onCreateContext(int, oox::AttributeList const&) (vmlshapecontext.cxx:0) ==169915== by 0x2B7341ED: oox::core::ContextHandler2Helper::implCreateChildContext(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) (contexthandler2.cxx:100) ==169915== by 0x2B734A7A: oox::core::ContextHandler2::createFastChildContext(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) (contexthandler2.cxx:204) ==169915== by 0x2B735464: non-virtual thunk to oox::core::ContextHandler2::createFastChildContext(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) (contexthandler2.cxx:0) ==169915== Block was alloc'd at ==169915== at 0x484486F: malloc (vg_replace_malloc.c:381) ==169915== by 0x49CFA18: _rtl_uString* rtl::str::Alloc<_rtl_uString>(int) (strtmpl.hxx:838) ==169915== by 0x49E0D72: rtl_uString_ImplAlloc(int) (ustring.cxx:1194) ==169915== by 0x49E1355: rtl_string2UString_status(_rtl_uString**, char const*, int, unsigned short, unsigned int, unsigned int*) (ustring.cxx:466) ==169915== by 0x49E1117: rtl_string2UString (ustring.cxx:576) ==169915== by 0x205735F3: rtl::OUString::OUString(char const*, int, unsigned short, unsigned int) (ustring.hxx:451) ==169915== by 0x20571680: sax_fastparser::FastAttributeList::getOptionalValue(int) (fastattribs.cxx:283) ==169915== by 0x205716DC: non-virtual thunk to sax_fastparser::FastAttributeList::getOptionalValue(int) (fastattribs.cxx:0) ==169915== by 0x2BA85A6B: oox::AttributeList::getString(int) const (attributelist.cxx:173) ==169915== by 0x2BC69B06: oox::vml::TextBoxContext::TextBoxContext(oox::core::ContextHandler2Helper const&, oox::vml::TextBox&, oox::AttributeList const&, oox::GraphicHelper const&) (vmltextboxcontext.cxx:186) ==169915== by 0x2BC46E5A: oox::vml::ShapeContext::onCreateContext(int, oox::AttributeList const&) (vmlshapecontext.cxx:555) ==169915== by 0x2BC47AE0: oox::vml::RectangleShapeContext::onCreateContext(int, oox::AttributeList const&) (vmlshapecontext.cxx:715) Change-Id: I745d8b718cccf894bda774b0343c2b17f49b0eed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133880 Tested-by: Jenkins Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-05use more o3tl::getTokenNoel Grandin
found by inspecting call sites of OUString::getToken Change-Id: I4269c7476c7aa46fac39528227e350568f0eb34a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132644 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-04use more string_view in oox::vml::ConversionHelperNoel Grandin
Change-Id: I8616f608ee4cc62114acb4fbd774796bc11d1911 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133812 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-04tdf#147919 PPTX export: fix curved and bent connector shapeTibor Nagy
by calculating and exporting adjustment values to avoid of connector lines with bad turns overlapping the connected shapes. Change-Id: I615a20f3ba3c5d03ae73d87848dc41e9ecd29ae5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133635 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2022-05-04simplify lcl_parseHandleRefNoel Grandin
Change-Id: I0a7cb2754ab43b8b627f196c99778b5fa3f2e005 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133808 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-04Just use Any ctor instead of makeAny in ooxStephan Bergmann
Change-Id: Id6c8341b545c819521056926ef1b80d20d148c5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133795 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-04-29use more string_view in ooxNoel Grandin
found by examining uses of OUString::copy() for likely places Change-Id: I23c397b0438e67e0fdbc1fb4ffa6882aa5e2bf91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133591 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-29oox: make buSzTx and buFontTx behave the same way as buClrTxXisco Fauli
I believe this is the right thing to do although this is a blind fix, since I couldn't find any file affected Change-Id: I500ceaf11b917abb5e86769b8816ddc2d6dfec6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133522 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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-28sd theme: add PPTX import for shape fill color effectsMiklos Vajna
This is always direct formatting, so FillProperties::pushToPropMap() always has the needed info at hand. Change-Id: I3317b618e0e8bb7688d0f0fbfe4546e2e8b4e947 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133525 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-04-27tdf#148784 consider StretchX in OOXML exportRegina Henschel
The export to custGeom uses currently a static version of the shape. Its vertices are calculated with EnhancedCustomShape2d::GetParameter(). That has parameters to determine whether ReplaceGeoWidth and ReplaceGeoHeight has to be used. It needs to be used, in case the shape has property StretchX or StretchY. That was missing. It is added now in cases where GetParameter() returns a coordinate. Not all cases are covered by unit tests. Further files for manual testing are attached to the bug. Change-Id: Idcdd081f855ed6c4e3a84dba08f8a2148ddfe54c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133463 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
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-27tdf#148665 Fix crash while loading SmartArt graphicsHossein
The regression introduced by c79fa460fe6220051bbda2d3c0cb67fbf765e2ac causes LibreOffice to crash while loading certain files that contain SmartArt graphics. By loading sample documents from tdf#148665 (docx) and also tdf#148735 (pptx) in a debug session, it became obvious that the problem happens in these statements from TextBody::toString() in textbody.cxx: if (!isEmpty()) return maParagraphs.front()->getRuns().front()->getText(); It is guaranteed that maParagraphs is not empty when trying to call getRuns(), but it is not checked that there are no runs in the first paragraph before trying to call getText(). The isEmpty() function returns false upon finding out that there is at least 1 paragraph. A check is added to TextBody::toString() to prevent a crash. This is the backtrace generated from loading documents from tdf#148735 in a Qt Creator debug session: 1 __GI_raise raise.c 50 0x7ffff79ec03b 2 __GI_abort abort.c 79 0x7ffff79cb859 3 ?? 0x7ffff7846109 4 std::vector<std::shared_ptr<oox::drawingml::TextRun>>::front vector 443 0x7fffd23d1fa6 5 oox::drawingml::TextBody::toString textbody.cxx 92 0x7fffd23d0f85 6 oox::drawingml::DiagramData::secureDataFromShapeToModelAfterDiagramImport datamodel.cxx 295 0x7fffd22d3047 7 oox::drawingml::AdvancedDiagramHelper::doAnchor diagramhelper.cxx 213 0x7fffd22fb92d 8 oox::drawingml::Shape::propagateDiagramHelper shape.cxx 229 0x7fffd2372a27 9 oox::ppt::PPTShape::addShape pptshape.cxx 574 0x7fffd25b2bd4 10 oox::ppt::SlidePersist::createXShapes slidepersist.cxx 150 0x7fffd25d81ea 11 oox::ppt::PresentationFragmentHandler::importSlide presentationfragmenthandler.cxx 404 0x7fffd25c1a78 12 oox::ppt::PresentationFragmentHandler::finalizeImport presentationfragmenthandler.cxx 550 0x7fffd25c3331 13 oox::core::FragmentHandler2::endDocument fragmenthandler2.cxx 53 0x7fffd22364ab 14 sax_fastparser::FastSaxParserImpl::parseStream fastparser.cxx 907 0x7fffe18b2d2b 15 sax_fastparser::FastSaxParser::parseStream fastparser.cxx 1480 0x7fffe18b71d2 16 oox::core::FastParser::parseStream fastparser.cxx 121 0x7fffd221d85b 17 oox::core::FastParser::parseStream fastparser.cxx 129 0x7fffd221d930 18 oox::core::XmlFilterBase::importFragment xmlfilterbase.cxx 413 0x7fffd2248ba5 19 oox::core::XmlFilterBase::importFragment xmlfilterbase.cxx 343 0x7fffd2248687 20 oox::ppt::PowerPointImport::importDocument pptimport.cxx 109 0x7fffd25a89e2 ... <More> Change-Id: I3a40be33061008b93455a5926259ef5b92e4ffe6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133341 Tested-by: Jenkins Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2022-04-26add o3tl::toUInt32Noel Grandin
Change-Id: I07f11bf12fbe1d1c2d812fa0965d6e632e1e1aba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133437 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-26DOCX export: image deduplication and clean upTünde Tóth
Follow-up to commit aea8043bc5f5187498fa450505d6de9d6986e2a6 "tdf#74670 tdf#91286 PPTX XLSX export: save image once". This reverts commit 797fef38612fb2fd62d1f6591619b9361e526bca "tdf#118535 DOCX export: save header image once" and commit 32ada80a9f47b095d7b0c4d16e3422f6ef7f2ac2 "DOCX export: make sure a graphic is only written once" and commit b484e9814c66d8d51cea974390963a6944bc9d73 "tdf#83227 oox: reuse RelId in DML/VML export for the same graphic". Change-Id: I2d90249808174290b6b3e4eb957b3ac87ad41f95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132506 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2022-04-26tdf#53970 PPTX: fix import of linked media filesTünde Tóth
Linked media files were imported as images in documents created with Impress after PPTX export. Change-Id: If4920c2e40f45fff73eca4a5fa987d524177597e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132635 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2022-04-26tdf#147586: Initialize mbBulletColorFollowText to falseXisco Fauli
Otherwise, once it's set to true, it's never reset Change-Id: Ie8a752da4162775f40c2f84f480e6a103eb55942 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133422 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-04-25oox: Remove obsolete TODOXisco Fauli
This can go after 1c924efe1f80207a5e104d755615b1eb9a91d418 < tdf#148685: Unset CharUnderlineColor and CharUnderlineHasColor properties > Change-Id: I9b9540cf0cdcd9ecbb39b92fe24b83a1810df7da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133382 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-04-25tdf#75263 - Export VBA-Project using detected charset on importAndreas Heinisch
Change-Id: Ia1f1bb31e077dcb4293c1106ac324a25a975a656 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133064 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-04-24Do not start a:path with lnTo in export to OOXMLRegina Henschel
This is a follow up to commit 2029b2f6dd0109c5892e5ac5640022b31fe42fd2 The commands A, W, T or L of a draw:enhanced-path draw a line from current point to start of the arc or end of line, respectivly. If there is no current point the path is faulty and behavior is not defined in ODF. LibreOffice is tolerant and makes a move to the start point of the arc or to the end point of the line. With this patch we do the same now in export to OOXML, so the user gets the same shape geometry as in LO. If a path starts with lnTo, MS Office will show nothing. I wouldn't care about user-created faulty paths, but LO produces such faulty path when an EllipseRibbon shape from binary MS Office is imported. Even when that will be fixed, we need the fix here, because the faulty path had been written to document markup and will be used when such document is opened. Change-Id: Ic52ec3bc78231b26efb592ddadee2e3042fdc065 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133349 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2022-04-22tdf#148685: Unset CharUnderlineColor and CharUnderlineHasColor propertiesXisco Fauli
Change-Id: Iebf482434cd393f55ae3e4690580b573624d78b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133219 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-04-22Fix typo in codeAndrea Gelmini
Change-Id: I289162ed8adf93139bbc69e8f5f4a1444dd52199 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133231 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-04-21tdf#109169 export Type encoded shading to OOXMLRegina Henschel
A shape might have the shading information not in commands in the enhanced-path, but generated in ctor of EnhancedCustomShape2d from the Type value of the shape. This shading information is a 32 bit value with first the number of the shadings and then the shadings. A shading is encoded with 1,2,3,4,5,6,7 for lighten 10 to 70 and 8,9,a,b,c,d,e,f for darken -80 to -10. To get this information from EnhanceCustomShape2d I have made its method GetLuminanceChange() public. Because OOXML only has darken, darkenLess, lighten and lightenLess our values are mapped: -10, -20, -30 to darkenLess -40, -50, -60, -70, -80 to darken 10, 20, 30 to lightenLess 40, 50, 60, 70 to lighten The bupreport mentions only 'Octagon Bevel' and 'Diamond Bevel'. But the patch fixes missing shading for shapes of Types 'ActionButton*' as well. Such shapes come in from MS binary import. Change-Id: I03f19496b915f3ced6346222e8806832b4ee2827 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133220 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2022-04-21Fix typoAndrea Gelmini
Change-Id: Ic31e50b22f64c55a1e0a7bbd5859672adfba5d0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133230 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-04-21Fix typoAndrea Gelmini
Change-Id: I1f7b1c0b28b9e5247debb85e07f19896d16f8bdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133228 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>