Related tdf#140226: use StaticWhichCast in annotationmanager.cxx (sd)

Change-Id: I6ea981af240bc87f46c9b6f70e3a05d8fd089b8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204362
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
This commit is contained in:
Julien Nabet
2026-04-26 13:29:04 +02:00
parent e66d2aec00
commit a909fbdaeb
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -936,7 +936,7 @@ class XFillGradientItem;
// 1092 is used out of order below
#define SID_OBJECT_MIRROR ( SID_SVX_START + 1093 )
#define SID_DELETE_POSTIT ( SID_SVX_START + 1094 )
#define SID_DELETE_POSTIT TypedWhichId<SfxUnoAnyItem>( SID_SVX_START + 1094 )
#define SID_NEXT_POSTIT ( SID_SVX_START + 1095 )
#define SID_PREVIOUS_POSTIT ( SID_SVX_START + 1096 )
#define SID_DELETEALL_POSTIT ( SID_SVX_START + 1097 )
@@ -381,7 +381,7 @@ void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest const & rReq)
const SfxPoolItem* pPoolItem = nullptr;
if( SfxItemState::SET == pArgs->GetItemState( SID_DELETEALLBYAUTHOR_POSTIT, true, &pPoolItem ) )
{
OUString sAuthor( static_cast<const SfxStringItem*>( pPoolItem )->GetValue() );
OUString sAuthor( pPoolItem->StaticWhichCast(SID_DELETEALLBYAUTHOR_POSTIT).GetValue() );
DeleteAnnotationsByAuthor( sAuthor );
}
}
@@ -396,14 +396,14 @@ void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest const & rReq)
if( SfxItemState::SET == pArgs->GetItemState( SID_DELETE_POSTIT, true, &pPoolItem ) )
{
uno::Reference<office::XAnnotation> xTmpAnnotation;
if (static_cast<const SfxUnoAnyItem*>(pPoolItem)->GetValue() >>= xTmpAnnotation)
if (pPoolItem->StaticWhichCast(SID_DELETE_POSTIT).GetValue() >>= xTmpAnnotation)
{
xAnnotation = dynamic_cast<sdr::annotation::Annotation*>(xTmpAnnotation.get());
assert(bool(xAnnotation) == bool(xTmpAnnotation) && "must be of concrete type sd::Annotation");
}
}
if( SfxItemState::SET == pArgs->GetItemState( SID_ATTR_POSTIT_ID, true, &pPoolItem ) )
nId = static_cast<const SvxPostItIdItem*>(pPoolItem)->GetValue().toUInt32();
nId = pPoolItem->StaticWhichCast(SID_ATTR_POSTIT_ID).GetValue().toUInt32();
}
if (nId != 0)
@@ -585,7 +585,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq )
if( SfxItemState::SET == pArgs->GetItemState( SID_ATTR_POSTIT_ID, true, &pPoolItem ) )
{
sal_uInt32 nReplyId = 0; // Id of the comment to reply to
nReplyId = static_cast<const SvxPostItIdItem*>(pPoolItem)->GetValue().toUInt32();
nReplyId = pPoolItem->StaticWhichCast(SID_ATTR_POSTIT_ID).GetValue().toUInt32();
xAnnotation = GetAnnotationById(nReplyId);
}
else if( SfxItemState::SET == pArgs->GetItemState( rReq.GetSlot(), true, &pPoolItem ) )
@@ -599,7 +599,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq )
}
if( SfxItemState::SET == pArgs->GetItemState( SID_ATTR_POSTIT_TEXT, true, &pPoolItem ) )
sReplyText = static_cast<const SvxPostItTextItem*>( pPoolItem )->GetValue();
sReplyText = pPoolItem->StaticWhichCast(SID_ATTR_POSTIT_TEXT).GetValue();
}
auto* pTextApi = getTextApiObject( xAnnotation );