summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2022-12-04 16:26:55 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2022-12-05 07:26:20 +0000
commit86c50d7d7de2e5c4be5f7c6931d87d1b17bcaf82 (patch)
tree4a4d2028eafdbcffe4c0531ee379c91f7a98af25
parent1c3dc6cdc53a2463af12688918d222d44039a96c (diff)
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 <momonasmon@gmail.com>
-rw-r--r--sd/source/core/stlpool.cxx2
1 files changed, 1 insertions, 1 deletions
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<XStyle>(xSourceTableStyle, UNO_QUERY_THROW)->getName());
if( xTarget->hasByName( sName ) )
- xTarget->replaceByName( sName, Any( xNewTableStyle ) );
+ Reference<XComponent>(xNewTableStyle, UNO_QUERY_THROW)->dispose();
else
xTarget->insertByName( sName, Any( xNewTableStyle ) );
}