summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2017-03-18 18:24:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-03-24 06:14:17 +0000
commit7916487cf4d9603cdbe4c7ffbe9bb3f28b51ce4e (patch)
treee3bafe408d8efd97d156521c1ea93d741a5215a8 /sc
parent9ee2d69c610d94280103e089671e9ba78b070e23 (diff)
convert ViewShellId to o3tl::strong_int
Change-Id: I45553d11d56aa8c4432aec126ca51f24bd3ead09 Reviewed-on: https://gerrit.libreoffice.org/35421 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx7
-rw-r--r--sc/source/ui/docshell/docfunc.cxx10
-rw-r--r--sc/source/ui/docshell/docsh4.cxx2
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx2
-rw-r--r--sc/source/ui/inc/undobase.hxx8
-rw-r--r--sc/source/ui/inc/undodraw.hxx4
-rw-r--r--sc/source/ui/undo/undobase.cxx4
-rw-r--r--sc/source/ui/undo/undodraw.cxx2
-rw-r--r--sc/source/ui/view/editsh.cxx2
9 files changed, 23 insertions, 18 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index ac7de0e77f18..3de85d2bc6fc 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -40,6 +40,11 @@
using namespace css;
+std::ostream& operator<<(std::ostream& os, ViewShellId const & id)
+{
+ os << (int)id; return os;
+}
+
namespace
{
@@ -669,7 +674,7 @@ void ScTiledRenderingTest::testUndoShells()
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pUndoManager->GetUndoActionCount());
sal_Int32 nView1 = SfxLokHelper::getView();
// This was -1: ScSimpleUndo did not remember what view shell created it.
- CPPUNIT_ASSERT_EQUAL(nView1, pUndoManager->GetUndoAction()->GetViewShellId());
+ CPPUNIT_ASSERT_EQUAL(ViewShellId(nView1), pUndoManager->GetUndoAction()->GetViewShellId());
comphelper::LibreOfficeKit::setActive(false);
}
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 64e3f2192c23..44e70a454fff 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1807,7 +1807,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
OUString aUndo = ScGlobal::GetRscString( STR_UNDO_INSERTCELLS );
if (bRecord)
{
- int nViewShellId = -1;
+ ViewShellId nViewShellId(-1);
if (pViewSh)
nViewShellId = pViewSh->GetViewShellId();
rDocShell.GetUndoManager()->EnterListAction( aUndo, aUndo, 0, nViewShellId );
@@ -2253,7 +2253,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
OUString aUndo = ScGlobal::GetRscString( STR_UNDO_DELETECELLS );
if (bRecord)
{
- int nViewShellId = -1;
+ ViewShellId nViewShellId(-1);
if (ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell())
nViewShellId = pViewSh->GetViewShellId();
rDocShell.GetUndoManager()->EnterListAction( aUndo, aUndo, 0, nViewShellId );
@@ -5274,7 +5274,7 @@ void ScDocFunc::ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNewEnd
bool bUndo(rDoc.IsUndoEnabled());
if (bUndo)
{
- int nViewShellId = -1;
+ ViewShellId nViewShellId(1);
if (ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell())
nViewShellId = pViewSh->GetViewShellId();
rDocShell.GetUndoManager()->EnterListAction( aUndo, aUndo, 0, nViewShellId );
@@ -5331,7 +5331,7 @@ void ScDocFunc::InsertAreaLink( const OUString& rFile, const OUString& rFilter,
{
// group all remove and the insert action
OUString aUndo = ScGlobal::GetRscString( STR_UNDO_INSERTAREALINK );
- int nViewShellId = -1;
+ ViewShellId nViewShellId(-1);
if (ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell())
nViewShellId = pViewSh->GetViewShellId();
rDocShell.GetUndoManager()->EnterListAction( aUndo, aUndo, 0, nViewShellId );
@@ -5531,7 +5531,7 @@ void ScDocFunc::ConvertFormulaToValue( const ScRange& rRange, bool bInteraction
void ScDocFunc::EnterListAction( sal_uInt16 nNameResId )
{
OUString aUndo( ScGlobal::GetRscString( nNameResId ) );
- int nViewShellId = -1;
+ ViewShellId nViewShellId(-1);
if (ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell())
nViewShellId = pViewSh->GetViewShellId();
rDocShell.GetUndoManager()->EnterListAction( aUndo, aUndo, 0, nViewShellId );
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 1ee2f8bfa646..359872ba776c 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -202,7 +202,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
if (bUndo)
{
OUString aStrImport = ScGlobal::GetRscString( STR_UNDO_IMPORTDATA );
- int nViewShellId = -1;
+ ViewShellId nViewShellId(-1);
if (ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell())
nViewShellId = pViewSh->GetViewShellId();
GetUndoManager()->EnterListAction( aStrImport, aStrImport, 0, nViewShellId );
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index ec6a67a32929..560183b53521 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -625,7 +625,7 @@ static void lcl_RemoveFields( OutlinerView& rOutView )
if (bUpdate)
pOutliner->SetUpdateMode( false );
OUString aName = ScGlobal::GetRscString( STR_UNDO_DELETECONTENTS );
- int nViewShellId = -1;
+ ViewShellId nViewShellId(-1);
if (ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell())
nViewShellId = pViewSh->GetViewShellId();
pOutliner->GetUndoManager().EnterListAction( aName, aName, 0, nViewShellId );
diff --git a/sc/source/ui/inc/undobase.hxx b/sc/source/ui/inc/undobase.hxx
index 24ef2ee758a5..7ca09678f1e9 100644
--- a/sc/source/ui/inc/undobase.hxx
+++ b/sc/source/ui/inc/undobase.hxx
@@ -47,13 +47,13 @@ public:
virtual bool Merge( SfxUndoAction *pNextAction ) override;
/// See SfxUndoAction::GetViewShellId().
- sal_Int32 GetViewShellId() const override;
+ ViewShellId GetViewShellId() const override;
protected:
ScDocShell* pDocShell;
std::unique_ptr<SfxUndoAction>
pDetectiveUndo;
- sal_Int32 mnViewShellId;
+ ViewShellId mnViewShellId;
bool IsPaintLocked() const { return pDocShell->IsPaintLocked(); }
@@ -167,7 +167,7 @@ private:
class ScUndoWrapper: public SfxUndoAction // for manual merging of actions
{
std::unique_ptr<SfxUndoAction> pWrappedUndo;
- sal_Int32 mnViewShellId;
+ ViewShellId mnViewShellId;
public:
ScUndoWrapper( SfxUndoAction* pUndo );
@@ -184,7 +184,7 @@ public:
virtual OUString GetComment() const override;
virtual OUString GetRepeatComment(SfxRepeatTarget&) const override;
/// See SfxUndoAction::GetViewShellId().
- sal_Int32 GetViewShellId() const override;
+ ViewShellId GetViewShellId() const override;
};
#endif
diff --git a/sc/source/ui/inc/undodraw.hxx b/sc/source/ui/inc/undodraw.hxx
index 43cb7766d918..cfe804c24cd9 100644
--- a/sc/source/ui/inc/undodraw.hxx
+++ b/sc/source/ui/inc/undodraw.hxx
@@ -28,7 +28,7 @@ class ScUndoDraw: public SfxUndoAction
{
std::unique_ptr<SfxUndoAction> pDrawUndo;
ScDocShell* pDocShell;
- sal_Int32 mnViewShellId;
+ ViewShellId mnViewShellId;
void UpdateSubShell();
@@ -46,7 +46,7 @@ public:
virtual OUString GetComment() const override;
virtual OUString GetRepeatComment(SfxRepeatTarget&) const override;
/// See SfxUndoAction::GetViewShellId().
- sal_Int32 GetViewShellId() const override;
+ ViewShellId GetViewShellId() const override;
};
#endif
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index b8b0aca430b1..af9849a509a6 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -44,7 +44,7 @@ ScSimpleUndo::ScSimpleUndo( ScDocShell* pDocSh ) :
mnViewShellId = pViewShell->GetViewShellId();
}
-sal_Int32 ScSimpleUndo::GetViewShellId() const
+ViewShellId ScSimpleUndo::GetViewShellId() const
{
return mnViewShellId;
}
@@ -630,7 +630,7 @@ OUString ScUndoWrapper::GetComment() const
return OUString();
}
-sal_Int32 ScUndoWrapper::GetViewShellId() const
+ViewShellId ScUndoWrapper::GetViewShellId() const
{
return mnViewShellId;
}
diff --git a/sc/source/ui/undo/undodraw.cxx b/sc/source/ui/undo/undodraw.cxx
index e779733c2b82..bc7f0a7118ca 100644
--- a/sc/source/ui/undo/undodraw.cxx
+++ b/sc/source/ui/undo/undodraw.cxx
@@ -44,7 +44,7 @@ OUString ScUndoDraw::GetComment() const
return OUString();
}
-sal_Int32 ScUndoDraw::GetViewShellId() const
+ViewShellId ScUndoDraw::GetViewShellId() const
{
return mnViewShellId;
}
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 03a0c6d15b9c..73ff7b3b5082 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -135,7 +135,7 @@ static void lcl_RemoveAttribs( EditView& rEditView )
pEngine->SetUpdateMode(false);
OUString aName = ScGlobal::GetRscString( STR_UNDO_DELETECONTENTS );
- int nViewShellId = -1;
+ ViewShellId nViewShellId(-1);
if (ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell())
nViewShellId = pViewSh->GetViewShellId();
pEngine->GetUndoManager().EnterListAction( aName, aName, 0, nViewShellId );