[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>
This commit is contained in:
committed by
Michael Stahl
parent
77d329a90f
commit
29b9df16df
@@ -58,6 +58,9 @@ interface XAnnotation
|
||||
/** stores the full name of the author who created this annotation. */
|
||||
[attribute] string Author;
|
||||
|
||||
/** stores the initials of the author who created this annotation. */
|
||||
[attribute] string Initials;
|
||||
|
||||
/** stores the date and time this annotation was last edited. */
|
||||
[attribute] ::com::sun::star::util::DateTime DateTime;
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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() );
|
||||
|
@@ -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 );
|
||||
|
||||
|
@@ -2705,6 +2705,18 @@ void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage )
|
||||
this->Characters(aAuthor);
|
||||
}
|
||||
|
||||
if (SvtSaveOptions().GetODFDefaultVersion() > SvtSaveOptions::ODFVER_012)
|
||||
{
|
||||
// initials
|
||||
OUString aInitials( xAnnotation->getInitials() );
|
||||
if( !aInitials.isEmpty() )
|
||||
{
|
||||
SvXMLElementExport aInitialsElem( *this, XML_NAMESPACE_LO_EXT,
|
||||
XML_SENDER_INITIALS, true, false );
|
||||
this->Characters(aInitials);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// date time
|
||||
css::util::DateTime aDate( xAnnotation->getDateTime() );
|
||||
|
@@ -67,6 +67,7 @@ private:
|
||||
Reference< XTextCursor > mxCursor;
|
||||
|
||||
OUStringBuffer maAuthorBuffer;
|
||||
OUStringBuffer maInitialsBuffer;
|
||||
OUStringBuffer maDateBuffer;
|
||||
};
|
||||
|
||||
@@ -141,6 +142,11 @@ SvXMLImportContext * DrawAnnotationContext::CreateChildContext( sal_uInt16 nPref
|
||||
else if( IsXMLToken( rLocalName, XML_DATE ) )
|
||||
pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maDateBuffer);
|
||||
}
|
||||
else if( (XML_NAMESPACE_TEXT == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix) &&
|
||||
IsXMLToken(rLocalName, XML_SENDER_INITIALS) )
|
||||
{
|
||||
pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maInitialsBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
// create text cursor on demand
|
||||
@@ -188,6 +194,7 @@ void DrawAnnotationContext::EndElement()
|
||||
if( mxAnnotation.is() )
|
||||
{
|
||||
mxAnnotation->setAuthor( maAuthorBuffer.makeStringAndClear() );
|
||||
mxAnnotation->setInitials( maInitialsBuffer.makeStringAndClear() );
|
||||
|
||||
util::DateTime aDateTime;
|
||||
if (::sax::Converter::parseDateTime(aDateTime, nullptr,
|
||||
|
Reference in New Issue
Block a user