summaryrefslogtreecommitdiff
path: root/sw/source/uibase/envelp
AgeCommit message (Collapse)Author
5 daysITEM: Refactor ItemTypeArmin Le Grand (Collabora)
ItemType is useful and faster than RTTI. Until now it was implemented by a 16-bit member in the base class, plus (potentially) all constructors having to hand a value in at item construction type (of type SfxItemType) to get that member set correctly. This works, but there is no reliable way to guarantee coverage, and there have already been cases with missing SfxItemType - these fallback to '0' and thus all Items with ItemType() == 0 are assumed equal and might be static_cast'ed to the wrong classes. Note that I identified *35* Items that had no correct ItemType set/implemented actually. It also uses 16-bit per incarnated Item at runtime. I thought and realized now a more systematic approach to do that with a pure virtual function at the Item itself. That can also be secured by a clang compiler plugin in the future to keep it working. It uses one virtual function per derived class, no longer space in incarnated Items. Also the constructors will get more simple again. But the main aspect is security - we cannot afford Items potentially being held as equal if they are not. Unfortunately C++ does not offer something like a 'strict pure virtual function' that would force to be overloaded in every derivation, but the used methotology and adding a clang test is reasonably safe. Have now done the cleanup of previous method. Change-Id: I04768285f1e9b73d64b0bb87df401944b5d35678 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180017 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-11-24Turn SW_MOD macro to a functionMike Kaganski
Change-Id: Ide1f6fd2fc8a80b31353a14e416505a2349cea2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177071 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-11-12loplugin:reftotemp in swNoel Grandin
Change-Id: I370d18643b0c83c60846a0b6f051440a043c647a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176486 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-06-18Add SfxItemType to SfxPoolItemOliver Specht
The SfxPoolItem has a new member SfxItemType m_eItemType to compare types based on enums instead of typeinfo() which consumes a lot of time e.g. while AutoFormat is running Change-Id: I033ce67bc9a28ee4790f162380314de85fb4154e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166452 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-06-10loplugin:ostr in sw/../uibaseNoel Grandin
Change-Id: I4f4284b55d481caa006743688e6d83cc3c713b5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168601 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-15avoid double map lookupNoel Grandin
Change-Id: I02018eaaf220c7835756eba6215425bac9cbc6f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159432 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-22sw: check GetActiveView()Xisco Fauli
See https://crashreport.libreoffice.org/stats/signature/SwView::GetDocShell() Change-Id: I90ebbff5082f1f9cae7fa3b940cbb9796d6c6dd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149223 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2023-02-27Use SAL_NEWLINE_STRING to avoid some wheel re-inventionMike Kaganski
Change-Id: Ib60ddf2b1111fb2d6caf22ac6e0848bd27373b9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147750 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-12-15sw: check SfxViewFrame::Current()Caolán McNamara
these ones looks potentially worth backporting Change-Id: I294fa029b53fa9d43cb738f07278301e2a06c210 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144245 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-10-13Fix typoAndrea Gelmini
Change-Id: Ia4d7dd731e24c89c3228fdaf18cc0558a9c5ee66 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141311 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-06-08VCL add vcl::WindowPosSize abstract classJan-Marek Glogowski
... and use it to remove a duplicate and simplify code. Should mostly be a refactoring, which was mainly done by some larger sed calls, except for the new API calls, which helped shrinking some LOC. All data is also now private. Originally two of the "replaced" "classes" had unsigned width and height and one had signed. Noel pointed out, that during calculations, the value might get negative temporarly, so this now settles with signed values. Still the set size should never be negative and this is enforced this way. Not sure that is what Noel had in mind. This also includes: - rename WindowState => WindowData - rename WindowStateMask => WindowDataMask - rename WindowStateState => WindowState - move WindowState and WindowDataMask to vcl/windowstate.hxx - move WindowData(Mask) and WindowState into vcl namespace - readability: replace or'ed WindowState enums with "meta" enums + add "meta" WindowState enums PosSize and PosSizeState Change-Id: Icd16cfb498531aa7238ddbde83fcb0ed6d9e4f77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135426 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2022-05-05use more o3tl::getTokenNoel Grandin
found by inspecting call sites of OUString::getToken Change-Id: I4269c7476c7aa46fac39528227e350568f0eb34a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132644 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-13loplugin:stringviewparam whitelist some more functionsNoel Grandin
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>
2021-11-12Fix (mis-)uses of temporary O[U]StringLiteralStephan Bergmann
...as sub-expressions of ternary operators, which happened to keep compiling after 4b9e440c51be3e40326bc90c33ae69885bfb51e4 "Turn OStringLiteral into a consteval'ed, static-refcound rtl_String" and e6dfaf9f44f9939abc338c83b3024108431d0f69 "Turn OUStringLiteral into a consteval'ed, static-refcound rtl_uString" because both branches are of the same type O[U]StringLiteral<N>, and which didn't cause any issues because no dangling pointers to those temporary objects escaped the surrounding full expressions. This was found with an experimental build with VS 2022 with --enable-latest-c++, which would support HAVE_CPP_CONSTEVAL after some linking fix in the configure.ac detection code (which is forthcoming in a later commit) and flagged all these uses in ternary operators as error C7595 "call to immediate function is not a constant expression". That error looks bogus (and it also caused a false > sd/source/ui/unoidl/unoobj.cxx(742): error C7595: 'Color::Color': call to immediate function is not a constant expression so HAVE_CPP_CONSTEVAL will need to remain undefined for VS 2022 until that compiler bug is fixed), but it nicely found all these cases that should arguably be cleaned up. Change-Id: I81de94e8af5a6c50e5fe7dfa1a4b253e0c2a68f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125082 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-06sw: prefix members of SwLabCfgItemMiklos Vajna
See tdf#94879 for motivation. Change-Id: I00fdf912e5cacdf4152184e0164fcb25dfee575e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121704 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-08-11Drop convertMm100ToTwip in favor of the new o3tl::toTwipsMike Kaganski
Step by step, duplicates from <tools/UnitConversion.hxx> may go Change-Id: Id4c03ff8adc120ae06dbfdbdfb4f5ff0bb51f489 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120315 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-02convert #defines to OUStringLiteralNoel Grandin
mostly by doing $ git grep -l '#define.*\"' -- *.cxx | xargs perl -pi -e 's/^#define\s+(\w+)\s+(\".*\")/constexpr OUStringLiteral \1 = u\2;/g' Change-Id: I140932a94914d3870f0d92e11a6ada2b42359e30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119842 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-11Simplify Sequences initializations (sw)Julien Nabet
Change-Id: I02647bdb720620afe20284a069a71c19dbfcea05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116944 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-01-03tighten up asserting in SfxPoolItem::operator==Noel Grandin
...subclasses, so we always call the SfxPoolItem::operatar== which will ensure that we are always comparing two objects that belong to the same class. And fix the fallout in SvxUnoNameItemTable. Change-Id: I5ec7fedaa914a328897b54c016ad13e505a15937 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108599 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-28Change OUStringLiteral from char[] to char16_t[]Stephan Bergmann
This is a prerequisite for making conversion from OUStringLiteral to OUString more efficient at least for C++20 (by replacing its internals with a constexpr- generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount, conditionally for C++20 for now). For a configure-wise bare-bones build on Linux, size reported by `du -bs instdir` grew by 118792 bytes from 1155636636 to 1155755428. In most places just a u"..." string literal prefix had to be added. In some places char const a[] = "..."; variables have been changed to char16_t, and a few places required even further changes to code (which prompted the addition of include/o3tl/string_view.hxx helper function o3tl::equalsIgnoreAsciiCase and the additional OUString::createFromAscii overload). For all uses of macros expanding to string literals, the relevant uses have been rewritten as u"" MACRO instead of changing the macro definitions. It should be possible to change at least some of those macro definitions (and drop the u"" from their call sites) in follow-up commits. Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-03tdf#42949 Fix IWYU warnings in include/[t-x]*/*hxxGabor Kelemen
Recheck after 7-0 branchoff Also drop the now unused file include/vcl/field.hxx Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I9e54c82f50d1e02a0f99858939cac999fc66f7de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99261 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-07-30loplugin:flatten in sw/uibase/dbui..sw/uibase/envelpNoel Grandin
Change-Id: I20dc75b75e999ed82d221072d6ecaf2c02c834eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99793 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-22tdf#42949 Simplify use of rtl::math::approxEqual in include/basegfx/Gabor Kelemen
Turns out we can save about 500Mb of preprocessor input if we use rtl_math_approxEqual from rtl/math.h instead of its C++ wrapper rtl::math::approxEqual from rtl/math.hxx and manage the fallout accordingly. Before: bin/includebloat.awk | head sum total bytes included (excluding system headers): 19017296671 After: $ bin/includebloat.awk | head sum total bytes included (excluding system headers): 18535432672 Change-Id: I1691171f3a309405a7099882ad9989d147f59118 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92508 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-01-07tdf#42949 Fix IWYU warnings in sw/source/uibase/[a-g]*/*cxxGabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I07178531d1c1edbfcd1ec1feed0dbe96ed2627a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85793 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-12-12use covariant return type for SfxPoolItem::CloneCaolán McNamara
and can then remove some casting Change-Id: Id821c32ca2cbcdb7f57ef7a5fa1960042e630ffc Reviewed-on: https://gerrit.libreoffice.org/85022 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-12-09drop newly unused SfxFloatingWindowCaolán McNamara
Change-Id: I8ac3957579c76a89b9692bdb50cbe7a56e1693e3 Reviewed-on: https://gerrit.libreoffice.org/84444 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-11-05weld SwSyncChildWinCaolán McNamara
Change-Id: I23eef815ba05e07f50f86ec375c5dff3ef759d55 Reviewed-on: https://gerrit.libreoffice.org/81746 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-11-03loplugin:stringaddNoel Grandin
tweak the plugin to be more permissive, then validate by hand afterwards Change-Id: I40c5c911fe6ff7e45baaca372abf7dac211d9654 Reviewed-on: https://gerrit.libreoffice.org/81942 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-02New loplugin:conditionalstringStephan Bergmann
Change-Id: I2eab990c15f845b44a3b598571aca361dadf9ff3 Reviewed-on: https://gerrit.libreoffice.org/81946 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-06convert equals() to operator== in xmlreader::SpanNoel Grandin
Change-Id: Ic6a8eae344c06be87e2bc4bf7f242a2d18ebc8ad Reviewed-on: https://gerrit.libreoffice.org/80312 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-02loplugin:stringadd in swNoel Grandin
Change-Id: I72e1cbc229a47660b2313f46898753e273b69d35 Reviewed-on: https://gerrit.libreoffice.org/79985 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-28loplugin:constmethod in swNoel Grandin
Change-Id: I73c3c6d2165287d2d581a04b23b1d3b48166a488 Reviewed-on: https://gerrit.libreoffice.org/79780 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-05tdf#42949 Fix IWYU warnings in sw/source/uibase/inc/[l-z]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ie1c889bb9bd74b0d2bd859dad4c85a209db750a3 Reviewed-on: https://gerrit.libreoffice.org/76503 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-07-03Simplify Sequence iterations in sw/source/uibase/Arkadiy Illarionov
Use range-based loops, STL and comphelper functions Change-Id: Ia67ebfa0aa0abad855975b13e86e699811ef713a Reviewed-on: https://gerrit.libreoffice.org/75003 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
2019-05-04Use hasElements to check Sequence emptiness in swArkadiy Illarionov
Similar to clang-tidy readability-container-size-empty Change-Id: If44f20a7aa678915e32d12101e1af71476f4b590 Reviewed-on: https://gerrit.libreoffice.org/71679 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-18Get rid of aEmptyOUStrMike Kaganski
Commit 8051bb7e18ccae0f639e65dfa86bcc18a5fb9108 had removed its "String" counterpart. Change-Id: Id873a259e7f4b2794e94dec83d08ed6b57298beb Reviewed-on: https://gerrit.libreoffice.org/65299 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-11-19tdf#42949 Fix IWYU warnings in include/vcl/[ab]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: If18c80fc64e55d797953e24e40e5d5e62bd9c625 Reviewed-on: https://gerrit.libreoffice.org/63453 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-10-30Simplify containers iterations in sw/source/ui*Arkadiy Illarionov
Use range-based loop or replace with STL functions. Change-Id: I0d690e873f720a68f04991674ce84ec590231fd0 Reviewed-on: https://gerrit.libreoffice.org/62432 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-22loplugin:unusedfields improvemementsNoel Grandin
treat fields touched in operator== as not being important, which finds some more stuff (but also adds some false+) Change-Id: I3f5d504d7dec7945a917afbcd58c92df74f03645 Reviewed-on: https://gerrit.libreoffice.org/62020 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-09Extend loplugin:redundantinline to catch inline functions w/o external linkageStephan Bergmann
...where "inline" (in its meaning of "this function can be defined in multiple translation units") thus doesn't make much sense. (As discussed in compilerplugins/clang/redundantinline.cxx, exempt such "static inline" functions in include files for now.) All the rewriting has been done automatically by the plugin, except for one instance in sw/source/ui/frmdlg/column.cxx that used to involve an #if), plus some subsequent solenv/clang-format/reformat-formatted-files. Change-Id: Ib8b996b651aeafc03bbdc8890faa05ed50517224 Reviewed-on: https://gerrit.libreoffice.org/61573 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-07-30loplugin:stringloop in swNoel Grandin
Change-Id: Ie316aee8d1e4f772dc25725b46e130c6717458c2 Reviewed-on: https://gerrit.libreoffice.org/58331 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-04sw: prefix members of SwEnvCfgItemMiklos Vajna
Change-Id: I626a1d8055bf2e3d835cd340b095b59e0ec7195b Reviewed-on: https://gerrit.libreoffice.org/55261 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2018-04-29Avoid getTokenCountMatteo Casalin
Change-Id: Iad8a623a219b1e6158a1ec447bdc7853817d2086
2018-04-29Avoid getTokenCountMatteo Casalin
Change-Id: Idf94fa126580623c879023b04a2d9cbe54679b21
2018-04-17tdf#42949 Remove unnecessary localization headers from swGabor Kelemen
Found by searching for the header names and the localization function: git grep -l -e \<strings.hrc\> sw | xargs grep -c -e SwResId -e StartProgress -e GetResource | grep :0$ | grep -v /pch Change-Id: I041a4e8b4c4cc7414f83bd08e64a1ff921244b44 Reviewed-on: https://gerrit.libreoffice.org/52919 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-01-15More loplugin:cstylecast: swStephan Bergmann
Change-Id: I75f75b53e58221a3bd0a6eb837483e7ebae3a02b
2018-01-12More loplugin:cstylecast: swStephan Bergmann
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: I0f49d21dfdf82742f11b27709f74294feb1e419e
2017-11-27sw: prefix members of SwEnvItemMiklos Vajna
Change-Id: I8a56ad94978ff13428a4e25a9b5d70efa49e5005 Reviewed-on: https://gerrit.libreoffice.org/45304 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-11-21loplugin:flatten in swNoel Grandin
Change-Id: I64176f48d90303f078e326c8838da9eb2daf8126 Reviewed-on: https://gerrit.libreoffice.org/44937 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-19clang-tidy modernize-use-equals-default in sw/source/uibaseJochen Nitschke
removing unused assignment operators for SwDocDisplayItem, SwElemItem and SwShadowCursorItem, which are implicitly deleted now. Change-Id: I25200c3c61b77c5dedf7cf9de3edabc9d1e68730 Reviewed-on: https://gerrit.libreoffice.org/44928 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>