summaryrefslogtreecommitdiff
path: root/sd/source/ui/view/Outliner.cxx
AgeCommit message (Collapse)AuthorFilesLines
2024-01-15cid#1546380 COPY_INSTEAD_OF_MOVECaolán McNamara1-1/+1
and cid#1545812 COPY_INSTEAD_OF_MOVE cid#1545463 COPY_INSTEAD_OF_MOVE cid#1545290 COPY_INSTEAD_OF_MOVE cid#1545844 COPY_INSTEAD_OF_MOVE Change-Id: Ie6d997fc6282599631dc9e07e2e59893e499c239 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162058 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-04-24loplugin:unnecessarygetstr extend to more std::string checkingNoel Grandin1-2/+2
suggested by mike kaganski Change-Id: I5f5f254142767aca45a6101abdd84a0163ca6a34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150936 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-09new loplugin:unnecessarygetstrNoel Grandin1-7/+7
which prevents constructing unnecessary temporaries via getStr() Change-Id: I9ca70893a10e954b5ee0e6ad6098660ee24c2bef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150170 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-20improve loplugin:refcountingNoel Grandin1-1/+1
to catch places where we are converting a weak reference to a strong reference, and then using a pointer to store the result Change-Id: I69b132907b574e5c6974fadf18bd9658107d3a0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145877 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-12-16sd: check SfxViewFrame::Current()Caolán McNamara1-4/+6
these ones look potentially worth backporting Change-Id: I6153b0f9ead7caef9f228a5724f51823bcf87c07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144280 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-11-02tdf#54857 elide more dynamic_castNoel Grandin1-2/+2
Change-Id: I42bef355eeef15e3733a5ee57b0569887cfa5e84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142183 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-11basegfx: replace typedef with a class B2DSize based on Size2DTomaž Vajngerl1-2/+2
Change-Id: Id8b3c2bcf0bf4be5aba2812b0edda479bc20c6a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139683 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-08-29ref-count SdrObjectNoel Grandin1-5/+5
Which means we can get rid of the majestic hack of ScCaptionPtr Previously, SdrObject was manually managed, and the ownership passed around in very complicated fashion. Notes: (*) SvxShape has a strong reference to SdrObject, where previously it had a weak reference. It is now strong since otherwise the SdrObject will go away very eagerly. (*) SdrObject still has a weak reference to SvxShape (*) In the existing places that an SdrObject is being deleted, we now just clear the reference (*) instead of SwVirtFlyDrawObj removing itself from the page that contains inside it's destructor, make the call site do the removing from the page. (*) Needed to take the SolarMutex in UndoManagerHelper_Impl::impl_clear because this can be called from UNO (e.g. sfx2_complex JUnit test) and the SdrObjects need the SolarMutex when destructing. (*) handle a tricky situation with SwDrawVirtObj in the SwDrawModel destructor because the existing code wants mpDrawObj in SwAnchoredObject to be sometimes owning, sometimes not, which results in a cycle with the new code. Change-Id: I4d79df1660e386388e5d51030653755bca02a163 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138837 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-02-07tdf#145868 sd replace: if search changes, restart find/replaceJustin Luth1-0/+12
REPLACE is really a replaceAndFind instead of a findAndReplace. Thus, when you changed your search parameter and did a replace, it replaced the previously searched for item, and then found the first instance of the new search parameter. That of course is just wrong. So make sure to verify that the previous search matches the current search competely. However, that doesn't mean that the entire searchItem matches, since we don't want to restart the search just because the replace parameter changed. In my testing, this wasn't an issue for REPLACE_ALL. So the only time we need to worry about the last search result is in a replace once situation. P.S. This commit exposed that mpSearchItem can point to a destructed SvxSearchItem, so this patches unit test will crash if the other 7.4 commit is missing. Change-Id: I7be14d64534018718145c6ac5f8629ff5f2e5611 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129385 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-02-05tdf#123658 sd search: restart search start on slide changeJustin Luth1-0/+8
When the user switches between slides and then re-starts a search, they expect that the search will begin on the current slide. This fixes a somewhat 5.2 regression. Before that time, the first search attempt failed, but the second attempt started at the current slide. After 5.2 fixed the first-attempt-failure, the starting position was "the slide after the last find". This patch resets the starting position to the current slide, which I saw was done in every case by DetectChange(). I thought about moving all this logic into DetectChange, but it doesn't make much sense to affect a spell-checking dialog run by moving around in the slides, so just keep the logic here. I submitted the unit test in a PRIOR patch. The basic search was failing on WIN/MAC platforms and so I wanted to confirm that this was NOT my fault. Indeed, on those OSes the testing fails, so I just run it under Linux where it works fine. Change-Id: I4d1af3049bb2c0a59ec46f005c4b1773aefffb6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129204 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
2022-02-05be more stylistically standardCaolán McNamara1-4/+4
Change-Id: I8fa978a5b58faa79c9c07b2c832a56b4d5230dd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129504 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-02-04related tdf#145868 sd: Clone SvxSearchItem to avoid use after freeJustin Luth1-2/+1
I tested "if (mpSearchItem)" which passed, but then it crashed when trying to access (*mpSearchItem) == (*pSearchItem) because the mpSearchItem's DTOR had already been called prior to the if(mpSearchItem). Since mpSearchItem is never compared to another memory pointer, it is safe to assign it to a Clone. Steps to reproduce: 1.) open Impress and search for something 2.) change the search string to something else 3.) search again. Note that there isn't currently any code that hits this. I discovered it trying to craft a fix for bug 145868. Change-Id: Idc5f5a3e812ed3e49631347c35c3f4b2d8bb4127 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129347 Tested-by: Jenkins Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-10-10loplugin:moveparam in svxNoel Grandin1-2/+2
Change-Id: I2e422235129f810feea5c17afa1332d8b7ac14ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123332 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-20be more disciplined with SetUpdateLayout on editengineNoel Grandin1-1/+1
save/restore in more places, and check in more places before doing layout, so we dont waste time on expensive layout Change-Id: I311f1f7f97a508da296078e936cb3704938dfdc3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121687 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-02rename UpdateMode -> UpdateLayout in editeng classNoel Grandin1-8/+8
... because "update" is such a generic term I keep forgetting what we are turning on and off Also return the previous value from SetUpdateLayout to make the save/restore code more compact. Change-Id: Iae1764c837a92e58c9b17521f130e8fc80311d22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121479 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-02clang-tidy:readability-redundant-member-initNoel Grandin1-7/+0
Change-Id: I0a9b238c0ba551b330bee7b89eb6cd48fad1b265 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121488 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-11convert some LogicToLogic calls to use o3tl::convert insteadTomaž Vajngerl1-2/+2
If a LogicToLogic uses fixed units, we can use o3tl::convert instead. We can also do the same for all other cases where LogicToLogic is used, but that needs additional investigation to determine if it is safe to do so. Note: MapUnit::Pixel is converted to o3tl::Length::pt because it assumed 72 PPI for a logical pixel, which corresponds with the conversion rate of a point (72 PPI). Today, 96 PPI is standard, which is also used for o3tl::Length:px. Change-Id: I29126df38bfcfda74b5d83d4cb880a378aecd18b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120230 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-08-05Pass context and resource string down to boost::locale separatelyNoel Grandin1-1/+1
because this is often on a hot path, and we can avoid the splitting and joining of strings like this. Change-Id: Ia36047209368ca53431178c2e8723a18cfe8260a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119220 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-10sd: ubsan - fix heap-use-after-free in SdOutlinerTomaž Vajngerl1-30/+33
OutlinerView can change (old one deleted and new one create) so we can't store it in a local vairable and need to always fetch it. UBSAN Error log: ==21484==ERROR: AddressSanitizer: heap-use-after-free on address 0x606000af7d28 at pc 0x2ab7c5979405 bp 0x7ffcd1a3d1a0 sp 0x7ffcd1a3d198 READ of size 8 at 0x606000af7d28 thread T0 -0 0x2ab7c5979404 in std::__uniq_ptr_impl<EditView, std::default_delete<EditView> >::_M_ptr() const /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/unique_ptr.h:147:42 -1 0x2ab7c59792ea in std::unique_ptr<EditView, std::default_delete<EditView> >::get() const /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/unique_ptr.h:337:21 -2 0x2ab7c59791d9 in std::unique_ptr<EditView, std::default_delete<EditView> >::operator*() const /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/unique_ptr.h:322:2 -3 0x2ab7c59725da in OutlinerView::GetEditView() const /include/editeng/outliner.hxx:209:46 -4 0x2ab7c70e36bb in SdOutliner::SearchAndReplaceOnce(std::__debug::vector<sd::SearchSelection, std::allocator<sd::SearchSelection> >*) /sd/source/ui/view/Outliner.cxx:903:21 -5 0x2ab7c70dcb32 in SdOutliner::SearchAndReplaceAll() /sd/source/ui/view/Outliner.cxx:622:29 -6 0x2ab7c70da81b in SdOutliner::StartSearchAndReplace(SvxSearchItem const*) /sd/source/ui/view/Outliner.cxx:478:28 -7 0x2ab7c61e4fc5 in sd::FuSearch::SearchAndReplace(SvxSearchItem const*) /sd/source/ui/func/fusearch.cxx:128:44 -8 0x2ab7c5c61fc5 in sd::DrawDocShell::Execute(SfxRequest&) /sd/source/ui/docshell/docshel3.cxx:228:36 -9 0x2ab7c5cac074 in SfxStubDrawDocShellExecute(SfxShell*, SfxRequest&) /workdir/SdiTarget/sd/sdi/sdslots.hxx:18384:1 -10 0x2ab7cd885d8f in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) /sfx2/source/control/dispatch.cxx:253:9 -11 0x2ab7cd89bd8f in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) /sfx2/source/control/dispatch.cxx:753:9 -12 0x2ab7cd89ccd6 in SfxDispatcher::Execute(unsigned short, SfxCallMode, SfxItemSet const*, SfxItemSet const*, unsigned short) /sfx2/source/control/dispatch.cxx:811:9 -13 0x2ab7cdd11d76 in SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:738:46 -14 0x2ab7cdd15135 in SfxOfficeDispatch::dispatchWithNotification(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:243:16 -15 0x2ab7f54b25d7 in framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatch> const&, com::sun::star::util::URL const&, bool, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx:159:30 -16 0x2ab7f54b1531 in framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx:117:16 -17 0x2ab7f54b2d17 in non-virtual thunk to framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx -18 0x2ab7e63c546f in unotest::MacrosTest::dispatchCommand(com::sun::star::uno::Reference<com::sun::star::lang::XComponent> const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /unotest/source/cpp/macros_test.cxx:85:22 -19 0x2ab7b1a9ac2d in testSearchAllInDocumentAndNotes::TestBody() /sd/qa/unit/uiimpress.cxx:715:5 -20 0x2ab7b1b43f84 in void std::__invoke_impl<void, void (testSearchAllInDocumentAndNotes::*&)(), testSearchAllInDocumentAndNotes*&>(std::__invoke_memfun_deref, void (testSearchAllInDocumentAndNotes::*&)(), testSearchAllInDocumentAndNotes*&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/invoke.h:73:14 -21 0x2ab7b1b43b5e in std::__invoke_result<void (testSearchAllInDocumentAndNotes::*&)(), testSearchAllInDocumentAndNotes*&>::type std::__invoke<void (testSearchAllInDocumentAndNotes::*&)(), testSearchAllInDocumentAndNotes*&>(void (testSearchAllInDocumentAndNotes::*&)(), testSearchAllInDocumentAndNotes*&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/invoke.h:95:14 -22 0x2ab7b1b439b2 in void std::_Bind<void (testSearchAllInDocumentAndNotes::* (testSearchAllInDocumentAndNotes*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/functional:467:11 -23 0x2ab7b1b43612 in void std::_Bind<void (testSearchAllInDocumentAndNotes::* (testSearchAllInDocumentAndNotes*))()>::operator()<void>() /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/functional:549:17 -24 0x2ab7b1b426a1 in std::_Function_handler<void (), std::_Bind<void (testSearchAllInDocumentAndNotes::* (testSearchAllInDocumentAndNotes*))()> >::_M_invoke(std::_Any_data const&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/std_function.h:316:2 -25 0x2ab7b1aec1f1 in std::function<void ()>::operator()() const /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/std_function.h:706:14 -26 0x2ab7b1b41984 in CppUnit::TestCaller<testSearchAllInDocumentAndNotes>::runTest() /workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:175:7 -27 0x2ab765f655ba in CppUnit::TestCaseMethodFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5 -28 0x2ab780dd0937 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /test/source/vclbootstrapprotector.cxx:46:14 -29 0x2ab765f36c47 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 -30 0x2ab775453fd7 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:78:12 -31 0x2ab765f36c47 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 -32 0x2ab771f47962 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:62:16 -33 0x2ab765f36c47 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 -34 0x2ab765ecdf84 in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12 -35 0x2ab765f36c47 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 -36 0x2ab765f30697 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:86:18 -37 0x2ab765fcfa79 in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:182:28 -38 0x2ab765f63c21 in CppUnit::TestCase::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:13 -39 0x2ab765f67a52 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30 -40 0x2ab765f66c4a in CppUnit::TestComposite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3 -41 0x2ab765f67a52 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30 -42 0x2ab765f66c4a in CppUnit::TestComposite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3 -43 0x2ab765ffd60e in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:27 -44 0x2ab765fce4de in CppUnit::TestResult::runTest(CppUnit::Test*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:149:9 -45 0x2ab765ffe56b in CppUnit::TestRunner::run(CppUnit::TestResult&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:14 -46 0x4ff42e in (anonymous namespace)::ProtectedFixtureFunctor::run() const /sal/cppunittester/cppunittester.cxx:324:20 -47 0x4fb90c in sal_main() /sal/cppunittester/cppunittester.cxx:474:20 -48 0x4fa40e in main /sal/cppunittester/cppunittester.cxx:381:1 -49 0x2ab767c44554 in __libc_start_main (/lib64/libc.so.6+0x22554) -50 0x425e04 in _start (/workdir/LinkTarget/Executable/cppunittester+0x425e04) 0x606000af7d28 is located 8 bytes inside of 56-byte region [0x606000af7d20,0x606000af7d58) freed by thread T0 here: -0 0x4f75f0 in operator delete(void*) /home/tdf/lode/packages/llvm-llvmorg-9.0.1.src/compiler-rt/lib/asan/asan_new_delete.cc:160 -1 0x2ab7c70c42b1 in SdOutliner::Implementation::ProvideOutlinerView(Outliner&, std::shared_ptr<sd::ViewShell> const&, vcl::Window*) /sd/source/ui/view/Outliner.cxx:1988:17 -2 0x2ab7c70c1302 in SdOutliner::SetViewShell(std::shared_ptr<sd::ViewShell> const&) /sd/source/ui/view/Outliner.cxx:1743:17 -3 0x2ab7c70ed9f4 in SdOutliner::SetViewMode(PageKind) /sd/source/ui/view/Outliner.cxx:1571:5 -4 0x2ab7c70f309e in SdOutliner::SetObject(sd::outliner::IteratorPosition const&) /sd/source/ui/view/Outliner.cxx:1720:5 -5 0x2ab7c70f3db6 in SdOutliner::PrepareSearchAndReplace() /sd/source/ui/view/Outliner.cxx:1507:13 -6 0x2ab7c70d4b3f in SdOutliner::ProvideNextTextObject() /sd/source/ui/view/Outliner.cxx:1302:33 -7 0x2ab7c70e30f0 in SdOutliner::SearchAndReplaceOnce(std::__debug::vector<sd::SearchSelection, std::allocator<sd::SearchSelection> >*) /sd/source/ui/view/Outliner.cxx:892:17 -8 0x2ab7c70dcb32 in SdOutliner::SearchAndReplaceAll() /sd/source/ui/view/Outliner.cxx:622:29 -9 0x2ab7c70da81b in SdOutliner::StartSearchAndReplace(SvxSearchItem const*) /sd/source/ui/view/Outliner.cxx:478:28 -10 0x2ab7c61e4fc5 in sd::FuSearch::SearchAndReplace(SvxSearchItem const*) /sd/source/ui/func/fusearch.cxx:128:44 -11 0x2ab7c5c61fc5 in sd::DrawDocShell::Execute(SfxRequest&) /sd/source/ui/docshell/docshel3.cxx:228:36 -12 0x2ab7c5cac074 in SfxStubDrawDocShellExecute(SfxShell*, SfxRequest&) /workdir/SdiTarget/sd/sdi/sdslots.hxx:18384:1 -13 0x2ab7cd885d8f in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) /sfx2/source/control/dispatch.cxx:253:9 -14 0x2ab7cd89bd8f in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) /sfx2/source/control/dispatch.cxx:753:9 -15 0x2ab7cd89ccd6 in SfxDispatcher::Execute(unsigned short, SfxCallMode, SfxItemSet const*, SfxItemSet const*, unsigned short) /sfx2/source/control/dispatch.cxx:811:9 -16 0x2ab7cdd11d76 in SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:738:46 -17 0x2ab7cdd15135 in SfxOfficeDispatch::dispatchWithNotification(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:243:16 -18 0x2ab7f54b25d7 in framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatch> const&, com::sun::star::util::URL const&, bool, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx:159:30 -19 0x2ab7f54b1531 in framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx:117:16 -20 0x2ab7f54b2d17 in non-virtual thunk to framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx -21 0x2ab7e63c546f in unotest::MacrosTest::dispatchCommand(com::sun::star::uno::Reference<com::sun::star::lang::XComponent> const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /unotest/source/cpp/macros_test.cxx:85:22 -22 0x2ab7b1a9ac2d in testSearchAllInDocumentAndNotes::TestBody() /sd/qa/unit/uiimpress.cxx:715:5 -23 0x2ab7b1b43f84 in void std::__invoke_impl<void, void (testSearchAllInDocumentAndNotes::*&)(), testSearchAllInDocumentAndNotes*&>(std::__invoke_memfun_deref, void (testSearchAllInDocumentAndNotes::*&)(), testSearchAllInDocumentAndNotes*&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/invoke.h:73:14 -24 0x2ab7b1b43b5e in std::__invoke_result<void (testSearchAllInDocumentAndNotes::*&)(), testSearchAllInDocumentAndNotes*&>::type std::__invoke<void (testSearchAllInDocumentAndNotes::*&)(), testSearchAllInDocumentAndNotes*&>(void (testSearchAllInDocumentAndNotes::*&)(), testSearchAllInDocumentAndNotes*&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/invoke.h:95:14 -25 0x2ab7b1b439b2 in void std::_Bind<void (testSearchAllInDocumentAndNotes::* (testSearchAllInDocumentAndNotes*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/functional:467:11 -26 0x2ab7b1b43612 in void std::_Bind<void (testSearchAllInDocumentAndNotes::* (testSearchAllInDocumentAndNotes*))()>::operator()<void>() /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/functional:549:17 -27 0x2ab7b1b426a1 in std::_Function_handler<void (), std::_Bind<void (testSearchAllInDocumentAndNotes::* (testSearchAllInDocumentAndNotes*))()> >::_M_invoke(std::_Any_data const&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/std_function.h:316:2 -28 0x2ab7b1aec1f1 in std::function<void ()>::operator()() const /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/std_function.h:706:14 -29 0x2ab7b1b41984 in CppUnit::TestCaller<testSearchAllInDocumentAndNotes>::runTest() /workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:175:7 Change-Id: I0b4616cd3813565bc58b7a84320cbf52dd654a3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116879 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-06-06tdf#142478 fix crash when searching and a viewshell change occursTomaž Vajngerl1-1/+11
When searching a impress document for a word, and the word is in notes as welll as in the document, a crash happens (only when searching with "find all"). The regressing commit changed that the search is now bound to a view (and to a viewshell). When searching for words in notes and document, at the transition from "standard" to "notes" page kind mode, the view and viewshells are destroyed and the new one created again. The problem lies here as when we destroy the viewshell, we also destroy the search context and FuSearch objects, but we are still executing the search -> crash. The solution for this is that when we change the page kind, we take the FuSearch object from the old viewshell and put it into the newly created viewshell, so that we keep the FuSearch object alive and don't throw away the search context too. Change-Id: I50931cca2a20c5704f7450e3cc8b3466af4c5a3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116758 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-04-06remove Application::GetDefDialogParent call in editengCaolán McNamara1-0/+1
and pass in an explicit parent to use Change-Id: I1aa768ec5ac13b2097b78499f964a3590a0ac14e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113695 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-01-19vcl: remove or rename too long methods names in VectorGraphicDataTomaž Vajngerl1-1/+1
Change-Id: I8a64d27927b608afdc7996e0b0bbc59a58fde90f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108443 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-10-13static_cast after dynamic_castNoel1-2/+2
Change-Id: I53e10fbebfd07c471ddd9b264562317251700500 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104225 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-06loplugin:const* make some params and methods constNoel1-4/+4
Change-Id: I97c5bbb929a2a4a029af4e6cb0fd571bbc2b698b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104030 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-29sd: Make search bound to a view - to allow independent searchingTomaž Vajngerl1-3/+9
Before if two windows are open, the search is not independent because Outline class is not independent for a view (because of FuSearch which remembers the view from when the it was created and then an instance is stored in the DocShell). This creates a SearchContext class stored on a View, which stores the actual View bound FuSearch instance, fix us the calls. Also move the VectorGraphicSearchContext back into Outline::Impl, because it doesn't need to be bound to the view anymore. Change-Id: I6a5ce71efafa378845eee4ac9574e2e4301138d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101224 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-08-29Fix typo in codeAndrea Gelmini1-3/+3
It passed "make check" on Linux Change-Id: I173e4887af5cbe3c660412d8463a5a82ee2c5724 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101591 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-17move vector graphic search to View, so it works in multiple viewsTomaž Vajngerl1-34/+25
VectorGraphicSearch was instantiated for the Outline, which is the same for every view. The problem with this is that when we have multiple views, the search would interfere with each other, which is especially distracting in online when multiple users connect to the same document and try searching. This adds VectorGraphicSearchContext class, that is added to the View, which makes the search view dependent and multiple instances of VectorGraphicSearch are created, each one for its own view. Change-Id: Ia0f34647b30b35f4ddb84d33353990d635756905 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100837 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-08-03loplugin:flatten in sdNoel Grandin1-22/+22
Change-Id: I57cf26d800d8d414014b88c250ee1cbd47551bc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100007 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-04sd: support match case, match whole word for PDF searchTomaž Vajngerl1-4/+12
THis adds support for match case and match whole word to the VectorGraphicSearch + tests. It uses the new options in PDF seearch in Draw/Impress. Change-Id: I20a6382c22bf01a5a021c8bae1ff78861419c0ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95530 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-04sd: allow to change the search string between searchesTomaž Vajngerl1-5/+11
Before this was missing, so even with a different search string, it still searched using the old string, which was a bug. Change-Id: I1655cb421e216e30ae593aabd3ead3a2d5c06299 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95461 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-04sd: add support to search backwards in PDF searchTomaž Vajngerl1-3/+18
Change-Id: I2c7f75d16a430dcfa892d28fb6b4f64118705ad2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95459 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-04sd: PDF search - reset mpVectorGraphicSearch at more placesTomaž Vajngerl1-22/+23
and simplify the case when the search doesn't find a match in the vector graphic. Change-Id: I3e086e8e36f8a578711eed6d4dcca65c0c4c6268 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95456 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-04sd: fix issue when PDF search doesn't send a search result + testTomaž Vajngerl1-1/+1
This fixes the issue when PDF search doesn't send the search result, because of premature exit. Also add test which reproduces this issue and tests the behavior of searching in multiple objects. Change-Id: I3a676eeac36bde88c67e90a49583444b8595a346 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95454 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-03sd: use getPDFSelection to get the search selection for LOKitTomaž Vajngerl1-19/+5
This reduces code duplication. Change-Id: I0a6a44d696841d1573d23f87353ac055cc92c83a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95386 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-03sd: fix not found case in PDF search + add PDF Search testsTomaž Vajngerl1-0/+15
When searching the PDF and the search text is not found (anymore) in the current VectorGraphicSearch, we need to remove it and mark that we don't currently search in a vector graphic (PDF) anymore. This wasn't handled correctly and caused a crash. In addition add a LOKit test for search into a PDF document, to make sure the not-found case and usual searching case are working correctly. Change-Id: I663a6b2cf4879f11d62e440ea0c35ffcd205f81f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95380 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-03sd: use b2DRectangleFromRectangle from canvastools.hxxTomaž Vajngerl1-11/+3
Change-Id: I8604b80f887a2c3a1143b8a9bc70f429576512f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95350 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-02sd: remove code dupl. when getting PDF text selection for LOKTomaž Vajngerl1-13/+23
Change-Id: I61d0a9851e9cfe60e9672acec38946b0b25f310f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95349 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-02sd: Search inside PDF document that were inserted as a graphicTomaž Vajngerl1-38/+209
This implements searching inside PDF documents that were inserted into the Draw/Impress document as a graphics and marks the areas of text that matches the search string. Complex (regex) search is not supported. Change-Id: I55d67772a2fe876ae72b9164998347304025d3e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95348 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-02sd: some style fixes in Outliner.cxxTomaž Vajngerl1-5/+7
Also no need to reset the mpImpl in destructor when it will be reset and destroyed in the next step anyway. Change-Id: I5027f962efc4159e61aa7eda26619db2e3b9434c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95309 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-02sd: in Outline add getViewShellBase to simplify codeTomaž Vajngerl1-4/+14
This simplifies constant casting of SfxViewShell::Current to sd::ViewShellBase. Instead of doing it in every method, let's have a dedicated function for that. Change-Id: Iadbe446c7edce5df40c2da14e3eee65012dd4d77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95308 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-02sd: move IsValidTextObject into source as anon. functionTomaž Vajngerl1-7/+13
IsValidTextObject is only used internally in Outline, so put it inside the source file as an anonymous function and not as a member function of Outliner. Change-Id: I867dc4f465a694e61b6102b19f8e54ce623e2858 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95307 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-06-02sd: move LOK search result logic to it's own methodTomaž Vajngerl1-49/+61
Change-Id: I67cbe4d3d63bffdab72c09b3a956f67806588348 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95306 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-05-28Resolves: tdf#133411 drop CONTENT_FLOWS_TO from dialog to search resultsCaolán McNamara1-10/+0
in the document, looks like only the calc one actually works, and when it works on large quantities of results calc grinds to a complete halt This was introduced with: commit b41332475783c31136673fb44cf4c411bb0148f8 Date: Mon Dec 2 15:54:29 2013 +0000 Integrate branch of IAccessible2 and has been a problem on and off with calc's potentially ~infinite grid There is the on-by-default search results dialog in calc (which has a limit on how many it shows) which provides an alternative route to iterate through the results Change-Id: I2685e480d2d15220be0bddbc83baad3992e7d5d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95006 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-05-28Related: tdf#133411 SetDocWin is using the previous search success stateCaolán McNamara1-2/+1
not the new state The order of calls probably didn't matter in the past where the use of the flag was deferred until the Accessibility data was queried which would happen in another event loop. This makes it more clear that it appears that only calc actually does anything productive here. I think this flow-to has created more trouble that its worth and I'll remove it but if we need to restore it, then this, I think, it the working state to restore to. Change-Id: Id6fbb483c081f6d5142100d70c1b29705dcb6452 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95005 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-05-23sd: move SearchSelection constructor to header fileTomaž Vajngerl1-11/+0
Change-Id: I71d7986044208b6c733c1d46db7bf84bc6254915 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94727 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-12-22sd: LOK: don't access null dispatcherAshod Nakashian1-18/+22
With SpellDialog invoked from multiple views the dispatcher can indeed be null in some cases. (cherry picked from commit b18c12f4dbe91379cef795d559c2d84341e32a75) Reviewed-on: https://gerrit.libreoffice.org/83631 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> (cherry picked from commit 188ff24ee209d4f5f8ec6a6ae82241e56f0be6d5) Change-Id: Ic2950e70383a77d63438341fac174d369748b36a Reviewed-on: https://gerrit.libreoffice.org/85676 Tested-by: Jenkins Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2019-10-31tdf#113041: Kill WaitCursor after FindAll in Draw and ImpressMuhammet Kara1-2/+2
Change-Id: Ibfbbc673a00839f538febc5bab1140b2e53535eb Reviewed-on: https://gerrit.libreoffice.org/81809 Tested-by: Jenkins Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
2019-10-23Resolves: tdf#128313 disambiguate flow-to search resultsCaolán McNamara1-1/+1
for a11y between find/replace where our result is a single thing, and find-all/replace-all where the result is potentially many things, which allows that searching in a selected calc column will flow-to the current cell, not the entire ~infinite set of cells in the column Change-Id: Ib3e56fceb90d869f157427f090cdffe986a5a588 Reviewed-on: https://gerrit.libreoffice.org/81396 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-09-29loplugin:constmethod in sdNoel Grandin1-1/+1
Change-Id: I063194abe47d8c1d3d9202bbe4b01d79c36ceda3 Reviewed-on: https://gerrit.libreoffice.org/79790 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>