[Libreoffice-commits] core.git: cui/source include/svtools include/svx include/vcl svtools/source svx/source vcl/source
Caolán McNamara
caolanm at redhat.com
Mon Sep 30 08:10:16 PDT 2013
cui/source/inc/treeopt.hxx | 2 +-
cui/source/options/treeopt.cxx | 2 +-
include/svtools/wizdlg.hxx | 2 +-
include/svx/sidebar/PanelLayout.hxx | 11 ++++++++++-
include/vcl/dialog.hxx | 2 +-
include/vcl/layout.hxx | 2 ++
include/vcl/tabctrl.hxx | 2 ++
include/vcl/window.hxx | 2 +-
svtools/source/dialogs/wizdlg.cxx | 2 +-
svx/source/sidebar/PanelLayout.cxx | 33 +++++++++++++++++++++++++++++++++
vcl/source/control/tabctrl.cxx | 6 ++++++
vcl/source/window/dialog.cxx | 4 ++--
vcl/source/window/layout.cxx | 6 ++++++
vcl/source/window/window2.cxx | 20 +++-----------------
14 files changed, 70 insertions(+), 26 deletions(-)
New commits:
commit a48cf78fab4a283ef43c091e8c324c968377f9db
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Sep 30 14:44:37 2013 +0100
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
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index 3968345..adf6563 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -186,7 +186,7 @@ private:
VectorOfNodes LoadNodes( Module* pModule, const OUString& rExtensionId );
void InsertNodes( const VectorOfNodes& rNodeList );
- virtual void queue_layout();
+ virtual void queue_resize();
void SetPaneSize(Window *pPane);
protected:
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 3239304..01c9f22 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -930,7 +930,7 @@ bool OfaTreeOptionsDialog::hasTreePendingLayout() const
return maTreeLayoutTimer.IsActive();
}
-void OfaTreeOptionsDialog::queue_layout()
+void OfaTreeOptionsDialog::queue_resize()
{
if (hasTreePendingLayout())
return;
diff --git a/include/svtools/wizdlg.hxx b/include/svtools/wizdlg.hxx
index 82212b3..92a26ee 100644
--- a/include/svtools/wizdlg.hxx
+++ b/include/svtools/wizdlg.hxx
@@ -263,7 +263,7 @@ public:
virtual void ActivatePage();
virtual long DeactivatePage();
- virtual void queue_layout();
+ virtual void queue_resize();
sal_Bool ShowPrevPage();
sal_Bool ShowNextPage();
diff --git a/include/svx/sidebar/PanelLayout.hxx b/include/svx/sidebar/PanelLayout.hxx
index 3395e7f..2fa82ee 100644
--- a/include/svx/sidebar/PanelLayout.hxx
+++ b/include/svx/sidebar/PanelLayout.hxx
@@ -14,19 +14,28 @@
#include <vcl/builder.hxx>
#include <vcl/ctrl.hxx>
+#include <vcl/timer.hxx>
#include <com/sun/star/frame/XFrame.hpp>
/// This class is the base for the Widget Layout-based sidebar panels.
class SVX_DLLPUBLIC PanelLayout : public Control, public VclBuilderContainer
{
+private:
+ Timer m_aPanelLayoutTimer;
+ bool m_bInClose;
+ bool hasPanelPendingLayout() const;
+
+ DECL_DLLPRIVATE_LINK( ImplHandlePanelLayoutTimerHdl, void* );
+
public:
PanelLayout(Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame);
- virtual ~PanelLayout() {}
+ virtual ~PanelLayout();
virtual Size GetOptimalSize() const;
virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL);
+ virtual void queue_resize();
};
#endif
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 4e20d63..afaea70 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -104,7 +104,7 @@ public:
bool isLayoutEnabled() const;
void setOptimalLayoutSize();
bool isCalculatingInitialLayoutSize() const { return mbIsCalculatingInitialLayoutSize; }
- virtual void queue_layout();
+ virtual void queue_resize();
virtual bool set_property(const OString &rKey, const OString &rValue);
VclButtonBox* get_action_area();
VclBox* get_content_area();
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 47b9593..0fa87ec 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -39,6 +39,8 @@ public:
{
m_bLayoutDirty = true;
}
+
+ virtual void queue_resize();
protected:
//these are the two that need to be implemented by
//containers, figure out how much space you want...
diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx
index 383c923..53b3572 100644
--- a/include/vcl/tabctrl.hxx
+++ b/include/vcl/tabctrl.hxx
@@ -201,6 +201,8 @@ public:
{
mbLayoutDirty = true;
}
+
+ virtual void queue_resize();
};
#endif // _SV_TABCTRL_HXX
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 4408adb..e255272 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1074,7 +1074,7 @@ public:
*
* akin to gtk_widget_queue_resize
*/
- void queue_resize();
+ virtual void queue_resize();
/*
* Sets the "width-request" property
diff --git a/svtools/source/dialogs/wizdlg.cxx b/svtools/source/dialogs/wizdlg.cxx
index df05a62..153a29e 100644
--- a/svtools/source/dialogs/wizdlg.cxx
+++ b/svtools/source/dialogs/wizdlg.cxx
@@ -119,7 +119,7 @@ bool WizardDialog::hasWizardPendingLayout() const
return maWizardLayoutTimer.IsActive();
}
-void WizardDialog::queue_layout()
+void WizardDialog::queue_resize()
{
if (hasWizardPendingLayout())
return;
diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx
index 003ca3e..e31c75b 100644
--- a/svx/source/sidebar/PanelLayout.cxx
+++ b/svx/source/sidebar/PanelLayout.cxx
@@ -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)
: Control(pParent)
+ , m_bInClose(false)
{
SetStyle(GetStyle() | WB_DIALOGCONTROL);
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
@@ -25,6 +34,30 @@ Size PanelLayout::GetOptimalSize() const
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)
{
bool bCanHandleSmallerWidth = false;
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 3504b90..93ee0cd 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -2361,4 +2361,10 @@ Size TabControl::GetOptimalSize() const
return calculateRequisition();
}
+void TabControl::queue_resize()
+{
+ markLayoutDirty();
+ Window::queue_resize();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index ef14a79..17f0e37 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1254,7 +1254,7 @@ IMPL_LINK( Dialog, ImplHandleLayoutTimerHdl, void*, EMPTYARG )
return 0;
}
-void Dialog::queue_layout()
+void Dialog::queue_resize()
{
if (hasPendingLayout() || isCalculatingInitialLayoutSize())
return;
@@ -1267,7 +1267,7 @@ void Dialog::queue_layout()
void Dialog::Resize()
{
- queue_layout();
+ queue_resize();
}
bool Dialog::set_property(const OString &rKey, const OString &rValue)
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index e7f5e1b..dff2546 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -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
{
long nSecondaryChildDimension = getSecondaryDimension(rChildSize);
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index aa91951..475181c 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1732,34 +1732,20 @@ namespace
{
bool bSomeoneCares = false;
- Dialog *pDialog = NULL;
-
- Window *pWindow = pOrigWindow;
-
- while (pWindow)
+ Window *pWindow = pOrigWindow->GetParent();
+ if (pWindow)
{
if (isContainerWindow(*pWindow))
{
- VclContainer *pContainer = static_cast<VclContainer*>(pWindow);
- pContainer->markLayoutDirty();
bSomeoneCares = true;
}
else if (pWindow->GetType() == WINDOW_TABCONTROL)
{
- TabControl *pTabControl = static_cast<TabControl*>(pWindow);
- pTabControl->markLayoutDirty();
bSomeoneCares = true;
}
- else if (pWindow->IsDialog())
- {
- pDialog = dynamic_cast<Dialog*>(pWindow);
- break;
- }
- pWindow = pWindow->GetParent();
+ pWindow->queue_resize();
}
- if (pDialog && pDialog != pOrigWindow)
- pDialog->queue_layout();
return bSomeoneCares;
}
}
More information about the Libreoffice-commits
mailing list