summaryrefslogtreecommitdiff
path: root/sc/source/ui/view
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-01-22 14:37:14 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-01-22 19:20:41 -0500
commitdabf147d1d7e892ce07202fbe89a584f0d592a62 (patch)
treef5ed979b52294adfaae4e03b89739f47c9c4f867 /sc/source/ui/view
parentb2f9d1b43e4b14cc48327cdce14a03c826096579 (diff)
Use scoped_ptr for these.
Change-Id: I9452950ad6a101c2b9299dca5ff6e1713cac774c
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r--sc/source/ui/view/formatsh.cxx8
-rw-r--r--sc/source/ui/view/tabvwsh5.cxx18
-rw-r--r--sc/source/ui/view/tabvwsha.cxx18
3 files changed, 19 insertions, 25 deletions
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 3da636d842cf..16412c4e7e3d 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -81,6 +81,8 @@
#include "scabstdlg.hxx"
#include <editeng/fontitem.hxx>
+#include <boost/scoped_ptr.hpp>
+
using namespace ::com::sun::star;
namespace {
@@ -774,8 +776,6 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
{
if ( pStyleSheet )
{
- SvxNumberInfoItem* pNumberInfoItem = NULL;
-
SfxStyleFamily eFam = pStyleSheet->GetFamily();
SfxAbstractTabDialog* pDlg = NULL;
sal_uInt16 nRsc = 0;
@@ -818,7 +818,9 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
}
}
- pTabViewShell->MakeNumberInfoItem( pDoc, GetViewData(), &pNumberInfoItem );
+ boost::scoped_ptr<SvxNumberInfoItem> pNumberInfoItem(
+ pTabViewShell->MakeNumberInfoItem(pDoc, GetViewData()));
+
pDocSh->PutItem( *pNumberInfoItem );
nRsc = RID_SCDLG_STYLES_PAR;
diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx
index c6fcaceeb56b..52a2262ffbed 100644
--- a/sc/source/ui/view/tabvwsh5.cxx
+++ b/sc/source/ui/view/tabvwsh5.cxx
@@ -308,9 +308,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
//------------------------------------------------------------------
-void ScTabViewShell::MakeNumberInfoItem( ScDocument* pDoc,
- ScViewData* pViewData,
- SvxNumberInfoItem** ppItem )
+SvxNumberInfoItem* ScTabViewShell::MakeNumberInfoItem( ScDocument* pDoc, ScViewData* pViewData )
{
//------------------------------
// NumberInfo-Item konstruieren:
@@ -361,26 +359,24 @@ void ScTabViewShell::MakeNumberInfoItem( ScDocument* pDoc,
switch ( eValType )
{
case SVX_VALUE_TYPE_STRING:
- *ppItem = new SvxNumberInfoItem(
+ return new SvxNumberInfoItem(
pDoc->GetFormatTable(),
aCellString,
SID_ATTR_NUMBERFORMAT_INFO );
- break;
case SVX_VALUE_TYPE_NUMBER:
- *ppItem = new SvxNumberInfoItem(
+ return new SvxNumberInfoItem(
pDoc->GetFormatTable(),
nCellValue,
SID_ATTR_NUMBERFORMAT_INFO );
- break;
case SVX_VALUE_TYPE_UNDEFINED:
default:
- *ppItem = new SvxNumberInfoItem(
- pDoc->GetFormatTable(),
- (const sal_uInt16)
- SID_ATTR_NUMBERFORMAT_INFO );
+ ;
}
+
+ return new SvxNumberInfoItem(
+ pDoc->GetFormatTable(), static_cast<const sal_uInt16>(SID_ATTR_NUMBERFORMAT_INFO));
}
//------------------------------------------------------------------
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 09f482bdc695..9c064bdc4ff7 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -464,17 +464,16 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
//------------------------------------------------------------------
void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName)
{
- SfxAbstractTabDialog * pDlg = NULL;
ScDocument* pDoc = GetViewData()->GetDocument();
SvxBoxItem aLineOuter( ATTR_BORDER );
SvxBoxInfoItem aLineInner( ATTR_BORDER_INNER );
- SvxNumberInfoItem* pNumberInfoItem = NULL;
const ScPatternAttr* pOldAttrs = GetSelectionPattern();
- SfxItemSet* pOldSet = new SfxItemSet(
- pOldAttrs->GetItemSet() );
+ boost::scoped_ptr<SfxAbstractTabDialog> pDlg;
+ boost::scoped_ptr<SfxItemSet> pOldSet(new SfxItemSet(pOldAttrs->GetItemSet()));
+ boost::scoped_ptr<SvxNumberInfoItem> pNumberInfoItem;
// Get border items and put them in the set:
GetSelectionFrame( aLineOuter, aLineInner );
@@ -503,7 +502,7 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName
pOldSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT,
pOldAttrs->GetNumberFormat( pDoc->GetFormatTable() ) ) );
- MakeNumberInfoItem( pDoc, GetViewData(), &pNumberInfoItem );
+ pNumberInfoItem.reset(MakeNumberInfoItem(pDoc, GetViewData()));
pOldSet->MergeRange( SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO );
pOldSet->Put(*pNumberInfoItem );
@@ -512,8 +511,8 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
- pDlg = pFact->CreateScAttrDlg(GetViewFrame(), GetDialogParent(), pOldSet);
- OSL_ENSURE(pDlg, "Dialog create fail!");
+ pDlg.reset(pFact->CreateScAttrDlg(GetViewFrame(), GetDialogParent(), pOldSet.get()));
+
if (!rName.isEmpty())
pDlg->SetCurPageId(rName);
short nResult = pDlg->Execute();
@@ -530,13 +529,10 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName
UpdateNumberFormatter((const SvxNumberInfoItem&)*pItem);
}
- ApplyAttributes( pOutSet, pOldSet );
+ ApplyAttributes(pOutSet, pOldSet.get());
rReq.Done( *pOutSet );
}
- delete pOldSet;
- delete pNumberInfoItem;
- delete pDlg;
}
//------------------------------------------------------------------