summaryrefslogtreecommitdiff
path: root/sd
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 /sd
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 'sd')
-rw-r--r--sd/inc/sdundo.hxx4
-rw-r--r--sd/inc/undo/undomanager.hxx2
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx9
-rw-r--r--sd/source/core/drawdoc3.cxx4
-rw-r--r--sd/source/core/undo/undomanager.cxx6
-rw-r--r--sd/source/core/undo/undoobjects.cxx2
-rw-r--r--sd/source/ui/func/fubullet.cxx2
-rw-r--r--sd/source/ui/func/fuinsfil.cxx2
-rw-r--r--sd/source/ui/view/drawview.cxx2
9 files changed, 19 insertions, 14 deletions
diff --git a/sd/inc/sdundo.hxx b/sd/inc/sdundo.hxx
index 159c1f11ddae..d2959cf9a159 100644
--- a/sd/inc/sdundo.hxx
+++ b/sd/inc/sdundo.hxx
@@ -34,11 +34,11 @@ public:
virtual OUString GetComment() const override { return maComment; }
virtual SdUndoAction* Clone() const { return nullptr; }
/// See SfxUndoAction::GetViewShellId().
- sal_Int32 GetViewShellId() const override;
+ ViewShellId GetViewShellId() const override;
protected:
SdDrawDocument* mpDoc;
- sal_Int32 mnViewShellId;
+ ViewShellId mnViewShellId;
private:
OUString maComment;
};
diff --git a/sd/inc/undo/undomanager.hxx b/sd/inc/undo/undomanager.hxx
index 2b1ed48a4abc..c053e9b8cabb 100644
--- a/sd/inc/undo/undomanager.hxx
+++ b/sd/inc/undo/undomanager.hxx
@@ -34,7 +34,7 @@ class SD_DLLPUBLIC UndoManager : public SdrUndoManager
public:
UndoManager();
- virtual void EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, sal_Int32 nViewShellId) override;
+ virtual void EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId) override;
virtual void AddUndoAction( SfxUndoAction *pAction, bool bTryMerg=false ) override;
size_t GetUndoActionCount(const bool bCurrentLevel = true) const override;
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 58e146acdf60..4e99d3498006 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -52,6 +52,11 @@ using namespace css;
static const char* const DATA_DIRECTORY = "/sd/qa/unit/tiledrendering/data/";
+static std::ostream& operator<<(std::ostream& os, ViewShellId id)
+{
+ os << (int)id; return os;
+}
+
class SdTiledRenderingTest : public SdModelTestBase, public XmlTestTools
{
public:
@@ -460,7 +465,7 @@ void SdTiledRenderingTest::testSetGraphicSelection()
CPPUNIT_ASSERT(pListAction);
for (size_t i = 0; i < pListAction->aUndoActions.size(); ++i)
// The second item was -1 here, view shell ID wasn't known.
- CPPUNIT_ASSERT_EQUAL(nView1, pListAction->aUndoActions.GetUndoAction(i)->GetViewShellId());
+ CPPUNIT_ASSERT_EQUAL(ViewShellId(nView1), pListAction->aUndoActions.GetUndoAction(i)->GetViewShellId());
Rectangle aShapeAfter = pObject->GetSnapRect();
// Check that a resize happened, but aspect ratio is not kept.
@@ -486,7 +491,7 @@ void SdTiledRenderingTest::testUndoShells()
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pUndoManager->GetUndoActionCount());
sal_Int32 nView1 = SfxLokHelper::getView();
// This was -1, SdUndoGroup did not track what view shell created it.
- CPPUNIT_ASSERT_EQUAL(nView1, pUndoManager->GetUndoAction()->GetViewShellId());
+ CPPUNIT_ASSERT_EQUAL(ViewShellId(nView1), pUndoManager->GetUndoAction()->GetViewShellId());
}
void SdTiledRenderingTest::testResetSelection()
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index c801a4af50cc..c45d02ec052e 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -484,7 +484,7 @@ bool SdDrawDocument::InsertBookmarkAsPage(
if( mpDocSh )
{
pUndoMgr = mpDocSh->GetUndoManager();
- sal_Int32 nViewShellId = -1;
+ ViewShellId nViewShellId(-1);
if (sd::ViewShell* pViewShell = mpDocSh->GetViewShell())
nViewShellId = pViewShell->GetViewShellBase().GetViewShellId();
pUndoMgr->EnterListAction(SD_RESSTR(STR_UNDO_INSERTPAGES), "", 0, nViewShellId);
@@ -1414,7 +1414,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
if (bUndo)
{
- sal_Int32 nViewShellId = -1;
+ ViewShellId nViewShellId(-1);
if (sd::ViewShell* pViewShell = mpDocSh->GetViewShell())
nViewShellId = pViewShell->GetViewShellBase().GetViewShellId();
pUndoMgr->EnterListAction(SD_RESSTR(STR_UNDO_SET_PRESLAYOUT), OUString(), 0, nViewShellId);
diff --git a/sd/source/core/undo/undomanager.cxx b/sd/source/core/undo/undomanager.cxx
index a18c858a680e..a8144231cbb7 100644
--- a/sd/source/core/undo/undomanager.cxx
+++ b/sd/source/core/undo/undomanager.cxx
@@ -30,7 +30,7 @@ UndoManager::UndoManager()
{
}
-void UndoManager::EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, sal_Int32 nViewShellId)
+void UndoManager::EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
{
if( !IsDoing() )
{
@@ -66,7 +66,7 @@ size_t UndoManager::GetUndoActionCount(const bool bCurrentLevel) const
return nRet;
// If an other view created the last undo action, prevent undoing it from this view.
- sal_Int32 nViewShellId = mpViewShell->GetViewShellId();
+ ViewShellId nViewShellId = mpViewShell->GetViewShellId();
if (pAction->GetViewShellId() != nViewShellId)
nRet = 0;
@@ -87,7 +87,7 @@ size_t UndoManager::GetRedoActionCount(const bool bCurrentLevel) const
return nRet;
// If an other view created the first redo action, prevent redoing it from this view.
- sal_Int32 nViewShellId = mpViewShell->GetViewShellId();
+ ViewShellId nViewShellId = mpViewShell->GetViewShellId();
if (pAction->GetViewShellId() != nViewShellId)
nRet = 0;
diff --git a/sd/source/core/undo/undoobjects.cxx b/sd/source/core/undo/undoobjects.cxx
index 101fd27927c4..4119a4fd2e23 100644
--- a/sd/source/core/undo/undoobjects.cxx
+++ b/sd/source/core/undo/undoobjects.cxx
@@ -38,7 +38,7 @@ SdUndoAction::SdUndoAction(SdDrawDocument* pSdDrawDocument)
mnViewShellId = pViewShell->GetViewShellBase().GetViewShellId();
}
-sal_Int32 SdUndoAction::GetViewShellId() const
+ViewShellId SdUndoAction::GetViewShellId() const
{
return mnViewShellId;
}
diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx
index 486af64be04a..fa1c343f45b0 100644
--- a/sd/source/ui/func/fubullet.cxx
+++ b/sd/source/ui/func/fubullet.cxx
@@ -256,7 +256,7 @@ void FuBullet::InsertSpecialCharacter( SfxRequest& rReq )
aOldSet.Put( pOV->GetAttribs() );
::svl::IUndoManager& rUndoMgr = pOL->GetUndoManager();
- int nViewShellId = mpViewShell ? mpViewShell->GetViewShellBase().GetViewShellId() : -1;
+ ViewShellId nViewShellId = mpViewShell ? mpViewShell->GetViewShellBase().GetViewShellId() : ViewShellId(-1);
rUndoMgr.EnterListAction(SD_RESSTR(STR_UNDO_INSERT_SPECCHAR),
"", 0, nViewShellId );
pOV->InsertText(aChars, true);
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index aca9c8cc8905..d200cc894a75 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -630,7 +630,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
nNewPages = 0;
- int nViewShellId = mpViewShell ? mpViewShell->GetViewShellBase().GetViewShellId() : -1;
+ ViewShellId nViewShellId = mpViewShell ? mpViewShell->GetViewShellBase().GetViewShellId() : ViewShellId(-1);
rDocliner.GetUndoManager().EnterListAction(
SD_RESSTR(STR_UNDO_INSERT_FILE), OUString(), 0, nViewShellId );
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index a5e2a3b9c4ed..355b0a3f1abf 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -520,7 +520,7 @@ void DrawView::DeleteMarked()
{
OUString aUndo(SVX_RESSTR(STR_EditDelete));
aUndo = aUndo.replaceFirst("%1", GetDescriptionOfMarkedObjects());
- sal_Int32 nViewShellId = mpDrawViewShell ? mpDrawViewShell->GetViewShellBase().GetViewShellId() : -1;
+ ViewShellId nViewShellId = mpDrawViewShell ? mpDrawViewShell->GetViewShellBase().GetViewShellId() : ViewShellId(-1);
pUndoManager->EnterListAction(aUndo, aUndo, 0, nViewShellId);
}