summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAugust Sodora <augsod@gmail.com>2011-12-16 18:37:03 -0500
committerAugust Sodora <augsod@gmail.com>2011-12-19 14:36:10 -0500
commitd330111ec383542ad8955d78a64f4ed4b095b683 (patch)
tree45a2274ff5825d2a4b478636bedb5c1cdace10b2
parent7f707bbef2d13c05f8387e8af4c33d0f321f7677 (diff)
Clean up treeopt select handler locking hack
-rw-r--r--cui/source/inc/treeopt.hxx3
-rw-r--r--cui/source/options/treeopt.cxx58
-rw-r--r--sw/source/ui/app/appopt.cxx5
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx2
4 files changed, 22 insertions, 46 deletions
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index c6ba40239a28..b7663205adb0 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -177,14 +177,11 @@ private:
sal_Bool bForgetSelection;
sal_Bool bExternBrowserActive;
- bool bInSelectHdl_Impl;
bool bIsFromExtensionManager;
// check "for the current document only" and set focus to "Western" languages box
bool bIsForSetDocumentLanguage;
- Timer aSelectTimer;
-
com::sun::star::uno::Reference < com::sun::star::awt::XContainerWindowProvider >
m_xContainerWinProvider;
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index c07cf50110d1..f41515f0e786 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -149,9 +149,6 @@ using namespace ::com::sun::star::util;
#define C2U(cChar) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( cChar ) )
#endif
-#define HINT_TIMEOUT 200
-#define SELECT_FIRST_TIMEOUT 0
-#define SELECT_TIMEOUT 300
#define EXPAND_PROTOCOL "vnd.sun.star.expand:"
LastPageSaver* OfaTreeOptionsDialog::pLastPageSaver = NULL;
@@ -365,7 +362,6 @@ SfxTabPage* CreateGeneralTabPage( sal_uInt16 nId, Window* pParent, const SfxItem
return pRet;
}
-
struct OptionsMapping_Impl
{
const char* m_pGroupName;
@@ -534,7 +530,6 @@ struct OptionsGroupInfo
pColorPageItemSet ( NULL ),\
mpColorPage ( NULL ),\
bForgetSelection ( sal_False ),\
- bInSelectHdl_Impl ( false ),\
bIsFromExtensionManager( false ), \
bIsForSetDocumentLanguage( false )
@@ -667,14 +662,7 @@ sal_uInt16 OfaTreeOptionsDialog::AddGroup(const String& rGroupName,
IMPL_LINK(OfaTreeOptionsDialog, ShowPageHdl_Impl, SvTreeListBox*, EMPTYARG)
{
- if ( aSelectTimer.GetTimeout() == SELECT_FIRST_TIMEOUT )
- {
- aSelectTimer.SetTimeout( SELECT_TIMEOUT );
- SelectHdl_Impl( NULL );
- }
- else if ( aSelectTimer.GetTimeout() == SELECT_TIMEOUT )
- aSelectTimer.Start();
-
+ SelectHdl_Impl( NULL );
return 0;
}
@@ -820,8 +808,6 @@ void OfaTreeOptionsDialog::InitTreeAndHandler()
aOkPB.SetClickHdl( LINK( this, OfaTreeOptionsDialog, OKHdl_Impl ) );
aHiddenGB.Show();
- aSelectTimer.SetTimeout( SELECT_FIRST_TIMEOUT );
- aSelectTimer.SetTimeoutHdl( LINK( this, OfaTreeOptionsDialog, SelectHdl_Impl ) );
}
void OfaTreeOptionsDialog::ActivatePage( sal_uInt16 nResId )
@@ -971,31 +957,25 @@ long OfaTreeOptionsDialog::Notify( NotifyEvent& rNEvt )
// --------------------------------------------------------------------
-class FlagSet_Impl
-{
- bool & rFlag;
- public:
- FlagSet_Impl(bool& bFlag) : rFlag(bFlag){rFlag = true;}
- ~FlagSet_Impl(){rFlag = false;}
-};
-
IMPL_LINK( OfaTreeOptionsDialog, SelectHdl_Impl, Timer*, EMPTYARG )
{
SvTreeListBox* pBox = &aTreeLB;
- SvLBoxEntry* pEntry = pBox->GetCurEntry();
- SvLBoxEntry* pParent = pBox->GetParent(pEntry);
- pBox->EndSelection();
- DBG_ASSERT(!bInSelectHdl_Impl, "Timeout handler called twice");
- if(bInSelectHdl_Impl || pCurrentPageEntry == pEntry)
+ if(pCurrentPageEntry == pBox->GetCurEntry())
+ {
+ pBox->EndSelection();
return 0;
- //#111938# lock the SelectHdl_Impl to prevent multiple executes
- FlagSet_Impl aFlag(bInSelectHdl_Impl);
+ }
+
+ SvLBoxEntry* pEntry = pBox->GetCurEntry();
+ SvLBoxEntry* pParent = pBox->GetParent(pEntry);
// If the user has selected a category, automatically switch to a suitable
// default sub-page instead.
if (!pParent)
{
+ pBox->EndSelection();
+
OptionsGroupInfo* pGroupInfo = static_cast<OptionsGroupInfo*>(pEntry->GetUserData());
if(!pGroupInfo)
@@ -1047,6 +1027,8 @@ IMPL_LINK( OfaTreeOptionsDialog, SelectHdl_Impl, Timer*, EMPTYARG )
return 0;
}
+ pBox->EndSelection();
+
TabPage* pOldPage = NULL;
TabPage* pNewPage = NULL;
OptionsPageInfo* pOptPageInfo = ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) )
@@ -1147,20 +1129,20 @@ IMPL_LINK( OfaTreeOptionsDialog, SelectHdl_Impl, Timer*, EMPTYARG )
pGroupInfo->m_pInItemSet->GetRanges());
}
- if(pGroupInfo->m_pModule)
- {
- pPageInfo->m_pPage = pGroupInfo->m_pModule->CreateTabPage(
- pPageInfo->m_nPageId, this, *pGroupInfo->m_pInItemSet );
- }
- else if(RID_SVXPAGE_COLOR != pPageInfo->m_nPageId)
- pPageInfo->m_pPage = ::CreateGeneralTabPage( pPageInfo->m_nPageId, this, *pGroupInfo->m_pInItemSet );
- else
+ if(pPageInfo->m_nPageId == RID_SVXPAGE_COLOR)
{
pPageInfo->m_pPage = ::CreateGeneralTabPage(
pPageInfo->m_nPageId, this, *pColorPageItemSet );
mpColorPage = (SvxColorTabPage*)pPageInfo->m_pPage;
mpColorPage->SetupForViewFrame( SfxViewFrame::Current() );
}
+ else
+ {
+ pPageInfo->m_pPage = ::CreateGeneralTabPage(pPageInfo->m_nPageId, this, *pGroupInfo->m_pInItemSet );
+
+ if(!pPageInfo->m_pPage && pGroupInfo->m_pModule)
+ pPageInfo->m_pPage = pGroupInfo->m_pModule->CreateTabPage(pPageInfo->m_nPageId, this, *pGroupInfo->m_pInItemSet);
+ }
DBG_ASSERT( pPageInfo->m_pPage, "tabpage could not created");
if ( pPageInfo->m_pPage )
diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx
index 22212668d8c4..d9afcb37c408 100644
--- a/sw/source/ui/app/appopt.cxx
+++ b/sw/source/ui/app/appopt.cxx
@@ -526,7 +526,6 @@ SfxTabPage* SwModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxI
}
}
break;
-#if OSL_DEBUG_LEVEL > 1
case RID_SW_TP_OPTTEST_PAGE:
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
@@ -538,7 +537,6 @@ SfxTabPage* SwModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxI
}
break;
}
-#endif
case RID_SW_TP_BACKGROUND:
{
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
@@ -564,7 +562,8 @@ SfxTabPage* SwModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxI
break;
}
- OSL_ENSURE( pRet, "SwModule::CreateTabPage(): Unknown tabpage id" );
+ if(!pRet)
+ SAL_WARN( "sw", "SwModule::CreateTabPage(): Unknown tabpage id " << nId );
return pRet;
}
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index a31db0d97390..7a636618d9ac 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -1645,9 +1645,7 @@ CreateTabPage SwAbstractDialogFactory_Impl::GetTabPageCreatorFunc( sal_uInt16 nI
break;
case RID_SW_TP_OPTTEST_PAGE :
case TP_OPTTEST_PAGE :
-#ifdef DBG_UTIL
pRet = SwTestTabPage::Create;
-#endif
break;
case TP_OPTPRINT_PAGE :
case RID_SW_TP_HTML_OPTPRINT_PAGE: