summaryrefslogtreecommitdiff
path: root/xmloff
AgeCommit message (Collapse)Author
2023-10-07loplugin:ostr: automatic rewriteStephan Bergmann
Change-Id: I2d09b2b83e1b50493ec88d0b2c323a83c0c86395 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157647 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
2023-10-04tdf#145834 Consistency for "Fontwork"Bogdan B
Change-Id: I5f660fac8576d96bf2d2363106be56a4d4fb4f64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157545 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2023-09-28tdf#156146 xmloff: ODF import: add backward compatibility hackMichael Stahl
As a follow-up to ade0a153f453500f15343380ac937252992733e0 "tdf#114287 xmloff: ODF import: fix text:list override of list style", add some ugly compatibility hack to preserve the visual layout of documents produced by LO versions before 7.6. Override the left/first-line margin of the applied numbering rules with what is in the paragraph or paragraph style, and try to do this only in the specific situation where the list style is the same. Change-Id: I1f4520c9bf9d2257d2e3864e4ddb2d28451bbd2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157284 Tested-by: Jenkins Tested-by: Gabor Kelemen <kelemeng@ubuntu.com> Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-09-12Added parent / child relationship to comments.Gökay Şatır
Adding parent name of a comment into odf file when there is a parent. Also includes: Added test case to comment property test. Change-Id: I033f6574b4875fcb76b16c8b5b9d9f7d55b52cbe Also includes: Add parent / child relations to replied comments. Change-Id: Ia7d95c4e6020b501798a89cbdcae64dc5691437c Change-Id: I08b5ab6eb11adcafcbf3559896d79d41b449b26a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156824 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-09-10PropertySetMergerImpl does not need to implement XAggreggationNoel Grandin
Checked on jenkins using 'make check' and +void SAL_CALL setDelegator(css::uno::Reference<css::uno::XInterface> const &) final { assert(false); } Change-Id: I40f4906723ab040b95a8db5c34e81b09a5ede38c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156772 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-10OMergedPropertySetInfo does not need to implement XAggreggationNoel Grandin
Checked on jenkins using 'make check' and +void SAL_CALL setDelegator(css::uno::Reference<css::uno::XInterface> const &) final { assert(false); } Change-Id: I8623da7e9962df1dbb09327933fccbddd82a4562 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156773 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-08WARN->INFO in XMLIndexSimpleEntryContextNoel Grandin
This is not generally a problem Change-Id: If7957da45e5ad00f881ef3a7c5c676b09494ec77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156713 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-07Fix typoAndrea Gelmini
Change-Id: I4f2f281c12fefe6f69ceacb715faf2b8644abeaa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156635 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-09-07Fix typoAndrea Gelmini
Change-Id: I330ff642b93e07c402f8dbb2fa0cefb1af1a7671 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156634 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-09-07Fix typoAndrea Gelmini
Change-Id: I8902bfb3c779471d4aff80ca7e94a9848b9ece51 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156636 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-09-06add referer to ole objectsCaolán McNamara
so we can identify what document is requesting their contents extends: commit 5668e73beb30b95abc6520b7432c54972ca3ab2c Date: Wed Nov 20 14:43:45 2013 +0100 avmedia: Implement "block untrusted referer links" feature See f0a9ca24fd4bf79cac908bf0d6fdb8905dc504db "rhbz#887420 Implement 'block untrusted referer links' feature" for details. This adds some further /*TODO?*/ comments, and one known problem (marked /*TODO!*/) is that movies/sounds are not blocked during a slideshow presentation. to these objects too, namely OLE2Shape and derivatives AppletShape, FrameShape and PluginShape so in paranoid mode we won't load the contents of such objects from documents considered "untrusted". Change-Id: I6d988035d0cd09fd3fade5f6885fe336c95579ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156612 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-09-06improve debug logging in SdXMLShapeContext::AddShapeNoel Grandin
so we get source info for the exception Change-Id: Icd54a4d1388c7a48ab3e0c8bd17c21f6004a470b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156589 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-05drop a stray printfCaolán McNamara
Change-Id: Ie9b48ab2db03c7c45aa4ffc24ca4532522bb60a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156571 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-09-05SAL_WARN->SAL_INFO in XMLShapeImportHelperNoel Grandin
these attributes are typically processed elsewhere, so this warning is not useful Change-Id: I2ebfe87e81e2959fbf25b17ed93a3bc80e1c6ab5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156560 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-05xmloff: rename m_aObject in XMLThemeContext and clarifyTomaž Vajngerl
Clarify what m_aObject is in the theme import (XMLThemeContext) and rename to a better name. It is refering to an object that has the "Theme" property, which is usually found in on XPage (master page) or XModel, but technically could be any object that has the property (for getting and setting the XTheme type). Change-Id: If15a8c42a0c516cd0566f4ee9e81f7315ef1651e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156511 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-09-04tdf#138792: PDF export: add batch of dublin core attributesSarper Akdemir
Adds support for exporting, editing in the UI and storage in ODF for the dublin core attributes listed below. Contributor (http://purl.org/dc/elements/1.1/contributor) Coverage (http://purl.org/dc/elements/1.1/coverage) Identifier (http://purl.org/dc/elements/1.1/identifier) Publisher (http://purl.org/dc/elements/1.1/publisher) Relation (http://purl.org/dc/elements/1.1/relation) Rights (http://purl.org/dc/elements/1.1/rights) Source (http://purl.org/dc/elements/1.1/source) Type (http://purl.org/dc/elements/1.1/type) Introduces XDocumentProperties2 to extend XDocumentProperties interface. Change-Id: Ie2e0b1fbbbd00b66aef477ba1bf4e4f61c03a3b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156330 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir.extern@allotropia.de>
2023-09-02replace set(nullptr) with clear()Noel Grandin
It's a little easier to read, but mostly it makes an upcoming loplugin easier to implement Change-Id: I4ae7db8eda77795dab3255d1afd8ba4f20a8de76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156451 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-01sc: add ODF import/export of the Theme + testsTomaž Vajngerl
One missing thing is the support in calc to save the Theme into the ODS document and read that back. The theme element is added as a child element to the office:styles - the same as it already is added in Writer. Also adds "Theme" property as a top level document property so it is possible to get and set the theme in xmloff. Also tests have been added to cover this usecases. Change-Id: Ic214ff5e945b77d50e6c881def9d49509560a0e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156363 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-09-01move theme element export to xmloff to remove code duplicationTomaž Vajngerl
Both Impress/Draw and Writer export the model::Theme in a similar way, but the code is duplicated. Remove duplication and move the code to a common place (on the SwXMLExport class) so it can be reused at both places. Change-Id: Id93acfafb0dd4ab0168b3228079f6ce6f64e6b55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156362 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-08-31tdf#157018 Enable import of color theme for DrawRegina Henschel
Use the color theme import in Draw too, otherwise we will not be able to detect theme colors. Change-Id: I8f01ba69848a6265193407a952144b31e3a7fdb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156313 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-08-30tdf#156975 Save a Theme in Draw too not only in ImpressRegina Henschel
Draw and Impress have many things in common and should therefore be treated equally where possible. Only if the theme colors are present in the document, colors can be recognized as theme colors during import. Change-Id: Ia1fae2aff989ae305c210efa3f925a80898880e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156267 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-08-25tdf#152724 Extend ODF for blank width "_x"Laurent Balland
Number format code "_x" is currently saved as a text string containing a number of spaces corresponding to the width of character "x". It may be confusing for user if its format code is modified. This change introduces a new XML tag XML_BLANK_WIDTH_CHAR to replace the previous text string if ODF version is extended <number:text> and <number:embedded-text>: the attribute is composed of a string containing the used character and its position in the text string (if position is 0, it is omitted). Several blank code characters are separated by '_'. Replacement blanks in the text string are preserved to enable compatibility. Example: format code "foo"_M_I_N"!"???,???.000_.000"!"_) is saved as: <number:number-style style:name="N173"> <number:text loext:blank-width-char="M3_I6_N7">foo !</number:text> <number:number number:decimal-places="6" number:min-decimal-places="6" number:min-integer-digits="6" loext:max-blank-integer-digits="6" number:grouping="true"> <number:embedded-text number:position="-4" loext:blank-width-char="."> </number:embedded-text> </number:number> <number:text loext:blank-width-char=")1">! </number:text> </number:number-style> Add QA test Change-Id: I785e1a14ecccc900e9fd5af88dd7b743fefcc48c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146582 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2023-08-25Revert "use more Reference::query instead of UNO_QUERY_THROW"Noel Grandin
This reverts commit 7fc6063914432d58d86cfcbd728d967e7c86ebfd. sberg noticed that there is a difference now: there's a subtle difference now, in that if y was null originally, it would have thrown a (caught) exception, whereas now it will crash in the y.query<X>() call. Change-Id: Idbb5a08d635d15b5ca63f4822eddf05fb0a5afa0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156002 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-25xmloff: support stroke/line complex color import/export + testTomaž Vajngerl
Change-Id: I4ed901fd5b23e58aafa781e2b07f460f034fbba3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155685 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-08-21move BGradient to awt::Gradient2 UNO conversion into docmodelTomaž Vajngerl
This is needed because the module dependencies are an issues if the conversion is done in basegfx. The bigger issue will come when the ComplexColor conversion will be done as basegfx can't depend on docmodel because of circular dependencies. The BGradient is also more suitable for docmodel anyway as the previously it was part of the model and is not a basic (gfx) type - however this doesn't move the whole BGradient into docmodel yet. Change-Id: Id91ce52232f89f00e09b451c13da36e2854ae14b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155674 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-08-21Tests with color stops to assert Color and not BColor valuesTomaž Vajngerl
For testing color stops of a gradient we don't need to assert super precise values (doubls to the n-th decimal point) as long the end results in the same (8-bit) Color value. So change the tests to convert the BColor that is in gradient color stops to Color and assert the Color value. Change-Id: Ibd7661e2f72955a0778e822df1fae568973be357 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155360 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-08-18use more Reference::query instead of UNO_QUERY_THROWNoel Grandin
since querying with exceptions is consideably more expensive Change-Id: I968a9a40766b2abb0d3058549b0ed44011fd5716 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155791 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-15ComplexColor various clean-up and (trivial) refactoringsTomaž Vajngerl
Don't allow access to member variables of ComplexColor and makes them private. Needs a lot of changes. Change "scheme" to "theme" to be more consistent. In LO we usually call the "theme color" what is usually refered to as "scheme color" in OOXML, where it is sometimes refered to as "scheme" and other times as theme color. Remove ThemeColor class which was replaced with CmplexColor some time ago. Remove un-needed includes and un-needed components. Use isValidThemeColor in many places where we check that the ComplexColor is of "Theme" type and that ThemeColorType is set to a valid value. Change-Id: I325595fa65b8e56a4707e9d22acc6330aac28961 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155359 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-08-14tdf#156321 ODT import: fix lost char format on outer span elementsMiklos Vajna
Regression from commit 209dce614c43f63f63f5b42a746665c0ec1cbfe3 (sw: fix ODT import of paragraph marker formatting, 2022-12-20), the bugdoc has a first paragraph with nested spans (the outer sets the boldness) and the text does not appear as bold in Writer anymore. What appears to be the problem is that our model is just a list of spans for a paragraph, so nesting is converted to a list of spans, but now the outer span char format is lost. Fix the problem by making the condition of the 'no upgrade from char format to para format' more strict: do this in case we have empty spans. That fixes this new use-case and leaves the original one fixed. Note that in the long run it may make sense to always disable the upgrade from char format to para format, but that has to be done in a way that does not break the import of nested spans. Change-Id: Ie6fafb3e9649e50790c7ecae8e136e6600f3341e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155648 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-08-02sc: theme color support for sparklines + ODF & OOXML import/exportTomaž Vajngerl
This changes Sparkline colors to use complex colors instead and adds Sparkline theme color import and export support for ODF and OOXML. Change-Id: I58edd525d50f95199bd4fe7825afb51aaa7fc091 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155113 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-08-01sc: Add import/export ODF support for border complex colorsTomaž Vajngerl
ODF Import and export support for border {left,right,top,bottom} complex colors. In addition round-trip test was extended with the border use case. Change-Id: I1d14690272c06e8ffcfcd483eb7f688ca5bb1e5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155014 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-08-01xmloff: fix import of CharComplexColor - add StylePropertiesContextTomaž Vajngerl
Import of CharComplexColor in Calc didn't work because the class XMLComplexColorContext wasn't used. This introduces a new class StylePropertiesContext, because the plain SvXMLPropertySetContext is not enough as we can't define to use XMLComplexColorContext when XML_CHAR_COMPLEX_COLOR is used on that class. Also adds a import/export test for CharComplexColor. Change-Id: I765ac71a801a5e9bcb105aaea73637df5e601b85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155008 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-07-31use more tools::Rectangle::Adjust*Noel Grandin
Change-Id: I6fb9e838f493149c52936932ef3b977db034ec1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155075 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-18sc: ODF import/export of background cell complex colorTomaž Vajngerl
Change-Id: Idf526aea21ccfeda9b03d1fb69588f120b6e161d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154571 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-07-18xmloff: move XMLComplexColor* import/export classes to public includeTomaž Vajngerl
Change-Id: I52aad31f63858eba905481812cbf971493252642 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154570 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-07-11tdf#150408: Implement "Legal" numbering (all levels using Arabic numbers)Mike Kaganski
Enabling this feature on a list level makes all numbered sublevels, that constitute the number of this level, to use Arabic numerals. This doesn't change the labels of other levels: e.g., if level 1 uses A,B,C; level 2 uses i,ii,iii; level 3 uses a,b,c, and is "Legal"; and level 4 uses 1,2,3; then a list may look like A. Something A.i. Some subitem A.ii. Another subitem 1.2.1. This is a "Legal" sub-subitem A.ii.a.1. And its child This improves interoperability with Word. This change introduces document model, ODF and OOXML import and export. In ODF, a new boolean attribute of 'text:outline-level-style' element, 'loext:is-legal', is introduced; its default value is "false". Change-Id: I5ae9f970864854c7e84c4b2f7ce46634b3ef104e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154288 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-07-06loplugin:unusedfields all-can-be-privateNoel Grandin
these fields can be private Change-Id: I74423a9ae2ef0263a28c8a716ab1c55861e453d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154092 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-06xmloff: ODF export: stop producing decorative on draw:frame etc.Michael Stahl
The attribute was moved to the style graphic-properties in commit 2721520ca37654056c3d509657c50ee42e3dcae4, which is in 7.5.2 so users likely have upgraded from 7.5.0/7.5.1 and this can be removed now. Change-Id: I69ef3e2e501af21f04df440bf176e46f651d671b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154074 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-07-05tdf#138504 svx,etc.: decorative flag on SdrObject shapesMichael Stahl
* SdrObject new member m_IsDecorative * new Undo SdrUndoObjDecorative * surprising amount of changes in sw including additional SwUndoFlyDecorative * svx API SvxShape property "Decorative" * UI checkbox "Decorative" * ODF import/export as loext:decorative on style:graphic-properties * PDF/UA export: ViewObjectContcat tag shapes with this flag as Artifact Change-Id: I37f7a0597eab92c6c6aff94fad6c16c59b231c80 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154063 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-07-04loplugin:unusedvarsglobalNoel Grandin
Change-Id: Ia86c8bd0bdc85c375eb3837ba97f9e171d9dac6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153974 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-28xmloff: ODF import: adapt generator parsing to 2-digit major versionsMichael Stahl
DocumentInfo currently assumes that a LO version encoded in "BuildId" property has only 1 digit major version, which is now wrong and would start to give incorrect results when major version "30" will be detected as LO_3x. Add the dots as separators into the BuildId because it's not going to work without. Change-Id: I8918afe3642cbefa8488c57658f1505c9a20eddd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153649 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-06-27related tdf#153993 Embedded text in scientific numbersLaurent Balland
Embedded text was limited to number:number. But scientific notation may require embedded text like 0.000" "000E+00 This change extend ODF format to support embedded text in number:scientific-number also Change-Id: I4e3220b06efbd9228d722bf518e137d7707ccf4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150804 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2023-06-27loplugin:stringstatic look for more stringsNoel Grandin
that can be initialised at compile-time instead of runtime Change-Id: I08d516fdc13a3a79f93c079f89ac44cbc7a1ed71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153620 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-26new loplugin:constexprliteralNoel Grandin
OUStringLiteral should be declared constexpr, to enforce that it is initialised at compile-time and not runtime. This seems to make a different at least on Visual Studio Change-Id: I1698f5fa22ddb480347c2f4d444530c2e0e88d92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153499 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-24tdf#133560: re-anchor objects, to use paragraph's dispose for bEndOfDocumentMike Kaganski
1. During import, XParagraphAppend::finishParagraph(Insert) are called, which are implemented using SwXText::Impl::finishOrAppendParagraph, and the latter calls m_pDoc->getIDocumentContentOperations().AppendTextNode( *aPam.GetPoint() ); // remove attributes from the previous paragraph m_pDoc->ResetAttrs(aPam); so that there is always another (empty) paragraph after the finalized one; 2. During import, lcl_AddRange is called to create anchored text content; the start and end of it may reference the very end of the document (using xTextAppend->getEnd()) - i.e., that last (maybe empty, maybe extra) paragraph. 3. In many places, and in particular, in DomainMapper_Impl destructor, DomainMapper_Impl::RemoveLastParagraph is called; and the latter uses one of the two techniques to remove that last paragraph: 3.1. It either obtains the paragraph's lang::XComponent interface, and calls its dispose (SwXParagraph::dispose), which eventually calls DocumentContentOperationsManager::DelFullPara; 3.2. Or it uses cursor to select 1 ch back, and replace the resulting selection with nothing. 3.1 has an advantage of keeping the formatting of the remaining (second- to-last) paragraph, but DocumentContentOperationsManager::DelFullPara, among other things, removes all anchored objects, thus this mode is not used for the end-of-document case (e.g., see commit message of commit e521930ea1c855c236efb67793e540d07c201d35 "fdo#58327: writerfilter: RemoveLastParagraph is tricky:", 2013-01-10); 3.2 keeps the anchored objects, but needs workarounds to keep bookmarks, and destroys the remaining paragraph character formatting. Let me try to use #3.1 also in the end-of-document case, by introducing code to move anchored objects to previous paragraph before calling XComponent::dispose. Indeed, it may happen that more processing could be needed, if more properties would happen to be bound to the very last extra paragraph. This change adds a call to DocumentRedlineManager::CompressRedlines in DocumentContentOperationsManager::DelFullPara, because previously, this was called during #3.2 inside setString. testTdf150086 failed without this change. testTdf131386 and testTdf152872 were changed to the now-correct import of last paragraph properties (previously both of them relied on the hidden property not present there, while it is there in Word). In DomainMapper_Impl::RemoveLastParagraph, the check of the content of selection made by moving backward one character was generalized to be run before both cases, because RTF sometimes has only one paragraph after a table (see e.g. testTdf148515), which now could be removed in the absence of the check. testTdf104390 was changed to not check the number of runs, because now the paragraph keeps the trailing "paragraph mark formatting" empty run, which previously was dropped using setString path. Also, the fix for tdf#148273 is re-implemented here, by dropping RES_PARATR_LIST_AUTOFMT in lcl_RstAttr. Likely keeping it was an unintended side effect of placing RES_PARATR_LIST_AUTOFMT inside RES_PARATR_LIST_BEGIN/END. After the change, explicit drop of it will be not needed at arbitrary boundary, which is section break; this property should only be applied where it's defined. This change can't be done separately, because of interrelated unit test failures left and right. In XMLParaContext::endFastElement, setting ListAutoFormat property must be set only after setting style now, because otherwise it will be reset in lcl_RstAttr when the style is set. Some test documents were modified, to drop font from the last paragraph properties, because their respective tests started to crash (see commit 172270a8f04388a8f8062f672f9c3f3144a01a1f "abort writer layout tests if a font isn't found", 2022-05-01). Before this change, these paragraphs had lost their formatting, so those fonts weren't used in layout. Change-Id: I7e41c20e68e24c78fae1d2005c3fd75fb146ba2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153481 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-06-20XMLTextParagraphExport::DocumentListNodes must be a complete typeStephan Bergmann
...at least when building with --with-latest-c++ against recent LLVM 17 trunk libc++, > In file included from xmloff/source/text/txtparae.cxx:22: > In file included from include/o3tl/any.hxx:21: > In file included from include/com/sun/star/uno/Any.hxx:28: > In file included from ~/llvm/inst/bin/../include/c++/v1/algorithm:1779: > In file included from ~/llvm/inst/bin/../include/c++/v1/__algorithm/inplace_merge.h:27: > In file included from ~/llvm/inst/bin/../include/c++/v1/__memory/uninitialized_buffer.h:14: > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:63:19: error: invalid application of 'sizeof' to an incomplete type 'XMLTextParagraphExport::DocumentListNodes' > 63 | static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type"); > | ^~~~~~~~~~~ > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:297:7: note: in instantiation of member function 'std::default_delete<XMLTextParagraphExport::DocumentListNodes>::operator()' requested here > 297 | __ptr_.second()(__tmp); > | ^ > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:263:75: note: in instantiation of member function 'std::unique_ptr<XMLTextParagraphExport::DocumentListNodes>::reset' requested here > 263 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); } > | ^ > xmloff/source/text/txtparae.cxx:1333:25: note: in instantiation of member function 'std::unique_ptr<XMLTextParagraphExport::DocumentListNodes>::~unique_ptr' requested here > 1333 | XMLTextParagraphExport::XMLTextParagraphExport( > | ^ > include/xmloff/txtparae.hxx:115:12: note: forward declaration of 'XMLTextParagraphExport::DocumentListNodes' > 115 | struct DocumentListNodes; > | ^ Change-Id: I319c1f682258950caf3571f51e5443d6753bcccd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153312 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-06-19embeddedfontshelper: use u16string_view instead of char pointerKhaled Hosny
Change-Id: I7a6088c570ebd0680cc1b2603b946192a19bef26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153268 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-17oox, writerfilter, xmloff: use frozen data structures for static dataTomaž Vajngerl
Change-Id: I4a53fa57f52900104d249c84cde36c9d3b9e1300 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153175 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-06-17SAL_WARN->SAL_INFO in SdXMLStylesContext::CreateStyleChildContextNoel Grandin
This is not an error - this method handles elements if it knows about them, and otherwise leaves the elements for other code to handle Change-Id: I531a2d9aff84ef4a2762923737a6b827e88cd920 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153191 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-15ODF export: simplify restart handling to skip list id where possibleMike Kaganski
This continues to minimize cases where random ids are written, helping to make the output more deterministic; it builds upon commits 8f48f91009caa86d896f247059874242ed18bf39 (ODT export: omit unreferenced <text:list xml:id="...">, 2022-03-10), and 82bbf63582bdf28e7918e58ebf6657a9144bc9f3 (tdf#155823: Improve the check if the list id is not required, 2023-06-14). The previous code used to write 'text:continue-list' when the list is restarted. It is unnecessary when there is no other condition requiring such a reference (like style change, or interleaving lists); so relax the conditions allowing to put simple 'text:continue-numbering="true"'. This also allows to simplify a bit the code around 'ShouldSkipListId'. Change-Id: Idf8be455953d08fd578266bda22f3a55d7b9ee23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153104 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>