summaryrefslogtreecommitdiff
path: root/sw/source/filter/xml
AgeCommit message (Collapse)Author
2021-02-25tdf#115815 sw: fix lost annotation ranges of redlinesLászló Németh
Annotations of tracked deletions lost their ranges during ODF export, according to the limitation of ODF or its recent implementation. As a workaround, save and restore the start of the annotation ranges using temporary bookmarks (which can be part of text:deletion). Note: maybe it's possible to split redline ranges regarding to the start of the annotation ranges, mixing tracked deletions with normal text or tracked insertions, but this would be a not backward compatible solution, because the ODF import of this file inserts extra (not tracked) spaces around the annotation, losing the original text content. Change-Id: I786993a05ee1683076e213374a92969d1856cf8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111489 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2021-02-20loplugin:refcounting in swNoel
Change-Id: I56f2f5aa4d9105e93f28701b8352d1fb97829ead Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111215 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-15loplugin:referencecasting in swNoel
Change-Id: Ie923fc8baaa26938378407f6e5f3c50b2cea7cca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110815 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-11Remove unneeded breaksAndrea Gelmini
Extending this: https://gerrit.libreoffice.org/c/core/+/110512 Change-Id: I1066aac690fe297a557352266f3405ae29ed4593 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110522 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-02-05Make sanitiseMm100ToTwip simpler and more correctMike Kaganski
The result's absolute value is always smaller than n. Returning an uncorrected value taken from reversing multiplication and division order when intermediate value would overflow is better than arbitrary constant. Also further deduplicate Twips <-> 100th-mm conversion, and make sure they all are in a single header. Using conversion implementation that handles negatives correctly improves accuracy, as seen in unit tests; e.g. in testPictureEffectPreservation (the original doc had "dir" equal to "8100000", while we tested that it was "8076614" after roundtrip). Change-Id: Icd027af6238a9f45f916f53f8684506cc959e696 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110433 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-01-28simplify code, use more subView()Noel
Change-Id: I569c7f34acbdf8451cd5c9acf1abd334637072d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110051 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-16make the Color constructors explicitly specify transparencyNoel
to reduce the churn, we leave the existing constructor in place, and add a clang plugin to detect when the value passed to the existing constructor may contain transparency/alpha data. i.e. we leave expressions like Color(0xffffff) alone, but warn about any non-constant expression, and any expression like Color(0xff000000) Change-Id: Id2ce58e08882d9b7bd0b9f88eca97359dcdbcc8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109362 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-15tdf#138544 sw LoadUserSettings: default ConsiderTextWrapOnObjPosJustin Luth
This is the fifth and final patch in the series. When you start a new document, Writer compat setting "Consider wrapping style when positioning objects" is off. Now, when saving and reloading it with LoadUserSettings disabled, it is still the program default of "off", instead of "on". Change-Id: I3e3b4cb6c48dad35b258a898990d7fadfd3048db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108549 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
2021-01-14tdf#138544 sw LoadUserSettings: default EmptyDbFieldHidesParaJustin Luth
This is the fourth patch in the series. When you start a new document, Writer compat setting "Hide paragraphs of database fields with an empty value" is on. Now, when saving and reloading it with LoadUserSettings disabled, it is still the program default of "on", instead of "off". This one was a bit different because it didn't initialize in the standard way. // for some properties we don't want to use the application // default if they're missing. So we watch for them in the loop // below, and set them if not found So I'm changing it to match the standard way, and adding the now familiar clause to cover the case when the LoadUserSettings is disabled. Change-Id: I979b01340000056567a4baa9ace27f9f9d15e9b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108548 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
2021-01-13tdf#138544 sw LoadUserSettings: default SubtractFlysAnchoredAtFlysJustin Luth
This is the third patch in the series. When you start a new document, Writer compat setting "Tolerate white lines of PDF page backgrounds for compatibility with old documents" is off. Now, when saving and reloading it with LoadUserSettings disabled, it is still the program default of "off", instead of "on". Change-Id: I06869600f0d75c9d5457372d56e39750ff5b3dae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108547 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
2021-01-12transparency->alpha in tools::ColorNoel
this just changes the Get/Set methods, the constructor and internal representation of Color is not changed. Change-Id: Idb6e07cc08bbaa5bd55b6bd4b585e648aef507b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109074 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-12tdf#138544 sw LoadUserSettings: default DoNotJustifyLinesWithManualBreakJustin Luth
This is the second patch in the series. When you start a new document, Writer compat setting "Expand word space on lines with manual breaks in justified paragraphs" is on. Now, when saving and reloading it with LoadUserSettings disabled, it is still the program default of "on", instead of "off". So this one is slightly more dangerous because it will prevent setting old behaviours for MULTIPLE settings which are not listed in the UI. (Anything that trusts that ConsiderWrapOnObjPos to indicate a very old document.) The fact that we are explicitly not loading ConsiderWrapOnObjPos from the document should not imply that this document is an old one. At this far point away from StarOffice 8, it is probably safer to assume the document is new, not old. P.S. I'm pretty sure the reset of ExpandWordSpace was a complete error during a refactor. (At that point, it was the only item that defaulted to true.) The only scenario I can imagine is that at one point in time, ExpandWordSpace was not part of the SvtCompatibilityOptions, and so this would add it. But now it certainly is one of the options, and so this pointless pre-init is simply overwritten. Change-Id: Ibe160099839bcf40d5659f7d5246854c7c4fb5e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108546 Tested-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-01-10static_cast after dynamic_castNoel Grandin
Change-Id: I3792ddadad9582a7e6f4740829c081d9571ddaff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109049 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-09fix coverity parse errorsCaolán McNamara
Change-Id: I3a1179947704452e3ffec02be59d0f7bf0b75ab0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109017 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-01-08use more IsTransparentNoel Grandin
Change-Id: I3ef18a2601a51d56614b5da9b56e871bd33ec79e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108942 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-07tdf#138544 sw LoadUserSettings: default PrinterIndependentLayoutJustin Luth
I hope I understand this correctly. In Options - Load/Save - General, there is option "Load user-specific settings with the document" (default = true). Turning this off seems to simply mean, don't read the settings in Options - LibreOffice Writer - Compatibility from the document. The assumption I guess is that this would instead use system defaults. (Well, actually the user can "modify" these and "set as default".) Well, that wasn't quite true in a few cases, like this one. The general logic says "if the setting is not specified in the doc, set to some old behaviour". And that makes sense. Of course there is no setting in old documents - the concept didn't exist yet. But when we explicitly exclude these user-enforceable compat items, do we really want to force old behaviour instead of current behaviour? And if the user has actually modified these defaults, do we want to ignore the user's settings? I doubt it. So here is the first patch. When you start a new document, Writer compat setting "Use printer metrics for document formatting" is off. Now, when saving and reloading it with LoadUserSettings disabled, it is still the program default of "off", instead of "on". And if the user modifies it to always be on, it will still turn on - so no regression there. Change-Id: I13b236852da843ce72be16d79e2fdace1550523c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108545 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-01-07Resolves: tdf#139126 DBL_MAX is a valid value, just not for WriterEike Rathke
Restore the old side effect behaviour where "1.79769313486232E+308" was not converted back to DBL_MAX, Writer doesn't check cell value after import for this "special value", *cough*. Change-Id: I31cf598d5f91d1f727d5f1f0e936a3505ea1b9e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108875 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2020-12-29Missing last para style when inserting text from odt file tdf#138879Georgy Litvinov
Change-Id: Ief235e98f3de02350b6403a1ea8ecf6361571789 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108285 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-29loplugin:stringviewparam: operator +Stephan Bergmann
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-26New loplugin:stringliteralvarStephan Bergmann
See the comment at the top of compilerplugins/clang/stringliteralvar.cxx for details. (Turned some affected variables in included files into inline variables, to avoid GCC warnings about unused variables.) Change-Id: Ie77219e6adfdaaceaa8b4e590b08971f2f04c83a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-21use std::u16string_view in SvXMLTokenEnumeratorNoel
Change-Id: I1194441063047637adc20c8e37bb717fdb787714 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108073 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-19tdf#82802 sw conditional style conditions not saved for TextBodyJustin Luth
Someone thought it would be a good idea for the built-in paragraph style Text Body to be special and support conditional formatting. It has been broken for import/export since 2015. It was mostly fixed in duplicate issue tdf#103091, but the side case of Text Body was missed. Partially reverting commit a5b4cb3f836c991d0647f55e1ef4920ce6115eac. xNewStyle didn't need to be a member variable since it is assigned to GetStyle anyway. Change-Id: I102d86c0b1f28e42b2c1350abc247b6b1f8acd4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107352 Tested-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-12-15use views to parse rather than allocating OUStringNoel
Change-Id: If0a848c64ce8077d1681661873629c83307cf8b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107736 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-14use more direct parsing on FastAttributeListNoel
instead of first allocating an OUString Change-Id: I796b1b2d47eb3cb9bebb00ae1bbd465010ebf494 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107691 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-08remove now unused XML_TOK_ constantsNoel
Change-Id: I73da015abc824194b88c53b87170c987d24080a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107411 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-08remove unused SvXMLTokenMapsNoel
Change-Id: I84a0a47e631e6bf7cfd1c745be6ed5839885861f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107370 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-08fastparser in stylesNoel Grandin
Change-Id: I39d285f1dd7dd18c396db96863f77f511741951c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107364 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-07loplugin:unusedmethodsNoel
Change-Id: Ib51fd610c5188fe95872d509f004ae88f38c5417 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107351 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-07convert SvXMLImport to fastparser, drop slowparser pathsNoel Grandin
Change-Id: I0f880a7680373043fecf083cdf4de8b0bb7041a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103775 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-04call createFastChildContextFallback in more placesNoel Grandin
to make my fastparser work easier to manage Change-Id: If98592f016cd35ca13b48d9df363e32fb1095b55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107233 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-03fastparser in SwXMLBodyContentContextNoel
Change-Id: Iec7fd359e3f007d53e352ae6c0253e2e8e5661ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107127 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-03fastparser in SwXMLTableContextNoel
Change-Id: I0ad5155e5b12cbe9c11cbd3861199bf81fec213d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107126 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-01OSL_FAIL.*exception -> TOOLS_WARN_EXCEPTIONNoel
Change-Id: I6800e23ead2767d245d5da71d2d40e0f8a6d7e1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106859 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-28fastparser in SwXMLTableContextNoel
Change-Id: I92e70bce3418c415a1855e0dc11c09fb32040e6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106774 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-24tdf#42949 Fix new IWYU warnings in directory swGabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I4bb84c3f401aba8a3dede9cec3a7f2187a2ba02a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106473 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-24loplugin:stringviewparam extend to comparison operatorsNoel
which means that some call sites have to change to use unicode string literals i.e. u"foo" instead of "foo" Change-Id: Ie51c3adf56d343dd1d1710777f9d2a43ee66221c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106125 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-23fastparser in SwXMLTableContextNoel Grandin
Change-Id: I52ea773993a19384c5a7ad3eb95b518446ea5e96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106360 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-22fastparser in SwXMLDocContext_ImplNoel Grandin
Change-Id: I21fa16d473660e06b73a75964f3317b13e2e05e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106359 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-19fastparser in TokenContextNoel
Change-Id: I12c2af505d4bf19d94fb127cda2403f0b6618b07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106159 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-19tdf#123936 Formatting files in module sw with clang-formatPhilipp Hofer
Change-Id: I6243bc95129bf81a124d006ce0fc1aa1b5f618bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105718 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Jenkins
2020-11-17sw_fieldmarkhide: replace IsHideRedlines() with HasMergedParas()Michael Stahl
... where obvious. Change-Id: Id941d59feea5a3539da9006725ef376b14bc7d1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105982 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-12New loplugin:stringviewparamStephan Bergmann
...to "Find functions that take rtl::O[U]String parameters that can be generalized to take std::[u16]string_view instead." (Which in turn can avoid costly O[U]String constructions, see e.g. loplugin:stringview and subView.) Some of those functions' call sites, passing plain char string literals, needed to be adapted when converting them. Change-Id: I644ab546d7a0ce9e470ab9b3196e3e60d1e812bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105622 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-05StartElement->startFastElement in swNoel
Change-Id: I6a916011fa7c89c1187fa593b7bfe0081b2a6690 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105342 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-05loplugin:unusedenumconstantsNoel
Change-Id: I9a2eb83647d6620b3c5b5ed5642227be47a657f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105303 Tested-by: Jenkins Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-02move SwCondCollCondChg on top of SfxHintBjoern Michaelsen
... and get rid of ModifyNotifications along the way. Change-Id: I10fc9d24743d50cef771ff63dae004d31dce1846 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105195 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-11-02create common macro and method for logging unknown attributesNoel
instead of repeating the code everywhere Change-Id: Idb94054b392ed256e64259cdb17d1522bf3c52b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105184 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-02drop the SvXMLExport::EndElement method..Noel
in favour of just using the endFastElement() method Change-Id: Id95abb0b9e78bc44278c5e9e3cc8dee15185e2e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105175 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-02make SvXMLImport capable of mixing fast- and slow- contexts adhocNoel
so I can convert even *ImportContext subclasses in the middle of a context stack, and thus break the cyclic dependency nature of the writer import. and adjust the xmlimport loplugin for the new rules. As a consequence of the loplugin:xmlimport's checking, we remove a bunch of now unnecessary overrides of startFastElement. Change-Id: I97464522ede8ec5e345e928cdafa4b18364b1b80 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104730 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-31rename to NotifyContainsEmbeddedFontCaolán McNamara
to indicate better what its users do with this notification. This reflects better the reality that while the embedded font has been read at this point, vcl hasn't been informed of its existence yet. Change-Id: I87f4d0a0361192dac972f6146d3721a69e11ac27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105086 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-10-30convert some tools::Long->sal_Int32Noel
in places where it is obvious we only need a sal_Int32, because we are dealing with rows and columns, and not even calc needs more than 32 bits for that. Change-Id: I114417e639c224d45bfd9fc6838122ab195eefa3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104584 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>