diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-04-23 14:54:42 +0530 |
---|---|---|
committer | pranavk <pranavk@collabora.co.uk> | 2017-05-01 06:46:19 +0200 |
commit | c454fbb9b62164d5f047990ae63522c9fb932086 (patch) | |
tree | 682c263be6e283fd4ad04e509548abd520595f16 /sd | |
parent | 862b6c0a32dfce924bfafa84acaed47c5380fc46 (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')
-rw-r--r-- | sd/inc/sdpage.hxx | 6 | ||||
-rw-r--r-- | sd/qa/unit/tiledrendering/data/dummy.odp | bin | 10727 -> 10763 bytes | |||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 52 | ||||
-rw-r--r-- | sd/source/core/sdpage.cxx | 3 | ||||
-rw-r--r-- | sd/source/core/sdpage2.cxx | 1 | ||||
-rw-r--r-- | sd/source/ui/inc/DrawViewShell.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/uitest/uiobject.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/Outliner.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/OutlinerIterator.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellBase.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/view/drviews1.cxx | 76 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/view/drviews3.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviews4.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviews5.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsa.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsb.cxx | 10 |
18 files changed, 124 insertions, 58 deletions
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx index df89127d80b8..0fb422bb1546 100644 --- a/sd/inc/sdpage.hxx +++ b/sd/inc/sdpage.hxx @@ -377,10 +377,16 @@ public: const sd::AnnotationVector& getAnnotations() const { return maAnnotations; } OString stringify() const; virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const override; + sal_uInt16 getPageId() { return mnPageId; } + + static sal_uInt16 mnLastPageId; private: bool mbIsPrecious; + // page id of this page + sal_uInt16 mnPageId; + /** clone the animations from this and set them to rTargetPage */ void cloneAnimations( SdPage& rTargetPage ) const; diff --git a/sd/qa/unit/tiledrendering/data/dummy.odp b/sd/qa/unit/tiledrendering/data/dummy.odp Binary files differindex 12cd67947df5..83dee413c5ed 100644 --- a/sd/qa/unit/tiledrendering/data/dummy.odp +++ b/sd/qa/unit/tiledrendering/data/dummy.odp diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index d1aeb4b4360a..08e1bc197dd6 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -44,6 +44,8 @@ #include <undo/undomanager.hxx> #include <sfx2/request.hxx> #include <svx/svxids.hrc> +#include <DrawViewShell.hxx> +#include <pres.hxx> #include <chrono> @@ -97,6 +99,7 @@ public: void testTdf81754(); void testTdf105502(); void testCommentCallbacks(); + void testMultiViewInsertDeletePage(); CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -132,6 +135,7 @@ public: CPPUNIT_TEST(testTdf81754); CPPUNIT_TEST(testTdf105502); CPPUNIT_TEST(testCommentCallbacks); + CPPUNIT_TEST(testMultiViewInsertDeletePage); CPPUNIT_TEST_SUITE_END(); @@ -1708,6 +1712,54 @@ void SdTiledRenderingTest::testCommentCallbacks() comphelper::LibreOfficeKit::setActive(false); } +void SdTiledRenderingTest::testMultiViewInsertDeletePage() +{ + // Load the document. + comphelper::LibreOfficeKit::setActive(); + SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp"); + ViewCallback aView1; + int nView1 = SfxLokHelper::getView(); + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1); + uno::Sequence<beans::PropertyValue> aArgs; + SdDrawDocument* pDoc = pXImpressDocument->GetDocShell()->GetDoc(); + + // Create second view + SfxLokHelper::createView(); + pXImpressDocument->initializeForTiledRendering(aArgs); + ViewCallback aView2; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2); + int nView2 = SfxLokHelper::getView(); + + // the document has 8 slides + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(8), pDoc->GetSdPageCount(PageKind::Standard)); + + // Switch to 5th page in 2nd view + pXImpressDocument->setPart(4); + + // Insert slide in 1st view + SfxLokHelper::setView(nView1); + comphelper::dispatchCommand(".uno:InsertPage", aArgs); + Scheduler::ProcessEventsToIdle(); + + // See if the current slide number changed in 2nd view too + SfxLokHelper::setView(nView2); + CPPUNIT_ASSERT_EQUAL(5, pXImpressDocument->getPart()); + + // Delete the page in 1st view now + SfxLokHelper::setView(nView1); + comphelper::dispatchCommand(".uno:DeletePage", aArgs); + Scheduler::ProcessEventsToIdle(); + + // See if current slide number changed in 2nd view too + SfxLokHelper::setView(nView2); + CPPUNIT_ASSERT_EQUAL(4, pXImpressDocument->getPart()); + + mxComponent->dispose(); + mxComponent.clear(); + + comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 94f685683026..907b96ee8963 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -90,6 +90,8 @@ using namespace com::sun::star::xml::dom; using ::com::sun::star::uno::Reference; +sal_uInt16 SdPage::mnLastPageId = 1; + /************************************************************************* |* |* Ctor @@ -120,6 +122,7 @@ SdPage::SdPage(SdDrawDocument& rNewDoc, bool bMasterPage) , mnTransitionFadeColor(0) , mfTransitionDuration(2.0) , mbIsPrecious(true) +, mnPageId(mnLastPageId++) { // The name of the layout of the page is used by SVDRAW to determine the // presentation template of the outline objects. Therefore, it already diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx index e8f119fa5d3e..33c736b7162e 100644 --- a/sd/source/core/sdpage2.cxx +++ b/sd/source/core/sdpage2.cxx @@ -370,6 +370,7 @@ SdPage::SdPage(const SdPage& rSrcPage) : FmFormPage(rSrcPage) , SdrObjUserCall() , mpItems(nullptr) +, mnPageId(mnLastPageId++) { mePageKind = rSrcPage.mePageKind; meAutoLayout = rSrcPage.meAutoLayout; diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index 82cc8aed9d05..6178bde590b8 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -271,6 +271,7 @@ public: bool IsInputLocked() const { return mnLockCount > 0UL; } sal_uInt16 GetCurPageId() { return maTabControl->GetCurPageId(); } + sal_uInt16 GetCurPagePos() { return maTabControl->GetCurPagePos(); } /** Show controls of the UI or hide them, depending on the given flag. Do not call this method directly. Call the method at ViewShellBase diff --git a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx index 40a8616adcd2..47d2aa64e00c 100644 --- a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx @@ -173,7 +173,8 @@ void CurrentSlideManager::SetCurrentSlideAtViewShellBase (const SharedPageDescri { sal_uInt16 nPageNumber = (rpDescriptor->GetPage()->GetPageNum()-1)/2; pDrawViewShell->SwitchPage(nPageNumber); - pDrawViewShell->GetPageTabControl().SetCurPageId(nPageNumber+1); + TabControl& rPageTabControl = pDrawViewShell->GetPageTabControl(); + rPageTabControl.SetCurPageId(rPageTabControl.GetPageId(nPageNumber)); } } } @@ -190,7 +191,8 @@ void CurrentSlideManager::SetCurrentSlideAtTabControl (const SharedPageDescripto if (pDrawViewShell) { sal_uInt16 nPageNumber = (rpDescriptor->GetPage()->GetPageNum()-1)/2; - pDrawViewShell->GetPageTabControl().SetCurPageId(nPageNumber+1); + TabControl& rPageTabControl = pDrawViewShell->GetPageTabControl(); + rPageTabControl.SetCurPageId(rPageTabControl.GetPageId(nPageNumber)); } } } diff --git a/sd/source/ui/uitest/uiobject.cxx b/sd/source/ui/uitest/uiobject.cxx index 2a564c2c68fb..68575ccc75fd 100644 --- a/sd/source/ui/uitest/uiobject.cxx +++ b/sd/source/ui/uitest/uiobject.cxx @@ -90,7 +90,7 @@ StringMap ImpressWindowUIObject::get_state() StringMap aMap = WindowUIObject::get_state(); aMap["SelectedText"] = getViewShell(mxWindow)->GetSelectionText(false); - aMap["CurrentSlide"] = OUString::number(getViewShell(mxWindow)->GetCurPageId()); + aMap["CurrentSlide"] = OUString::number(getViewShell(mxWindow)->GetCurPagePos() + 1); aMap["Zoom"] = OUString::number(getViewShell(mxWindow)->GetZoom()); return aMap; diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index e6b58ec9391e..919958fa7476 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -962,7 +962,7 @@ void SdOutliner::RememberStartPosition() { meStartViewMode = pDrawViewShell->GetPageKind(); meStartEditMode = pDrawViewShell->GetEditMode(); - mnStartPageIndex = pDrawViewShell->GetCurPageId() - 1; + mnStartPageIndex = pDrawViewShell->GetCurPagePos(); } if (mpView != nullptr) diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx index d81f60b8a104..0126a1d3a57b 100644 --- a/sd/source/ui/view/OutlinerIterator.cxx +++ b/sd/source/ui/view/OutlinerIterator.cxx @@ -316,7 +316,7 @@ sal_Int32 OutlinerContainer::GetPageIndex ( { case CURRENT: if (pDrawViewShell.get()) - nPageIndex = pDrawViewShell->GetCurPageId() - 1; + nPageIndex = pDrawViewShell->GetCurPagePos(); else { const SdPage* pPage = rpViewShell->GetActualPage(); diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 073735c1dad1..9487cba4ddb8 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -977,8 +977,7 @@ int ViewShellBase::getPart() const if (DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pViewShell)) { - // curPageId seems to start at 1 - return pDrawViewShell->GetCurPageId() - 1; + return pDrawViewShell->GetCurPagePos(); } return 0; diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 062cf7235c40..2ea8063470ab 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -328,7 +328,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) { ViewShellManager::UpdateLock aLock (GetViewShellBase().GetViewShellManager()); - sal_uInt16 nActualPageNum = 0; + sal_uInt16 nActualPageId = maTabControl->GetPageId(0); GetViewShellBase().GetDrawController().FireChangeEditMode (eEMode == EditMode::MasterPage); GetViewShellBase().GetDrawController().FireChangeLayerMode (bIsLayerModeActive); @@ -397,17 +397,17 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) { pPage = GetDoc()->GetSdPage(i, mePageKind); OUString aPageName = pPage->GetName(); - maTabControl->InsertPage(i + 1, aPageName); + maTabControl->InsertPage(pPage->getPageId(), aPageName); - if ( pPage->IsSelected() && nActualPageNum == 0 ) + if ( pPage->IsSelected() ) { - nActualPageNum = i; + nActualPageId = pPage->getPageId(); } } - maTabControl->SetCurPageId(nActualPageNum + 1); + maTabControl->SetCurPageId(nActualPageId); - SwitchPage(nActualPageNum); + SwitchPage(maTabControl->GetPagePos(nActualPageId)); //tdf#102343 re-enable common undo on switch back from master mode mpDrawView->GetModel()->SetDisableTextEditUsesCommonUndoManager(false); @@ -427,7 +427,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) } maTabControl->Clear(); - sal_uInt16 nActualMasterPageNum = 0; + sal_uInt16 nActualMasterPageId = maTabControl->GetPageId(0); sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); for (sal_uInt16 i = 0; i < nMasterPageCnt; i++) @@ -438,16 +438,16 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) if (nPos != -1) aLayoutName = aLayoutName.copy(0, nPos); - maTabControl->InsertPage(i + 1, aLayoutName); + maTabControl->InsertPage(pMaster->getPageId(), aLayoutName); if (&(mpActualPage->TRG_GetMasterPage()) == pMaster) { - nActualMasterPageNum = i; + nActualMasterPageId = pMaster->getPageId(); } } - maTabControl->SetCurPageId(nActualMasterPageNum + 1); - SwitchPage(nActualMasterPageNum); + maTabControl->SetCurPageId(nActualMasterPageId); + SwitchPage(maTabControl->GetPagePos(nActualMasterPageId)); //tdf#102343 changing attributes of textboxes in master typically //changes the stylesheet they are linked to, so if the common @@ -477,7 +477,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) // Set the tab control only for draw pages. For master page // this has been done already above. if (meEditMode == EditMode::Page) - maTabControl->SetCurPageId (nActualPageNum + 1); + maTabControl->SetCurPageId (nActualPageId); } ResetActualLayer(); @@ -494,6 +494,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) SetContextName(GetSidebarContextName()); } + } /** @@ -625,7 +626,7 @@ SdPage* DrawViewShell::getCurrentPage() const GetDoc()->GetSdPageCount(mePageKind): GetDoc()->GetMasterSdPageCount(mePageKind); - sal_Int32 nCurrentPage = maTabControl->GetCurPageId() - 1; + sal_Int32 nCurrentPage = maTabControl->GetCurPagePos(); DBG_ASSERT( (nPageCount>0) && (nCurrentPage<nPageCount), "sd::DrawViewShell::getCurrentPage(), illegal page index!" ); if( (nPageCount < 0) || (nCurrentPage>=nPageCount) ) nCurrentPage = 0; // play safe here @@ -649,12 +650,9 @@ void DrawViewShell::ResetActualPage() if (!GetDoc()) return; - sal_uInt16 nCurrentPage = maTabControl->GetCurPageId() - 1; + sal_uInt16 nCurrentPageId = maTabControl->GetCurPageId(); + sal_uInt16 nCurrentPageNum = maTabControl->GetPagePos(nCurrentPageId); sal_uInt16 nPageCount = (meEditMode == EditMode::Page)?GetDoc()->GetSdPageCount(mePageKind):GetDoc()->GetMasterSdPageCount(mePageKind); - if (nPageCount > 0) - nCurrentPage = std::min((sal_uInt16)(nPageCount - 1), nCurrentPage); - else - nCurrentPage = 0; if (meEditMode == EditMode::Page) { @@ -668,19 +666,22 @@ void DrawViewShell::ResetActualPage() { pPage = GetDoc()->GetSdPage(i, mePageKind); OUString aPageName = pPage->GetName(); - maTabControl->InsertPage(i + 1, aPageName); + maTabControl->InsertPage(pPage->getPageId(), aPageName); - // correct selection recognition of the pages - GetDoc()->SetSelected(pPage, i == nCurrentPage); + if (nCurrentPageId == pPage->getPageId()) + { + nCurrentPageNum = i; + GetDoc()->SetSelected(pPage, true); + } + else + GetDoc()->SetSelected(pPage, false); } - maTabControl->SetCurPageId(nCurrentPage + 1); + maTabControl->SetCurPageId(maTabControl->GetPageId(nCurrentPageNum)); } else // EditMode::MasterPage { - SdPage* pActualPage = GetDoc()->GetMasterSdPage(nCurrentPage, mePageKind); maTabControl->Clear(); - sal_uInt16 nActualMasterPageNum = 0; sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); for (sal_uInt16 i = 0; i < nMasterPageCnt; i++) @@ -690,14 +691,14 @@ void DrawViewShell::ResetActualPage() sal_Int32 nPos = aLayoutName.indexOf(SD_LT_SEPARATOR); if (nPos != -1) aLayoutName = aLayoutName.copy(0, nPos); - maTabControl->InsertPage(i + 1, aLayoutName); + maTabControl->InsertPage(pMaster->getPageId(), aLayoutName); - if (pActualPage == pMaster) - nActualMasterPageNum = i; + if (pMaster->getPageId() == nCurrentPageId) + nCurrentPageNum = i; } - maTabControl->SetCurPageId(nActualMasterPageNum + 1); - SwitchPage(nActualMasterPageNum); + maTabControl->SetCurPageId(maTabControl->GetPageId(nCurrentPageNum)); + SwitchPage(nCurrentPageNum); } GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHPAGE, @@ -767,6 +768,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) 83888 for details.) Therefore the nested calls are ignored (they would jump to the wrong page anyway.) */ + if (mbIsInSwitchPage) return false; mbIsInSwitchPage = true; @@ -831,7 +833,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) sPageText = sPageText.copy(0, nPos); if (pPV && pNewPage == dynamic_cast< SdPage* >( pPV->GetPage() ) - && sPageText == maTabControl->GetPageText(nSelectedPage+1)) + && sPageText == maTabControl->GetPageText(maTabControl->GetPageId(nSelectedPage))) { // this slide is already visible return true; @@ -853,7 +855,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) SdPage* pCurrentPage = pPV ? dynamic_cast<SdPage*>(pPV->GetPage()) : nullptr; if (pCurrentPage && pNewPage == pCurrentPage - && maTabControl->GetPageText(nSelectedPage+1).equals(pNewPage->GetName())) + && maTabControl->GetPageText(maTabControl->GetPageId(nSelectedPage)).equals(pNewPage->GetName())) { // this slide is already visible return true; @@ -965,7 +967,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) } mpDrawView->HideSdrPage(); - maTabControl->SetCurPageId(nSelectedPage+1); + maTabControl->SetCurPageId(maTabControl->GetPageId(nSelectedPage)); mpDrawView->ShowSdrPage(mpActualPage); GetViewShellBase().GetDrawController().FireSwitchCurrentPage(mpActualPage); @@ -993,9 +995,9 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) OUString aPageName = mpActualPage->GetName(); - if (maTabControl->GetPageText(nSelectedPage+1) != aPageName) + if (maTabControl->GetPageText(maTabControl->GetPageId(nSelectedPage)) != aPageName) { - maTabControl->SetPageText(nSelectedPage+1, aPageName); + maTabControl->SetPageText(maTabControl->GetPageId(nSelectedPage), aPageName); } } else @@ -1026,7 +1028,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) } mpDrawView->HideSdrPage(); - maTabControl->SetCurPageId(nSelectedPage+1); + maTabControl->SetCurPageId(maTabControl->GetPageId(nSelectedPage)); SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind); @@ -1065,9 +1067,9 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) if (nPos != -1) aLayoutName = aLayoutName.copy(0, nPos); - if (maTabControl->GetPageText(nSelectedPage+1) != aLayoutName) + if (maTabControl->GetPageText(maTabControl->GetPageId(nSelectedPage)) != aLayoutName) { - maTabControl->SetPageText(nSelectedPage+1, aLayoutName); + maTabControl->SetPageText(maTabControl->GetPageId(nSelectedPage), aLayoutName); } if( mePageKind == PageKind::Handout ) diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index fa8024e0a8c9..938cb6c5b842 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -383,7 +383,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { mpDrawView->SdrEndTextEdit(); } - sal_uInt16 nPage = maTabControl->GetCurPageId() - 1; + sal_uInt16 nPage = maTabControl->GetCurPagePos(); mpActualPage = GetDoc()->GetSdPage(nPage, mePageKind); ::sd::ViewShell::mpImpl->ProcessModifyPageSlot ( rReq, @@ -420,10 +420,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) mpDrawView->SdrEndTextEdit(); } - sal_uInt16 nPageId = maTabControl->GetCurPageId(); + sal_uInt16 nPage = maTabControl->GetCurPagePos(); SdPage* pCurrentPage = ( GetEditMode() == EditMode::Page ) - ? GetDoc()->GetSdPage( nPageId - 1, GetPageKind() ) - : GetDoc()->GetMasterSdPage( nPageId - 1, GetPageKind() ); + ? GetDoc()->GetSdPage( nPage, GetPageKind() ) + : GetDoc()->GetMasterSdPage( nPage, GetPageKind() ); OUString aTitle = SD_RESSTR(STR_TITLE_RENAMESLIDE); OUString aDescr = SD_RESSTR(STR_DESC_RENAMESLIDE); @@ -443,7 +443,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) aNameDlg->GetName( aNewName ); if (aNewName != aPageName) { - bool bResult = RenameSlide( nPageId, aNewName ); + bool bResult = RenameSlide( maTabControl->GetPageId(nPage), aNewName ); DBG_ASSERT( bResult, "Couldn't rename slide" ); } } diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 4aff2371708d..2a3aedf19bba 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -142,7 +142,7 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) if (! pArgs) { - nSelectedPage = maTabControl->GetCurPageId() - 1; + nSelectedPage = maTabControl->GetCurPagePos(); } else if (pArgs->Count () == 2) { diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 064c9a611fe6..825dbf1d2bbd 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -74,7 +74,7 @@ using namespace ::com::sun::star::drawing; void DrawViewShell::DeleteActualPage() { - sal_uInt16 nPage = maTabControl->GetCurPageId() - 1; + sal_uInt16 nPage = maTabControl->GetCurPagePos(); mpDrawView->SdrEndTextEdit(); diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index bf487fba1762..59535abcbe7c 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -354,7 +354,7 @@ void DrawViewShell::WriteFrameViewData() mpFrameView->SetSelectedPage(0); else { - mpFrameView->SetSelectedPage( maTabControl->GetCurPageId() - 1 ); + mpFrameView->SetSelectedPage( maTabControl->GetCurPagePos() ); } mpFrameView->SetViewShEditMode(meEditMode); diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 24269c22ef43..5c8832a5b111 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -657,7 +657,7 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) // Always show the slide/page number. OUString aOUString = (nPageCount == nActivePageCount) ? SD_RESSTR(STR_SD_PAGE_COUNT) : SD_RESSTR(STR_SD_PAGE_COUNT_CUSTOM); - aOUString = aOUString.replaceFirst("%1", OUString::number(maTabControl->GetCurPageId())); + aOUString = aOUString.replaceFirst("%1", OUString::number(maTabControl->GetCurPagePos() + 1)); aOUString = aOUString.replaceFirst("%2", OUString::number(nPageCount)); if(nPageCount != nActivePageCount) aOUString = aOUString.replaceFirst("%3", OUString::number(nActivePageCount)); 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 ) ); } |