sd/source/ui/inc/TableDesignPane.hxx | 1 + sd/source/ui/table/TableDesignPane.cxx | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+)
New commits: commit 24ea3f7b0ed23e8ed1b8e42db440aaf54084e1ac Author: Maxim Monastirsky <momonas...@gmail.com> AuthorDate: Tue Nov 22 11:56:36 2022 +0200 Commit: Maxim Monastirsky <momonas...@gmail.com> CommitDate: Tue Nov 22 14:04:08 2022 +0100 End text edit mode before changing a table style Because we now support text attributes in styles, and their visualization will not update when in edit mode. Change-Id: I117812442b07476a84b9bd887fa2380ec4581283 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143101 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonas...@gmail.com> diff --git a/sd/source/ui/inc/TableDesignPane.hxx b/sd/source/ui/inc/TableDesignPane.hxx index a3658bb30bf2..2ab94204b7ff 100644 --- a/sd/source/ui/inc/TableDesignPane.hxx +++ b/sd/source/ui/inc/TableDesignPane.hxx @@ -86,6 +86,7 @@ private: void removeListener(); void updateControls(); void selectStyle(std::u16string_view rStyle); + void endTextEditForStyle(const css::uno::Reference<css::uno::XInterface>& rStyle); void setDocumentModified(); void FillDesignPreviewControl(); diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 07371e6e9980..dd7749db7e79 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -307,6 +307,7 @@ void TableDesignWidget::ResetStyle() xTableStyle->replaceByIndex(i, mxCellFamily->getByName(xCellStyle->getParentStyle())); } + endTextEditForStyle(xTableStyle); Reference<util::XModifiable>(xTableStyle, UNO_QUERY_THROW)->setModified(false); updateControls(); @@ -331,6 +332,8 @@ void TableDesignWidget::DeleteStyle() if (xBox->run() != RET_YES) return; + + endTextEditForStyle(xTableStyle); } Reference<XNameContainer>(mxTableFamily, UNO_QUERY_THROW)->removeByName(xTableStyle->getName()); @@ -377,6 +380,8 @@ void TableDesignWidget::EditStyle(std::string_view rCommand) mrBase.GetFrameWeld(), &aNewAttr, *mrBase.GetDrawView()->GetModel(), true) : nullptr); if (pDlg && pDlg->Execute() == RET_OK) { + endTextEditForStyle(xTableStyle); + if (!bUserDefined) { mxCellFamily->insertByName(xCellStyle->getName(), Any(xCellStyle)); @@ -446,6 +451,9 @@ void TableDesignWidget::ApplyStyle() { if( pView ) { + if (pView->IsTextEdit()) + pView->SdrEndTextEdit(); + SfxRequest aReq( SID_TABLE_STYLE, SfxCallMode::SYNCHRON, SfxGetpApp()->GetPool() ); aReq.AppendItem( SfxStringItem( SID_TABLE_STYLE, sStyleName ) ); @@ -668,6 +676,19 @@ void TableDesignWidget::selectStyle(std::u16string_view rStyle) } } +void TableDesignWidget::endTextEditForStyle(const Reference<XInterface>& rStyle) +{ + if (!mxSelectedTable) + return; + + Reference<XInterface> xTableStyle(mxSelectedTable->getPropertyValue("TableTemplate"), UNO_QUERY); + if (xTableStyle != rStyle) + return; + + if (mrBase.GetDrawView()->IsTextEdit()) + mrBase.GetDrawView()->SdrEndTextEdit(); +} + void TableDesignWidget::addListener() { Link<tools::EventMultiplexerEvent&,void> aLink( LINK(this,TableDesignWidget,EventMultiplexerListener) );