Kaydet (Commit) 2b34b48a authored tarafından Caolán McNamara's avatar Caolán McNamara

try to get reasonable sizes for docking windows

start docked, move to undocked
start undocked, move to dock, back to undocked
start undocked, with and without size saved in settings and restored

Change-Id: I0bfdceb11aabdf9fdb855b97433b2af0532e4d03
üst 29ebb0ea
......@@ -361,6 +361,7 @@ public:
virtual void SetText( const OUString& rStr ) SAL_OVERRIDE;
virtual OUString GetText() const SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
};
inline void DockingWindow::SetPin( bool bPin )
......
......@@ -1209,11 +1209,9 @@ void SfxDockingWindow::Initialize_Impl()
// trick: use VCL method SetWindowState to adjust position and size
pFloatWin->SetWindowState( pImp->aWinState );
Size aSize(pFloatWin->GetSizePixel());
pFloatWin->set_width_request(aSize.Width());
pFloatWin->set_height_request(aSize.Height());
// remember floating size for calculating alignment and tracking rectangle
SetFloatingSize( pFloatWin->GetSizePixel() );
SetFloatingSize(aSize);
}
......@@ -1221,8 +1219,6 @@ void SfxDockingWindow::Initialize_Impl()
pImp->bConstructed = true;
}
void SfxDockingWindow::FillInfo(SfxChildWinInfo& rInfo) const
/* [Description]
......
......@@ -624,7 +624,7 @@ void SmElementsControl::build()
Size SmElementsControl::GetOptimalSize() const
{
return LogicToPixel(Size(300, 300), MapMode(MAP_APPFONT));
return LogicToPixel(Size(100, 100), MapMode(MAP_APPFONT));
}
const sal_uInt16 SmElementsDockingWindow::aCategories[] = {
......
......@@ -833,9 +833,6 @@ void DockingWindow::SetFloatingMode( bool bFloatMode )
pWin->SetRollUpOutputSizePixel( maRollUpOutSize );
pWin->SetMinOutputSizePixel( maMinOutSize );
pWin->set_width_request(std::max(aSize.Width(), maMinOutSize.Width()));
pWin->set_height_request(std::max(aSize.Height(), maMinOutSize.Height()));
pWin->SetMaxOutputSizePixel( mpImplData->maMaxOutSize );
ToggleFloatingMode();
......@@ -1106,4 +1103,21 @@ void DockingWindow::setPosSizeOnContainee(Size aSize, Window &rBox)
VclContainer::setLayoutAllocation(rBox, aPos, aSize);
}
Size DockingWindow::GetOptimalSize() const
{
if (!isLayoutEnabled())
return Window::GetOptimalSize();
Size aSize = VclContainer::getLayoutRequisition(*GetWindow(WINDOW_FIRSTCHILD));
sal_Int32 nBorderWidth = get_border_width();
aSize.Height() += mpWindowImpl->mnLeftBorder + mpWindowImpl->mnRightBorder
+ 2*nBorderWidth;
aSize.Width() += mpWindowImpl->mnTopBorder + mpWindowImpl->mnBottomBorder
+ 2*nBorderWidth;
return Window::CalcWindowSize(aSize);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment