summaryrefslogtreecommitdiff
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
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>
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx2
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx2
-rw-r--r--desktop/source/lib/init.cxx2
-rw-r--r--editeng/source/editeng/editundo.cxx2
-rw-r--r--editeng/source/editeng/impedit.hxx2
-rw-r--r--editeng/source/editeng/impedit5.cxx4
-rw-r--r--framework/source/fwe/helper/undomanagerhelper.cxx2
-rw-r--r--include/editeng/editund2.hxx8
-rw-r--r--include/editeng/outliner.hxx3
-rw-r--r--include/sfx2/viewsh.hxx2
-rw-r--r--include/svl/undo.hxx14
-rw-r--r--include/svx/svdundo.hxx6
-rw-r--r--reportdesign/inc/UndoActions.hxx2
-rw-r--r--reportdesign/source/ui/dlg/GroupsSorting.cxx4
-rw-r--r--reportdesign/source/ui/report/SectionWindow.cxx2
-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
-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
-rw-r--r--sfx2/source/view/lokhelper.cxx14
-rw-r--r--sfx2/source/view/viewimp.hxx2
-rw-r--r--sfx2/source/view/viewsh.cxx4
-rw-r--r--svl/source/undo/undo.cxx18
-rw-r--r--svx/source/svdraw/svdmodel.cxx6
-rw-r--r--svx/source/svdraw/svdundo.cxx2
-rw-r--r--sw/inc/undobj.hxx8
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx9
-rw-r--r--sw/source/core/undo/docundo.cxx12
-rw-r--r--sw/source/core/undo/undobj.cxx6
-rw-r--r--vcl/source/edit/texteng.cxx2
46 files changed, 120 insertions, 100 deletions
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index a5097e0b6e0b..fd96f7b7af84 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -741,7 +741,7 @@ void OQueryTableView::RemoveTabWin(OTableWindow* pTabWin)
OQueryDesignView* pParent = static_cast<OQueryDesignView*>(getDesignView());
SfxUndoManager& rUndoMgr = m_pView->getController().GetUndoManager();
- rUndoMgr.EnterListAction( OUString( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), OUString(), 0, -1 );
+ rUndoMgr.EnterListAction( OUString( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), OUString(), 0, ViewShellId(-1) );
// add the Undo-Action
OQueryTabWinDelUndoAct* pUndoAction = new OQueryTabWinDelUndoAct(this);
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index d0ba3523d217..d391c68c7353 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -939,7 +939,7 @@ bool OSelectionBrowseBox::SaveModified()
strOldCellContents = pEntry->GetField();
bListAction = true;
if ( !m_bInUndoMode )
- rController.GetUndoManager().EnterListAction(OUString(),OUString(),0,-1);
+ rController.GetUndoManager().EnterListAction(OUString(),OUString(),0,ViewShellId(-1));
sal_Int32 nPos = m_pFieldCell->GetEntryPos(aFieldName);
OUString aAliasName = pEntry->GetAlias();
@@ -2447,7 +2447,7 @@ void OSelectionBrowseBox::appendUndoAction(const OUString& _rOldValue, const OUS
if ( !_bListAction )
{
_bListAction = true;
- static_cast<OQueryController&>(getDesignView()->getController()).GetUndoManager().EnterListAction(OUString(),OUString(),0,-1);
+ static_cast<OQueryController&>(getDesignView()->getController()).GetUndoManager().EnterListAction(OUString(),OUString(),0,ViewShellId(-1));
}
appendUndoAction(_rOldValue,_rNewValue,_nRow);
}
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 203e12adac2f..09ef0e0cd672 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -660,7 +660,7 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
break;
case SID_BROWSER_CLEAR_QUERY:
{
- GetUndoManager().EnterListAction( OUString( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), OUString(), 0, -1 );
+ GetUndoManager().EnterListAction( OUString( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), OUString(), 0, ViewShellId(-1) );
getContainer()->clear();
GetUndoManager().LeaveListAction();
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index f089175f29ac..7777121f2c54 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -648,7 +648,7 @@ void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId )
default: sActionDescription = ModuleRes( STR_CHANGE_COLUMN_ATTRIBUTE ); break;
}
- GetUndoManager().EnterListAction( sActionDescription, OUString(),0,-1 );
+ GetUndoManager().EnterListAction( sActionDescription, OUString(), 0, ViewShellId(-1) );
if (!pActFieldDescr)
{
const OTypeInfoMap& rTypeInfoMap = GetView()->getController().getTypeInfo();
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0e73a272cce1..90c85b9de4ac 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1864,7 +1864,7 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis,
{
if (pViewShell->getPart() == nPart)
{
- nViewId = pViewShell->GetViewShellId();
+ nViewId = (sal_Int32)pViewShell->GetViewShellId();
doc_setView(pThis, nViewId);
break;
}
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 30650d129d70..1862c9887b64 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -151,7 +151,7 @@ OUString EditUndo::GetComment() const
return aComment;
}
-sal_Int32 EditUndo::GetViewShellId() const
+ViewShellId EditUndo::GetViewShellId() const
{
return mnViewShellId;
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index e8d2cead0532..644f4b2b88e6 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -691,7 +691,7 @@ private:
SpellInfo * CreateSpellInfo( bool bMultipleDocs );
/// Obtains a view shell ID from the active EditView.
- sal_Int32 CreateViewShellId();
+ ViewShellId CreateViewShellId();
ImpEditEngine(EditEngine* pEditEngine, SfxItemPool* pPool);
void InitDoc(bool bKeepParaAttribs);
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index fca0358ae757..83d60c75165c 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -224,9 +224,9 @@ EditUndoSetAttribs* ImpEditEngine::CreateAttribUndo( EditSelection aSel, const S
return pUndo;
}
-sal_Int32 ImpEditEngine::CreateViewShellId()
+ViewShellId ImpEditEngine::CreateViewShellId()
{
- sal_Int32 nRet = -1;
+ ViewShellId nRet(-1);
const EditView* pEditView = pEditEngine ? pEditEngine->GetActiveView() : nullptr;
const OutlinerViewShell* pViewShell = pEditView ? pEditView->GetImpEditView()->GetViewShell() : nullptr;
diff --git a/framework/source/fwe/helper/undomanagerhelper.cxx b/framework/source/fwe/helper/undomanagerhelper.cxx
index efa05ed28b70..b02b8aabbd37 100644
--- a/framework/source/fwe/helper/undomanagerhelper.cxx
+++ b/framework/source/fwe/helper/undomanagerhelper.cxx
@@ -525,7 +525,7 @@ namespace framework
{
::comphelper::FlagGuard aNotificationGuard( m_bAPIActionRunning );
- rUndoManager.EnterListAction( i_title, OUString(), 0, -1 );
+ rUndoManager.EnterListAction( i_title, OUString(), 0, ViewShellId(-1) );
}
m_aContextVisibilities.push( i_hidden );
diff --git a/include/editeng/editund2.hxx b/include/editeng/editund2.hxx
index 0a86fe7a96a5..e4af37b25a36 100644
--- a/include/editeng/editund2.hxx
+++ b/include/editeng/editund2.hxx
@@ -46,9 +46,9 @@ public:
class EDITENG_DLLPUBLIC EditUndo : public SfxUndoAction
{
private:
- sal_uInt16 nId;
- sal_Int32 mnViewShellId;
- EditEngine* mpEditEngine;
+ sal_uInt16 nId;
+ ViewShellId mnViewShellId;
+ EditEngine* mpEditEngine;
public:
EditUndo(sal_uInt16 nI, EditEngine* pEE);
@@ -62,7 +62,7 @@ public:
virtual bool CanRepeat(SfxRepeatTarget&) const override;
virtual OUString GetComment() const override;
/// See SfxUndoAction::GetViewShellId().
- sal_Int32 GetViewShellId() const override;
+ ViewShellId GetViewShellId() const override;
sal_uInt16 GetId() const;
};
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 034de4776bfc..75127e7e5f30 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -26,6 +26,7 @@
#include <rtl/ustring.hxx>
#include <svl/SfxBroadcaster.hxx>
#include <svl/languageoptions.hxx>
+#include <svl/undo.hxx>
#include <tools/gen.hxx>
#include <tools/color.hxx>
#include <tools/contnr.hxx>
@@ -377,7 +378,7 @@ class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI OutlinerViewShell
{
public:
virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const = 0;
- virtual sal_uInt32 GetViewShellId() const = 0;
+ virtual ViewShellId GetViewShellId() const = 0;
/// Wrapper around SfxLokHelper::notifyOtherViews().
virtual void NotifyOtherViews(int nType, const OString& rKey, const OString& rPayload) = 0;
/// Wrapper around SfxLokHelper::notifyOtherView().
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 14466922f461..e8aef57c7c50 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -332,7 +332,7 @@ public:
virtual int getPart() const;
virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
/// See OutlinerViewShell::GetViewShellId().
- sal_uInt32 GetViewShellId() const override;
+ ViewShellId GetViewShellId() const override;
/// See OutlinerViewShell::NotifyOtherViews().
void NotifyOtherViews(int nType, const OString& rKey, const OString& rPayload) override;
/// See OutlinerViewShell::NotifyOtherView().
diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx
index 3fdfb8b4babc..abb892788cbf 100644
--- a/include/svl/undo.hxx
+++ b/include/svl/undo.hxx
@@ -22,12 +22,16 @@
#include <svl/svldllapi.h>
#include <rtl/ustring.hxx>
#include <tools/datetime.hxx>
+#include <o3tl/strong_int.hxx>
#include <limits>
#include <memory>
struct MarkedUndoAction;
+struct ViewShellIdTag;
+typedef o3tl::strong_int<sal_Int32, ViewShellIdTag> ViewShellId;
+
class SVL_DLLPUBLIC SfxRepeatTarget
{
public:
@@ -60,7 +64,7 @@ public:
virtual OUString GetComment() const;
virtual OUString GetRepeatComment(SfxRepeatTarget&) const;
/// ID of the view shell that created this undo action.
- virtual sal_Int32 GetViewShellId() const;
+ virtual ViewShellId GetViewShellId() const;
/// Timestamp when this undo item was created.
const DateTime& GetDateTime() const;
virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
@@ -134,7 +138,7 @@ class SVL_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArra
public:
SfxListUndoAction(
- const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, sal_Int32 nViewShellId, SfxUndoArray *pFather );
+ const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId, SfxUndoArray *pFather );
virtual ~SfxListUndoAction() override;
virtual void Undo() override;
@@ -148,7 +152,7 @@ public:
virtual OUString GetComment() const override;
/// See SfxUndoAction::GetViewShellId().
- sal_Int32 GetViewShellId() const override;
+ ViewShellId GetViewShellId() const override;
virtual OUString GetRepeatComment(SfxRepeatTarget&) const override;
virtual sal_uInt16 GetId() const;
@@ -237,7 +241,7 @@ namespace svl
virtual bool Repeat( SfxRepeatTarget &rTarget ) = 0;
virtual bool CanRepeat( SfxRepeatTarget &rTarget ) const = 0;
- virtual void EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, sal_Int32 nViewShellId) = 0;
+ virtual void EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId) = 0;
/** leaves the list action entered with EnterListAction
@return the number of the sub actions in the list which has just been left. Note that in case no such
@@ -329,7 +333,7 @@ public:
virtual OUString GetRepeatActionComment( SfxRepeatTarget &rTarget) const override;
virtual bool Repeat( SfxRepeatTarget &rTarget ) override;
virtual bool CanRepeat( SfxRepeatTarget &rTarget ) const override;
- 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 size_t LeaveListAction() override;
virtual size_t LeaveAndMergeListAction() override;
virtual bool IsInListAction() const override;
diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx
index e53ca9872744..2653ba8569e8 100644
--- a/include/svx/svdundo.hxx
+++ b/include/svx/svdundo.hxx
@@ -54,8 +54,8 @@ class OutlinerParaObject;
class SVX_DLLPUBLIC SdrUndoAction : public SfxUndoAction
{
protected:
- SdrModel& rMod;
- sal_Int32 m_nViewShellId;
+ SdrModel& rMod;
+ ViewShellId m_nViewShellId;
protected:
SdrUndoAction(SdrModel& rNewMod);
@@ -73,7 +73,7 @@ public:
virtual void SdrRepeat(SdrView& rView);
/// See SfxUndoAction::GetViewShellId().
- sal_Int32 GetViewShellId() const override;
+ ViewShellId GetViewShellId() const override;
};
/**
diff --git a/reportdesign/inc/UndoActions.hxx b/reportdesign/inc/UndoActions.hxx
index dc24b55f9a50..95744d0a67bf 100644
--- a/reportdesign/inc/UndoActions.hxx
+++ b/reportdesign/inc/UndoActions.hxx
@@ -112,7 +112,7 @@ namespace rptui
UndoContext( SfxUndoManager& i_undoManager, const OUString& i_undoTitle )
:m_rUndoManager( i_undoManager )
{
- m_rUndoManager.EnterListAction( i_undoTitle, OUString(), 0, -1 );
+ m_rUndoManager.EnterListAction( i_undoTitle, OUString(), 0, ViewShellId(-1) );
}
~UndoContext()
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index 25e9749117a4..521951992040 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -439,7 +439,7 @@ bool OFieldExpressionControl::SaveModified()
{
bAppend = true;
OUString sUndoAction(ModuleRes(RID_STR_UNDO_APPEND_GROUP));
- m_pParent->m_pController->getUndoManager().EnterListAction( sUndoAction, OUString(), 0, -1 );
+ m_pParent->m_pController->getUndoManager().EnterListAction( sUndoAction, OUString(), 0, ViewShellId(-1) );
xGroup = m_pParent->getGroups()->createGroup();
xGroup->setHeaderOn(true);
@@ -778,7 +778,7 @@ void OFieldExpressionControl::DeleteRows()
{
bFirstTime = false;
OUString sUndoAction(ModuleRes(RID_STR_UNDO_REMOVE_SELECTION));
- m_pParent->m_pController->getUndoManager().EnterListAction( sUndoAction, OUString(), 0, -1 );
+ m_pParent->m_pController->getUndoManager().EnterListAction( sUndoAction, OUString(), 0, ViewShellId(-1) );
}
sal_Int32 nGroupPos = m_aGroupPositions[nIndex];
diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx
index 65459b59e9a0..fc235820760d 100644
--- a/reportdesign/source/ui/report/SectionWindow.cxx
+++ b/reportdesign/source/ui/report/SectionWindow.cxx
@@ -318,7 +318,7 @@ void OSectionWindow::zoom(const Fraction& _aZoom)
IMPL_LINK_NOARG( OSectionWindow, StartSplitHdl, Splitter*, void)
{
const OUString sUndoAction( ModuleRes( RID_STR_UNDO_CHANGE_SIZE ) );
- getViewsWindow()->getView()->getReportView()->getController().getUndoManager().EnterListAction( sUndoAction, OUString(), 0, -1 );
+ getViewsWindow()->getView()->getReportView()->getController().getUndoManager().EnterListAction( sUndoAction, OUString(), 0, ViewShellId(-1) );
}
IMPL_LINK_NOARG( OSectionWindow, EndSplitHdl, Splitter*, void )
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 );
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);
}
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 73e29f3994e8..2420b0903578 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -32,7 +32,7 @@ int SfxLokHelper::createView()
SfxViewShell* pViewShell = SfxViewShell::Current();
if (!pViewShell)
return -1;
- return pViewShell->GetViewShellId();
+ return (sal_Int32)pViewShell->GetViewShellId();
}
void SfxLokHelper::destroyView(int nId)
@@ -41,12 +41,12 @@ void SfxLokHelper::destroyView(int nId)
if (!pApp)
return;
- unsigned nViewShellId = nId;
+ int nViewShellId = nId;
SfxViewShellArr_Impl& rViewArr = pApp->GetViewShells_Impl();
for (SfxViewShell* pViewShell : rViewArr)
{
- if (pViewShell->GetViewShellId() == nViewShellId)
+ if ((sal_Int32)pViewShell->GetViewShellId() == nViewShellId)
{
SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
SfxRequest aRequest(pViewFrame, SID_CLOSEWIN);
@@ -62,12 +62,12 @@ void SfxLokHelper::setView(int nId)
if (!pApp)
return;
- unsigned nViewShellId = nId;
+ int nViewShellId = nId;
SfxViewShellArr_Impl& rViewArr = pApp->GetViewShells_Impl();
for (SfxViewShell* pViewShell : rViewArr)
{
- if (pViewShell->GetViewShellId() == nViewShellId)
+ if ((sal_Int32)pViewShell->GetViewShellId() == nViewShellId)
{
if (pViewShell == SfxViewShell::Current())
return;
@@ -93,7 +93,7 @@ int SfxLokHelper::getView(SfxViewShell* pViewShell)
if (!pViewShell)
return -1;
- return pViewShell->GetViewShellId();
+ return (sal_Int32)pViewShell->GetViewShellId();
}
std::size_t SfxLokHelper::getViewsCount()
@@ -115,7 +115,7 @@ bool SfxLokHelper::getViewIds(int* pArray, size_t nSize)
for (std::size_t i = 0; i < rViewArr.size(); ++i)
{
SfxViewShell* pViewShell = rViewArr[i];
- pArray[i] = pViewShell->GetViewShellId();
+ pArray[i] = (sal_Int32)pViewShell->GetViewShellId();
}
return true;
}
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
index 95fdf8260df4..bbf0eb30a48f 100644
--- a/sfx2/source/view/viewimp.hxx
+++ b/sfx2/source/view/viewimp.hxx
@@ -63,7 +63,7 @@ struct SfxViewShell_Impl
/// Set if we are in the middle of a tiled search.
bool m_bTiledSearching;
static sal_uInt32 m_nLastViewShellId;
- const sal_uInt32 m_nViewShellId;
+ const ViewShellId m_nViewShellId;
explicit SfxViewShell_Impl(SfxViewShellFlags const nFlags);
~SfxViewShell_Impl();
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 4a9fabc30724..329ded27bf28 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1486,7 +1486,7 @@ int SfxViewShell::getPart() const
return 0;
}
-sal_uInt32 SfxViewShell::GetViewShellId() const
+ViewShellId SfxViewShell::GetViewShellId() const
{
return pImpl->m_nViewShellId;
}
@@ -1509,7 +1509,7 @@ void SfxViewShell::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("SfxViewShell"));
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("id"), BAD_CAST(OString::number(GetViewShellId()).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("id"), BAD_CAST(OString::number((sal_Int32)GetViewShellId()).getStr()));
xmlTextWriterEndElement(pWriter);
}
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 71dd56de8621..1ca8375b0164 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -70,9 +70,9 @@ OUString SfxUndoAction::GetComment() const
}
-sal_Int32 SfxUndoAction::GetViewShellId() const
+ViewShellId SfxUndoAction::GetViewShellId() const
{
- return -1;
+ return ViewShellId(-1);
}
const DateTime& SfxUndoAction::GetDateTime() const
@@ -132,7 +132,7 @@ void SfxUndoAction::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("symbol"), BAD_CAST(typeid(*this).name()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("comment"), BAD_CAST(GetComment().toUtf8().getStr()));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("viewShellId"), BAD_CAST(OString::number(GetViewShellId()).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("viewShellId"), BAD_CAST(OString::number((sal_Int32)GetViewShellId()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("dateTime"), BAD_CAST(utl::toISO8601(m_aDateTime.GetUNODateTime()).toUtf8().getStr()));
xmlTextWriterEndElement(pWriter);
}
@@ -988,7 +988,7 @@ void SfxUndoManager::RemoveUndoListener( SfxUndoListener& i_listener )
*/
void SfxUndoManager::EnterListAction( const OUString& rComment,
const OUString &rRepeatComment, sal_uInt16 nId,
- sal_Int32 nViewShellId )
+ ViewShellId nViewShellId )
{
UndoManagerGuard aGuard( *m_xData );
@@ -1289,7 +1289,7 @@ boost::property_tree::ptree lcl_ActionToJson(size_t nIndex, SfxUndoAction* pActi
boost::property_tree::ptree aRet;
aRet.put("index", nIndex);
aRet.put("comment", pAction->GetComment().toUtf8().getStr());
- aRet.put("viewId", pAction->GetViewShellId());
+ aRet.put("viewId", (sal_Int32)pAction->GetViewShellId());
aRet.put("dateTime", utl::toISO8601(pAction->GetDateTime().GetUNODateTime()).toUtf8().getStr());
return aRet;
}
@@ -1333,12 +1333,12 @@ OUString SfxUndoManager::GetRedoActionsInfo() const
struct SfxListUndoAction::Impl
{
sal_uInt16 mnId;
- sal_Int32 mnViewShellId;
+ ViewShellId mnViewShellId;
OUString maComment;
OUString maRepeatComment;
- Impl( sal_uInt16 nId, sal_Int32 nViewShellId, const OUString& rComment, const OUString& rRepeatComment ) :
+ Impl( sal_uInt16 nId, ViewShellId nViewShellId, const OUString& rComment, const OUString& rRepeatComment ) :
mnId(nId), mnViewShellId(nViewShellId), maComment(rComment), maRepeatComment(rRepeatComment) {}
};
@@ -1352,7 +1352,7 @@ OUString SfxListUndoAction::GetComment() const
return mpImpl->maComment;
}
-sal_Int32 SfxListUndoAction::GetViewShellId() const
+ViewShellId SfxListUndoAction::GetViewShellId() const
{
return mpImpl->mnViewShellId;
}
@@ -1371,7 +1371,7 @@ SfxListUndoAction::SfxListUndoAction(
const OUString &rComment,
const OUString &rRepeatComment,
sal_uInt16 nId,
- sal_Int32 nViewShellId,
+ ViewShellId nViewShellId,
SfxUndoArray *pFather ) :
mpImpl(new Impl(nId, nViewShellId, rComment, rRepeatComment))
{
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 7bb15c830f90..7df859647579 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -467,7 +467,7 @@ void SdrModel::BegUndo()
{
if( mpImpl->mpUndoManager )
{
- int nViewShellId = -1;
+ ViewShellId nViewShellId(-1);
if (SfxViewShell* pViewShell = SfxViewShell::Current())
nViewShellId = pViewShell->GetViewShellId();
mpImpl->mpUndoManager->EnterListAction("","",0,nViewShellId);
@@ -491,7 +491,7 @@ void SdrModel::BegUndo(const OUString& rComment)
{
if( mpImpl->mpUndoManager )
{
- int nViewShellId = -1;
+ ViewShellId nViewShellId(-1);
if (SfxViewShell* pViewShell = SfxViewShell::Current())
nViewShellId = pViewShell->GetViewShellId();
mpImpl->mpUndoManager->EnterListAction( rComment, "", 0, nViewShellId );
@@ -516,7 +516,7 @@ void SdrModel::BegUndo(const OUString& rComment, const OUString& rObjDescr, SdrR
{
aComment = aComment.replaceFirst("%1", rObjDescr);
}
- int nViewShellId = -1;
+ ViewShellId nViewShellId(-1);
if (SfxViewShell* pViewShell = SfxViewShell::Current())
nViewShellId = pViewShell->GetViewShellId();
mpImpl->mpUndoManager->EnterListAction( aComment,"",0,nViewShellId );
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index a1c836fbb4d5..f04dc32b2b35 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -102,7 +102,7 @@ OUString SdrUndoAction::GetSdrRepeatComment(SdrView& /*rView*/) const
return OUString();
}
-sal_Int32 SdrUndoAction::GetViewShellId() const
+ViewShellId SdrUndoAction::GetViewShellId() const
{
return m_nViewShellId;
}
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;
}
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 11c8704db606..5ff7af0e9d29 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -1324,7 +1324,7 @@ void TextEngine::UndoActionStart( sal_uInt16 nId )
if ( IsUndoEnabled() && !IsInUndo() )
{
OUString aComment;
- GetUndoManager().EnterListAction( aComment, OUString(), nId, -1 );
+ GetUndoManager().EnterListAction( aComment, OUString(), nId, ViewShellId(-1) );
}
}