summaryrefslogtreecommitdiff
path: root/sw/source/core/docnode/node.cxx
AgeCommit message (Collapse)Author
2023-11-07ITEM: Get away from classic 'poolable' Item flagArmin Le Grand (allotropia)
To understand this, some look back in history will be needed to see why it is as it is today. In some (reworked) comments 'poolable' is described as flag to hold Items in the ItemPool, also always having only one incarnation of each possible Item. This is not the original intention, but a side-effect. The reason is what the binary format in the office did: To save a document, the Objects & the Pool were saved, *not* individual Items *together* with the objects. The Pool was completely (binary) saved (and loaded) in one run. Temporary IDs were used to represent at the objects in file which Items were referenced. This *required* to have only one incarnation per item to have a minimal binary file size, thus this high effort was put into this. At doc load, the pool was loaded, all Items were set to RefCount 5000, the references from the objects were restored and then for each Item the RefCount was lowered by 5000 again and - if being zero - deleted. Items for UI were marked 'non-poolable' to *not* safe them with the document, so poolable was a flag to decide if that Info/Item was to be saved with the document - or more direct: if it is Model Data. Items are small, so if we prefer runtime it is okay to no longer being strict with this, anyways does not happen often and has only marginal memory effects - compared to runtime effects/savings. Other problems which this caused: One example is that objects in the UNDO stack were still in the pool, so e.g. deleted pictures were saved with the document despite no longer being used (!). That is the reason we have an UndoItemPool and a method MigrateItemPool to move stuff to that Pool when objects go to the UNDO stack - all of this is also no longer needed. Cleaning this up means to ideally have all items in the SfxItemSet, no longer at the Pool. The Pool should be reduced to a 'Default-Item- Holder' and a 'Slot-to-whichId-mapper'. This needs thorough cleanups/removals, but will be worth it because that massive simplification(s) will increase safety an runtime and make migrating to the goal of completely type-based ItemSet stuff easier for the future. Hopefully only view code in the office working with items will have to be changed for this. In this 1st step I already found that some 'compromizes' will be needed: - There are still Items that have to be at the pool to make the Surrogate-stuff working. This gives back all Items in a Pool of a type and is used in ca. 80 cases. Each one looks at these Items *without* context (e.g. a SfxItemSet at an Object would be a context), so if e.g. a dialog is open that temporarily uses Items of that type you would also get these - without knowing about it... To make that work there is still a mechanism to have Items at the Pool, but now just *registering* (and un-reg) them without any sort/search/ remove needs. Also only for Items that need that, so I evaluated the GetItemSurrogates calls and added some asserts when GetItemSurrogates tries to access an unregistered item type which needs to be added. - Another caveat is that there are about 250 places that directly put Items to the Pool (not all remove these, that is done at pool deletion, so some kind of silent 'garbage-collection' is in place). To have an overview I renamed the accessing methods to separate them from the same functionality at the SfxItemSet, which had the same names. An implementation does still add these directly to the pool, there is no way to cleanup those usages for now. In principle all these should be changed to hold the data at an SfxItemSet. I am still hunting problems. But you can build the office, all apps work (including chart) and you can do speed comparisons already. There are test throwing errors, so I hunt these now. It is hard to give an estimation about how much more changes/corrections will be needed. Completed adaptions to new registered Items at Pool, that reduces the failing tests. Still many that I need to hunt. Added stuff to work around that 'compromize' in ScDocumentPool: It overloads ::PutImpl of the pool to implement special handling for a single Item in SC, the ScPatternAttr. In former code that method was used from SfxItemSet and ::PutImpl at the pool directly, so it was only used in one place. I am not sure if it was used from the SfxItemSet functionality, but better offer it for now. To not waste too much runtime the callbacks depend on the boolean 'NewItemCallback' at the SfxPoolItem, it gets set for that single Item in SC and only then the callbacks trigger. I hope to get rid of those again, e.g. newItem_UseDirect is only needed since we have no 'real' StaticPoolDefaults currently - another thing that needs to be cleaned up in a next step. Since usages of impl(Create|Cleanup)ItemEntry and Direct(Put|Remove)ItemInPoolImpl got more and more similar I decided to unify that: move impl(Create|Cleanup)ItemEntry to tooling, make it globally available in svl and use it also directly for Direct(Put|Remove)ItemInPoolImpl. This slightly increases the failing tests again, but only since in Direct(Put|Remove)ItemInPoolImpl that fallback (e.g. tryToGetEqualItem) was used before, thus this is the same class of errors (SfxPoolItem ptr-compare) as the others which I will need to find anyways. Also fixed some missing stuff. Have now idenified and redirected all SfxPoolItem ptr-compares to be able to debug these - one cause for the remaining errors is probably that before with bPoolable those often were sufficient, but are no longer. Used the [loplugin:itemcompare] and a local clang build to do so, see https://gerrit.libreoffice.org/c/core/+/157172 Stabilized Direct(Put|Remove)ItemInPoolImpl forwards, added parameter to implCreateItemEntry to signal that it gets called from DirectPool stuff - currently needed. Hopefully when getting rid of that DirectPool stuff we can remove that again Added two more debug functionalities: - Added a SerialNumber to allow targeted debugging for deterministic cases - Added registering & listing of still-allocated SfxPoolItems at office shutdown Found PtrComp error in thints.cxx - POC, thanks to areSfxPoolItemPtrsEqual. Will hopefully help more with other tests Found some wrong asserts/warnings where I was too careful and not finding something/succeeding is OK, fixes some UnitTests for SC For SC I now just tried to replace all areSfxPoolItemPtrsEqual with the full-ptr-content compare SfxPoolItem::areSame. I also needed to experiment/adapt the newItem_Callback solution but got it working. Did that replacement now for SW too, found some places where the direct ptr compare is OK. Continued for the rest of occurrences, now all 160 places evaluated. Also done some cleanups. Massive cleanups of stuff no longer needed with this paradigm change. Also decided to keep tryToGetEqualItem/ITEM_CLASSIC_MODE for now. It is used for *one* Item (ScPatternAttr/ATTR_PATTERN) in SC that already needs many exceptions. Also useful for testing if errors come up on this change to test if it is related to this. Added forwarding of target Pool for ::Clone in SvxSetItem and SvxSetItem, simplified SfxStateCache::SetState_Impl and returned to simple ptr compares in SfxPoolItem::areSame to not do the test in areSfxPoolItemPtrsEqual. Debugged through UITest_calc_tests9 and found that in tdf133629 where BoxStyle is applied to fully selected empty calc the Item- reuse fallback has to be used not only for ATTR_PATTERN, see comment @implCreateItemEntry. Maybe more... Problem with test_tdf156611_insert_hyperlink_like_excel. Found that in ScEditShell::GetFirstURLFieldFromCell the correct SvxURLField is found and returned as ptr, but it's usage crashes. That is due to the SfxItemSet aEditSet used there gets destroyed at function return what again deletes the SvxFieldItem that is holding the SvxURLField that gets returned. This shows a more general problem: There is no 'SfxPoolItemHolder' that safely holds a single SfxPoolItem - like a SfxItemSet for a single Item (if Items would be shared_ptrs, that would be a safe return value). That will be needed in the future, but for now use another solution: Since I see no reason why EE_FEATURE_FIELD should not be shareable I wil change this for ow in the SfxItemInfo for EditCharAttribField. That way the Item returned will be shared (RefCnt > 1) and thus not be deleted. I changed the return value for GetURLField() and GetFirstURLFieldFromCell() in ScEditShell: At least for GetFirstURLFieldFromCell the return type/value was not safe: The SvxFieldItem accessed there and held in the local temporary SfxItemSet may be deleted with it, so return value can be corrupted/deleted. To avoid that, return a Clone of SvxFieldData as a unique_ptr. With all that UnitTest debugging and hunting and to get the paradigm change working to no longer rely on shared/pooled items I lost a little bit focus on speed, so I made an optimization round for the two central methods implCreateItemEntry/implCleanupItemEntry to get back to the speed improvements that I detected when starting this change. It was mainly lost due to that 'strange' chained pool stuff we have, so I added to detect the target pool (the one at which the WhichID is registered) directly and only once. Next thing to cleanup will/should be the pool and it's concept, all this is not needed and really costs runtime. Since implCreateItemEntry/implCleanupItemEntry are executed millions of times, each cycle counts here. Had an error in the last changes: pool::*_Impl methods use index instead of WhichID - most of them. Another bad trap, I really need to cleanup pool stuff next. Change-Id: I6295f332325b33268ec396ed46f8d0a1026e2d69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157559 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-09-27pass SwAttrSet around explicitlyNoel Grandin
instead of using SfxItemSet and static_cast'ing it everywhere Change-Id: I12d1a6bd2dec7035fa16206ea01346a3a73c1457 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157309 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-01remove AUTOFMT_DOCNODEBjoern Michaelsen
- remove obsolete GetInfo()s - introduce SwFormat::IsUsed() - move handling from GetInfo to SwClientNotify - make sure SwAutoFormatUsedHint is forwarded to clients where needed (e.g. SwTextFormatColl, SwDDETable, SwPageDesc, ...) Change-Id: I07d9e94ee791ca6e738b4eb3e597055ad8fbe755 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155504 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2023-08-23tdf#156116 - A11Y - fix object name does not update in accessibility sidebarBalazs Varga
when we modify the name on the Navigator sidebar. Update the related accessibility issue after we modify the name on the sidebar. Change-Id: I8f4b8780ff1ffe7cfb86ff837c9579d6b785b832 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155904 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
2023-08-09tdf#147938 sw_redlinehide: move fix into SwNodes::UndoTableOfText()Michael Stahl
Reproducing tdf#151866 on the .odt attachment, it becomes clear that the fix for tdf#147938 is in the wrong place. There a node has the merge flag None although it is the last node of a merge, because CheckParaRedlineMerge() first sets the node flags and then calls DelFrames(), which now resets the flags. In case there's another caller of DelFrames() that needs this, it's not obvious, can be added later. (regression from commit 5b55ccfd384d3c0c11e05f22bd7e956b4bc7e43a) Change-Id: Iba0cb83260ecb18a4b96ded20a95b2b20d696fc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155516 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-08-04tdf#147938 sw_redlinehide: fix undo of table to textMichael Stahl
The problem is that when the text node is split in SwNodes::UndoTableToText(), the 2nd one retains the merge flag NonFirst, not the 1st one, and it ends up in the 2nd table cell, so it's skipped when creating the layout frames (and an assert in InsertCnt_() segfaults). SwContentNode::DelFrames() should probably reset the merge flags of nodes when it deletes the merged frame. (regression from commit 32902f66e7749b2d06d13f50416be5323a0c0ea9) Change-Id: I7b3b1ca873bde831481c676780200a3206ae667c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155345 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-05-24sw: fix crash in SwNode::GetFlyFormat()Xisco Fauli
FindFlyFrame() might return nullptr See https://crashreport.libreoffice.org/stats/signature/SwNode::GetFlyFormat() Change-Id: Id99a806e62f03b8912747525c8b0235c1b23232b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152156 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-04-28Revert "Revert "introduce sw::SpzFrameFormat ...""Bjoern Michaelsen
apparently, in SwHistoryChangeFlyAnchor::SetInDoc, m_rFormat might actually reference a DrawFormat, not a FlyFormat, and that is likely fundamentally broken. But for now, lets just make m_rFormat a sw::SpzFrameFormat -- this already removes some pointless up and downcasting. This reverts commit 52acefd6024ec79f8333ba40eef83816eda3046f. Change-Id: I040d98548bf9ac1c25b93214224eb0812f8cb653 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151150 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2023-04-27Revert "introduce sw::SpzFrameFormat ..."Stephan Bergmann
This reverts commit 09cdcb5f37bb4e42da7b28db6e757b9f2affed14. It broke at least CppunitTest_sw_uiwriter3 (<https://ci.libreoffice.org//job/lo_ubsan/2756/>), > /sw/source/core/undo/rolbck.cxx:938:46: runtime error: downcast of address 0x61300041fd00 which does not point to an object of type 'SwFlyFrameFormat' > 0x61300041fd00: note: object is of type 'SwDrawFrameFormat' > 00 00 00 00 70 83 cf 09 25 7f 00 00 00 83 47 00 30 61 00 00 40 e5 43 00 30 61 00 00 80 66 5d 00 > ^~~~~~~~~~~~~~~~~~~~~~~ > vptr for 'SwDrawFrameFormat' > #0 0x7f24fca9c5b9 in SwHistoryChangeFlyAnchor::SetInDoc(SwDoc*, bool) /sw/source/core/undo/rolbck.cxx:938:46 > #1 0x7f24fca880f3 in SwHistory::Rollback(SwDoc*, unsigned short) /sw/source/core/undo/rolbck.cxx:1208:15 > #2 0x7f24fcb47832 in SwUndoDelete::UndoImpl(sw::UndoRedoContext&) /sw/source/core/undo/undel.cxx:1031:33 > #3 0x7f24fcb703c2 in SwUndo::UndoWithContext(SfxUndoContext&) /sw/source/core/undo/undobj.cxx:225:5 > #4 0x7f2543b8b57c in SfxUndoManager::ImplUndo(SfxUndoContext*) /svl/source/undo/undo.cxx:712:22 > #5 0x7f2543b8c4f8 in SfxUndoManager::UndoWithContext(SfxUndoContext&) /svl/source/undo/undo.cxx:664:12 > #6 0x7f24fca6a074 in sw::UndoManager::impl_DoUndoRedo(sw::UndoManager::UndoOrRedoType, unsigned long) /sw/source/core/undo/docundo.cxx:696:32 > #7 0x7f24fca6b38f in sw::UndoManager::UndoWithOffset(unsigned long) /sw/source/core/undo/docundo.cxx:731:16 > #8 0x7f24fa830b18 in SwEditShell::Undo(unsigned short, unsigned short) /sw/source/core/edit/edundo.cxx:141:57 > #9 0x7f250088f448 in SwWrtShell::Do(SwWrtShell::DoType, unsigned short, unsigned short) /sw/source/uibase/wrtsh/wrtundo.cxx:45:26 > #10 0x7f24ff7f16e2 in SwBaseShell::ExecUndo(SfxRequest&) /sw/source/uibase/shells/basesh.cxx:651:27 > #11 0x7f24ff7eea14 in SfxStubSwBaseShellExecUndo(SfxShell*, SfxRequest&) /workdir/SdiTarget/sw/sdi/swslots.hxx:2203:1 > #12 0x7f2523fbc059 in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) /sfx2/source/control/dispatch.cxx:254:9 > #13 0x7f2523fd1ced in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) /sfx2/source/control/dispatch.cxx:753:9 > #14 0x7f2523f61333 in SfxBindings::Execute_Impl(SfxRequest&, SfxSlot const*, SfxShell*) /sfx2/source/control/bindings.cxx:1060:22 > #15 0x7f252437496b in SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:688:53 > #16 0x7f2524377211 in SfxOfficeDispatch::dispatchWithNotification(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:266:16 > #17 0x7f24cad28dd6 in framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatch> const&, com::sun::star::util::URL const&, bool, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx:163:30 > #18 0x7f24cad27cb2 in framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx:120:16 > #19 0x7f24cad29684 in non-virtual thunk to framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx > #20 0x7f24e91d386d in unotest::MacrosTest::dispatchCommand(com::sun::star::uno::Reference<com::sun::star::lang::XComponent> const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /unotest/source/cpp/macros_test.cxx:94:33 > #21 0x7f25319b2012 in testTdf132321::TestBody() /sw/qa/extras/uiwriter/uiwriter3.cxx:982:5 Change-Id: Ibeb181bc38cd6f88df76403cca8a15b45090633f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151027 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-24introduce sw::SpzFrameFormat ...Bjoern Michaelsen
- ... as a base class of frame formats allowed into the spz frame format container - with a private ctor and friends SwDrawFrameFormat and SwFlyFrameFormat so only these two classes derive from it - with that, switch over the SpzFrameFormats to only ever allow these types into the container - in followups, likely quite a bit of stronger typing can be introduced. - ultimately, it would be nice to have each SwDrawFrameFormats and SwFlyFrameFormats in their own strongly typed container in the end. Change-Id: Ic30efc1220aded701533c9ca5003d2aaf8bbdaec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150452 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2023-04-11introduce SwFrameFormat::IsVisible()Bjoern Michaelsen
- as a replacement for RES_CONTENT_VISIBLE - broadly: if a FrameFormat has at least one Frame, it is visible - however, sections are special and need to recurse into their childs - SwFlyFrameFormat::GetInfo then does not need to override anymore Change-Id: I01c469e7330a7daaccd2be0541af1d83c7d1a424 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150038 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2023-02-15SwContentNode: assert on dead codeBjoern Michaelsen
Change-Id: Id094b0c244a55581fe3db1773788b4dd31698a24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146963 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-11-25tdf#141438 Clean old comments //FEATURE::CONDCOLLBogdan B
Change-Id: I350a9c0a033edddf805170534561b6dca0bf5ae0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143172 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2022-11-24add SwFormatAnchor::GetAnchorNode methodNoel Grandin
as a step towards switching away from using SwPosition inside SwFormatAnchor (because SwFormatAnchor wants to do weird stuff with the internals of SwPosition) Change-Id: I1527b6585d1e130b46e1e51b1e40eea043339d8f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143205 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-11-18sw: handle joining and splitting nodes for online a11y checkTomaž Vajngerl
Change-Id: I706bf56209beebbe2987bce436536c3d9ade51f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142655 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-10-30tdf#126788 fetch node index once hereNoel Grandin
Change-Id: I5991dda00879b55090a8353001ce341a2360fab2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142031 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-25tdf#144939: fix chapter numbering updatesBjoern Michaelsen
Change-Id: Icd29a380663a1c5f70e3a8ee86db64ec4eae8d86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140558 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2022-09-23add a new SwContentNode::GoNext variantNoel Grandin
that takes a SwPosition and keeps the nNode and nContent fields there in sync. this is part of the process of hiding the internals of SwPosition. Change-Id: I1996e588703ca2400fa84e979c72cc5382e5b700 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140435 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-20add CanJoinNext method that takes a SwPosition*Noel Grandin
part of the process of hiding the internals of SwPosition Change-Id: I401fa4d98a2e53a082bfb39f3d13315261a0a2ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140246 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-30SAL_WARN->SAL_INFO in SwContentNode::ChkCondCollNoel Grandin
we call this on all nodes, so it's not really a bug Change-Id: I7bb258e68abf6fb0ced5a46924b715febb79c587 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139036 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-23use more SwPosition::GetNodeNoel Grandin
Change-Id: Iad8d3247062f459960767487d603711aff01f10e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138698 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-13pass SwNode instead of SwNodeIndex to SwNode constructorsNoel Grandin
part of the process of hiding the internals of SwPosition Change-Id: I0b2dd3e24c82c1551a7275ffc78991823354858a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138224 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-06make SeekEntry take a SwNode, not an SwNodeIndexNoel Grandin
as part of the process of hiding the internals of SwPosition Change-Id: Id43211f221f3b90c46629bedec25f9078c7bf9dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137894 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-02introduce SwPosition::GetNodeNoel Grandin
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-07-26convert CRSR_SKIP_* to typed enumNoel Grandin
Change-Id: Ia5cb9915fc7ad3238f4386f5ed3e43efc4b74a32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137478 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-25rename SwIndex->SwContentIndexNoel Grandin
to help my poor brain with the different kinds of index we have floating around Change-Id: I47ed223922170687d7e07812445aed66b3218230 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137404 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-25SwIndex/SwIndexReg is only used to deal with SwContentNodesNoel Grandin
so make that apparent in the type system and naming, instead of implicit. Which requires adding a small helper class for the one place we were instantiating an SwIndexReg by itselg Change-Id: I74db37239aed0005e5a2a01916635fa93de638f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137403 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-10sw doc model xml dump: show table row propertiesMiklos Vajna
Also extract SwTableNode::dumpAsXml() from SwStartNode::dumpAsXml(), ideally dumpAsXml() should only dump own members, not members of other classes. Change-Id: I5ef3e90d0cdd23ba44c192de1802844acad64cc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135575 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-05-17tdf#148461 sw_redlinehide: fix assert in SwContentNode::DelFrames()Michael Stahl
The assert(pMerged->pFirstNode->GetIndex() <= i) is intended for when frames are really deleted, but CheckParaRedlineMerge() calls it while the now-outdated MergedPara is still on the frame, but the nodes already have new flags; assign a dummy node in this situation. Change-Id: I23fbfdb6901e6e15abf92913aa252e59877bc280 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134475 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-03-28Recheck sw/ cxx files with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I8a8df68946297fad517b753d73e4373203a45ed6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132150 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-03-02use SfxItemSet::GetItemIfSet in sw/source/core/docnodeNoel Grandin
Change-Id: I71f6b60e981aa4391563a5214be38bb03646cdf4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130839 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-02-22Fix typosAndrea Gelmini
Change-Id: I705530b841a5e1a4c45f78408948d4cdba630d96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130291 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-02-08add template versions of SwContentNode::GetAttrNoel Grandin
Change-Id: I62c0d54c9e1dc89c5684210075219c1eeee9f942 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129602 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-01-20WASM --enable-wasm-strip now skips lots of LO codeArmin Le Grand (Allotropia)
... resulting in a stripped-down, Writer-only build to decrease the resulting WASM bytecode size. It removes the following code from the build: * All other major modules: Base, Calc, Chart, Draw, Impress and Math and related writerperfect filters * The premultiply tables * The (auto-)recovery functionality * All accessibility (but not the accessibility document checker) * The LanguageGuess component * EPUB support * The start center / BackingWindow * The TipOfTheDay functionality * The splash screen communication Currently crashs with anything different then soffice --writer. Closing the document also still crashes. FYI: many of these features are now behind ENABLE_WASM_STRIP_* defines, but they normally don't work on their own, globally! That's because we started with stripping the main components. Change-Id: Ib9c0f9452815910c0a2aceaf142ba1ad4a9cb0d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126182 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2021-12-01sw doc model xml dump: show the format of section nodesMiklos Vajna
The SwSectionNode has an SwSection, which is registered in an SwSectionFormat, which finally tells us if it's a protected one. Change-Id: Ie46c516f900f1c479c11cbbaf061973400614a2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126151 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-11-05tdf#134294: fix Chapter heading updatesBjoern Michaelsen
A quick manual recheck seems to confirm, that this does not regress tdf#118735, tdf#118049. I couldnt quite recheck tdf#118833, the "steps to reproduce" dont quite work on master -- but I did find any obvious regression there. Change-Id: I407ac8c0a8222e3f8c74449a4ec2b9b27e8a3a20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124532 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-10-21introduce SwNodeOffset strong typedefNoel Grandin
for indexing into node children. Replaces various usage of sal_uLong, tools::Long, sal_uInt32 with an underlying type of sal_Int32. Also add a NODE_OFFSET_MAX constant to replace usage of ULONG_MAX Change-Id: I2f466922e1ebc19029bb2883d2b29aa4c0614170 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123892 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-16Simplify vector initialization in swJulien Nabet
Change-Id: Ibded138d113e56b78b12c96c7ecd8258564627ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123701 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-10-10use SfxItemSetFixed in swNoel Grandin
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-09-20clean up ambiguous confusing rectangle APIs like IsInside()Luboš Luňák
Reading 'rectA.IsInside( rectB )' kind of suggests that the code checks whether 'rectA is inside rectB', but it's actually the other way around. Rename IsInside() -> Contains(), IsOver() -> Overlaps(), which should make it clear which way the logic goes. Change-Id: I9347450fe7dc34c96df6d636a4e3e660de1801ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122271 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Tested-by: Jenkins
2021-09-05tdf#144304 Fix crashes from "speedup dynamic_cast to SwTextFrame"Aron Budea
Also preemptively adjust cases where FindNextCnt(true) or FindPrevCnt() can be null. Regressions from 426930d0c4bd6f782a04a92e8a36e92cd65e186f. Change-Id: Idb91464ecd285f6f5cf2e399c00faa2dfbbd5601 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121662 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-31fix crash in select-allNoel Grandin
<vmiklos> noelgrandin: hmm, when simply typing "a\nb\nc\d" into writer and trying to select-all, i get a crash from the new SwFrame::DynCastTextFrame(). is that something you see? https://pastebin.com/raw/v00ncxXP is the backtrace <vmiklos> sounds like the old code invoked dynamic_cast<> on nullptr fine, but the new pFoo->DynCastTextFrame() won't work if pFoo is nullptr <noelgrandin> vmiklos, doh!, thanks, will fix Change-Id: I58966512551e90ded3d3ecd65fef9f083dc6d852 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121365 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-28speedup dynamic_cast to SwTextFrameNoel Grandin
which is a hotspot in loading some documents Change-Id: I7f1c48305cd40bcd9bee4baf219228f10cc297b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121184 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-05sw: use more StaticWhichCast() in source/core/docnode/Miklos Vajna
See commit 0025e80ba6d882f6f885499efaf37ab0e2ed699d (sw: use SfxPoolItem::StaticWhichCast() in SwTextBoxHelper, 2021-07-07) for motivation. Change-Id: Id3ca7f0796a9afdccd7211a2ceec19e476647612 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120010 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-07-19Move svl::Items to include/svl/whichranges.hxx, and unify its usageMike Kaganski
... in WhichRangesContainer and SfxItemSet ctors. Now it's not needed to explicitly use 'value' in WhichRangesContainer's ctor, or create an instance for use in SfxItemSet ctor (svl::Items is already defined as a template value of corresponding type). Instead of WhichRangesContainer Foo(svl::Items<1, 2>::value); SfxItemSet Bar(rItemPool, svl::Items<1, 2>{}); now use: WhichRangesContainer Foo(svl::Items<1, 2>); SfxItemSet Bar(rItemPool, svl::Items<1, 2>); Change-Id: I4681d952b6442732025e5a26768098878907a238 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119157 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-01can allocate these SfxItemSet on the stackNoel Grandin
Change-Id: Ib2b89613ad3e8f2bcdd51bee10bab3559a64fce4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118208 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-21create SfxHintId::SwLegacyModify idNoel Grandin
to avoid expensive dynamic_casts in writer Change-Id: Ic73ae7d4af985043f8533913b33939e3445ec7de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117586 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-31no need to allocate this separatelyNoel Grandin
std: :vector is only 3 words big in it's empty state Change-Id: I5d7630f0ded1ace284c0a4441230bf672f4639be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116398 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-30std::unique_ptr->std::optionalNoel Grandin
Change-Id: I7a10e9bf14d45d1fe958dc33fe96ebb8318b3bec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116393 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-03-19silence coverity unchecked return value from library on xmlText* functionsCaolán McNamara
Change-Id: I651abb00d8ae1bdbf758a6a0176fd8912531a585 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112753 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>