summaryrefslogtreecommitdiff
path: root/sw/source/core/fields
AgeCommit message (Collapse)AuthorFilesLines
2021-05-21sw: replace most static_cast<sal_uInt16>() calls with o3tl::narrowing()Miklos Vajna2-5/+5
o3tl::narrowing() is a better way to handle this, as that way the integer conversion is still implicit, which allows detecting integer truncation at runtime (with suitable compiler flags). Change-Id: I499abda3be6943e8c111c56df390e72939586221 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115948 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-05-03loplugin:stringadd improvement for appending numbersNoel Grandin1-3/+3
I was wrong, the Concat framework already optimised appending numbers by stack-allocating small buffers, so include them in the plugin Change-Id: I922edbdde273c89abfe21d51c5d25dc01c97db25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115037 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-02throw() -> noexcept, part 2/3: Automatic loplugin:noexcept rewriteStephan Bergmann1-1/+1
Change-Id: I076f16d0536b534abf0ced4d76051eadb4c0e033 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114949 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-04-28sw bibliography: fix warning when de-selecting a biblio entry fieldMiklos Vajna2-6/+8
De-selecting a biblio entry field resulted in this warning: warn:sw.core:3311:3311:sw/source/core/fields/authfld.cxx:104: SwAuthorityFieldType::RemoveField: pEntry is not my field But this was even an assert before commit 64ffabbdb2725e93de997171708bb31c33c93a55 (sw bibliography, refer to a page: make the biblio field clickable, 2021-03-12). It seems the root of the problem was: - SwAuthorityFieldType has a list of SwAuthEntry instances that its SwAuthorityFields may have - when the field is selected, we copy the selection to a clipboard document, using SwFEShell::Copy() - this calls SwAuthorityFieldType::AppendField() to register the SwAuthEntry, but that registers a copy instead - SwAuthorityFieldType::RemoveField() then asserted that the original SwAuthEntry is part of SwAuthorityFieldType's list, but it was not Fix the problem by returning a reference to the copied SwAuthEntry in SwAuthorityFieldType::AppendField(), that fixes the warning and then we can turn this back to an assert, to detect problems where an unregistered SwAuthEntry would be de-registered. In practice this caused a problem in the Insert Bibliography Entry dialog: bibliography source = document content case uses SwAuthorityFieldType::GetAllEntryIdentifiers() to provide a list of sources, and this way sources were not removed from that list when deleting biblio entry fields. Change-Id: Iea4fa44302aaac0daa122bbf227888d1dbb06597 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114765 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-04-27loplugin:stringadd convert chained append to +Noel Grandin1-7/+7
which can use the more efficient *StringConcat Also fix a crash in stringview plugin which started happening while I working on this. Change-Id: I91a5b9b7707d1594d27d80b73930f5afac8ae608 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114568 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-22no need to create temporaries when appending number to O[U]StringBufferNoel Grandin1-6/+6
Change-Id: I36d82423b5f75010552696a66cec7e53ee265ce4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114395 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-21loplugin:stringadd replace OUStringLiteral temporaries with OUString::ConcatNoel Grandin1-1/+1
Change-Id: I656f06a74d9f0180ae460264563d6a935c7d2c60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114377 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-20use OUString::Concat here, not OUStringLiteralNoel Grandin1-1/+1
Change-Id: Ia2172bcab60f32c9d9d4f6ca0230484343eef69b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114321 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-13sw bibliography, refer to a page: fix biblio field relative URLsMiklos Vajna1-0/+12
Clicking always requires an absolute URL, so add functionality to get the absolute URL (even if the field has a relative one) and use that when handling a click. Change-Id: I05f8b11937eac7b6032750557f4066181c6e4520 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114059 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-03-19silence coverity unchecked return value from library on xmlText* functionsCaolán McNamara4-44/+44
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>
2021-03-18tdf#140980 sw: fix bad strikethrough of annotationsLászló Németh1-1/+16
Not deleted annotation windows got a bad strikethrough in ChangesInMargin mode, if they annotate tracked deletions. Also clean-up commit a001a66ba27e2fe9a485388869d53f001f2b09af (tdf#140982 sw ChangesInMargin: fix annotation ranges). Change-Id: I06cb88113bf038c09702b6ef33e46c94c963730d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112672 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2021-03-12sw bibliography, refer to a page: make the biblio field clickableMiklos Vajna2-2/+16
- add support for this in SwWrtShell::ClickToField() - restrict this to ctrl-click by default (similar to hyperlinks) - ignore empty URLs - extend the tooltip to hint the URL - change pointer to hint that the field is clickable - downgrade the assert to SAL_WARN in SwAuthorityFieldType::RemoveField(), that currently fires every time a biblio field is de-selected Change-Id: I3b4a12d8a7661f7d8d41804f104505c7594debd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112400 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-03-01sw doc model xml dump: show SwAuthEntryMiklos Vajna1-0/+19
To see the author/title/etc of bibliography fields. Change-Id: Ia466c96d3d17b52b94a85070edd023a0579e970a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111732 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-02-26sw doc model xml dump: show SwAuthorityFieldMiklos Vajna1-0/+23
Towards seeing the actual contents of these bibliography references. Change-Id: I9f7b623a551adf9fd3f3a5ba4e376676c891bc04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111630 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-02-15loplugin:referencecasting in swNoel1-1/+1
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-11sw tooltip on bibliography fields: add the actual tooltip functionalityMiklos Vajna1-0/+48
- Similar to e.g. SwMacroField::GetMacro(), add a new SwAuthorityField::GetAuthority() that returns a string which is similar to the one-liner text node in the bibliography table for a given bibliography reference. - Base this on the recently added SwAuthorityFieldType::CreateTOXInternational() and SwTOXAuthority::GetText() to share code with sw::ToxTextGenerator::GenerateText() and SwTOXBaseSection::Update(). - Finally extend SwEditWin::RequestHelp() to actually provide the tooltip on mouse hover. Change-Id: I33a58076c6d141566298259e7e4681541fac1055 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110765 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-02-10sw tooltip on bibliography fields: add an SwTOXInternational factoryMiklos Vajna1-3/+8
This is normally created in SwAuthorityFieldType::GetSequencePos(), but this way the logic can be reused when creating an SwTOXAuthority outside SwTOXBaseSection::Update(). Towards providing a tooltip on mouseover for bibliography reference fields. Change-Id: Ide15d0e30223ca40514439c3f3c506651228c69b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110705 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-01-28simplify code, use more subView()Noel1-2/+2
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-26loplugin:passstuffbyrefNoel1-1/+1
Change-Id: I330e0ab6c9955939dad313f9d472f93e39dbd313 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109924 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-11Revert "Revert "NotifyClients no more""Bjoern Michaelsen1-2/+2
- ... and ensure caching gets checked in SwFormat this time. This reverts commit d988b0cdeb54d84a0347a036a277c21c12544ab9. Change-Id: Iea887f841c47cde4a025a305eb0984392e3bb5cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109037 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2021-01-05Revert "NotifyClients no more"Stephan Bergmann1-2/+2
This reverts commit 96bafa464ebdbce3ef04bec9beae5e745bb37794. It started to cause an ASan heap-use-after-free during CppunitTest_sw_uiwriter, see the comments starting at <https://gerrit.libreoffice.org/c/core/+/108604/ 5#message-681a6100cff11cb51d20e5a2b2fb38da1f92ab32> "NotifyClients no more". Change-Id: Id0eef2e75ea047d4b337c51df929eea81fb69f5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108717 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-01-04loplugin:stringviewparam: operator +=Stephan Bergmann1-2/+2
Change-Id: I30ce1b5bd8fb168da7067c1967c5af2569df2653 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108512 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-01-03NotifyClients no moreBjoern Michaelsen1-2/+2
... and prevent recursive invalidation in SwAnchoredObject. Change-Id: I6f386f3ffded29663fcc74c2679b76c1b839f367 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108604 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-12-26Remove pointless macroGabor Kelemen1-3/+1
DDE_TXT_ENCODING is just an alias since 2008 commit a190965485508c4493ee33228dae68e12cd858f9 and commit cc141699cc6b2fa38b0b0003bff27751e23ae8e4 Change-Id: I2ca32871c13bd3837f173e5f9f959f364857de52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108330 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-09cid#1470573 Unchecked dynamic_castCaolán McNamara1-1/+1
Change-Id: I8489d82a293dc194dac183d3a117f4e256eb8043 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107457 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-12-07SwUserFieldType: Modify no moreBjoern Michaelsen1-6/+6
Change-Id: I1194225011380bf63d854f8054d063e93a832744 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107322 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-12-07Sw{Get,Set}ExpFieldType: Modify no moreBjoern Michaelsen1-4/+6
Change-Id: Id0daf2aa04663127dcbd78d2206d81aab6a783f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107321 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-12-07SwRefPageSetFieldType: Modify no moreBjoern Michaelsen1-4/+7
Change-Id: I313237069eeafd5913468e18e2eb34e9ef185302 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107320 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-12-07SwAuthorityFieldType: Modify no moreBjoern Michaelsen1-2/+2
Change-Id: I59f1e5d25c0defa3b551061fccfeea625d0df3aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107319 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-12-06SwDDETable: Modify no moreBjoern Michaelsen1-11/+13
Change-Id: I6b9bd54835ba6abc4ab9184c49c684d9c387bda4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107268 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-11-30loplugin:stringviewparam include comparisons with string literalsNoel1-5/+5
Change-Id: I8ba1214500dddaf413c506a4b82f43d63cda804b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106559 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-24tdf#42949 Fix new IWYU warnings in directory swGabor Kelemen8-8/+4
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 operatorsNoel2-2/+2
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-21SwEditShell: remove SwIterator hackBjoern Michaelsen1-1/+5
Change-Id: I27facf6490241e6978c848f80acb8e07d7b91144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106210 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-11-17sw_fieldmarkhide: replace IsHideRedlines() with HasMergedParas()Michael Stahl1-1/+1
... 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-16Replace needless SwClientNotifyCalls with CallSwClientNotifyBjoern Michaelsen1-22/+31
Change-Id: I967d458be7cd7c68ff410357da0cb0163dcb454e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105908 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-11-11convert more long -> tools::LongNoel1-2/+2
found by grepping and changed by hand. Change-Id: I3c720859dba430fde3abc76c6c5cb58269efaf4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105512 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-11Fix typosAndrea Gelmini1-2/+2
Change-Id: Ice850a7929c5b88ca0c4da52504aa959aacd1024 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105548 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Bjoern Kirchhoff <Bjoern.Kirchhoff@escriba.de>
2020-11-10sw user field type: fix failing string to double conversionkirchhoffb1-6/+18
For converting a string to a double, we need to know the language of the string. We should not assume, that this language is always the system locale, because the system locale can change during a session. Change-Id: Ic851d7430bba7392c7e2c8b36912467eee935f9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96776 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-05Ensure no class directly derives from SwModifyBjoern Michaelsen1-1/+1
- make all classes that used to be SwModify to be sw::BroadcastingModify's - this makes sure they are all sw::BroadcastMixin too, so all clients of SwModify can be migrated over to use sw::BroadcastMixin (only) instead Change-Id: Idd217b98f9c20f01e0788bc65af796050dbb5699 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105207 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-11-02SwFieldType: ModifyNotification no more ...Bjoern Michaelsen1-0/+12
Change-Id: Idb6c0a6cca5df729037067f6def5594eed2cca19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105178 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-11-01sw/source/core/doc: Stop abusing observer pattern for code obfuscation.Bjoern Michaelsen1-1/+1
The old SwClient/SwModify combo is a questionable implementation of the observer pattern (among other things). The one thing the observer pattern is good for is dependency inversion: The creator of the message does not need to know the type of the receiver. Calling the message handling on the receiver directly introduces tight coupling and entirely defeats the purpose, leaving us with the worst of both worlds. In such case, at least be honest about the tight coupling and call a somewhat more explicit member function of the target. Thus introduce SwFootNoteInfo::UpdateFormatOrAttr, SwContentNode::UpdateAttr, remove some useless SwFormatChg clutter in Set{Foot,End}NodeInfo, and check for some invariants in SwContentNode::SwClientNotify to limit some of the "a message are two void pointers" madness. Change-Id: I32a8d6973231bb5f65c9e144be72d5bcf98f3f44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105104 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-10-20use tools::Long in swNoel4-7/+7
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-10-06loplugin:const* make some params and methods constNoel1-1/+1
Change-Id: I3c8ca72b2b41a4f82ee20cbe025b41425f32e715 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104028 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-05SwGetRefFieldType ctor never passed a null SwDoc*Caolán McNamara1-17/+17
ditto: SwFEShell::Copy SwEditShell::Copy SwFEShell::CopyDrawSel SwFEShell::Paste SwChartDataProvider ctor ResetInDoc family Change-Id: I2d1544c09919f0e566fadc04d3b160b18ea62fc7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103957 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-10-05SwDateTimeField::GetDateTime always dereferences its SwDoc*Caolán McNamara2-7/+7
ditto: SwXFrameEnumeration ctor lcl_ReAssignTOXType Change-Id: Idaa6bef29cbc4c3a08d578ef4bedcaa071547944 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103928 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-10-05Evaluate family never passed a null SwDoc*Caolán McNamara4-57/+56
ditto: SwTemplNameFieldType ctor lcl_RestoreRedlines never passed a null SwDoc* lcl_InsAttr SwFileNameFieldType ctor SwRefPageGetFieldType ctor SwJumpEditFieldType ctor SwPostItFieldType ctor SwScriptFieldType ctor SwMacroFieldType ctor Change-Id: I61fa1b0e5fba16f9d1be1880dde6c487dca88374 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103927 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-30loplugin:reducevarscope in swNoel1-4/+2
Change-Id: Ifed7220c6acf7049b2985f1911a806b37a54d794 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103646 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-09-30SwNode::GetDoc can return a reference insteadCaolán McNamara5-10/+10
and remove discovered redundant null checks Change-Id: I6b8bc9593434f38947e399a48888a8fa0d4f7e77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103640 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-28sw: prefix members of SwFrameChangesLeave, SwSidebarItem, ...Miklos Vajna2-7/+7
... SwSizeEnterLeave and SwTextAPIObject See tdf#94879 for motivation. Change-Id: Iea12ac975b68700488f7b39bbb3596a011159c61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103528 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins