161 Commits
Author SHA1 Message Date
Xisco Fauli 00aebb5e88 loplugin:unusedmethods
Change-Id: I5eec1b68efc285995db3b5825699c07fa006cb35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207375
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-29 10:16:53 +02:00
Armin Le Grand (collabora) 82f3257285 Undo/Redo: Repair SetUndoComment
In commit 93aa742ba3 which is
20 years ago 'cl' did a big change to get to SfxUndoManager
which is a needed abstraction for the formally Svx-based
Undo/Redo stuff.
Unfortunately SdrModel::SetUndoComment was *not* supported
and this was expressed as just doing a

OSL_FAIL("svx::SdrModel::SetUndoComment(), method not supported with application undo manager!" );

in SdrModel::SetUndoComment when SfxUndoManager was used.
But SetUndoComment *is* used in nine cases in
svdraw/svdedtv2.cxx. All of these execute some action and
create Undos for it. All nine Undos were without any Undo
text since then - over 20 years...

I stumbled over that when adding needed Diagram stuff to
UnGroupMarked().

I fix this with this commit. Creating that fix showed me
why 'cl' intentionally did not support that, but just
abandoning functionality is not a good choice.

Signed-off-by: Armin Le Grand (collabora) <Armin.LeGrand@collabora.com>
Change-Id: Idde2fcecc85a9eee39b62d38ed7d71a8cfbd3288
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2486
Reviewed-by: Armin Le Grand <armin.legrand@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 5adf090261d705123074a0fa1c46119b2bf44bf3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206022
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-05 12:42:59 +02:00
Tomaž Vajngerl 4edaca7c38 switch some dumpAsXml functions to use tools::XmlWriter
Change-Id: I6bcda888f578ec52c05a575df56c4c267ad82ccc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195169
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2025-12-08 09:01:03 +01:00
Gabor Kelemen 4d24007632 tdf#146619 Run IWYU again on include/svl/
Change-Id: I5dc8757a6d06ab6917a9af733550295008fde5b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193914
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
Tested-by: Jenkins
2025-11-29 13:59:05 +01:00
Noel Grandin a368b4321a tdf#136238 Speedup deleting a very very large cross page table
We have a very large nested/list action here, which means
that RemoveOldestUndoAction() cannot do anything, and we spin
in the loop in sw::UndoManager::AddUndoAction

So we need to break out of that loop in this situation, which
makes the delete almost instantaneous.

Change-Id: Ia2bd9c0fd00c6551e99ae09154ecf0f680b9fcea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182748
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-03-11 08:16:39 +01:00
Noel Grandin 148fa9e940 tdf#157130 undo and track changes not restoring characters (macOS)
Not sure about the real underlying issue here.

In debug mode, we hit this assert. Changing it from an assert to a "do decrement mnEmptyMark if it would become negative" seems to help.

Change-Id: Ie23a685552d2f8153b67e18f9c0203ecbaad0ede
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174905
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-10-24 10:54:08 +02:00
Justin Luth 09df48f87f tdf#161741 undo nits: NeedsClearRedo is private + prioritize TopLevel
moNeedsClearRedo is an implementation detail,
so there should not be public functions for it.

Plus, NeedsClearRedo can be called either against
the CurrentLevel stack or the TopLevel stack
(whatever that implies - there is no documentation...)
and since it is a delayed call that means that
multiple NeedsClearRedo attempts could be made,
theoretically against both stacks.

My initial implementation was "last one wins",
(which may very well prove to be the best one)
but whatever happens, it should be clearly intentional.
Based on my limited skill at code reading,
it sounds like CurrentLevel might be more of an implemention detail
or a temporary expansion of a ListUndoAction,
so I am guessing that any request for TopLevel clearing
should be given priority.

For Writer, it is always clearing the TopLevel stack
  sw/source/core/undo/docundo.cxx: ClearRedo()
    return SdrUndoManager::ImplClearRedo_NoLock(TopLevel);

