summaryrefslogtreecommitdiff
path: root/sw/inc/swcrsr.hxx
AgeCommit message (Collapse)Author
2022-10-31Revert "tdf#126788 replace dynamic_cast with static_cast"Noel Grandin
This reverts commit 32b0b79c3f71e4aca995aa92ee519d93a3ca2b3b. Reason for revert: apparently sometimes we can have a regular SwPaM here? Change-Id: Ib09028a8ca565cea35defba5783ca4f869c59c55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141924 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-29tdf#126788 replace dynamic_cast with static_castNoel Grandin
no need to dynamic_cast here Change-Id: I36b2c20c0f8743c39a8b8b0f14a9eb2ee6effee7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142015 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-02introduce SwPosition::GetContentIndexNoel Grandin
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::GetNodeIndexNoel Grandin
as part of the process of hiding the internals of SwPosition largely done by doing: git grep -lF 'nNode.GetIndex' | xargs perl -pi -e 's/\bnNode\.GetIndex/GetNodeIndex/g' Change-Id: I3616cea4c47595afe74f1aa8e3be553279f25d44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137694 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-26sal_uLong->sal_Int32 in the Find/Search methodsNoel Grandin
we cast this to sal_Int32 once it hits the UNO methods anyway Change-Id: I8d18330929acbb5b2f40d9b0fd0f49e087be867e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137483 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-26tools::Long->sal_Int32 in SwCursor::m_nRowSpanOffsetNoel Grandin
elsewhere in writer this is either sal_uInt16 or sal_Int32, so lets use the wider type Change-Id: I976aa2076a1bf703caff343806daf83de89782bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137482 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>
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-15Avoid usage of incomplete types in member functions defined in-classStephan Bergmann
...that started to fail now at least with clang-cl (where the MSVC rules when to emit inline member function definitions are more aggressive than for other ABIs) with --with-latest-c++ and --with-visual-studio=2022 (where usage of incomplete types in std::vector now triggered > In file included from C:/lo-clang/core/slideshow/source/engine/opengl/TransitionerImpl.cxx:31: > In file included from C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\memory:11: > In file included from C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\exception:12: > C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\type_traits(744,50): error: incomplete type 'Primitive' used in type trait expression > struct is_trivially_destructible : bool_constant<__is_trivially_destructible(_Ty)> { > ^ > C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\type_traits(59,53): note: in instantiation of template class 'std::is_trivially_destructible<Primitive>' requested here > struct conjunction<_First, _Rest...> : _Conjunction<_First::value, _First, _Rest...>::type { > ^ > C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\type_traits(64,44): note: in instantiation of template class 'std::conjunction<std::is_trivially_destructible<Primitive>, std::disjunction<std::_Is_default_allocator<std::allocator<Primitive>>, std::_Has_no_alloc_destroy<std::allocator<Primitive>, Primitive *>>>' requested here > _INLINE_VAR constexpr bool conjunction_v = conjunction<_Traits...>::value; > ^ > C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\xmemory(934,20): note: in instantiation of variable template specialization 'std::conjunction_v<std::is_trivially_destructible<Primitive>, std::disjunction<std::_Is_default_allocator<std::allocator<Primitive>>, std::_Has_no_alloc_destroy<std::allocator<Primitive>, Primitive *>>>' requested here > if constexpr (!conjunction_v<is_trivially_destructible<_Ty>, _Uses_default_destroy<_Alloc, _Ty*>>) { > ^ > C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\vector(1632,13): note: in instantiation of function template specialization 'std::_Destroy_range<std::allocator<Primitive>>' requested here > _Destroy_range(_Myfirst, _Mylast, _Al); > ^ > C:/PROGRA~1/MIB055~1/2022/Preview/VC/Tools/MSVC/1430~1.305/Include\vector(583,9): note: in instantiation of member function 'std::vector<Primitive>::_Tidy' requested here > _Tidy(); > ^ > C:/lo-clang/core/slideshow/source/engine/opengl/TransitionImpl.hxx(74,5): note: in instantiation of member function 'std::vector<Primitive>::~vector' requested here > TransitionScene( > ^ > C:/lo-clang/core/slideshow/source/engine/opengl/TransitionImpl.hxx(42,7): note: forward declaration of 'Primitive' > class Primitive; > ^ etc.). Which in turn required tweaking of loplugin:unnecessaryoverride to avoid false > In file included from C:/lo-clang/core/slideshow/source/engine/opengl/TransitionerImpl.cxx:67: > C:/lo-clang/core/slideshow/source/engine/opengl/TransitionImpl.hxx(389,18): error: unnecessary user-declared destructor [loplugin:unnecessaryoverride] > TransitionScene::~TransitionScene() = default; > ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ > C:/lo-clang/core/slideshow/source/engine/opengl/TransitionImpl.hxx(81,12): note: declared here [loplugin:unnecessaryoverride] > inline ~TransitionScene(); > ~~~~~~~^~~~~~~~~~~~~~~~~~ Change-Id: Ia72fb44e6e92ff47376d7b7159c0df7cbf883b69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123648 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-11loplugin:unnecessaryreturn in sw/Noel Grandin
Change-Id: Iaca3f5385fd2c763cd1121ae50624aaa4a1f6165 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117029 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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-10-20use tools::Long in swNoel
Change-Id: I44be72b3a9b14823ec37a3c799cffb4fb4d6e1de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104527 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-09-25tdf#101830 sw: show field name for inline input fields tooMichael Stahl
Currently if the View->Field Names is toggled, SwViewShell::ImplApplyViewOptions() will call Reformat() and throw away all existing portions. So we can just create a different kind of portion altogether depending on the value of the setting, and avoid complex multi-inheritance portion or copying lots of code around. This requires correcting a few assumptions that a SwFieldPortion has a length of 0 or 1; for the input field, its length is the length of the entire input field including CH_TXT_ATR_INPUTFIELDSTART/END (unless it's a follow/rest portion, those are length 0 as always). For the cursor travelling, LeftRight() works similar to f6a60ce214117946eef222701023dca612bf0a2b, while UpDown() and mouse click positioning need tweaks in SwTextCursor::GetModelPositionForViewPoint() to take the field length into account. Due to the previous point, mouse click related functions in edtwin.cxx require checking the position at the start now. When enabling Field Names, move any shell cursors out of input fields. Change-Id: I1304f419bd6fa20f0c55fd1b13165c4866d64000 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103155 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-09-09tdf#119286 speed up find/replaceNoel Grandin
SvxSearchItem is very expensive to construct, so move it outside the primary loop. This takes the time from 6s to 3s for me. Change-Id: Ie6491761e69c4f787910d7ecfbd071b7e68efd35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102231 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-31Translate German variable namesJohnny_M
Ende -> End Change-Id: Idf599738be9b1eaac51da3461edc424fcc83a94e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91217 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2018-12-18sw_redlinehide_4b: adapt FindFormat()Michael Stahl
Change-Id: I78cfca1cd629bf518f8294450a34ee228a360ef9
2018-12-18sw_redlinehide_4b: adapt FindAttrs()Michael Stahl
Iterate over merged nodes, and iterate over extents in them, so the complex attribute-finding logic doesn't need to be changed. Change-Id: Id72ca9247165a0c93f0cf2a38b7a0249771ca2eb
2018-12-18sw_redlinehide_4b: adapt FindText()Michael Stahl
Generally speaking, the find functions should find the strings that are visible in the document view. However, they may also be called from SwXTextDocument functions, where they ought to find the strings that are actually in the document model. So concoct some funny helper types and adapt this so it can handle both cases; it's not pretty but maybe it even works. Change-Id: I1917398ff928e922673353e75e8fb724dc042031
2018-12-18sw: refactor a confusing thicket of overloads, all named Find()Michael Stahl
Also, some of these don't really make much sense as member functions of SwPaM, so make them plain functions instead. Also, some pointer parameters are never null, but there is code to handle that case in MakeRegion(); simplify that. Change-Id: I822e814b0cab14f7f31cfa33478ed15774405a61
2018-12-05loplugin:unnecessaryparen include more assignmentsNoel Grandin
Change-Id: I9fb8366634b31230b732dd38a98f800075529714 Reviewed-on: https://gerrit.libreoffice.org/64510 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-15sw_redlinehide_3: adapt SwCursorShell::LRMargin/IsAtLRMarginMichael Stahl
Change-Id: I4576a464b37e786178a3cb31a0be922f1b55db88
2018-09-19sw_redlinehide_2: view cursor movement, Word/Sentence functionsMichael Stahl
E.g. Ctrl+Left/Right, Ctrl+Shift+Del/Backspace, double-click to select word... These are all implemented in SwCursor, so they need a layout passed to them from the SwViewShell. There was a bug in the while loop in SwCursor::GoSentence() case NEXT_SENT that triggered assert in the mapping code when the endOfSentence() returned the length of the SwTextNode but then it was incremented once more. Change-Id: Ic3866860a8c07774dce35952271c207eb6e7d182
2018-09-19sw_redlinehide_2: adapt SwCursor::UpDown()Michael Stahl
Actually it already works, this is just a clean up to pass in the SwCursorShell's layout... Change-Id: I1a90bbe9966c7f4d5b5e959122ca1f995df93a45
2018-09-19sw_redlinehide_2: view cursor movement, SwCursorShell::LeftRight()Michael Stahl
Just put a loop in SwCursor::LeftRight() to repeat a movement if it didn't actually advance the text frame index; the SwContentNode::GoPrevious()/GoNext() take into account hidden text attributes from SwScriptInfo, so this ought to result in end positions that are neither hidden by attributes nor by redlines. This requires passing the layout to SwCursor. Change-Id: Ieb623840f6390fa6f1c78b7458ad8dc6523a2744
2018-08-16remove mempoolNoel Grandin
we've been using the normal memory allocator instead of the sal slab allocator ever since commit bc6a5d8e79e7d0e7d75ac107aa8e6aa275e434e9 Date: Wed Nov 15 16:52:44 2017 +0530 Disable custom allocator Change-Id: I3383962cedb85d56fbec695398901f6ff7057651 Reviewed-on: https://gerrit.libreoffice.org/58577 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-04-Werror=deprecated-copy (GCC trunk towards GCC 9)Stephan Bergmann
It is apparently by "design" that SwCursor has a deleted copy ctor and non- deleted copy assignment op, see bdf3c9bff607e3977c8455927b21ba292530d25a 'sw: replace SwPaM's so-called "copy constructor'" and c23dd470d49d722197c148f4ef64a6a3350af88d "sw: same treatment for SwCursor's fake 'copy constructor'" Change-Id: I7c44dcf022fa3edbd371d5a19c547f6ebdc13204 Reviewed-on: https://gerrit.libreoffice.org/56934 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-06-07provide overrides of GetNext/GetPrev in SwPaM subclassesNoel Grandin
so we don't need to cast at the call sites. Also fix the type of mpExtInputRing in SwDoc Change-Id: I60794a4b5c24ca552eafa87b8810dc08efdee3ea Reviewed-on: https://gerrit.libreoffice.org/52455 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-28loplugin:countusersofdefaultparamsNoel Grandin
Change-Id: I84868b3115c534a8240394283cc3beedf8cb3a80 Reviewed-on: https://gerrit.libreoffice.org/53543 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-23loplugin:useuniqueptr in SwCursorNoel Grandin
storing a struct with two integer values in it, in a linked list, just seems inefficient Change-Id: I2913aa867cc978271d7778f06546d47fa6c57973 Reviewed-on: https://gerrit.libreoffice.org/51761 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-03-21sw: fix some IWYU warningsMiklos Vajna
Change-Id: I3682cc475de8342e4cdf122a35f6c1cfddd4c01e Reviewed-on: https://gerrit.libreoffice.org/51677 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-03-04Translate German variable namesJohnny_M
Akt -> Current in swcrsr Change-Id: I5c5dabefa6e2924620b8ab4829943b74dc7e6bcd Reviewed-on: https://gerrit.libreoffice.org/50665 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2017-11-27loplugin:countusersofdefaultparams in sw (2)Noel Grandin
Change-Id: Ibb045a0b7750cf6807d6f5caba86a9e6e59828ae Reviewed-on: https://gerrit.libreoffice.org/45237 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-23loplugin:includeform: swStephan Bergmann
Change-Id: Ifc3c4c31a31ee7189eeab6f1af30b94d64f2f92a
2017-08-03loplugin:constparams in sw part1Noel Grandin
Change-Id: Id8d8afe268a82585ec2d3699411073dfb905d6ba Reviewed-on: https://gerrit.libreoffice.org/40734 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-19tdf#106929 sw: SwCursorShell::Pop() ensure cursor ring is recreatedMichael Stahl
... from table cursor. The problem is that in this case, between Push() and Pop() there is no call to ClearMark() or any of the other functions that sets the SwTableCursor::m_bChanged flag, so MakeBoxSels() is never called for the m_pCurrentCursor after Pop() and there is no cursor ring selecting all table cells. (regression from b227a8e4d65e4bbfe991aed9342fe3e30eca8639) Change-Id: I5bce18b71fed60a926f4ddf9938dfb7d1ddf4e92
2017-03-01typesafe wrappers for css::i18nutil::TransliterationModulesNoel Grandin
and related css::util::SearchOptions2 The TransliterationModules enum has it's constants spread over multiple UNO enum/constant-collections - TransliterationModules and TransliterationModulesExtra, which means that most code simply uses sal_Int32. Wrap them up into a better bundle so that only the lowest layer needs to deal directly with the UNO constants. Change-Id: I1edeab79fcc7817a4a97c933ef84ab7015bb849b Reviewed-on: https://gerrit.libreoffice.org/34582 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-26loplugin: unnecessary destructor swNoel Grandin
Change-Id: I27dcd289177bd6a63f07d75fb3cfd5c14fa2ee9d Reviewed-on: https://gerrit.libreoffice.org/33572 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-29convert SwCursorSelOverFlags to o3tl::typed_flagsNoel Grandin
Change-Id: I399db07f508e5aeba005c8c6746cf5adc42702d2 Reviewed-on: https://gerrit.libreoffice.org/31350 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-07loplugin:unnecessaryvirtual in svx..swNoel Grandin
Change-Id: I4ae8de558550e6577c28b95e0aaed74f00d79c29 Reviewed-on: https://gerrit.libreoffice.org/30650 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-27loplugin:expandablemethods in swNoel Grandin
Change-Id: Ibc9edc28f4041235ab30c026bd3774bd74b7e960 Reviewed-on: https://gerrit.libreoffice.org/30287 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-13loplugin:override: No more need for the "MSVC dtor override" workaroundStephan Bergmann
The issue of 362d4f0cd4e50111edfae9d30c90602c37ed65a2 "Explicitly mark overriding destructors as 'virtual'" appears to no longer be a problem with MSVC 2013. (The little change in the rewriting code of compilerplugins/clang/override.cxx was necessary to prevent an endless loop when adding "override" to OOO_DLLPUBLIC_CHARTTOOLS virtual ~CloseableLifeTimeManager(); in chart2/source/inc/LifeTime.hxx, getting stuck in the leading OOO_DLLPUBLIC_CHARTTOOLS macro. Can't remember what that isAtEndOfImmediateMacroExpansion thing was originally necessary for, anyway.) Change-Id: I534c634504d7216b9bb632c2775c04eaf27e927e
2016-09-08loplugin:constantparam in swNoel Grandin
Change-Id: Ic49d1c3c7b57fb213964ddc21b0f774c762aad94
2016-08-31convert FindRanges to o3tl::typed_flags_setNoel Grandin
Change-Id: I745b2f469e44b79a06a18bc5264aae75b096835c
2016-08-31remove the SwMoveFnCollection* typedefsNoel Grandin
which were just obscuring the code, and pass it around by const& Change-Id: I4fce5ef4bf616867c46a145f660a8e90d3c94462
2016-08-19loplugin:countusersofdefaultparams in swNoel Grandin
Change-Id: I668bfe93d77b06385544651583bcf71f6b5df2fc
2016-04-22Avoid reserved identifiersStephan Bergmann
Change-Id: I27ff0f4f0eb395d7e0a60dd604758c220a3134c4
2016-03-22loplugin:constantparam in swNoel Grandin
Change-Id: I56925a8fd776b3ee787cc26adbaa08c58dd022c0
2016-02-24let SvxSearchItem use SearchOptions2Eike Rathke
And all those places that interface to SvxSearchItem. Change-Id: I08915824a596cd0f247a89f44e4684cd22b98082
2015-11-25bin/rename-sw-abbreviations.shlibreoffice-5-1-branch-pointRobinson Tryon
This commit renames the most annoying abbreviations in Writer (and partially in the shared code too). Change-Id: I77e5134f42f25e3786afa36b7a505c7e3237a9e8
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
Change-Id: I01e11fa956a249974e77dce9deebe79311f098d0