summaryrefslogtreecommitdiff
path: root/editeng/source/uno
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2023-06-20 19:26:50 +0200
committerBalazs Varga <balazs.varga.extern@allotropia.de>2023-06-29 09:29:34 +0200
commitda8dead8e9282010893cbd12519e107baf03cd1a (patch)
tree0833f32ef84e9e565c57d24ca2ef0d955a359205 /editeng/source/uno
parentb3594e01ec6d0156277f354efe5cacc04b33c4b6 (diff)
tdf#73537 - sc: show author and creation date in calc comments
in temporory mode. Show the author and creation/modification date of the the comment only in temporory mode. In edit mode, or visible mode, shows only the original text. Change-Id: I2c5856e4c6a813dbef4ad55de319f922daa57f67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153358 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com> Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
Diffstat (limited to 'editeng/source/uno')
-rw-r--r--editeng/source/uno/unotext.cxx38
1 files changed, 35 insertions, 3 deletions
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 881cfa32cd89..ee66097f7ec9 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -2117,11 +2117,43 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraph(
}
uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::insertTextPortion(
- const OUString& /*rText*/,
- const uno::Sequence< beans::PropertyValue >& /*rCharAndParaProps*/,
- const uno::Reference< text::XTextRange>& /*rTextRange*/ )
+ const OUString& rText,
+ const uno::Sequence< beans::PropertyValue >& rCharAndParaProps,
+ const uno::Reference< text::XTextRange>& rTextRange )
{
+ SolarMutexGuard aGuard;
+
uno::Reference< text::XTextRange > xRet;
+
+ if (!rTextRange.is())
+ return xRet;
+
+ SvxUnoTextRangeBase* pRange = comphelper::getFromUnoTunnel<SvxUnoTextRange>(rTextRange);
+ if (!pRange)
+ return xRet;
+
+ SvxEditSource *pEditSource = GetEditSource();
+ SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : nullptr;
+
+ if (pTextForwarder)
+ {
+ pRange->setString(rText);
+
+ ESelection aSelection(pRange->GetSelection());
+
+ pTextForwarder->RemoveAttribs(aSelection);
+ pEditSource->UpdateData();
+
+ SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
+ SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
+ ImplGetSvxTextPortionSfxPropertySet(), pTextForwarder, aSelection.nStartPara );
+ pTextForwarder->QuickSetAttribs( aItemSet, aSelection);
+ rtl::Reference<SvxUnoTextRange> pNewRange = new SvxUnoTextRange( *this );
+ xRet = pNewRange;
+ pNewRange->SetSelection(aSelection);
+ for( const beans::PropertyValue& rProp : rCharAndParaProps )
+ pNewRange->setPropertyValue( rProp.Name, rProp.Value );
+ }
return xRet;
}