summaryrefslogtreecommitdiff
path: root/sd/source/ui/view/drviewsb.cxx
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-04-23 14:54:42 +0530
committerpranavk <pranavk@collabora.co.uk>2017-05-01 06:46:19 +0200
commitc454fbb9b62164d5f047990ae63522c9fb932086 (patch)
tree682c263be6e283fd4ad04e509548abd520595f16 /sd/source/ui/view/drviewsb.cxx
parent862b6c0a32dfce924bfafa84acaed47c5380fc46 (diff)
sd: Use unique Page ids for better multi-view support + unit test
... instead of using simple IDs which are assumed to be one greater than the slide position everywhere in the codebase. Use a 16 bit static counter and uniquely assign page ids to SdPage objects. This helps in identifying which slide was already selected in second view before any slide is deleted in the first view. Otherwise, using simple positions to keep track of it leads the second view to end up selecting the wrong slide after any slide is added or removed in the first view. Change-Id: I465cf7ea86899f0e52549062a9e5fa5cd459f978 Reviewed-on: https://gerrit.libreoffice.org/36863 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: pranavk <pranavk@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/view/drviewsb.cxx')
-rw-r--r--sd/source/ui/view/drviewsb.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/sd/source/ui/view/drviewsb.cxx b/sd/source/ui/view/drviewsb.cxx
index e0412ae11acc..258eaeab56f1 100644
--- a/sd/source/ui/view/drviewsb.cxx
+++ b/sd/source/ui/view/drviewsb.cxx
@@ -76,7 +76,7 @@ bool DrawViewShell::RenameSlide( sal_uInt16 nPageId, const OUString & rName )
if( GetEditMode() == EditMode::Page )
{
- pPageToRename = GetDoc()->GetSdPage( nPageId - 1, ePageKind );
+ pPageToRename = GetDoc()->GetSdPage( maTabControl->GetPagePos(nPageId), ePageKind );
// Undo
SdPage* pUndoPage = pPageToRename;
@@ -98,14 +98,14 @@ bool DrawViewShell::RenameSlide( sal_uInt16 nPageId, const OUString & rName )
if( ePageKind == PageKind::Standard )
{
// also rename notes-page
- SdPage* pNotesPage = GetDoc()->GetSdPage( nPageId - 1, PageKind::Notes );
+ SdPage* pNotesPage = GetDoc()->GetSdPage( maTabControl->GetPagePos(nPageId), PageKind::Notes );
pNotesPage->SetName( rName );
}
}
else
{
// rename MasterPage -> rename LayoutTemplate
- pPageToRename = GetDoc()->GetMasterSdPage( nPageId - 1, ePageKind );
+ pPageToRename = GetDoc()->GetMasterSdPage( maTabControl->GetPagePos(nPageId), ePageKind );
GetDoc()->RenameLayoutTemplate( pPageToRename->GetLayoutName(), rName );
}
@@ -131,7 +131,7 @@ bool DrawViewShell::RenameSlide( sal_uInt16 nPageId, const OUString & rName )
if (pSlideSorterViewShell != nullptr)
{
pSlideSorterViewShell->GetSlideSorter().GetController().PageNameHasChanged(
- nPageId-1, rName);
+ maTabControl->GetPagePos(nPageId), rName);
}
}
@@ -143,7 +143,7 @@ IMPL_LINK( DrawViewShell, RenameSlideHdl, AbstractSvxNameDialog&, rDialog, bool
OUString aNewName;
rDialog.GetName( aNewName );
- SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl->GetCurPageId() - 1, GetPageKind() );
+ SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl->GetCurPagePos(), GetPageKind() );
return pCurrentPage && ( aNewName == pCurrentPage->GetName() || GetDocSh()->IsNewPageNameValid( aNewName ) );
}