Change-Id: I195aefb696599f018712135a2e015549d534791f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171984
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-by: Justin Luth <jluth@mail.com>
2024-09-06 08:42:31 +02:00
Justin Luth 0a9da9e43c tdf#161741 tdf#161705 undo: delay ClearRedo until Undo finishes
I know NOTHING about the intricacies of Undo/Redo.
However, this is my feeble attempt to add some sanity to it.
It should not be the responsibility of the caller
to know when they are allowed to call ClearRedo.

This patch reverts commit 0cd000bb83
author  Daniel Arato (NISZ) on Mon May 10 15:41:28 2021 +0200
    tdf#141613 sw: avoid possible crash when undoing header creation
which was not a sufficient hack.

I hope this patch lays a better framework
to handle future similar issues.

vvv NAIVE OPTIMIST ALERT vvv

mbDoing was added with
commit 9cb53122e9
Author: Frank Schoenheit on Fri Oct 22 15:00:39 2010 +0200
    undoapi: more I/SfxUndoManager changes
    in preparation of new Undo API features

and has been untouched since then AFAICS,
and there was never any mechanism to change mbDoing.
In other words, it has been sitting there doing NOTHING.

So, I am taking it over and using it how I imagine it was intended,
and how it is documented.

Change-Id: I7aa355cc6458ac8ba34ddb9ee73fc850dcbca702
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170793
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-08-16 09:03:26 +02:00
Mike Kaganski 466156f14d Use osl::ResettableMutexGuardScopedReleaser instead of ad-hoc guards
Change-Id: I2aa09655c207d3647650b5e38011a600bd221699
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165777
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-04 13:21:14 +02:00
Mike Kaganski b049ee456f cool#8443 let Insert Chart dialog to undo out of order on Cancel
Change-Id: I66d749362c9fb5f2c228f0f5d2c927cc0cf3f89f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164179
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-03-14 13:21:47 +01:00
Caolán McNamara b50df5aa72 Resolves: tdf#134308 if max undo is 0, treat as if no undo
Change-Id: I7eaa71d80718a4350ba6a3d7ff19ce09e1ac3aa3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151354
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-05-04 15:14:53 +02:00
Noel Grandin f712c53133 loplugin:unnecessarygetstr extend to checking std::string::c_str
Change-Id: I17398e2a6a31a2c98ba8e54b5c8045f22aee8759
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150749
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-21 21:46:09 +02:00
Stephan Bergmann 91ba9654ba Move tools/diagnose_ex.h to comphelper/diagnose_ex.hxx
...so that its TOOLS_WARN_EXCEPTION can be used in
comphelper/source/misc/logging.cxx in a follow-up commit.  (And while at it,
rename from diangose_ex.h to the more appropriate diagnose_ex.hxx.  The
comphelper module is sufficiently low-level for this immediate use case, so use
that at least for now; o3tl might be even more suitable but doesn't have a
Library until now.  Also, for the immediate use case it would have sufficed to
only break DbgGetCaughtException, exceptionToString, TOOLS_WARN_EXCEPTION,
TOOLS_WARN_EXCEPTION_IF, and TOOLS_INFO_EXCEPTION out of
include/tools/diagnose_ex.h into an additional new
include/comphelper/diagnose_ex.hxx, but its probably easier overall to just move
the complete include file as is.)

Change-Id: I9f3222d4ccf1a9ac29d7eb9ba1530d53e2affaee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138451
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-08-18 17:10:19 +02:00
Mike Kaganski ab12ae777b A bit of RAII
Change-Id: I58fb16f7e2c4c30212605b667cfd3f79a3dc7d4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137400
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-07-25 12:13:26 +02:00
Noel Grandin 5a6b4b4f28 clang-tidy modernize-pass-by-value in svl
Change-Id: I184efd7aee2c3eb02399100a4a7500951255d423
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135357
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-03 18:32:32 +02:00
Miklos Vajna 2a8506c2f2 svl: use std::rotate() in SfxUndoManager::ImplUndo()
Instead of manually moving out, moving a range and then moving in.

