loplugin:fieldcast in SvxClipBoardControl

Change-Id: I5877e1dd8c17c36a5233457030d54349f11ab04f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159223
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2023-11-08 13:41:39 +02:00
parent d294d1a32d
commit 651b8080d1
2 changed files with 7 additions and 7 deletions

View file

@ -28,10 +28,11 @@
class SfxModule;
class ToolBox;
class SvxClipboardFormatItem;
class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxClipBoardControl final : public SfxToolBoxControl
{
std::unique_ptr<SfxPoolItem> pClipboardFmtItem;
std::unique_ptr<SvxClipboardFormatItem> pClipboardFmtItem;
bool bDisabled;
public:

View file

@ -57,17 +57,16 @@ SvxClipBoardControl::~SvxClipBoardControl()
void SvxClipBoardControl::CreatePopupWindow()
{
const SvxClipboardFormatItem* pFmtItem = dynamic_cast<SvxClipboardFormatItem*>( pClipboardFmtItem.get() );
if ( pFmtItem )
if ( pClipboardFmtItem )
{
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "svx/ui/clipboardmenu.ui"));
std::unique_ptr<weld::Menu> xPopup(xBuilder->weld_menu("menu"));
sal_uInt16 nCount = pFmtItem->Count();
sal_uInt16 nCount = pClipboardFmtItem->Count();
for (sal_uInt16 i = 0; i < nCount; ++i)
{
SotClipboardFormatId nFmtID = pFmtItem->GetClipbrdFormatId( i );
OUString aFmtStr( pFmtItem->GetClipbrdFormatName( i ) );
SotClipboardFormatId nFmtID = pClipboardFmtItem->GetClipbrdFormatId( i );
OUString aFmtStr( pClipboardFmtItem->GetClipbrdFormatName( i ) );
if (aFmtStr.isEmpty())
aFmtStr = SvPasteObjectHelper::GetSotFormatUIName( nFmtID );
xPopup->append(OUString::number(static_cast<sal_uInt32>(nFmtID)), aFmtStr);
@ -102,7 +101,7 @@ void SvxClipBoardControl::StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItem
pClipboardFmtItem.reset();
if ( eState >= SfxItemState::DEFAULT )
{
pClipboardFmtItem.reset( pState->Clone() );
pClipboardFmtItem.reset( static_cast<SvxClipboardFormatItem*>(pState->Clone()) );
GetToolBox().SetItemBits( GetId(), GetToolBox().GetItemBits( GetId() ) | ToolBoxItemBits::DROPDOWN );
}
else if ( !bDisabled )