merge queue_layout and queue_resize
so that any window derived class, and not just dialogs, can trigger layouting of their children. Merge together the handful of hacked-up impls of this. Do that then for the sidebar PanelLayout so that when the label of the custom animation frame changes that the frame allocates enough space for the new label to display fully Change-Id: I9a95f6c3f60cd6cea47656e66cb9ffcc154a3a5a
This commit is contained in:
@@ -186,7 +186,7 @@ private:
|
|||||||
VectorOfNodes LoadNodes( Module* pModule, const OUString& rExtensionId );
|
VectorOfNodes LoadNodes( Module* pModule, const OUString& rExtensionId );
|
||||||
void InsertNodes( const VectorOfNodes& rNodeList );
|
void InsertNodes( const VectorOfNodes& rNodeList );
|
||||||
|
|
||||||
virtual void queue_layout();
|
virtual void queue_resize();
|
||||||
void SetPaneSize(Window *pPane);
|
void SetPaneSize(Window *pPane);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -930,7 +930,7 @@ bool OfaTreeOptionsDialog::hasTreePendingLayout() const
|
|||||||
return maTreeLayoutTimer.IsActive();
|
return maTreeLayoutTimer.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OfaTreeOptionsDialog::queue_layout()
|
void OfaTreeOptionsDialog::queue_resize()
|
||||||
{
|
{
|
||||||
if (hasTreePendingLayout())
|
if (hasTreePendingLayout())
|
||||||
return;
|
return;
|
||||||
|
@@ -263,7 +263,7 @@ public:
|
|||||||
virtual void ActivatePage();
|
virtual void ActivatePage();
|
||||||
virtual long DeactivatePage();
|
virtual long DeactivatePage();
|
||||||
|
|
||||||
virtual void queue_layout();
|
virtual void queue_resize();
|
||||||
|
|
||||||
sal_Bool ShowPrevPage();
|
sal_Bool ShowPrevPage();
|
||||||
sal_Bool ShowNextPage();
|
sal_Bool ShowNextPage();
|
||||||
|
@@ -14,19 +14,28 @@
|
|||||||
|
|
||||||
#include <vcl/builder.hxx>
|
#include <vcl/builder.hxx>
|
||||||
#include <vcl/ctrl.hxx>
|
#include <vcl/ctrl.hxx>
|
||||||
|
#include <vcl/timer.hxx>
|
||||||
|
|
||||||
#include <com/sun/star/frame/XFrame.hpp>
|
#include <com/sun/star/frame/XFrame.hpp>
|
||||||
|
|
||||||
/// This class is the base for the Widget Layout-based sidebar panels.
|
/// This class is the base for the Widget Layout-based sidebar panels.
|
||||||
class SVX_DLLPUBLIC PanelLayout : public Control, public VclBuilderContainer
|
class SVX_DLLPUBLIC PanelLayout : public Control, public VclBuilderContainer
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
Timer m_aPanelLayoutTimer;
|
||||||
|
bool m_bInClose;
|
||||||
|
bool hasPanelPendingLayout() const;
|
||||||
|
|
||||||
|
DECL_DLLPRIVATE_LINK( ImplHandlePanelLayoutTimerHdl, void* );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PanelLayout(Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
|
PanelLayout(Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
|
||||||
const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame);
|
const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame);
|
||||||
virtual ~PanelLayout() {}
|
virtual ~PanelLayout();
|
||||||
|
|
||||||
virtual Size GetOptimalSize() const;
|
virtual Size GetOptimalSize() const;
|
||||||
virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL);
|
virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL);
|
||||||
|
virtual void queue_resize();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -104,7 +104,7 @@ public:
|
|||||||
bool isLayoutEnabled() const;
|
bool isLayoutEnabled() const;
|
||||||
void setOptimalLayoutSize();
|
void setOptimalLayoutSize();
|
||||||
bool isCalculatingInitialLayoutSize() const { return mbIsCalculatingInitialLayoutSize; }
|
bool isCalculatingInitialLayoutSize() const { return mbIsCalculatingInitialLayoutSize; }
|
||||||
virtual void queue_layout();
|
virtual void queue_resize();
|
||||||
virtual bool set_property(const OString &rKey, const OString &rValue);
|
virtual bool set_property(const OString &rKey, const OString &rValue);
|
||||||
VclButtonBox* get_action_area();
|
VclButtonBox* get_action_area();
|
||||||
VclBox* get_content_area();
|
VclBox* get_content_area();
|
||||||
|
@@ -39,6 +39,8 @@ public:
|
|||||||
{
|
{
|
||||||
m_bLayoutDirty = true;
|
m_bLayoutDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void queue_resize();
|
||||||
protected:
|
protected:
|
||||||
//these are the two that need to be implemented by
|
//these are the two that need to be implemented by
|
||||||
//containers, figure out how much space you want...
|
//containers, figure out how much space you want...
|
||||||
|
@@ -201,6 +201,8 @@ public:
|
|||||||
{
|
{
|
||||||
mbLayoutDirty = true;
|
mbLayoutDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void queue_resize();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SV_TABCTRL_HXX
|
#endif // _SV_TABCTRL_HXX
|
||||||
|
@@ -1074,7 +1074,7 @@ public:
|
|||||||
*
|
*
|
||||||
* akin to gtk_widget_queue_resize
|
* akin to gtk_widget_queue_resize
|
||||||
*/
|
*/
|
||||||
void queue_resize();
|
virtual void queue_resize();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sets the "width-request" property
|
* Sets the "width-request" property
|
||||||
|
@@ -119,7 +119,7 @@ bool WizardDialog::hasWizardPendingLayout() const
|
|||||||
return maWizardLayoutTimer.IsActive();
|
return maWizardLayoutTimer.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WizardDialog::queue_layout()
|
void WizardDialog::queue_resize()
|
||||||
{
|
{
|
||||||
if (hasWizardPendingLayout())
|
if (hasWizardPendingLayout())
|
||||||
return;
|
return;
|
||||||
|
@@ -12,9 +12,18 @@
|
|||||||
|
|
||||||
PanelLayout::PanelLayout(Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame)
|
PanelLayout::PanelLayout(Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame)
|
||||||
: Control(pParent)
|
: Control(pParent)
|
||||||
|
, m_bInClose(false)
|
||||||
{
|
{
|
||||||
SetStyle(GetStyle() | WB_DIALOGCONTROL);
|
SetStyle(GetStyle() | WB_DIALOGCONTROL);
|
||||||
m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame);
|
m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame);
|
||||||
|
m_aPanelLayoutTimer.SetTimeout(50);
|
||||||
|
m_aPanelLayoutTimer.SetTimeoutHdl( LINK( this, PanelLayout, ImplHandlePanelLayoutTimerHdl ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
PanelLayout::~PanelLayout()
|
||||||
|
{
|
||||||
|
m_bInClose = true;
|
||||||
|
m_aPanelLayoutTimer.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
Size PanelLayout::GetOptimalSize() const
|
Size PanelLayout::GetOptimalSize() const
|
||||||
@@ -25,6 +34,30 @@ Size PanelLayout::GetOptimalSize() const
|
|||||||
return Control::GetOptimalSize();
|
return Control::GetOptimalSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PanelLayout::hasPanelPendingLayout() const
|
||||||
|
{
|
||||||
|
return m_aPanelLayoutTimer.IsActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PanelLayout::queue_resize()
|
||||||
|
{
|
||||||
|
if (m_bInClose)
|
||||||
|
return;
|
||||||
|
if (hasPanelPendingLayout())
|
||||||
|
return;
|
||||||
|
if (!isLayoutEnabled(this))
|
||||||
|
return;
|
||||||
|
m_aPanelLayoutTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPL_LINK( PanelLayout, ImplHandlePanelLayoutTimerHdl, void*, EMPTYARG )
|
||||||
|
{
|
||||||
|
Window *pChild = GetWindow(WINDOW_FIRSTCHILD);
|
||||||
|
assert(pChild);
|
||||||
|
VclContainer::setLayoutAllocation(*pChild, Point(0, 0), GetSizePixel());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void PanelLayout::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags)
|
void PanelLayout::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags)
|
||||||
{
|
{
|
||||||
bool bCanHandleSmallerWidth = false;
|
bool bCanHandleSmallerWidth = false;
|
||||||
|
@@ -2361,4 +2361,10 @@ Size TabControl::GetOptimalSize() const
|
|||||||
return calculateRequisition();
|
return calculateRequisition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabControl::queue_resize()
|
||||||
|
{
|
||||||
|
markLayoutDirty();
|
||||||
|
Window::queue_resize();
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -1254,7 +1254,7 @@ IMPL_LINK( Dialog, ImplHandleLayoutTimerHdl, void*, EMPTYARG )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialog::queue_layout()
|
void Dialog::queue_resize()
|
||||||
{
|
{
|
||||||
if (hasPendingLayout() || isCalculatingInitialLayoutSize())
|
if (hasPendingLayout() || isCalculatingInitialLayoutSize())
|
||||||
return;
|
return;
|
||||||
@@ -1267,7 +1267,7 @@ void Dialog::queue_layout()
|
|||||||
|
|
||||||
void Dialog::Resize()
|
void Dialog::Resize()
|
||||||
{
|
{
|
||||||
queue_layout();
|
queue_resize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Dialog::set_property(const OString &rKey, const OString &rValue)
|
bool Dialog::set_property(const OString &rKey, const OString &rValue)
|
||||||
|
@@ -156,6 +156,12 @@ void VclContainer::SetSizePixel(const Size& rAllocation)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VclContainer::queue_resize()
|
||||||
|
{
|
||||||
|
markLayoutDirty();
|
||||||
|
Window::queue_resize();
|
||||||
|
}
|
||||||
|
|
||||||
void VclBox::accumulateMaxes(const Size &rChildSize, Size &rSize) const
|
void VclBox::accumulateMaxes(const Size &rChildSize, Size &rSize) const
|
||||||
{
|
{
|
||||||
long nSecondaryChildDimension = getSecondaryDimension(rChildSize);
|
long nSecondaryChildDimension = getSecondaryDimension(rChildSize);
|
||||||
|
@@ -1732,34 +1732,20 @@ namespace
|
|||||||
{
|
{
|
||||||
bool bSomeoneCares = false;
|
bool bSomeoneCares = false;
|
||||||
|
|
||||||
Dialog *pDialog = NULL;
|
Window *pWindow = pOrigWindow->GetParent();
|
||||||
|
if (pWindow)
|
||||||
Window *pWindow = pOrigWindow;
|
|
||||||
|
|
||||||
while (pWindow)
|
|
||||||
{
|
{
|
||||||
if (isContainerWindow(*pWindow))
|
if (isContainerWindow(*pWindow))
|
||||||
{
|
{
|
||||||
VclContainer *pContainer = static_cast<VclContainer*>(pWindow);
|
|
||||||
pContainer->markLayoutDirty();
|
|
||||||
bSomeoneCares = true;
|
bSomeoneCares = true;
|
||||||
}
|
}
|
||||||
else if (pWindow->GetType() == WINDOW_TABCONTROL)
|
else if (pWindow->GetType() == WINDOW_TABCONTROL)
|
||||||
{
|
{
|
||||||
TabControl *pTabControl = static_cast<TabControl*>(pWindow);
|
|
||||||
pTabControl->markLayoutDirty();
|
|
||||||
bSomeoneCares = true;
|
bSomeoneCares = true;
|
||||||
}
|
}
|
||||||
else if (pWindow->IsDialog())
|
pWindow->queue_resize();
|
||||||
{
|
|
||||||
pDialog = dynamic_cast<Dialog*>(pWindow);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pWindow = pWindow->GetParent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pDialog && pDialog != pOrigWindow)
|
|
||||||
pDialog->queue_layout();
|
|
||||||
return bSomeoneCares;
|
return bSomeoneCares;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user