summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2002-03-19 16:19:23 +0000
committerMathias Bauer <mba@openoffice.org>2002-03-19 16:19:23 +0000
commit84f0b62954ba6c31f021bb67db1db08c5691ddd3 (patch)
treec775ec37416504327880e7441260edc70655a71c /sfx2
parent42edbed6db09eb640603678b1c2e0840b2eb50e7 (diff)
#98169#: don't share Popup menues
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/appdata.cxx6
-rw-r--r--sfx2/source/appl/appinit.cxx6
-rw-r--r--sfx2/source/appl/appmain.cxx23
-rw-r--r--sfx2/source/appl/appmisc.cxx43
-rw-r--r--sfx2/source/appl/appquit.cxx7
-rw-r--r--sfx2/source/inc/appdata.hxx8
-rw-r--r--sfx2/source/menu/mnuitem.cxx21
-rw-r--r--sfx2/source/toolbox/tbxitem.cxx33
8 files changed, 57 insertions, 90 deletions
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index 5b9595d37df7..88a8f2909432 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: appdata.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: mba $ $Date: 2001-12-17 14:19:22 $
+ * last change: $Author: mba $ $Date: 2002-03-19 17:17:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -141,8 +141,6 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* pApp ) :
pSecureURLs(0),
nAutoTabPageId(0),
nExecutingSID( 0 ),
- pNewMenu( 0 ),
- pAutoPilotMenu( 0 ),
pAppDispatch(NULL),
pTriggerTopic(0),
pDdeService2(0),
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index f54482198908..c2e1da6502c0 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: appinit.cxx,v $
*
- * $Revision: 1.28 $
+ * $Revision: 1.29 $
*
- * last change: $Author: mba $ $Date: 2002-01-17 09:14:31 $
+ * last change: $Author: mba $ $Date: 2002-03-19 17:17:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -362,8 +362,6 @@ FASTBOOL SfxApplication::Initialize_Impl()
pAppData_Impl->pPool = NoChaos::GetItemPool();
SetPool( pAppData_Impl->pPool );
- InsertLateInitHdl( LINK(this, SfxApplication,LateInitNewMenu_Impl) );
- InsertLateInitHdl( LINK(this, SfxApplication,LateInitWizMenu_Impl) );
InsertLateInitHdl( LINK(pNewHdl, SfxNewHdl, InitMem_Impl) );
InsertLateInitHdl( LINK(this, SfxApplication,SpecialService_Impl) );
InsertLateInitHdl( STATIC_LINK( pAppData_Impl, SfxAppData_Impl, CreateDocumentTemplates ) );
diff --git a/sfx2/source/appl/appmain.cxx b/sfx2/source/appl/appmain.cxx
index 9f6e8f774141..943e112b805a 100644
--- a/sfx2/source/appl/appmain.cxx
+++ b/sfx2/source/appl/appmain.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: appmain.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: cd $ $Date: 2001-07-06 16:04:24 $
+ * last change: $Author: mba $ $Date: 2002-03-19 17:17:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -388,25 +388,6 @@ void SfxApplication::Main( )
#endif
//-------------------------------------------------------------------------
-
-IMPL_LINK( SfxApplication, LateInitNewMenu_Impl, void*, pvoid)
-{
- DBG_PROFSTART(SfxAppMainNewMenu);
- pAppData_Impl->GetPopupMenu( SID_NEWDOCDIRECT );
- DBG_PROFSTOP(SfxAppMainNewMenu);
- return 0;
-}
-
-IMPL_LINK( SfxApplication, LateInitWizMenu_Impl, void*, pvoid)
-{
- DBG_PROFSTART(SfxAppMainWizMenu);
- pAppData_Impl->GetPopupMenu( SID_AUTOPILOTMENU );
- DBG_PROFSTOP(SfxAppMainWizMenu);
- return 0;
-}
-
-//-------------------------------------------------------------------------
-
void SfxApplication::InsertLateInitHdl(const Link& rLink)
{
if ( Application::IsInExecute() )
diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx
index cb68b0bdcfae..c472b66b6064 100644
--- a/sfx2/source/appl/appmisc.cxx
+++ b/sfx2/source/appl/appmisc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: appmisc.cxx,v $
*
- * $Revision: 1.35 $
+ * $Revision: 1.36 $
*
- * last change: $Author: mba $ $Date: 2002-03-07 18:05:40 $
+ * last change: $Author: mba $ $Date: 2002-03-19 17:17:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -805,45 +805,6 @@ long Select_Impl( void* pHdl, void* pVoid )
return TRUE;
}
-PopupMenu* SfxAppData_Impl::GetPopupMenu( sal_uInt16 nSID, sal_Bool bBig, sal_Bool bNew )
-{
- PopupMenu** ppMenu;
- String sKey;
- switch( nSID )
- {
- case SID_NEWDOCDIRECT:
- ppMenu = &pNewMenu;
- sKey = BOOKMARK_NEWMENU;
- break;
- case SID_AUTOPILOTMENU:
- ppMenu = &pAutoPilotMenu;
- sKey = BOOKMARK_WIZARDMENU;
- break;
- default:
- ppMenu = 0;
- DBG_ERROR( "Menu ID unknown!" );
- break;
- }
-
- if( ppMenu && ( !*ppMenu || bNew ) )
- {
- if ( *ppMenu )
- delete *ppMenu;
- SfxViewFrame* pViewFrame = SfxViewFrame::Current();
- if ( !pViewFrame )
- pViewFrame = pViewFrame->GetFirst();
-
- Reference<com::sun::star::lang::XMultiServiceFactory> aXMultiServiceFactory(::comphelper::getProcessServiceFactory());
- ::framework::MenuConfiguration aConf( aXMultiServiceFactory );
- Reference<com::sun::star::frame::XFrame> aXFrame(pViewFrame->GetFrame()->GetFrameInterface());
- *ppMenu = aConf.CreateBookmarkMenu( aXFrame, sKey );
- if ( *ppMenu )
- (*ppMenu)->SetSelectHdl( Link( this, Select_Impl ) );
- }
-
- return ppMenu ? *ppMenu : NULL;
-}
-
SfxMenuBarManager* SfxApplication::GetMenuBarManager() const
{
SfxViewFrame *pFrame = SfxViewFrame::Current();
diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx
index 640ef1735a20..4ca11aed21a0 100644
--- a/sfx2/source/appl/appquit.cxx
+++ b/sfx2/source/appl/appquit.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: appquit.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: mba $ $Date: 2001-11-15 15:03:07 $
+ * last change: $Author: mba $ $Date: 2002-03-19 17:17:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -312,9 +312,6 @@ void SfxApplication::Deinitialize()
DELETEZ(pAppDispat);
DELETEZ(pImp->pSfxResManager);
- DELETEZ( pAppData_Impl->pNewMenu );
- DELETEZ( pAppData_Impl->pAutoPilotMenu );
-
// ab hier d"urfen keine SvObjects mehr existieren
DELETEX(pAppData_Impl->pMatcher);
DELETEX(pAppData_Impl->pSfxFrameObjectFactoryPtr);
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index ad0b9a89c128..e341d39ace14 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: appdata.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: mba $ $Date: 2001-11-15 15:11:07 $
+ * last change: $Author: mba $ $Date: 2002-03-19 17:18:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -72,7 +72,6 @@
class SfxApplication;
class SvStrings;
class Config;
-class PopupMenu;
class SfxBmkMenu;
class SvVerbList;
class SfxProgress;
@@ -152,8 +151,6 @@ public:
SfxEventConfiguration* pEventConfig;
SvUShorts* pDisabledSlotList;
SvStrings* pSecureURLs;
- PopupMenu* pNewMenu;
- PopupMenu* pAutoPilotMenu;
SfxMiscCfg* pMiscConfig;
SvtSaveOptions* pSaveOptions;
SvtUndoOptions* pUndoOptions;
@@ -187,7 +184,6 @@ public:
SfxAppData_Impl( SfxApplication* );
~SfxAppData_Impl();
- PopupMenu* GetPopupMenu( USHORT nSid, BOOL bBig=FALSE, BOOL bNew=FALSE );
virtual void Notify( SfxBroadcaster &rBC, const SfxHint &rHint );
void UpdateApplicationSettings( BOOL bDontHide );
SfxDocumentTemplates* GetDocumentTemplates();
diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx
index 4847c6be51da..380676d6c7b9 100644
--- a/sfx2/source/menu/mnuitem.cxx
+++ b/sfx2/source/menu/mnuitem.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: mnuitem.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: mba $ $Date: 2001-07-03 17:34:09 $
+ * last change: $Author: mba $ $Date: 2002-03-19 17:18:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -95,6 +95,7 @@
#ifndef _SFXSTRITEM_HXX //autogen
#include <svtools/stritem.hxx>
#endif
+#include <framework/menuconfiguration.hxx>
#pragma hdrstop
#include "appdata.hxx"
@@ -113,6 +114,7 @@
#include "arrdecl.hxx"
#include "module.hxx"
#include "unoctitm.hxx"
+#include "viewfrm.hxx"
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::frame;
@@ -477,6 +479,8 @@ PopupMenu* SfxMenuControl::GetPopup () const
return 0;
}
+long Select_Impl( void* pHdl, void* pVoid );
+
SFX_IMPL_MENU_CONTROL( SfxAppMenuControl_Impl, SfxStringItem );
SfxAppMenuControl_Impl::SfxAppMenuControl_Impl(
@@ -486,16 +490,21 @@ SfxAppMenuControl_Impl::SfxAppMenuControl_Impl(
String aText = rMenu.GetItemText( nPos );
SfxApplication* pApp = SFX_APP();
SfxAppData_Impl* pImpl = pApp->Get_Impl();
- PopupMenu* pView = pImpl->GetPopupMenu( nPos );
- if ( pView )
+
+ Reference<com::sun::star::lang::XMultiServiceFactory> aXMultiServiceFactory(::comphelper::getProcessServiceFactory());
+ ::framework::MenuConfiguration aConf( aXMultiServiceFactory );
+ Reference<com::sun::star::frame::XFrame> aXFrame( GetBindings().GetDispatcher_Impl()->GetFrame()->GetFrame()->GetFrameInterface() );
+ pMenu = aConf.CreateBookmarkMenu( aXFrame, GetId() == SID_NEWDOCDIRECT ? BOOKMARK_NEWMENU : BOOKMARK_WIZARDMENU );
+ if( pMenu )
{
- rMenu.SetPopupMenu( nPos, pView );
-// pView->SetSelectHdl( LINK( this, SfxAppMenuControl_Impl, Select) );
+ pMenu->SetSelectHdl( Link( this, Select_Impl ) );
+ rMenu.SetPopupMenu( nPos, pMenu );
}
}
SfxAppMenuControl_Impl::~SfxAppMenuControl_Impl()
{
+ delete pMenu;
}
SfxUnoMenuControl* SfxMenuControl::CreateControl( const String& rCmd,
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 61bfcc49e3bd..c99887200470 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tbxitem.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: mba $ $Date: 2002-03-14 10:08:39 $
+ * last change: $Author: mba $ $Date: 2002-03-19 17:19:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,6 +61,13 @@
#include <string> // prevent conflict with STL includes
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
+#include <com/sun/star/frame/XFrame.hpp>
+#endif
+
#ifndef _SFXENUMITEM_HXX //autogen
#include <svtools/eitem.hxx>
#endif
@@ -75,6 +82,8 @@
#endif
#include <svtools/imagemgr.hxx>
+#include <comphelper/processfactory.hxx>
+#include <framework/menuconfiguration.hxx>
#pragma hdrstop
@@ -104,6 +113,9 @@
#include "unoctitm.hxx"
#include "helpid.hrc"
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+
//--------------------------------------------------------------------
static USHORT nLastId_Impl = SID_NEWDOCDIRECT;
@@ -616,6 +628,7 @@ SfxAppToolBoxControl_Impl::SfxAppToolBoxControl_Impl
)
: SfxToolBoxControl( nId, rBox, rBindings )
, bBigImages( FALSE )
+ , pMenu( 0 )
{
aTimer.SetTimeout( 250 );
aTimer.SetTimeoutHdl( LINK( this, SfxAppToolBoxControl_Impl, Timeout ) );
@@ -624,6 +637,11 @@ SfxAppToolBoxControl_Impl::SfxAppToolBoxControl_Impl
SetImage( String() );
}
+SfxAppToolBoxControl_Impl::~SfxAppToolBoxControl_Impl()
+{
+ delete pMenu;
+}
+
void SfxAppToolBoxControl_Impl::SetImage( const String &rURL )
{
String aURL = rURL;
@@ -685,6 +703,7 @@ void SfxAppToolBoxControl_Impl::Select( BOOL bMod1 )
}
//--------------------------------------------------------------------
+long Select_Impl( void* pHdl, void* pVoid );
IMPL_LINK( SfxAppToolBoxControl_Impl, Timeout, Timer *, pTimer )
{
@@ -695,9 +714,17 @@ IMPL_LINK( SfxAppToolBoxControl_Impl, Timeout, Timer *, pTimer )
USHORT nId = GetId();
BOOL bNew = FALSE;
- PopupMenu* pMenu = pApp->Get_Impl()->GetPopupMenu( nId, bBigImages, bNew );
+ if ( !pMenu )
+ {
+ Reference <com::sun::star::lang::XMultiServiceFactory> aXMultiServiceFactory(::comphelper::getProcessServiceFactory());
+ ::framework::MenuConfiguration aConf( aXMultiServiceFactory );
+ Reference<com::sun::star::frame::XFrame> aXFrame( GetBindings().GetDispatcher_Impl()->GetFrame()->GetFrame()->GetFrameInterface() );
+ pMenu = aConf.CreateBookmarkMenu( aXFrame, BOOKMARK_NEWMENU );
+ }
+
if( pMenu )
{
+ pMenu->SetSelectHdl( Link( this, Select_Impl ) );
rBox.SetItemDown( GetId(), TRUE );
USHORT nSelected = pMenu->Execute( &rBox, aRect, POPUPMENU_EXECUTE_UP );
if ( nSelected )