summaryrefslogtreecommitdiff
path: root/sd/source/ui/annotations
diff options
context:
space:
mode:
authorJaume Pujantell <jaume.pujantell@collabora.com>2023-06-05 11:49:41 +0200
committerAndras Timar <andras.timar@collabora.com>2023-06-08 21:53:59 +0200
commit53d610786ba8085fcce331174c74294c90c41a20 (patch)
tree3f4af2f6ebc0a22b5070a0a951d79f6221309fa9 /sd/source/ui/annotations
parent260bc16e1923016d0628a8779e219b290d4c9011 (diff)
pdfium: better suport for annotations and some fixes
Added suport to import FreeText annotations. Added some suport to export graphical annotations. Fixed some color issues to be more inline with the pdfium library. Change-Id: I7371595ebb95594ee765ae532ca7c7d4f0499592 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152606 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sd/source/ui/annotations')
-rw-r--r--sd/source/ui/annotations/annotationtag.cxx23
1 files changed, 17 insertions, 6 deletions
diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx
index 7afe26ee54b0..dbadf4cb6fe1 100644
--- a/sd/source/ui/annotations/annotationtag.cxx
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -524,18 +524,29 @@ BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected )
{
ScopedVclPtrInstance< VirtualDevice > pVDev;
- OUString sInitials(mxAnnotation->getInitials());
- if (sInitials.isEmpty())
- sInitials = getInitials(mxAnnotation->getAuthor());
+ OUString sText;
+ auto* pAnnotation = dynamic_cast<sd::Annotation*>(mxAnnotation.get());
+ if (pAnnotation && pAnnotation->isFreeText())
+ {
+ sText = mxAnnotation->getTextRange()->getString();
+ }
+ else
+ {
+ OUString sInitials(mxAnnotation->getInitials());
+ if (sInitials.isEmpty())
+ {
+ sInitials = getInitials(mxAnnotation->getAuthor());
+ }
- OUString sAuthor(sInitials + " " + OUString::number(mnIndex));
+ sText = sInitials + " " + OUString::number(mnIndex);
+ }
pVDev->SetFont( mrFont );
const int BORDER_X = 4; // pixels
const int BORDER_Y = 4; // pixels
- maSize = Size( pVDev->GetTextWidth( sAuthor ) + 2*BORDER_X, pVDev->GetTextHeight() + 2*BORDER_Y );
+ maSize = Size(pVDev->GetTextWidth(sText) + 2 * BORDER_X, pVDev->GetTextHeight() + 2 * BORDER_Y);
pVDev->SetOutputSizePixel( maSize, false );
Color aBorderColor( maColor );
@@ -563,7 +574,7 @@ BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected )
pVDev->DrawRect( aBorderRect );
pVDev->SetTextColor( maColor.IsDark() ? COL_WHITE : COL_BLACK );
- pVDev->DrawText( Point( BORDER_X, BORDER_Y ), sAuthor );
+ pVDev->DrawText(Point(BORDER_X, BORDER_Y), sText);
return pVDev->GetBitmapEx( aPos, maSize );
}