diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-09-16 10:14:06 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-16 11:33:20 +0100 |
commit | 363446eb61de141deb1364805e0d7cd0e1f6d7fe (patch) | |
tree | ee1d0e11a8c3b99fe3ebf3b9ec2e85c6be1a6d6e /svx/source/sidebar/PanelLayout.cxx | |
parent | 6eb840cc540bb6f2efcebc0349a8e6e7ba074cd8 (diff) |
Resolves: fdo#69236 route size request to layout widget, not hard-coded value
a) For the sidebar the sidebars automatically handle scrolling, but for the
older panel the widgets has to do the scrolling so add scrolling parents to the
.ui
b) Fold the DialogListBox scrolling widget implementation into
VclScrolledWindow and remove the duplication.
Change-Id: Ife9ccd8c501e5dee7bf3102a92c8261d979cd834
Diffstat (limited to 'svx/source/sidebar/PanelLayout.cxx')
-rw-r--r-- | svx/source/sidebar/PanelLayout.cxx | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx index 2c5a5bbe563f..9712b260867a 100644 --- a/svx/source/sidebar/PanelLayout.cxx +++ b/svx/source/sidebar/PanelLayout.cxx @@ -27,14 +27,31 @@ Size PanelLayout::GetOptimalSize() const void PanelLayout::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags) { + bool bCanHandleSmallerWidth = false; + bool bCanHandleSmallerHeight = false; + + bool bIsLayoutEnabled = isLayoutEnabled(this); + Window *pChild = GetWindow(WINDOW_FIRSTCHILD); + + if (bIsLayoutEnabled && pChild->GetType() == WINDOW_SCROLLWINDOW) + { + WinBits nStyle = pChild->GetStyle(); + if (nStyle && (WB_AUTOHSCROLL | WB_HSCROLL)) + bCanHandleSmallerWidth = true; + if (nStyle && (WB_AUTOVSCROLL | WB_VSCROLL)) + bCanHandleSmallerHeight = true; + } + Size aSize(GetOptimalSize()); - nWidth = std::max(nWidth,aSize.Width()); - nHeight = std::max(nHeight,aSize.Height()); + if (!bCanHandleSmallerWidth) + nWidth = std::max(nWidth,aSize.Width()); + if (!bCanHandleSmallerHeight) + nHeight = std::max(nHeight,aSize.Height()); Control::setPosSizePixel(nX, nY, nWidth, nHeight, nFlags); - if (isLayoutEnabled(this) && (nFlags & WINDOW_POSSIZE_SIZE)) - VclContainer::setLayoutAllocation(*GetWindow(WINDOW_FIRSTCHILD), Point(0, 0), Size(nWidth, nHeight)); + if (bIsLayoutEnabled && (nFlags & WINDOW_POSSIZE_SIZE)) + VclContainer::setLayoutAllocation(*pChild, Point(0, 0), Size(nWidth, nHeight)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |