summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/browser
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/browser')
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx26
-rw-r--r--dbaccess/source/ui/browser/brwview.cxx34
-rw-r--r--dbaccess/source/ui/browser/dataview.cxx28
-rw-r--r--dbaccess/source/ui/browser/dbtreeview.cxx11
-rw-r--r--dbaccess/source/ui/browser/dbtreeview.hxx3
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx13
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx32
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx4
8 files changed, 87 insertions, 64 deletions
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 0bfddcc7bb6c..d39dd447553b 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -757,7 +757,7 @@ bool SbaXDataBrowserController::Construct(vcl::Window* pParent)
}
// create the view
- setView( * new UnoDataBrowserView( pParent, *this, getORB() ) );
+ setView( VclPtr<UnoDataBrowserView>::Create( pParent, *this, getORB() ) );
if (!getBrowserView())
return false;
@@ -1271,8 +1271,8 @@ IMPL_LINK( SbaXDataBrowserController, OnAsyncDisplayError, void*, /* _pNotIntere
{
if ( m_aCurrentError.isValid() )
{
- OSQLMessageBox aDlg( getBrowserView(), m_aCurrentError );
- aDlg.Execute();
+ ScopedVclPtrInstance< OSQLMessageBox > aDlg( getBrowserView(), m_aCurrentError );
+ aDlg->Execute();
}
return 0L;
}
@@ -1764,19 +1764,19 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(bool bFilter)
Reference< XConnection> xCon(xFormSet->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY);
if(bFilter)
{
- DlgFilterCrit aDlg( getBrowserView(), getORB(), xCon, xParser, xSup->getColumns() );
- if ( !aDlg.Execute() )
+ ScopedVclPtrInstance< DlgFilterCrit > aDlg( getBrowserView(), getORB(), xCon, xParser, xSup->getColumns() );
+ if ( !aDlg->Execute() )
return; // if so we don't need to update the grid
- aDlg.BuildWherePart();
+ aDlg->BuildWherePart();
}
else
{
- DlgOrderCrit aDlg( getBrowserView(),xCon,xParser,xSup->getColumns() );
- if(!aDlg.Execute())
+ ScopedVclPtrInstance< DlgOrderCrit > aDlg( getBrowserView(),xCon,xParser,xSup->getColumns() );
+ if(!aDlg->Execute())
{
return; // if so we don't need to actualize the grid
}
- aDlg.BuildOrderPart();
+ aDlg->BuildOrderPart();
}
}
catch(const SQLException& )
@@ -2172,11 +2172,11 @@ bool SbaXDataBrowserController::SaveModified(bool bAskFor)
{
getBrowserView()->getVclControl()->GrabFocus();
- MessageDialog aQry(getBrowserView()->getVclControl(),
- "SaveModifiedDialog",
- "dbaccess/ui/savemodifieddialog.ui");
+ ScopedVclPtrInstance<MessageDialog> aQry( getBrowserView()->getVclControl(),
+ "SaveModifiedDialog",
+ "dbaccess/ui/savemodifieddialog.ui" );
- switch (aQry.Execute())
+ switch (aQry->Execute())
{
case RET_NO:
Execute(ID_BROWSER_UNDORECORD,Sequence<PropertyValue>());
diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx
index f41289e3a797..fe0ad003ab79 100644
--- a/dbaccess/source/ui/browser/brwview.cxx
+++ b/dbaccess/source/ui/browser/brwview.cxx
@@ -106,7 +106,7 @@ void UnoDataBrowserView::Construct(const Reference< ::com::sun::star::awt::XCont
m_pVclControl = NULL;
getVclControl();
- OSL_ENSURE(m_pVclControl != NULL, "UnoDataBrowserView::Construct : no real grid control !");
+ OSL_ENSURE(m_pVclControl != nullptr, "UnoDataBrowserView::Construct : no real grid control !");
}
catch(const Exception&)
{
@@ -117,17 +117,15 @@ void UnoDataBrowserView::Construct(const Reference< ::com::sun::star::awt::XCont
UnoDataBrowserView::~UnoDataBrowserView()
{
- {
- boost::scoped_ptr<Splitter> aTemp(m_pSplitter);
- m_pSplitter = NULL;
- }
+ disposeOnce();
+}
+
+void UnoDataBrowserView::dispose()
+{
+ m_pSplitter.disposeAndClear();
setTreeView(NULL);
- if ( m_pStatus )
- {
- delete m_pStatus;
- m_pStatus = NULL;
- }
+ m_pStatus.disposeAndClear();
try
{
@@ -136,7 +134,9 @@ UnoDataBrowserView::~UnoDataBrowserView()
}
catch(const Exception&)
{}
-
+ m_pTreeView.clear();
+ m_pVclControl.clear();
+ ODataView::dispose();
}
IMPL_LINK( UnoDataBrowserView, SplitHdl, void*, /*NOINTERESTEDIN*/ )
@@ -157,13 +157,9 @@ void UnoDataBrowserView::setSplitter(Splitter* _pSplitter)
void UnoDataBrowserView::setTreeView(DBTreeView* _pTreeView)
{
- if (m_pTreeView != _pTreeView)
+ if (m_pTreeView.get() != _pTreeView)
{
- if (m_pTreeView)
- {
- boost::scoped_ptr<vcl::Window> aTemp(m_pTreeView);
- m_pTreeView = NULL;
- }
+ m_pTreeView.disposeAndClear();
m_pTreeView = _pTreeView;
}
}
@@ -175,7 +171,7 @@ void UnoDataBrowserView::showStatus( const OUString& _rStatus )
else
{
if (!m_pStatus)
- m_pStatus = new FixedText(this);
+ m_pStatus = VclPtr<FixedText>::Create(this);
m_pStatus->SetText(_rStatus);
m_pStatus->Show();
Resize();
@@ -268,7 +264,7 @@ SbaGridControl* UnoDataBrowserView::getVclControl() const
UnoDataBrowserView* pTHIS = const_cast<UnoDataBrowserView*>(this);
if ( pPeer )
{
- m_pVclControl = static_cast<SbaGridControl*>(pPeer->GetWindow());
+ m_pVclControl = static_cast<SbaGridControl*>(pPeer->GetWindow().get());
pTHIS->startComponentListening(Reference<XComponent>(VCLUnoHelper::GetInterface(m_pVclControl),UNO_QUERY));
}
}
diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx
index dc27afe956a3..fd7451f34891 100644
--- a/dbaccess/source/ui/browser/dataview.cxx
+++ b/dbaccess/source/ui/browser/dataview.cxx
@@ -42,7 +42,7 @@ namespace dbaui
class ColorChanger
{
protected:
- OutputDevice* m_pDev;
+ VclPtr<OutputDevice> m_pDev;
public:
ColorChanger( OutputDevice* _pDev, const ::Color& _rNewLineColor, const ::Color& _rNewFillColor )
@@ -65,12 +65,11 @@ namespace dbaui
WinBits nStyle)
:Window(pParent,nStyle)
,m_xContext(_rxContext)
- ,m_rController( _rController )
- ,m_aSeparator( this )
+ ,m_xController( &_rController )
+ ,m_aSeparator( VclPtr<FixedLine>::Create(this) )
{
- m_rController.acquire();
m_pAccel.reset(::svt::AcceleratorExecute::createAcceleratorHelper());
- m_aSeparator.Show();
+ m_aSeparator->Show();
}
void ODataView::Construct()
@@ -79,8 +78,15 @@ namespace dbaui
ODataView::~ODataView()
{
+ disposeOnce();
+ }
- m_rController.release();
+ void ODataView::dispose()
+ {
+ m_xController.clear();
+ m_aSeparator.disposeAndClear();
+ m_pAccel.reset();
+ vcl::Window::dispose();
}
void ODataView::resizeDocumentView( Rectangle& /*_rPlayground*/ )
@@ -105,7 +111,7 @@ namespace dbaui
// position the separator
const Size aSeparatorSize = Size( aPlayground.GetWidth(), 2 );
- m_aSeparator.SetPosSizePixel( aPlayground.TopLeft(), aSeparatorSize );
+ m_aSeparator->SetPosSizePixel( aPlayground.TopLeft(), aSeparatorSize );
aPlayground.Top() += aSeparatorSize.Height() + 1;
// position the controls of the document's view
@@ -134,7 +140,7 @@ namespace dbaui
case MouseNotifyEvent::KEYUP:
case MouseNotifyEvent::MOUSEBUTTONDOWN:
case MouseNotifyEvent::MOUSEBUTTONUP:
- bHandled = m_rController.interceptUserInput( _rNEvt );
+ bHandled = m_xController->interceptUserInput( _rNEvt );
break;
default:
break;
@@ -148,7 +154,7 @@ namespace dbaui
if ( nType == StateChangedType::CONTROLBACKGROUND )
{
// Check if we need to get new images for normal/high contrast mode
- m_rController.notifyHiContrastChanged();
+ m_xController->notifyHiContrastChanged();
}
if ( nType == StateChangedType::INITSHOW )
@@ -157,7 +163,7 @@ namespace dbaui
// model's arguments.
try
{
- Reference< XController > xController( m_rController.getXController(), UNO_SET_THROW );
+ Reference< XController > xController( m_xController->getXController(), UNO_SET_THROW );
Reference< XModel > xModel( xController->getModel(), UNO_QUERY );
if ( xModel.is() )
{
@@ -183,7 +189,7 @@ namespace dbaui
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
{
// Check if we need to get new images for normal/high contrast mode
- m_rController.notifyHiContrastChanged();
+ m_xController->notifyHiContrastChanged();
}
}
void ODataView::attachFrame(const Reference< XFrame >& _xFrame)
diff --git a/dbaccess/source/ui/browser/dbtreeview.cxx b/dbaccess/source/ui/browser/dbtreeview.cxx
index 9dba9af17c20..bc0b44194983 100644
--- a/dbaccess/source/ui/browser/dbtreeview.cxx
+++ b/dbaccess/source/ui/browser/dbtreeview.cxx
@@ -36,7 +36,7 @@ DBTreeView::DBTreeView( vcl::Window* pParent, WinBits nBits)
, m_pTreeListBox(NULL)
{
- m_pTreeListBox = new DBTreeListBox(this, WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
+ m_pTreeListBox = VclPtr<DBTreeListBox>::Create(this, WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
m_pTreeListBox->EnableCheckButton(NULL);
m_pTreeListBox->SetDragDropMode( DragDropMode::NONE );
m_pTreeListBox->EnableInplaceEditing( true );
@@ -46,6 +46,11 @@ DBTreeView::DBTreeView( vcl::Window* pParent, WinBits nBits)
DBTreeView::~DBTreeView()
{
+ disposeOnce();
+}
+
+void DBTreeView::dispose()
+{
if (m_pTreeListBox)
{
if (m_pTreeListBox->GetModel())
@@ -53,9 +58,9 @@ DBTreeView::~DBTreeView()
m_pTreeListBox->GetModel()->RemoveView(m_pTreeListBox);
m_pTreeListBox->DisconnectFromModel();
}
- boost::scoped_ptr<vcl::Window> aTemp(m_pTreeListBox);
- m_pTreeListBox = NULL;
}
+ m_pTreeListBox.disposeAndClear();
+ vcl::Window::dispose();
}
void DBTreeView::SetPreExpandHandler(const Link& _rHdl)
diff --git a/dbaccess/source/ui/browser/dbtreeview.hxx b/dbaccess/source/ui/browser/dbtreeview.hxx
index 99bf4416ce8c..5313583fc061 100644
--- a/dbaccess/source/ui/browser/dbtreeview.hxx
+++ b/dbaccess/source/ui/browser/dbtreeview.hxx
@@ -31,7 +31,7 @@ namespace dbaui
class DBTreeView : public vcl::Window
{
private:
- DBTreeListBox* m_pTreeListBox;
+ VclPtr<DBTreeListBox> m_pTreeListBox;
protected:
// window overridables
virtual void Resize() SAL_OVERRIDE;
@@ -40,6 +40,7 @@ namespace dbaui
DBTreeView( vcl::Window* pParent,
WinBits nBits );
virtual ~DBTreeView();
+ virtual void dispose() SAL_OVERRIDE;
/** sets a handler which is called when an list box entry is to be expanded.
<p>When calling the link, the parameter is an SvTreeListEntry marking the entry to be expanded.
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index c0e6c4686d56..7bf028e18ac1 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -291,7 +291,7 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen
xParent = xFrame->getContainerWindow();
VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(xParent);
- vcl::Window* pParentWin = pParentComponent ? pParentComponent->GetWindow() : NULL;
+ VclPtr< vcl::Window > pParentWin = pParentComponent ? pParentComponent->GetWindow() : VclPtr< vcl::Window >();
if (!pParentWin)
{
throw IllegalArgumentException("Parent window is null", *this, 1 );
@@ -312,7 +312,6 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen
catch(Exception&)
{
// no one clears my view if I won't
- boost::scoped_ptr<vcl::Window> aTemp(m_pView);
m_pView = NULL;
throw;
}
@@ -983,6 +982,16 @@ Reference< XConnection > OGenericUnoController::connect( const OUString& _rDataS
return xConnection;
}
+void OGenericUnoController::setView( const VclPtr<ODataView> &i_rView )
+{
+ m_pView = i_rView;
+}
+
+void OGenericUnoController::clearView()
+{
+ m_pView = NULL;
+}
+
void OGenericUnoController::showError(const SQLExceptionInfo& _rInfo)
{
::dbaui::showError(_rInfo,getView(),getORB());
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 92bf55a2457e..fad16daabc0b 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -309,7 +309,7 @@ void SAL_CALL SbaXGridPeer::dispose() throw( RuntimeException, std::exception )
void SbaXGridPeer::NotifyStatusChanged(const ::com::sun::star::util::URL& _rUrl, const Reference< ::com::sun::star::frame::XStatusListener > & xControl)
{
- SbaGridControl* pGrid = static_cast<SbaGridControl*>(GetWindow());
+ VclPtr< SbaGridControl > pGrid = GetAs< SbaGridControl >();
if (!pGrid)
return;
@@ -361,7 +361,7 @@ Reference< ::com::sun::star::frame::XDispatch > SAL_CALL SbaXGridPeer::queryDis
IMPL_LINK( SbaXGridPeer, OnDispatchEvent, void*, /*NOTINTERESTEDIN*/ )
{
- SbaGridControl* pGrid = static_cast< SbaGridControl* >( GetWindow() );
+ VclPtr< SbaGridControl > pGrid = GetAs< SbaGridControl >();
if ( pGrid ) // if this fails, we were disposing before arriving here
{
if ( Application::GetMainThreadIdentifier() != ::osl::Thread::getCurrentIdentifier() )
@@ -398,7 +398,7 @@ SbaXGridPeer::DispatchType SbaXGridPeer::classifyDispatchURL( const URL& _rURL )
void SAL_CALL SbaXGridPeer::dispatch(const URL& aURL, const Sequence< PropertyValue >& aArgs) throw( RuntimeException, std::exception )
{
- SbaGridControl* pGrid = static_cast<SbaGridControl*>(GetWindow());
+ VclPtr< SbaGridControl > pGrid = GetAs< SbaGridControl >();
if (!pGrid)
return;
@@ -549,9 +549,9 @@ SbaXGridPeer* SbaXGridPeer::getImplementation(const Reference< XInterface >& _rx
return NULL;
}
-FmGridControl* SbaXGridPeer::imp_CreateControl(vcl::Window* pParent, WinBits nStyle)
+VclPtr<FmGridControl> SbaXGridPeer::imp_CreateControl(vcl::Window* pParent, WinBits nStyle)
{
- return new SbaGridControl( m_xContext, pParent, this, nStyle);
+ return VclPtr<SbaGridControl>::Create( m_xContext, pParent, this, nStyle);
}
// SbaGridHeader
@@ -717,13 +717,19 @@ SbaGridControl::SbaGridControl(Reference< XComponentContext > _rM,
SbaGridControl::~SbaGridControl()
{
+ disposeOnce();
+}
+
+void SbaGridControl::dispose()
+{
if (m_nAsyncDropEvent)
Application::RemoveUserEvent(m_nAsyncDropEvent);
+ FmGridControl::dispose();
}
-BrowserHeader* SbaGridControl::imp_CreateHeaderBar(BrowseBox* pParent)
+VclPtr<BrowserHeader> SbaGridControl::imp_CreateHeaderBar(BrowseBox* pParent)
{
- return new SbaGridHeader(pParent);
+ return VclPtr<SbaGridHeader>::Create(pParent);
}
CellController* SbaGridControl::GetController(long nRow, sal_uInt16 nCol)
@@ -786,10 +792,10 @@ void SbaGridControl::SetColWidth(sal_uInt16 nColId)
Any aWidth = xAffectedCol->getPropertyValue(PROPERTY_WIDTH);
sal_Int32 nCurWidth = aWidth.hasValue() ? ::comphelper::getINT32(aWidth) : -1;
- DlgSize aDlgColWidth(this, nCurWidth, false);
- if (aDlgColWidth.Execute())
+ ScopedVclPtrInstance< DlgSize > aDlgColWidth(this, nCurWidth, false);
+ if (aDlgColWidth->Execute())
{
- sal_Int32 nValue = aDlgColWidth.GetValue();
+ sal_Int32 nValue = aDlgColWidth->GetValue();
Any aNewWidth;
if (-1 == nValue)
{ // set to default
@@ -815,10 +821,10 @@ void SbaGridControl::SetRowHeight()
Any aHeight = xCols->getPropertyValue(PROPERTY_ROW_HEIGHT);
sal_Int32 nCurHeight = aHeight.hasValue() ? ::comphelper::getINT32(aHeight) : -1;
- DlgSize aDlgRowHeight(this, nCurHeight, true);
- if (aDlgRowHeight.Execute())
+ ScopedVclPtrInstance< DlgSize > aDlgRowHeight(this, nCurHeight, true);
+ if (aDlgRowHeight->Execute())
{
- sal_Int32 nValue = aDlgRowHeight.GetValue();
+ sal_Int32 nValue = aDlgRowHeight->GetValue();
Any aNewHeight;
if ((sal_Int16)-1 == nValue)
{ // set to default
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index ddc38f897c88..e546a4a7b33e 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -348,11 +348,11 @@ bool SbaTableQueryBrowser::Construct(vcl::Window* pParent)
// create controls and set sizes
const long nFrameWidth = getBrowserView()->LogicToPixel( ::Size( 3, 0 ), MAP_APPFONT ).Width();
- m_pSplitter = new Splitter(getBrowserView(),WB_HSCROLL);
+ m_pSplitter = VclPtr<Splitter>::Create(getBrowserView(),WB_HSCROLL);
m_pSplitter->SetPosSizePixel( ::Point(0,0), ::Size(nFrameWidth,0) );
m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) );
- m_pTreeView = new DBTreeView(getBrowserView(), WB_TABSTOP | WB_BORDER);
+ m_pTreeView = VclPtr<DBTreeView>::Create(getBrowserView(), WB_TABSTOP | WB_BORDER);
m_pTreeView->SetPreExpandHandler(LINK(this, SbaTableQueryBrowser, OnExpandEntry));
m_pTreeView->setCopyHandler(LINK(this, SbaTableQueryBrowser, OnCopyEntry));