summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-05-07 14:37:36 +0100
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2015-05-12 13:30:36 +0000
commit0be1277c5ad9f3ea2e8ff78c12431f8c512293cc (patch)
tree2c486962043a4c60c647e22b52d7ce6e8ba45f9b
parente2bf47485575befd57b027a5339c35d6aa905680 (diff)
Resolves: tdf#72007: on switching decks keep our left indent, don't assume 0
Change-Id: I878c999611e1294d5107f1cf2c000d9ed5f88cb1 (cherry picked from commit 4073afa350387f9fc9194347ad78c6cbdabbb812) Related: tdf#72007 align to right if undocked Change-Id: Ia0af0493e0af6c945006e6a1f6f918f7b104068d (cherry picked from commit 8b867887022903bc5788b01db51dfcec521dc878) Reviewed-on: https://gerrit.libreoffice.org/15689 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx90
1 files changed, 37 insertions, 53 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 620bfeb55993..5f275ee0e706 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -344,62 +344,33 @@ void SidebarController::NotifyResize (void)
if (mpCurrentDeck)
{
SfxSplitWindow* pSplitWindow = GetSplitWindow();
- if (pSplitWindow) //in sidebar mode
+ WindowAlign eAlign = pSplitWindow ? pSplitWindow->GetAlign() : WINDOWALIGN_RIGHT;
+ 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.
@@ -693,11 +664,24 @@ void SidebarController::SwitchToDeck (
}
aNewPanels.resize(nWriteIndex);
+ SfxSplitWindow* pSplitWindow = GetSplitWindow();
+ sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor();
+ WindowAlign eAlign = pSplitWindow ? pSplitWindow->GetAlign() : WINDOWALIGN_RIGHT;
+ 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->SetPanels(aNewPanels);