summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r--sc/source/ui/docshell/arealink.cxx6
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx20
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx4
-rw-r--r--sc/source/ui/docshell/docfunc.cxx9
-rw-r--r--sc/source/ui/docshell/docsh.cxx36
-rw-r--r--sc/source/ui/docshell/docsh3.cxx22
-rw-r--r--sc/source/ui/docshell/docsh4.cxx60
-rw-r--r--sc/source/ui/docshell/docsh5.cxx16
-rw-r--r--sc/source/ui/docshell/docsh6.cxx4
-rw-r--r--sc/source/ui/docshell/documentlinkmgr.cxx4
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx4
-rw-r--r--sc/source/ui/docshell/impex.cxx8
-rw-r--r--sc/source/ui/docshell/sizedev.cxx2
-rw-r--r--sc/source/ui/docshell/tablink.cxx6
-rw-r--r--sc/source/ui/docshell/tpstat.cxx14
15 files changed, 114 insertions, 101 deletions
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index 663eb89dfaf5..8b3247af4f3b 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -459,9 +459,9 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
//! Link-Dialog muss Default-Parent setzen
// "kann keine Zeilen einfuegen"
- InfoBox aBox( Application::GetDefDialogParent(),
- ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_2 ) );
- aBox.Execute();
+ ScopedVclPtrInstance<InfoBox> aBox( Application::GetDefDialogParent(),
+ ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_2 ) );
+ aBox->Execute();
}
// aufraeumen
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index bb974630a333..d8e63818fb7e 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1269,9 +1269,9 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
// OutRange of pOldObj (pDestObj) is still old area
if (!lcl_EmptyExcept(&rDoc, aNewOut, pOldObj->GetOutRange()))
{
- QueryBox aBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
+ ScopedVclPtrInstance<QueryBox> aBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) );
- if (aBox.Execute() == RET_NO)
+ if (aBox->Execute() == RET_NO)
{
//! like above (not editable)
*pOldObj = aUndoDPObj;
@@ -1421,11 +1421,11 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
if (!bEmpty)
{
- QueryBox aBox(
+ ScopedVclPtrInstance<QueryBox> aBox(
rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY));
- if (aBox.Execute() == RET_NO)
+ if (aBox->Execute() == RET_NO)
{
//! like above (not editable)
return false;
@@ -1495,9 +1495,9 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
{
if (!lcl_EmptyExcept(&rDoc, aNewOut, rDPObj.GetOutRange()))
{
- QueryBox aBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
- ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) );
- if (aBox.Execute() == RET_NO)
+ ScopedVclPtrInstance<QueryBox> aBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
+ ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) );
+ if (aBox->Execute() == RET_NO)
{
rDPObj = aUndoDPObj;
return false;
@@ -1593,9 +1593,9 @@ void ScDBDocFunc::UpdateImport( const OUString& rTarget, const svx::ODataAccessD
const ScDBData* pData = rDBColl.getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(rTarget));
if (!pData)
{
- InfoBox aInfoBox(rDocShell.GetActiveDialogParent(),
- ScGlobal::GetRscString( STR_TARGETNOTFOUND ) );
- aInfoBox.Execute();
+ ScopedVclPtrInstance<InfoBox> aInfoBox( rDocShell.GetActiveDialogParent(),
+ ScGlobal::GetRscString( STR_TARGETNOTFOUND ) );
+ aInfoBox->Execute();
return;
}
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 6c0b23772d5a..df197e37db44 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -635,8 +635,8 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
nErrStringId = STR_MSSG_IMPORTDATA_0;
aErrorMessage = ScGlobal::GetRscString( nErrStringId );
}
- InfoBox aInfoBox( rDocShell.GetActiveDialogParent(), aErrorMessage );
- aInfoBox.Execute();
+ ScopedVclPtrInstance< InfoBox > aInfoBox( rDocShell.GetActiveDialogParent(), aErrorMessage );
+ aInfoBox->Execute();
}
delete pImportDoc;
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 753fd6de8735..305ab149d229 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -2764,7 +2764,6 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
if ( !bIncludeFiltered && pClipDoc->HasClipFilteredRows() )
UnmergeCells( aPasteDest, false );
- VirtualDevice aVirtDev;
bool bDestHeight = AdjustRowHeight(
ScRange( 0,nDestRow,nDestTab, MAXCOL,nDestEndRow,nDestEndTab ),
false );
@@ -3757,8 +3756,8 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi )
{
if (!bApi)
{
- InfoBox aBox( rDocShell.GetActiveDialogParent(), OUString( ScResId( SCSTR_WRONGPASSWORD ) ) );
- aBox.Execute();
+ ScopedVclPtrInstance< InfoBox > aBox( rDocShell.GetActiveDialogParent(), OUString( ScResId( SCSTR_WRONGPASSWORD ) ) );
+ aBox->Execute();
}
return false;
}
@@ -3787,8 +3786,8 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi )
{
if (!bApi)
{
- InfoBox aBox( rDocShell.GetActiveDialogParent(), OUString( ScResId( SCSTR_WRONGPASSWORD ) ) );
- aBox.Execute();
+ ScopedVclPtrInstance< InfoBox > aBox( rDocShell.GetActiveDialogParent(), OUString( ScResId( SCSTR_WRONGPASSWORD ) ) );
+ aBox->Execute();
}
return false;
}
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index a422041945e6..ad3b6bffee8f 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -472,14 +472,14 @@ bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::uno::R
{
// Generator is not LibreOffice. Ask if the user wants to perform
// full re-calculation.
- QueryBox aBox(
+ ScopedVclPtrInstance<QueryBox> aBox(
GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS));
- aBox.SetCheckBoxText(ScGlobal::GetRscString(STR_ALWAYS_PERFORM_SELECTED));
+ aBox->SetCheckBoxText(ScGlobal::GetRscString(STR_ALWAYS_PERFORM_SELECTED));
- bHardRecalc = aBox.Execute() == RET_YES;
+ bHardRecalc = aBox->Execute() == RET_YES;
- if (aBox.GetCheckBoxState())
+ if (aBox->GetCheckBoxState())
{
// Always perform selected action in the future.
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
@@ -689,11 +689,11 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
ScAppOptions aAppOptions = SC_MOD()->GetAppOptions();
if ( aAppOptions.GetShowSharedDocumentWarning() )
{
- WarningBox aBox( GetActiveDialogParent(), WinBits( WB_OK ),
+ ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(), WinBits( WB_OK ),
ScGlobal::GetRscString( STR_SHARED_DOC_WARNING ) );
- aBox.SetDefaultCheckBoxText();
- aBox.Execute();
- bool bChecked = aBox.GetCheckBoxState();
+ aBox->SetDefaultCheckBoxText();
+ aBox->Execute();
+ bool bChecked = aBox->GetCheckBoxState();
if ( bChecked )
{
aAppOptions.SetShowSharedDocumentWarning( !bChecked );
@@ -818,8 +818,8 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
OUString aMessage( ScGlobal::GetRscString( STR_FILE_LOCKED_SAVE_LATER ) );
aMessage = aMessage.replaceFirst( "%1", aUserName );
- WarningBox aBox( GetActiveDialogParent(), WinBits( WB_RETRY_CANCEL | WB_DEF_RETRY ), aMessage );
- if ( aBox.Execute() == RET_RETRY )
+ ScopedVclPtrInstance< WarningBox > aBox( GetActiveDialogParent(), WinBits( WB_RETRY_CANCEL | WB_DEF_RETRY ), aMessage );
+ if ( aBox->Execute() == RET_RETRY )
{
bRetry = true;
}
@@ -893,9 +893,9 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
}
else
{
- WarningBox aBox( GetActiveDialogParent(), WinBits( WB_OK ),
+ ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(), WinBits( WB_OK ),
ScGlobal::GetRscString( STR_DOC_NOLONGERSHARED ) );
- aBox.Execute();
+ aBox->Execute();
SfxBindings* pBindings = GetViewBindings();
if ( pBindings )
@@ -934,10 +934,10 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
if ( GetDocument().GetExternalRefManager()->containsUnsavedReferences() )
{
- WarningBox aBox( GetActiveDialogParent(), WinBits( WB_YES_NO ),
+ ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(), WinBits( WB_YES_NO ),
ScGlobal::GetRscString( STR_UNSAVED_EXT_REF ) );
- if( RET_NO == aBox.Execute())
+ if( RET_NO == aBox->Execute())
{
SetError( ERRCODE_IO_ABORT, OUString( OSL_LOG_PREFIX ) ); // this error code will produce no error message, but will break the further saving process
}
@@ -1454,7 +1454,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
Fraction aZoom( 1, 1 );
double nPPTX = ScGlobal::nScreenPPTX * (double) aZoom / GetOutputFactor(); // Factor is printer display ratio
double nPPTY = ScGlobal::nScreenPPTY * (double) aZoom;
- VirtualDevice aVirtDev;
+ ScopedVclPtrInstance< VirtualDevice > pVirtDev;
// all sheets (for Excel import)
SCTAB nTabCount = aDocument.GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
@@ -1477,7 +1477,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
aColWidthParam[nCol].mbSimpleText = false;
sal_uInt16 nWidth = aDocument.GetOptimalColWidth(
- nCol, nTab, &aVirtDev, nPPTX, nPPTY, aZoom, aZoom, false, &aMark,
+ nCol, nTab, pVirtDev, nPPTX, nPPTY, aZoom, aZoom, false, &aMark,
&aColWidthParam[nCol] );
aDocument.SetColWidth( nCol, nTab,
nWidth + (sal_uInt16)ScGlobal::nLastColWidthExtra );
@@ -2880,10 +2880,10 @@ void ScDocShell::GetDocStat( ScDocStat& rDocStat )
(sal_uInt16) ScPrintFunc( this, pPrinter, i ).GetTotalPages() );
}
-SfxDocumentInfoDialog* ScDocShell::CreateDocumentInfoDialog(
+VclPtr<SfxDocumentInfoDialog> ScDocShell::CreateDocumentInfoDialog(
vcl::Window *pParent, const SfxItemSet &rSet )
{
- SfxDocumentInfoDialog* pDlg = new SfxDocumentInfoDialog( pParent, rSet );
+ VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create( pParent, rSet );
ScDocShell* pDocSh = PTR_CAST(ScDocShell,SfxObjectShell::Current());
// Only for statistics, if this Doc is shown; not from the Doc Manager
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 66c3a8608338..b97bf8675e89 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -368,11 +368,11 @@ void ScDocShell::CalcOutputFactor()
pRefDev->SetFont(aOldFont);
pRefDev->SetMapMode(aOldMode);
- VirtualDevice aVirtWindow( *Application::GetDefaultDevice() );
- aVirtWindow.SetMapMode(MAP_PIXEL);
- pPattern->GetFont(aDefFont, SC_AUTOCOL_BLACK, &aVirtWindow); // font color doesn't matter here
- aVirtWindow.SetFont(aDefFont);
- nWindowWidth = aVirtWindow.GetTextWidth(aTestString);
+ ScopedVclPtrInstance< VirtualDevice > pVirtWindow( *Application::GetDefaultDevice() );
+ pVirtWindow->SetMapMode(MAP_PIXEL);
+ pPattern->GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow); // font color doesn't matter here
+ pVirtWindow->SetFont(aDefFont);
+ nWindowWidth = pVirtWindow->GetTextWidth(aTestString);
nWindowWidth = (long) ( nWindowWidth / ScGlobal::nScreenPPTX * HMM_PER_TWIPS );
if (nPrinterWidth && nWindowWidth)
@@ -1202,12 +1202,12 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell )
while ( bLoop )
{
bLoop = false;
- ScConflictsDlg aDlg( GetActiveDialogParent(), GetViewData(), &rSharedDoc, aConflictsList );
- if ( aDlg.Execute() == RET_CANCEL )
+ ScopedVclPtrInstance< ScConflictsDlg > aDlg( GetActiveDialogParent(), GetViewData(), &rSharedDoc, aConflictsList );
+ if ( aDlg->Execute() == RET_CANCEL )
{
- QueryBox aBox( GetActiveDialogParent(), WinBits( WB_YES_NO | WB_DEF_YES ),
+ ScopedVclPtrInstance<QueryBox> aBox( GetActiveDialogParent(), WinBits( WB_YES_NO | WB_DEF_YES ),
ScGlobal::GetRscString( STR_DOC_WILLNOTBESAVED ) );
- if ( aBox.Execute() == RET_YES )
+ if ( aBox->Execute() == RET_YES )
{
return false;
}
@@ -1320,8 +1320,8 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell )
PostPaintExtras();
PostPaintGridAll();
- InfoBox aInfoBox( GetActiveDialogParent(), ScGlobal::GetRscString( STR_DOC_UPDATED ) );
- aInfoBox.Execute();
+ ScopedVclPtrInstance< InfoBox > aInfoBox( GetActiveDialogParent(), ScGlobal::GetRscString( STR_DOC_UPDATED ) );
+ aInfoBox->Execute();
}
return ( pThisAction != NULL );
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 8e400290014e..515ed542a921 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -222,8 +222,8 @@ void ScDocShell::Execute( SfxRequest& rReq )
aMessage += sTarget;
aMessage += aTemplate.getToken( 1, '#' );
- QueryBox aBox( 0, WinBits(WB_YES_NO | WB_DEF_YES), aMessage );
- bDo = ( aBox.Execute() == RET_YES );
+ ScopedVclPtrInstance< QueryBox > aBox( nullptr, WinBits(WB_YES_NO | WB_DEF_YES), aMessage );
+ bDo = ( aBox->Execute() == RET_YES );
}
if (bDo)
@@ -427,10 +427,10 @@ void ScDocShell::Execute( SfxRequest& rReq )
if(nSet==LM_ON_DEMAND)
{
- QueryBox aBox( GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
+ ScopedVclPtrInstance<QueryBox> aBox( GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
ScGlobal::GetRscString(STR_RELOAD_TABLES) );
- nDlgRet=aBox.Execute();
+ nDlgRet=aBox->Execute();
}
if (nDlgRet == RET_YES || nSet==LM_ALWAYS)
@@ -476,9 +476,9 @@ void ScDocShell::Execute( SfxRequest& rReq )
OSL_ENSURE(pViewSh,"SID_REIMPORT_AFTER_LOAD: keine View");
if (pViewSh && pDBColl)
{
- QueryBox aBox( GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
+ ScopedVclPtrInstance<QueryBox> aBox( GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
ScGlobal::GetRscString(STR_REIMPORT_AFTER_LOAD) );
- if (aBox.Execute() == RET_YES)
+ if (aBox->Execute() == RET_YES)
{
ScDBCollection::NamedDBs& rDBs = pDBColl->getNamedDBs();
ScDBCollection::NamedDBs::iterator itr = rDBs.begin(), itrEnd = rDBs.end();
@@ -575,10 +575,10 @@ void ScDocShell::Execute( SfxRequest& rReq )
if ( !pItem )
{
// no dialog on playing the macro
- WarningBox aBox( pParent ? pParent : GetActiveDialogParent(),
+ ScopedVclPtrInstance<WarningBox> aBox( pParent ? pParent : GetActiveDialogParent(),
WinBits(WB_YES_NO | WB_DEF_NO),
ScGlobal::GetRscString( STR_END_REDLINING ) );
- bDo = ( aBox.Execute() == RET_YES );
+ bDo = ( aBox->Execute() == RET_YES );
}
if ( bDo )
@@ -644,10 +644,10 @@ void ScDocShell::Execute( SfxRequest& rReq )
{
if ( nSlot == SID_DOCUMENT_COMPARE )
{ //! old changes trace will be lost
- WarningBox aBox( GetActiveDialogParent(),
+ ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(),
WinBits(WB_YES_NO | WB_DEF_NO),
ScGlobal::GetRscString( STR_END_REDLINING ) );
- if( aBox.Execute() == RET_YES )
+ if( aBox->Execute() == RET_YES )
bDo = ExecuteChangeProtectionDialog( NULL, true );
else
bDo = false;
@@ -913,10 +913,10 @@ void ScDocShell::Execute( SfxRequest& rReq )
break;
}
- ScShareDocumentDlg aDlg( GetActiveDialogParent(), pViewData );
- if ( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< ScShareDocumentDlg > aDlg( GetActiveDialogParent(), pViewData );
+ if ( aDlg->Execute() == RET_OK )
{
- bool bSetShared = aDlg.IsShareDocumentChecked();
+ bool bSetShared = aDlg->IsShareDocumentChecked();
if ( bSetShared != static_cast< bool >( IsDocShared() ) )
{
if ( bSetShared )
@@ -924,9 +924,11 @@ void ScDocShell::Execute( SfxRequest& rReq )
bool bContinue = true;
if ( HasName() )
{
- QueryBox aBox( GetActiveDialogParent(), WinBits( WB_YES_NO | WB_DEF_YES ),
+ ScopedVclPtrInstance<QueryBox> aBox(
+ GetActiveDialogParent(),
+ WinBits( WB_YES_NO | WB_DEF_YES ),
ScGlobal::GetRscString( STR_DOC_WILLBESAVED ) );
- if ( aBox.Execute() == RET_NO )
+ if ( aBox->Execute() == RET_NO )
{
bContinue = false;
}
@@ -1013,14 +1015,16 @@ void ScDocShell::Execute( SfxRequest& rReq )
OUString aMessage( ScGlobal::GetRscString( STR_FILE_LOCKED_TRY_LATER ) );
aMessage = aMessage.replaceFirst( "%1", aUserName );
- WarningBox aBox( GetActiveDialogParent(), WinBits( WB_OK ), aMessage );
- aBox.Execute();
+ ScopedVclPtrInstance< WarningBox > aBox( GetActiveDialogParent(), WinBits( WB_OK ), aMessage );
+ aBox->Execute();
}
else
{
- WarningBox aBox( GetActiveDialogParent(), WinBits( WB_YES_NO | WB_DEF_YES ),
+ ScopedVclPtrInstance<WarningBox> aBox(
+ GetActiveDialogParent(),
+ WinBits( WB_YES_NO | WB_DEF_YES ),
ScGlobal::GetRscString( STR_DOC_DISABLESHARED ) );
- if ( aBox.Execute() == RET_YES )
+ if ( aBox->Execute() == RET_YES )
{
xCloseable->close( sal_True );
@@ -1052,9 +1056,9 @@ void ScDocShell::Execute( SfxRequest& rReq )
else
{
xCloseable->close( sal_True );
- WarningBox aBox( GetActiveDialogParent(), WinBits( WB_OK ),
+ ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(), WinBits( WB_OK ),
ScGlobal::GetRscString( STR_DOC_NOLONGERSHARED ) );
- aBox.Execute();
+ aBox->Execute();
}
}
catch ( uno::Exception& )
@@ -1127,8 +1131,8 @@ bool ScDocShell::ExecuteChangeProtectionDialog( vcl::Window* _pParent, bool bJus
OUString aText( ScResId( SCSTR_PASSWORD ) );
OUString aPassword;
- boost::scoped_ptr<SfxPasswordDialog> pDlg(new SfxPasswordDialog(
- _pParent ? _pParent : GetActiveDialogParent(), &aText ));
+ ScopedVclPtrInstance<SfxPasswordDialog> pDlg(
+ _pParent ? _pParent : GetActiveDialogParent(), &aText );
pDlg->SetText( aTitle );
pDlg->SetMinLen( 1 );
pDlg->SetHelpId( GetStaticInterface()->GetSlot(SID_CHG_PROTECT)->GetCommand() );
@@ -1153,9 +1157,9 @@ bool ScDocShell::ExecuteChangeProtectionDialog( vcl::Window* _pParent, bool bJus
}
else
{
- InfoBox aBox( GetActiveDialogParent(),
+ ScopedVclPtrInstance<InfoBox> aBox( GetActiveDialogParent(),
OUString( ScResId( SCSTR_WRONGPASSWORD ) ) );
- aBox.Execute();
+ aBox->Execute();
}
}
else
@@ -1483,9 +1487,9 @@ void ScDocShell::PageStyleModified( const OUString& rStyleName, bool bApi )
if (bWarn && !bApi)
{
ScWaitCursorOff aWaitOff( GetActiveDialogParent() );
- InfoBox aInfoBox(GetActiveDialogParent(),
- ScGlobal::GetRscString(STR_PRINT_INVALID_AREA));
- aInfoBox.Execute();
+ ScopedVclPtrInstance<InfoBox> aInfoBox(GetActiveDialogParent(),
+ ScGlobal::GetRscString(STR_PRINT_INVALID_AREA));
+ aInfoBox->Execute();
}
}
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 79167bcaa71d..f95815389e66 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -81,8 +81,8 @@ void ScDocShell::ErrorMessage( sal_uInt16 nGlobStrId )
}
}
- InfoBox aBox( pParent, ScGlobal::GetRscString( nGlobStrId ) );
- aBox.Execute();
+ ScopedVclPtrInstance< InfoBox > aBox( pParent, ScGlobal::GetRscString( nGlobStrId ) );
+ aBox->Execute();
if (bFocus)
pParent->GrabFocus();
}
@@ -487,9 +487,9 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
if (bErr)
{
- InfoBox aBox( GetActiveDialogParent(),
+ ScopedVclPtrInstance<InfoBox> aBox( GetActiveDialogParent(),
ScGlobal::GetRscString( STR_CONSOLIDATE_ERR1 ) );
- aBox.Execute();
+ aBox->Execute();
return;
}
@@ -697,16 +697,16 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord )
}
else
{
- InfoBox aBox(GetActiveDialogParent(),
+ ScopedVclPtrInstance<InfoBox> aBox( GetActiveDialogParent(),
ScGlobal::GetRscString( STR_PROTECTIONERR ) );
- aBox.Execute();
+ aBox->Execute();
}
}
else
{
- InfoBox aBox(GetActiveDialogParent(),
+ ScopedVclPtrInstance<InfoBox> aBox(GetActiveDialogParent(),
ScGlobal::GetRscString( STR_SCENARIO_NOTFOUND ) );
- aBox.Execute();
+ aBox->Execute();
}
}
else
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index 3918dbc929df..6d320959f46e 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -531,8 +531,8 @@ void ScDocShell::CheckConfigOptions()
if (pViewShell)
{
vcl::Window* pParent = pViewShell->GetFrameWin();
- InfoBox aBox(pParent, ScGlobal::GetRscString(STR_OPTIONS_WARN_SEPARATORS));
- aBox.Execute();
+ ScopedVclPtrInstance< InfoBox > aBox(pParent, ScGlobal::GetRscString(STR_OPTIONS_WARN_SEPARATORS));
+ aBox->Execute();
}
// For now, this is the only option setting that could launch info
diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx
index 7da7c3855d8c..42745eb3f344 100644
--- a/sc/source/ui/docshell/documentlinkmgr.cxx
+++ b/sc/source/ui/docshell/documentlinkmgr.cxx
@@ -165,8 +165,8 @@ bool DocumentLinkManager::updateDdeLinks( vcl::Window* pWin )
aBuf.append(aElem);
aBuf.appendAscii("\nType : ");
aBuf.append(aType);
- MessageDialog aBox(pWin, aBuf.makeStringAndClear());
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(pWin, aBuf.makeStringAndClear());
+ aBox->Execute();
}
}
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index e99e9e017e94..ddea5130c995 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -3020,9 +3020,9 @@ void ScExternalRefManager::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
SfxObjectShell* pObjShell = static_cast<const SfxEventHint&>( rHint ).GetObjShell();
ScDocShell* pDocShell = static_cast< ScDocShell* >( pObjShell );
- WarningBox aBox( pDocShell->GetActiveDialogParent(), WinBits( WB_OK ),
+ ScopedVclPtrInstance<WarningBox> aBox( pDocShell->GetActiveDialogParent(), WinBits( WB_OK ),
ScGlobal::GetRscString( STR_CLOSE_WITH_UNSAVED_REFS ) );
- aBox.Execute();
+ aBox->Execute();
}
break;
case SFX_EVENT_SAVEDOCDONE:
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 806c1b4d7c01..e11b6be89f79 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -210,9 +210,9 @@ bool ScImportExport::StartPaste()
ScEditableTester aTester( pDoc, aRange );
if ( !aTester.IsEditable() )
{
- InfoBox aInfoBox(Application::GetDefDialogParent(),
+ ScopedVclPtrInstance<InfoBox> aInfoBox( Application::GetDefDialogParent(),
ScGlobal::GetRscString( aTester.GetMessageId() ) );
- aInfoBox.Execute();
+ aInfoBox->Execute();
return false;
}
}
@@ -1452,8 +1452,8 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
if ( !mbApi && nStartCol != nEndCol &&
!pDoc->IsBlockEmpty( nTab, nStartCol + 1, nStartRow, nEndCol, nRow ) )
{
- ScReplaceWarnBox aBox( pDocSh->GetActiveDialogParent() );
- if ( aBox.Execute() != RET_YES )
+ ScopedVclPtrInstance< ScReplaceWarnBox > aBox( pDocSh->GetActiveDialogParent() );
+ if ( aBox->Execute() != RET_YES )
{
return false;
}
diff --git a/sc/source/ui/docshell/sizedev.cxx b/sc/source/ui/docshell/sizedev.cxx
index e0ff33c205c1..744266efe4f5 100644
--- a/sc/source/ui/docshell/sizedev.cxx
+++ b/sc/source/ui/docshell/sizedev.cxx
@@ -55,7 +55,7 @@ ScSizeDeviceProvider::ScSizeDeviceProvider( ScDocShell* pDocSh )
ScSizeDeviceProvider::~ScSizeDeviceProvider()
{
if (bOwner)
- delete pDevice;
+ pDevice.disposeAndClear();
else
pDevice->SetMapMode( aOldMapMode );
}
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 65df85b18ff9..6c8edb9ecbb5 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -47,9 +47,9 @@
struct TableLink_Impl
{
- ScDocShell* m_pDocSh;
- vcl::Window* m_pOldParent;
- Link m_aEndEditLink;
+ ScDocShell* m_pDocSh;
+ VclPtr<vcl::Window> m_pOldParent;
+ Link m_aEndEditLink;
TableLink_Impl() : m_pDocSh( NULL ), m_pOldParent( NULL ) {}
};
diff --git a/sc/source/ui/docshell/tpstat.cxx b/sc/source/ui/docshell/tpstat.cxx
index 7895be53451e..7aca08e43042 100644
--- a/sc/source/ui/docshell/tpstat.cxx
+++ b/sc/source/ui/docshell/tpstat.cxx
@@ -27,9 +27,9 @@
// Dokumentinfo-Tabpage:
-SfxTabPage* ScDocStatPage::Create( vcl::Window *pParent, const SfxItemSet* rSet )
+VclPtr<SfxTabPage> ScDocStatPage::Create( vcl::Window *pParent, const SfxItemSet* rSet )
{
- return new ScDocStatPage( pParent, *rSet );
+ return VclPtr<SfxTabPage>( new ScDocStatPage ( pParent, *rSet ), SAL_NO_ACQUIRE );
}
ScDocStatPage::ScDocStatPage( vcl::Window *pParent, const SfxItemSet& rSet )
@@ -56,8 +56,18 @@ ScDocStatPage::ScDocStatPage( vcl::Window *pParent, const SfxItemSet& rSet )
ScDocStatPage::~ScDocStatPage()
{
+ disposeOnce();
}
+void ScDocStatPage::dispose()
+{
+ m_pFtTables.clear();
+ m_pFtCells.clear();
+ m_pFtPages.clear();
+ SfxTabPage::dispose();
+}
+
+
bool ScDocStatPage::FillItemSet( SfxItemSet* /* rSet */ )
{
return false;