VCL: Simplify MessBox and its children initialisation.

Change-Id: Icf24af615e6020b40f92f565194b2328e99f47ad
Reviewed-on: https://gerrit.libreoffice.org/26199
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Arnaud Versini
2016-06-12 15:42:19 +02:00
committed by Noel Grandin
parent 272a8afa60
commit 4ccc83fb25
2 changed files with 18 additions and 57 deletions

View File

@@ -41,7 +41,6 @@ protected:
OUString maCheckBoxText;
bool mbCheck;
SAL_DLLPRIVATE void ImplInitMessBoxData();
SAL_DLLPRIVATE void ImplInitButtons();
SAL_DLLPRIVATE void ImplPosControls();
@@ -67,9 +66,6 @@ public:
class VCL_DLLPUBLIC InfoBox : public MessBox
{
private:
SAL_DLLPRIVATE void ImplInitInfoBoxData();
public:
InfoBox( vcl::Window* pParent, const OUString& rMessage );
InfoBox( vcl::Window* pParent, WinBits nStyle,
@@ -80,9 +76,6 @@ public:
class VCL_DLLPUBLIC WarningBox : public MessBox
{
private:
SAL_DLLPRIVATE void ImplInitWarningBoxData();
public:
WarningBox( vcl::Window* pParent, WinBits nStyle,
const OUString& rMessage );
@@ -94,9 +87,6 @@ public:
class VCL_DLLPUBLIC ErrorBox : public MessBox
{
private:
SAL_DLLPRIVATE void ImplInitErrorBoxData();
public:
ErrorBox( vcl::Window* pParent, WinBits nStyle,
const OUString& rMessage );

View File

@@ -51,15 +51,6 @@ static void ImplInitMsgBoxImageList()
}
}
void MessBox::ImplInitMessBoxData()
{
mpVCLMultiLineEdit = nullptr;
mpFixedImage = nullptr;
mbHelpBtn = false;
mpCheckBox = nullptr;
mbCheck = false;
}
void MessBox::ImplInitButtons()
{
WinBits nStyle = GetStyle();
@@ -140,9 +131,10 @@ void MessBox::ImplInitButtons()
MessBox::MessBox( vcl::Window* pParent, WinBits nStyle,
const OUString& rTitle, const OUString& rMessage ) :
ButtonDialog( WINDOW_MESSBOX ),
maMessText( rMessage )
maMessText( rMessage ),
mbHelpBtn( false ),
mbCheck( false )
{
ImplInitMessBoxData();
ImplInit( pParent, nStyle | WB_MOVEABLE | WB_HORZ | WB_CENTER );
ImplInitButtons();
@@ -379,7 +371,13 @@ Size MessBox::GetOptimalSize() const
return Size( 250, 100 );
}
void InfoBox::ImplInitInfoBoxData()
InfoBox::InfoBox( vcl::Window* pParent, const OUString& rMessage ) :
InfoBox( pParent, WB_OK | WB_DEF_OK, rMessage )
{
}
InfoBox::InfoBox( vcl::Window* pParent, WinBits nStyle, const OUString& rMessage ) :
MessBox( pParent, nStyle, OUString(), rMessage )
{
// Default Text is the display title from the application
if ( GetText().isEmpty() )
@@ -388,25 +386,15 @@ void InfoBox::ImplInitInfoBoxData()
SetImage( InfoBox::GetStandardImage() );
}
InfoBox::InfoBox( vcl::Window* pParent, const OUString& rMessage ) :
MessBox( pParent, WB_OK | WB_DEF_OK, OUString(), rMessage )
{
ImplInitInfoBoxData();
}
InfoBox::InfoBox( vcl::Window* pParent, WinBits nStyle, const OUString& rMessage ) :
MessBox( pParent, nStyle, OUString(), rMessage )
{
ImplInitInfoBoxData();
}
Image InfoBox::GetStandardImage()
{
ImplInitMsgBoxImageList();
return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 4 );
}
void WarningBox::ImplInitWarningBoxData()
WarningBox::WarningBox( vcl::Window* pParent, WinBits nStyle,
const OUString& rMessage ) :
MessBox( pParent, nStyle, OUString(), rMessage )
{
// Default Text is the display title from the application
if ( GetText().isEmpty() )
@@ -415,13 +403,6 @@ void WarningBox::ImplInitWarningBoxData()
SetImage( WarningBox::GetStandardImage() );
}
WarningBox::WarningBox( vcl::Window* pParent, WinBits nStyle,
const OUString& rMessage ) :
MessBox( pParent, nStyle, OUString(), rMessage )
{
ImplInitWarningBoxData();
}
void WarningBox::SetDefaultCheckBoxText()
{
ResMgr* pResMgr = ImplGetResMgr();
@@ -435,7 +416,9 @@ Image WarningBox::GetStandardImage()
return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 3 );
}
void ErrorBox::ImplInitErrorBoxData()
ErrorBox::ErrorBox( vcl::Window* pParent, WinBits nStyle,
const OUString& rMessage ) :
MessBox( pParent, nStyle, OUString(), rMessage )
{
// Default Text is the display title from the application
if ( GetText().isEmpty() )
@@ -444,13 +427,6 @@ void ErrorBox::ImplInitErrorBoxData()
SetImage( ErrorBox::GetStandardImage() );
}
ErrorBox::ErrorBox( vcl::Window* pParent, WinBits nStyle,
const OUString& rMessage ) :
MessBox( pParent, nStyle, OUString(), rMessage )
{
ImplInitErrorBoxData();
}
Image ErrorBox::GetStandardImage()
{
try
@@ -466,7 +442,8 @@ Image ErrorBox::GetStandardImage()
return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 1 );
}
void QueryBox::ImplInitQueryBoxData()
QueryBox::QueryBox( vcl::Window* pParent, WinBits nStyle, const OUString& rMessage ) :
MessBox( pParent, nStyle, OUString(), rMessage )
{
// Default Text is the display title from the application
if ( GetText().isEmpty() )
@@ -475,12 +452,6 @@ void QueryBox::ImplInitQueryBoxData()
SetImage( QueryBox::GetStandardImage() );
}
QueryBox::QueryBox( vcl::Window* pParent, WinBits nStyle, const OUString& rMessage ) :
MessBox( pParent, nStyle, OUString(), rMessage )
{
ImplInitQueryBoxData();
}
void QueryBox::SetDefaultCheckBoxText()
{
ResMgr* pResMgr = ImplGetResMgr();