Kaydet (Commit) e098e2d5 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in MoreButton

and remove unused mpItemList field in ImplMoreButtonData

Change-Id: I1eee6958d0f064cec22028399de5fb28e8647617
Reviewed-on: https://gerrit.libreoffice.org/53236Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 00dd50d1
...@@ -24,13 +24,14 @@ ...@@ -24,13 +24,14 @@
#include <vcl/dllapi.h> #include <vcl/dllapi.h>
#include <vcl/mapmod.hxx> #include <vcl/mapmod.hxx>
#include <vcl/button.hxx> #include <vcl/button.hxx>
#include <memory>
struct ImplMoreButtonData; struct ImplMoreButtonData;
class VCL_DLLPUBLIC MoreButton : public PushButton class VCL_DLLPUBLIC MoreButton : public PushButton
{ {
ImplMoreButtonData* mpMBData; std::unique_ptr<ImplMoreButtonData> mpMBData;
bool mbState; bool mbState;
MoreButton( const MoreButton & ) = delete; MoreButton( const MoreButton & ) = delete;
......
...@@ -23,18 +23,15 @@ ...@@ -23,18 +23,15 @@
struct ImplMoreButtonData struct ImplMoreButtonData
{ {
std::vector< VclPtr<vcl::Window> >* mpItemList;
OUString maMoreText; OUString maMoreText;
OUString maLessText; OUString maLessText;
}; };
void MoreButton::ImplInit( vcl::Window* pParent, WinBits nStyle ) void MoreButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
{ {
mpMBData = new ImplMoreButtonData; mpMBData.reset(new ImplMoreButtonData);
mbState = false; mbState = false;
mpMBData->mpItemList = nullptr;
PushButton::ImplInit( pParent, nStyle ); PushButton::ImplInit( pParent, nStyle );
mpMBData->maMoreText = Button::GetStandardText( StandardButtonType::More ); mpMBData->maMoreText = Button::GetStandardText( StandardButtonType::More );
...@@ -80,8 +77,7 @@ MoreButton::~MoreButton() ...@@ -80,8 +77,7 @@ MoreButton::~MoreButton()
void MoreButton::dispose() void MoreButton::dispose()
{ {
delete mpMBData->mpItemList; mpMBData.reset();
delete mpMBData;
PushButton::dispose(); PushButton::dispose();
} }
...@@ -98,13 +94,6 @@ void MoreButton::Click() ...@@ -98,13 +94,6 @@ void MoreButton::Click()
// Update the windows according to the status // Update the windows according to the status
if ( mbState ) if ( mbState )
{ {
// Show window
if ( mpMBData->mpItemList ) {
for (VclPtr<Window> & i : *mpMBData->mpItemList) {
i->Show();
}
}
// Adapt dialogbox // Adapt dialogbox
Point aPos( pParent->GetPosPixel() ); Point aPos( pParent->GetPosPixel() );
tools::Rectangle aDeskRect( pParent->ImplGetFrameWindow()->GetDesktopRectPixel() ); tools::Rectangle aDeskRect( pParent->ImplGetFrameWindow()->GetDesktopRectPixel() );
...@@ -127,13 +116,6 @@ void MoreButton::Click() ...@@ -127,13 +116,6 @@ void MoreButton::Click()
// Adapt Dialogbox // Adapt Dialogbox
aSize.AdjustHeight( -nDeltaPixel ); aSize.AdjustHeight( -nDeltaPixel );
pParent->SetSizePixel( aSize ); pParent->SetSizePixel( aSize );
// Hide window(s) again
if ( mpMBData->mpItemList ) {
for (VclPtr<Window> & i : *mpMBData->mpItemList) {
i->Hide();
}
}
} }
// Call Click handler here, so that we can initialize the Controls // Call Click handler here, so that we can initialize the Controls
PushButton::Click(); PushButton::Click();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment