2015-07-29 02:46:50 +02:00
|
|
|
/* -*- 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"
|
|
|
|
|
2017-10-23 22:44:16 +02:00
|
|
|
#include <ChartController.hxx>
|
2022-01-20 16:04:37 +02:00
|
|
|
#include <ChartModel.hxx>
|
2015-07-29 02:46:50 +02:00
|
|
|
|
2015-07-29 03:16:13 +02:00
|
|
|
#include <svx/xlnwtit.hxx>
|
|
|
|
#include <svx/xlinjoit.hxx>
|
|
|
|
#include <svx/xlntrit.hxx>
|
|
|
|
|
2020-01-21 15:43:46 +00:00
|
|
|
#include <svx/linectrl.hxx>
|
2015-08-20 03:14:08 +02:00
|
|
|
#include <svx/tbcontrl.hxx>
|
2020-01-06 09:51:42 +00:00
|
|
|
#include <sfx2/weldutils.hxx>
|
2015-10-10 16:21:29 +02:00
|
|
|
#include <vcl/svapp.hxx>
|
2015-08-20 03:14:08 +02:00
|
|
|
|
2015-07-29 02:46:50 +02:00
|
|
|
#include <com/sun/star/view/XSelectionSupplier.hpp>
|
2018-08-22 00:10:54 +02:00
|
|
|
#include <com/sun/star/chart2/XDiagram.hpp>
|
2015-07-29 02:46:50 +02:00
|
|
|
|
2021-01-06 11:44:43 +01:00
|
|
|
#include <comphelper/lok.hxx>
|
|
|
|
#include <sfx2/viewsh.hxx>
|
|
|
|
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
|
|
|
|
|
2020-01-14 15:21:18 +02:00
|
|
|
namespace chart::sidebar {
|
2015-07-29 02:46:50 +02:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2020-10-06 13:09:02 +02:00
|
|
|
SvxLineStyleToolBoxControl* getLineStyleToolBoxControl(const ToolbarUnoDispatcher& rToolBoxColor)
|
2015-08-20 03:14:08 +02:00
|
|
|
{
|
2020-01-21 15:43:46 +00:00
|
|
|
css::uno::Reference<css::frame::XToolbarController> xController = rToolBoxColor.GetControllerForCommand(".uno:XLineStyle");
|
2023-01-04 16:43:40 +01:00
|
|
|
SvxLineStyleToolBoxControl* pToolBoxLineStyleControl = dynamic_cast<SvxLineStyleToolBoxControl*>(xController.get());
|
2020-01-21 15:43:46 +00:00
|
|
|
return pToolBoxLineStyleControl;
|
|
|
|
}
|
|
|
|
|
2020-10-06 13:09:02 +02:00
|
|
|
SvxColorToolBoxControl* getColorToolBoxControl(const ToolbarUnoDispatcher& rToolBoxLineStyle)
|
2020-01-21 15:43:46 +00:00
|
|
|
{
|
|
|
|
css::uno::Reference<css::frame::XToolbarController> xController = rToolBoxLineStyle.GetControllerForCommand(".uno:XLineColor");
|
2015-08-20 03:14:08 +02:00
|
|
|
SvxColorToolBoxControl* pToolBoxColorControl = dynamic_cast<SvxColorToolBoxControl*>(xController.get());
|
|
|
|
return pToolBoxColorControl;
|
|
|
|
}
|
|
|
|
|
2022-01-20 16:04:37 +02:00
|
|
|
OUString getCID(const rtl::Reference<::chart::ChartModel>& xModel)
|
2015-07-29 02:46:50 +02:00
|
|
|
{
|
|
|
|
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())
|
2023-05-20 11:38:16 -04:00
|
|
|
return OUString();
|
2015-07-29 02:46:50 +02:00
|
|
|
|
|
|
|
OUString aCID;
|
|
|
|
aAny >>= aCID;
|
|
|
|
|
|
|
|
return aCID;
|
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Reference<css::beans::XPropertySet> getPropSet(
|
2022-01-20 16:04:37 +02:00
|
|
|
const rtl::Reference<::chart::ChartModel>& xModel)
|
2015-07-29 02:46:50 +02:00
|
|
|
{
|
|
|
|
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:
|
2015-09-07 09:33:18 +01:00
|
|
|
explicit PreventUpdate(bool& bUpdate):
|
2015-07-29 02:46:50 +02:00
|
|
|
mbUpdate(bUpdate)
|
|
|
|
{
|
|
|
|
mbUpdate = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
~PreventUpdate()
|
|
|
|
{
|
|
|
|
mbUpdate = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool& mbUpdate;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-03-04 17:22:14 +00:00
|
|
|
std::unique_ptr<PanelLayout> ChartLinePanel::Create(
|
|
|
|
weld::Widget* pParent,
|
2015-07-29 02:46:50 +02:00
|
|
|
const css::uno::Reference<css::frame::XFrame>& rxFrame,
|
|
|
|
ChartController* pController)
|
|
|
|
{
|
2015-11-10 10:11:17 +01:00
|
|
|
if (pParent == nullptr)
|
|
|
|
throw css::lang::IllegalArgumentException("no parent Window given to ChartAxisPanel::Create", nullptr, 0);
|
2015-07-29 02:46:50 +02:00
|
|
|
if (!rxFrame.is())
|
2015-11-10 10:11:17 +01:00
|
|
|
throw css::lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", nullptr, 1);
|
2015-07-29 02:46:50 +02:00
|
|
|
|
2021-03-04 17:22:14 +00:00
|
|
|
return std::make_unique<ChartLinePanel>(pParent, rxFrame, pController);
|
2015-07-29 02:46:50 +02:00
|
|
|
}
|
|
|
|
|
2021-03-04 17:22:14 +00:00
|
|
|
ChartLinePanel::ChartLinePanel(weld::Widget* pParent,
|
2015-07-29 02:46:50 +02:00
|
|
|
const css::uno::Reference<css::frame::XFrame>& rxFrame,
|
|
|
|
ChartController* pController):
|
|
|
|
svx::sidebar::LinePropertyPanelBase(pParent, rxFrame),
|
2022-01-20 16:04:37 +02:00
|
|
|
mxModel(pController->getChartModel()),
|
2015-07-29 02:46:50 +02:00
|
|
|
mxListener(new ChartSidebarModifyListener(this)),
|
|
|
|
mxSelectionListener(new ChartSidebarSelectionListener(this)),
|
2015-07-31 17:34:56 +02:00
|
|
|
mbUpdate(true),
|
2015-08-20 03:14:08 +02:00
|
|
|
mbModelValid(true),
|
2020-01-21 15:43:46 +00:00
|
|
|
maLineColorWrapper(mxModel, getColorToolBoxControl(*mxColorDispatch), "LineColor"),
|
|
|
|
maLineStyleWrapper(mxModel, getLineStyleToolBoxControl(*mxLineStyleDispatch))
|
2015-07-29 02:46:50 +02:00
|
|
|
{
|
2015-10-12 23:50:20 +02:00
|
|
|
disableArrowHead();
|
2015-10-10 16:54:43 +02:00
|
|
|
std::vector<ObjectType> aAcceptedTypes { OBJECTTYPE_PAGE, OBJECTTYPE_DIAGRAM,
|
2015-10-12 23:25:38 +02:00
|
|
|
OBJECTTYPE_DATA_SERIES, OBJECTTYPE_DATA_POINT,
|
|
|
|
OBJECTTYPE_TITLE, OBJECTTYPE_LEGEND, OBJECTTYPE_DATA_CURVE,
|
|
|
|
OBJECTTYPE_DATA_AVERAGE_LINE, OBJECTTYPE_AXIS};
|
2021-10-10 20:38:09 +02:00
|
|
|
mxSelectionListener->setAcceptedTypes(std::move(aAcceptedTypes));
|
2015-07-29 02:46:50 +02:00
|
|
|
Initialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
ChartLinePanel::~ChartLinePanel()
|
|
|
|
{
|
2021-05-19 17:36:48 +01:00
|
|
|
doUpdateModel(nullptr);
|
2015-07-29 02:46:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ChartLinePanel::Initialize()
|
|
|
|
{
|
2022-01-20 16:04:37 +02:00
|
|
|
mxModel->addModifyListener(mxListener);
|
2015-07-29 02:46:50 +02:00
|
|
|
|
|
|
|
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
|
|
|
|
if (xSelectionSupplier.is())
|
2021-02-16 19:59:26 +02:00
|
|
|
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
|
2015-07-29 02:46:50 +02:00
|
|
|
|
2020-01-06 09:51:42 +00:00
|
|
|
SvxColorToolBoxControl* pToolBoxColor = getColorToolBoxControl(*mxColorDispatch);
|
2015-08-20 03:14:08 +02:00
|
|
|
pToolBoxColor->setColorSelectFunction(maLineColorWrapper);
|
|
|
|
|
2020-01-21 15:43:46 +00:00
|
|
|
SvxLineStyleToolBoxControl* pToolBoxLineStyle = getLineStyleToolBoxControl(*mxLineStyleDispatch);
|
|
|
|
pToolBoxLineStyle->setLineStyleSelectFunction(maLineStyleWrapper);
|
|
|
|
|
2016-09-20 16:41:39 +02:00
|
|
|
setMapUnit(MapUnit::Map100thMM);
|
2015-07-29 02:46:50 +02:00
|
|
|
updateData();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChartLinePanel::updateData()
|
|
|
|
{
|
2015-07-31 17:34:56 +02:00
|
|
|
if (!mbUpdate || !mbModelValid)
|
2015-07-29 02:46:50 +02:00
|
|
|
return;
|
|
|
|
|
2015-10-10 16:21:29 +02:00
|
|
|
SolarMutexGuard aGuard;
|
2015-07-29 02:46:50 +02:00
|
|
|
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
|
|
|
|
if (!xPropSet.is())
|
|
|
|
return;
|
|
|
|
|
2015-07-29 15:33:57 +02:00
|
|
|
sal_uInt16 nLineTransparence = 0;
|
|
|
|
xPropSet->getPropertyValue("LineTransparence") >>= nLineTransparence;
|
|
|
|
XLineTransparenceItem aLineTransparenceItem(nLineTransparence);
|
|
|
|
updateLineTransparence(false, true, &aLineTransparenceItem);
|
|
|
|
|
2021-01-11 11:00:26 +01:00
|
|
|
sal_uInt32 nWidth = 0;
|
2021-01-06 11:44:43 +01:00
|
|
|
xPropSet->getPropertyValue("LineWidth") >>= nWidth;
|
|
|
|
XLineWidthItem aWidthItem(nWidth);
|
|
|
|
updateLineWidth(false, true, &aWidthItem);
|
|
|
|
|
2020-01-21 15:43:46 +00:00
|
|
|
maLineStyleWrapper.updateData();
|
2015-08-20 03:14:08 +02:00
|
|
|
maLineColorWrapper.updateData();
|
2015-07-29 02:46:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ChartLinePanel::modelInvalid()
|
|
|
|
{
|
2015-07-31 17:34:56 +02:00
|
|
|
mbModelValid = false;
|
2015-07-29 02:46:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ChartLinePanel::selectionChanged(bool bCorrectType)
|
|
|
|
{
|
|
|
|
if (bCorrectType)
|
|
|
|
updateData();
|
|
|
|
}
|
|
|
|
|
2022-01-20 16:04:37 +02:00
|
|
|
void ChartLinePanel::doUpdateModel(rtl::Reference<::chart::ChartModel> xModel)
|
2015-07-29 02:46:50 +02:00
|
|
|
{
|
2015-07-31 17:34:56 +02:00
|
|
|
if (mbModelValid)
|
|
|
|
{
|
2022-01-20 16:04:37 +02:00
|
|
|
mxModel->removeModifyListener(mxListener);
|
2015-07-29 02:46:50 +02:00
|
|
|
|
2021-05-19 17:36:48 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2015-07-29 02:46:50 +02:00
|
|
|
mxModel = xModel;
|
2021-05-19 17:36:48 +01:00
|
|
|
mbModelValid = mxModel.is();
|
|
|
|
|
|
|
|
if (!mbModelValid)
|
|
|
|
return;
|
2015-07-29 02:46:50 +02:00
|
|
|
|
2020-01-21 15:43:46 +00:00
|
|
|
maLineStyleWrapper.updateModel(mxModel);
|
2015-08-20 03:14:08 +02:00
|
|
|
maLineColorWrapper.updateModel(mxModel);
|
|
|
|
|
2022-01-20 16:04:37 +02:00
|
|
|
mxModel->addModifyListener(mxListener);
|
2015-07-29 02:46:50 +02:00
|
|
|
|
|
|
|
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
|
|
|
|
if (xSelectionSupplier.is())
|
2021-02-16 19:59:26 +02:00
|
|
|
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
|
2015-07-29 02:46:50 +02:00
|
|
|
}
|
|
|
|
|
2021-05-19 17:36:48 +01:00
|
|
|
void ChartLinePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
|
|
|
|
{
|
2022-01-20 16:04:37 +02:00
|
|
|
::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
|
|
|
|
assert(!xModel || pModel);
|
|
|
|
doUpdateModel(pModel);
|
2021-05-19 17:36:48 +01:00
|
|
|
}
|
|
|
|
|
2015-07-29 03:16:13 +02:00
|
|
|
void ChartLinePanel::setLineJoint(const XLineJointItem* pItem)
|
2015-07-29 02:46:50 +02:00
|
|
|
{
|
2015-07-29 03:16:13 +02:00
|
|
|
css::uno::Reference<css::beans::XPropertySet> xPropSet =
|
|
|
|
getPropSet(mxModel);
|
|
|
|
|
|
|
|
if (!xPropSet.is())
|
|
|
|
return;
|
|
|
|
|
2015-07-30 14:13:32 +02:00
|
|
|
PreventUpdate aPreventUpdate(mbUpdate);
|
2015-07-29 03:16:13 +02:00
|
|
|
if (pItem)
|
2017-02-03 08:54:47 +02:00
|
|
|
xPropSet->setPropertyValue("LineJoint", css::uno::Any(pItem->GetValue()));
|
2015-07-29 02:46:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ChartLinePanel::setLineCap(const XLineCapItem* /*pItem*/)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-07-29 03:16:13 +02:00
|
|
|
void ChartLinePanel::setLineTransparency(const XLineTransparenceItem& rItem)
|
2015-07-29 02:46:50 +02:00
|
|
|
{
|
2015-07-29 03:16:13 +02:00
|
|
|
css::uno::Reference<css::beans::XPropertySet> xPropSet =
|
|
|
|
getPropSet(mxModel);
|
|
|
|
|
|
|
|
if (!xPropSet.is())
|
|
|
|
return;
|
|
|
|
|
2015-07-30 14:13:32 +02:00
|
|
|
PreventUpdate aPreventUpdate(mbUpdate);
|
2017-02-03 08:54:47 +02:00
|
|
|
xPropSet->setPropertyValue("LineTransparence", css::uno::Any(rItem.GetValue()));
|
2015-07-29 02:46:50 +02:00
|
|
|
}
|
|
|
|
|
2015-07-29 03:16:13 +02:00
|
|
|
void ChartLinePanel::setLineWidth(const XLineWidthItem& rItem)
|
2015-07-29 02:46:50 +02:00
|
|
|
{
|
2015-07-29 03:16:13 +02:00
|
|
|
css::uno::Reference<css::beans::XPropertySet> xPropSet =
|
|
|
|
getPropSet(mxModel);
|
|
|
|
|
|
|
|
if (!xPropSet.is())
|
|
|
|
return;
|
|
|
|
|
2015-07-30 14:13:32 +02:00
|
|
|
PreventUpdate aPreventUpdate(mbUpdate);
|
2017-02-03 08:54:47 +02:00
|
|
|
xPropSet->setPropertyValue("LineWidth", css::uno::Any(rItem.GetValue()));
|
2015-07-29 02:46:50 +02:00
|
|
|
}
|
|
|
|
|
2021-01-06 11:44:43 +01:00
|
|
|
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,
|
2023-04-24 11:37:48 +02:00
|
|
|
".uno:LineWidth=" + OString::number(mnWidthCoreValue));
|
2021-01-06 11:44:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:21:18 +02:00
|
|
|
}
|
2015-07-29 02:46:50 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|