diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-01-31 11:02:05 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-01-31 11:30:49 +0000 |
commit | 0867207f2934ba20ab2636d38ec64a01a5a2a8d7 (patch) | |
tree | de146ae13c790f2c8c8a6015071d830c48f37de2 | |
parent | b0f4052cf2f4924251a835470c78aa85f8da93f1 (diff) |
tell the options dialog to relayout if a pane queue-resizes
Change-Id: I44686ea724873181018bf00253a08afa58c9a10b
-rw-r--r-- | cui/source/inc/treeopt.hxx | 8 | ||||
-rw-r--r-- | cui/source/options/treeopt.cxx | 32 | ||||
-rw-r--r-- | sfx2/inc/sfx2/macropg.hxx | 1 | ||||
-rw-r--r-- | vcl/inc/vcl/dialog.hxx | 2 |
4 files changed, 38 insertions, 5 deletions
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx index 36a02501d356..320769407f82 100644 --- a/cui/source/inc/treeopt.hxx +++ b/cui/source/inc/treeopt.hxx @@ -140,6 +140,11 @@ typedef std::vector< ExtensionsTabPage* > VectorOfPages; class OfaTreeOptionsDialog : public SfxModalDialog { private: + SvTreeListEntry* pCurrentPageEntry; + Timer maTreeLayoutTimer; + DECL_DLLPRIVATE_LINK( ImplHandleTreeLayoutTimerHdl, void* ); + bool hasTreePendingLayout() const; + OKButton aOkPB; CancelButton aCancelPB; HelpButton aHelpPB; @@ -152,8 +157,6 @@ private: String sTitle; String sNotLoadedError; - SvTreeListEntry* pCurrentPageEntry; - // for the ColorTabPage SfxItemSet* pColorPageItemSet; SvxColorTabPage *mpColorPage; @@ -183,6 +186,7 @@ private: VectorOfNodes LoadNodes( Module* pModule, const rtl::OUString& rExtensionId ); void InsertNodes( const VectorOfNodes& rNodeList ); + virtual void queue_layout(); void SetPaneSize(Window *pPane); protected: diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 61445c94bfd4..bbd9f6fd818b 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -484,6 +484,7 @@ struct OptionsGroupInfo // ----------------------------------------------------------------------- #define INI_LIST() \ + pCurrentPageEntry ( NULL ),\ aOkPB ( this, CUI_RES( PB_OK ) ),\ aCancelPB ( this, CUI_RES( PB_CANCEL ) ),\ aHelpPB ( this, CUI_RES( PB_HELP ) ),\ @@ -492,7 +493,6 @@ struct OptionsGroupInfo aTreeLB ( this, CUI_RES( TLB_PAGES ) ),\ sTitle ( GetText() ),\ sNotLoadedError ( CUI_RES( ST_LOAD_ERROR ) ),\ - pCurrentPageEntry ( NULL ),\ pColorPageItemSet ( NULL ),\ mpColorPage ( NULL ),\ bForgetSelection ( sal_False ),\ @@ -539,6 +539,8 @@ OfaTreeOptionsDialog::OfaTreeOptionsDialog( Window* pParent, const rtl::OUString OfaTreeOptionsDialog::~OfaTreeOptionsDialog() { + maTreeLayoutTimer.Stop(); + pCurrentPageEntry = NULL; SvTreeListEntry* pEntry = aTreeLB.First(); // first children while(pEntry) @@ -759,6 +761,9 @@ void OfaTreeOptionsDialog::ApplyItemSets() void OfaTreeOptionsDialog::InitTreeAndHandler() { + maTreeLayoutTimer.SetTimeout(50); + maTreeLayoutTimer.SetTimeoutHdl( LINK( this, OfaTreeOptionsDialog, ImplHandleTreeLayoutTimerHdl ) ); + aTreeLB.SetNodeDefaultImages(); aTreeLB.SetHelpId( HID_OFADLG_TREELISTBOX ); @@ -915,6 +920,31 @@ long OfaTreeOptionsDialog::Notify( NotifyEvent& rNEvt ) return SfxModalDialog::Notify(rNEvt); } +bool OfaTreeOptionsDialog::hasTreePendingLayout() const +{ + return maTreeLayoutTimer.IsActive(); +} + +void OfaTreeOptionsDialog::queue_layout() +{ + if (hasTreePendingLayout()) + return; + if (IsInClose()) + return; + maTreeLayoutTimer.Start(); +} + +IMPL_LINK( OfaTreeOptionsDialog, ImplHandleTreeLayoutTimerHdl, void*, EMPTYARG ) +{ + if (pCurrentPageEntry && aTreeLB.GetParent(pCurrentPageEntry)) + { + OptionsPageInfo* pPageInfo = (OptionsPageInfo*)pCurrentPageEntry->GetUserData(); + if (pPageInfo->m_pPage && pPageInfo->m_pPage->isLayoutEnabled()) + SetPaneSize(pPageInfo->m_pPage); + } + return 0; +} + // -------------------------------------------------------------------- void OfaTreeOptionsDialog::SetPaneSize(Window *pPane) { diff --git a/sfx2/inc/sfx2/macropg.hxx b/sfx2/inc/sfx2/macropg.hxx index b3b39d5161b3..1a6c87198f41 100644 --- a/sfx2/inc/sfx2/macropg.hxx +++ b/sfx2/inc/sfx2/macropg.hxx @@ -34,7 +34,6 @@ class Edit; class String; class SfxObjectShell; -class SfxConfigGroupListBox_Impl; class SfxConfigFunctionListBox_Impl; class _HeaderTabListBox; diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx index 7f16d07dd033..7fc2a4d75ae7 100644 --- a/vcl/inc/vcl/dialog.hxx +++ b/vcl/inc/vcl/dialog.hxx @@ -95,7 +95,7 @@ public: virtual void Resize(); bool isLayoutEnabled() const; void setInitialLayoutSize(); - void queue_layout(); + virtual void queue_layout(); virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue); VclButtonBox* get_action_area(); VclBox* get_content_area(); |