diff options
author | Prashant Pandey <prashant3.yishu@gmail.com> | 2013-09-14 23:16:38 +0530 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-30 19:51:35 +0000 |
commit | 8965bfda9753568a038303d9935f7a451282a857 (patch) | |
tree | 4350cf84659527db3227b318b17f7e422394ef36 | |
parent | 762274102c74169b3be5518bc69b5fb03708ea9c (diff) |
Fixing the problem with Sidebar-alignment
Currently, when the sidebar is taken from right side of
the screen to left side of the screen, the vertical tab
-bar is still attached towards the right side of deck.
Ideally, when the sidebar is attched towards the left
side of the screen, the tab-bar should automatically set
towards the left side of deck.
Change-Id: I1f56e5f0b7dfef37760e6563e7d757f7901cf2cd
Reviewed-on: https://gerrit.libreoffice.org/5979
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 9dbb17843422..02bd0760f979 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -361,22 +361,45 @@ void SidebarController::NotifyResize (void) else bIsDeckVisible = false; - // Place the deck. - if (mpCurrentDeck) + SfxSplitWindow* pSplitWindow = GetSplitWindow(); + if ( mpCurrentDeck && pSplitWindow ) { - if (bIsDeckVisible) + // 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 { - mpCurrentDeck->setPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight); - mpCurrentDeck->Show(); - mpCurrentDeck->RequestLayout(); + // Place the deck first. + { + if (bIsDeckVisible) + { + mpCurrentDeck->setPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight); + mpCurrentDeck->Show(); + mpCurrentDeck->RequestLayout(); + } + else + mpCurrentDeck->Hide(); + } + + // Now place the tab bar. + mpTabBar->setPosSizePixel(nWidth-TabBar::GetDefaultWidth(),0,TabBar::GetDefaultWidth(),nHeight); + mpTabBar->Show(); } - else - mpCurrentDeck->Hide(); - } + else if ( pSplitWindow->GetAlign() == WINDOWALIGN_LEFT) // attach the Sidebar towards the left-side of screen + { + // Place the tab bar first. + mpTabBar->setPosSizePixel(0,0,TabBar::GetDefaultWidth(),nHeight); + mpTabBar->Show(); - // Place the tab bar. - mpTabBar->setPosSizePixel(nWidth-TabBar::GetDefaultWidth(),0,TabBar::GetDefaultWidth(),nHeight); - mpTabBar->Show(); + // Now place the deck. + if (bIsDeckVisible) + { + mpCurrentDeck->setPosSizePixel(TabBar::GetDefaultWidth(),0, nWidth-TabBar::GetDefaultWidth(), nHeight); + mpCurrentDeck->Show(); + mpCurrentDeck->RequestLayout(); + } + else + mpCurrentDeck->Hide(); + } + } // Determine if the closer of the deck can be shown. sal_Int32 nMinimalWidth = 0; @@ -667,6 +690,7 @@ void SidebarController::SwitchToDeck ( 0, mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth(), mpParentWindow->GetSizePixel().Height()); + mpCurrentDeck->SetPanels(aNewPanels); mpCurrentDeck->Show(); |