summaryrefslogtreecommitdiff
path: root/sfx2/source/config/evntconf.cxx
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2009-05-06 10:59:57 +0000
committerRelease Engineers <releng@openoffice.org>2009-05-06 10:59:57 +0000
commit44b515b9a328f92bec405a22151650393144c19a (patch)
treef26ac111c0674d5c7ea974c0021d52afe960e7b9 /sfx2/source/config/evntconf.cxx
parent59cc4ba03370d45a14d0f706e6970cbe0c3ac26a (diff)
CWS-TOOLING: integrate CWS mba32issues01
2009-05-05 18:23:27 +0200 mba r271547 : apply diffs from m45->m47 for all files moved from dialog to cui 2009-05-05 18:22:02 +0200 mba r271545 : apply diffs from m45->m47 for all files moved from dialog to cui 2009-05-05 18:16:42 +0200 mba r271544 : apply diffs from m45->m47 for all files moved from dialog to cui 2009-04-29 19:35:58 +0200 mba r271392 : #i73672#: unify commands for inserting special characters 2009-04-29 18:01:27 +0200 mba r271391 : #i101337#: missing string resources 2009-04-29 18:01:10 +0200 mba r271390 : #i101337#: missing string resources 2009-04-29 15:42:47 +0200 mba r271380 : concurrency problem in multithreaded dmake due to missing dependency 2009-04-28 17:36:03 +0200 tbo r271336 : #i99432# 2009-04-28 13:57:52 +0200 mba r271322 : #i101302#: ctor might be called with pSet=0 2009-04-22 19:32:39 +0200 tbo r271138 : #i99432# 2009-04-09 14:46:03 +0200 mba r270709 : make sendreportw32.cxx compile with pch 2009-04-06 16:05:07 +0200 mba r270568 : #i99432#: some tweaks for build order 2009-04-06 15:38:52 +0200 mba r270558 : typo 2009-04-06 13:36:19 +0200 mba r270542 : #i99432#: split of localization also 2009-04-06 13:19:06 +0200 mba r270539 : #i99432#: split up srs files also 2009-04-03 17:57:59 +0200 mba r270513 : #i99432#: split dialog folder into two 2009-04-03 17:56:46 +0200 mba r270512 : #i99432#: split dialog folder into two 2009-04-01 22:15:00 +0200 mba r270364 : warnings on Linux 2009-04-01 22:10:44 +0200 mba r270363 : warnings on Linux 2009-04-01 21:43:54 +0200 mba r270362 : warning fixed 2009-04-01 21:41:27 +0200 mba r270361 : warning on Linux fixed 2009-04-01 21:35:44 +0200 mba r270360 : warning fixed 2009-04-01 20:19:59 +0200 mba r270358 : warning found on Linux fixed 2009-04-01 19:23:38 +0200 mba r270354 : warning due to missing eof 2009-04-01 18:56:25 +0200 mba r270352 : linking problem fixed that appeared only on mac 2009-04-01 18:41:30 +0200 mba r270350 : warnings discovered on Linux fixed 2009-04-01 18:34:28 +0200 mba r270349 : some fixes for warnings and include problems discoverd after resync and build on mac 2009-04-01 14:08:22 +0200 mba r270328 : CWS-TOOLING: rebase CWS mba32issues01 to trunk@270033 (milestone: DEV300:m45) 2009-03-04 18:13:35 +0100 mba r268858 : #i99432#: more dialogs moved to cui 2009-03-04 17:47:41 +0100 mba r268854 : #i99432#: more dialogs moved to cui 2009-03-04 17:32:39 +0100 mba r268851 : warning fixed 2009-03-04 12:59:26 +0100 mba r268814 : #i99432#: more dialogs moved to cui 2009-03-04 11:49:03 +0100 mba r268802 : #i99432#: CharmapDialog moved to cui 2009-03-04 10:46:00 +0100 mba r268795 : #i99432#: CharmapDialog moved to cui 2009-03-04 10:43:50 +0100 mba r268794 : #i99432#: CharmapDialog moved to cui 2009-03-04 10:00:29 +0100 mba r268792 : #i99432#: CharmapDialog moved to cui 2009-03-04 10:00:03 +0100 mba r268791 : #i99432#: CharmapDialog moved to cui 2009-03-04 09:59:43 +0100 mba r268790 : #i99432#: CharmapDialog moved to cui 2009-03-04 09:58:51 +0100 mba r268789 : #i99432#: CharmapDialog moved to cui 2009-03-04 09:58:16 +0100 mba r268788 : #i99432#: CharmapDialog moved to cui 2009-03-03 16:33:14 +0100 mba r268763 : #i99465#: new SfxAbstractDialog interface and creation methods 2009-03-03 16:32:28 +0100 mba r268762 : #i99432#: some tabpages moved to cui 2009-03-03 16:32:09 +0100 mba r268761 : #i99432#: some tabpages moved to cui 2009-03-03 16:29:40 +0100 mba r268760 : #i99465#: new SfxAbstractDialog interface and creation methods 2009-03-03 16:29:08 +0100 mba r268759 : #i99432#: MacroAssignment page moved to cui 2009-03-03 16:28:41 +0100 mba r268758 : #i99432#: MacroAssignment page moved to cui 2009-03-03 16:28:18 +0100 mba r268757 : #i99465#: new SfxAbstractDialog interface and creation methods 2009-03-03 16:27:36 +0100 mba r268756 : #i99465#: replace FN_SYMBOL by SID_CHARMAP 2009-03-03 16:27:02 +0100 mba r268755 : #i99465#: new SfxAbstractDialog interface and creation methods 2009-03-03 16:26:23 +0100 mba r268754 : #i99465#: new SfxAbstractDialog interface and creation methods 2009-03-03 16:25:30 +0100 mba r268753 : #i99465#: new SfxAbstractDialog interface and creation methods 2009-03-03 16:24:49 +0100 mba r268752 : #i99465#: new SfxAbstractDialog interface and creation methods 2009-03-03 16:24:35 +0100 mba r268751 : #i99432#: MacroAssignment page moved to cui 2009-03-03 16:23:20 +0100 mba r268750 : #i99465#: new SfxAbstractDialog interface and creation methods 2009-03-03 16:23:04 +0100 mba r268749 : #i99432#: MacroAssignment page moved to cui 2009-03-03 16:21:56 +0100 mba r268748 : #i99465#: new SfxAbstractDialog interface and creation methods 2009-03-03 16:18:39 +0100 mba r268747 : #i99432#: MacroAssignment page moved to cui 2009-03-03 16:13:14 +0100 mba r268745 : #i99465#: replace FN_SYMBOL by SID_CHARMAP 2009-03-03 16:02:54 +0100 mba r268738 : #i99432#: moved MacroAssignment TabPage from sfx2 2009-03-03 14:57:58 +0100 mba r268729 : #i99465#: transport return value via ItemSet 2009-03-03 00:08:10 +0100 mba r268701 : #i99432#: move acccfg to cuilib 2009-03-03 00:07:32 +0100 mba r268700 : #i99432#: move acccfg to cuilib 2009-03-03 00:02:01 +0100 mba r268699 : #i99432#: move acccfg to cuilib 2009-03-03 00:01:38 +0100 mba r268698 : #i99432#: move acccfg to cuilib 2009-03-03 00:01:11 +0100 mba r268697 : #i99432#: move acccfg to cuilib 2009-03-03 00:00:40 +0100 mba r268696 : #i99432#: move acccfg to cuilib 2009-03-03 00:00:06 +0100 mba r268695 : #i99432#: replace SfxAbstractSingleTabDialog by SfxAbstractDialog 2009-03-02 23:59:22 +0100 mba r268694 : #i99432#: move acccfg to cuilib 2009-03-02 23:57:19 +0100 mba r268693 : #i99432#: move acccfg to svx 2009-03-02 23:56:14 +0100 mba r268692 : #i99432#: replace SfxAbstractSingleTabDialog by SfxAbstractDialog 2009-03-02 23:49:37 +0100 mba r268691 : #i99785#: consolidate dialogs library 2009-03-02 17:26:40 +0100 mba r268683 : #i99785#: consolidate dialogs library 2009-03-02 17:24:28 +0100 mba r268682 : i99465#: consolidate slot for InsertSymbol command 2009-03-02 17:22:29 +0100 mba r268681 : #i99785#: consolidate dialogs library 2009-03-02 17:18:11 +0100 mba r268680 : i99432#: move accelconfig and macroassignment to cui 2009-03-02 17:08:30 +0100 mba r268679 : #i99785#: consolidate dialogs library 2009-03-02 17:06:57 +0100 mba r268678 : #i99785#: consolidate dialogs library 2009-03-02 17:06:30 +0100 mba r268677 : #i99785#: consolidate dialogs library 2009-03-02 17:05:02 +0100 mba r268676 : #i99785#: consolidate dialogs library 2009-03-02 17:04:35 +0100 mba r268675 : #i99785#: consolidate dialogs library 2009-03-02 16:47:53 +0100 mba r268673 : i99432#: move accelconfig and macroassignment to cui 2009-03-02 16:45:17 +0100 mba r268671 : i99432#: move accelconfig and macroassignment to cui 2009-03-02 16:39:59 +0100 mba r268670 : i99432#: move accelconfig and macroassignment to cui 2009-03-02 16:38:59 +0100 mba r268668 : i99432#: move accelconfig and macroassignment to cui 2009-03-02 16:38:28 +0100 mba r268667 : i99432#: move accelconfig and macroassignment to cui 2009-03-02 16:36:06 +0100 mba r268666 : i99432#: move accelconfig and macroassignment to cui 2009-03-02 16:29:50 +0100 mba r268663 : i99432#: move accelconfig and macroassignment to cui 2009-03-02 16:24:00 +0100 mba r268659 : i99432#: move accelconfig and macroassignment to cui 2009-03-02 16:23:31 +0100 mba r268658 : i99432#: move accelconfig and macroassignment to cui 2009-03-02 16:22:41 +0100 mba r268657 : i99432#: move accelconfig and macroassignment to cui 2009-02-25 16:57:26 +0100 mba r268453 : obsolete 2009-02-17 10:50:51 +0100 mba r267846 : obsolete 2009-02-12 16:33:54 +0100 mba r267676 : #i96834#: warning fixed 2009-02-11 19:28:47 +0100 mba r267626 : #i91978#: unused code 2009-02-11 18:37:47 +0100 mba r267625 : metafile output, fixes for 3 layer office 2009-02-11 12:56:28 +0100 mba r267593 : selective trees; incomplete build lists; metafile output
Diffstat (limited to 'sfx2/source/config/evntconf.cxx')
-rw-r--r--sfx2/source/config/evntconf.cxx681
1 files changed, 97 insertions, 584 deletions
diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx
index 03d5c6f483..9606795df1 100644
--- a/sfx2/source/config/evntconf.cxx
+++ b/sfx2/source/config/evntconf.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -60,11 +60,8 @@
#include <sfx2/dispatch.hxx>
#include "config.hrc"
#include "sfxresid.hxx"
-#include <sfx2/macropg.hxx>
#include "eventsupplier.hxx"
-//#include <sfx2/sfxsids.hrc>
-//#include "sfxlocal.hrc"
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/document/XEventsSupplier.hpp>
@@ -90,43 +87,104 @@ static const USHORT nOldVersion = 4;
static const USHORT nVersion = 5;
TYPEINIT1(SfxEventHint, SfxHint);
+TYPEINIT1(SfxEventNamesItem, SfxPoolItem);
using namespace com::sun::star;
-// class SfxMacroQueryDlg_Impl -------------------------------------------
-/*
-class SfxMacroQueryDlg_Impl : public QueryBox
+SfxEventNamesList& SfxEventNamesList::operator=( const SfxEventNamesList& rTbl )
{
-public:
- SfxMacroQueryDlg_Impl( const String& rMacro, BOOL bDefault );
-};
+ DelDtor();
+ SfxEventName* pTmp = ((SfxEventNamesList&)rTbl).First();
+ while( pTmp )
+ {
+ SfxEventName *pNew = new SfxEventName( *pTmp );
+ Insert( rTbl.GetCurKey(), pNew );
+ pTmp = ((SfxEventNamesList&)rTbl).Next();
+ }
+ return *this;
+}
-// class SfxMacroQueryDlg_Impl -------------------------------------------
+void SfxEventNamesList::DelDtor()
+{
+ SfxEventName* pTmp = First();
+ while( pTmp )
+ {
+ delete pTmp;
+ pTmp = Next();
+ }
+ Clear();
+}
-SfxMacroQueryDlg_Impl::SfxMacroQueryDlg_Impl( const String& rMacName, BOOL bDefault ) :
- QueryBox( NULL, SfxResId( QUERYBOX_MACROQUERY ) )
+int SfxEventNamesItem::operator==( const SfxPoolItem& rAttr ) const
{
- SetButtonText( GetButtonId(0), String( SfxResId(BTN_OK) ) );
- SetButtonText( GetButtonId(1), String( SfxResId(BTN_CANCEL) ) );
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+
+ const SfxEventNamesList& rOwn = aEventsList;
+ const SfxEventNamesList& rOther = ( (SfxEventNamesItem&) rAttr ).aEventsList;
- String aText = GetMessText();
- aText.SearchAndReplace( String::CreateFromAscii("$(MACRO)"), rMacName );
+ // Anzahl unterschiedlich => auf jeden Fall ungleich
+ if ( rOwn.Count() != rOther.Count() )
+ return FALSE;
- if ( bDefault )
+ // einzeln verleichen; wegen Performance ist die Reihenfolge wichtig
+ for ( USHORT nNo = 0; nNo < rOwn.Count(); ++nNo )
{
- SetFocusButton(GetButtonId(0));
- aText.SearchAndReplace( String::CreateFromAscii("$(TEXT)"), String( SfxResId(FT_OK) ) );
+ const SfxEventName *pOwn = rOwn.GetObject(nNo);
+ const SfxEventName *pOther = rOther.GetObject(nNo);
+ if ( rOwn.GetKey(pOwn) != rOther.GetKey(pOther) ||
+ pOwn->maEventName != pOther->maEventName ||
+ pOwn->maUIName != pOther->maUIName )
+ return FALSE;
}
- else
+
+ return TRUE;
+
+}
+
+SfxItemPresentation SfxEventNamesItem::GetPresentation( SfxItemPresentation,
+ SfxMapUnit,
+ SfxMapUnit,
+ XubString &rText,
+ const IntlWrapper* ) const
+{
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+SfxPoolItem* SfxEventNamesItem::Clone( SfxItemPool *) const
+{
+ return new SfxEventNamesItem(*this);
+}
+
+SfxPoolItem* SfxEventNamesItem::Create(SvStream &, USHORT) const
+{
+ DBG_ERROR("not streamable!");
+ return new SfxEventNamesItem(Which());
+}
+
+SvStream& SfxEventNamesItem::Store(SvStream &rStream, USHORT ) const
+{
+ DBG_ERROR("not streamable!");
+ return rStream;
+}
+
+USHORT SfxEventNamesItem::GetVersion( USHORT ) const
+{
+ DBG_ERROR("not streamable!");
+ return 0;
+}
+
+void SfxEventNamesItem::AddEvent( const String& rName, const String& rUIName, USHORT nID )
+{
+ SfxEventName* pName;
+ if ( 0 != (pName=aEventsList.Get(nID)) )
{
- SetFocusButton(GetButtonId(1));
- aText.SearchAndReplace( String::CreateFromAscii("$(TEXT)"), String( SfxResId(FT_CANCEL) ) );
+ DBG_WARNING("Event already added!");
}
-
- SetMessText( aText );
- FreeResource();
+ else
+ aEventsList.Insert( nID, new SfxEventName( nID, rName, rUIName.Len() ? rUIName : rName ) );
}
-*/
+
// class SfxAsyncEvent_Impl ----------------------------------------------
class SfxAsyncEvent_Impl : public SfxListener
@@ -196,26 +254,8 @@ IMPL_LINK(SfxAsyncEvent_Impl, TimerHdl, Timer*, pAsyncTimer)
return 0L;
}
-// class SfxEventList_Impl -----------------------------------------------
-
-struct EventNames_Impl
-{
- USHORT mnId;
- String maEventName;
- String maUIName;
-
- EventNames_Impl( USHORT nId,
- const String& rEventName,
- const String& rUIName )
- : mnId( nId )
- , maEventName( rEventName )
- , maUIName( rUIName ) {}
-};
-
-DECLARE_LIST( SfxEventList_Impl, EventNames_Impl* )
-
-SfxEventList_Impl *gp_Id_SortList = NULL;
-SfxEventList_Impl *gp_Name_SortList = NULL;
+SfxEventNamesList *gp_Id_SortList = NULL;
+SfxEventNamesList *gp_Name_SortList = NULL;
//==========================================================================
@@ -224,96 +264,23 @@ SfxEventConfiguration::SfxEventConfiguration()
, pDocTable( NULL )
{
bIgnoreConfigure = sal_False;
-
- // Array zum Ermitteln der Bindungen
- pEventArr = new SfxEventArr_Impl;
-
- // Einen default entry eingf"ugen
- const SfxEvent_Impl *pEvent = new SfxEvent_Impl(String(), 0);
- pEventArr->Insert(pEvent, 0);
}
-/*
-SfxEventConfigItem_Impl* SfxEventConfiguration::GetAppEventConfig_Impl()
-{
- if ( !pAppEventConfig )
- {
- pAppEventConfig = new SfxEventConfigItem_Impl( SFX_ITEMTYPE_APPEVENTCONFIG, this );
- pAppEventConfig->Initialize();
- }
- return pAppEventConfig;
-}
-*/
//==========================================================================
SfxEventConfiguration::~SfxEventConfiguration()
{
- for (USHORT n=0; n<pEventArr->Count(); n++)
- delete (*pEventArr)[n];
- delete pEventArr;
delete pDocTable;
if ( gp_Id_SortList )
{
- EventNames_Impl* pData = gp_Id_SortList->First();
- while ( pData )
- {
- delete pData;
- pData = gp_Id_SortList->Next();
- }
delete gp_Id_SortList;
delete gp_Name_SortList;
-
gp_Id_SortList = NULL;
gp_Name_SortList = NULL;
}
}
-//==========================================================================
-
-void SfxEventConfiguration::RegisterEvent(USHORT nId, const String& rName)
-{
- USHORT nCount = pEventArr->Count();
- const SfxEvent_Impl *pEvent = new SfxEvent_Impl(rName, nId);
- pEventArr->Insert(pEvent, nCount);
-}
-
-//==========================================================================
-
-String SfxEventConfiguration::GetEventName(USHORT nId) const
-{
- DBG_ASSERT(pEventArr,"Keine Events angemeldet!");
- USHORT nCount = pEventArr->Count();
- for (USHORT n=1; n<nCount; n++)
- {
- if ((*pEventArr)[n]->nEventId == nId)
- {
- return (*pEventArr)[n]->aEventName;
- }
- }
-
- DBG_ERROR("Event nicht gefunden!");
- return (*pEventArr)[0]->aEventName;
-}
-
-//==========================================================================
-
-USHORT SfxEventConfiguration::GetEventId(const String& rName) const
-{
- DBG_ASSERT(pEventArr,"Keine Events angemeldet!");
- USHORT nCount = pEventArr->Count();
- for (USHORT n=1; n<nCount; n++)
- {
- if ((*pEventArr)[n]->aEventName == rName)
- {
- return (*pEventArr)[n]->nEventId;
- }
- }
-
- DBG_ERROR("Event nicht gefunden!");
- return SFX_NO_EVENT;
-}
-
void SfxEventConfiguration::ConfigureEvent( USHORT nId, const SvxMacro& rMacro, SfxObjectShell *pDoc )
{
if ( bIgnoreConfigure )
@@ -333,315 +300,6 @@ void SfxEventConfiguration::ConfigureEvent( USHORT nId, const SvxMacro& rMacro,
}
//==========================================================================
-/*
-const SvxMacro* SfxEventConfiguration::GetMacroForEventId
-(
- USHORT nId,
- SfxObjectShell* pDoc
-)
-{
- pDocEventConfig = pDoc ? pDoc->GetEventConfig_Impl() : NULL;
- const SvxMacro* pMacro=NULL;
- if ( pDocEventConfig )
- pMacro = pDocEventConfig->aMacroTable.Seek( nId );
- if ( !pMacro )
- pMacro = GetAppEventConfig_Impl()->aMacroTable.Seek( nId );
- return pMacro;
-} */
-
-/*
-const SfxMacroInfo* SfxEventConfiguration::GetMacroInfo
-(
- USHORT nId,
- SfxObjectShell* pDoc
-) const
-{
- DBG_ASSERT(pEventArr,"Keine Events angemeldet!");
-
- SfxEventConfigItem_Impl *pDocEventConfig = pDoc ? pDoc->GetEventConfig_Impl() : NULL;
- const SvxMacro* pMacro=NULL;
- if ( pDocEventConfig )
- pMacro = pDocEventConfig->aMacroTable.Seek( nId );
- if ( !pMacro )
- pMacro = const_cast< SfxEventConfiguration* >(this)->GetAppEventConfig_Impl()->aMacroTable.Seek( nId );
-
- return SFX_APP()->GetMacroConfig()->GetMacroInfo_Impl( pMacro );
-} */
-
-//==========================================================================
-/*
-SfxEventConfigItem_Impl::SfxEventConfigItem_Impl( USHORT nConfigId,
- SfxEventConfiguration *pCfg,
- SfxObjectShell *pObjSh)
- : SfxConfigItem( nConfigId, pObjSh ? NULL : SFX_APP()->GetConfigManager_Impl() )
- , pEvConfig( pCfg )
- , pObjShell( pObjSh )
- , aMacroTable( 2, 2 )
- , bInitialized( FALSE )
-
-{
- bInitialized = TRUE;
-}
-
-//==========================================================================
-
-int SfxEventConfigItem_Impl::Load(SvStream& rStream)
-{
- USHORT nFileVersion;
- rStream >> nFileVersion;
- if ( nFileVersion < nCompatVersion || nFileVersion > nVersion )
- return SfxConfigItem::WARNING_VERSION;
-
- SvxMacroTableDtor aLocalMacroTable;
- if ( nFileVersion <= nOldVersion )
- {
- if ( nFileVersion > nCompatVersion )
- {
- USHORT nWarn;
- rStream >> nWarn;
- bWarning = ( nWarn & 0x01 ) != 0;
- bAlwaysWarning = ( nWarn & 0x02 ) != 0;
- }
- else
- bWarning = bAlwaysWarning = FALSE;
-
- USHORT nCount, nEventCount = pEvConfig->GetEventCount();
- rStream >> nCount;
-
- USHORT i;
- for (i=0; i<nCount; i++)
- {
- USHORT nId;
- SfxMacroInfo aInfo( pObjShell );
- rStream >> nId >> aInfo;
-
- for (USHORT n=0; n<nEventCount; n++)
- {
- USHORT nEventId = (*pEvConfig->pEventArr)[n+1]->nEventId;
- if ( nEventId == nId )
- {
- SvxMacro *pMacro = new SvxMacro( aInfo.GetQualifiedName(), aInfo.GetBasicName(), STARBASIC );
- aLocalMacroTable.Insert( nEventId, pMacro );
- break;
- }
- }
- }
- }
- else
- {
- USHORT nWarn;
- rStream >> nWarn;
- bWarning = ( nWarn & 0x01 ) != 0;
- bAlwaysWarning = ( nWarn & 0x02 ) != 0;
- aLocalMacroTable.Read( rStream );
- }
-
- if ( pObjShell && pEvConfig )
- pEvConfig->PropagateEvents_Impl( pObjShell, aLocalMacroTable );
-
- return SfxConfigItem::ERR_OK;
-}
-
-BOOL SfxEventConfigItem_Impl::LoadXML( SvStream& rInStream )
-{
- ::framework::EventsConfig aCfg;
-
- // #110897#
- // if ( ::framework::EventsConfiguration::LoadEventsConfig( rInStream, aCfg ) )
- if ( ::framework::EventsConfiguration::LoadEventsConfig( ::comphelper::getProcessServiceFactory(), rInStream, aCfg ) )
- {
- long nCount = aCfg.aEventNames.getLength();
- for ( long i=0; i<nCount; i++ )
- {
- SvxMacro* pMacro = SfxEvents_Impl::ConvertToMacro( aCfg.aEventsProperties[i], NULL, TRUE );
- USHORT nID = (USHORT) SfxEventConfiguration::GetEventId_Impl( aCfg.aEventNames[i] );
- if ( nID && pMacro )
- pEvConfig->PropagateEvent_Impl( pObjShell, nID, pMacro );
- else
- DBG_ERROR("Suspicious event binding!");
- }
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-//==========================================================================
-
-BOOL SfxEventConfigItem_Impl::Store(SvStream& rStream)
-{
- USHORT nWarn=0;
- if ( bWarning )
- nWarn |= 0x01;
- if ( bAlwaysWarning )
- nWarn |= 0x02;
- rStream << nVersion << nWarn;
- aMacroTable.Write( rStream );
- return TRUE;
-}
-
-BOOL SfxEventConfigItem_Impl::StoreXML( SvStream& rOutStream )
-{
- // get the event names
- ResStringArray aEventNames( SfxResId( EVENT_NAMES_ARY ) );
- long nNamesCount = aEventNames.Count();
-
- // create two sequences for names and properties
- SEQUENCE < OUSTRING > aSequence( nNamesCount );
- SEQUENCE < ANY > aData( nNamesCount );
-
- // fill in the names
- OUSTRING* pNames = aSequence.getArray();
- long i;
- for ( i=0; i<nNamesCount; i++ )
- pNames[i] = aEventNames.GetString( (USHORT) i);
-
- REFERENCE< XEVENTSSUPPLIER > xSupplier;
- if ( pObjShell )
- {
- xSupplier = REFERENCE< XEVENTSSUPPLIER >( pObjShell->GetModel(), UNO_QUERY );
- }
- else
- {
- xSupplier = REFERENCE< XEVENTSSUPPLIER >
- ( ::comphelper::getProcessServiceFactory()->createInstance(
- rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster" )), UNO_QUERY );
- }
-
- // fill in the bindings
- REFERENCE< XNAMEREPLACE > xEvents = xSupplier->getEvents();
- SvxMacroTableDtor& rTable = aMacroTable;
- long nCount = (long) rTable.Count();
- for ( i=0; i<nCount; i++ )
- {
- USHORT nID = (USHORT) rTable.GetObjectKey( i );
- OUSTRING aEventName = pEvConfig->GetEventName_Impl( nID );
- if ( aEventName.getLength() )
- {
- // search name
- long n;
- for ( n=0; n<(long)nNamesCount; n++ )
- {
- if ( aSequence[n] == aEventName )
- {
- aData[n] = xEvents->getByName( aEventName );
- break;
- }
- }
-
- DBG_ASSERT( n<nNamesCount, "Unknown event!" );
- }
- }
-
- ::framework::EventsConfig aCfg;
- aCfg.aEventNames = aSequence;
- aCfg.aEventsProperties = aData;
-
- // #110897#
- // return ::framework::EventsConfiguration::StoreEventsConfig( rOutStream, aCfg );
- return ::framework::EventsConfiguration::StoreEventsConfig( ::comphelper::getProcessServiceFactory(), rOutStream, aCfg );
-}
-
-//==========================================================================
-
-String SfxEventConfigItem_Impl::GetStreamName() const
-{
- return SfxConfigItem::GetStreamName( GetType() );
-}
-
-//==========================================================================
-
-void SfxEventConfigItem_Impl::UseDefault()
-{
- bWarning = TRUE;
- bAlwaysWarning = FALSE;
-
- aMacroTable.DelDtor();
- SetDefault( TRUE );
- pEvConfig->PropagateEvents_Impl( pObjShell, aMacroTable );
-}
-
-int SfxEventConfigItem_Impl::Load( SotStorage& rStorage )
-{
- SotStorageStreamRef xStream = rStorage.OpenSotStream( SfxEventConfigItem_Impl::GetStreamName(), STREAM_STD_READ );
- if ( xStream->GetError() )
- return SfxConfigItem::ERR_READ;
- else
- {
- if ( bInitialized )
- {
- aMacroTable.DelDtor();
- pEvConfig->PropagateEvents_Impl( pObjShell, aMacroTable );
- }
-
- if ( LoadXML( *xStream ) )
- return SfxConfigItem::ERR_OK;
- else
- return SfxConfigItem::ERR_READ;
- }
-}
-
-BOOL SfxEventConfigItem_Impl::Store( SotStorage& rStorage )
-{
- if ( pObjShell )
- // DocEventConfig is stored with the document
- return TRUE;
-
- SotStorageStreamRef xStream = rStorage.OpenSotStream( SfxEventConfigItem_Impl::GetStreamName(), STREAM_STD_READWRITE|STREAM_TRUNC );
- if ( xStream->GetError() )
- return FALSE;
- else
- return StoreXML( *xStream );
-}
-
-
-//==========================================================================
-
-SfxEventConfigItem_Impl::~SfxEventConfigItem_Impl()
-{
-}
-
-//==========================================================================
-
-void SfxEventConfigItem_Impl::ConfigureEvent( USHORT nId, SvxMacro *pMacro )
-{
- if ( aMacroTable.Seek( nId ) )
- {
- if ( pMacro )
- aMacroTable.Replace( nId, pMacro );
- else
- aMacroTable.Remove( nId );
- }
- else if ( pMacro )
- aMacroTable.Insert( nId, pMacro );
- SetDefault(FALSE);
-}
-
-
-void SfxEventConfiguration::AddEvents( SfxMacroTabPage* pPage ) const
-{
- DBG_ASSERT(pEventArr,"Keine Events angemeldet!");
- USHORT nCount = pEventArr->Count();
- for (USHORT n=1; n<nCount; n++)
- if ( (*pEventArr)[n]->aEventName.Len() )
- pPage->AddEvent( (*pEventArr)[n]->aEventName, (*pEventArr)[n]->nEventId );
-}
-
-
-SvxMacroTableDtor* SfxEventConfiguration::GetAppEventTable()
-{
- return &GetAppEventConfig_Impl()->aMacroTable;
-}
- *
-void SfxEventConfiguration::SetAppEventTable( const SvxMacroTableDtor& rTable )
-{
- //GetAppEventConfig_Impl()->aMacroTable = rTable;
- //pAppEventConfig->SetDefault(FALSE);
- PropagateEvents_Impl( NULL, rTable );
-}
-
-*/
SvxMacroTableDtor* SfxEventConfiguration::GetDocEventTable( SfxObjectShell*pDoc )
{
@@ -668,98 +326,6 @@ SvxMacroTableDtor* SfxEventConfiguration::GetDocEventTable( SfxObjectShell*pDoc
return pDocTable;
}
-/*
-void SfxEventConfiguration::SetDocEventTable( SfxObjectShell *pDoc,
- const SvxMacroTableDtor& rTable )
-{
- if ( pDoc )
- {
- pDoc->SetModified(TRUE);
- PropagateEvents_Impl( pDoc, rTable );
- }
- else
- DBG_ERROR( "No Document!" );
-}
-
-//--------------------------------------------------------------------------
-void SfxEventConfiguration::PropagateEvents_Impl( SfxObjectShell *pDoc,
- const SvxMacroTableDtor& rTable )
-{
- REFERENCE< XEVENTSSUPPLIER > xSupplier;
- if ( pDoc )
- {
- xSupplier = REFERENCE< XEVENTSSUPPLIER >( pDoc->GetModel(), UNO_QUERY );
- }
- else
- {
- xSupplier = REFERENCE< XEVENTSSUPPLIER >
- ( ::comphelper::getProcessServiceFactory()->createInstance(
- rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster" )), UNO_QUERY );
- }
-
- if ( xSupplier.is() )
- {
- SvxMacro *pMacro;
- ULONG nCount;
- ULONG nID, i;
-
- REFERENCE< XNAMEREPLACE > xEvents = xSupplier->getEvents();
-
- bIgnoreConfigure = sal_True;
-
- // Erase old values first, because we don't know anything about the
- // changes here
-
- SEQUENCE < PROPERTYVALUE > aProperties;
- SEQUENCE < OUSTRING > aEventNames = xEvents->getElementNames();
- OUSTRING* pNames = aEventNames.getArray();
- ANY aEmpty;
-
- aEmpty <<= aProperties;
- nCount = aEventNames.getLength();
-
- for ( i=0; i<nCount; i++ )
- {
- try
- {
- xEvents->replaceByName( pNames[i], aEmpty );
- }
- catch( ::com::sun::star::lang::IllegalArgumentException )
- { DBG_ERRORFILE( "PropagateEvents_Impl: caught IllegalArgumentException" ) }
- catch( ::com::sun::star::container::NoSuchElementException )
- { DBG_ERRORFILE( "PropagateEvents_Impl: caught NoSuchElementException" ) }
- }
-
- // now set the new values
-
- nCount = rTable.Count();
-
- for ( i=0; i<nCount; i++ )
- {
- pMacro = rTable.GetObject( i );
- nID = rTable.GetObjectKey( i );
- OUSTRING aEventName = GetEventName_Impl( nID );
-
- if ( aEventName.getLength() )
- {
- ANY aEventData = CreateEventData_Impl( pMacro );
- try
- {
- xEvents->replaceByName( aEventName, aEventData );
- }
- catch( ::com::sun::star::lang::IllegalArgumentException )
- { DBG_ERRORFILE( "PropagateEvents_Impl: caught IllegalArgumentException" ) }
- catch( ::com::sun::star::container::NoSuchElementException )
- { DBG_ERRORFILE( "PropagateEvents_Impl: caught NoSuchElementException" ) }
- }
- else
- DBG_WARNING( "PropagateEvents_Impl: Got unkown event" );
- }
-
- bIgnoreConfigure = sal_False;
- }
-}
-*/
//--------------------------------------------------------------------------
void SfxEventConfiguration::PropagateEvent_Impl( SfxObjectShell *pDoc,
USHORT nId,
@@ -904,7 +470,7 @@ ULONG SfxEventConfiguration::GetPos_Impl( USHORT nId, sal_Bool &rFound )
long nEnd = gp_Id_SortList->Count() - 1;
long nMid = 0;
- EventNames_Impl* pMid;
+ SfxEventName* pMid;
rFound = sal_False;
@@ -950,7 +516,7 @@ ULONG SfxEventConfiguration::GetPos_Impl( const String& rName, sal_Bool &rFound
long nEnd = gp_Name_SortList->Count() - 1;
long nMid = 0;
- EventNames_Impl* pMid;
+ SfxEventName* pMid;
rFound = sal_False;
@@ -992,7 +558,7 @@ OUSTRING SfxEventConfiguration::GetEventName_Impl( ULONG nID )
if ( bFound )
{
- EventNames_Impl *pData = gp_Id_SortList->GetObject( nPos );
+ SfxEventName *pData = gp_Id_SortList->GetObject( nPos );
aRet = pData->maEventName;
}
}
@@ -1012,7 +578,7 @@ ULONG SfxEventConfiguration::GetEventId_Impl( const OUSTRING& rEventName )
if ( bFound )
{
- EventNames_Impl *pData = gp_Name_SortList->GetObject( nPos );
+ SfxEventName *pData = gp_Name_SortList->GetObject( nPos );
nRet = pData->mnId;
}
}
@@ -1027,8 +593,8 @@ void SfxEventConfiguration::RegisterEvent( USHORT nId,
{
if ( ! gp_Id_SortList )
{
- gp_Id_SortList = new SfxEventList_Impl;
- gp_Name_SortList = new SfxEventList_Impl;
+ gp_Id_SortList = new SfxEventNamesList;
+ gp_Name_SortList = new SfxEventNamesList;
}
sal_Bool bFound = sal_False;
@@ -1040,65 +606,12 @@ void SfxEventConfiguration::RegisterEvent( USHORT nId,
return;
}
- EventNames_Impl *pData;
-
- pData = new EventNames_Impl( nId, rMacroName, rUIName );
- gp_Id_SortList->Insert( pData, nPos );
-
+ gp_Id_SortList->Insert( nPos, new SfxEventName( nId, rMacroName, rUIName ) );
nPos = GetPos_Impl( rMacroName, bFound );
- DBG_ASSERT( !bFound, "RegisterEvent: Name in List, but ID not?" );
-
- gp_Name_SortList->Insert( pData, nPos );
-
- SFX_APP()->GetEventConfig()->RegisterEvent( nId, rUIName );
-}
-
-/*
-BOOL SfxEventConfiguration::Import( SvStream& rInStream, SvStream* pOutStream, SfxObjectShell* pDoc )
-{
- if ( pDoc )
- {
- // load events, they are automatically propagated to the document
- DBG_ASSERT( !pOutStream, "DocEventConfig must not be converted!" );
- SfxEventConfigItem_Impl* pCfg = pDoc->GetEventConfig_Impl( TRUE );
- if ( pCfg )
- return ( pCfg->Load( rInStream ) == SfxConfigItem::ERR_OK );
- DBG_ERROR("Couldn't create EventConfiguration!");
- return FALSE;
- }
- else if ( pOutStream )
- {
- SfxEventConfiguration aConfig;
- if ( aConfig.GetAppEventConfig_Impl()->Load( rInStream ) == SfxConfigItem::ERR_OK )
- return aConfig.pAppEventConfig->StoreXML( *pOutStream );
- return FALSE;
- }
- DBG_ERROR( "No OutStream!" );
- return FALSE;
-}
+ DBG_ASSERT( !bFound, "RegisterEvent: Name in List, but ID not?" );
-BOOL SfxEventConfiguration::Export( SvStream* pInStream, SvStream& rOutStream, SfxObjectShell* pDoc )
-{
- if ( pDoc )
- {
- DBG_ASSERT( !pInStream, "DocEventConfig can't be converted!" );
- SfxEventConfigItem_Impl* pCfg = pDoc->GetEventConfig_Impl();
- if ( pCfg )
- return pCfg->Store( rOutStream );
- DBG_ERROR("Couldn't create EventConfiguration!");
- return FALSE;
- }
- else if ( pInStream )
- {
- SfxEventConfiguration aConfig;
- if ( aConfig.GetAppEventConfig_Impl()->LoadXML( *pInStream ) )
- return aConfig.pAppEventConfig->Store( rOutStream );
- return FALSE;
- }
+ gp_Name_SortList->Insert( nPos, new SfxEventName( nId, rMacroName, rUIName ) );
- DBG_ERROR( "No InStream!" );
- return FALSE;
+ SFX_APP()->GetEventConfig();
}
-*/
-