summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2023-05-05 11:12:36 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2023-05-05 13:23:27 +0200
commit86b48c757906c3ef647f3d5e2579ac1fef1bf55b (patch)
treee763fed67e8f058577c4b4f6ddc3c777e33b2ae6 /sd
parentabe1b3ff2e0f2fc0e9ccf8ac3f22fa34babc7155 (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>
Diffstat (limited to 'sd')
-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 6a1b776f4ead..06f07048455e 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -1568,19 +1568,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;
}