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>
This commit is contained in:
Samuel Mehrbrodt
2024-07-04 07:33:49 +02:00
parent 9b72524722
commit 3958f65b8e
3 changed files with 13 additions and 0 deletions
+1
View File
@@ -97,6 +97,7 @@ class Comment
return y.toInt32();
}
OUString getAuthor ( const CommentAuthorList& list );
OUString getInitials ( const CommentAuthorList& list );
};
class CommentList
+11
View File
@@ -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())
@@ -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());