Change-Id: Iaff461e1fcee3936c8ddc02bf471a804e7881aef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125219
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2021-11-15 11:39:56 +01:00
Miklos Vajna 39f2313600 sw, out of order undo: allow multiple actions from other views
Previously we assumed that the action to be executed is always exactly
the top of the undo stack minus 1 element.

Extend this, so that in case an other view appends two or more elements
to the undo stack, we still find our undo action. Obviously only do this
if all those undo actions are independent from us.

This requires replacing the swap in svl/ with a move-out + move a range
down + move in construct.

Change-Id: Ic12d32d6eb5e77618d99eddb4fa096802f32d655
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125076
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2021-11-12 12:46:22 +01:00
Miklos Vajna 2875c65946 sw, out of order undo: allow a subset of a non-empty redo list
Specifically, we used to not allow out of order undo at all if the redo
list was non-empty. This relaxes that condition a bit. Out of order undo
is OK with a non-empty redo list, in case all undo actions in the redo
list are either

1) owned by the current view or

2) independent from the undo action to be executed

I.e. if view1 has lots of type undo actions and an view2 adds a
single type undo action on top of it, then allow view 1 to execute
multiple of its typing undo actions, not just a single one.

Change-Id: I2f5d9404a9994ed74b65233d2a315976c27b28b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125023
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2021-11-11 09:57:20 +01:00
Miklos Vajna 8e8e72f08b sw: allow undo of typing in 2 views independent from each other
Undoing out of order is dangerous by default, so limit this to a very
specific case as a start, that allows growing in follow-up commits.

For now, allow out of order undo if:

1) redo stack is empty

2) we're in LOK mode (different views represent different users)

3) we undo a single action (count is 1)

4) the top undo action doesn't belong to the current view

5) the top and the previous undo actions are independent

Which only requires that SwUndoInsert::UndoImpl() is independent for two
different paragraphs, which seems to be the case.

Independent undo actions opt in for this, currently the only such
allowed undo action is SwUndoInsert ("typing"), which adds characters to
a single text node. Even those are only considered independent if they
operate on different text nodes.

On the positive side, this allows out of order undo in the frequent case
where two users collaborate on a long document and they just type some
new content into the document at different paragraphs.

Change-Id: Ibb4551e8f7046b4947491b8bf751eaa0cbb2d060
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124949
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2021-11-10 09:37:36 +01:00
Noel Grandin 58364e04cc clang-tidy:readability-redundant-member-init
Change-Id: I6a2a36c28fafac7002fbe093b22ad186562ea5c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121543
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-03 09:56:59 +02:00
Noel Grandin c4ff09fc8c flatten SfxUndoManager_Data a little
no need to allocate the SfxUndoArray separately

Change-Id: I5866ee1382d0be22b71a7322fe4379d3e159f488
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119894
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-02 21:18:26 +02:00
Caolán McNamara f8538ec496 cid#1473798 silence Unchecked return value from library
Change-Id: I00174b5444749f3345f5691e24eb5219d1b47059
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112837
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-03-21 20:43:51 +01:00
Caolán McNamara 7a5014b24e silence coverity unchecked return value from library on xmlText* functions
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-19 21:07:04 +01:00
Gabor Kelemen 107399d684 tdf#42949 Fix new IWYU warnings in directories s*
Except recently checked sc, sd, svx, sw

Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: Ice1b86628e4f22a39f307b9c5fa567b6ab9d5acb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106917
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-12-01 14:56:43 +01:00
Noel 73b115b1a3 use tools::Long in svl
Change-Id: Ic63d3c0ebd1e58d7bab5b0fd6313cabddc16eb98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104517
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-19 13:52:32 +02:00
Xisco Fauli 0b3ff97d7d tdf#136728: Revert "tdf#136238 speed up deleting large cross page table"
This reverts commit da5c289a9c.

