Files
libreoffice/chart2/source/controller/sidebar/ChartLinePanel.cxx

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

291 lines
8.7 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "ChartLinePanel.hxx"
#include <ChartController.hxx>
#include <ChartModel.hxx>
#include <svx/xlnwtit.hxx>
#include <svx/xlinjoit.hxx>
#include <svx/xlntrit.hxx>
#include <svx/linectrl.hxx>
#include <svx/tbcontrl.hxx>
#include <sfx2/weldutils.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <comphelper/lok.hxx>
#include <sfx2/viewsh.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
namespace chart::sidebar {
namespace {
SvxLineStyleToolBoxControl* getLineStyleToolBoxControl(const ToolbarUnoDispatcher& rToolBoxColor)
{
css::uno::Reference<css::frame::XToolbarController> xController = rToolBoxColor.GetControllerForCommand(".uno:XLineStyle");
Revert all the recent loplugin:unocast changes ...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>
2023-01-04 16:43:40 +01:00
SvxLineStyleToolBoxControl* pToolBoxLineStyleControl = dynamic_cast<SvxLineStyleToolBoxControl*>(xController.get());
return pToolBoxLineStyleControl;
}
SvxColorToolBoxControl* getColorToolBoxControl(const ToolbarUnoDispatcher& rToolBoxLineStyle)
{
css::uno::Reference<css::frame::XToolbarController> xController = rToolBoxLineStyle.GetControllerForCommand(".uno:XLineColor");
SvxColorToolBoxControl* pToolBoxColorControl = dynamic_cast<SvxColorToolBoxControl*>(xController.get());
return pToolBoxColorControl;
}
OUString getCID(const rtl::Reference<::chart::ChartModel>& xModel)
{
css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
if (!xSelectionSupplier.is())
return OUString();
css::uno::Any aAny = xSelectionSupplier->getSelection();
if (!aAny.hasValue())
return OUString();
OUString aCID;
aAny >>= aCID;
return aCID;
}
css::uno::Reference<css::beans::XPropertySet> getPropSet(
const rtl::Reference<::chart::ChartModel>& xModel)
{
OUString aCID = getCID(xModel);
css::uno::Reference<css::beans::XPropertySet> xPropSet =
ObjectIdentifier::getObjectPropertySet(aCID, xModel);
ObjectType eType = ObjectIdentifier::getObjectType(aCID);
if (eType == OBJECTTYPE_DIAGRAM)
{
css::uno::Reference<css::chart2::XDiagram> xDiagram(
xPropSet, css::uno::UNO_QUERY);
if (!xDiagram.is())
return xPropSet;
xPropSet.set(xDiagram->getWall());
}
return xPropSet;
}
class PreventUpdate
{
public:
explicit PreventUpdate(bool& bUpdate):
mbUpdate(bUpdate)
{
mbUpdate = false;
}
~PreventUpdate()
{
mbUpdate = true;
}
private:
bool& mbUpdate;
};
}
std::unique_ptr<PanelLayout> ChartLinePanel::Create(
weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController)
{
if (pParent == nullptr)
throw css::lang::IllegalArgumentException("no parent Window given to ChartAxisPanel::Create", nullptr, 0);
if (!rxFrame.is())
throw css::lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", nullptr, 1);
return std::make_unique<ChartLinePanel>(pParent, rxFrame, pController);
}
ChartLinePanel::ChartLinePanel(weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController):
svx::sidebar::LinePropertyPanelBase(pParent, rxFrame),
mxModel(pController->getChartModel()),
mxListener(new ChartSidebarModifyListener(this)),
mxSelectionListener(new ChartSidebarSelectionListener(this)),
mbUpdate(true),
mbModelValid(true),
maLineColorWrapper(mxModel, getColorToolBoxControl(*mxColorDispatch), "LineColor"),
maLineStyleWrapper(mxModel, getLineStyleToolBoxControl(*mxLineStyleDispatch))
{
disableArrowHead();
std::vector<ObjectType> aAcceptedTypes { OBJECTTYPE_PAGE, OBJECTTYPE_DIAGRAM,
OBJECTTYPE_DATA_SERIES, OBJECTTYPE_DATA_POINT,
OBJECTTYPE_TITLE, OBJECTTYPE_LEGEND, OBJECTTYPE_DATA_CURVE,
OBJECTTYPE_DATA_AVERAGE_LINE, OBJECTTYPE_AXIS};
mxSelectionListener->setAcceptedTypes(std::move(aAcceptedTypes));
Initialize();
}
ChartLinePanel::~ChartLinePanel()
{
doUpdateModel(nullptr);
}
void ChartLinePanel::Initialize()
{
mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
SvxColorToolBoxControl* pToolBoxColor = getColorToolBoxControl(*mxColorDispatch);
pToolBoxColor->setColorSelectFunction(maLineColorWrapper);
SvxLineStyleToolBoxControl* pToolBoxLineStyle = getLineStyleToolBoxControl(*mxLineStyleDispatch);
pToolBoxLineStyle->setLineStyleSelectFunction(maLineStyleWrapper);
setMapUnit(MapUnit::Map100thMM);
updateData();
}
void ChartLinePanel::updateData()
{
if (!mbUpdate || !mbModelValid)
return;
SolarMutexGuard aGuard;
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
if (!xPropSet.is())
return;
sal_uInt16 nLineTransparence = 0;
xPropSet->getPropertyValue("LineTransparence") >>= nLineTransparence;
XLineTransparenceItem aLineTransparenceItem(nLineTransparence);
updateLineTransparence(false, true, &aLineTransparenceItem);
sal_uInt32 nWidth = 0;
xPropSet->getPropertyValue("LineWidth") >>= nWidth;
XLineWidthItem aWidthItem(nWidth);
updateLineWidth(false, true, &aWidthItem);
maLineStyleWrapper.updateData();
maLineColorWrapper.updateData();
}
void ChartLinePanel::modelInvalid()
{
mbModelValid = false;
}
void ChartLinePanel::selectionChanged(bool bCorrectType)
{
if (bCorrectType)
updateData();
}
void ChartLinePanel::doUpdateModel(rtl::Reference<::chart::ChartModel> xModel)
{
if (mbModelValid)
{
mxModel->removeModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (oldSelectionSupplier.is()) {
oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
}
updateModel must remove the SelectionChangeListener from the old controller ...and not just add it to the new controller. It caused > $ SAL_USE_VCLPLUGIN=gen make UITest_chart UITEST_TEST_NAME=chartLegend.chartLegend.test_chart_display_legend_dialog to fail with > ==346284==ERROR: AddressSanitizer: heap-use-after-free on address 0x61a00049cca8 at pc 0x7f8496747751 bp 0x7fff7c483f10 sp 0x7fff7c483f08 > READ of size 8 at 0x61a00049cca8 thread T0 > #0 in chart::sidebar::ChartSidebarSelectionListener::selectionChanged(com::sun::star::lang::EventObject const&) at chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx:66:15 > #1 in chart::ChartController::impl_notifySelectionChangeListeners() at chart2/source/controller/main/ChartController_Window.cxx:1740:28 > #2 in chart::ChartController::impl_selectObjectAndNotiy() at chart2/source/controller/main/ChartController_Window.cxx:1756:5 > #3 in chart::ChartController::modeChanged(com::sun::star::util::ModeChangeEvent const&) at chart2/source/controller/main/ChartController.cxx:538:31 > #4 in chart::ChartView::impl_notifyModeChangeListener(rtl::OUString const&) at chart2/source/view/main/ChartView.cxx:2653:32 > #5 in chart::ChartView::impl_updateView(bool) at chart2/source/view/main/ChartView.cxx:2561:9 > #6 in chart::ChartView::update() at chart2/source/view/main/ChartView.cxx:2687:5 > #7 in chart::ChartController::execute_Paint(OutputDevice&, tools::Rectangle const&) at chart2/source/controller/main/ChartController_Window.cxx:485:25 > #8 in chart::ChartWindow::Paint(OutputDevice&, tools::Rectangle const&) at chart2/source/controller/main/ChartWindow.cxx:99:30 > #9 in PaintHelper::DoPaint(vcl::Region const*) at vcl/source/window/paint.cxx:309:24 > #10 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) at vcl/source/window/paint.cxx:613:17 > #11 in PaintHelper::~PaintHelper() at vcl/source/window/paint.cxx:549:30 > #12 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) at vcl/source/window/paint.cxx:619:1 > #13 in PaintHelper::~PaintHelper() at vcl/source/window/paint.cxx:549:30 > #14 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) at vcl/source/window/paint.cxx:619:1 > #15 in PaintHelper::~PaintHelper() at vcl/source/window/paint.cxx:549:30 > #16 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) at vcl/source/window/paint.cxx:619:1 > #17 in PaintHelper::~PaintHelper() at vcl/source/window/paint.cxx:549:30 > #18 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) at vcl/source/window/paint.cxx:619:1 > #19 in PaintHelper::~PaintHelper() at vcl/source/window/paint.cxx:549:30 > #20 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) at vcl/source/window/paint.cxx:619:1 > #21 in PaintHelper::~PaintHelper() at vcl/source/window/paint.cxx:549:30 > #22 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) at vcl/source/window/paint.cxx:619:1 > #23 in PaintHelper::~PaintHelper() at vcl/source/window/paint.cxx:549:30 > #24 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) at vcl/source/window/paint.cxx:619:1 > #25 in PaintHelper::~PaintHelper() at vcl/source/window/paint.cxx:549:30 > #26 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) at vcl/source/window/paint.cxx:619:1 > #27 in vcl::Window::ImplCallOverlapPaint() at vcl/source/window/paint.cxx:637:9 > #28 in vcl::Window::ImplHandlePaintHdl(Timer*) at vcl/source/window/paint.cxx:660:9 > #29 in vcl::Window::LinkStubImplHandlePaintHdl(void*, Timer*) at vcl/source/window/paint.cxx:641:1 > #30 in Link<Timer*, void>::Call(Timer*) const at include/tools/link.hxx:111:45 > #31 in Timer::Invoke() at vcl/source/app/timer.cxx:75:21 > #32 in Scheduler::ProcessTaskScheduling() at vcl/source/app/scheduler.cxx:478:20 > #33 in Scheduler::CallbackTaskScheduling() at vcl/source/app/scheduler.cxx:287:5 > #34 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54:13 > #35 in X11SalData::Timeout() at vcl/unx/generic/app/saldata.cxx:551:41 > #36 in SalXLib::CheckTimeout(bool) at vcl/unx/generic/app/saldata.cxx:635:17 > #37 in SalXLib::Yield(bool, bool) at vcl/unx/generic/app/saldata.cxx:716:25 > #38 in X11SalInstance::DoYield(bool, bool) at vcl/unx/generic/app/salinst.cxx:182:20 > #39 in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:454:48 > #40 in Application::Yield() at vcl/source/app/svapp.cxx:518:5 > #41 in Application::Execute() at vcl/source/app/svapp.cxx:433:9 > #42 in desktop::Desktop::Main() at desktop/source/app/app.cxx:1602:17 > #43 in ImplSVMain() at vcl/source/app/svmain.cxx:196:35 > #44 in SVMain() at vcl/source/app/svmain.cxx:228:12 > #45 in soffice_main at desktop/source/app/sofficemain.cxx:107:12 > #46 in sal_main at desktop/source/app/main.c:48:15 > #47 in main at desktop/source/app/main.c:47:1 > 0x61a00049cca8 is located 1064 bytes inside of 1160-byte region [0x61a00049c880,0x61a00049cd08) > freed by thread T0 here: > #0 in operator delete(void*, unsigned long) at compiler-rt/lib/asan/asan_new_delete.cpp:172:3 > #1 in chart::sidebar::ChartLinePanel::~ChartLinePanel() at chart2/source/controller/sidebar/ChartLinePanel.cxx:143:1 > #2 in VclReferenceBase::release() const at include/vcl/vclreferencebase.hxx:40:13 > #3 in rtl::Reference<vcl::Window>::~Reference() at include/rtl/ref.hxx:92:22 > #4 in VclPtr<vcl::Window>::disposeAndClear() at include/vcl/vclptr.hxx:208:5 > #5 in sfx2::sidebar::SidebarPanelBase::disposing() at sfx2/source/sidebar/SidebarPanelBase.cxx:81:15 > #6 in cppu::WeakComponentImplHelperBase::dispose() at cppuhelper/source/implbase.cxx:102:17 > #7 in cppu::PartialWeakComponentImplHelper<com::sun::star::ui::XContextChangeEventListener, com::sun::star::ui::XUIElement, com::sun::star::ui::XToolPanel, com::sun::star::ui::XSidebarPanel, com::sun::star::ui::XUpdateModel>::dispose() at include/cppuhelper/compbase.hxx:90:36 > #8 in sfx2::sidebar::Panel::dispose() at sfx2/source/sidebar/Panel.cxx:106:25 > #9 in VclReferenceBase::disposeOnce() at vcl/source/outdev/vclreferencebase.cxx:38:5 > #10 in VclPtr<sfx2::sidebar::Panel>::disposeAndClear() at include/vcl/vclptr.hxx:206:19 > #11 in sfx2::sidebar::Deck::dispose() at sfx2/source/sidebar/Deck.cxx:92:17 > #12 in VclReferenceBase::disposeOnce() at vcl/source/outdev/vclreferencebase.cxx:38:5 > #13 in VclPtr<sfx2::sidebar::Deck>::disposeAndClear() at include/vcl/vclptr.hxx:206:19 > #14 in sfx2::sidebar::SidebarController::CreateDeck(rtl::OUString const&, sfx2::sidebar::Context const&, bool) at sfx2/source/sidebar/SidebarController.cxx:664:19 > #15 in sfx2::sidebar::SidebarController::SwitchToDeck(sfx2::sidebar::DeckDescriptor const&, sfx2::sidebar::Context const&) at sfx2/source/sidebar/SidebarController.cxx:822:5 > #16 in sfx2::sidebar::SidebarController::UpdateConfigurations() at sfx2/source/sidebar/SidebarController.cxx:569:9 > #17 in sfx2::sidebar::SidebarController::SidebarController(sfx2::sidebar::SidebarDockingWindow*, SfxViewFrame const*)::$_3::operator()() const at sfx2/source/sidebar/SidebarController.cxx:140:52 > #18 in void std::__invoke_impl<void, sfx2::sidebar::SidebarController::SidebarController(sfx2::sidebar::SidebarDockingWindow*, SfxViewFrame const*)::$_3&>(std::__invoke_other, sfx2::sidebar::SidebarController::SidebarController(sfx2::sidebar::SidebarDockingWindow*, SfxViewFrame const*)::$_3&) at include/c++/10.0.1/bits/invoke.h:60:14 > #19 in std::enable_if<is_invocable_r_v<void, sfx2::sidebar::SidebarController::SidebarController(sfx2::sidebar::SidebarDockingWindow*, SfxViewFrame const*)::$_3&>, void>::type std::__invoke_r<void, sfx2::sidebar::SidebarController::SidebarController(sfx2::sidebar::SidebarDockingWindow*, SfxViewFrame const*)::$_3&>(sfx2::sidebar::SidebarController::SidebarController(sfx2::sidebar::SidebarDockingWindow*, SfxViewFrame const*)::$_3&) at include/c++/10.0.1/bits/invoke.h:110:2 > #20 in std::_Function_handler<void (), sfx2::sidebar::SidebarController::SidebarController(sfx2::sidebar::SidebarDockingWindow*, SfxViewFrame const*)::$_3>::_M_invoke(std::_Any_data const&) at include/c++/10.0.1/bits/std_function.h:291:9 > #21 in std::function<void ()>::operator()() const at include/c++/10.0.1/bits/std_function.h:622:14 > #22 in sfx2::sidebar::AsynchronousCall::HandleUserCall(void*) at sfx2/source/sidebar/AsynchronousCall.cxx:66:9 > #23 in sfx2::sidebar::AsynchronousCall::LinkStubHandleUserCall(void*, void*) at sfx2/source/sidebar/AsynchronousCall.cxx:62:1 > #24 in Link<void*, void>::Call(void*) const at include/tools/link.hxx:111:45 > #25 in ImplHandleUserEvent(ImplSVEvent*) at vcl/source/window/winproc.cxx:2009:30 > #26 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) at vcl/source/window/winproc.cxx:2562:13 > #27 in SalFrame::CallCallback(SalEvent, void const*) const at vcl/inc/salframe.hxx:306:29 > #28 in SalGenericDisplay::ProcessEvent(SalUserEventList::SalUserEvent) at vcl/unx/generic/app/gendisp.cxx:66:22 > #29 in SalUserEventList::DispatchUserEvents(bool) at vcl/source/app/salusereventlist.cxx:108:17 > #30 in SalGenericDisplay::DispatchInternalEvent(bool) at vcl/unx/generic/app/gendisp.cxx:51:12 > #31 in SalX11Display::Yield() at vcl/unx/generic/app/saldisp.cxx:1918:9 > #32 in DisplayYield(int, void*) at vcl/unx/generic/app/saldisp.cxx:414:13 > #33 in (anonymous namespace)::YieldEntry::HandleNextEvent() const at vcl/unx/generic/app/saldata.cxx:566:38 > #34 in SalXLib::Yield(bool, bool) at vcl/unx/generic/app/saldata.cxx:662:25 > #35 in X11SalInstance::DoYield(bool, bool) at vcl/unx/generic/app/salinst.cxx:182:20 > #36 in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:454:48 > #37 in Application::Yield() at vcl/source/app/svapp.cxx:518:5 > #38 in Dialog::Execute() at vcl/source/window/dialog.cxx:1032:9 > #39 in SalInstanceDialog::run() at vcl/source/app/salvtables.cxx:1480:23 > #40 in weld::DialogController::run() at include/vcl/weld.hxx:2196:47 > #41 in chart::ChartController::executeDispatch_OpenLegendDialog() at chart2/source/controller/main/ChartController_Insert.cxx:227:18 > #42 in chart::ChartController::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at chart2/source/controller/main/ChartController.cxx:1130:15 > #43 in ChartUIObject::PostCommand(void*) at chart2/source/controller/uitest/uiobject.cxx:76:41 > #44 in ChartUIObject::LinkStubPostCommand(void*, void*) at chart2/source/controller/uitest/uiobject.cxx:72:1 > #45 in Link<void*, void>::Call(void*) const at include/tools/link.hxx:111:45 > #46 in ImplHandleUserEvent(ImplSVEvent*) at vcl/source/window/winproc.cxx:2009:30 > #47 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) at vcl/source/window/winproc.cxx:2562:13 > #48 in SalFrame::CallCallback(SalEvent, void const*) const at vcl/inc/salframe.hxx:306:29 > #49 in SalGenericDisplay::ProcessEvent(SalUserEventList::SalUserEvent) at vcl/unx/generic/app/gendisp.cxx:66:22 > #50 in SalUserEventList::DispatchUserEvents(bool) at vcl/source/app/salusereventlist.cxx:108:17 > #51 in SalGenericDisplay::DispatchInternalEvent(bool) at vcl/unx/generic/app/gendisp.cxx:51:12 > #52 in SalX11Display::Yield() at vcl/unx/generic/app/saldisp.cxx:1918:9 > #53 in DisplayYield(int, void*) at vcl/unx/generic/app/saldisp.cxx:414:13 > #54 in (anonymous namespace)::YieldEntry::HandleNextEvent() const at vcl/unx/generic/app/saldata.cxx:566:38 > #55 in SalXLib::Yield(bool, bool) at vcl/unx/generic/app/saldata.cxx:662:25 > #56 in X11SalInstance::DoYield(bool, bool) at vcl/unx/generic/app/salinst.cxx:182:20 > #57 in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:454:48 > #58 in Application::Reschedule(bool) at vcl/source/app/svapp.cxx:467:12 > #59 in (anonymous namespace)::ExecuteWrapper::ExecuteActionHdl(Timer*) at vcl/source/uitest/uno/uiobject_uno.cxx:91:13 > #60 in (anonymous namespace)::ExecuteWrapper::LinkStubExecuteActionHdl(void*, Timer*) at vcl/source/uitest/uno/uiobject_uno.cxx:78:1 > #61 in Link<Timer*, void>::Call(Timer*) const at include/tools/link.hxx:111:45 > #62 in Timer::Invoke() at vcl/source/app/timer.cxx:75:21 > #63 in Scheduler::ProcessTaskScheduling() at vcl/source/app/scheduler.cxx:478:20 > #64 in Scheduler::CallbackTaskScheduling() at vcl/source/app/scheduler.cxx:287:5 > #65 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54:13 > #66 in X11SalData::Timeout() at vcl/unx/generic/app/saldata.cxx:551:41 > #67 in SalXLib::CheckTimeout(bool) at vcl/unx/generic/app/saldata.cxx:635:17 > #68 in SalXLib::Yield(bool, bool) at vcl/unx/generic/app/saldata.cxx:716:25 > #69 in X11SalInstance::DoYield(bool, bool) at vcl/unx/generic/app/salinst.cxx:182:20 > #70 in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:454:48 > #71 in Application::Yield() at vcl/source/app/svapp.cxx:518:5 > #72 in Application::Execute() at vcl/source/app/svapp.cxx:433:9 > #73 in desktop::Desktop::Main() at desktop/source/app/app.cxx:1602:17 > #74 in ImplSVMain() at vcl/source/app/svmain.cxx:196:35 > #75 in SVMain() at vcl/source/app/svmain.cxx:228:12 > #76 in soffice_main at desktop/source/app/sofficemain.cxx:107:12 > #77 in sal_main at desktop/source/app/main.c:48:15 > #78 in main at desktop/source/app/main.c:47:1 > previously allocated by thread T0 here: > #0 in operator new(unsigned long) at compiler-rt/lib/asan/asan_new_delete.cpp:99:3 > #1 in VclPtr<chart::sidebar::ChartLinePanel> VclPtr<chart::sidebar::ChartLinePanel>::Create<vcl::Window*&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, chart::ChartController*&>(vcl::Window*&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, chart::ChartController*&) at include/vcl/vclptr.hxx:129:42 > #2 in chart::sidebar::ChartLinePanel::Create(vcl::Window*, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, chart::ChartController*) at chart2/source/controller/sidebar/ChartLinePanel.cxx:117:12 > #3 in chart::sidebar::ChartPanelFactory::createUIElement(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at chart2/source/controller/sidebar/Chart2PanelFactory.cxx:107:22 > #4 in non-virtual thunk to chart::sidebar::ChartPanelFactory::createUIElement(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at chart2/source/controller/sidebar/Chart2PanelFactory.cxx > #5 in (anonymous namespace)::UIElementFactoryManager::createUIElement(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/uifactory/uielementfactorymanager.cxx:437:39 > #6 in non-virtual thunk to (anonymous namespace)::UIElementFactoryManager::createUIElement(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/uifactory/uielementfactorymanager.cxx > #7 in sfx2::sidebar::SidebarController::CreateUIElement(com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> const&, rtl::OUString const&, bool, sfx2::sidebar::Context const&) at sfx2/source/sidebar/SidebarController.cxx:967:32 > #8 in sfx2::sidebar::SidebarController::CreatePanel(rtl::OUString const&, vcl::Window*, bool, sfx2::sidebar::Context const&, VclPtr<sfx2::sidebar::Deck> const&) at sfx2/source/sidebar/SidebarController.cxx:908:43 > #9 in sfx2::sidebar::SidebarController::CreatePanels(rtl::OUString const&, sfx2::sidebar::Context const&) at sfx2/source/sidebar/SidebarController.cxx:720:41 > #10 in sfx2::sidebar::SidebarController::CreateDeck(rtl::OUString const&, sfx2::sidebar::Context const&, bool) at sfx2/source/sidebar/SidebarController.cxx:672:5 > #11 in sfx2::sidebar::SidebarController::SwitchToDeck(sfx2::sidebar::DeckDescriptor const&, sfx2::sidebar::Context const&) at sfx2/source/sidebar/SidebarController.cxx:822:5 > #12 in sfx2::sidebar::SidebarController::UpdateConfigurations() at sfx2/source/sidebar/SidebarController.cxx:569:9 > #13 in sfx2::sidebar::SidebarController::notifyContextChangeEvent(com::sun::star::ui::ContextChangeEventObject const&) at sfx2/source/sidebar/SidebarController.cxx:323:9 > #14 in (anonymous namespace)::ContextChangeEventMultiplexer::addContextChangeEventListener(com::sun::star::uno::Reference<com::sun::star::ui::XContextChangeEventListener> const&, com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&) at framework/source/services/ContextChangeEventMultiplexer.cxx:176:29 > #15 in sfx2::sidebar::SidebarController::registerSidebarForFrame(sfx2::sidebar::SidebarController*, com::sun::star::uno::Reference<com::sun::star::frame::XController> const&) at sfx2/source/sidebar/SidebarController.cxx:213:19 > #16 in chart::ChartController::attachFrame(com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) at chart2/source/controller/main/ChartController.cxx:400:9 > #17 in chart::ChartFrameLoader::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) at chart2/source/controller/main/ChartFrameloader.cxx:133:22 > #18 in framework::LoadEnv::impl_loadContent() at framework/source/loadenv/loadenv.cxx:1157:37 > #19 in framework::LoadEnv::start() at framework/source/loadenv/loadenv.cxx:395:20 > #20 in framework::LoadEnv::startLoading(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, rtl::OUString const&, int, LoadEnvFeatures) at framework/source/loadenv/loadenv.cxx:300:5 > #21 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/loadenv/loadenv.cxx:169:14 > #22 in (anonymous namespace)::XFrameImpl::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/services/frame.cxx:590:16 > #23 in non-virtual thunk to (anonymous namespace)::XFrameImpl::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/services/frame.cxx > #24 in DocumentHolder::LoadDocToFrame(bool) at embeddedobj/source/general/docholder.cxx:984:31 > #25 in DocumentHolder::ShowInplace(com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> const&, com::sun::star::awt::Rectangle const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider> const&) at embeddedobj/source/general/docholder.cxx:477:15 > #26 in OCommonEmbeddedObject::SwitchStateTo_Impl(int) at embeddedobj/source/commonembedding/embedobj.cxx:252:42 > #27 in OCommonEmbeddedObject::changeState(int) at embeddedobj/source/commonembedding/embedobj.cxx:451:17 > #28 in OCommonEmbeddedObject::doVerb(int) at embeddedobj/source/commonembedding/embedobj.cxx:537:9 > #29 in SfxInPlaceClient::DoVerb(long) at sfx2/source/view/ipclient.cxx:950:40 > #30 in ScTabViewShell::ActivateObject(SdrOle2Obj*, long) at sc/source/ui/view/tabvwshb.cxx:205:29 > #31 in ScGridWinUIObject::execute(rtl::OUString const&, std::__debug::map<rtl::OUString const, rtl::OUString, std::less<rtl::OUString const>, std::allocator<std::pair<rtl::OUString const, rtl::OUString> > > const&) at sc/source/ui/uitest/uiobject.cxx:175:29 > #32 in UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0::operator()() const at vcl/source/uitest/uno/uiobject_uno.cxx:124:16 > #33 in void std::__invoke_impl<void, UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0&>(std::__invoke_other, UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0&) at include/c++/10.0.1/bits/invoke.h:60:14 > #34 in std::enable_if<is_invocable_r_v<void, UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0&>, void>::type std::__invoke_r<void, UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0&>(UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0&) at include/c++/10.0.1/bits/invoke.h:110:2 > #35 in std::_Function_handler<void (), UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0>::_M_invoke(std::_Any_data const&) at include/c++/10.0.1/bits/std_function.h:291:9 > #36 in std::function<void ()>::operator()() const at include/c++/10.0.1/bits/std_function.h:622:14 > #37 in (anonymous namespace)::ExecuteWrapper::ExecuteActionHdl(Timer*) at vcl/source/uitest/uno/uiobject_uno.cxx:83:13 > #38 in (anonymous namespace)::ExecuteWrapper::LinkStubExecuteActionHdl(void*, Timer*) at vcl/source/uitest/uno/uiobject_uno.cxx:78:1 > #39 in Link<Timer*, void>::Call(Timer*) const at include/tools/link.hxx:111:45 > #40 in Timer::Invoke() at vcl/source/app/timer.cxx:75:21 > #41 in Scheduler::ProcessTaskScheduling() at vcl/source/app/scheduler.cxx:478:20 > #42 in Scheduler::CallbackTaskScheduling() at vcl/source/app/scheduler.cxx:287:5 > #43 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54:13 > #44 in X11SalData::Timeout() at vcl/unx/generic/app/saldata.cxx:551:41 > #45 in SalXLib::CheckTimeout(bool) at vcl/unx/generic/app/saldata.cxx:635:17 > #46 in SalXLib::Yield(bool, bool) at vcl/unx/generic/app/saldata.cxx:716:25 > #47 in X11SalInstance::DoYield(bool, bool) at vcl/unx/generic/app/salinst.cxx:182:20 > #48 in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:454:48 > #49 in Application::Yield() at vcl/source/app/svapp.cxx:518:5 > #50 in Application::Execute() at vcl/source/app/svapp.cxx:433:9 > #51 in desktop::Desktop::Main() at desktop/source/app/app.cxx:1602:17 > #52 in ImplSVMain() at vcl/source/app/svmain.cxx:196:35 > #53 in SVMain() at vcl/source/app/svmain.cxx:228:12 > #54 in soffice_main at desktop/source/app/sofficemain.cxx:107:12 > #55 in sal_main at desktop/source/app/main.c:48:15 > #56 in main at desktop/source/app/main.c:47:1 The changes that were necessary to fix that scenario are those in ChartAreaPanel.cxx and ChartLinePanel.cxx, but the other updateModel implementations look equally broken. Change-Id: I064fb701dc10e7cb7ef7ea5839f7dd1ae8d0ebba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91467 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-04-01 10:39:04 +02:00
}
mxModel = xModel;
mbModelValid = mxModel.is();
if (!mbModelValid)
return;
maLineStyleWrapper.updateModel(mxModel);
maLineColorWrapper.updateModel(mxModel);
mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
}
void ChartLinePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
{
::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
assert(!xModel || pModel);
doUpdateModel(pModel);
}
void ChartLinePanel::setLineJoint(const XLineJointItem* pItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getPropSet(mxModel);
if (!xPropSet.is())
return;
PreventUpdate aPreventUpdate(mbUpdate);
if (pItem)
xPropSet->setPropertyValue("LineJoint", css::uno::Any(pItem->GetValue()));
}
void ChartLinePanel::setLineCap(const XLineCapItem* /*pItem*/)
{
}
void ChartLinePanel::setLineTransparency(const XLineTransparenceItem& rItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getPropSet(mxModel);
if (!xPropSet.is())
return;
PreventUpdate aPreventUpdate(mbUpdate);
xPropSet->setPropertyValue("LineTransparence", css::uno::Any(rItem.GetValue()));
}
void ChartLinePanel::setLineWidth(const XLineWidthItem& rItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getPropSet(mxModel);
if (!xPropSet.is())
return;
PreventUpdate aPreventUpdate(mbUpdate);
xPropSet->setPropertyValue("LineWidth", css::uno::Any(rItem.GetValue()));
}
void ChartLinePanel::updateLineWidth(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem)
{
LinePropertyPanelBase::updateLineWidth(bDisabled, bSetOrDefault, pItem);
SfxViewShell* pViewShell = SfxViewShell::Current();
if (comphelper::LibreOfficeKit::isActive() && pViewShell)
{
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
".uno:LineWidth=" + OString::number(mnWidthCoreValue));
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */