Commit graph

629 commits

Author SHA1 Message Date
Noel Grandin
fcaf6cee08 loplugin:ostr in vbahelper
Change-Id: I7763dd628ba3d4288e52b51e08a5af301f916c1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167621
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-14 15:14:51 +02:00
Stephan Bergmann
d98e014cf6 Extended loplugin:ostr manual changes
I had done these a while ago, when I looked into extending loplugin:ostr to do
more automatic rewriting, and these were places where I needed to do something
manually, for one reason or another, because the automatic rewriting would not
pick it up correctly.

However, I got distracted, and a wholesale automatic rewrite would still run
into cases where an _ostr/_ustr instance from a library's .rodata would still be
referenced after the library has already been dlcose'd.  So I never came around
to finishing all that.

But there appears to be renewed interest in (automatic) rewritings here now, so
it probably makes sense if I share this part of my work anyway.

Change-Id: I3da9d38398e4bca373cb0000a9d34b49a36ad58a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166792
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
2024-04-28 11:29:52 +02:00
tbalaj
5c99838c1a tdf#143148 Update Include Guard usage
Updates vbabutton.hxx to use pragma once

Change-Id: I55874083ad0cdbc08bedaa71fa7553acfefa3195
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164324
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-03-11 05:42:43 +01:00
Mike Kaganski
0fa827dbb2 Drop std::as_const from css::uno::Sequence iterations
Obsoleted by commit 2484de6728 (Remove
non-const Sequence::begin()/end() in internal code, 2021-10-15) and
commit fb3c04bd19 (Drop non-const
Sequence::operator[] in internal code, 2021-11-05).

Change-Id: Idbafef5d34c0d4771cbbf75b9db9712e504164cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162640
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-27 12:43:48 +01:00
Armin Le Grand (allotropia)
b8e393686c ITEM: Remove suspicious extra-Which in ::Put
The ::Put methods at SfxItemSet had an extra WhichID
parameter that was not really documented, but I would
guess often asked why it exists: An extra WhichID, just
called 'nWhich' (which makes things NOT clearer). That
is 'strange' since the Item given to be put already
internally has a WhichID, so why a 2nd one?

If you were really interested and read all that code
(no, no comments on that anywhere) you might know
that this a kind of 'Target-WhichID' under which
the Item shall be put to the ItemSet. Since this
is unclear for most people it is even dangerous and
explains why so many code places just hand over the
WhichID requsted from the Item that already gets
handed over.

To make it short: I removed that. For the 19 places
where this was really needed I added a new method
besides ::Put called ::PutAsTargetWhich that takes that
extra WhichID (now called TargetWhich) and takes the
needed actions. These are quite some because that may
be combined with the bPassingOwnership flag, see new
SfxItemSet::PutImplAsTargetWhich method.

This makes usage of ItemSets/Items less dangerous. It
also simplifies and thus makes safer the central helpers
implCreateItemEntry/implCleanupItemEntry which have some
less cases to handle.

Debugged the failing UnitTests showed that there is
an incarnate Item != SfxVoidItem that causes problems.
I checked for errors in the change, but no luck.
Afterr some time I found out that a ::Clone
implementation caused the problem: These need to
also copy the WichID of the original, but the
SfxFrameItem failed to do so. This did not cause
problems in the former version because
implCreateItemEntry was designed to set a missing/
different WhichID.
I corrected that in SfxFrameItem, also removed not
needed costructor that caused that. Also added a
SAL_WARN and a correction in implCreateItemEntry.
I could have added an assert (did so for running
local UnitTests), but should be enough.

NOTE: When hunting for Items except SfxVoidItem
that get crerated using a WhichID '0' i learned
that this indeed happens: There are some (5) calls
to SfxRequest::SetReturnValue that incarnate an
SfxBoolItem with WhichID '0' (ZERO). This is not
good and I think about how to change that...

