summaryrefslogtreecommitdiff
path: root/extensions/source/scanner
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/source/scanner')
-rw-r--r--extensions/source/scanner/grid.cxx21
-rw-r--r--extensions/source/scanner/grid.hxx11
-rw-r--r--extensions/source/scanner/sanedlg.cxx67
-rw-r--r--extensions/source/scanner/sanedlg.hxx49
-rw-r--r--extensions/source/scanner/scanunx.cxx6
5 files changed, 106 insertions, 48 deletions
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index 1056a1474c9b..346715b4bc28 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -120,6 +120,7 @@ public:
GridWindow(vcl::Window* pParent);
void Init(double* pXValues, double* pYValues, int nValues, bool bCutValues, const BitmapEx &rMarkerBitmap);
virtual ~GridWindow();
+ virtual void dispose() SAL_OVERRIDE;
void setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY );
@@ -212,9 +213,29 @@ GridDialog::GridDialog(double* pXValues, double* pYValues, int nValues, vcl::Win
m_pResetButton->SetClickHdl( LINK( this, GridDialog, ClickButtonHdl ) );
}
+GridDialog::~GridDialog()
+{
+ disposeOnce();
+}
+
+void GridDialog::dispose()
+{
+ m_pOKButton.clear();
+ m_pResetTypeBox.clear();
+ m_pResetButton.clear();
+ m_pGridWindow.clear();
+ ModalDialog::dispose();
+}
+
GridWindow::~GridWindow()
{
+ disposeOnce();
+}
+
+void GridWindow::dispose()
+{
delete [] m_pNewYValues;
+ vcl::Window::dispose();
}
double GridWindow::findMinX()
diff --git a/extensions/source/scanner/grid.hxx b/extensions/source/scanner/grid.hxx
index 6fca647facd5..940dec60097e 100644
--- a/extensions/source/scanner/grid.hxx
+++ b/extensions/source/scanner/grid.hxx
@@ -37,19 +37,20 @@ enum resetType
class GridDialog : public ModalDialog
{
- OKButton* m_pOKButton;
+ VclPtr<OKButton> m_pOKButton;
- ListBox* m_pResetTypeBox;
- PushButton* m_pResetButton;
+ VclPtr<ListBox> m_pResetTypeBox;
+ VclPtr<PushButton> m_pResetButton;
- GridWindow* m_pGridWindow;
+ VclPtr<GridWindow> m_pGridWindow;
DECL_LINK( ClickButtonHdl, Button* );
public:
GridDialog(double* pXValues, double* pYValues, int nValues,
vcl::Window* pParent, bool bCutValues = true);
-
+ virtual ~GridDialog();
+ virtual void dispose() SAL_OVERRIDE;
void setBoundings(double fMinX, double fMinY, double fMaxX, double fMaxY);
double* getNewYValues();
};
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index ae9c4d5cc00d..384be4d3371d 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -43,7 +43,7 @@ private:
Rectangle maPreviewRect;
Point maTopLeft, maBottomRight;
Point maMinTopLeft, maMaxBottomRight;
- SaneDlg* mpParentDialog;
+ VclPtr<SaneDlg> mpParentDialog;
DragDirection meDragDirection;
bool mbDragEnable;
bool mbDragDrawn;
@@ -61,6 +61,12 @@ public:
, mbIsDragging(false)
{
}
+ virtual ~ScanPreview() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
+ {
+ mpParentDialog.clear();
+ vcl::Window::dispose();
+ }
void Init(SaneDlg *pParent)
{
mpParentDialog = pParent;
@@ -151,8 +157,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeScanPreview(vcl::Windo
OString sBorder = VclBuilder::extractCustomProperty(rMap);
if (!sBorder.isEmpty())
nWinStyle |= WB_BORDER;
- ScanPreview *pWindow = new ScanPreview(pParent, nWinStyle);
- return pWindow;
+ return new ScanPreview(pParent, nWinStyle);
}
SaneDlg::SaneDlg( vcl::Window* pParent, Sane& rSane, bool bScanEnabled ) :
@@ -239,7 +244,37 @@ SaneDlg::SaneDlg( vcl::Window* pParent, Sane& rSane, bool bScanEnabled ) :
SaneDlg::~SaneDlg()
{
+ disposeOnce();
+}
+
+void SaneDlg::dispose()
+{
mrSane.SetReloadOptionsHdl( maOldLink );
+ mpOKButton.clear();
+ mpCancelButton.clear();
+ mpDeviceInfoButton.clear();
+ mpPreviewButton.clear();
+ mpScanButton.clear();
+ mpButtonOption.clear();
+ mpOptionTitle.clear();
+ mpOptionDescTxt.clear();
+ mpVectorTxt.clear();
+ mpLeftField.clear();
+ mpTopField.clear();
+ mpRightField.clear();
+ mpBottomField.clear();
+ mpDeviceBox.clear();
+ mpReslBox.clear();
+ mpAdvancedBox.clear();
+ mpVectorBox.clear();
+ mpQuantumRangeBox.clear();
+ mpStringRangeBox.clear();
+ mpBoolCheckBox.clear();
+ mpStringEdit.clear();
+ mpNumericEdit.clear();
+ mpOptionBox.clear();
+ mpPreview.clear();
+ ModalDialog::dispose();
}
namespace {
@@ -256,8 +291,8 @@ short SaneDlg::Execute()
{
if( ! Sane::IsSane() )
{
- MessageDialog aErrorBox(NULL, SaneResId(STR_COULD_NOT_BE_INIT));
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SaneResId(STR_COULD_NOT_BE_INIT));
+ aErrorBox->Execute();
return RET_CANCEL;
}
LoadState();
@@ -539,8 +574,8 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton )
aString = aString.replaceFirst( "%s", Sane::GetVendor( mrSane.GetDeviceNumber() ) );
aString = aString.replaceFirst( "%s", Sane::GetModel( mrSane.GetDeviceNumber() ) );
aString = aString.replaceFirst( "%s", Sane::GetType( mrSane.GetDeviceNumber() ) );
- MessageDialog aInfoBox(this, aString, VCL_MESSAGE_INFO);
- aInfoBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aInfoBox(this, aString, VCL_MESSAGE_INFO);
+ aInfoBox->Execute();
}
else if( pButton == mpPreviewButton )
AcquirePreview();
@@ -568,11 +603,11 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton )
x[ i ] = (double)i;
mrSane.GetOptionValue( mnCurrentOption, y.get() );
- GridDialog aGrid( x.get(), y.get(), nElements, this );
- aGrid.SetText( mrSane.GetOptionName( mnCurrentOption ) );
- aGrid.setBoundings( 0, mfMin, nElements, mfMax );
- if( aGrid.Execute() && aGrid.getNewYValues() )
- mrSane.SetOptionValue( mnCurrentOption, aGrid.getNewYValues() );
+ ScopedVclPtrInstance< GridDialog > aGrid( x.get(), y.get(), nElements, this );
+ aGrid->SetText( mrSane.GetOptionName( mnCurrentOption ) );
+ aGrid->setBoundings( 0, mfMin, nElements, mfMax );
+ if( aGrid->Execute() && aGrid->getNewYValues() )
+ mrSane.SetOptionValue( mnCurrentOption, aGrid->getNewYValues() );
}
break;
case SANE_TYPE_BOOL:
@@ -820,8 +855,8 @@ void SaneDlg::AcquirePreview()
if( nOption == -1 )
{
OUString aString(SaneResId(STR_SLOW_PREVIEW));
- MessageDialog aBox(this, aString, VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL);
- if (aBox.Execute() == RET_CANCEL)
+ ScopedVclPtrInstance< MessageDialog > aBox(this, aString, VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL);
+ if (aBox->Execute() == RET_CANCEL)
return;
}
else
@@ -830,8 +865,8 @@ void SaneDlg::AcquirePreview()
BitmapTransporter aTransporter;
if( ! mrSane.Start( aTransporter ) )
{
- MessageDialog aErrorBox(this, SaneResId(STR_ERROR_SCAN));
- aErrorBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(this, SaneResId(STR_ERROR_SCAN));
+ aErrorBox->Execute();
}
else
{
diff --git a/extensions/source/scanner/sanedlg.hxx b/extensions/source/scanner/sanedlg.hxx
index 57eaa54b0cb3..6aca2733c3a7 100644
--- a/extensions/source/scanner/sanedlg.hxx
+++ b/extensions/source/scanner/sanedlg.hxx
@@ -40,38 +40,38 @@ private:
Link maOldLink;
- OKButton* mpOKButton;
- CancelButton* mpCancelButton;
- PushButton* mpDeviceInfoButton;
- PushButton* mpPreviewButton;
- PushButton* mpScanButton;
- PushButton* mpButtonOption;
+ VclPtr<OKButton> mpOKButton;
+ VclPtr<CancelButton> mpCancelButton;
+ VclPtr<PushButton> mpDeviceInfoButton;
+ VclPtr<PushButton> mpPreviewButton;
+ VclPtr<PushButton> mpScanButton;
+ VclPtr<PushButton> mpButtonOption;
- FixedText* mpOptionTitle;
- FixedText* mpOptionDescTxt;
- FixedText* mpVectorTxt;
+ VclPtr<FixedText> mpOptionTitle;
+ VclPtr<FixedText> mpOptionDescTxt;
+ VclPtr<FixedText> mpVectorTxt;
- MetricField* mpLeftField;
- MetricField* mpTopField;
- MetricField* mpRightField;
- MetricField* mpBottomField;
+ VclPtr<MetricField> mpLeftField;
+ VclPtr<MetricField> mpTopField;
+ VclPtr<MetricField> mpRightField;
+ VclPtr<MetricField> mpBottomField;
- ListBox* mpDeviceBox;
- NumericBox* mpReslBox;
- CheckBox* mpAdvancedBox;
+ VclPtr<ListBox> mpDeviceBox;
+ VclPtr<NumericBox> mpReslBox;
+ VclPtr<CheckBox> mpAdvancedBox;
- NumericField* mpVectorBox;
- ListBox* mpQuantumRangeBox;
- ListBox* mpStringRangeBox;
+ VclPtr<NumericField> mpVectorBox;
+ VclPtr<ListBox> mpQuantumRangeBox;
+ VclPtr<ListBox> mpStringRangeBox;
- CheckBox* mpBoolCheckBox;
+ VclPtr<CheckBox> mpBoolCheckBox;
- Edit* mpStringEdit;
- Edit* mpNumericEdit;
+ VclPtr<Edit> mpStringEdit;
+ VclPtr<Edit> mpNumericEdit;
- SvTreeListBox* mpOptionBox;
+ VclPtr<SvTreeListBox> mpOptionBox;
- ScanPreview* mpPreview;
+ VclPtr<ScanPreview> mpPreview;
int mnCurrentOption;
int mnCurrentElement;
@@ -105,6 +105,7 @@ private:
public:
SaneDlg( vcl::Window*, Sane&, bool );
virtual ~SaneDlg();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
void UpdateScanArea( bool );
diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx
index a66d797587dc..7d4da1f523fe 100644
--- a/extensions/source/scanner/scanunx.cxx
+++ b/extensions/source/scanner/scanunx.cxx
@@ -299,9 +299,9 @@ sal_Bool ScannerManager::configureScannerAndScan( ScannerContext& scanner_contex
);
pHolder->m_bBusy = true;
- SaneDlg aDlg( NULL, pHolder->m_aSane, listener.is() );
- bRet = aDlg.Execute();
- bScan = aDlg.getDoScan();
+ ScopedVclPtrInstance< SaneDlg > aDlg(nullptr, pHolder->m_aSane, listener.is());
+ bRet = aDlg->Execute();
+ bScan = aDlg->getDoScan();
pHolder->m_bBusy = false;
}
if ( bScan )