summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2024-07-01 23:44:30 +0200
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2024-07-04 07:33:49 +0200
commit3958f65b8e5d28bf2e4a7854f7446bebf427e23b (patch)
treeb169e0ab5db88c11c3dd75660976c5a9febdc12c /oox/source
parent9b72524722efbc60532a04bb55660a3c35696adf (diff)
pptx: Import comment author initials
Change-Id: Ic5838c929db9c08d6d9c6e1c87160dc2530105e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169847 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/ppt/comments.cxx11
-rw-r--r--oox/source/ppt/presentationfragmenthandler.cxx1
2 files changed, 12 insertions, 0 deletions
diff --git a/oox/source/ppt/comments.cxx b/oox/source/ppt/comments.cxx
index 7082649dd9a7..37fa924e786f 100644
--- a/oox/source/ppt/comments.cxx
+++ b/oox/source/ppt/comments.cxx
@@ -76,6 +76,17 @@ OUString Comment::getAuthor(const CommentAuthorList& list)
return u"Anonymous"_ustr;
}
+OUString Comment::getInitials(const CommentAuthorList& list)
+{
+ const sal_Int32 nId = authorId.toInt32();
+ for (auto const& author : list.cmAuthorLst)
+ {
+ if (author.id.toInt32() == nId)
+ return author.initials;
+ }
+ return u"A"_ustr;
+}
+
const Comment& CommentList::getCommentAtIndex(int index)
{
if (index < 0 || o3tl::make_unsigned(index) >= cmLst.size())
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index c8783a7da976..9a1ea8679cef 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -595,6 +595,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage
::oox::drawingml::convertEmuToHmm( nPosX ) * 15.87,
::oox::drawingml::convertEmuToHmm( nPosY ) * 15.87 ) );
xAnnotation->setAuthor( aComment.getAuthor(maAuthorList) );
+ xAnnotation->setInitials( aComment.getInitials(maAuthorList) );
xAnnotation->setDateTime( aComment.getDateTime() );
uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
xText->setString( aComment.get_text());