Change-Id: I9854a14cdc42d1cc19c7b9df65ce74147d680825
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162124
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-01-17 01:56:01 +01:00
Gabor Kelemen
2c6f28f431 tdf#146619 Recheck include/[v-x]* with IWYU
Change-Id: I3cecd622aa04d842a449b4bfd6c55d0b8b96aabf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156992
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-12-12 18:51:27 +01:00
Noel Grandin
cc772833a1 loplugin:fieldcast in VbShapeRangeEnumHelper
Change-Id: I18e24a4c0b86a6f9a456c0e962f87d74a4edf709
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159093
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-08 08:17:55 +01:00
Noel Grandin
d31bb122bc loplugin:fieldcast in VbShapeEnumHelper
Change-Id: Iece221df3b650078a1796d407459bbd96ad058e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159092
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-08 08:17:48 +01:00
Stephan Bergmann
bd6fb0cd3e Extended loplugin:ostr: Rewrite some O[U]StringLiteral -> O[U]String
...in include files.  This is a mix of automatic rewriting in include files and
manual fixups (mostly addressing loplugin:redundantfcast) in source files that
include those.

Change-Id: I1f3cc1e67b9cabd2e9d61a4d9e9a01e587ea35cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158337
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-23 11:04:42 +02:00
Stephan Bergmann
335e73a7f3 Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: vbahelper
Change-Id: Idb944974318a94763532639c9e74040adadf06f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158290
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-20 22:46:23 +02:00
Noel Grandin
87db52ab1e Revert "use more Reference::query instead of UNO_QUERY_THROW"
This reverts commit 7fc6063914.

sberg noticed that there is a difference now:

there's a subtle difference now, in that if  y  was null originally, it would have thrown a (caught) exception, whereas now it will crash in the  y.query<X>()  call.

Change-Id: Idbb5a08d635d15b5ca63f4822eddf05fb0a5afa0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156002
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-25 14:15:56 +02:00
Noel Grandin
7fc6063914 use more Reference::query instead of UNO_QUERY_THROW
since querying with exceptions is consideably more expensive

Change-Id: I968a9a40766b2abb0d3058549b0ed44011fd5716
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155791
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-18 11:03:02 +02:00
Noel Grandin
b6b26421a1 split Point/Size/Rectangle into AbsoluteScreenPixel* types
to attempt to make it obvious in code what kind of coordinate
system we are dealing with.

The idea is that by doing this, the compile-time type checking
will flush out inconsistencies between different code.

I started with vcl::Window::OutputToAbsoluteScreenPixel
and worked outwards from there.

Change-Id: Ia967d7a0bb38886695f3a761b85c8b9340ddb1c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154676
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-02 08:13:15 +02:00
Noel Grandin
0e8b7dd7a0 split GetWindowExtentsRelative asunder
sometimes it returns a relative position, sometimes an absolute
position.

Rather have two different methods with names that match what
they return.

Change-Id: Ie1e73c6be1c797fd59934c96866d1fef1f972b35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154653
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-20 08:15:29 +02:00
Noel Grandin
bfdf5d290b use more XVclWindowPeer
Rather than using it's superclass XWindowPeer and implicitly relying on it being XVclWindowPeer and casting it everywhere.

Change-Id: Icfb46f3b920d00f4a167a31803a71bbb0368d05c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149894
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-01 14:42:17 +02:00
Baole Fang
a6edfaaeb0 tdf#150281: Fix CentimetersToPoints in Calc
Originally, CentimetersToPoints was implemented as a base method for
Writer and Calc. They are both using the same implementation,
which is correct for Writer, but wrong for Calc.
Since their behavior should be different,
I remove the base method and implement a correct one for Calc.

Change-Id: If957accdd9be86a96ca6fb711502e49a79bf3223
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148745
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-13 15:16:24 +00:00
Noel Grandin
d0b71f167c flatten some vba classes
no need to allocate ShapeHelper separately, it is only one pointer big

Change-Id: Ie4981ca81ac1dd430f22ba32357fcabbbd47bd09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147944
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-28 10:53:39 +00:00
Hannah Meeks
0548269ca0 VBA: Remove conversions in writer from OORGBTOXLRGB (XLRGB is actually BGR!)
Enum to store if document is Writer or Calc because font colors are treated
differently depending on this:

