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>
This commit is contained in:
Noel Grandin 2017-03-18 18:24:53 +02:00 committed by Noel Grandin
parent 9ee2d69c61
commit 7916487cf4
46 changed files with 120 additions and 100 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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();

View File

@ -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();

View File

@ -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;
}

View File

@ -151,7 +151,7 @@ OUString EditUndo::GetComment() const
return aComment;
}
sal_Int32 EditUndo::GetViewShellId() const
ViewShellId EditUndo::GetViewShellId() const
{
return mnViewShellId;
}

View File

@ -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);

View File

@ -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;

View File

@ -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 );

View File

@ -47,7 +47,7 @@ class EDITENG_DLLPUBLIC EditUndo : public SfxUndoAction
{
private:
sal_uInt16 nId;
sal_Int32 mnViewShellId;
ViewShellId mnViewShellId;
EditEngine* mpEditEngine;
public:
@ -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;
};

View File

@ -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().

View File

@ -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().

View File

@ -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;

View File

@ -55,7 +55,7 @@ class SVX_DLLPUBLIC SdrUndoAction : public SfxUndoAction
{
protected:
SdrModel& rMod;
sal_Int32 m_nViewShellId;
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;
};
/**

View File

@ -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()

View File

@ -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];

View File

@ -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 )

View File

@ -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);
}

View File

@ -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 );

View File

@ -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 );

View File

@ -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 );

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -44,7 +44,7 @@ OUString ScUndoDraw::GetComment() const
return OUString();
}
sal_Int32 ScUndoDraw::GetViewShellId() const
ViewShellId ScUndoDraw::GetViewShellId() const
{
return mnViewShellId;
}

View File

@ -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 );

View File

@ -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;
};

View File

@ -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;

View File

@ -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()

View File

@ -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);

View File

@ -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;

View File

@ -38,7 +38,7 @@ SdUndoAction::SdUndoAction(SdDrawDocument* pSdDrawDocument)
mnViewShellId = pViewShell->GetViewShellBase().GetViewShellId();
}
sal_Int32 SdUndoAction::GetViewShellId() const
ViewShellId SdUndoAction::GetViewShellId() const
{
return mnViewShellId;
}

View File

@ -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);

View File

@ -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 );

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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();

View File

@ -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);
}

View File

@ -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))
{

View File

@ -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 );

View File

@ -102,7 +102,7 @@ OUString SdrUndoAction::GetSdrRepeatComment(SdrView& /*rView*/) const
return OUString();
}
sal_Int32 SdrUndoAction::GetViewShellId() const
ViewShellId SdrUndoAction::GetViewShellId() const
{
return m_nViewShellId;
}

View File

@ -52,7 +52,7 @@ class SwUndo
{
SwUndoId const m_nId;
RedlineFlags nOrigRedlineFlags;
sal_Int32 m_nViewShellId;
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.

View File

@ -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();

View File

@ -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())

View File

@ -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;
}

View File

@ -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) );
}
}