summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-02-05 10:44:12 +0000
committerMichael Stahl <mstahl@redhat.com>2016-02-18 11:06:27 +0000
commit29b9df16dfbf17bbe9c46cd268849e6bfa97c84d (patch)
tree8ec29a7fad837e70671fe282afc0155f271d277b /sd
parent77d329a90f5c4ba22883b0756af112d8ebdf2599 (diff)
[API CHANGE] add Author Initials to XAnnotation
and use the users preferred initials for impress annotations i.e. the ones entered in the tools->options and save and load those to/from odf similarly to what we do for writer annotation initials Change-Id: Iadc0e994bfaf58632ce25b8f7cdc737580ee97bc Reviewed-on: https://gerrit.libreoffice.org/22143 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/core/annotations/Annotation.cxx22
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx2
-rw-r--r--sd/source/ui/annotations/annotationtag.cxx8
3 files changed, 29 insertions, 3 deletions
diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx
index c1b1065553e5..da351ff5f68d 100644
--- a/sd/source/core/annotations/Annotation.cxx
+++ b/sd/source/core/annotations/Annotation.cxx
@@ -82,6 +82,8 @@ public:
virtual void SAL_CALL setSize( const css::geometry::RealSize2D& _size ) throw (css::uno::RuntimeException, std::exception) override;
virtual OUString SAL_CALL getAuthor() throw (RuntimeException, std::exception) override;
virtual void SAL_CALL setAuthor(const OUString & the_value) throw (RuntimeException, std::exception) override;
+ virtual OUString SAL_CALL getInitials() throw (RuntimeException, std::exception) override;
+ virtual void SAL_CALL setInitials(const OUString & the_value) throw (RuntimeException, std::exception) override;
virtual util::DateTime SAL_CALL getDateTime() throw (RuntimeException, std::exception) override;
virtual void SAL_CALL setDateTime(const util::DateTime & the_value) throw (RuntimeException, std::exception) override;
virtual Reference< XText > SAL_CALL getTextRange() throw (RuntimeException, std::exception) override;
@@ -102,6 +104,7 @@ private:
RealPoint2D m_Position;
RealSize2D m_Size;
OUString m_Author;
+ OUString m_Initials;
util::DateTime m_DateTime;
rtl::Reference< TextApiObject > m_TextRange;
};
@@ -125,6 +128,7 @@ struct AnnotationData
RealPoint2D m_Position;
RealSize2D m_Size;
OUString m_Author;
+ OUString m_Initials;
util::DateTime m_DateTime;
void get( const rtl::Reference< Annotation >& xAnnotation )
@@ -132,6 +136,7 @@ struct AnnotationData
m_Position = xAnnotation->getPosition();
m_Size = xAnnotation->getSize();
m_Author = xAnnotation->getAuthor();
+ m_Initials = xAnnotation->getInitials();
m_DateTime = xAnnotation->getDateTime();
}
@@ -140,6 +145,7 @@ struct AnnotationData
xAnnotation->setPosition(m_Position);
xAnnotation->setSize(m_Size);
xAnnotation->setAuthor(m_Author);
+ xAnnotation->setInitials(m_Initials);
xAnnotation->setDateTime(m_DateTime);
}
};
@@ -289,6 +295,22 @@ void SAL_CALL Annotation::setAuthor(const OUString & the_value) throw (RuntimeEx
}
}
+OUString SAL_CALL Annotation::getInitials() throw (RuntimeException, std::exception)
+{
+ osl::MutexGuard g(m_aMutex);
+ return m_Initials;
+}
+
+void SAL_CALL Annotation::setInitials(const OUString & the_value) throw (RuntimeException, std::exception)
+{
+ prepareSet("Initials", Any(), Any(), nullptr);
+ {
+ osl::MutexGuard g(m_aMutex);
+ createChangeUndo();
+ m_Initials = the_value;
+ }
+}
+
util::DateTime SAL_CALL Annotation::getDateTime() throw (RuntimeException, std::exception)
{
osl::MutexGuard g(m_aMutex);
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index 02f3ca3af02a..24d0e68d1394 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -396,6 +396,7 @@ void AnnotationManagerImpl::InsertAnnotation()
// set current author to new annotation
SvtUserOptions aUserOptions;
xAnnotation->setAuthor( aUserOptions.GetFullName() );
+ xAnnotation->setInitials( aUserOptions.GetID() );
// set current time to new annotation
xAnnotation->setDateTime( getCurrentDateTime() );
@@ -467,6 +468,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest& rReq )
SvtUserOptions aUserOptions;
xAnnotation->setAuthor( aUserOptions.GetFullName() );
+ xAnnotation->setInitials( aUserOptions.GetID() );
// set current time to reply
xAnnotation->setDateTime( getCurrentDateTime() );
diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx
index 0c3638f0db2f..827ece454c84 100644
--- a/sd/source/ui/annotations/annotationtag.cxx
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -517,9 +517,11 @@ BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected )
{
ScopedVclPtrInstance< VirtualDevice > pVDev;
- OUString sAuthor(
- getInitials(mxAnnotation->getAuthor()) + " "
- + OUString::number(mnIndex));
+ OUString sInitials(mxAnnotation->getInitials());
+ if (sInitials.isEmpty())
+ sInitials = getInitials(mxAnnotation->getAuthor());
+
+ OUString sAuthor(sInitials + " " + OUString::number(mnIndex));
pVDev->SetFont( mrFont );