In writer the colors come in as RGB but in calc they are in BGR and both palettes
are in RBG so we only need this conversion for calc.

Includes testdoc for calc - to show this still works

Change-Id: I79d9d585dbfc527c0781543ce1f1095c4db190b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144788
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-02-20 16:55:31 +00:00
Caolán McNamara
0908c7c118 SfxViewShell::GetViewFrame never returns null, change to a reference
various null checks can be seen to be redundant and removed

Change-Id: Icf49c1de4b0302795d2769a370af3abceaad0221
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147147
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-02-16 15:13:21 +00:00
Stephan Bergmann
19691c3b68 Revert all the recent loplugin:unocast changes
...as obsoleted by ef53355355 "Rudimentary support
for dynamic_cast on UNO proxy objects".

This reverts all of:
4cfcc9ac37 "loplugin:unocast (framework::Desktop)"
03efbf72f4 "loplugin:unocast
 (vclcanvas::TextLayout)"
80099fdd51 "loplugin:unocast (SalGtkXWindow)"
cc147f576d "loplugin:unocast
 (sdext::presenter::CachablePresenterView)"
40db42be1d "loplugin:unocast
 (vclcanvas::CanvasFont)"
2d1e7995ea "loplugin:unocast (CairoColorSpace)"
4c0bbe4bd9 "loplugin:unocast
 (canvas::ParametricPolyPolygon)"
8980366662 "loplugin:unocast
 (vclcanas::CanvasBitmap)"
d5e0c2c8db "loplugin:unocast
 (sfx2::DigitalSignatures)"
c0c4519e0d "loplugin:unocast
 (VCLXAccessibleComponent)"
feb8b833a6 "loplugin:unocast (VCLXDialog)"
1fa58cc6cc "loplugin:unocast (VCLXMultiPage)"
f481f036de "loplugin:unocast
 (DocumentSettingsSerializer)"
73df933f5f "loplugin:unocast
 (css::embed::EmbeddedUpdate)"
