summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/ww8par5.cxx
AgeCommit message (Collapse)AuthorFilesLines
2024-08-18cid#1556978 COPY_INSTEAD_OF_MOVECaolán McNamara1-1/+1
and cid#1556976 COPY_INSTEAD_OF_MOVE cid#1556965 COPY_INSTEAD_OF_MOVE cid#1556956 COPY_INSTEAD_OF_MOVE cid#1556953 COPY_INSTEAD_OF_MOVE cid#1556946 COPY_INSTEAD_OF_MOVE cid#1556934 COPY_INSTEAD_OF_MOVE cid#1556897 COPY_INSTEAD_OF_MOVE Change-Id: I6cf90b385042e7ca7d07138c28c0e95f97de8f61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171983 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
2024-08-16cid#1557618 COPY_INSTEAD_OF_MOVECaolán McNamara1-1/+1
and cid#1557535 COPY_INSTEAD_OF_MOVE cid#1557520 COPY_INSTEAD_OF_MOVE cid#1557513 COPY_INSTEAD_OF_MOVE cid#1557503 COPY_INSTEAD_OF_MOVE cid#1557487 COPY_INSTEAD_OF_MOVE cid#1557483 COPY_INSTEAD_OF_MOVE cid#1557479 COPY_INSTEAD_OF_MOVE cid#1557474 COPY_INSTEAD_OF_MOVE cid#1557461 COPY_INSTEAD_OF_MOVE cid#1557446 COPY_INSTEAD_OF_MOVE cid#1557445 COPY_INSTEAD_OF_MOVE cid#1557441 COPY_INSTEAD_OF_MOVE cid#1557435 COPY_INSTEAD_OF_MOVE cid#1557433 COPY_INSTEAD_OF_MOVE cid#1557429 COPY_INSTEAD_OF_MOVE cid#1557375 COPY_INSTEAD_OF_MOVE cid#1557372 COPY_INSTEAD_OF_MOVE cid#1557356 COPY_INSTEAD_OF_MOVE cid#1557350 COPY_INSTEAD_OF_MOVE cid#1557344 COPY_INSTEAD_OF_MOVE cid#1557339 COPY_INSTEAD_OF_MOVE cid#1557332 COPY_INSTEAD_OF_MOVE cid#1557330 COPY_INSTEAD_OF_MOVE cid#1557328 COPY_INSTEAD_OF_MOVE cid#1557323 COPY_INSTEAD_OF_MOVE cid#1557315 COPY_INSTEAD_OF_MOVE cid#1557313 COPY_INSTEAD_OF_MOVE cid#1557304 COPY_INSTEAD_OF_MOVE cid#1557297 COPY_INSTEAD_OF_MOVE cid#1557291 COPY_INSTEAD_OF_MOVE cid#1557290 COPY_INSTEAD_OF_MOVE cid#1557271 COPY_INSTEAD_OF_MOVE cid#1557266 COPY_INSTEAD_OF_MOVE cid#1557262 COPY_INSTEAD_OF_MOVE cid#1557259 COPY_INSTEAD_OF_MOVE cid#1557246 COPY_INSTEAD_OF_MOVE cid#1557242 COPY_INSTEAD_OF_MOVE cid#1557241 COPY_INSTEAD_OF_MOVE cid#1557236 COPY_INSTEAD_OF_MOVE cid#1557228 COPY_INSTEAD_OF_MOVE cid#1557225 COPY_INSTEAD_OF_MOVE cid#1557221 COPY_INSTEAD_OF_MOVE cid#1557217 COPY_INSTEAD_OF_MOVE cid#1557213 COPY_INSTEAD_OF_MOVE cid#1557211 COPY_INSTEAD_OF_MOVE cid#1557209 COPY_INSTEAD_OF_MOVE cid#1557205 COPY_INSTEAD_OF_MOVE cid#1557204 COPY_INSTEAD_OF_MOVE cid#1557193 COPY_INSTEAD_OF_MOVE cid#1556082 COPY_INSTEAD_OF_MOVE Change-Id: I07f195a79a69d4bac0d14317854efc88d6fe94d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171927 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-11cid#1558088 COPY_INSTEAD_OF_MOVECaolán McNamara1-1/+1
and cid#1558080 COPY_INSTEAD_OF_MOVE cid#1558077 COPY_INSTEAD_OF_MOVE cid#1558055 COPY_INSTEAD_OF_MOVE cid#1558043 COPY_INSTEAD_OF_MOVE cid#1558039 COPY_INSTEAD_OF_MOVE cid#1558015 COPY_INSTEAD_OF_MOVE cid#1558014 COPY_INSTEAD_OF_MOVE cid#1558009 COPY_INSTEAD_OF_MOVE cid#1558002 COPY_INSTEAD_OF_MOVE cid#1557998 COPY_INSTEAD_OF_MOVE cid#1557996 COPY_INSTEAD_OF_MOVE cid#1557990 COPY_INSTEAD_OF_MOVE cid#1557986 COPY_INSTEAD_OF_MOVE cid#1557980 COPY_INSTEAD_OF_MOVE cid#1557971 COPY_INSTEAD_OF_MOVE cid#1557968 COPY_INSTEAD_OF_MOVE cid#1557967 COPY_INSTEAD_OF_MOVE cid#1557961 COPY_INSTEAD_OF_MOVE cid#1557959 COPY_INSTEAD_OF_MOVE cid#1557958 COPY_INSTEAD_OF_MOVE cid#1557956 COPY_INSTEAD_OF_MOVE cid#1557953 COPY_INSTEAD_OF_MOVE cid#1557949 COPY_INSTEAD_OF_MOVE cid#1557947 COPY_INSTEAD_OF_MOVE cid#1557940 COPY_INSTEAD_OF_MOVE cid#1557931 COPY_INSTEAD_OF_MOVE cid#1557930 COPY_INSTEAD_OF_MOVE cid#1557915 COPY_INSTEAD_OF_MOVE cid#1557913 COPY_INSTEAD_OF_MOVE cid#1557910 COPY_INSTEAD_OF_MOVE cid#1557886 COPY_INSTEAD_OF_MOVE cid#1557884 COPY_INSTEAD_OF_MOVE cid#1557880 COPY_INSTEAD_OF_MOVE cid#1557875 COPY_INSTEAD_OF_MOVE cid#1557871 COPY_INSTEAD_OF_MOVE cid#1557862 COPY_INSTEAD_OF_MOVE cid#1557847 COPY_INSTEAD_OF_MOVE cid#1557845 COPY_INSTEAD_OF_MOVE cid#1557844 COPY_INSTEAD_OF_MOVE cid#1557843 COPY_INSTEAD_OF_MOVE cid#1557838 COPY_INSTEAD_OF_MOVE cid#1557835 COPY_INSTEAD_OF_MOVE cid#1557834 COPY_INSTEAD_OF_MOVE cid#1557828 COPY_INSTEAD_OF_MOVE cid#1557823 COPY_INSTEAD_OF_MOVE cid#1557817 COPY_INSTEAD_OF_MOVE cid#1557813 COPY_INSTEAD_OF_MOVE cid#1557812 COPY_INSTEAD_OF_MOVE Change-Id: I55d4a920daa2d148683419169eb828325fd3c757 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171732 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-04simplify IMark hierarchy (5)Noel Grandin1-4/+4
merge into IFieldmark into Fieldmark Change-Id: Ide5c01fe49bae0be45746f6b581d72342da9c3a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171463 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-07-22add a static_assert for sizes of m_nFieldTagAlways and m_nFieldTagBadCaolán McNamara1-2/+7
Change-Id: I4d847c74d8d069c76f874a19e6fbc99425757a44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170837 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-21cid#1606961 silence Overflowed array index readCaolán McNamara1-1/+1
and cid#1606751 Overflowed array index read Change-Id: If9681a61b14b68e6d1f12b0d4907ab23180972f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170819 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-19cid#1609598 COPY_INSTEAD_OF_MOVECaolán McNamara1-1/+1
and cid#1554697 COPY_INSTEAD_OF_MOVE cid#1554709 COPY_INSTEAD_OF_MOVE cid#1554764 COPY_INSTEAD_OF_MOVE cid#1554804 COPY_INSTEAD_OF_MOVE cid#1554821 COPY_INSTEAD_OF_MOVE cid#1554833 COPY_INSTEAD_OF_MOVE Change-Id: I3ee0bf523b1c8dfde3674ac5088abe5182cbfb34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170720 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-17cid#1606961 Overflowed array index readCaolán McNamara1-2/+2
using a constexpr sal_uInt16 for the eMax limit, and dropping o3tl::narrowing might be enough to clear this bogus warning Change-Id: I6f7fd468333b39d597eccacf37e6a64926dfc015 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170635 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-05-28loplugin:ostr in sw/../ww8Noel Grandin1-14/+14
Change-Id: I48cc8f196e116c9c20c2930bb043e1d1ccf1de33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167952 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-24tdf#160253: fix list identifier export decision codeMike Kaganski1-1/+1
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) tried to improve deterministic ODF output, by omitting the list identifiers in case when those identifiers were unreferenced. The latter of these used document model node numbers to check if other lists appeared after the last occurrence of the list that is continuing in the current node. But it turned out, that this isn't robust. Consider this ODF: <text:list xml:id="list1" text:style-name="L1"> <text:list-item> <text:p>a</text:p> </text:list-item> </text:list> <text:p>b<text:note text:id="ftn1" text:note-class="endnote"><text:note-citation>i</text:note-citation><text:note-body> <text:list text:style-name="L2"> <text:list-item> <text:p>x</text:p> </text:list-item> </text:list></text:note-body></text:note></text:p> <text:list text:continue-list="list1" text:style-name="L1"> <text:list-item> <text:p>c</text:p> </text:list-item> </text:list> The paragraphs a, b, and c are all in the main document body, and have sequential document model node numbers (say, 15, 16, 17). If these numbers are checked, there is no node between node 15 ("a") and node 17 ("c") with a different list (both 15 and 17 belong to a list with style "L1" and identifier "list1", and node 16 doesn't belong to any lists). That suggests that the list identifier isn't needed in this case. Bug when the actual output of node 16 is done, it includes a node from an endnote ("x"), which is located in a different place in the document model, and has a node number like 7 (so not between 15 and 17). The paragraph "x" belongs to another list with style "L2", and is output to ODF between paragraphs "a" and "c". Here, we must refer from paragraph "c" to the list of the paragraph "a" using the list id, but this is not obvious when only considering node numbers, and requires the prior knowledge of the actual order of appearance of lists in the ODF. Unless we build a DOM, this is only possible, if we do a two-pass output, and collect the nodes order in the first pass. The output already does that in a "collect autostyles" pass. The problem here is that the "collect autostyles" pass used an optimized function, XMLTextParagraphExport::collectTextAutoStylesOptimized, introduced in commit 8195d7061ed52ebb98f46d35fe5929762c71e4b3 (INTEGRATION: CWS swautomatic01 (1.126.4); FILE MERGED, 2006-12-01) for #i65476# and which used style::XAutoStylesSupplier for optimization to get the autostyles. This drops XMLTextParagraphExport::collectTextAutoStylesOptimized, and reverts to use of collectTextAutoStyles, which handles nodes in the same order as when writing to ODF. There, we build a vector of the node numbers sequence, used later to sort DocumentListNodes. This uncovered an omission from the work on paragraph mark (commit 1a88efa8e02a6d765dab13c7110443bb9e6acecf tdf#155238: Reimplement how ListAutoFormat is stored to ODF, 2023-05-11). Turns out, that the code in SwTextFormatter::NewNumberPortion introduced in commit cb0e1b52d68aa6d5b505f91cb4ce577f7f3b2a8f (sw, numbering portion format: consider full-para char formats as well, 2022-10-20) was left behind when re-implementing paragraph marks to use dedicated property; empty trailing spans still affected how the lists were rendered, and that allowed to overlook import defects, where the paragraph mark properties weren't properly set. In ODF import (XMLParaContext::endFastElement), for compatibility, this treats empty trailing spans as defining paragraph mark (when the paragraph mark wasn't set explicitly). This way, the trailing spans get converted to the paragraph mark. In WW8 import, last cell paragraphs didn't call the code handling the paragraph marks. This is also fixed now. The changes result in slightly different numbering of autostyles in the ODF. It seems, that the new numbering more closely follows the order of appearance of the autostyles in the output; and some cases of autostyles that were written, but unreferenced, are now eliminated. The unit tests were updated accordingly. I hope that the performance impact on the export time would not be too large. It is unclear why outline numbering exports a list element at all. Fixing that to not emit the list element is a separate task / TODO. Change-Id: I5c99f8d48be77c4454ffac6ffa9f5babfe0d4909 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166572 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-04tdf#160301 import DOCVARIABLE fields as user fieldsOliver Specht1-6/+24
DOCVARIBLE fields in *.doc files are imported as user fields. Change-Id: Ib723d8a586ca644e0b158f839caef33b2b6225a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165096 Tested-by: Jenkins Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-03-11Use weak reference to SfxObjectShell in SfxEventHint to avoid use-after-freeMike Kaganski1-3/+3
The events may be processed after the shell has been destroyed. This is happening reliably after commit e2bfc34d146806a8f96be0cd2323d716f12cba4e (Reimplement OleComponentNative_Impl to use IGlobalInterfaceTable, 2024-03-11) when controlling LibreOffice from external Java scripts; but obviously, it could happen before as well. Now SotObject inherits from cppu::OWeakObject, instead of SvRefBase. Change-Id: I73a3531499a3068c801c98f40de39bdf8ad90b2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164458 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-07Drop SvtFilterOptions and use officecfg insteadMike Kaganski1-3/+2
Change-Id: I6aa9a21d1422b8b3b6fe5dde9869dffa88be5535 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161744 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-11-08loplugin:fieldcast in SwWW8ImplReaderNoel Grandin1-3/+2
Change-Id: If27ac0047d5f63164ea6b142b857077abf7b5a51 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159128 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-07use more TypedWhichIdNoel Grandin1-3/+2
Change-Id: Ic52321ba38589a396a52d95454524ab8985cbafd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159060 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-07use more TypedWhichIdNoel Grandin1-1/+1
Change-Id: I37683d59e4994546ad4591d213b825ab080940eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159059 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-10-27Add flags to STYLEREFSkyler Grey1-4/+4
This commit is part of an implementation for the following STYLEREF flags - Search from bottom to top, which sets the STYLEREF field to search downwards first, or from the bottom of the page in marginals - Hide non numerical, which hides all characters that are not either numbers or punctuation commonly used as delimiters. For example, if your STYLEREF said "Chapter 2.1", this setting would make it say "2.1" This commit implements: - The document model - The layout - The UI Change-Id: I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158349 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-10-20Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: swStephan Bergmann1-1/+1
Change-Id: I85fff7ed6932c5fc196e18f24fa01074ba4837e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158241 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-20tdf#86790: Add support for a word-style stylerefSkyler Grey1-4/+3
STYLEREF is a field type in Word which changes its content based on nearby paragraphs. For example, upon creating a styleref referencing "Heading 1" you will see the text of the nearest "Heading 1"-styled paragraph that is above the field. This patch implements STYLEREF in Writer as a cross-reference. By using "insert>cross-reference>styles" you'll be presented with a list of styles. Selecting one and clicking "insert" will create a field which has text from the "most relevant" instance of the style. To find the most relevant instance we first search up for paragraphs with the style, and if there are any we take the closest. If there weren't any, we search down for paragraphs with the style. This patch also updates our use of STYLEREF for chapters exported to docx by using it for all chapters not only those in headers and footers. This allows us to approximate more chapter field functionality even when moving between Writer and Word. Finally, this patch adds some tests for STYLEREF: - testTdf86790 tests that the "sample file with STYLEREF" document from tdf#86790 has the correct fields - testStyleRefSearchUp tests that the STYLEREF searches up when there are bits of text both above and below it - testStyleRefSearchDown tests that the STYLEREF searches down when there are bits of text below it only - testMarginalStyleRef tests that the STYLEREF searches from the page top when it is placed in a footer - testFootnotetyleRef tests that the STYLEREF searches from the reference mark when it is placed in a footnote Still TODO: - [ ] Update documentation - [ ] Implement reverse-searching (\l) and nondelimiter suppression (\t) - Probably these 2 will be in a followup patch Change-Id: I25dd7a6940abee5651a784b9059fe23b32547d6c Signed-off-by: Skyler Grey <skyler.grey@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157456 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-06-26new loplugin:constexprliteralNoel Grandin1-1/+1
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-05-20tdf#90408 Revert #i79169# save/apply attributes of macrobutton textJustin Luth1-26/+0
This reverts ancient commit a79a0101f114e0fcac40503220c5d34750124367. I'm not sure what problem it was trying to solve, but it doesn't seem necessary now. At least, I took my unit test and set some different font sizes to them, and they correctly got those attributes. This was the original file that needed to be fixed: make CppunitTest_sw_ww8export4 CPPUNIT_TEST_NAME=testTdf90408 This is for the current bug report: make CppunitTest_sw_ww8export4 CPPUNIT_TEST_NAME=testTdf90408B Change-Id: I09fb3bd12d645318f1024ac78a9b3154a1fcd078 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152025 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
2023-01-19tdf#141649 doc import: do not duplicate conditional textJustin Luth1-0/+10
This patch is a mixed blessing. It will be a regression if an IF FIELD was bogus, and the user only wanted to see the modified, unrefreshed text. That is because in MS Word, most fields do not update automatically, but require the user to press F9 to refresh the contents. The contents are also editable, so the result might not match either the true or false result-string. However, in LO the IF FIELD is always refreshed, and thus will never display any bogus hand-modifications. The import of these IF fields started in DOC in LO 6.1, but it was never correct and immediately duplicated content. Additionally, DOC format didn't export at all, so anything to do with IF FIELDS was lost - meaning that after a round-trip the result was the same as what MS Word last saw with the field gone. So in the eyes of the user, the fixing of import and export might be causing a regression of changed text. So be it. I can only assume that in most cases the use of an IF FIELD is intentional and that it would be desirsable to have it working. Change-Id: If90f6f4cddcefebf379352aac6519595c1bf2b23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145821 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
2023-01-18tdf#114537 doc import: trim switches before evaluating FIELD_IFJustin Luth1-1/+17
Although this function is only used for ww8 import (and qa tests), it is documented as being more generic. So I decided to just trim at the source and not try to introduce any MS-isms into the parse function. Something similar will be needed for DOCX, but DOCX import for FIELD_IF is completely missing. Change-Id: I822b400e3e53abd953f4c382947f0e80ae62b234 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145691 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
2022-11-17ofz#53457 sanity check the form field rangeCaolán McNamara1-2/+17
Change-Id: I2a1c82bb0590acf8f2399f2ea4b6b477600c7908 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142840 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-10-11Deduplicate O(U)StringConcatenationMike Kaganski1-1/+1
And use an overloaded helper function with a better (?) unified name to show that the result is not an O(U)String. Change-Id: I8956338b05d02bf46a6185828130ea8ef145d46b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141203 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-10-11use more string_view in swNoel Grandin1-23/+23
Change-Id: Ibefb8549834ba5011286e3221f1ae276e2c0c0bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141153 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-24Use more SwPosition::AdjustNoel Grandin1-3/+3
to keep the internal fields of SwPosition in sync. Change-Id: Icdcf9db112f34b3164e52c33f90484755cc08ccf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138754 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-24use SwNode instead of SwNodeIndex in WillHavePageDescHere methodNoel Grandin1-3/+3
part of the process of hiding the internals of SwPosition Change-Id: Ib671c8a0588e7e53567b2ed02ff6169226d7c2e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138752 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-24Use more SwPosition::AdjustNoel Grandin1-1/+1
to keep the internal fields of SwPosition in sync. Change-Id: Ia11f4797fe0b7b0ba4fb368fe4f9918a2d577c87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138751 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-14rename SwPaM::GetNode to GetPointNode/GetContentNodeNoel Grandin1-2/+2
Using a parameter to select point/mark makes the code much harder to read Change-Id: I4ac8b904ac423e2b99253b7e4b6adc72c8afe1a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138083 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-11unique_ptr->optional in SwWW8ImplReaderNoel Grandin1-5/+5
Change-Id: I9d5961c974cf0ec378dd3560ad24d65e5d3aa197 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138104 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-04add more SwPosition::AssignNoel Grandin1-2/+1
These are just the "obviously correct" places where we can use SwPosition::Assign, i.e. the places where we are already correctly setting both nNode and nContent in SwPosition. Change-Id: I27078c91e491c9162770ce729364197056d62cb6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137775 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-02introduce SwPosition::GetContentIndexNoel Grandin1-4/+4
as part of the process of hiding the internals of SwPosition largely done by doing: git grep -lF 'nContent.GetIndex' | xargs perl -pi -e 's/\bnContent\.GetIndex/GetContentIndex/g' Change-Id: I12684071a6666c365dbadbab2a4b37cf51b274d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137695 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-02introduce SwPosition::GetNodeNoel Grandin1-6/+6
as part of the process of hiding the internals of SwPosition largely done by doing: git grep -lF 'nNode.GetNode' | xargs perl -pi -e 's/nNode\.GetNode/GetNode/g' Change-Id: Id1937df1bd5a54677c2c1bbfb2d693a4e22a7b98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137671 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-16sw: prefix members of SwMSDffManager, SwWW8FltControlStack, ...Miklos Vajna1-10/+10
... SwWW8FltRefStack and SwWW8ReferencedFltEndStack See tdf#94879 for motivation. Change-Id: I93ac7230bc383433d7232c5d14ed98339620316f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134380 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-05-03Just use Any ctor instead of makeAny in swStephan Bergmann1-3/+3
Change-Id: I2c9023ba8d07314d23ae7a65e670e8748c5e9322 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133766 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-27tdf#148380 sw ms: import select fldLock'd fields as FIXEDJustin Luth1-3/+4
Many fields we are locking just because we can't trust that what is seen in MSWord is what will be seen in LO. Of the unlocked fields which normally should be updated (SAVEDATE and PRINTDATE), if MS Word secretly has also locked them (via Ctrl-F11), then we also need to lock them. Currently, on export these will be exported as plain text, which IMHO is perfect because them we never need to mess with these nasty fields again. WriterFilter import was already handling the complicated FldChar's fldLock OK, but nothing happened with the one for fldSimple. Proving once again that a monkey can program, I randomly made copy-changes to model.xml until I got the result I wanted... The unit test has one of each. Change-Id: Ia197794f4ea7e105b67cb1805c5def5347d7690d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133087 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-04-26tdf#132475 sw ms: import/export DI_CHANGE as fieldJustin Luth1-1/+3
and (only) the AUTHOR portion as FIXED for DOC/DOCX/RTF. The SAVEDATE import was failing as a field because of exception writerfilter/source/dmapper/DomainMapper_Impl.cxx:6950: Exception in CloseFieldCommand() com.sun.star.lang.ServiceNotRegisteredException message: "unknown service: com.sun.star.text.TextField.DocInfo.Change at /persistent/git/libreoffice2/svx/source/unodraw/unomod.cxx:191" In terms of marking the field FIXED: MS Word doesn't update the save date while the document is being edited (although a user could force an update via F9) but it does update the field at FILEOPEN! So, since it updates the date on FILEOPEN, it makes perfect sense to treat this as a normal SAVEDATE field in LO - not fixed at all. At opening time, it will ignore the last-displayed-text and load the values from the field just like Word. The difference will be that it updates the field immediately after a while-editing-save, but that's fine, because when Word opens the same file, that is what it will see. However, curiously enough, MS Word does NOT update the LASTSAVEBY user, and thus the modified author can be set as FIXED, with the normal caveat that a LO user won't be able to update the field (except by deleting and re-creating it). Change-Id: I5640432708cf3eebb6a60eaa500fdf0b8f3a6e1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133209 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-04-13tdf#148380 doc: Import AUTHOR/CREATEDATE as FIXEDFLDJustin Luth1-5/+6
Writerfilter already did this earlier in the patch set. So now change DOC format to do all the same things. Change-Id: I8db2b4e3fc227b73c4d075ee624117e1b1f1d92e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132663 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-04-12loplugin:stringview more o3tl conversionNoel Grandin1-1/+1
look for call sequences that can use string_view and the new o3tl functions in o3tl/string_view.hxx Also add a few more wrappers to said #include file Change-Id: I05d8752cc67a7b55b0b57e8eed803bd06bfcd9ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132840 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-11loplugin:stringview add check for getToken().toInt32Noel Grandin1-2/+2
where we can convert that to o3tl::toInt32(o3tl::getToken( and avoid the heap allocation of a temporary string Change-Id: Ib11c19c6e6cdc0de3e551affd3578d181e292de4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132810 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-07ofz#46457 don't crash with mangled INCLUDETEXT field caseCaolán McNamara1-1/+13
Change-Id: I86621bce8587aeeeded90bc81ae9f17049c17f42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132667 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-03-24tdf#147861 ww8import: solve TODO: not fixed-field if equalJustin Luth1-3/+20
Do not mark the field as "fixed" if the displayed string matches the internal variable. This allows changing the variable within LO and having the field update to reflect that change, which is the way that these fields are supposed to work (although in MS Word they only update manually via F9 which is why some needed to be fixed in the first place). Change-Id: Id359cbf0b48e63bddab3e45871326988467d7ddb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131414 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-03-22tdf#147861 ww8import: use GetFieldResult, not current DocPropertyJustin Luth1-2/+11
In all the testing I could think of on DOCX and DOC examples (and only a very few exist in the unit tests) the actual value of the DocProperty was irrelevant to what Word shows as the document loads. It always takes the in-document, as-last-seen static text. As a way to hack a fix using existing capabilities, I marked as FIXEDFLD the unknown custom fields that weren't handled separately. That fixes what is displayed as the import value, (which of course means that F9 will no longer return a modification back to the DocProperty value). It also means the (fixed) field is lost on export, but a follow-up patch handles that for DOC/RTF/DOCX. There were NO DI_CUSTOM examples in existing ww8 tests, but: -ooxmlexport8: fdo74745.docx, fdo81486.docx -ooxmlexport10: tdf92157.docx and in these cases the plain text matched the variable anyway, but a manual manipulation showed that LO is importing DOCX wrong as well, so a similar import fix needs to happen for RTF/DOCX. My fear is that there are some special-magic-associations that worked properly the old way by accident that I will break by marking them as fixed. No backporting please since obviously very few people report bugs about fields. Change-Id: I3f167eb3bd570b66ee829241bf9d31d557fc8749 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131237 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Reviewed-by: Justin Luth <jluth@mail.com>
2022-03-02remove writerhelper::ItemGetNoel Grandin1-3/+3
the TypedWhichId template methods on SwFormat supercede this Change-Id: I7444dc1eb85fccfc9d60da4f1502ea2e2ceccdc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130805 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-14Stream::Tell returns sal_uInt64Noel Grandin1-5/+5
Change-Id: I02e49d4f59c17a9868c4111ac91b5dd2715e689c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126630 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-23O[U]String::replaceAt overloads that take string_viewNoel Grandin1-7/+7
which results in lots of nice string_view improvements picked up by the plugins Change-Id: Ib0ec3887816b3d4436d003b739d9814f83e244b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-11loplugin:moveparam in swNoel Grandin1-6/+6
Change-Id: I4fa524e4abb101ed0ff1b8f97b84582b84aa1d07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123387 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-10use SfxItemSetFixed in swNoel Grandin1-3/+2
Change-Id: I69e188d7599b7fc439f613cec0a0967ccb748b7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123313 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-05drop 'using namespace std' in swJulien Nabet1-1/+0
Change-Id: Idb2350c32d9fba55e9ad8db7aa4c1a280f03ca6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123068 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>