Change-Id: Ic6a77ec2cd3b502fb4e94159a0424340850590df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103665
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-01 20:54:53 +02:00
Noel Grandin da5c289a9c tdf#136238 speed up deleting large cross page table
Goes from more than 30s to less than 1s on my pc.

We were getting stuck inside the loop in sw::UndoManager::AddUndoAction,
because the RemoveOldestUndoAction was continually doing nothing because
it was hitting the
  if ( IsInListAction()
  {
assert(!"SfxUndoManager::RemoveOldestUndoActions: cannot remove a
not-yet-closed list action!");
    return;
 }

code.

Which means that there is some bug here, but I'm not sure what. We are
deep inside the delete logic at that point, and it doesn't seem
unreasonable to opportunistically delete some of the UNDO list at that
point.

So the real fix is just the conversion from a while loop to an if-check.

Change-Id: Ie2707009dd6574b996421f67d952ab9fdaaaf6aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102378
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-09-10 16:02:49 +02:00
Gabor Kelemen d3e1ada454 Remove unused using declarations in oox...xmlsecurity
Found by:
run-clang-tidy-10 -checks=-*,misc-unused-using-decls

Change-Id: I3e95791e223ef01e140a6217e29a9efae428a784
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90876
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-03-25 09:13:27 +01:00
Noel Grandin df3e1b7bbd Revert "loplugin:constfields in svl"
This reverts commit 5181253946.

Change-Id: I30e30aae45c33824c0df823a9fad710faa81ea3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90453
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-13 19:21:01 +01:00
Noel Grandin c82efb610b clang-tidy modernize-concat-nested-namespace
Change-Id: Iab35a8b85b3ba1df791c774f40b037f9420a071a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86708
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-31 18:36:09 +01:00
Stephan Bergmann f853ec317f Extend loplugin:external to warn about classes
...following up on 314f15bff0 "Extend
loplugin:external to warn about enums".

Cases where free functions were moved into an unnamed namespace along with a
class, to not break ADL, are in:

  filter/source/svg/svgexport.cxx
  sc/source/filter/excel/xelink.cxx
  sc/source/filter/excel/xilink.cxx
  svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx

All other free functions mentioning moved classes appear to be harmless and not
give rise to (silent, even) ADL breakage.  (One remaining TODO in
compilerplugins/clang/external.cxx is that derived classes are not covered by
computeAffectedTypes, even though they could also be affected by ADL-breakage---
but don't seem to be in any acutal case across the code base.)

For friend declarations using elaborate type specifiers, like

  class C1 {};
  class C2 { friend class C1; };

* If C2 (but not C1) is moved into an unnamed namespace, the friend declaration
must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see
C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither
qualified nor a template-id and the declaration is a function or an
elaborated-type-specifier, the lookup to determine whether the entity has been
previously declared shall not consider any scopes outside the innermost
enclosing namespace.")

* If C1 (but not C2) is moved into an unnamed namespace, the friend declaration
must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882>
"elaborated-type-specifier friend not looked up in unnamed namespace".

Apart from that, to keep changes simple and mostly mechanical (which should help
avoid regressions), out-of-line definitions of class members have been left in
the enclosing (named) namespace.  But explicit specializations of class
templates had to be moved into the unnamed namespace to appease
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of
template from unnamed namespace using unqualified-id in enclosing namespace".

Also, accompanying declarations (of e.g. typedefs or static variables) that
could arguably be moved into the unnamed namespace too have been left alone.

And in some cases, mention of affected types in blacklists in other loplugins
needed to be adapted.

And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which
is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is
not moved into an unnamed namespace (because it is declared in
sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is.  GCC warns about
such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler
doesn’t give this warning for types defined in the main .C file, as those are
unlikely to have multiple definitions."
(<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>)  The
warned-about classes also don't have multiple definitions in the given test, so
disable the warning when including the .cxx.

Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4
Reviewed-on: https://gerrit.libreoffice.org/83239
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-22 12:57:32 +01:00
Noel Grandin 4b995afda3 loplugin:virtualdead in svl
Change-Id: Idbb5d0a633f12d5813561a2ad8aed46ec6d67c48
Reviewed-on: https://gerrit.libreoffice.org/79639
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-27 14:50:11 +02:00
Andrea Gelmini d4cea44bf2 Fix typos
Change-Id: I359ac987daa01e624bdf889c319eeb660f88bbfd
Reviewed-on: https://gerrit.libreoffice.org/77260
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-08-12 10:38:49 +02:00
Mike Kaganski f591bf522d tdf#125030: Prevent double-clearing the guard
... discovered after after commit d38f9934f0.

Change-Id: I09bcee0053d1a5132483c933a903f006a236a679
Reviewed-on: https://gerrit.libreoffice.org/71550
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-04-29 20:56:09 +02:00
Arkadiy Illarionov 260002b16f Simplify containers iterations in svgio, svl, svtools
Use range-based loop or replace with STL functions

Change-Id: I98a3e55a14c8ac00188c5003f84194c2cc6795fb
Reviewed-on: https://gerrit.libreoffice.org/63959
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-25 12:29:05 +01:00
Noel Grandin 9375e542f2 use unique_ptr in markForDeletion
Change-Id: I10e5ad02243c7045d51191c735163ee4a027126e
Reviewed-on: https://gerrit.libreoffice.org/62695
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-01 06:44:46 +01:00
Noel Grandin 15c86cadad rename RemoveX->Remove in SfxUndoArray
accidentally left it this way when doing
    commit 19e715973e
    Date:   Mon Oct 29 16:15:27 2018 +0200
    loplugin:useuniqueptr in MarkedUndoAction

Change-Id: I250676df7af27f485c5d34281ef0da1e127eb24c
Reviewed-on: https://gerrit.libreoffice.org/62694
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-01 06:44:26 +01:00
Noel Grandin 19e715973e loplugin:useuniqueptr in MarkedUndoAction
Change-Id: Ic06b990112df5bc135cfd7af6f1129580f294428
Reviewed-on: https://gerrit.libreoffice.org/62509
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-30 09:28:07 +01:00
Noel Grandin f7ce839c78 use unique_ptr in SfxUndoManager::AddUndoAction
Change-Id: I11483e3cece12a7373f4276972b4c899edf1ce15
Reviewed-on: https://gerrit.libreoffice.org/61566
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-09 12:09:55 +02:00
Noel Grandin 5181253946 loplugin:constfields in svl
Change-Id: I18183c5c257cbe69bd067d4e74c50483ae683cf3
Reviewed-on: https://gerrit.libreoffice.org/61509
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-08 10:25:31 +02:00
Noel Grandin 9fe3839fed flatten SfxUndoArray
there is really no need to point to an impl which points to a
std::vector

Change-Id: I73c47cf3056a24d909e77b9b4cf9d9ae57c19c04
Reviewed-on: https://gerrit.libreoffice.org/60588
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-19 08:45:08 +02:00
Stephan Bergmann 206b5b2661 New loplugin:external
...warning about (for now only) functions and variables with external linkage
that likely don't need it.

The problems with moving entities into unnamed namespacs and breaking ADL
(as alluded to in comments in compilerplugins/clang/external.cxx) are
illustrated by the fact that while

  struct S1 { int f() { return 0; } };
  int f(S1 s) { return s.f(); }
  namespace N {
    struct S2: S1 { int f() { return 1; } };
    int f(S2 s) { return s.f(); }
  }
  int main() { return f(N::S2()); }

returns 1, both moving just the struct S2 into an nunnamed namespace,

  struct S1 { int f() { return 0; } };
  int f(S1 s) { return s.f(); }
  namespace N {
    namespace { struct S2: S1 { int f() { return 1; } }; }
    int f(S2 s) { return s.f(); }
  }
  int main() { return f(N::S2()); }

as well as moving just the function f overload into an unnamed namespace,

  struct S1 { int f() { return 0; } };
  int f(S1 s) { return s.f(); }
  namespace N {
    struct S2: S1 { int f() { return 1; } };
    namespace { int f(S2 s) { return s.f(); } }
  }
  int main() { return f(N::S2()); }

would each change the program to return 0 instead.

Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c
Reviewed-on: https://gerrit.libreoffice.org/60539
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-17 09:05:38 +02:00
Noel Grandin 2d71dd52b6 merge IUndoManager into SfxUndoManager
SfxUndoManager is the only implementation of the IUnderManager
"interface", and it lives in the same header.
Plus this way we can get rid of some covariant parameters,
which will make using std::unique_ptr easier.

Change-Id: I6661b9876b18da830bead78794d237886cd3c5c9
Reviewed-on: https://gerrit.libreoffice.org/57317
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-13 08:39:15 +02:00
Stephan Bergmann dead6b3a94 More loplugin:cstylecast: svl
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: I71e3b2c9b4c68183288f43999d242e95ae13584d
2018-01-12 20:14:44 +01:00
Noel Grandin ccf986a77a loplugin:useuniqueptr in svl
Change-Id: I2fdb63517349474d90cb17ad2bd667f30840e83d
Reviewed-on: https://gerrit.libreoffice.org/47727
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-11 14:50:11 +01:00
Henry Castro 6fd6e3c1d3 lokit: add .uno:DocumentRepair command
Change-Id: I5b13ea6f4785bc91c29111fa63c4a1b0ea9b2660
Reviewed-on: https://gerrit.libreoffice.org/38908
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Henry Castro <hcastro@collabora.com>
2017-12-07 19:14:18 +01:00
Julien Nabet ebfdb9a15a Replace lists by vectors in svl
+ remove using namespace std and use prefix std::

Change-Id: Iab432f2c88ba5a15541bd97567682c6a34b0af2e
Reviewed-on: https://gerrit.libreoffice.org/43471
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-18 08:43:43 +02:00
Noel Grandin 48b200a0a2 clang-tidy modernize-use-emplace in svgio..svtools
Change-Id: I4f3b0762e197d5397e723aba1dc43e3c857be145
Reviewed-on: https://gerrit.libreoffice.org/42193
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-12 13:15:40 +02:00
Noel Grandin e669f70613 loplugin:constparams in i18npool,opencl,svl
Change-Id: I23368c3ce6d29c7b2e758e209e5a8315e82a2818
Reviewed-on: https://gerrit.libreoffice.org/40051
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-18 08:19:59 +02:00
Jochen Nitschke c4ddf6cd6d C++11 remove std::unary_function bases from functors
std::unary_function is deprecated since C++11 and removed in C++17

90% done with regexp magic.
removed obsolete <functional> includes.

The std::unary_function base class was used in 3 places:
* chart2/source/tools/DataSeriesHelper.cxx: lcl_MatchesRole
   is used in a std::not1 function helper who uses the members
   return_type and argument_type.
   - replace deprecated std::not1 with a lambda
* chart2/source/tools/ModifyListenerHelper.cxx:
   lcl_weakReferenceToSame used the argument_type member in the
   operator() parameter.
   - inline the parameter type.
* xmloff/source/chart/SchXMLExport.cxx: lcl_SequenceToMapElement
   used result_type and argument_type in operator().
   - inline the types

Also fix compile error with gcc about finding std::for_each.

Change-Id: I073673beb01410c3108e7d0346d9e7d6b9ad2e2f
Reviewed-on: https://gerrit.libreoffice.org/39358
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-07-03 12:21:03 +02:00