diff options
-rw-r--r-- | sd/source/ui/annotations/annotationmanager.cxx | 36 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotationmanagerimpl.hxx | 2 | ||||
-rw-r--r-- | svx/sdi/svx.sdi | 2 |
3 files changed, 37 insertions, 3 deletions
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index 70d53dae6363..1bef8877276f 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -61,6 +61,7 @@ #include <editeng/udlnitem.hxx> #include <editeng/crossedoutitem.hxx> +#include <svx/postattr.hxx> #include <svx/svdetc.hxx> #include "annotationmanager.hxx" @@ -68,6 +69,7 @@ #include "annotationwindow.hxx" #include "annotations.hrc" +#include "Annotation.hxx" #include "ToolBarManager.hxx" #include "DrawDocShell.hxx" #include "DrawViewShell.hxx" @@ -244,6 +246,30 @@ void SAL_CALL AnnotationManagerImpl::disposing( const css::lang::EventObject& /* { } +Reference<XAnnotation> AnnotationManagerImpl::GetAnnotationById(sal_uInt32 nAnnotationId) +{ + SdPage* pPage = nullptr; + do + { + pPage = GetNextPage(pPage, true); + if( pPage && !pPage->getAnnotations().empty() ) + { + AnnotationVector aAnnotations(pPage->getAnnotations()); + for( AnnotationVector::iterator iter = aAnnotations.begin(); iter != aAnnotations.end(); ++iter ) + { + Reference<XAnnotation> xAnnotation(*iter); + if( sd::getAnnotationId(xAnnotation) == nAnnotationId ) + { + return xAnnotation; + } + } + } + } while( pPage ); + + Reference<XAnnotation> xAnnotationEmpty; + return xAnnotationEmpty; +} + void AnnotationManagerImpl::ShowAnnotations( bool bShow ) { // enforce show annotations if a new annotation is inserted @@ -315,14 +341,19 @@ void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest& rReq) case SID_DELETE_POSTIT: { Reference< XAnnotation > xAnnotation; + sal_uInt32 nId = 0; if( pArgs ) { const SfxPoolItem* pPoolItem = nullptr; if( SfxItemState::SET == pArgs->GetItemState( SID_DELETE_POSTIT, true, &pPoolItem ) ) static_cast<const SfxUnoAnyItem*>(pPoolItem)->GetValue() >>= xAnnotation; + if( SfxItemState::SET == pArgs->GetItemState( SID_ATTR_POSTIT_ID, true, &pPoolItem ) ) + nId = static_cast<const SvxPostItIdItem*>(pPoolItem)->GetValue().toUInt32(); } - if( !xAnnotation.is() ) + if (nId != 0) + xAnnotation = GetAnnotationById(nId); + else if( !xAnnotation.is() ) GetSelectedAnnotation( xAnnotation ); DeleteAnnotation( xAnnotation ); @@ -576,7 +607,8 @@ void AnnotationManagerImpl::GetAnnotationState(SfxItemSet& rSet) Reference< XAnnotation > xAnnotation; GetSelectedAnnotation( xAnnotation ); - if( !xAnnotation.is() || bReadOnly ) + // Don't disable SID_DELETE_POSTIT slot in case of LOK + if( (!xAnnotation.is() && !comphelper::LibreOfficeKit::isActive()) || bReadOnly ) rSet.DisableItem( SID_DELETE_POSTIT ); SdPage* pPage = nullptr; diff --git a/sd/source/ui/annotations/annotationmanagerimpl.hxx b/sd/source/ui/annotations/annotationmanagerimpl.hxx index b860118cfdd5..5ef5139749ff 100644 --- a/sd/source/ui/annotations/annotationmanagerimpl.hxx +++ b/sd/source/ui/annotations/annotationmanagerimpl.hxx @@ -128,6 +128,8 @@ private: bool mbPopupMenuActive; ImplSVEvent * mnUpdateTagsEvent; vcl::Font maFont; + + css::uno::Reference<css::office::XAnnotation> GetAnnotationById(sal_uInt32 nAnnotationId); }; OUString getAnnotationDateTimeString( const css::uno::Reference< css::office::XAnnotation >& xAnnotation ); diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index ca91a73080b7..bf93a6e9b3ab 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -4609,7 +4609,7 @@ SfxVoidItem ReplyToAnnotation SID_REPLYTO_POSTIT SfxVoidItem DeleteAnnotation SID_DELETE_POSTIT -() +(SvxPostItIdItem Id SID_ATTR_POSTIT_ID) [ AutoUpdate = FALSE, FastCall = FALSE, |