420165ab0e "loplugin:unocast
 (canvas::tools' StandardColorSpace, StandardNoAlphaColorSpace)"
9abe8ee067 "loplugin:unocast (MutableTreeNode)"
9f3022ceb0 "loplugin:unocast (VCLXTabPage)"
1be70dda02 "loplugin:unocast
 (vcl::unotools::VclCanvasBitmap)"
d6a70bb641 "loplugin:unocast
 (basegfx::unotools::UnoPolyPolygon)"
5a14f009e6 "loplugin:unocast
 (xmlsecurity::Certificate)"
99009c9535 "loplugin:unocast (sd::Annotation)"
0c7585c5fa "loplugin:unocast (sd::TextApiObject)"
24e14afd1b "loplugin:unocast
 (SignatureVerifierImpl)"
1a7ad0c10d "loplugin:unocast
 (pcr::PropertyEventTranslation)"
a97e2d2702 "loplugin:unocast (RangePageBreaks)"
19dfdf86ad "iloplugin:unocast
 (pcr::OFormattedNumericControl)"
f9785ea595 "loplugin:unocast
 (frm::OInterfaceContainer)"
5e5f40a4a9 "loplugin:unocast (ScVbaShapes)"
27b35b2c21 "loplugin:unocast (ScVbaShapeRange)"
cb3108f860 "cid#1517812 Dereference null return
 value"
feba0ddb15 "loplugin:unocast
 (weld::TransportAsXWindow)"
4d6c232165 "loplugin:unocast
 (oox::ForumlaImExportBase)"
4844c096a8 "loplugin:unocast
 (cairocanvas::SurfaceProvider)"
9a0b523e0a "loplugin:unocast
 (cairocanvas::CanvasBitmap)"
8a5648d8e5 "loplugin:unocast
 (cairocanvas::TextLayout)"
28c27a0623 "loplugin:unocast
 (cairocanvas::CanvasFont)"
53bc223cb3 "loplugin:unocast
 (cairocanvas::RepaintTarget)"
5f70b0b9f6 "loplugin:unocast (SvXMLImport)"
068187a898 "loplugin:unocast (VCLXWindow)"
88b4f96620 "loplugin:unocast
 (sfx2::sidebar::SidebarController)"
f1b7a69b28 "loplugin:unocast
 (SvxLineStyleToolBoxControl)"
ba76f0ba7e "loplugin:unocast
 (i18npool::Calendar_gregorian)"
840154daf9 "loplugin:unocast
 (framework::AddonsToolBarWrapper)"
b0e9c4c5f0 "loplugin:unocast
 (GrammarCheckingIterator)"
8ee6cfc965 "loplugin:unocast
 (ucb::ucp::ext::Content)"
5b8cd77c11 "loplugin:unocast
 (basic::SfxScriptLibraryContainer)"
9e73ff9fce "loplugin:unocast
 (sdext::presenter::PresenterNotesView)"
a98acca8fb "loplugin:unocast
 (SelectionChangeHandler)"
c0b59ad6e3 "Consistently use
 comphelper::getSomethingImpl<I>(aIdentifier, this)"
276e3ccbdd "loplugin:unocast
 (vclcanvas::RepaintTarget)"

Change-Id: I37c73e3422a5154bf6cb647640d2d3f23db8bc34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145063
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-05 11:45:51 +00:00
Stephan Bergmann
5e5f40a4a9 loplugin:unocast (ScVbaShapes)
(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)

Change-Id: I913565ccd93472f2a8893c4251e80d0309827c34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144633
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-21 06:42:34 +00:00
Stephan Bergmann
27b35b2c21 loplugin:unocast (ScVbaShapeRange)
(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)

Change-Id: I4a66df07f2e768ee3203b730b50be4b9ec6a01a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144634
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-21 06:42:22 +00:00
Justin Luth
55628d6b25 sw vba: add WordBasic.MsgBox
The unit test just consists of adding a
"WordBasic.MsgBox()" to the vba code in testVBA.docm.

make CppunitTest_sw_macros_test

or just open the file manually for an easy-to-run experience.

Change-Id: I38edfee42649fcc85f0f535a2c9861c45038fa0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141347
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-10-17 14:14:53 +02:00
Justin Luth
73911ed8d3 tdf#148806 doc vba: highest priority is ThisDocument AutoOpen V2
A review by Stephan Bergmann made me re-think adding a separate
event for this. It really is only one event and not two
(or three as I initially imagined). In the end, I like this better
because it highlights the difference between Excel and Word
by keeping all the differentiating logic in one place.

The inability to properly document the purpose of these new events
was the impetus to redesign this. Thanks Stephan for the prompt.

Change-Id: Ic2d461c13c4a52e279224cb485d2b6c4a3c57b54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141233
Tested-by: Justin Luth <jluth@mail.com>
Reviewed-by: Justin Luth <jluth@mail.com>
2022-10-12 01:12:17 +02:00
Justin Luth
ffc15725b5 tdf#148806 tdf#151393 xls vba: no Auto_Open from ThisWorksheet
Unlike Word, ThisWorksheet cannot hold auto-running
subroutines for Open/Close/New.

This fixes a LO 7.4 regression caused by
commit beb6c62e99.

Change-Id: Idb8f72775d9392b306cb924ee776821272b12f3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141127
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
2022-10-11 20:39:04 +02:00
Justin Luth
eaa38b0f9d tdf#148806 doc vba: only autoOpen PUBLIC macros
Note: this should NOT apply to Document_Open which normally
is a private subroutine and runs fine as private.

I tested and it DOES apply to all three version of AutoOpen:
-ThisDocument.AutoOpen,
-<AnyModule>.AutoOpen,
-AutoOpen.Main

Note: this is different from Excel.
Private Auto_Open runs just fine there.

Change-Id: If10c8c90c35275c2b14dc2e15fb357674fc580b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141114
Tested-by: Justin Luth <jluth@mail.com>
Reviewed-by: Justin Luth <jluth@mail.com>
2022-10-11 03:08:13 +02:00
Justin Luth
e2abb5bbc0 tdf#148806 doc vba: accept module AutoOpen.Main
This is the lowest priority way of running AutoOpen,
and it only applies to Word, not Excel.

There is some code in basic/source/classes/sb.cxx
that was somewhat finding this before it got lost in LO 7.4
with commit beb6c62e99.

TODO: these AutoOpens should only run with a public sub,
not a private one.

Change-Id: I8a733cde13f96636942d84a0b05520692aac3e52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141094
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
2022-10-09 01:07:23 +02:00
Justin Luth
6834fda784 related tdf#148806 xls/x vba: no auto_open if Auto_Open module
The presence of an Auto_Close module prevents any
auto_close subroutines from running.

Interestingly, Word is different. It doesn't care at all
if such a module is present. (In fact, it uses that
module's main() as an AutoClose if there is no
Sub AutoClose.)

Change-Id: I83a80b7f016dcf2ad3b7fd931acacb6f788241a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141036
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
2022-10-07 23:48:36 +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
ed4ffba1c1 Drop some conversion from vbahelper; use usual functions where needed
Change-Id: I71bea54f095072a0e403bfc7aa48a0f0f9a0ebaa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137891
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-08-06 12:10:19 +02:00
Mike Kaganski
da9b11a50a Use o3tl::convert in VbaApplicationBase::CentimetersToPoints
Note that the old conversion was incorrect; it likely followed
MS documentation [1], which is inaccurate: running in Word

  MsgBox CentimetersToPoints(1.0)

gives 28.34646 (expected given the 1 in = 72 pt definition).

[1] https://docs.microsoft.com/en-us/office/vba/api/word.application.centimeterstopoints

Change-Id: I4eefccc4bd17958f944f364bc3ea579a8fdbd703
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137855
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-08-05 14:48:17 +02:00
Noel Grandin
2d009c4057 loplugin:moveit
Change-Id: I2702e716dc669ffbb870d36d060e110288d7a744
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137043
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-14 11:18:21 +02:00
Chris Sherlock
934985becc tools: rename getHeight/Width() to GetOpenHeight/Width()
By default Rectangle uses closed interval, if we really want to use half
open intervals then we should specifically say as such in the name.

Change-Id: Id7a91120ba1a1a4bc330014216b73a692dbf03a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136575
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-07-11 11:06:53 +02:00
Noel Grandin
86ec14169c clang-tidy modernize-pass-by-value in vbahelper
Change-Id: I7f2a7dd3e8f0a791496f5e021bd802dba89d7643
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136559
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-28 12:43:04 +02:00
Stephan Bergmann
3a06db0af0 Use a range-based for loop
Change-Id: Id3c358e0a7f11a4a203b1acbd42b9b09c7f7a2fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135193
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-31 19:14:49 +02:00
Stephan Bergmann
5060c50158 Use o3tl::make_unsigned in some places
...where a signed and an unsigned value are compared, and the signed value has
just been proven to be non-negative here

Change-Id: I20600d61a5d59d739bc1bee838c0038e4611aec2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134875
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-24 16:50:03 +02:00
Mike Kaganski
bc1ab88ffa More usual 1899-12-30 base Date in Basic
Omissions from commit 8189d81564

Change-Id: I6b205f7bcc9ff9c30e55b03d39d02b9be15a01c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134064
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-05-10 06:58:24 +02:00
Stephan Bergmann
46972be699 Just use Any ctor instead of makeAny in vbahelper
Change-Id: Ie985584ad55f69817294e45b11b7c832d39c9bf7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133737
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-03 13:35:43 +02:00
Noel Grandin
fdfd517a6f loplugin:stringviewparam whitelist some more functions
for which we have o3tl:: equivalents

Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-13 08:38:53 +02:00
Noel Grandin
cbaf1fbaa6 loplugin:stringview more o3tl conversion
look for call sequences that can use string_view and the new o3tl
functions in o3tl/string_view.hxx

Also add a few more wrappers to said #include file

Change-Id: I05d8752cc67a7b55b0b57e8eed803bd06bfcd9ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132840
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-12 12:42:15 +02:00
Noel Grandin
3e76797384 move comphelper::string::toInt32 to o3tl
so we can use it in places where we cannot include comphelper

Change-Id: Iba0ba3e4c0dcf0f9d1f09092a77c3b2010ec4f6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132732
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-08 20:44:43 +02:00
Noel Grandin
36e0e88b28 use more subView when converting to Int32
Change-Id: I54e3ddf79ba793fd4328bf8bda7f949b65349651
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132693
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-08 13:18:41 +02:00
Jeff Huang
7b0e0409c3 tdf#145539 const OUString -> constexpr OUStringLiteral
Convert string literals defined as const char[] in header files
to constexpr OUStringLiteral

Change-Id: I69fdc34cfb663ff87fabc8efc72d6563aa23465b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124724
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
2021-11-25 15:57:44 +01:00
Noel Grandin
2ab40e9ecc use more OUStringLiteral in MediaDescriptor
Change-Id: I0567d103db8db401c737fed98483912a39352929
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124835
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-08 11:31:36 +01:00
Mike Kaganski
951c4ceb2e Prepare for removal of non-const operator[] from Sequence in vbahelper
Change-Id: I2450faf4b3e093b2046034e2a5e5657ff5144d98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124410
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-01 05:26:16 +01:00
Mike Kaganski
2484de6728 Remove non-const Sequence::begin()/end() in internal code
... to avoid hidden cost of multiple COW checks, because they
call getArray() internally.
This obsoletes [loplugin:sequenceloop].

Also rename toNonConstRange to asNonConstRange, to reflect that
the result is a view of the sequence, not an independent object.

TODO: also drop non-const operator[], but introduce operator[]
in SequenceRange.

Change-Id: Idd5fd7a3400fe65274d2a6343025e2ef8911635d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123518
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-15 10:36:36 +02:00
Mike Kaganski
8a017d25a6 Avoid COW overhead using css::uno::Sequence
The scenarios are:

1. Calling sequence's begin() and end() in pairs to pass to algorithms
   (both calls use getArray(), which does the COW checks)
2. In addition to #1, calling end() again when checking result of find
   algorithms, and/or begin() to calculate result's distance
3. Using non-const sequences in range-based for loops, which internally
   do #1
4. Assigning sequence to another sequence variable, and then modifying
   one of them

In many cases, the sequences could be made const, or treated as const
for the purposes of the algorithms (using std::as_const, std::cbegin,
and std::cend). Where algorithm modifies the sequence, it was changed
to only call getArray() once. For that, css::uno::toNonConstRange was
introduced, which returns a struct (sublclass of std::pair) with two
iterators [begin, end], that are calculated using one call to begin()
and one call to getLength().

To handle #4, css::uno::Sequence::swap was introduced, that swaps the
internal pointer to uno_Sequence. So when a local Sequence variable
should be assigned to another variable, and the latter will be modified
further, it's now possible to use swap instead, so the two sequences
are kept independent.

The modified places were found by temporarily removing non-const end().

Change-Id: I8fe2787f200eecb70744e8b77fbdf7a49653f628
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123542
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-14 06:00:49 +02:00
Noel Grandin
d968425f00 loplugin:moveparam check for collection params
Empirically, when we are passing a collection type to a constructor,
80% of the time, we are passing a local temporary that can be moved
instead of being copied.

Change-Id: I5acc9d761c920691934a4be806a3d3ab6cdbab96
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123056
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-12 13:12:11 +02:00
Verne-Lai
dad5b69b22 [tdf#42982]Improve runtimeException's Message
Change-Id: Ieb1bc302c2c1093561082704e26e3ff3b648db91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122902
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-10-04 11:21:34 +02:00
Noel Grandin
d72511eda9 gives names to all the Idles and Tasks
enforce it by making the constructor parameter non-default.

Change-Id: I321543e4dcf15ea0a43ad8cce91d2f8dc22df6ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122766
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-28 19:35:13 +02:00