summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-02-16 18:08:46 +0100
committerAndras Timar <andras.timar@collabora.com>2018-02-20 16:29:59 +0100
commit6f860657ae607d63c5c5b4f36b99b0dce2074cf9 (patch)
tree5ce74f5c11dced663e56fe4813abdafdbea31af7 /editeng
parent854d5f0f4f4f61d559305befa1daf2721b3d4ee6 (diff)
tdf#115783 sd: fix lost char attributes during in-table copy&paste
The SvxFontHeightItem (12pt) is originally a character-level property on the table cell (covering the whole cell text) but when the user sets the font height of the cell, sdr::properties::CellProperties::ItemSetChanged() will turn that into a paragraph-level property. This is fine, except that this way the property has unclear semantics when the user pastes single-paragraph content into an existing paragraph. (Keep the old paragraph properties? Use the new ones?) The current behavior is that sd::View::OnEndPasteOrDrop() calls into ContentAttribs::SetStyleSheet() at the end of the paste, which removes paragraph-level formatting (giving visibility to the from-style 18pt font height this way for the existing content), so both the old and the new paragraph formatting is lost. Improve the situation by copying these paragraph-level character properties back to character-level before paste at the paste position (so doc model is back to the state after load), that way font height and similar properties are not removed by the on-end-paste handler. (cherry picked from commit f0c25c751cf8e166a84b289746bce6202a40391d) Conflicts: sd/qa/unit/tiledrendering/tiledrendering.cxx Change-Id: I43d321dedcda6c0df9b009b9d99c3544f783473c Reviewed-on: https://gerrit.libreoffice.org/49967 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editeng.cxx7
-rw-r--r--editeng/source/outliner/outliner.cxx5
2 files changed, 12 insertions, 0 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index db6c7710dc38..a3679f5809b1 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1737,6 +1737,13 @@ const SfxPoolItem& EditEngine::GetParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich
return pImpEditEngine->GetParaAttrib( nPara, nWhich );
}
+void EditEngine::SetCharAttribs(sal_Int32 nPara, const SfxItemSet& rSet)
+{
+ EditSelection aSel(pImpEditEngine->ConvertSelection(nPara, 0, nPara, GetTextLen(nPara)));
+ pImpEditEngine->SetAttribs(aSel, rSet);
+ pImpEditEngine->FormatAndUpdate();
+}
+
void EditEngine::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& rLst ) const
{
pImpEditEngine->GetCharAttribs( nPara, rLst );
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index d9985a5479ab..27ffe02353db 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -746,6 +746,11 @@ void Outliner::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
pEditEngine->SetParaAttribs( nPara, rSet );
}
+void Outliner::SetCharAttribs(sal_Int32 nPara, const SfxItemSet& rSet)
+{
+ pEditEngine->SetCharAttribs(nPara, rSet);
+}
+
bool Outliner::Expand( Paragraph const * pPara )
{
if ( pParaList->HasHiddenChildren( pPara ) )