chart2/inc/ChartView.hxx | 4 +-- chart2/source/view/main/ChartView.cxx | 36 +++++++++++++++++++++++++++++++--- uitest/libreoffice/connection.py | 6 +++-- 3 files changed, 39 insertions(+), 7 deletions(-)
New commits: commit 6506279e3bed2284ce0ec9a0957a0201eb0d72ae Author: Mike Kaganski <[email protected]> AuthorDate: Mon Oct 16 10:14:49 2023 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Oct 16 18:27:40 2023 +0200 tdf#157776: Do not set chart and its parent modified when painting When the chart is painted for the first time, its update may create the initial set of objects, which used to set modified state after loading documents. Change-Id: Ie50ef34875440058020486192fe649b492e4baf9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158015 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index 9c80ba2ffb55..cbee98d8cb4a 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -115,7 +115,7 @@ public: // ___ExplicitValueProvider___ virtual bool getExplicitValuesForAxis( - rtl::Reference< ::chart::Axis > xAxis + rtl::Reference< Axis > xAxis , ExplicitScaleData& rExplicitScale , ExplicitIncrementData& rExplicitIncrement ) override; virtual rtl::Reference< SvxShape > @@ -205,7 +205,7 @@ private: //member css::uno::Reference< css::uno::XComponentContext> m_xCC; - chart::ChartModel& mrChartModel; + ChartModel& mrChartModel; css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index d499aae6f298..08aaeb69ffe1 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -75,6 +75,7 @@ #include <osl/mutex.hxx> #include <svx/unofill.hxx> #include <drawinglayer/XShapeDumper.hxx> +#include <sfx2/objsh.hxx> #include <time.h> @@ -112,12 +113,9 @@ #include <memory> #include <libxml/xmlwriter.h> -namespace com::sun::star::chart2 { class XChartDocument; } - namespace chart { using namespace ::com::sun::star; -using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Any; @@ -1413,6 +1411,35 @@ void SAL_CALL ChartView::disposing( const lang::EventObject& /* rSource */ ) { } +namespace +{ +// Disables setting the chart's modified state, as well as its parent's (if exists). +// Painting a chart must not set these states. +struct ChartModelDisableSetModified +{ + ChartModel& mrChartModel; + SfxObjectShell* mpParentShell; + bool mbWasUnmodified; + ChartModelDisableSetModified(ChartModel& rChartModel) + : mrChartModel(rChartModel) + , mpParentShell(SfxObjectShell::GetShellFromComponent(rChartModel.getParent())) + , mbWasUnmodified(!rChartModel.isModified()) + { + if (mpParentShell && mpParentShell->IsEnableSetModified()) + mpParentShell->EnableSetModified(false); + else + mpParentShell = nullptr; + } + ~ChartModelDisableSetModified() + { + if (mbWasUnmodified && mrChartModel.isModified()) + mrChartModel.setModified(false); + if (mpParentShell) + mpParentShell->EnableSetModified(true); + } +}; +} + void ChartView::impl_updateView( bool bCheckLockedCtrler ) { if( !m_pDrawModelWrapper ) @@ -1443,6 +1470,9 @@ void ChartView::impl_updateView( bool bCheckLockedCtrler ) m_pDrawModelWrapper->lockControllers(); } + // Rendering the chart must not set its (or its parent) modified status + ChartModelDisableSetModified dontSetModified(mrChartModel); + //create chart view { m_bViewDirty = false; commit be71e660fd29a714466bf041a6b9b394b9fdbf08 Author: Mike Kaganski <[email protected]> AuthorDate: Mon Oct 16 15:18:11 2023 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Oct 16 18:27:32 2023 +0200 Fix UITests on Windows ... after commit 0d21e1075f0288a007cb427ce508d6fbbf8503dd (uitest: add signal_handler function, 2023-10-04), which added handlers unconditionally, for signals unavailable on Windows. Change-Id: I8b177c4110f869781b2501ee6f15ae7ff4862a94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158050 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/uitest/libreoffice/connection.py b/uitest/libreoffice/connection.py index e3b76b4baf44..4f901130f223 100644 --- a/uitest/libreoffice/connection.py +++ b/uitest/libreoffice/connection.py @@ -10,6 +10,7 @@ import time import traceback import uuid import os +import platform import signal try: @@ -37,8 +38,9 @@ class OfficeConnection: If the connection method is path the instance will be created as a new subprocess. If the connection method is connect the instance tries to connect to an existing instance with the specified socket string """ - signal.signal(signal.SIGCHLD, signal_handler) - signal.signal(signal.SIGPIPE, signal_handler) + if platform.system() != "Windows": + signal.signal(signal.SIGCHLD, signal_handler) + signal.signal(signal.SIGPIPE, signal_handler) (method, sep, rest) = self.args["--soffice"].partition(":") if sep != ":":
