diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2017-03-18 18:24:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-24 06:14:17 +0000 |
commit | 7916487cf4d9603cdbe4c7ffbe9bb3f28b51ce4e (patch) | |
tree | e3bafe408d8efd97d156521c1ea93d741a5215a8 /sw | |
parent | 9ee2d69c610d94280103e089671e9ba78b070e23 (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 'sw')
-rw-r--r-- | sw/inc/undobj.hxx | 8 | ||||
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/undo/docundo.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/undo/undobj.cxx | 6 |
4 files changed, 20 insertions, 15 deletions
diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx index 0f99d73670b8..91185bbcded0 100644 --- a/sw/inc/undobj.hxx +++ b/sw/inc/undobj.hxx @@ -51,8 +51,8 @@ class SwUndo : public SfxUndoAction { SwUndoId const m_nId; - RedlineFlags nOrigRedlineFlags; - sal_Int32 m_nViewShellId; + RedlineFlags nOrigRedlineFlags; + ViewShellId m_nViewShellId; protected: bool bCacheComment; @@ -82,7 +82,7 @@ public: // should not be public, but ran into trouble in untbl.cxx private: /// Try to obtain the view shell ID of the current view. - static sal_Int32 CreateViewShellId(const SwDoc* pDoc); + static ViewShellId CreateViewShellId(const SwDoc* pDoc); // SfxUndoAction virtual void Undo() override; virtual void Redo() override; @@ -109,7 +109,7 @@ public: virtual OUString GetComment() const override; /// See SfxUndoAction::GetViewShellId(). - sal_Int32 GetViewShellId() const override; + ViewShellId GetViewShellId() const override; // UndoObject remembers which mode was turned on. // In Undo/Redo/Repeat this remembered mode is switched on. diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index c07f9fb46772..f1da81e6b193 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -36,6 +36,11 @@ static const char* const DATA_DIRECTORY = "/sw/qa/extras/tiledrendering/data/"; +static std::ostream& operator<<(std::ostream& os, ViewShellId id) +{ + os << (int)id; return os; +} + /// Testsuite for the SwXTextDocument methods implementing the vcl::ITiledRenderable interface. class SwTiledRenderingTest : public SwModelTestBase { @@ -1252,7 +1257,7 @@ void SwTiledRenderingTest::testShapeTextUndoShells() sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rUndoManager.GetUndoActionCount()); // This was -1: the view shell id for the undo action wasn't known. - CPPUNIT_ASSERT_EQUAL(nView1, rUndoManager.GetUndoAction()->GetViewShellId()); + CPPUNIT_ASSERT_EQUAL(ViewShellId(nView1), rUndoManager.GetUndoAction()->GetViewShellId()); mxComponent->dispose(); mxComponent.clear(); @@ -1284,7 +1289,7 @@ void SwTiledRenderingTest::testShapeTextUndoGroupShells() sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rUndoManager.GetUndoActionCount()); // This was -1: the view shell id for the (top) undo list action wasn't known. - CPPUNIT_ASSERT_EQUAL(nView1, rUndoManager.GetUndoAction()->GetViewShellId()); + CPPUNIT_ASSERT_EQUAL(ViewShellId(nView1), rUndoManager.GetUndoAction()->GetViewShellId()); // Create an editeng text selection in the first view. EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView(); diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 22b1e2a0a9bb..96b01c18b20b 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -112,7 +112,7 @@ size_t UndoManager::GetUndoActionCount(const bool bCurrentLevel) const if (!m_bRepair) { // If an other view created the last undo action, prevent undoing it from this view. - sal_Int32 nViewShellId = m_pView->GetViewShellId(); + ViewShellId nViewShellId = m_pView->GetViewShellId(); if (pAction->GetViewShellId() != nViewShellId) nRet = 0; } @@ -136,7 +136,7 @@ size_t UndoManager::GetRedoActionCount(const bool bCurrentLevel) const if (m_pView && !m_bRepair) { // If an other view created the first redo action, prevent redoing it from this view. - sal_Int32 nViewShellId = m_pView->GetViewShellId(); + ViewShellId nViewShellId = m_pView->GetViewShellId(); if (pAction->GetViewShellId() != nViewShellId) nRet = 0; } @@ -282,7 +282,7 @@ UndoManager::StartUndo(SwUndoId const i_eUndoId, comment = pRewriter->Apply(comment); } - int nViewShellId = -1; + ViewShellId nViewShellId(-1); if (m_pDocShell) { if (const SwView* pView = m_pDocShell->GetView()) @@ -368,7 +368,7 @@ UndoManager::GetLastUndoInfo( if (comphelper::LibreOfficeKit::isActive() && !m_bRepair) { // If an other view created the undo action, prevent undoing it from this view. - sal_Int32 nViewShellId = pView ? pView->GetViewShellId() : m_pDocShell->GetView()->GetViewShellId(); + ViewShellId nViewShellId = pView ? pView->GetViewShellId() : m_pDocShell->GetView()->GetViewShellId(); if (pAction->GetViewShellId() != nViewShellId) { if (o_pId) @@ -431,7 +431,7 @@ bool UndoManager::GetFirstRedoInfo(OUString *const o_pStr, if (comphelper::LibreOfficeKit::isActive() && !m_bRepair) { // If an other view created the undo action, prevent redoing it from this view. - sal_Int32 nViewShellId = pView ? pView->GetViewShellId() : m_pDocShell->GetView()->GetViewShellId(); + ViewShellId nViewShellId = pView ? pView->GetViewShellId() : m_pDocShell->GetView()->GetViewShellId(); if (pAction->GetViewShellId() != nViewShellId) { if (o_pId) @@ -664,7 +664,7 @@ bool UndoManager::Repeat(::sw::RepeatContext & rContext, SwUndoId const nId(static_cast<const SwUndo*>(pRepeatAction)->GetId()); if (DoesUndo()) { - int nViewShellId = -1; + ViewShellId nViewShellId(-1); if (m_pDocShell) { if (const SwView* pView = m_pDocShell->GetView()) diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 7a67c130ccc5..87a8fc50d9d0 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -164,9 +164,9 @@ SwUndo::SwUndo(SwUndoId const nId, const SwDoc* pDoc) { } -sal_Int32 SwUndo::CreateViewShellId(const SwDoc* pDoc) +ViewShellId SwUndo::CreateViewShellId(const SwDoc* pDoc) { - sal_Int32 nRet = -1; + ViewShellId nRet(-1); if (const SwDocShell* pDocShell = pDoc->GetDocShell()) { @@ -286,7 +286,7 @@ OUString SwUndo::GetComment() const return aResult; } -sal_Int32 SwUndo::GetViewShellId() const +ViewShellId SwUndo::GetViewShellId() const { return m_nViewShellId; } |