summaryrefslogtreecommitdiff
path: root/vbahelper
AgeCommit message (Collapse)AuthorFilesLines
2023-11-08loplugin:fieldcast in VbShapeRangeEnumHelperNoel Grandin1-3/+5
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-08loplugin:fieldcast in VbShapeEnumHelperNoel Grandin1-3/+3
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-10-23Extended loplugin:ostr: Rewrite some O[U]StringLiteral -> O[U]StringStephan Bergmann1-12/+12
...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-20Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: vbahelperStephan Bergmann4-11/+11
Change-Id: Idb944974318a94763532639c9e74040adadf06f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158290 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-11Drop o3tl::span, can use C++20 std::span directly nowStephan Bergmann1-1/+1
Change-Id: Ic21ff7bf48f07f7277979d52e99d2c5c268de83f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157825 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-08-25Revert "use more Reference::query instead of UNO_QUERY_THROW"Noel Grandin4-21/+37
This reverts commit 7fc6063914432d58d86cfcbd728d967e7c86ebfd. 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-18use more Reference::query instead of UNO_QUERY_THROWNoel Grandin4-37/+21
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-02split Point/Size/Rectangle into AbsoluteScreenPixel* typesNoel Grandin1-2/+2
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-07-23vcl: Drop now unneeded DevicePoint typedefKhaled Hosny1-3/+24
It has been always typedef'd to basegfx::B2DPoint since: commit 5e218b5c51f7d9cd10bd9db832879efca41b9c75 Date: Wed Jan 12 21:19:32 2022 +0000 always use B2DPoint for DevicePoint Change-Id: I9f5202d5a71c77dd79f1759923917c26bf68a9af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154632 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-20split GetWindowExtentsRelative asunderNoel Grandin1-2/+2
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-04-01use more XVclWindowPeerNoel Grandin2-17/+21
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-03-13tdf#150281: Fix CentimetersToPoints in CalcBaole Fang1-5/+0
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-02-28flatten some vba classesNoel Grandin6-35/+41
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-20VBA: Remove conversions in writer from OORGBTOXLRGB (XLRGB is actually BGR!)Hannah Meeks1-7/+23
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-16SfxViewShell::GetViewFrame never returns null, change to a referenceCaolán McNamara1-3/+3
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-01-05Revert all the recent loplugin:unocast changesStephan Bergmann2-22/+2
...as obsoleted by ef533553559fe09b4afab651fc692885d1acf4ed "Rudimentary support for dynamic_cast on UNO proxy objects". This reverts all of: 4cfcc9ac37b90ce64c8402a41eb4638adb185b5c "loplugin:unocast (framework::Desktop)" 03efbf72f4ddf7a84aa8aabef348331bd4b75e8a "loplugin:unocast (vclcanvas::TextLayout)" 80099fdd51a69eaa6c36ca88ef772810e4a777fa "loplugin:unocast (SalGtkXWindow)" cc147f576d8687fb79c77d47d41dc4ba1678a469 "loplugin:unocast (sdext::presenter::CachablePresenterView)" 40db42be1d8fd0f9c6c8c5ba3767ddb9ee2034c2 "loplugin:unocast (vclcanvas::CanvasFont)" 2d1e7995eae29e2826449eb5179f5fae181794a5 "loplugin:unocast (CairoColorSpace)" 4c0bbe4bd97636207cf71a6aa120c67698891da9 "loplugin:unocast (canvas::ParametricPolyPolygon)" 89803666621c07d1b1ac9d3bd883f0ca192a91a0 "loplugin:unocast (vclcanas::CanvasBitmap)" d5e0c2c8db71878d21c2a7255af08cf5f9a6dd04 "loplugin:unocast (sfx2::DigitalSignatures)" c0c4519e0d5b555f59bbc04cc616454edfd1f4ce "loplugin:unocast (VCLXAccessibleComponent)" feb8b833a6245d42400f42a0bc789dc84594ee6f "loplugin:unocast (VCLXDialog)" 1fa58cc6cc9c3849753342a5d9a6ddfa461b5e66 "loplugin:unocast (VCLXMultiPage)" f481f036deb1b1b46f3038074c4659f3a91b9c6c "loplugin:unocast (DocumentSettingsSerializer)" 73df933f5fa5932f94e5a1b338a3eda00a9ce354 "loplugin:unocast (css::embed::EmbeddedUpdate)" 420165ab0ef03c0467f9d17f504de2d2fc78f0e6 "loplugin:unocast (canvas::tools' StandardColorSpace, StandardNoAlphaColorSpace)" 9abe8ee067e6c00f19d8a13346d53c4641c27166 "loplugin:unocast (MutableTreeNode)" 9f3022ceb036f23b4b0994c3e2fbd1001bff225a "loplugin:unocast (VCLXTabPage)" 1be70dda02c12a60778b7607cff2520ae1aa611e "loplugin:unocast (vcl::unotools::VclCanvasBitmap)" d6a70bb641b96e8e5616448c2378131ed62658b4 "loplugin:unocast (basegfx::unotools::UnoPolyPolygon)" 5a14f009e6782c077463c8cbb8e9cea3d7950107 "loplugin:unocast (xmlsecurity::Certificate)" 99009c9535dfa3e0d838989ccc7d84bfa2320ff4 "loplugin:unocast (sd::Annotation)" 0c7585c5fa78887e5459885ed744e8044fd76137 "loplugin:unocast (sd::TextApiObject)" 24e14afd1bfcaed6c200ab081973fba7e47267ca "loplugin:unocast (SignatureVerifierImpl)" 1a7ad0c10d286ce9ae2700ceb2fd50eed1fb43a4 "loplugin:unocast (pcr::PropertyEventTranslation)" a97e2d2702d9a6f37775ccee2c08c4f3b2479c4b "loplugin:unocast (RangePageBreaks)" 19dfdf86ad1f5b08041d8b7a9f196caf881231ab "iloplugin:unocast (pcr::OFormattedNumericControl)" f9785ea595fd8e911f6370e836fa579225b9e571 "loplugin:unocast (frm::OInterfaceContainer)" 5e5f40a4a92a31b0932c690219d002fcf18598cf "loplugin:unocast (ScVbaShapes)" 27b35b2c215b4832d4378ec3a7ecbba926552d06 "loplugin:unocast (ScVbaShapeRange)" cb3108f860065928552a86cf8acc4b3a95718ecf "cid#1517812 Dereference null return value" feba0ddb1521d1142560fe54b7d7696ee910237f "loplugin:unocast (weld::TransportAsXWindow)" 4d6c23216559eb48f9943bb49d6e475a6d64ba15 "loplugin:unocast (oox::ForumlaImExportBase)" 4844c096a8ab6a9a620c410a0949d4499f12a504 "loplugin:unocast (cairocanvas::SurfaceProvider)" 9a0b523e0a84d403b9092176ccec4b3e3efe42d0 "loplugin:unocast (cairocanvas::CanvasBitmap)" 8a5648d8e59b4b007dbbf3824777c19a21efc61e "loplugin:unocast (cairocanvas::TextLayout)" 28c27a0623bc78a0590858f97d03b620985bc84c "loplugin:unocast (cairocanvas::CanvasFont)" 53bc223cb3288e32a417696ee61c29e5f01f209d "loplugin:unocast (cairocanvas::RepaintTarget)" 5f70b0b9f6bc4ab145ddbd9155590ed4a3b1b9ec "loplugin:unocast (SvXMLImport)" 068187a898cdd2e26e9b16c348ecc1ed2dee3f29 "loplugin:unocast (VCLXWindow)" 88b4f966202717cd4ad38a30a8eda22c3e69ed35 "loplugin:unocast (sfx2::sidebar::SidebarController)" f1b7a69b280aefe2f1b3b0f32193494fd765f2bd "loplugin:unocast (SvxLineStyleToolBoxControl)" ba76f0ba7e8de4d2953739c952004b7d9af47197 "loplugin:unocast (i18npool::Calendar_gregorian)" 840154daf934d8df52ead1cb7acd798c4d30f007 "loplugin:unocast (framework::AddonsToolBarWrapper)" b0e9c4c5f063cefa9557810e3349bdb9c7493091 "loplugin:unocast (GrammarCheckingIterator)" 8ee6cfc9655ce9de4617cea1a0d9cb9d7a4fbfac "loplugin:unocast (ucb::ucp::ext::Content)" 5b8cd77c112bc8c0e92b8fec215c3c8e802bbc0a "loplugin:unocast (basic::SfxScriptLibraryContainer)" 9e73ff9fce12e102bb3c3cea8d8bb96c88f2c9ad "loplugin:unocast (sdext::presenter::PresenterNotesView)" a98acca8fbc38d3fd5600ae5056a8e42b6d8a40d "loplugin:unocast (SelectionChangeHandler)" c0b59ad6e35b0cb0dea0821e95f95569739078c1 "Consistently use comphelper::getSomethingImpl<I>(aIdentifier, this)" 276e3ccbdd3259ec3daf8a1a98fa7f406b14e21c "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>
2022-12-21loplugin:unocast (ScVbaShapes)Stephan Bergmann1-1/+11
(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-21loplugin:unocast (ScVbaShapeRange)Stephan Bergmann1-1/+11
(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-10-17sw vba: add WordBasic.MsgBoxJustin Luth1-0/+21
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-12tdf#148806 doc vba: highest priority is ThisDocument AutoOpen V2Justin Luth1-18/+32
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-11tdf#148806 tdf#151393 xls vba: no Auto_Open from ThisWorksheetJustin Luth1-2/+23
Unlike Word, ThisWorksheet cannot hold auto-running subroutines for Open/Close/New. This fixes a LO 7.4 regression caused by commit beb6c62e990599d91ac5d9183164c94d269027d3. Change-Id: Idb8f72775d9392b306cb924ee776821272b12f3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141127 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
2022-10-11tdf#148806 doc vba: only autoOpen PUBLIC macrosJustin Luth1-2/+13
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-09tdf#148806 doc vba: accept module AutoOpen.MainJustin Luth1-1/+17
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 beb6c62e990599d91ac5d9183164c94d269027d3. 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-07related tdf#148806 xls/x vba: no auto_open if Auto_Open moduleJustin Luth1-0/+17
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-09-14move ErrCode to comphelper and improve debug output stringNoel Grandin2-2/+2
need to move it, because modules "below" vcl want to use the debug output method Change-Id: Ibcaf4089a1e0b3fcc0b5189c7ebf1aae90f50b48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139791 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-18Move tools/diagnose_ex.h to comphelper/diagnose_ex.hxxStephan Bergmann1-1/+1
...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-06Drop some conversion from vbahelper; use usual functions where neededMike Kaganski1-19/+7
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-05Use o3tl::convert in VbaApplicationBase::CentimetersToPointsMike Kaganski1-3/+1
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-07-14loplugin:moveitNoel Grandin2-3/+3
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-11tools: rename getHeight/Width() to GetOpenHeight/Width()Chris Sherlock1-3/+3
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-06-28clang-tidy modernize-pass-by-value in vbahelperNoel Grandin26-52/+71
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-05-31Use a range-based for loopStephan Bergmann1-6/+6
Change-Id: Id3c358e0a7f11a4a203b1acbd42b9b09c7f7a2fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135193 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-24Use o3tl::make_unsigned in some placesStephan Bergmann1-1/+2
...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-10More usual 1899-12-30 base Date in BasicMike Kaganski1-2/+1
Omissions from commit 8189d815641c583b5506d482f0b4f1ab47924f6a 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-03Just use Any ctor instead of makeAny in vbahelperStephan Bergmann33-166/+166
Change-Id: Ie985584ad55f69817294e45b11b7c832d39c9bf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133737 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-13loplugin:stringviewparam whitelist some more functionsNoel Grandin2-6/+7
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-12loplugin:stringview more o3tl conversionNoel Grandin1-1/+2
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-08move comphelper::string::toInt32 to o3tlNoel Grandin1-1/+1
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-08use more subView when converting to Int32Noel Grandin1-1/+1
Change-Id: I54e3ddf79ba793fd4328bf8bda7f949b65349651 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132693 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-10Generally determine Rdb content from gb_*_set_componentfile callsStephan Bergmann2-2/+2
...instead of by listing the content somewhat redundantly in the Rdb_*.mk files, to avoid duplication of logic for components that are only built conditionally (and thus should only be included conditionally in the corresponding Rdb). To achieve that, add an "rdb" parameter to gb_ComponentTarget_ComponentTarget (and to the gb_*_set_componentfile macros that internally call gb_ComponentTarget_ComponentTarget), which is used to make the appropriate gb_Rdb_add_component call internally from within gb_ComponentTarget_ComponentTarget. (As a special case, gb_CppunitTest_set_componentfile shall not call gb_Rdb_add_component, as that has already been done by the corresponding gb_Library_set_componentfile call, so allow the gb_ComponentTarget_ComponentTarget "rdb" parameter to be empty to support that special case.) Most Rdb_*.mk files are thus mostly empty now. One exception is i18npool/Rdb_saxparser.mk, which duplicates some of the Rdb_services content as needed during the build in CustomTarget_i18npool/localedata. 1c9a40299d328c78c035ca63ccdf22c5c669a03b "gbuild: create services.rdb from built components" had already tried to do something similar (in addition to other things) under a new --enable-services-rdb-from-build option. However, that approach had four drawbacks that this approach here addresses (and which thus partly reverts 1c9a40299d328c78c035ca63ccdf22c5c669a03b): 1 Rdb_services shall not contain the component files of all libraries that are built. While that commit filtered out the component files that go into Rdb_ure/services (ure/Rdb_ure.mk), it failed to filter out the component files that go into others like Rdb_postgresql-sdbc (connectivity/Rdb_postgresql-sdbc.mk). 2 The code added by that commit to Makefile.gbuild codified the knowledge that there is an Rdb_services, which is brittle. 3 The code added by that commit to solenv/gbuild/Rdb.mk codified the knowledge (for gb_Rdb__URECOMPONENTS) that there is an Rdb_ure/services, which is brittle. 4 Introducing an --enable-services-rdb-from-build option needlessly provided two different ways how the content of Rdb_services is assembled. The changes done here would leave --enable-services-rdb-from-build as a misnomer, as it no longer controls how Rdb_services is assembled. I thus renamed it to --enable-customtarget-components, as that is apparently what it still does now. Change-Id: Ia5e8df4b640146c77421fcec6daa11a9cd260265 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126577 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-11-25tdf#145539 const OUString -> constexpr OUStringLiteralJeff Huang1-2/+2
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-08use more OUStringLiteral in MediaDescriptorNoel Grandin1-1/+1
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-01Prepare for removal of non-const operator[] from Sequence in vbahelperMike Kaganski10-57/+47
Change-Id: I2450faf4b3e093b2046034e2a5e5657ff5144d98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124410 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-15Remove non-const Sequence::begin()/end() in internal codeMike Kaganski2-6/+5
... 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-14Avoid COW overhead using css::uno::SequenceMike Kaganski5-6/+7
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-12loplugin:moveparam check for collection paramsNoel Grandin1-2/+2
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-04[tdf#42982]Improve runtimeException's MessageVerne-Lai1-1/+1
Change-Id: Ieb1bc302c2c1093561082704e26e3ff3b648db91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122902 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-09-28gives names to all the Idles and TasksNoel Grandin1-1/+1
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-28vcl: rename OutDevState to StackChris Sherlock1-2/+7
I have moved the header file to include/vcl/rendercontext as this will eventually be part of the RenderContext split from OutputDevice. State and associated enums have also been moved to the vcl namespace. I have also moved ComplexTextLayoutFlags into the vcl::text namespace. Change-Id: I0abbf560e75b45a272854b267e948c240cd69091 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121524 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-09-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 5Mike Kaganski1-6/+2
- Revise uses of getSomething to use getFromUnoTunnel Where that is impossible, use getSomething_cast to unify casting, and minimize number of places doing low-level transformations. The change keeps the existing tunnel references that last for the duration of the pointers' life, because sometimes destroying such reference may destroy the pointed object, and result in use after free. Change-Id: I291c33223582c34cd2c763aa8aacf0ae899ca4c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122101 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>