diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-05-07 14:37:36 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-05-07 14:38:16 +0100 |
commit | 4073afa350387f9fc9194347ad78c6cbdabbb812 (patch) | |
tree | c99cf277d9a54b3f984ed93c1eea3df63d1b6cb4 | |
parent | 0776b33f79327936e0bbf26acc73f2f0db45b9c8 (diff) |
Resolves: tdf#72007: on switching decks keep our left indent, don't assume 0
Change-Id: I878c999611e1294d5107f1cf2c000d9ed5f88cb1
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 90 |
1 files changed, 37 insertions, 53 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 682049cc341e..e34f44c02b6b 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -324,62 +324,33 @@ void SidebarController::NotifyResize() if (mpCurrentDeck) { SfxSplitWindow* pSplitWindow = GetSplitWindow(); - if (pSplitWindow) //in sidebar mode + WindowAlign eAlign = pSplitWindow ? pSplitWindow->GetAlign() : WINDOWALIGN_LEFT; + long nDeckX, nTabX; + if (eAlign == WINDOWALIGN_LEFT) // attach the Sidebar towards the left-side of screen { - // Find out that which side of the Window do we need to attach the Sidebar? - if ( pSplitWindow->GetAlign() == WINDOWALIGN_RIGHT ) // attach the Sidebar towards the right-side of screen - { - // Place the deck first. - { - if (bIsDeckVisible) - { - mpCurrentDeck->setPosSizePixel(0,0, nWidth-nTabBarDefaultWidth, nHeight); - mpCurrentDeck->Show(); - mpCurrentDeck->RequestLayout(); - } - else - mpCurrentDeck->Hide(); - } - - // Now place the tab bar. - mpTabBar->setPosSizePixel(nWidth-nTabBarDefaultWidth,0,nTabBarDefaultWidth,nHeight); - mpTabBar->Show(); - } - else if ( pSplitWindow->GetAlign() == WINDOWALIGN_LEFT) // attach the Sidebar towards the left-side of screen - { - // Place the tab bar first. - mpTabBar->setPosSizePixel(0,0,nTabBarDefaultWidth,nHeight); - mpTabBar->Show(); - - // Now place the deck. - if (bIsDeckVisible) - { - mpCurrentDeck->setPosSizePixel(nTabBarDefaultWidth,0, nWidth-nTabBarDefaultWidth, nHeight); - mpCurrentDeck->Show(); - mpCurrentDeck->RequestLayout(); - } - else - mpCurrentDeck->Hide(); - } + nDeckX = nTabBarDefaultWidth; + nTabX = 0; } - else //floating window mode + else // attach the Sidebar towards the right-side of screen { - // Place the deck first. - { - if (bIsDeckVisible) - { - mpCurrentDeck->setPosSizePixel(0,0, nWidth-nTabBarDefaultWidth, nHeight); - mpCurrentDeck->Show(); - mpCurrentDeck->RequestLayout(); - } - else - mpCurrentDeck->Hide(); - } + nDeckX = 0; + nTabX = nWidth-nTabBarDefaultWidth; + } - // Now place the tab bar. - mpTabBar->setPosSizePixel(nWidth-nTabBarDefaultWidth,0,nTabBarDefaultWidth,nHeight); - mpTabBar->Show(); + // Place the deck first. + if (bIsDeckVisible) + { + mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth - nTabBarDefaultWidth, nHeight); + mpCurrentDeck->Show(); + mpCurrentDeck->RequestLayout(); } + else + mpCurrentDeck->Hide(); + + // Now place the tab bar. + mpTabBar->setPosSizePixel(nTabX, 0, nTabBarDefaultWidth, nHeight); + mpTabBar->Show(); + } // Determine if the closer of the deck can be shown. @@ -658,11 +629,24 @@ void SidebarController::SwitchToDeck ( // mpCurrentPanels - may miss stuff (?) aNewPanels.resize(nWriteIndex); + SfxSplitWindow* pSplitWindow = GetSplitWindow(); + sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor(); + WindowAlign eAlign = pSplitWindow ? pSplitWindow->GetAlign() : WINDOWALIGN_LEFT; + long nDeckX; + if (eAlign == WINDOWALIGN_LEFT) // attach the Sidebar towards the left-side of screen + { + nDeckX = nTabBarDefaultWidth; + } + else // attach the Sidebar towards the right-side of screen + { + nDeckX = 0; + } + // Activate the deck and the new set of panels. mpCurrentDeck->setPosSizePixel( + nDeckX, 0, - 0, - mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor(), + mpParentWindow->GetSizePixel().Width() - nTabBarDefaultWidth, mpParentWindow->GetSizePixel().Height()); mpCurrentDeck->ResetPanels(aNewPanels); |