summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2023-05-05 11:12:36 +0300
committerMichael Stahl <michael.stahl@allotropia.de>2023-05-08 13:42:29 +0200
commita614740c09d99daf1a68f4642fded2c0c7608916 (patch)
treed3d5eefbb566c07eaad4893494eacbe5ee8d35aa
parentf6a783af88b571ff1f3df9bda31eb0aac66a2c5f (diff)
tdf#155144 sd: Don't reset table styles on RTF pasting
Regression of daab698b346e5e40b67f1e15c796c4e399ccaf8a ("sd: replace hardcoded table styles with xml file"). The problem is with the temp SdDrawDocument reusing the document's DrawDocShell. Before the mentioned commit we used to insert the default table styles directly into the style sheets pool, and that didn't affect the dest document as each SdDrawDocument maintains its own pool. However, after that commit we go through ODF import which use the document model which happens to be the dest document. This results with all the default table styles being replaced, with all their formatting being reset, and all existing tables being reset to the default style following the disposal of the original styles. At the same time, this leaves the temp SdDrawDocument with no table styles in its pool, and so the newly inserted table ends up with no style assigned. Change-Id: I9bebae929ec3d54e0139dd212ad0ad1dfe815caa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151417 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com> (cherry picked from commit 86b48c757906c3ef647f3d5e2579ac1fef1bf55b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151376 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sd/source/ui/view/sdview3.cxx18
1 files changed, 8 insertions, 10 deletions
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index f96cd774a92a..9b94d9cca8b5 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -1571,19 +1571,17 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
bool View::PasteRTFTable( const ::tools::SvRef<SotTempStream>& xStm, SdrPage* pPage, SdrInsertFlags nPasteOptions )
{
- SdDrawDocument aModel( DocumentType::Impress, mpDocSh );
- aModel.NewOrLoadCompleted(DocCreationMode::New);
- aModel.GetItemPool().SetDefaultMetric(MapUnit::Map100thMM);
- aModel.InsertPage(aModel.AllocPage(false).get());
+ DrawDocShellRef xShell = new DrawDocShell(SfxObjectCreateMode::INTERNAL, false, DocumentType::Impress);
+ xShell->DoInitNew();
- Reference< XComponent > xComponent( new SdXImpressDocument( &aModel, true ) );
- aModel.setUnoModel( Reference< XInterface >::query( xComponent ) );
+ SdDrawDocument* pModel = xShell->GetDoc();
+ pModel->GetItemPool().SetDefaultMetric(MapUnit::Map100thMM);
+ pModel->InsertPage(pModel->AllocPage(false).get());
- CreateTableFromRTF( *xStm, &aModel );
- bool bRet = Paste(aModel, maDropPos, pPage, nPasteOptions);
+ CreateTableFromRTF(*xStm, pModel);
+ bool bRet = Paste(*pModel, maDropPos, pPage, nPasteOptions);
- xComponent->dispose();
- xComponent.clear();
+ xShell->DoClose();
return bRet;
}