summaryrefslogtreecommitdiffstats
path: root/dbaccess/source
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/ui/control/sqledit.cxx4
-rw-r--r--dbaccess/source/ui/inc/JoinTableView.hxx2
-rw-r--r--dbaccess/source/ui/inc/singledoccontroller.hxx2
-rw-r--r--dbaccess/source/ui/misc/singledoccontroller.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx9
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx23
-rw-r--r--dbaccess/source/ui/querydesign/QueryTextView.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx20
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx17
9 files changed, 43 insertions, 42 deletions
diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx
index db774978ad60..c94c5335b8df 100644
--- a/dbaccess/source/ui/control/sqledit.cxx
+++ b/dbaccess/source/ui/control/sqledit.cxx
@@ -153,10 +153,10 @@ IMPL_LINK_NOARG(OSqlEdit, OnUndoActionTimer, Timer *, void)
{
OJoinController& rController = m_pView->getContainerWindow()->getDesignView()->getController();
SfxUndoManager& rUndoMgr = rController.GetUndoManager();
- OSqlEditUndoAct* pUndoAct = new OSqlEditUndoAct( this );
+ std::unique_ptr<OSqlEditUndoAct> pUndoAct(new OSqlEditUndoAct( this ));
pUndoAct->SetOriginalText( m_strOrigText );
- rUndoMgr.AddUndoAction( pUndoAct );
+ rUndoMgr.AddUndoAction( std::move(pUndoAct) );
rController.InvalidateFeature(SID_UNDO);
rController.InvalidateFeature(SID_REDO);
diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx b/dbaccess/source/ui/inc/JoinTableView.hxx
index b44aa22d7cab..ffa729812805 100644
--- a/dbaccess/source/ui/inc/JoinTableView.hxx
+++ b/dbaccess/source/ui/inc/JoinTableView.hxx
@@ -318,7 +318,7 @@ namespace dbaui
modified
@param _pAction a possible undo action to add at the controller
*/
- void invalidateAndModify(SfxUndoAction *_pAction);
+ void invalidateAndModify(std::unique_ptr<SfxUndoAction> _pAction);
private:
using Window::Scroll;
diff --git a/dbaccess/source/ui/inc/singledoccontroller.hxx b/dbaccess/source/ui/inc/singledoccontroller.hxx
index 018a69dd01f2..37cc6740063e 100644
--- a/dbaccess/source/ui/inc/singledoccontroller.hxx
+++ b/dbaccess/source/ui/inc/singledoccontroller.hxx
@@ -58,7 +58,7 @@ namespace dbaui
additionally invalidates the UNDO and REDO slot
@param pAction the undo action to add
*/
- void addUndoActionAndInvalidate( SfxUndoAction* pAction );
+ void addUndoActionAndInvalidate( std::unique_ptr<SfxUndoAction> pAction );
// OGenericUnoController
virtual FeatureState GetState( sal_uInt16 nId ) const override;
diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx
index 0a0411bbb891..072a63eece79 100644
--- a/dbaccess/source/ui/misc/singledoccontroller.cxx
+++ b/dbaccess/source/ui/misc/singledoccontroller.cxx
@@ -77,10 +77,10 @@ namespace dbaui
return m_pData->m_xUndoManager->GetSfxUndoManager();
}
- void OSingleDocumentController::addUndoActionAndInvalidate(SfxUndoAction *_pAction)
+ void OSingleDocumentController::addUndoActionAndInvalidate(std::unique_ptr<SfxUndoAction> _pAction)
{
// add undo action
- GetUndoManager().AddUndoAction( _pAction );
+ GetUndoManager().AddUndoAction( std::move(_pAction) );
// when we add an undo action the controller was modified
setModified( true );
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index dda98512cb77..5e46b34afbca 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -42,6 +42,7 @@
#include <UITools.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <tools/diagnose_ex.h>
+#include <o3tl/make_unique.hxx>
#include <algorithm>
#include <functional>
@@ -1065,10 +1066,10 @@ IMPL_LINK_NOARG(OJoinTableView, OnDragScrollTimer, Timer *, void)
ScrollWhileDragging();
}
-void OJoinTableView::invalidateAndModify(SfxUndoAction *_pAction)
+void OJoinTableView::invalidateAndModify(std::unique_ptr<SfxUndoAction> _pAction)
{
Invalidate(InvalidateFlags::NoChildren);
- m_pView->getController().addUndoActionAndInvalidate(_pAction);
+ m_pView->getController().addUndoActionAndInvalidate(std::move(_pAction));
}
void OJoinTableView::TabWinMoved(OTableWindow* ptWhich, const Point& ptOldPosition)
@@ -1076,7 +1077,7 @@ void OJoinTableView::TabWinMoved(OTableWindow* ptWhich, const Point& ptOldPositi
Point ptThumbPos(GetHScrollBar().GetThumbPos(), GetVScrollBar().GetThumbPos());
ptWhich->GetData()->SetPosition(ptWhich->GetPosPixel() + ptThumbPos);
- invalidateAndModify(new OJoinMoveTabWinUndoAct(this, ptOldPosition, ptWhich));
+ invalidateAndModify(o3tl::make_unique<OJoinMoveTabWinUndoAct>(this, ptOldPosition, ptWhich));
}
void OJoinTableView::TabWinSized(OTableWindow* ptWhich, const Point& ptOldPosition, const Size& szOldSize)
@@ -1084,7 +1085,7 @@ void OJoinTableView::TabWinSized(OTableWindow* ptWhich, const Point& ptOldPositi
ptWhich->GetData()->SetSize(ptWhich->GetSizePixel());
ptWhich->GetData()->SetPosition(ptWhich->GetPosPixel());
- invalidateAndModify(new OJoinSizeTabWinUndoAct(this, ptOldPosition, szOldSize, ptWhich));
+ invalidateAndModify(o3tl::make_unique<OJoinSizeTabWinUndoAct>(this, ptOldPosition, szOldSize, ptWhich));
}
bool OJoinTableView::IsAddAllowed()
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 81573f0498a7..2e462c444dac 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -49,6 +49,7 @@
#include <strings.hrc>
#include <strings.hxx>
#include <svtools/treelistentry.hxx>
+#include <o3tl/make_unique.hxx>
using namespace dbaui;
using namespace ::com::sun::star::uno;
@@ -67,13 +68,13 @@ namespace
@param _bOwner is the undo action the owner
*/
void addUndoAction( OQueryTableView const * _pView,
- OQueryTabConnUndoAction* _pUndoAction,
+ std::unique_ptr<OQueryTabConnUndoAction> _pUndoAction,
OQueryTableConnection* _pConnection,
bool _bOwner = false)
{
_pUndoAction->SetOwnership(_bOwner);
_pUndoAction->SetConnection(_pConnection);
- _pView->getDesignView()->getController().addUndoActionAndInvalidate(_pUndoAction);
+ _pView->getDesignView()->getController().addUndoActionAndInvalidate(std::move(_pUndoAction));
}
/** openJoinDialog opens the join dialog with this connection data
@param _pView the view which we use
@@ -110,7 +111,7 @@ namespace
// add an undo action
if ( _bAddUndo )
addUndoAction( _pView,
- new OQueryAddTabConnUndoAction(_pView),
+ o3tl::make_unique<OQueryAddTabConnUndoAction>(_pView),
static_cast< OQueryTableConnection*>(_pConnection));
// redraw
_pConnection->RecalcLines();
@@ -421,16 +422,14 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString&
// No need to initialize, as that happens in ShowTabWin
// New UndoAction
- OQueryTabWinShowUndoAct* pUndoAction = new OQueryTabWinShowUndoAct(this);
+ std::unique_ptr<OQueryTabWinShowUndoAct> pUndoAction(new OQueryTabWinShowUndoAct(this));
pUndoAction->SetTabWin(pNewTabWin); // Window
- bool bSuccess = ShowTabWin(pNewTabWin, pUndoAction,bAppend);
+ bool bSuccess = ShowTabWin(pNewTabWin, pUndoAction.get(), bAppend);
if(!bSuccess)
{
// reset table window
pUndoAction->SetTabWin(nullptr);
pUndoAction->SetOwnership(false);
-
- delete pUndoAction;
return;
}
@@ -531,7 +530,7 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString&
}
// My parent needs to be informed about the delete
- m_pView->getController().addUndoActionAndInvalidate( pUndoAction );
+ m_pView->getController().addUndoActionAndInvalidate( std::move(pUndoAction) );
}
void OQueryTableView::AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest)
@@ -631,7 +630,7 @@ bool OQueryTableView::RemoveConnection(VclPtr<OTableConnection>& rConnection, bo
// add undo action
addUndoAction(this,
- new OQueryDelTabConnUndoAction(this),
+ o3tl::make_unique<OQueryDelTabConnUndoAction>(this),
xConnection.get(),
true);
@@ -688,16 +687,16 @@ void OQueryTableView::RemoveTabWin(OTableWindow* pTabWin)
rUndoMgr.EnterListAction(DBA_RES(STR_QUERY_UNDO_TABWINDELETE) , OUString(), 0, ViewShellId(-1));
// add the Undo-Action
- OQueryTabWinDelUndoAct* pUndoAction = new OQueryTabWinDelUndoAct(this);
+ std::unique_ptr<OQueryTabWinDelUndoAct> pUndoAction(new OQueryTabWinDelUndoAct(this));
pUndoAction->SetTabWin(static_cast< OQueryTableWindow*>(pTabWin));
// and hide the window
- HideTabWin(static_cast< OQueryTableWindow*>(pTabWin), pUndoAction);
+ HideTabWin(static_cast< OQueryTableWindow*>(pTabWin), pUndoAction.get());
// Undo Actions and delete the fields in SelectionBrowseBox
pParent->TableDeleted( static_cast< OQueryTableWindowData*>(pTabWin->GetData().get())->GetAliasName() );
- m_pView->getController().addUndoActionAndInvalidate( pUndoAction );
+ m_pView->getController().addUndoActionAndInvalidate( std::move(pUndoAction) );
rUndoMgr.LeaveListAction();
modified();
diff --git a/dbaccess/source/ui/querydesign/QueryTextView.cxx b/dbaccess/source/ui/querydesign/QueryTextView.cxx
index 1b192ce1dcca..3ff1296c8579 100644
--- a/dbaccess/source/ui/querydesign/QueryTextView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTextView.cxx
@@ -75,10 +75,10 @@ OUString OQueryTextView::getStatement()
void OQueryTextView::clear()
{
- OSqlEditUndoAct* pUndoAct = new OSqlEditUndoAct( m_pEdit );
+ std::unique_ptr<OSqlEditUndoAct> pUndoAct(new OSqlEditUndoAct( m_pEdit ));
pUndoAct->SetOriginalText( m_pEdit->GetText() );
- getContainerWindow()->getDesignView()->getController().addUndoActionAndInvalidate( pUndoAct );
+ getContainerWindow()->getDesignView()->getController().addUndoActionAndInvalidate( std::move(pUndoAct) );
m_pEdit->SetText(OUString());
}
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 178f90991727..37475fb2d01b 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -310,11 +310,11 @@ void OSelectionBrowseBox::ColumnMoved( sal_uInt16 nColId, bool _bCreateUndo )
// create the undo action
if ( !m_bInUndoMode && _bCreateUndo )
{
- OTabFieldMovedUndoAct* pUndoAct = new OTabFieldMovedUndoAct(this);
+ std::unique_ptr<OTabFieldMovedUndoAct> pUndoAct(new OTabFieldMovedUndoAct(this));
pUndoAct->SetColumnPosition( nOldPos + 1);
pUndoAct->SetTabFieldDescr(pOldEntry);
- getDesignView()->getController().addUndoActionAndInvalidate(pUndoAct);
+ getDesignView()->getController().addUndoActionAndInvalidate(std::move(pUndoAct));
}
}
}
@@ -1289,10 +1289,10 @@ void OSelectionBrowseBox::RemoveField(sal_uInt16 nColumnId )
// trigger UndoAction
if ( !m_bInUndoMode )
{
- OTabFieldDelUndoAct* pUndoAction = new OTabFieldDelUndoAct( this );
+ std::unique_ptr<OTabFieldDelUndoAct> pUndoAction(new OTabFieldDelUndoAct( this ));
pUndoAction->SetTabFieldDescr(pDesc);
pUndoAction->SetColumnPosition(nPos);
- rController.addUndoActionAndInvalidate( pUndoAction );
+ rController.addUndoActionAndInvalidate( std::move(pUndoAction) );
}
RemoveColumn(nColumnId);
@@ -1578,10 +1578,10 @@ OTableFieldDescRef OSelectionBrowseBox::InsertField(const OTableFieldDescRef& _r
if ( !m_bInUndoMode )
{
// trigger UndoAction
- OTabFieldCreateUndoAct* pUndoAction = new OTabFieldCreateUndoAct( this );
+ std::unique_ptr<OTabFieldCreateUndoAct> pUndoAction(new OTabFieldCreateUndoAct( this ));
pUndoAction->SetTabFieldDescr( pEntry );
pUndoAction->SetColumnPosition(_nColumnPosition);
- getDesignView()->getController().addUndoActionAndInvalidate( pUndoAction );
+ getDesignView()->getController().addUndoActionAndInvalidate( std::move(pUndoAction) );
}
return pEntry;
@@ -2322,10 +2322,10 @@ void OSelectionBrowseBox::ColumnResized(sal_uInt16 nColId)
if ( !m_bInUndoMode )
{
// create the undo action
- OTabFieldSizedUndoAct* pUndo = new OTabFieldSizedUndoAct(this);
+ std::unique_ptr<OTabFieldSizedUndoAct> pUndo(new OTabFieldSizedUndoAct(this));
pUndo->SetColumnPosition( nPos );
pUndo->SetOriginalWidth(pEntry->GetColWidth());
- getDesignView()->getController().addUndoActionAndInvalidate(pUndo);
+ getDesignView()->getController().addUndoActionAndInvalidate(std::move(pUndo));
}
pEntry->SetColWidth(sal_uInt16(GetColumnWidth(nColId)));
}
@@ -2452,12 +2452,12 @@ void OSelectionBrowseBox::appendUndoAction(const OUString& _rOldValue,const OUSt
{
if ( !m_bInUndoMode && _rNewValue != _rOldValue )
{
- OTabFieldCellModifiedUndoAct* pUndoAct = new OTabFieldCellModifiedUndoAct(this);
+ std::unique_ptr<OTabFieldCellModifiedUndoAct> pUndoAct(new OTabFieldCellModifiedUndoAct(this));
pUndoAct->SetCellIndex(_nRow);
OSL_ENSURE(GetColumnPos(GetCurColumnId()) != BROWSER_INVALIDID,"Current position isn't valid!");
pUndoAct->SetColumnPosition( GetColumnPos(GetCurColumnId()) );
pUndoAct->SetCellContents(_rOldValue);
- getDesignView()->getController().addUndoActionAndInvalidate(pUndoAct);
+ getDesignView()->getController().addUndoActionAndInvalidate(std::move(pUndoAct));
}
}
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 841ab7ba8161..03936e7611f6 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -41,6 +41,7 @@
#include <SqlNameEdit.hxx>
#include <TableRowExchange.hxx>
#include <sot/storage.hxx>
+#include <o3tl/make_unique.hxx>
#include <UITools.hxx>
#include "TableFieldControl.hxx"
#include <dsntypes.hxx>
@@ -507,7 +508,7 @@ void OTableEditorCtrl::SaveData(long nRow, sal_uInt16 nColId)
// If FieldDescr exists, the field is deleted and the old content restored
if (pActFieldDescr)
{
- GetUndoManager().AddUndoAction(new OTableEditorTypeSelUndoAct(this, nRow, FIELD_TYPE, pActFieldDescr->getTypeInfo()));
+ GetUndoManager().AddUndoAction(o3tl::make_unique<OTableEditorTypeSelUndoAct>(this, nRow, FIELD_TYPE, pActFieldDescr->getTypeInfo()));
SwitchType(TOTypeInfoSP());
pActFieldDescr = pActRow->GetActFieldDescr();
}
@@ -658,14 +659,14 @@ void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId )
nInvalidateTypeEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, InvalidateFieldType), nullptr, true );
pActFieldDescr = pActRow->GetActFieldDescr();
pDescrWin->DisplayData( pActFieldDescr );
- GetUndoManager().AddUndoAction( new OTableEditorTypeSelUndoAct(this, nRow, nColId+1, TOTypeInfoSP()) );
+ GetUndoManager().AddUndoAction( o3tl::make_unique<OTableEditorTypeSelUndoAct>(this, nRow, nColId+1, TOTypeInfoSP()) );
}
if( nColId != FIELD_TYPE )
- GetUndoManager().AddUndoAction( new OTableDesignCellUndoAct(this, nRow, nColId) );
+ GetUndoManager().AddUndoAction( o3tl::make_unique<OTableDesignCellUndoAct>(this, nRow, nColId) );
else
{
- GetUndoManager().AddUndoAction(new OTableEditorTypeSelUndoAct(this, GetCurRow(), nColId, GetFieldDescr(GetCurRow())->getTypeInfo()));
+ GetUndoManager().AddUndoAction(o3tl::make_unique<OTableEditorTypeSelUndoAct>(this, GetCurRow(), nColId, GetFieldDescr(GetCurRow())->getTypeInfo()));
resetType();
}
@@ -799,7 +800,7 @@ void OTableEditorCtrl::InsertRows( long nRow )
RowInserted( nRow,vInsertedUndoRedoRows.size() );
// Create the Undo-Action
- GetUndoManager().AddUndoAction( new OTableEditorInsUndoAct(this, nRow,vInsertedUndoRedoRows) );
+ GetUndoManager().AddUndoAction( o3tl::make_unique<OTableEditorInsUndoAct>(this, nRow,vInsertedUndoRedoRows) );
GetView()->getController().setModified( true );
InvalidateFeatures();
}
@@ -808,7 +809,7 @@ void OTableEditorCtrl::DeleteRows()
{
OSL_ENSURE(GetView()->getController().isDropAllowed(),"Call of DeleteRows not valid here. Please check isDropAllowed!");
// Create the Undo-Action
- GetUndoManager().AddUndoAction( new OTableEditorDelUndoAct(this) );
+ GetUndoManager().AddUndoAction( o3tl::make_unique<OTableEditorDelUndoAct>(this) );
// Delete all marked rows
long nIndex = FirstSelectedRow();
@@ -845,7 +846,7 @@ void OTableEditorCtrl::InsertNewRows( long nRow )
long nInsertRows = GetSelectRowCount();
if( !nInsertRows )
nInsertRows = 1;
- GetUndoManager().AddUndoAction( new OTableEditorInsNewUndoAct(this, nRow, nInsertRows) );
+ GetUndoManager().AddUndoAction( o3tl::make_unique<OTableEditorInsNewUndoAct>(this, nRow, nInsertRows) );
// Insert the number of selected rows
for( long i=nRow; i<(nRow+nInsertRows); i++ )
m_pRowList->insert( m_pRowList->begin()+i ,std::make_shared<OTableRow>());
@@ -1525,7 +1526,7 @@ void OTableEditorCtrl::SetPrimaryKey( bool bSet )
}
}
- GetUndoManager().AddUndoAction( new OPrimKeyUndoAct(this, aDeletedPrimKeys, aInsertedPrimKeys) );
+ GetUndoManager().AddUndoAction( o3tl::make_unique<OPrimKeyUndoAct>(this, aDeletedPrimKeys, aInsertedPrimKeys) );
// Invalidate the handle-columns
InvalidateHandleColumn();