From 86c50d7d7de2e5c4be5f7c6931d87d1b17bcaf82 Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Sun, 4 Dec 2022 16:26:55 +0200 Subject: sd: Don't replace table styles on page pasting i.e. insert a table, and set its style to anything except default. Then right click on the page in the page pane => Copy. Right click again => Paste. The table on the first page will reset to the default table style. The problem is in SdStyleSheetPool::CopyTableStyles which attempts to replace existing styles with the pasted ones, causing the old ones to be destroyed. But in fact there's absolutely no case where we want to do anything like this. All we want is to keep the formatting of the pasted page, not to change existing styles which might be used in the rest of the document. (And if the pasted style has indeed a different formatting, it can be inserted under a different name. To be handled in a follow-up commit.) Change-Id: I7caaffc72265bb045bf21c831f2da27012e41845 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143644 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky --- sd/source/core/stlpool.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index ad4733f96189..738279e8a440 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -553,7 +553,7 @@ void SdStyleSheetPool::CopyTableStyles(SdStyleSheetPool const & rSourcePool) const OUString sName(Reference(xSourceTableStyle, UNO_QUERY_THROW)->getName()); if( xTarget->hasByName( sName ) ) - xTarget->replaceByName( sName, Any( xNewTableStyle ) ); + Reference(xNewTableStyle, UNO_QUERY_THROW)->dispose(); else xTarget->insertByName( sName, Any( xNewTableStyle ) ); } -- cgit v1.2.3