diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-09-18 10:15:03 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-09-18 10:15:03 +0000 |
commit | b5d0edea37b43a55f4d6a730bb5961250e1984c4 (patch) | |
tree | 259c23a3e0b3f716360a486af766ba104d6f2b07 /sfx2 | |
parent | e50d2f7ae804b5a219cf4a440d19f7ac2d000c10 (diff) |
CWS-TOOLING: integrate CWS mba32issues02
2009-09-17 mb93783 merge commit
2009-09-03 tb121644 #i104748 - slot unification to .uno:PasteSpecial
2009-09-01 mba #101455#: code simplification
2009-08-31 mb93783 iso locales for norwegian builds are nb and nn, not no
2009-08-25 mba merge to m55
2009-07-29 mba cleanup after rebase
2009-07-29 mba #i103200#: wrong order of first and last name in CJK UI
2009-07-27 mba adding dictionary changes from broken svn CWS
2009-07-27 mba adding dictionary changes from broken svn CWS
2009-07-27 mba apply patch from broken svn CWS
Diffstat (limited to 'sfx2')
40 files changed, 525 insertions, 1501 deletions
diff --git a/sfx2/inc/sfx2/dinfdlg.hxx b/sfx2/inc/sfx2/dinfdlg.hxx index e33a3f89a9..ce84acd12a 100644 --- a/sfx2/inc/sfx2/dinfdlg.hxx +++ b/sfx2/inc/sfx2/dinfdlg.hxx @@ -417,12 +417,14 @@ private: ImageButton m_aRemoveButton; sal_Int32 m_nLineHeight; + sal_Int32 m_nScrollPos; SvtSysLocale m_aSysLocale; std::vector< CustomPropertyLine* > m_aCustomPropertiesLines; CustomPropertyLine* m_pCurrentLine; SvNumberFormatter m_aNumberFormatter; Timer m_aEditLoseFocusTimer; Timer m_aBoxLoseFocusTimer; + Link m_aRemovedHdl; DECL_LINK( TypeHdl, CustomPropertiesTypeBox* ); DECL_LINK( RemoveHdl, CustomPropertiesRemoveButton* ); @@ -449,6 +451,7 @@ public: bool DoesCustomPropertyExist( const String& rName ) const; ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetCustomProperties() const; + void SetRemovedHdl( const Link& rLink ) { m_aRemovedHdl = rLink; } }; // class CustomPropertiesControl ----------------------------------------- @@ -466,12 +469,13 @@ private: void Initialize(); DECL_LINK( ScrollHdl, ScrollBar* ); + DECL_LINK( RemovedHdl, void* ); public: CustomPropertiesControl( Window* pParent, const ResId& rResId ); ~CustomPropertiesControl(); - void AddLine( const ::rtl::OUString& sName, com::sun::star::uno::Any& rAny ); + void AddLine( const ::rtl::OUString& sName, com::sun::star::uno::Any& rAny, bool bInteractive ); inline bool AreAllLinesValid() const { return m_aPropertiesWin.AreAllLinesValid(); } inline void ClearAllLines() { m_aPropertiesWin.ClearAllLines(); } diff --git a/sfx2/inc/sfx2/event.hxx b/sfx2/inc/sfx2/event.hxx index 9c3d022983..60255b4b21 100644 --- a/sfx2/inc/sfx2/event.hxx +++ b/sfx2/inc/sfx2/event.hxx @@ -34,6 +34,8 @@ #include "sfx2/dllapi.h" #include <tools/string.hxx> #include <svtools/hint.hxx> +#include <svtools/eventcfg.hxx> +#include <rtl/ustring.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> @@ -44,33 +46,24 @@ class SfxObjectShell; class SFX2_DLLPUBLIC SfxEventHint : public SfxHint { - USHORT nEventId; SfxObjectShell* pObjShell; - String _aArgs; - BOOL _bDummy; - BOOL _bAddToHistory; + ::rtl::OUString aEventName; + USHORT nEventId; public: TYPEINFO(); - SfxEventHint( USHORT nId, - const String& rArgs, - SfxObjectShell *pObj = 0 ) - : nEventId(nId), - pObjShell(pObj), - _aArgs( rArgs ), - _bAddToHistory(FALSE) - {} - SfxEventHint( USHORT nId, SfxObjectShell *pObj = 0 ) - : nEventId(nId), - pObjShell(pObj), - _bAddToHistory(FALSE) + SfxEventHint( USHORT nId, const ::rtl::OUString& aName, SfxObjectShell *pObj = 0 ) + : pObjShell(pObj), + aEventName(aName), + nEventId(nId) {} - const String& GetArgs() const { return _aArgs;} - USHORT GetEventId() const { return nEventId; } + ::rtl::OUString GetEventName() const + { return aEventName; } + SfxObjectShell* GetObjShell() const { return pObjShell; } }; @@ -82,8 +75,6 @@ class SfxNamedHint : public SfxHint String _aEventName; SfxObjectShell* _pObjShell; String _aArgs; - BOOL _bDummy; - BOOL _bAddToHistory; public: TYPEINFO(); @@ -93,15 +84,13 @@ public: SfxObjectShell *pObj = 0 ) : _aEventName( rName ), _pObjShell( pObj), - _aArgs( rArgs ), - _bAddToHistory( FALSE ) + _aArgs( rArgs ) {} SfxNamedHint( const String& rName, SfxObjectShell *pObj = 0 ) : _aEventName( rName ), - _pObjShell( pObj ), - _bAddToHistory( FALSE ) + _pObjShell( pObj ) {} const String& GetArgs() const { return _aArgs;} diff --git a/sfx2/inc/sfx2/evntconf.hxx b/sfx2/inc/sfx2/evntconf.hxx index e7038ba2f7..d228f4e4d6 100644 --- a/sfx2/inc/sfx2/evntconf.hxx +++ b/sfx2/inc/sfx2/evntconf.hxx @@ -118,36 +118,9 @@ public: class SFX2_DLLPUBLIC SfxEventConfiguration { -friend class SfxEventConfigItem_Impl; - - SvxMacroTableDtor* pAppTable; - SvxMacroTableDtor* pDocTable; - sal_Bool bIgnoreConfigure; - public: - SfxEventConfiguration(); - ~SfxEventConfiguration(); - - void ConfigureEvent(USHORT nId, const SvxMacro&, - SfxObjectShell* pObjSh); - void ConfigureEvent(USHORT nId, const String& rMacro, - SfxObjectShell* pObjSh); - - SvxMacroTableDtor* GetDocEventTable(SfxObjectShell*); - - static void RegisterEvent( USHORT nId, const String& rName, - const String& rMacroName ); - - SAL_DLLPRIVATE BOOL Warn_Impl( SfxObjectShell *pDoc, const SvxMacro* pMacro ); - SAL_DLLPRIVATE void PropagateEvent_Impl( SfxObjectShell *pDoc, - USHORT nId, - const SvxMacro* pMacro ); - SAL_DLLPRIVATE static rtl::OUString GetEventName_Impl( ULONG nID ); - SAL_DLLPRIVATE static ULONG GetEventId_Impl( const rtl::OUString& rEventName ); - SAL_DLLPRIVATE ::com::sun::star::uno::Any CreateEventData_Impl( const SvxMacro *pMacro ); - - SAL_DLLPRIVATE static ULONG GetPos_Impl( USHORT nID, sal_Bool &rFound ); - SAL_DLLPRIVATE static ULONG GetPos_Impl( const String& rName, sal_Bool &rFound ); + static void ConfigureEvent( ::rtl::OUString aName, const SvxMacro&, SfxObjectShell* pObjSh); + static SvxMacro* ConvertToMacro( const com::sun::star::uno::Any& rElement, SfxObjectShell* pDoc, BOOL bBlowUp ); }; #endif diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index a2c1e1eb68..d9996b0d4b 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -734,7 +734,7 @@ public: const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos ); SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); - SAL_DLLPRIVATE static SEQUENCE< OUSTRING > GetEventNames_Impl(); + SAL_DLLPRIVATE SEQUENCE< OUSTRING > GetEventNames_Impl(); SAL_DLLPRIVATE void InitBasicManager_Impl(); SAL_DLLPRIVATE SfxObjectShell_Impl* Get_Impl() { return pImp; } diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc index 385a2d889c..ce6b09adbb 100644 --- a/sfx2/inc/sfx2/sfx.hrc +++ b/sfx2/inc/sfx2/sfx.hrc @@ -111,6 +111,9 @@ #define SFX_EVENT_SAVEDOCFAILED (EVENT_SFX_START + 28) #define SFX_EVENT_SAVETODOCFAILED (EVENT_SFX_START + 29) +#define SFX_EVENT_TITLECHANGED (EVENT_SFX_START + 30) +#define SFX_EVENT_MODECHANGED (EVENT_SFX_START + 31) + // Events f"ur Controls etc. #define SFX_EVENT_MOUSEOVER_OBJECT ( EVENT_SFX_START + 100 ) #define SFX_EVENT_MOUSECLICK_OBJECT ( EVENT_SFX_START + 101 ) diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx index 175e8afb74..e6d68889e4 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -1513,7 +1513,7 @@ private: SAL_DLLPRIVATE void impl_store( const OUSTRING& sURL , const SEQUENCE< PROPERTYVALUE >& seqArguments , sal_Bool bSaveTo ) ; - SAL_DLLPRIVATE void postEvent_Impl( ULONG nEventID ); + SAL_DLLPRIVATE void postEvent_Impl( ::rtl::OUString ); SAL_DLLPRIVATE String getEventName_Impl( long nID ); SAL_DLLPRIVATE void NotifyStorageListeners_Impl(); SAL_DLLPRIVATE bool QuerySaveSizeExceededModules( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler ); diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 2a68235f7f..09a9849d7c 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -140,8 +140,10 @@ //#define SID_TITLE (SID_SFX_START + 307) #define SID_CONTEXT (SID_SFX_START + 310) -#define SID_CURRENTTIME (SID_SFX_START + 311) -#define SID_CURRENTDATE (SID_SFX_START + 312) + +#define SID_PASTE_SPECIAL (SID_SFX_START + 311) +#define SID_CLIPBOARD_FORMAT_ITEMS (SID_SFX_START + 312) + #define SID_VERSION_VISIBLE (SID_SFX_START + 313) #define SID_PASTE_UNFORMATTED (SID_SFX_START + 314) #define SID_PRINTER_NOTFOUND_WARN (SID_SFX_START + 320) diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx index 0750f8592d..ae45545cba 100644 --- a/sfx2/inc/sfx2/viewsh.hxx +++ b/sfx2/inc/sfx2/viewsh.hxx @@ -38,6 +38,7 @@ #include <com/sun/star/uno/Reference.h> #include <svtools/lstner.hxx> #include <com/sun/star/ui/XContextMenuInterceptor.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp> #include <cppuhelper/interfacecontainer.hxx> #include "shell.hxx" #include <tools/gen.hxx> @@ -77,6 +78,9 @@ class NotifyEvent; #define SFX_PRINTER_CHG_ORIENTATION_FLAG 3 #define SFX_PRINTER_CHG_SIZE_FLAG 4 +#define SFX_PRINTERROR_NONE 0 +#define SFX_PRINTERROR_BUSY 1 + enum SfxScrollingMode { SCROLLING_NO, @@ -302,6 +306,8 @@ public: void SetAdditionalPrintOptions( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& ); + void AddRemoveClipboardListener( const com::sun::star::uno::Reference < com::sun::star::datatransfer::clipboard::XClipboardListener>&, BOOL ); + #if _SOLAR__PRIVATE SAL_DLLPRIVATE SfxInPlaceClient* GetUIActiveIPClient_Impl() const; SAL_DLLPRIVATE void AddContextMenuInterceptor_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::ui::XContextMenuInterceptor >& xInterceptor ); diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi index 61b897bace..5da69fa977 100644 --- a/sfx2/sdi/appslots.sdi +++ b/sfx2/sdi/appslots.sdi @@ -92,14 +92,6 @@ interface Application ExecMethod = MiscExec_Impl ; StateMethod = MiscState_Impl ; ] - SID_CURRENTTIME // ole(no) api(final/play/norec) - [ - StateMethod = MiscState_Impl ; - ] - SID_CURRENTDATE // ole(no) api(final/play/norec) - [ - StateMethod = MiscState_Impl ; - ] SID_LOADCONFIG // ole(no) api(final/play) [ ExecMethod = MiscExec_Impl ; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index db625a9386..26f55ccdd1 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -853,7 +853,7 @@ SfxBoolItem BrowseView SID_BROWSER_MODE [ /* flags: */ AutoUpdate = TRUE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -1041,7 +1041,7 @@ SfxVoidItem ClearHistory SID_CLEARHISTORY [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -1447,60 +1447,6 @@ SfxVoidItem CreateMacro SID_BASICIDE_CREATEMACRO ] //-------------------------------------------------------------------------- -SfxStringItem CurrentDate SID_CURRENTDATE - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Volatile, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = TRUE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = TRUE, - ToolBoxConfig = FALSE, - GroupId = GID_VIEW; -] - -//-------------------------------------------------------------------------- -SfxStringItem CurrentTime SID_CURRENTTIME - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Volatile, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = TRUE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = TRUE, - ToolBoxConfig = FALSE, - GroupId = GID_VIEW; -] - -//-------------------------------------------------------------------------- SfxStringItem CurrentURL SID_CURRENT_URL [ @@ -1842,7 +1788,7 @@ SfxBoolItem EditDoc SID_EDITDOC [ /* flags: */ AutoUpdate = TRUE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -4287,7 +4233,7 @@ SfxBoolItem Modified SID_MODIFIED [ /* flags: */ AutoUpdate = TRUE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -5015,7 +4961,7 @@ SfxVoidItem Paste SID_PASTE [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = TRUE, HasCoreId = FALSE, HasDialog = FALSE, @@ -5035,6 +4981,59 @@ SfxVoidItem Paste SID_PASTE ] //-------------------------------------------------------------------------- +SfxVoidItem ClipboardFormatItems SID_CLIPBOARD_FORMAT_ITEMS +(SfxUInt32Item SelectedFormat SID_CLIPBOARD_FORMAT_ITEMS) +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* status: */ + SlotType = SvxClipboardFmtItem + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_EDIT; +] + +//-------------------------------------------------------------------------- +SfxInt16Item PasteSpecial SID_PASTE_SPECIAL +(SfxUInt32Item Format SID_PASTE_SPECIAL) +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_EDIT; +] + +//-------------------------------------------------------------------------- SfxStringItem DocPath SID_DOCPATH [ @@ -5486,7 +5485,7 @@ SfxVoidItem Redo SID_REDO [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -5539,7 +5538,7 @@ SfxBoolItem Reload SID_RELOAD [ /* flags: */ AutoUpdate = TRUE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -5643,7 +5642,7 @@ SfxStringItem RepeatAction SID_REPEAT /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -5747,7 +5746,7 @@ SfxBoolItem Save SID_SAVEDOC [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = TRUE, HasCoreId = FALSE, HasDialog = FALSE, @@ -7179,7 +7178,7 @@ SfxVoidItem Undo SID_UNDO [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -8809,7 +8808,7 @@ SfxInt16Item PasteUnformatted SID_PASTE_UNFORMATTED [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = TRUE, HasCoreId = FALSE, HasDialog = FALSE, diff --git a/sfx2/sdi/sfxslots.sdi b/sfx2/sdi/sfxslots.sdi index 7e851ae414..7954591236 100644 --- a/sfx2/sdi/sfxslots.sdi +++ b/sfx2/sdi/sfxslots.sdi @@ -59,6 +59,7 @@ TypeLibFile( "sfxslots.tlb" ) item String SfxFrameItem; //! Dummy item String SfxObjectShellItem //! Dummy item String SfxUsrAnyItem //! Dummy + item String SvxClipboardFmtItem; //! Dummy struct Point { diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 135f2f3f2b..d1aa10f5de 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -505,7 +505,7 @@ void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) if ( pOldContainerFrame ) { if ( bTaskActivate ) - NotifyEvent( SfxEventHint( SFX_EVENT_DEACTIVATEDOC, pOldContainerFrame->GetObjectShell() ) ); + NotifyEvent( SfxEventHint( SFX_EVENT_DEACTIVATEDOC, GlobalEventConfig::GetEventName(STR_EVENT_DEACTIVATEDOC), pOldContainerFrame->GetObjectShell() ) ); pOldContainerFrame->DoDeactivate( bTaskActivate, pFrame ); if( pOldContainerFrame->GetProgress() ) @@ -529,7 +529,7 @@ void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) if ( bTaskActivate && pNewContainerFrame->GetObjectShell() ) { pNewContainerFrame->GetObjectShell()->PostActivateEvent_Impl( pNewContainerFrame ); - NotifyEvent(SfxEventHint(SFX_EVENT_ACTIVATEDOC, pNewContainerFrame->GetObjectShell() ) ); + NotifyEvent(SfxEventHint(SFX_EVENT_ACTIVATEDOC, GlobalEventConfig::GetEventName(STR_EVENT_ACTIVATEDOC), pNewContainerFrame->GetObjectShell() ) ); } SfxProgress *pProgress = pNewContainerFrame->GetProgress(); diff --git a/sfx2/source/appl/app.hrc b/sfx2/source/appl/app.hrc index b1c2c84498..112c5c4506 100644 --- a/sfx2/source/appl/app.hrc +++ b/sfx2/source/appl/app.hrc @@ -78,27 +78,11 @@ #define RID_RECORDINGTOOLBOX (RID_SFX_APP_START+43) #define RID_ENVTOOLBOX (RID_SFX_APP_START+44) -#define STR_EVENT_STARTAPP (RID_SFX_APP_START+50) -#define STR_EVENT_CLOSEAPP (RID_SFX_APP_START+51) -#define STR_EVENT_CREATEDOC (RID_SFX_APP_START+52) -#define STR_EVENT_OPENDOC (RID_SFX_APP_START+53) -#define STR_EVENT_CLOSEDOC (RID_SFX_APP_START+54) -#define STR_EVENT_SAVEDOC (RID_SFX_APP_START+55) -#define STR_EVENT_SAVEASDOC (RID_SFX_APP_START+56) -#define STR_EVENT_ACTIVATEDOC (RID_SFX_APP_START+57) -#define STR_EVENT_DEACTIVATEDOC (RID_SFX_APP_START+58) -#define STR_EVENT_ONERROR (RID_SFX_APP_START+78) -#define STR_EVENT_PREPARECLOSEDOC (RID_SFX_APP_START+89) -#define STR_EVENT_MODIFYCHANGED (RID_SFX_APP_START+90) -#define STR_EVENT_SAVEDOCDONE (RID_SFX_APP_START+95) -#define STR_EVENT_SAVEASDOCDONE (RID_SFX_APP_START+96) - #define STR_QUITAPP (RID_SFX_APP_START+59) #define STR_EXITANDRETURN (RID_SFX_APP_START+60) #define STR_ERR_NOFILE (RID_SFX_APP_START+61) #define STR_EXTHELPSTATUS (RID_SFX_APP_START+62) -#define STR_EVENT_PRINTDOC (RID_SFX_APP_START+64) #define STR_ADDRESS_NAME (RID_SFX_APP_START+65) #define RID_STR_HLPFILENOTEXIST (RID_SFX_APP_START+68) diff --git a/sfx2/source/appl/app.src b/sfx2/source/appl/app.src index 9b7ea4e64f..555c7467aa 100644 --- a/sfx2/source/appl/app.src +++ b/sfx2/source/appl/app.src @@ -502,76 +502,6 @@ ToolBox RID_FULLSCREENTOOLBOX }; }; -String STR_EVENT_STARTAPP -{ - Text [ en-US ] = "Start Application" ; -}; - -String STR_EVENT_CLOSEAPP -{ - Text [ en-US ] = "Close Application" ; -}; - -String STR_EVENT_CREATEDOC -{ - Text [ en-US ] = "Create Document" ; -}; - -String STR_EVENT_CLOSEDOC -{ - Text [ en-US ] = "Document closed" ; -}; - -String STR_EVENT_PREPARECLOSEDOC -{ - Text [ en-US ] = "Document is closing" ; -}; - -String STR_EVENT_OPENDOC -{ - Text [ en-US ] = "Open Document" ; -}; - -String STR_EVENT_SAVEDOC -{ - Text [ en-US ] = "Save Document" ; -}; - -String STR_EVENT_SAVEASDOC -{ - Text [ en-US ] = "Save Document As" ; -}; - -String STR_EVENT_SAVEDOCDONE -{ - Text [ en-US ] = "Document has been saved" ; -}; - -String STR_EVENT_SAVEASDOCDONE -{ - Text [ en-US ] = "Document has been saved as" ; -}; - -String STR_EVENT_ACTIVATEDOC -{ - Text [ en-US ] = "Activate Document" ; -}; - -String STR_EVENT_DEACTIVATEDOC -{ - Text [ en-US ] = "Deactivate Document" ; -}; - -String STR_EVENT_PRINTDOC -{ - Text [ en-US ] = "Print Document" ; -}; - -String STR_EVENT_MODIFYCHANGED -{ - Text [ en-US ] = "'Modified' status was changed" ; -}; - String STR_ERR_NOTEMPLATE { Text [ en-US ] = "The selected template has an incorrect format" ; @@ -582,7 +512,6 @@ String STR_ERR_NOFILE Text [ en-US ] = "Can't open file $." ; }; - String STR_QUITAPP { Text [ en-US ] = "E~xit" ; diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index c99f00a09d..d7be1bbf66 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -160,10 +160,12 @@ IMPL_LINK(SfxEventAsyncer_Impl, TimerHdl, Timer*, pAsyncTimer) SfxObjectShellRef xRef( aHint.GetObjShell() ); pAsyncTimer->Stop(); #ifdef DBG_UTIL - ::rtl::OUString aName = SfxEventConfiguration::GetEventName_Impl( aHint.GetEventId() ); - ByteString aTmp( "SfxEvent: "); - aTmp += ByteString( String(aName), RTL_TEXTENCODING_UTF8 ); - DBG_TRACE( aTmp.GetBuffer() ); + if (!xRef.Is()) + { + ByteString aTmp( "SfxEvent: "); + aTmp += ByteString( String( aHint.GetEventName() ), RTL_TEXTENCODING_UTF8 ); + DBG_TRACE( aTmp.GetBuffer() ); + } #endif SFX_APP()->Broadcast( aHint ); if ( xRef.Is() ) @@ -1037,7 +1039,7 @@ SfxEventConfiguration* SfxApplication::GetEventConfig() const //-------------------------------------------------------------------- void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, FASTBOOL bSynchron ) { - DBG_ASSERT(pAppData_Impl->pEventConfig,"Keine Events angemeldet!"); + //DBG_ASSERT(pAppData_Impl->pEventConfig,"Keine Events angemeldet!"); SfxObjectShell *pDoc = rEventHint.GetObjShell(); if ( pDoc && ( pDoc->IsPreview() || !pDoc->Get_Impl()->bInitialized ) ) @@ -1052,6 +1054,14 @@ void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, FASTBOOL bSync if ( bSynchron ) { +#ifdef DBG_UTIL + if (!pDoc) + { + ByteString aTmp( "SfxEvent: "); + aTmp += ByteString( String( rEventHint.GetEventName() ), RTL_TEXTENCODING_UTF8 ); + DBG_TRACE( aTmp.GetBuffer() ); + } +#endif Broadcast(rEventHint); if ( pDoc ) pDoc->Broadcast( rEventHint ); diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 13173dba77..a995006238 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -144,7 +144,6 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a pApp->Broadcast( SfxSimpleHint( SFX_HINT_DEINITIALIZING ) ); pApp->Get_Impl()->pAppDispatch->ReleaseAll(); pApp->Get_Impl()->pAppDispatch->release(); - pApp->NotifyEvent(SfxEventHint( SFX_EVENT_CLOSEAPP) ); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); css::uno::Reference< css::document::XEventListener > xGlobalBroadcaster(xSMGR->createInstance(SERVICE_GLOBALEVENTBROADCASTER), css::uno::UNO_QUERY); @@ -301,38 +300,6 @@ FASTBOOL SfxApplication::Initialize_Impl() Registrations_Impl(); -// ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - // TODO/LATER: exchange confusing defines; CREATEDOC -> NEWDOC, DOCCREATED -> CREATEDOC - SfxEventConfiguration::RegisterEvent(SFX_EVENT_STARTAPP, String(SfxResId(STR_EVENT_STARTAPP)), SfxObjectShell::GetEventNames_Impl()[0] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_CLOSEAPP, String(SfxResId(STR_EVENT_CLOSEAPP)), SfxObjectShell::GetEventNames_Impl()[1] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_CREATEDOC, String(SfxResId(STR_EVENT_CREATEDOC)), SfxObjectShell::GetEventNames_Impl()[2] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_OPENDOC, String(SfxResId(STR_EVENT_OPENDOC)), SfxObjectShell::GetEventNames_Impl()[3] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEASDOC, String(SfxResId(STR_EVENT_SAVEASDOC)), SfxObjectShell::GetEventNames_Impl()[4] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEASDOCDONE, String(SfxResId(STR_EVENT_SAVEASDOCDONE)), SfxObjectShell::GetEventNames_Impl()[5] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEDOC, String(SfxResId(STR_EVENT_SAVEDOC)), SfxObjectShell::GetEventNames_Impl()[6] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEDOCDONE, String(SfxResId(STR_EVENT_SAVEDOCDONE)), SfxObjectShell::GetEventNames_Impl()[7] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_PREPARECLOSEDOC, String(SfxResId(STR_EVENT_PREPARECLOSEDOC)),SfxObjectShell::GetEventNames_Impl()[8] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_CLOSEDOC, String(SfxResId(STR_EVENT_CLOSEDOC)), SfxObjectShell::GetEventNames_Impl()[9] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_ACTIVATEDOC, String(SfxResId(STR_EVENT_ACTIVATEDOC)), SfxObjectShell::GetEventNames_Impl()[10] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_DEACTIVATEDOC, String(SfxResId(STR_EVENT_DEACTIVATEDOC)), SfxObjectShell::GetEventNames_Impl()[11] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_PRINTDOC, String(SfxResId(STR_EVENT_PRINTDOC)), SfxObjectShell::GetEventNames_Impl()[12] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_MODIFYCHANGED, String(SfxResId(STR_EVENT_MODIFYCHANGED)), SfxObjectShell::GetEventNames_Impl()[13] ); - - SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVETODOC, String(), SfxObjectShell::GetEventNames_Impl()[14] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVETODOCDONE, String(), SfxObjectShell::GetEventNames_Impl()[15] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_VIEWCREATED, String(), SfxObjectShell::GetEventNames_Impl()[16] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_PREPARECLOSEVIEW, String(), SfxObjectShell::GetEventNames_Impl()[17] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_CLOSEVIEW, String(), SfxObjectShell::GetEventNames_Impl()[18] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_VISAREACHANGED, String(), SfxObjectShell::GetEventNames_Impl()[19] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_DOCCREATED, String(), SfxObjectShell::GetEventNames_Impl()[20] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_LOADFINISHED, String(), SfxObjectShell::GetEventNames_Impl()[21] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEASDOCFAILED, String(), SfxObjectShell::GetEventNames_Impl()[22] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEDOCFAILED, String(), SfxObjectShell::GetEventNames_Impl()[23] ); - SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVETODOCFAILED, String(), SfxObjectShell::GetEventNames_Impl()[24] ); - SfxEventConfiguration::RegisterEvent(SFX_HINT_TITLECHANGED, String(), SfxObjectShell::GetEventNames_Impl()[25] ); - SfxEventConfiguration::RegisterEvent(SFX_HINT_MODECHANGED, String(), SfxObjectShell::GetEventNames_Impl()[26] ); - // Subklasse initialisieren pAppData_Impl->bDowning = sal_False; Init(); diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index cfa60d4e8c..7a70f6f094 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -668,17 +668,6 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) rSet.DisableItem(nWhich); break; - case SID_CURRENTTIME: - { - rSet.Put( SfxStringItem( nWhich, aLocaleWrapper.getTime( Time(), FALSE ) ) ); - break; - } - case SID_CURRENTDATE: - { - rSet.Put( SfxStringItem( nWhich, aLocaleWrapper.getDate( Date() ) ) ); - break; - } - case SID_HELPTIPS: { rSet.Put( SfxBoolItem( SID_HELPTIPS, Help::IsQuickHelpEnabled() ) ); @@ -859,6 +848,12 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) pFact->CreateFrameDialog( NULL, xFrame, rReq.GetSlot(), sPageURL ); pDlg->Execute(); delete pDlg; + SfxViewFrame* pView = SfxViewFrame::GetFirst(); + while ( pView ) + { + pView->GetBindings().InvalidateAll(FALSE); + pView = SfxViewFrame::GetNext( *pView ); + } } break; } diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx index 1b76a3c795..ec52cacbeb 100644 --- a/sfx2/source/config/evntconf.cxx +++ b/sfx2/source/config/evntconf.cxx @@ -69,23 +69,6 @@ #include <com/sun/star/uno/Reference.hxx> // ----------------------------------------------------------------------- - -#define PROPERTYVALUE ::com::sun::star::beans::PropertyValue -#define XNAMEREPLACE ::com::sun::star::container::XNameReplace -#define XEVENTSSUPPLIER ::com::sun::star::document::XEventsSupplier -#define ANY ::com::sun::star::uno::Any -#define REFERENCE ::com::sun::star::uno::Reference -#define SEQUENCE ::com::sun::star::uno::Sequence -#define UNO_QUERY ::com::sun::star::uno::UNO_QUERY - -#define OUSTRING ::rtl::OUString - -// ----------------------------------------------------------------------- - -static const USHORT nCompatVersion = 3; -static const USHORT nOldVersion = 4; -static const USHORT nVersion = 5; - TYPEINIT1(SfxEventHint, SfxHint); TYPEINIT1(SfxEventNamesItem, SfxPoolItem); @@ -176,195 +159,11 @@ void SfxEventNamesItem::AddEvent( const String& rName, const String& rUIName, US aEventsList.Insert( new SfxEventName( nID, rName, rUIName.Len() ? rUIName : rName ) ); } -// class SfxAsyncEvent_Impl ---------------------------------------------- - -class SfxAsyncEvent_Impl : public SfxListener -{ - String aArgs; - SfxObjectShell* pSh; - const SvxMacro* pMacro; - Timer *pTimer; - -public: - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - SfxAsyncEvent_Impl( SfxObjectShell *pDoc, const SvxMacro *pMacro, const String& rArgs ); - ~SfxAsyncEvent_Impl(); - DECL_LINK( TimerHdl, Timer*); -}; - -// ----------------------------------------------------------------------- - -void SfxAsyncEvent_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - SfxSimpleHint* pHint = PTR_CAST( SfxSimpleHint, &rHint ); - if( pHint && pHint->GetId() == SFX_HINT_DYING && pTimer->IsActive() ) - { - pTimer->Stop(); - delete this; - } -} - -// ----------------------------------------------------------------------- - -SfxAsyncEvent_Impl::SfxAsyncEvent_Impl( SfxObjectShell *pDoc, const SvxMacro *pMac, const String& rArgs ) - : aArgs( rArgs ) - , pSh( pDoc ) - , pMacro( pMac ) -{ - if( pSh ) StartListening( *pSh ); - pTimer = new Timer; - pTimer->SetTimeoutHdl( LINK(this, SfxAsyncEvent_Impl, TimerHdl) ); - pTimer->SetTimeout( 0 ); - pTimer->Start(); -} - -// ----------------------------------------------------------------------- - -SfxAsyncEvent_Impl::~SfxAsyncEvent_Impl() -{ - delete pTimer; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK(SfxAsyncEvent_Impl, TimerHdl, Timer*, pAsyncTimer) -{ - pAsyncTimer->Stop(); - ScriptType eSType = pMacro->GetScriptType(); - BOOL bIsBasic = ( eSType == STARBASIC ); - if ( bIsBasic && StarBASIC::IsRunning() ) - // Neues eventgebundenes Macro erst ausf"uhren, wenn gerade kein anderes Macro mehr l"auft - pAsyncTimer->Start(); - else - { - SFX_APP()->GetMacroConfig()->ExecuteMacro( pSh, pMacro, aArgs ); - delete this; - } - - return 0L; -} - -SfxEventNamesList *gp_Id_SortList = NULL; -SfxEventNamesList *gp_Name_SortList = NULL; - -//========================================================================== - -SfxEventConfiguration::SfxEventConfiguration() - : pAppTable( NULL ) - , pDocTable( NULL ) -{ - bIgnoreConfigure = sal_False; -} - -//========================================================================== - -SfxEventConfiguration::~SfxEventConfiguration() -{ - delete pDocTable; - - if ( gp_Id_SortList ) - { - delete gp_Id_SortList; - delete gp_Name_SortList; - gp_Id_SortList = NULL; - gp_Name_SortList = NULL; - } -} - -void SfxEventConfiguration::ConfigureEvent( USHORT nId, const SvxMacro& rMacro, SfxObjectShell *pDoc ) -{ - if ( bIgnoreConfigure ) - return; - - SvxMacro *pMacro = NULL; - if ( rMacro.GetMacName().Len() ) - pMacro = new SvxMacro( rMacro.GetMacName(), rMacro.GetLibName(), rMacro.GetScriptType() ); - if ( pDoc ) - { - PropagateEvent_Impl( pDoc, nId, pMacro ); - } - else - { - PropagateEvent_Impl( NULL, nId, pMacro ); - } -} //========================================================================== -SvxMacroTableDtor* SfxEventConfiguration::GetDocEventTable( SfxObjectShell*pDoc ) -{ - if ( pDocTable ) - delete pDocTable; - - pDocTable = new SvxMacroTableDtor; - - if ( pDoc ) - { - REFERENCE< XEVENTSSUPPLIER > xSup( pDoc->GetModel(), UNO_QUERY ); - uno::Reference < container::XNameReplace > xEvents = xSup->getEvents(); - - uno::Sequence < ::rtl::OUString > aNames = xEvents->getElementNames(); - for ( sal_Int32 i=0; i<aNames.getLength(); i++ ) - { - SvxMacro* pMacro = SfxEvents_Impl::ConvertToMacro( xEvents->getByName( aNames[i] ), pDoc, TRUE ); - USHORT nID = (USHORT) GetEventId_Impl( aNames[i] ); - if ( nID && pMacro ) - pDocTable->Insert( nID, pMacro ); - } - } - - return pDocTable; -} - //-------------------------------------------------------------------------- -void SfxEventConfiguration::PropagateEvent_Impl( SfxObjectShell *pDoc, - USHORT nId, - const SvxMacro* pMacro ) -{ - 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() ) - { - REFERENCE< XNAMEREPLACE > xEvents = xSupplier->getEvents(); - - bIgnoreConfigure = sal_True; - - 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; - } -} - -// ------------------------------------------------------------------------------------------------------- -ANY SfxEventConfiguration::CreateEventData_Impl( const SvxMacro *pMacro ) +uno::Any CreateEventData_Impl( const SvxMacro *pMacro ) { /* This function converts a SvxMacro into an Any containing three @@ -376,57 +175,57 @@ ANY SfxEventConfiguration::CreateEventData_Impl( const SvxMacro *pMacro ) If pMacro is NULL, we return an empty property sequence, so PropagateEvent_Impl can delete an event binding. */ - ANY aEventData; + uno::Any aEventData; if ( pMacro ) { if ( pMacro->GetScriptType() == STARBASIC ) { - SEQUENCE < PROPERTYVALUE > aProperties(3); - PROPERTYVALUE *pValues = aProperties.getArray(); + uno::Sequence < beans::PropertyValue > aProperties(3); + beans::PropertyValue *pValues = aProperties.getArray(); - OUSTRING aType = OUSTRING::createFromAscii( STAR_BASIC );; - OUSTRING aLib = pMacro->GetLibName(); - OUSTRING aMacro = pMacro->GetMacName(); + ::rtl::OUString aType = ::rtl::OUString::createFromAscii( STAR_BASIC );; + ::rtl::OUString aLib = pMacro->GetLibName(); + ::rtl::OUString aMacro = pMacro->GetMacName(); - pValues[ 0 ].Name = OUSTRING::createFromAscii( PROP_EVENT_TYPE ); + pValues[ 0 ].Name = ::rtl::OUString::createFromAscii( PROP_EVENT_TYPE ); pValues[ 0 ].Value <<= aType; - pValues[ 1 ].Name = OUSTRING::createFromAscii( PROP_LIBRARY ); + pValues[ 1 ].Name = ::rtl::OUString::createFromAscii( PROP_LIBRARY ); pValues[ 1 ].Value <<= aLib; - pValues[ 2 ].Name = OUSTRING::createFromAscii( PROP_MACRO_NAME ); + pValues[ 2 ].Name = ::rtl::OUString::createFromAscii( PROP_MACRO_NAME ); pValues[ 2 ].Value <<= aMacro; aEventData <<= aProperties; } else if ( pMacro->GetScriptType() == EXTENDED_STYPE ) { - SEQUENCE < PROPERTYVALUE > aProperties(2); - PROPERTYVALUE *pValues = aProperties.getArray(); + uno::Sequence < beans::PropertyValue > aProperties(2); + beans::PropertyValue *pValues = aProperties.getArray(); - OUSTRING aLib = pMacro->GetLibName(); - OUSTRING aMacro = pMacro->GetMacName(); + ::rtl::OUString aLib = pMacro->GetLibName(); + ::rtl::OUString aMacro = pMacro->GetMacName(); - pValues[ 0 ].Name = OUSTRING::createFromAscii( PROP_EVENT_TYPE ); + pValues[ 0 ].Name = ::rtl::OUString::createFromAscii( PROP_EVENT_TYPE ); pValues[ 0 ].Value <<= aLib; - pValues[ 1 ].Name = OUSTRING::createFromAscii( PROP_SCRIPT ); + pValues[ 1 ].Name = ::rtl::OUString::createFromAscii( PROP_SCRIPT ); pValues[ 1 ].Value <<= aMacro; aEventData <<= aProperties; } else if ( pMacro->GetScriptType() == JAVASCRIPT ) { - SEQUENCE < PROPERTYVALUE > aProperties(2); - PROPERTYVALUE *pValues = aProperties.getArray(); + uno::Sequence < beans::PropertyValue > aProperties(2); + beans::PropertyValue *pValues = aProperties.getArray(); - OUSTRING aMacro = pMacro->GetMacName(); + ::rtl::OUString aMacro = pMacro->GetMacName(); - pValues[ 0 ].Name = OUSTRING::createFromAscii( PROP_EVENT_TYPE ); + pValues[ 0 ].Name = ::rtl::OUString::createFromAscii( PROP_EVENT_TYPE ); pValues[ 0 ].Value <<= ::rtl::OUString::createFromAscii(SVX_MACRO_LANGUAGE_JAVASCRIPT); - pValues[ 1 ].Name = OUSTRING::createFromAscii( PROP_MACRO_NAME ); + pValues[ 1 ].Name = ::rtl::OUString::createFromAscii( PROP_MACRO_NAME ); pValues[ 1 ].Value <<= aMacro; aEventData <<= aProperties; @@ -438,171 +237,68 @@ ANY SfxEventConfiguration::CreateEventData_Impl( const SvxMacro *pMacro ) } else { - SEQUENCE < PROPERTYVALUE > aProperties; + uno::Sequence < beans::PropertyValue > aProperties; aEventData <<= aProperties; } return aEventData; } -// ------------------------------------------------------------------------------------------------------- -ULONG SfxEventConfiguration::GetPos_Impl( USHORT nId, sal_Bool &rFound ) +//-------------------------------------------------------------------------- +void PropagateEvent_Impl( SfxObjectShell *pDoc, rtl::OUString aEventName, const SvxMacro* pMacro ) { - rFound = sal_False; - - if ( ! gp_Id_SortList->Count() ) - return 0; - - // use binary search to find the correct position - // in the list - - int nCompVal = 1; - long nStart = 0; - long nEnd = gp_Id_SortList->Count() - 1; - long nMid = 0; - - SfxEventName* pMid; - - rFound = sal_False; - - while ( nCompVal && ( nStart <= nEnd ) ) - { - nMid = ( nEnd - nStart ) / 2 + nStart; - pMid = gp_Id_SortList->GetObject( (USHORT) nMid ); - - nCompVal = pMid->mnId - nId; - - if ( nCompVal < 0 ) // pMid < pData - nStart = nMid + 1; - else - nEnd = nMid - 1; - } - - if ( nCompVal == 0 ) + uno::Reference < document::XEventsSupplier > xSupplier; + if ( pDoc ) { - rFound = sal_True; + xSupplier = uno::Reference < document::XEventsSupplier >( pDoc->GetModel(), uno::UNO_QUERY ); } else { - if ( nCompVal < 0 ) // pMid < pData - nMid++; + xSupplier = uno::Reference < document::XEventsSupplier > + ( ::comphelper::getProcessServiceFactory()->createInstance( + rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster" )), uno::UNO_QUERY ); } - return (USHORT) nMid; -} - -// ------------------------------------------------------------------------------------------------------- -ULONG SfxEventConfiguration::GetPos_Impl( const String& rName, sal_Bool &rFound ) -{ - rFound = sal_False; - - if ( ! gp_Name_SortList->Count() ) - return 0; - - // use binary search to find the correct position - // in the list - - int nCompVal = 1; - long nStart = 0; - long nEnd = gp_Name_SortList->Count() - 1; - long nMid = 0; - - SfxEventName* pMid; - - rFound = sal_False; - - while ( nCompVal && ( nStart <= nEnd ) ) + if ( xSupplier.is() ) { - nMid = ( nEnd - nStart ) / 2 + nStart; - pMid = gp_Name_SortList->GetObject( (USHORT) nMid ); - - nCompVal = rName.CompareTo( pMid->maEventName ); - - if ( nCompVal < 0 ) // pMid < pData - nStart = nMid + 1; - else - nEnd = nMid - 1; - } + uno::Reference < container::XNameReplace > xEvents = xSupplier->getEvents(); + if ( aEventName.getLength() ) + { + uno::Any aEventData = CreateEventData_Impl( pMacro ); - if ( nCompVal == 0 ) - { - rFound = sal_True; - } - else - { - if ( nCompVal < 0 ) // pMid < pData - nMid++; + 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" ); + } } - - return (USHORT) nMid; } //-------------------------------------------------------------------------------------------------------- -OUSTRING SfxEventConfiguration::GetEventName_Impl( ULONG nID ) +void SfxEventConfiguration::ConfigureEvent( rtl::OUString aName, const SvxMacro& rMacro, SfxObjectShell *pDoc ) { - OUSTRING aRet; - - if ( gp_Id_SortList ) + SvxMacro *pMacro = NULL; + if ( rMacro.GetMacName().Len() ) + pMacro = new SvxMacro( rMacro.GetMacName(), rMacro.GetLibName(), rMacro.GetScriptType() ); + if ( pDoc ) { - sal_Bool bFound; - ULONG nPos = GetPos_Impl( (USHORT) nID, bFound ); - - if ( bFound ) - { - SfxEventName *pData = gp_Id_SortList->GetObject( nPos ); - aRet = pData->maEventName; - } + PropagateEvent_Impl( pDoc, aName, pMacro ); } - - return aRet; -} - -//-------------------------------------------------------------------------------------------------------- -ULONG SfxEventConfiguration::GetEventId_Impl( const OUSTRING& rEventName ) -{ - ULONG nRet = 0; - - if ( gp_Name_SortList ) + else { - sal_Bool bFound; - ULONG nPos = GetPos_Impl( rEventName, bFound ); - - if ( bFound ) - { - SfxEventName *pData = gp_Name_SortList->GetObject( nPos ); - nRet = pData->mnId; - } + PropagateEvent_Impl( NULL, aName, pMacro ); } - - return nRet; } // ------------------------------------------------------------------------------------------------------- -void SfxEventConfiguration::RegisterEvent( USHORT nId, - const String& rUIName, - const String& rMacroName ) +SvxMacro* SfxEventConfiguration::ConvertToMacro( const com::sun::star::uno::Any& rElement, SfxObjectShell* pDoc, BOOL bBlowUp ) { - if ( ! gp_Id_SortList ) - { - gp_Id_SortList = new SfxEventNamesList; - gp_Name_SortList = new SfxEventNamesList; - } - - sal_Bool bFound = sal_False; - ULONG nPos = GetPos_Impl( nId, bFound ); - - if ( bFound ) - { - DBG_ERRORFILE( "RegisterEvent: Event already registered?" ); - return; - } - - gp_Id_SortList->Insert( new SfxEventName( nId, rMacroName, rUIName ), nPos ); - nPos = GetPos_Impl( rMacroName, bFound ); - - DBG_ASSERT( !bFound, "RegisterEvent: Name in List, but ID not?" ); - - gp_Name_SortList->Insert( new SfxEventName( nId, rMacroName, rUIName ), nPos ); - - SFX_APP()->GetEventConfig(); + return SfxEvents_Impl::ConvertToMacro( rElement, pDoc, bBlowUp ); } diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 487c460de6..02efe0aeba 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -145,16 +145,6 @@ IMPL_LINK(SfxAsyncExec_Impl, TimerHdl, Timer*, pTimer) } class SfxBindings_Impl - -/* [Beschreibung] - - Diese Implementations-Struktur der Klasse SfxBindings dient - der Entkopplung von "Anderungen vom exportierten Interface sowie - der Verringerung von extern sichtbaren Symbolen. - - Eine Instanz exisitiert pro SfxBindings-Instanz f"ur deren Laufzeit. -*/ - { public: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchRecorder > xRecorder; @@ -186,20 +176,6 @@ public: //-------------------------------------------------------------------- struct SfxFoundCache_Impl - -/* [Beschreibung] - - In Instanzen dieser Struktur werden in <SfxBindings::CreateSet_Impl()> - weitere Informationen zu den gemeinsam von einem <Slot-Server> zu - erfragenden Status gesammelt, deren Ids dort in die Ranges eines - <SfxItemSet>s aufgenommen werden. - - Diese Informationen werden w"ahrend der Suche nach den zusammen - upzudatenden Ids sowieso als Zwischenergebnis ermittelt und nachher - wieder ben"otigt, daher macht es Sinn, sie f"ur diesen kurzen Zeitraum - gleich aufzubewahren. -*/ - { sal_uInt16 nSlotId; // die Slot-Id sal_uInt16 nWhichId; // falls verf"ugbar die Which-Id, sonst nSlotId @@ -242,20 +218,6 @@ SV_IMPL_OP_PTRARR_SORT(SfxFoundCacheArr_Impl, SfxFoundCache_Impl*); //========================================================================== SfxBindings::SfxBindings() - -/* [Beschreibung] - - Konstruktor der Klasse SfxBindings. Genau eine Instanz wird automatisch - von der <SfxApplication> vor <SfxApplication::Init()> angelegt. Wird - eine Instanz ben"otigt, z.B. zum Invalidieren von Slots, sollte diese - "uber den zugeh"origen <SfxViewFrame> besorgt werden. Bestimmte - SfxViewFrame Subklassen (z.B. <SfxInPlaceFrame>) legen ihre eigene - Instanz der SfxBindings an. - - <SfxControllerItem> Instanzen k"onnen erst angelegt werden, wenn - die zugeh"orige SfxBindings Instanz existiert. -*/ - : pImp(new SfxBindings_Impl), pDispatcher(0), nRegLevel(1) // geht erst auf 0, wenn Dispatcher gesetzt @@ -324,23 +286,6 @@ SfxBindings::~SfxBindings() //-------------------------------------------------------------------- void SfxBindings::DeleteControllers_Impl() - -/* [Beschreibung] - - Interne Methode zum l"oschen noch existierender <SfxControllerItem> - Instanzen, die bei dieser SfxBindings Instanz angemeldet sind. - - Dies sind i.d.R. <SfxPopupWindow>s. Nich sich selbst geh"orende - SfxControllerItems d"urfen bei Aufruf nur noch existieren, wenn sie - einem der restlichen SfxPopupWindows geh"oren. - - - [Anmerkung] - - Wird beim Beenden der Applikation gerufen, bevor das Applikations- - Fenster gel"oscht wird. -*/ - { // in der ersten Runde den SfxPopupWindows l"oschen sal_uInt16 nCount = pImp->pCaches->Count(); @@ -415,20 +360,6 @@ SfxPopupAction SfxBindings::GetPopupAction_Impl() const //-------------------------------------------------------------------- void SfxBindings::HidePopups( bool bHide ) - -/* [Beschreibung] - - Dieser Methode versteckt und zeigt die <SfxPopupWindows>, die aus - <SfxToolboxControl>s dieser SfxBindings-Instanz abgerissen wurden bzw. - floating <SfxChildWindow>-Instanzen dieser SfxBindings-Instanz. - - - [Anmerkung] - - Es k"onnten noch weitere Floating-Windows exisitieren, die durch - diese Methode nicht erfa\st werden. -*/ - { // SfxPopupWindows hiden HidePopupCtrls_Impl( bHide ); @@ -469,13 +400,6 @@ void SfxBindings::Update_Impl ( SfxStateCache* pCache // der upzudatende SfxStatusCache ) - -/* [Beschreibung] - - Interne Methode zum Updaten eines Caches und den von derselben - Status-Methode in derselben Shell bedienten und dirty Slots. -*/ - { if( pCache->GetDispatch().is() && pCache->GetItemLink() ) { @@ -558,35 +482,6 @@ void SfxBindings::Update ( sal_uInt16 nId // die gebundene und upzudatende Slot-Id ) - -/* [Beschreibung] - - Diese Methode sorgt f"ur synchrones Updaten der auf die Slot-Id nId - gebundenen <SfxContollerItem> Instanzen, die an dieser SfxBindings - Instanz angemeldet sind. Vergleichbar zu Window::Update() - (StarView) erfolgt ein Update nur, wenn entweder ein auf diese - Slot-Id gebundenes SfxContollerItem dirty ist, oder die Slot-Id - selbst dirty ist. Dies kann durch einen vorhergehendes Aufruf von - <SfxBindings::Invalidate(sal_uInt16)> erzwungen werden. - - - [Anmerkung] - - Es ist g"unstiger, zun"achst alle zu invalidierenden Slot-Ids per - <SfxBindings::Invalidate(sal_uInt16)> zu invalidieren und dann - Update() aufzurufen, als einzelne abwechselnde Invalidate/Update, - da von derselben Status-Methode bediente Status-Anfragen von - den SfxBindings automatisch zusammengefa"st werden. - - - [Querverweise] - - <SfxShell::Invalidate(sal_uInt16)> - <SfxBindings::Invalidate(sal_uInt16)> - <SfxBindings::InvalidateAll(sal_Bool)> - <SfxBindings::Update()> -*/ - { DBG_MEMTEST(); DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); @@ -654,26 +549,6 @@ void SfxBindings::Update //-------------------------------------------------------------------- void SfxBindings::Update() - -/* [Beschreibung] - - Diese Methode sorgt f"ur synchrones Updaten aller <SfxContollerItem> - Instanzen, die an dieser SfxBindings Instanz angemeldet sind. Vergleichbar - zu Window::Update() (StarView) erfolgt ein Update nur, wenn entweder ein - SfxContollerItem dirty ist, in einem Status-Cache der Zeiger auf den - <Slot-Server> dirty ist. Ersteres kann durch einen Aufruf von - <SfxBindings::Invalidate(sal_uInt16)> erzwungen werden, letzters durch - <SfxBindings::InvalidateAll(sal_Bool)>. - - - [Querverweise] - - <SfxShell::Invalidate(sal_uInt16)> - <SfxBindings::Invalidate(sal_uInt16)> - <SfxBindings::InvalidateAll(sal_Bool)> - <SfxBindings::Update(sal_uInt16)> -*/ - { DBG_MEMTEST(); DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); @@ -702,19 +577,6 @@ void SfxBindings::SetState ( const SfxItemSet& rSet // zu setzende Status-Werte ) - -/* [Beschreibung] - - Diese Methode erlaubt das direkte Setzen neuer Status-Werte, ohne - den Umweg "uber <SfxBindings::Invalidate()> und das dann im Update - erfolgende Rufen der Status-Methoden an den <SfxShell>s. - - - [Querverweise] - - <SfxBindings::SetState(const SfxPoolItem&)> -*/ - { // wenn gelockt, dann nur invalidieren if ( nRegLevel ) @@ -759,23 +621,6 @@ void SfxBindings::SetState ( const SfxPoolItem& rItem // zu setzender Status-Wert ) - -/* [Beschreibung] - - Diese Methode erlaubt das direkte Setzen eines neuen Status-Wertes, - ohne den Umweg "uber <SfxBindings::Invalidate()> und das dann im Update - erfolgende Rufen der Status-Methoden an den <SfxShell>s. - - Mit dieser Methode k"onnen nur <SfxPoolItem>s mit Slot, nicht - aber mit Which-Id gesetzt werden, da kein <SfxItemPool> bekannt ist, - "uber den gemappt werden k"onnte. - - - [Querverweise] - - <SfxBindings::SetState(const SfxItemSet&)> -*/ - { if ( nRegLevel ) { @@ -824,25 +669,6 @@ SfxStateCache* SfxBindings::GetStateCache wurde, bzw. an der es einfef"ugt werden w"urde. */ ) - -/* [Beschreibung] - - Diese Methode sucht die zu einer Slot-Id geh"orige <SfxStatusCache> - Instanz. Falls die Slot-Id in keinem Controller gebunden ist, wird - ein 0-Pointer zur"uckgegeben. - - Falls pPos != 0, wird erst ab der Position mit der Suche angefangen. - Dieses ist eine Optimierung, f"ur den Fall, da"s die kleineren - Ids bereits abgearbeitet wurden. - - In *pPos wird der ::com::sun::star::sdbcx::Index innerhalb der SfxBindings zur"uckgegeben, - unter dem dieser Cache z.Zt. abgelegt ist. Dieser ::com::sun::star::sdbcx::Index ist bis zum - n"achsten Aufruf von <SfxBindings::EnterRegistrations()> g"ultig. - W"ahrend der Umkonfiguration (<SfxBindings::IsInRegistrations()> == sal_True) - kann ist der ::com::sun::star::sdbcx::Index und der R"uckgabewert nur sehr kurzfristig - g"ultig. -*/ - { DBG_MEMTEST(); DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); @@ -870,27 +696,6 @@ void SfxBindings::InvalidateAll sal_False Slot-Server bleiben g"ultig */ ) - -/* [Beschreibung] - - Invalidiert alle <SfxControllerItem> Instanzen, die an dieser - SfxBindings Instanz angemeldet sind, und bei bWithMsg == sal_True - ebenfalls die <Slot-Server>-Caches. - - Es wird daraufhin ein Timer gestartet, bei dessen Ablauf das Updaten - beginnt. Somit k"onnen mehrere Invalidierungen vorgenommen werden, - bevor "uberhaupt etwas passiert. - - - [Querverweise] - - <SfxShell::Invalidate(sal_uInt16)> - <SfxBindings::Invalidate(sal_uInt16)> - <SfxBindings::Invalidate(sal_uInt16*)> - <SfxBindings::Update()> - <SfxBindings::Update(sal_uInt16)> -*/ - { DBG_PROFSTART(SfxBindingsInvalidateAll); DBG_ASSERT( !pImp->bInUpdate, "SfxBindings::Invalidate while in update" ); @@ -942,26 +747,6 @@ void SfxBindings::Invalidate const sal_uInt16* pIds /* numerisch sortiertes 0-terminiertes Array von Slot-Ids (einzel, nicht als Paare!) */ ) - -/* [Beschreibung] - - Invalidiert die <SfxControllerItem> Instanzen der Slot-Ids in 'pIds', - die an dieser SfxBindings Instanz angemeldet sind. - - Es wird daraufhin ein Timer gestartet, bei dessen Ablauf das Updaten - beginnt. Somit k"onnen mehrere Invalidierungen vorgenommen werden, - bevor "uberhaupt etwas passiert. - - - [Querverweise] - - <SfxShell::Invalidate(sal_uInt16)> - <SfxBindings::Invalidate(sal_uInt16)> - <SfxBindings::InvalidateAll(sal_uInt16)> - <SfxBindings::Update()> - <SfxBindings::Update(sal_uInt16)> -*/ - { DBG_PROFSTART(SfxBindingsInvalidateAll); // DBG_ASSERT( !pImp->bInUpdate, "SfxBindings::Invalidate while in update" ); @@ -1032,26 +817,6 @@ void SfxBindings::InvalidateShell Slot-Ids werden invalidiert */ //! MI: z. Zt. immer bDeep ) - -/* [Beschreibung] - - Invalidiert alle <SfxControllerItem> Instanzen, die zur Zeit von - der angegebenen SfxShell Instanz bedient werden und an dieser - SfxBindings Instanz angemeldet sind - - Es wird daraufhin ein Timer gestartet, bei dessen Ablauf das Updaten - beginnt. Somit k"onnen mehrere Invalidierungen vorgenommen werden, - bevor "uberhaupt etwas passiert. - - - [Querverweise] - - <SfxShell::Invalidate(sal_uInt16)> - <SfxBindings::Invalidate(sal_uInt16)> - <SfxBindings::Update()> - <SfxBindings::Update(sal_uInt16)> -*/ - { DBG_ASSERT( !pImp->bInUpdate, "SfxBindings::Invalidate while in update" ); @@ -1108,24 +873,6 @@ void SfxBindings::Invalidate ( sal_uInt16 nId // zu invalidierende Slot-Id ) - -/* [Beschreibung] - - Invalidiert alle <SfxControllerItem> Instanzen, die auf die Slot-Id - nId gebunden sind und an dieser SfxBindings Instanz angemeldet sind. - - Es wird daraufhin ein Timer gestartet, bei dessen Ablauf das Updaten - beginnt. Somit k"onnen mehrere Invalidierungen vorgenommen werden, - bevor "uberhaupt etwas passiert. - - - [Querverweise] - <SfxBindings::Invalidate(sal_uInt16*)> - <SfxBindings::InvalidateAll(sal_Bool)> - <SfxBindings::Update()> - <SfxBindings::Update(sal_uInt16)> -*/ - { DBG_MEMTEST(); // DBG_ASSERT( !pImp->bInUpdate, "SfxBindings::Invalidate while in update" ); @@ -1166,24 +913,6 @@ void SfxBindings::Invalidate sal_Bool bWithItem, // StateCache clearen ? sal_Bool bWithMsg // SlotServer neu holen ? ) - -/* [Beschreibung] - - Invalidiert alle <SfxControllerItem> Instanzen, die auf die Slot-Id - nId gebunden sind und an dieser SfxBindings Instanz angemeldet sind, - und bei bWithMsg == sal_True ebenfalls den <Slot-Server>-Cache. - - Es wird daraufhin ein Timer gestartet, bei dessen Ablauf das Updaten - beginnt. Somit k"onnen mehrere Invalidierungen vorgenommen werden, - bevor "uberhaupt etwas passiert. - - [Querverweise] - <SfxBindings::Invalidate(sal_uInt16*)> - <SfxBindings::InvalidateAll(sal_Bool)> - <SfxBindings::Update()> - <SfxBindings::Update(sal_uInt16)> -*/ - { DBG_MEMTEST(); DBG_ASSERT( !pImp->bInUpdate, "SfxBindings::Invalidate while in update" ); @@ -1214,52 +943,9 @@ void SfxBindings::Invalidate } } -void SfxBindings::Invalidate -( - sal_uInt16, // zu invalidierende Slot-Id - sal_Bool // SlotServer neu holen ? -) - -/* [Beschreibung] - - Invalidiert alle <SfxControllerItem> Instanzen, die auf die Slot-Id - nId gebunden sind und an dieser SfxBindings Instanz angemeldet sind, - und bei bWithMsg == sal_True ebenfalls den <Slot-Server>-Cache. - - Es wird daraufhin ein Timer gestartet, bei dessen Ablauf das Updaten - beginnt. Somit k"onnen mehrere Invalidierungen vorgenommen werden, - bevor "uberhaupt etwas passiert. - - [Querverweise] - <SfxBindings::Invalidate(sal_uInt16*)> - <SfxBindings::InvalidateAll(sal_Bool)> - <SfxBindings::Update()> - <SfxBindings::Update(sal_uInt16)> -*/ - -{ - DBG_ERROR( "Methode veraltet!" ); -} - //-------------------------------------------------------------------- sal_Bool SfxBindings::IsBound( sal_uInt16 nSlotId, sal_uInt16 nStartSearchAt ) - -/* [Beschreibung] - - Stellt fest, ob die angegebene Slot-Id in einem <SfxControllerItem> - gebunden ist, der an dieser SfxBindings Instanz angemeldet ist. - - - [R"uckgabewert] - - sal_Bool sal_True - Die angegeben Slot-Id ist gebunden. - - sal_False - Die angegeben Slot-Id ist nicht gebunden. -*/ - { DBG_MEMTEST(); DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); @@ -1269,14 +955,6 @@ sal_Bool SfxBindings::IsBound( sal_uInt16 nSlotId, sal_uInt16 nStartSearchAt ) //-------------------------------------------------------------------- sal_uInt16 SfxBindings::GetSlotPos( sal_uInt16 nId, sal_uInt16 nStartSearchAt ) - -/* [Beschreibung] - - Ermittelt den ::com::sun::star::sdbcx::Index der angegebenen Slot-Id in den SfxBindings. - Falls die Slot-Id nicht gebunden ist, wird der ::com::sun::star::sdbcx::Index zur"uckgegeben, - an dem sie eingef"ugt w"urde. -*/ - { DBG_MEMTEST(); DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); @@ -1471,30 +1149,6 @@ const SfxPoolItem* SfxBindings::ExecuteSynchron( sal_uInt16 nId, const SfxPoolIt sal_Bool SfxBindings::Execute( sal_uInt16 nId, const SfxPoolItem** ppItems, sal_uInt16 nModi, SfxCallMode nCallMode, const SfxPoolItem **ppInternalArgs ) - -/* [Beschreibung] - - F"uhrt den Slot mit der Slot-Id nId "uber den <Slot-Server> Cache - aus. Dies ist nur bei in dieser SfxBindings INstanz gebundenen - Slot-Ids m"oglich. - - - [R"uckgabewert] - - sal_Bool sal_True - Das Execute wurde ausgef"uhrt. - - sal_False - Das Execute konnte nicht ausgef"uhrt werden, - weil der Slot entweder nicht zur Verf"ugung steht - (in keiner aktiven <SfxShell> vorhanden oder - disabled) ist oder der Anwender die Ausf"uhrung - abgebrochen hat (Cancel in einem Dialog). - - - [Querverweise] - <SfxDispatcher> -*/ { DBG_MEMTEST(); DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); @@ -1716,13 +1370,6 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell //-------------------------------------------------------------------- void SfxBindings::UpdateSlotServer_Impl() - -/* [Beschreibung] - - Interne Methode zum Updaten der Pointer auf die SlotServer - nach <SfxBindings::InvalidateAll(sal_Bool)>. -*/ - { DBG_PROFSTART(SfxBindingsUpdateServers); DBG_MEMTEST(); @@ -1785,16 +1432,6 @@ SfxItemSet* SfxBindings::CreateSet_Impl const SfxSlotServer** pMsgServer, // out: Slot-Server zu nId SfxFoundCacheArr_Impl& rFound // out: Liste der Caches der Siblings ) - -/* [Beschreibung] - - Diese interne Methode sucht zu pCache die Slot-Ids, die von derselben - Status-Methode bedient werden und ebenfalls gebunden und dirty sind. - Es wird ein SfxItemSet zusammengestellt, das die Slot-Ids (oder falls - vorhanden die mit dem Pool der Shell gemappten Which-Ids) enth"alt. - Die Caches dieser Slots werden in pFoundCaches zur"uckgeliefert. -*/ - { DBG_MEMTEST(); DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); @@ -1942,18 +1579,6 @@ void SfxBindings::UpdateControllers_Impl const SfxPoolItem* pItem, // item to send to controller SfxItemState eState // state of item ) - -/* [Beschreibung] - - Dieses ist eine Hilfsmethode f"ur NextJob_Impl mit der die SfxController, - welche auf nSlotId gebunden sind, upgedated werden. Dabei wird der - Wert aus dem SfxPoolItem unter dem Which-Wert nWhich aus dem Set rSet - genommen. - - Falls zu rSlot Enum-Werte in der Slotmap eingetragen sind, und diese - gebunden sind, werden sie ebenfalls upgedated. -*/ - { DBG_ASSERT( !pFound->pSlot || SFX_KIND_ENUM != pFound->pSlot->GetKind(), "direct update of enum slot isn't allowed" ); @@ -2059,13 +1684,6 @@ void SfxBindings::UpdateControllers_Impl //-------------------------------------------------------------------- IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer ) - -/* [Beschreibung] - - Die SfxController werden "uber einen Timer updated. Dieses ist der - dazugeh"orige interne TimeOut-Handler. - */ - { #ifdef DBG_UTIL // on Windows very often C++ Exceptions (GPF etc.) are caught by MSVCRT or another MS library @@ -2178,18 +1796,26 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer ) } } - // volatiles wieder von vorne starten pImp->nMsgPos = 0; - pImp->aTimer.SetTimeout(TIMEOUT_IDLE); + + // check for volatile slots + bool bVolatileSlotsPresent = false; for ( sal_uInt16 n = 0; n < nCount; ++n ) { SfxStateCache* pCache = (*pImp->pCaches)[n]; const SfxSlotServer *pSlotServer = pCache->GetSlotServer(*pDispatcher, pImp->xProv); - if ( pSlotServer && - pSlotServer->GetSlot()->IsMode(SFX_SLOT_VOLATILE) ) + if ( pSlotServer && pSlotServer->GetSlot()->IsMode(SFX_SLOT_VOLATILE) ) + { pCache->Invalidate(sal_False); + bVolatileSlotsPresent = true; + } } + if (bVolatileSlotsPresent) + pImp->aTimer.SetTimeout(TIMEOUT_IDLE); + else + pImp->aTimer.Stop(); + // Update-Runde ist beendet pImp->bInNextJob = sal_False; Broadcast(SfxSimpleHint(SFX_HINT_UPDATEDONE)); @@ -2210,35 +1836,6 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer ) //-------------------------------------------------------------------- sal_uInt16 SfxBindings::EnterRegistrations(const char *pFile, int nLine) - -/* [Beschreibung] - - Die An- oder Abmeldung von <SfxControllerItem> Instanzen mu"s in - EnterRegistrations() und LeaveRegistrations() geklammert werden. - W"ahrend dieser Zeit erfolgen keine Udates der <SfxContollerItem> - Instanzen (weder der alten noch der neu angemeldeten). - - [Parameter] - - pFile, nLine Dateiname und Zeilennummer der rufenden - Methode (nur Debug) - - [R"uckgabewert] - - sal_uInt16 Level der Registrierung. Dieser kann in - <SfxBindings::LeaveRegistrations(sal_uInt16)> als - Parameter angegeben werden, um die Paarigkeit - der EnterRegistrations() und LeaveRegistrations() - zu pr"ufen. - - - [Querverweise] - <SfxBindings::IsInRegistrations()> - <SfxBindings::Register(SfxControllerItem&)> - <SfxBindings::Release(SfxControllerItem&)> - <SfxBindings::LeaveRegistrations()> -*/ - { (void)pFile; (void)nLine; @@ -2296,36 +1893,6 @@ sal_uInt16 SfxBindings::EnterRegistrations(const char *pFile, int nLine) //-------------------------------------------------------------------- void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int nLine ) - -/* [Beschreibung] - - Die An- oder Abmeldung von <SfxControllerItem> Instanzen mu"s in - EnterRegistrations() und LeaveRegistrations() geklammert werden. - W"ahrend dieser Zeit erfolgen keine Udates der <SfxContollerItem> - Instanzen (weder der alten noch der neu angemeldeten). - - - [Parameter] - - sal_uInt16 nLevel == USRT_MAX - keine Paarigkeits-Pr"ufung f"ur diese Klammerung - - - pFile, nLine Dateiname und Zeilennummer der rufenden - Methode (nur Debug) - - < USHRT_MAX - R"uckgabewert des zugeh"origen EnterRegistrations() - zum pr"ufen der Paarigkeit. - - - [Querverweise] - <SfxBindings::IsInRegistrations()> - <SfxBindings::Register(SfxControllerItem&)> - <SfxBindings::Release(SfxControllerItem&)> - <SfxBindings::EnterRegistrations()> -*/ - { (void)nLevel; // unused variable (void)pFile; @@ -2425,26 +1992,6 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int //-------------------------------------------------------------------- const SfxSlot* SfxBindings::GetSlot(sal_uInt16 nSlotId) - -/* [Beschreibung] - - Diese Methode liefert einen Pointer auf den zur Zeit gecacheten - SfxSlot f"ur die angegebene Slot-Id. - - - [R"uckgabewert] - - const <SfxSlot>* 0 - Falls die Slot-Id nicht gebunden ist oder - ein solcher Slot momentan in keiner aktiven - <SfxShell> vorhanden ist. - - != 0 - Falls die Slot-Id gebunden ist und ein solcher - Slot momentan in einer aktiven <SfxShell> - vorhanden ist. -*/ - { DBG_MEMTEST(); DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); @@ -2463,17 +2010,6 @@ const SfxSlot* SfxBindings::GetSlot(sal_uInt16 nSlotId) //-------------------------------------------------------------------- void SfxBindings::SetDispatcher( SfxDispatcher *pDisp ) - -/* [Beschreibung] - - Setzt den zur Zeit von dieser SfxBindings Instanz zu verwendenden - Dispatcher um. - - Falls sich der Dispatcher dadurch "andert, wird intern - <SFxBindings::InvalidateAll(sal_Bool)> mit sal_True gerufen, also jegliche - gecachete Information der Bindings weggeworfen. -*/ - { SfxDispatcher *pOldDispat = pDispatcher; if ( pDisp != pDispatcher ) @@ -2541,17 +2077,11 @@ void SfxBindings::SetDispatcher( SfxDispatcher *pDisp ) //-------------------------------------------------------------------- void SfxBindings::ClearCache_Impl( sal_uInt16 nSlotId ) - -// interne Methode zum forwarden dieses Methodenaufrufs - { GetStateCache(nSlotId)->ClearCache(); } //-------------------------------------------------------------------- - -// interne Methode zum Ansto\sen des Statusupdates - void SfxBindings::StartUpdate_Impl( sal_Bool bComplete ) { if ( pImp->pSubBindings ) @@ -2568,18 +2098,6 @@ void SfxBindings::StartUpdate_Impl( sal_Bool bComplete ) //------------------------------------------------------------------------- SfxItemState SfxBindings::QueryState( sal_uInt16 nSlot, SfxPoolItem* &rpState ) -/* [Beschreibung] - - Wird gerufen, um den Status f"ur 'nSlot' zu erfragen. Wenn der return - value SFX_ITEM_SET ist, wird ein SfxPoolItem zur"uckgegeben, indem der - rpState entsprechend gesetzt wird. Es findet dabei ein Eigent"umer"ubergang - statt, d.h. die aufrufende Methode mu\s das Item l"oschen. - - Anmerkung: diese Methode ist sehr teuer und sollte nur gerufen werden, - wenn kein Controller f"ur das Erfragen des Status angelegt werden kann oder - der Status unbedingt sofort geliefert werden mu\s. -*/ - { ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDisp; SfxStateCache *pCache = GetStateCache( nSlot ); @@ -2870,15 +2388,6 @@ BOOL SfxBindings::ExecuteCommand_Impl( const String& rCommand ) return FALSE; } -//REMOVE SfxConfigManager* SfxBindings::GetConfigManager( USHORT nType ) const -//{ -//REMOVE SfxConfigManager *pMgr = pDispatcher->GetFrame()->GetObjectShell()->GetConfigManager(); -//REMOVE if ( pMgr && pMgr->HasConfigItem( nType ) ) -//REMOVE return pMgr; -//REMOVE else -// return SFX_APP()->GetConfigManager_Impl(); -//} - com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > SfxBindings::GetRecorder() const { return pImp->xRecorder; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index d6be5de2a1..d59d36855c 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1619,7 +1619,7 @@ CustomPropertiesWindow::CustomPropertiesWindow( Window* pParent, const ResId& rR m_aValueEdit ( this, SfxResId( SFX_ED_PROPERTY_VALUE ) ), m_aYesNoButton ( this, SfxResId( SFX_WIN_PROPERTY_YESNO ) ), m_aRemoveButton ( this, SfxResId( SFX_PB_PROPERTY_REMOVE ) ), - + m_nScrollPos (0), m_aNumberFormatter( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLanguage() ) @@ -1676,6 +1676,8 @@ IMPL_LINK( CustomPropertiesWindow, RemoveHdl, CustomPropertiesRemoveButton*, pBu } } } + + m_aRemovedHdl.Call(0); return 0; } @@ -1852,6 +1854,7 @@ void CustomPropertiesWindow::AddLine( const ::rtl::OUString& sName, Any& rAny ) Size aSize = (*pCurrent)->GetSizePixel(); Point aPos = (*pCurrent)->GetPosPixel(); aPos.Y() += nPos; + aPos.Y() += m_nScrollPos; (*pNewCurrent)->SetPosSizePixel( aPos, aSize ); (*pNewCurrent)->Show(); pCurrent++; @@ -1974,10 +1977,12 @@ void CustomPropertiesWindow::ClearAllLines() delete pLine; } m_aCustomPropertiesLines.clear(); + m_nScrollPos = 0; } void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos ) { + m_nScrollPos += nNewPos; std::vector< CustomPropertyLine* >::iterator pIter; for ( pIter = m_aCustomPropertiesLines.begin(); pIter != m_aCustomPropertiesLines.end(); ++pIter ) @@ -2141,6 +2146,7 @@ CustomPropertiesControl::CustomPropertiesControl( Window* pParent, const ResId& XubString sTEST = m_aHeaderBar.GetItemText( HI_NAME ); m_aPropertiesWin.InitControls( &m_aHeaderBar, &m_aVertScroll ); + m_aPropertiesWin.SetRemovedHdl( LINK( this, CustomPropertiesControl, RemovedHdl ) ); m_aVertScroll.SetRangeMin( 0 ); sal_Int32 nScrollOffset = m_aPropertiesWin.GetLineHeight(); @@ -2156,7 +2162,7 @@ CustomPropertiesControl::CustomPropertiesControl( Window* pParent, const ResId& Link aScrollLink = LINK( this, CustomPropertiesControl, ScrollHdl ); m_aVertScroll.SetScrollHdl( aScrollLink ); - m_aVertScroll.SetEndScrollHdl( aScrollLink ); +// m_aVertScroll.SetEndScrollHdl( aScrollLink ); } CustomPropertiesControl::~CustomPropertiesControl() @@ -2176,10 +2182,20 @@ IMPL_LINK( CustomPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar ) return 0; } -void CustomPropertiesControl::AddLine( const ::rtl::OUString& sName, Any& rAny ) +IMPL_LINK( CustomPropertiesControl, RemovedHdl, void*, EMPTYARG ) +{ + m_aVertScroll.SetRangeMax( m_aPropertiesWin.GetVisibleLineCount() + 1 ); + if ( m_aPropertiesWin.GetOutputSizePixel().Height() < m_aPropertiesWin.GetVisibleLineCount() * m_aPropertiesWin.GetLineHeight() ) + m_aVertScroll.DoScrollAction ( SCROLL_LINEUP ); + return 0; +} + +void CustomPropertiesControl::AddLine( const ::rtl::OUString& sName, Any& rAny, bool bInteractive ) { m_aPropertiesWin.AddLine( sName, rAny ); m_aVertScroll.SetRangeMax( m_aPropertiesWin.GetVisibleLineCount() + 1 ); + if ( bInteractive && m_aPropertiesWin.GetOutputSizePixel().Height() < m_aPropertiesWin.GetVisibleLineCount() * m_aPropertiesWin.GetLineHeight() ) + m_aVertScroll.DoScroll( m_aPropertiesWin.GetVisibleLineCount() + 1 ); } // class SfxCustomPropertiesPage ----------------------------------------- @@ -2200,7 +2216,7 @@ SfxCustomPropertiesPage::SfxCustomPropertiesPage( Window* pParent, const SfxItem IMPL_LINK( SfxCustomPropertiesPage, AddHdl, PushButton*, EMPTYARG ) { Any aAny; - m_aPropertiesCtrl.AddLine( ::rtl::OUString(), aAny ); + m_aPropertiesCtrl.AddLine( ::rtl::OUString(), aAny, true ); return 0; } @@ -2250,7 +2266,7 @@ void SfxCustomPropertiesPage::Reset( const SfxItemSet& rItemSet ) std::vector< CustomProperty* > aCustomProps = pInfoItem->GetCustomProperties(); for ( sal_uInt32 i = 0; i < aCustomProps.size(); i++ ) { - m_aPropertiesCtrl.AddLine( aCustomProps[i]->m_sName, aCustomProps[i]->m_aValue ); + m_aPropertiesCtrl.AddLine( aCustomProps[i]->m_sName, aCustomProps[i]->m_aValue, false ); } } diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk index 4c893288eb..986755558c 100644 --- a/sfx2/source/doc/makefile.mk +++ b/sfx2/source/doc/makefile.mk @@ -48,7 +48,7 @@ CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS) SRS1NAME=$(TARGET) SRC1FILES = \ - doc.src new.src doctdlg.src docvor.src doctempl.src sfxbasemodel.src graphhelp.src + doc.src new.src doctdlg.src docvor.src doctempl.src graphhelp.src SLOFILES = \ $(SLO)$/printhelper.obj \ diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 15c883b421..8398679302 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1383,54 +1383,6 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) } } -/* -SfxEventConfigItem_Impl* SfxObjectShell::GetEventConfig_Impl( BOOL bForce ) -{ - if ( bForce && !pImp->pEventConfig ) - { - pImp->pEventConfig = new SfxEventConfigItem_Impl( SFX_ITEMTYPE_DOCEVENTCONFIG, - SFX_APP()->GetEventConfig(), this ); - if (pImp->pCfgMgr) - pImp->pEventConfig->Connect( pImp->pCfgMgr ); - pImp->pEventConfig->Initialize(); - } - - return pImp->pEventConfig; -} */ - -//REMOVE SvStorageRef SfxObjectShell::GetConfigurationStorage( SotStorage* pStor ) -//REMOVE { -//REMOVE // configuration storage shall be opened in own storage or a new storage, if the -//REMOVE // document is getting stored into this storage -//REMOVE if ( !pStor ) -//REMOVE pStor = GetStorage(); -//REMOVE -//REMOVE if ( pStor->IsOLEStorage() ) -//REMOVE return (SvStorageRef) SotStorageRef(); -//REMOVE -//REMOVE // storage is always opened in transacted mode, so changes must be commited -//REMOVE SotStorageRef xStorage = pStor->OpenSotStorage( DEFINE_CONST_UNICODE("Configurations"), -//REMOVE IsReadOnly() ? STREAM_STD_READ : STREAM_STD_READWRITE ); -//REMOVE if ( xStorage.Is() && xStorage->GetError() ) -//REMOVE xStorage.Clear(); -//REMOVE return (SvStorageRef) xStorage; -//REMOVE } - -//REMOVE SotStorageStreamRef SfxObjectShell::GetConfigurationStream( const String& rName, BOOL bCreate ) -//REMOVE { -//REMOVE SotStorageStreamRef xStream; -//REMOVE SvStorageRef xStorage = GetConfigurationStorage(); -//REMOVE if ( xStorage.Is() ) -//REMOVE { -//REMOVE xStream = xStorage->OpenSotStream( rName, -//REMOVE bCreate ? STREAM_STD_READWRITE|STREAM_TRUNC : STREAM_STD_READ ); -//REMOVE if ( xStream.Is() && xStream->GetError() ) -//REMOVE xStream.Clear(); -//REMOVE } -//REMOVE -//REMOVE return xStream; -//REMOVE } - SfxObjectShellRef MakeObjectShellForOrganizer_Impl( const String& aTargetURL, BOOL bForWriting ) { // check for own format diff --git a/sfx2/source/doc/objembed.cxx b/sfx2/source/doc/objembed.cxx index 8641281d50..c50539a0bd 100644 --- a/sfx2/source/doc/objembed.cxx +++ b/sfx2/source/doc/objembed.cxx @@ -136,7 +136,7 @@ void SfxObjectShell::SetVisArea( const Rectangle & rVisArea ) if ( IsEnableSetModified() ) SetModified( TRUE ); - SFX_APP()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, this)); + SFX_APP()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, GlobalEventConfig::GetEventName(STR_EVENT_VISAREACHANGED), this)); /* Size aSize (GetVisArea().GetSize()); diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 847ae205cb..ff4ed98058 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -423,7 +423,7 @@ void SfxObjectShell::ModifyChanged() Invalidate( SID_MACRO_SIGNATURE ); Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); // xmlsec05, signed state might change in title... - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_MODIFYCHANGED, this ) ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_MODIFYCHANGED, GlobalEventConfig::GetEventName(STR_EVENT_MODIFYCHANGED), this ) ); } //------------------------------------------------------------------------- @@ -1137,8 +1137,10 @@ void SfxObjectShell::PostActivateEvent_Impl( SfxViewFrame* pFrame ) { sal_uInt16 nId = pImp->nEventId; pImp->nEventId = 0; - if ( nId ) - pSfxApp->NotifyEvent(SfxEventHint( nId, this ), sal_False); + if ( nId == SFX_EVENT_OPENDOC ) + pSfxApp->NotifyEvent(SfxEventHint( nId, GlobalEventConfig::GetEventName(STR_EVENT_OPENDOC), this ), sal_False); + else if (nId == SFX_EVENT_CREATEDOC ) + pSfxApp->NotifyEvent(SfxEventHint( nId, GlobalEventConfig::GetEventName(STR_EVENT_CREATEDOC), this ), sal_False); } } } @@ -1432,7 +1434,7 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags ) } pImp->bInitialized = sal_True; - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, this ) ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) ); // Title is not available until loading has finished Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 52e00f3b36..6ab2bf2d81 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -522,7 +522,7 @@ sal_Bool SfxObjectShell::DoInitNew( SfxMedium* pMed ) pImp->bInitialized = sal_True; SetActivateEvent_Impl( SFX_EVENT_CREATEDOC ); - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, this ) ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, GlobalEventConfig::GetEventName(STR_EVENT_DOCCREATED), this ) ); return sal_True; } @@ -3257,7 +3257,7 @@ uno::Reference< embed::XStorage > SfxObjectShell::GetStorage() SetupStorage( pImp->m_xDocStorage, SOFFICE_FILEFORMAT_CURRENT, sal_False ); pImp->m_bCreateTempStor = sal_False; - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, this ) ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, GlobalEventConfig::GetEventName(STR_EVENT_STORAGECHANGED), this ) ); } catch( uno::Exception& ) { @@ -3417,7 +3417,7 @@ sal_Bool SfxObjectShell::SaveCompleted( const uno::Reference< embed::XStorage >& if ( bSendNotification ) { - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, this ) ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, GlobalEventConfig::GetEventName(STR_EVENT_STORAGECHANGED), this ) ); } return bResult; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index d5292df407..acc91515df 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -61,6 +61,7 @@ #include <basic/sbstar.hxx> #include <svtools/stritem.hxx> #include <basic/sbx.hxx> +#include <svtools/eventcfg.hxx> #include <sfx2/objsh.hxx> #include <sfx2/signaturestate.hxx> @@ -251,7 +252,6 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,pModule( 0 ) ,pFrame( 0 ) ,pTbxConfig( 0 ) - ,pEventConfig(NULL) ,eFlags( SFXOBJECTSHELL_UNDEFINED ) ,pCloser( 0 ) ,bReadOnlyUI( sal_False ) @@ -597,6 +597,9 @@ sal_uInt16 SfxObjectShell::PrepareClose while ( pFrame && (pFrame->GetFrameType() & SFXFRAME_SERVER ) ) pFrame = SfxViewFrame::GetNext( *pFrame, this ); + SfxApplication *pSfxApp = SFX_APP(); + pSfxApp->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEDOC, GlobalEventConfig::GetEventName(STR_EVENT_PREPARECLOSEDOC), this) ); + sal_Bool bClose = sal_False; if ( bUI && IsModified() ) { @@ -887,11 +890,6 @@ SfxObjectShell* SfxObjectShell::GetObjectShell() SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames() { - return GetEventNames_Impl(); -} - -SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames_Impl() -{ static uno::Sequence< ::rtl::OUString >* pEventNameContainer = NULL; if ( !pEventNameContainer ) @@ -899,88 +897,7 @@ SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames_Impl() ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( !pEventNameContainer ) { - static uno::Sequence< ::rtl::OUString > aEventNameContainer( 27 ); - // SFX_EVENT_STARTAPP - aEventNameContainer[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnStartApp" ) ); - - // SFX_EVENT_CLOSEAPP - aEventNameContainer[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnCloseApp" ) ); - - // SFX_EVENT_CREATEDOC - aEventNameContainer[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnNew" ) ); - - // SFX_EVENT_OPENDOC - aEventNameContainer[3] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnLoad" ) ); - - // SFX_EVENT_SAVEASDOC - aEventNameContainer[4] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnSaveAs" ) ); - - // SFX_EVENT_SAVEASDOCDONE - aEventNameContainer[5] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnSaveAsDone" ) ); - - // SFX_EVENT_SAVEDOC - aEventNameContainer[6] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnSave" ) ); - - // SFX_EVENT_SAVEDOCDONE - aEventNameContainer[7] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnSaveDone" ) ); - - // SFX_EVENT_PREPARECLOSEDOC - aEventNameContainer[8] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnPrepareUnload" ) ); - - // SFX_EVENT_CLOSEDOC - aEventNameContainer[9] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnUnload" ) ); - - // SFX_EVENT_ACTIVATEDOC - aEventNameContainer[10] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnFocus" ) ); - - // SFX_EVENT_DEACTIVATEDOC - aEventNameContainer[11] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnUnfocus" ) ); - - // SFX_EVENT_PRINTDOC - aEventNameContainer[12] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnPrint" ) ); - - // SFX_EVENT_MODIFYCHANGED - aEventNameContainer[13] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnModifyChanged" ) ); - - // SFX_EVENT_SAVETODOC - aEventNameContainer[14] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnCopyTo" ) ); - - // SFX_EVENT_SAVETODOCDONE - aEventNameContainer[15] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnCopyToDone" ) ); - - // SFX_EVENT_VIEWCREATED - aEventNameContainer[16] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnViewCreated" ) ); - - // SFX_EVENT_PREPARECLOSEVIEW - aEventNameContainer[17] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnPrepareViewClosing" ) ); - - // SFX_EVENT_CLOSEVIEW - aEventNameContainer[18] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnViewClosed" ) ); - - // SFX_EVENT_VISAREACHANGED - aEventNameContainer[19] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnVisAreaChanged" ) ); - - // SFX_EVENT_DOCCREATED - aEventNameContainer[20] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnCreate" ) ); - - // SFX_EVENT_LOADFINISHED - aEventNameContainer[21] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnLoadFinished" ) ); - - // SFX_EVENT_SAVEASDOCFAILED - aEventNameContainer[22] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnSaveAsFailed" ) ); - - // SFX_EVENT_SAVEDOCFAILED - aEventNameContainer[23] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnSaveFailed" ) ); - - // SFX_EVENT_SAVETODOCFAILED - aEventNameContainer[24] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnCopyToFailed" ) ); - - // SFX_HINT_TITLECHANGED - aEventNameContainer[25] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnTitleChanged" ) ); - - // SFX_HINT_MODECHANGED - aEventNameContainer[26] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnModeChanged" ) ); - + static uno::Sequence< ::rtl::OUString > aEventNameContainer = GlobalEventConfig().getElementNames(); pEventNameContainer = &aEventNameContainer; } } @@ -988,6 +905,13 @@ SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames_Impl() return *pEventNameContainer; } +SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames_Impl() +{ + if (!pImp->xEventNames.getLength()) + pImp->xEventNames = GetEventNames(); + return pImp->xEventNames; +} + //-------------------------------------------------------------------- void SfxObjectShell::SetModel( SfxBaseModel* pModel ) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 8b5c32feeb..25d2d964e9 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.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 @@ -1614,7 +1614,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa SfxAllItemSet *pParams = new SfxAllItemSet( SFX_APP()->GetPool() ); TransformParameters( SID_SAVEDOC, aSeqArgs, *pParams ); - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOC, m_pData->m_pObjectShell ) ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOC, GlobalEventConfig::GetEventName(STR_EVENT_SAVEDOC), m_pData->m_pObjectShell ) ); sal_Bool bRet = sal_False; @@ -1645,14 +1645,12 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa : ERRCODE_IO_CANTWRITE; m_pData->m_pObjectShell->ResetError(); - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEFINISHED, m_pData->m_pObjectShell ) ); - if ( bRet ) { m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "successful saving." ) ) ); m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl(); - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCDONE, m_pData->m_pObjectShell ) ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVEDOCDONE), m_pData->m_pObjectShell ) ); } else { @@ -1660,7 +1658,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa m_pData->m_pObjectShell->StoreLog(); // write the contents of the logger to the file - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCFAILED, m_pData->m_pObjectShell ) ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCFAILED, GlobalEventConfig::GetEventName(STR_EVENT_SAVEDOCFAILED), m_pData->m_pObjectShell ) ); throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), nErrCode ); } @@ -2546,7 +2544,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , impl_getPrintHelper(); } - postEvent_Impl( pNamedHint->GetEventId() ); + postEvent_Impl( pNamedHint->GetEventName() ); } if ( pSimpleHint ) @@ -2555,11 +2553,11 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , { ::rtl::OUString aTitle = m_pData->m_pObjectShell->GetTitle(); addTitle_Impl( m_pData->m_seqArguments, aTitle ); - postEvent_Impl( pSimpleHint->GetId() ); + postEvent_Impl( GlobalEventConfig::GetEventName( STR_EVENT_TITLECHANGED ) ); } if ( pSimpleHint->GetId() == SFX_HINT_MODECHANGED ) { - postEvent_Impl( pSimpleHint->GetId() ); + postEvent_Impl( GlobalEventConfig::GetEventName( STR_EVENT_MODECHANGED ) ); } /* else if ( pSimpleHint->GetId() == SFX_HINT_DYING @@ -2760,7 +2758,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL if ( !bSaved && m_pData->m_pObjectShell ) { - SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOC : SFX_EVENT_SAVEASDOC, + SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOC : SFX_EVENT_SAVEASDOC, GlobalEventConfig::GetEventName( bSaveTo ? STR_EVENT_SAVETODOC : STR_EVENT_SAVEASDOC ), m_pData->m_pObjectShell ) ); SfxAllItemSet *aParams = new SfxAllItemSet( SFX_APP()->GetPool() ); @@ -2783,7 +2781,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL } // since saving a document modifies its DocumentInfo, the current - // DocumentInfo must be saved on "SaveTo", so it can be restored + // DocumentInfo must be saved on "SaveTo", so it can be restored // after saving sal_Bool bCopyTo = bSaveTo || m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED; @@ -2860,11 +2858,11 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL if ( !bSaveTo ) { m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl(); - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEASDOCDONE, m_pData->m_pObjectShell ) ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEASDOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVEASDOCDONE), m_pData->m_pObjectShell ) ); } else { - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, m_pData->m_pObjectShell ) ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVETODOCDONE), m_pData->m_pObjectShell ) ); } } else @@ -2873,7 +2871,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing failed!" ) ) ); m_pData->m_pObjectShell->StoreLog(); - SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, + SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, GlobalEventConfig::GetEventName( bSaveTo ? STR_EVENT_SAVETODOCFAILED : STR_EVENT_SAVEASDOCFAILED), m_pData->m_pObjectShell ) ); throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), nErrCode ); @@ -2883,18 +2881,26 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL //******************************************************************************************************** -void SfxBaseModel::postEvent_Impl( ULONG nEventID ) +void SfxBaseModel::postEvent_Impl( ::rtl::OUString aName ) { // object already disposed? if ( impl_isDisposed() ) return; + DBG_ASSERT( aName.getLength(), "Empty event name!" ); + if (!aName.getLength()) + return; + ::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const uno::Reference< XDOCEVENTLISTENER >*)0) ); if( pIC ) { - ::rtl::OUString aName = SfxEventConfiguration::GetEventName_Impl( nEventID ); +#ifdef DBG_UTIL + ByteString aTmp( "SfxEvent: "); + aTmp += ByteString( String(aName), RTL_TEXTENCODING_UTF8 ); + DBG_TRACE( aTmp.GetBuffer() ); +#endif document::EventObject aEvent( (frame::XModel *)this, aName ); ::cppu::OInterfaceContainerHelper aIC( m_aMutex ); uno::Sequence < uno::Reference < uno::XInterface > > aElements = pIC->getElements(); diff --git a/sfx2/source/doc/sfxbasemodel.src b/sfx2/source/doc/sfxbasemodel.src deleted file mode 100644 index 6c1753dcf1..0000000000 --- a/sfx2/source/doc/sfxbasemodel.src +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: sfxbasemodel.src,v $ - * $Revision: 1.10 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <sfx2/sfx.hrc> -#include "sfxlocal.hrc" - -/* -// the following events names are now hardcoded in the code -StringArray EVENT_NAMES_ARY -{ - ItemList = - { - < "OnStartApp" ; SFX_EVENT_STARTAPP ; > ; - < "OnCloseApp" ; SFX_EVENT_CLOSEAPP ; > ; - < "OnNew" ; SFX_EVENT_CREATEDOC ; > ; - < "OnLoad" ; SFX_EVENT_OPENDOC ; > ; - < "OnSaveAs" ; SFX_EVENT_SAVEASDOC ; > ; - < "OnSaveAsDone" ; SFX_EVENT_SAVEASDOCDONE ; > ; - < "OnSave" ; SFX_EVENT_SAVEDOC ; > ; - < "OnSaveDone" ; SFX_EVENT_SAVEDOCDONE ; > ; - < "OnPrepareUnload" ; SFX_EVENT_PREPARECLOSEDOC ; > ; - < "OnUnload" ; SFX_EVENT_CLOSEDOC ; > ; - < "OnFocus" ; SFX_EVENT_ACTIVATEDOC ; > ; - < "OnUnfocus" ; SFX_EVENT_DEACTIVATEDOC ; > ; - < "OnPrint" ; SFX_EVENT_PRINTDOC ; > ; - < "OnModifyChanged" ; SFX_EVENT_MODIFYCHANGED ; > ; - < "OnCopyTo" ; SFX_EVENT_SAVETODOC ; > ; - < "OnCopyToDone" ; SFX_EVENT_SAVETODOCDONE ; > ; - < "OnViewCreated" ; SFX_EVENT_VIEWCREATED ; > ; - < "OnPrepareViewClosing"; SFX_EVENT_PREPARECLOSEVIEW ; > ; - < "OnViewClosed" ; SFX_EVENT_CLOSEVIEW ; > ; - < "OnVisAreaChanged" ; SFX_EVENT_VISAREACHANGED ; > ; - < "OnCreate" ; SFX_EVENT_DOCCREATED ; > ; - < "OnLoadFinished" ; SFX_EVENT_LOADFINISHED ; > ; - < "OnSaveAsFailed" ; SFX_EVENT_SAVEASDOCFAILED ; > ; - < "OnSaveFailed" ; SFX_EVENT_SAVEDOCFAILED ; > ; - < "OnCopyToFailed" ; SFX_EVENT_SAVETODOCFAILED ; > ; - }; -}; -*/ - -/* - these events are defined by the applications or aren't used - any longer - - < "OnNewMail" ; SFX_EVENT_NEWMESSAGE ; > ; - < "OnError" ; SFX_EVENT_ONERROR ; > ; - < "OnSelect" ; > ; - < "OnInsertStart" ; > ; - < "OnInsertDone" ; > ; - < "OnMailMerge" ; > ; - < "OnAlphaCharInput" ; > ; - < "OnNonAlphaCharInput" ; > ; - < "OnResize" ; > ; - < "OnMove" ; > ; - < "OnPageCountChange" ; > ; - < "OnMouseOver" ; SFX_EVENT_MOUSEOVER_OBJECT ; > ; - < "OnClick" ; SFX_EVENT_MOUSECLICK_OBJECT ; > ; - < "OnMouseOut" ; SFX_EVENT_MOUSEOUT_OBJECT ; > ; - < "OnLoadError" ; > ; - < "OnLoadCancel" ; > ; - < "OnLoadDone" ; > ; - < "OnLoadFinished" ; SFX_EVENT_LOADFINISHED ; > ; - < "OnSaveFinished" ; SFX_EVENT_SAVEFINISHED ; > ; - < "OnModifyChanged" ; SFX_EVENT_MODIFYCHANGED ; > ; - < "OnToggleFullscreen" ; SFX_EVENT_TOGGLEFULLSCREENMODE ; > ; -*/ diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx index 4520fd6c3d..f1a10d7b5f 100644 --- a/sfx2/source/inc/eventsupplier.hxx +++ b/sfx2/source/inc/eventsupplier.hxx @@ -187,7 +187,6 @@ class SfxGlobalEvents_Impl : public ModelCollectionMutexBase , ::com::sun::star::document::XEventListener , ::com::sun::star::document::XDocumentEventListener , ::com::sun::star::container::XSet > - , public SfxListener { ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMGR; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xEvents; @@ -197,8 +196,6 @@ class SfxGlobalEvents_Impl : public ModelCollectionMutexBase TModelList m_lModels; GlobalEventConfig* pImp; - void Notify( SfxBroadcaster& aBC, const SfxHint& aHint ); - public: SfxGlobalEvents_Impl(const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xSMGR); virtual ~SfxGlobalEvents_Impl(); diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index 54a5f2eca6..8ee3b79a6f 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -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 @@ -33,6 +33,8 @@ //#include <hash_map> #include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <rtl/ustring.hxx> #include <com/sun/star/logging/XSimpleLogRing.hpp> #include <tools/datetime.hxx> @@ -72,6 +74,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess xBasicLibraries; ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer > xDialogLibraries; + com::sun::star::uno::Sequence < rtl::OUString > xEventNames; ::sfx2::DocumentMacroMode aMacroMode; SfxProgress* pProgress; @@ -141,7 +144,6 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess SfxModule* pModule; SfxFrame* pFrame; SfxToolBoxConfig* pTbxConfig; - SfxEventConfigItem_Impl* pEventConfig; SfxObjectShellFlags eFlags; svtools::AsynchronLink* pCloser; String aBaseURL; diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index 226da37c66..933581c7fd 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -98,12 +98,6 @@ void SAL_CALL SfxEvents_Impl::replaceByName( const OUSTRING & aName, const ANY & // create Configuration at first, creation might call this method also and that would overwrite everything // we might have stored before! - USHORT nID = (USHORT) SfxEventConfiguration::GetEventId_Impl( aName ); - OSL_ENSURE( nID, "SfxEvents_Impl::replaceByName: no ID for the given event!" ); - if ( !nID ) - // throw? - return; - if ( mpObjShell && !mpObjShell->IsLoading() ) mpObjShell->SetModified( TRUE ); @@ -370,7 +364,7 @@ SfxEvents_Impl::SfxEvents_Impl( SfxObjectShell* pShell, if ( pShell ) maEventNames = pShell->GetEventNames(); else - maEventNames = SfxObjectShell::GetEventNames_Impl(); + maEventNames = GlobalEventConfig().getElementNames(); maEventData = SEQUENCE < ANY > ( maEventNames.getLength() ); @@ -646,24 +640,6 @@ SfxGlobalEvents_Impl::~SfxGlobalEvents_Impl() } //----------------------------------------------------------------------------- -void SfxGlobalEvents_Impl::Notify( SfxBroadcaster& /*aBC*/, const SfxHint& aHint ) -{ - SfxEventHint* pNamedHint = PTR_CAST(SfxEventHint, &aHint); - if (!pNamedHint) - return; - - css::uno::Reference< css::document::XEventsSupplier > xSup; - - ::rtl::OUString sName = SfxEventConfiguration::GetEventName_Impl(pNamedHint->GetEventId()); - SfxObjectShell* pShell = pNamedHint->GetObjShell(); - if (pShell) - xSup = css::uno::Reference< css::document::XEventsSupplier >(pShell->GetModel(), UNO_QUERY); - - css::document::EventObject aEvent(xSup, sName); - notifyEvent(aEvent); -} - -//----------------------------------------------------------------------------- css::uno::Reference< css::container::XNameReplace > SAL_CALL SfxGlobalEvents_Impl::getEvents() throw(css::uno::RuntimeException) { diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index d1487d3ebb..e5d7ca0693 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -296,7 +296,7 @@ sal_uInt16 SfxFrame::PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing ) bOther = ( pFrame->GetFrame() != this ); } - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEVIEW, pCur) ); + SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEVIEW ), pCur) ); if ( bOther ) // if there are other views only the current view of this frame must be asked diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 3d95c81f6e..cab7101731 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -79,6 +79,7 @@ namespace css = ::com::sun::star; #endif +#include <sfx2/doctempl.hxx> #include <sfx2/app.hxx> #include <sfx2/request.hxx> #include <sfx2/sfxsids.hrc> @@ -396,76 +397,88 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< css::bean return bLoadState; } - String sStandardTemplate = SfxObjectFactory::GetStandardTemplate( aServiceName ); - BOOL bUseDefaultTemplate = (sStandardTemplate.Len()>0); - if( bUseDefaultTemplate ) - { - // #i21583# - // Forget the filter, which was detected for the corresponding "private:factory/xxx" URL. - // We must use the right filter, matching to this document ... not to the private URL! - const SfxFilter* pTemplateFilter = impl_detectFilterForURL(sStandardTemplate, rArgs, rMatcher); - if (pTemplateFilter) - { - pFilter = pTemplateFilter; - aFilterName = pTemplateFilter->GetName(); - // standard template set -> load it "AsTemplate" - aSet.Put( SfxStringItem ( SID_FILE_NAME, sStandardTemplate ) ); - aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) ); - } + String sTemplateURL; + SFX_ITEMSET_ARG( &aSet, pTemplateRegionItem, SfxStringItem, SID_TEMPLATE_REGIONNAME, FALSE ); + SFX_ITEMSET_ARG( &aSet, pTemplateNameItem, SfxStringItem, SID_TEMPLATE_NAME, FALSE ); + if ( pTemplateRegionItem && pTemplateNameItem ) + { + SfxDocumentTemplates aTmpFac; + aTmpFac.GetFull( pTemplateRegionItem->GetValue(), pTemplateNameItem->GetValue(), sTemplateURL ); + } + else + { + sTemplateURL = SfxObjectFactory::GetStandardTemplate( aServiceName ); + } - // #119268# - // something is wrong with the set default template (e.g. unknown format, missing file etcpp) - // The we have to jump into the following special code, where "private:factory/ URL's are handled. - // We cant "load" such private/factory URL's! - else - bUseDefaultTemplate = FALSE; + BOOL bUseTemplate = (sTemplateURL.Len()>0); + if( bUseTemplate ) + { + // #i21583# + // Forget the filter, which was detected for the corresponding "private:factory/xxx" URL. + // We must use the right filter, matching to this document ... not to the private URL! + const SfxFilter* pTemplateFilter = impl_detectFilterForURL(sTemplateURL, rArgs, rMatcher); + if (pTemplateFilter) + { + pFilter = pTemplateFilter; + aFilterName = pTemplateFilter->GetName(); + // standard template set -> load it "AsTemplate" + aSet.Put( SfxStringItem ( SID_FILE_NAME, sTemplateURL ) ); + aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) ); } - if ( !bUseDefaultTemplate ) - { - // execute "NewDocument" request - /* Attention! - #107913# - Pointers can't be used to check if two objects are equals! - E.g. the memory manager can reuse freed memory ... - and then the holded copy of a pointer will point to another - (and different!) object - may using the same type then before. - In such case we compare one object with itself ... - */ - SfxRequest aReq( SID_NEWDOCDIRECT, SFX_CALLMODE_SYNCHRON, aSet ); - aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, pFrame ) ); - aReq.AppendItem( SfxStringItem( SID_NEWDOCDIRECT, aFact ) ); - - if ( pDocumentTitleItem ) - aReq.AppendItem( *pDocumentTitleItem ); - - const SfxPoolItem* pRet = pApp->NewDocDirectExec_ImplOld(aReq); - if (pRet) - { - // default must be set to true, because some return values - // cant be checked ... but indicates "success"! - bLoadState = sal_True; + // #119268# + // something is wrong with the set default template (e.g. unknown format, missing file etcpp) + // The we have to jump into the following special code, where "private:factory/ URL's are handled. + // We cant "load" such private/factory URL's! + else + bUseTemplate = FALSE; + } - // On the other side some special slots return a boolean state, - // which can be set to FALSE. - SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, pRet ); - if (pItem) - bLoadState = pItem->GetValue(); - } - else - bLoadState = sal_False; + if ( !bUseTemplate ) + { + // execute "NewDocument" request + /* Attention! + #107913# + Pointers can't be used to check if two objects are equals! + E.g. the memory manager can reuse freed memory ... + and then the holded copy of a pointer will point to another + (and different!) object - may using the same type then before. + In such case we compare one object with itself ... + */ + SfxRequest aReq( SID_NEWDOCDIRECT, SFX_CALLMODE_SYNCHRON, aSet ); + aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, pFrame ) ); + aReq.AppendItem( SfxStringItem( SID_NEWDOCDIRECT, aFact ) ); + + if ( pDocumentTitleItem ) + aReq.AppendItem( *pDocumentTitleItem ); + + const SfxPoolItem* pRet = pApp->NewDocDirectExec_ImplOld(aReq); + if (pRet) + { + // default must be set to true, because some return values + // cant be checked ... but indicates "success"! + bLoadState = sal_True; - if ( !bLoadState && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() ) - { - css::uno::Reference< css::frame::XFrame > axFrame; - wFrame->SetFrameInterface_Impl( axFrame ); - wFrame->DoClose(); - } + // On the other side some special slots return a boolean state, + // which can be set to FALSE. + SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, pRet ); + if (pItem) + bLoadState = pItem->GetValue(); + } + else + bLoadState = sal_False; - xFrame.clear(); - xListener.clear(); - return bLoadState; + if ( !bLoadState && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() ) + { + css::uno::Reference< css::frame::XFrame > axFrame; + wFrame->SetFrameInterface_Impl( axFrame ); + wFrame->DoClose(); } + + xFrame.clear(); + xListener.clear(); + return bLoadState; + } } else { diff --git a/sfx2/source/view/prnmon.cxx b/sfx2/source/view/prnmon.cxx index 6be24a75e2..899b082c89 100644 --- a/sfx2/source/view/prnmon.cxx +++ b/sfx2/source/view/prnmon.cxx @@ -388,7 +388,7 @@ IMPL_LINK_INLINE_END( SfxPrintProgress, PrintErrorNotify, void *, EMPTYARG ) IMPL_LINK( SfxPrintProgress, StartPrintNotify, void *, EMPTYARG ) { SfxObjectShell *pObjShell = pImp->pViewShell->GetObjectShell(); - SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_PRINTDOC, pObjShell)); + SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_PRINTDOC, GlobalEventConfig::GetEventName( STR_EVENT_PRINTDOC ), pObjShell)); pObjShell->Broadcast( SfxPrintingHint( com::sun::star::view::PrintableState_JOB_STARTED, NULL, NULL ) ); return 0; } diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 029a160fa3..5a64421423 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1148,9 +1148,9 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime if ( m_pData->m_bIsFrameReleasedWithController ) { - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEVIEW, pDoc ) ); + SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEVIEW ), pDoc ) ); if ( !pView ) - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, pDoc) ); + SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), pDoc) ); } REFERENCE< XMODEL > xModel = pDoc->GetModel(); diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index ea7dd77f98..bf88a5775d 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -210,6 +210,9 @@ long SfxTopWindow_Impl::Notify( NotifyEvent& rNEvt ) if ( nHelpId ) SfxHelp::OpenHelpAgent( pFrame, nHelpId ); + // if focus was on an external window, the clipboard content might have been changed + pView->GetBindings().Invalidate( SID_PASTE ); + pView->GetBindings().Invalidate( SID_PASTE_SPECIAL ); return sal_True; } else if( rNEvt.GetType() == EVENT_KEYINPUT ) @@ -1016,7 +1019,7 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) GetCurrentViewFrame()->Resize(TRUE); } - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, pDoc ) ); + SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), pDoc ) ); return sal_True; } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 2ad6ea9377..8f406833a5 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -867,7 +867,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) if ( xNewObj.Is() ) { // Propagate document closure. - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_CLOSEDOC, xOldObj ) ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), xOldObj ) ); } // als erledigt recorden @@ -1145,7 +1145,7 @@ void SfxViewFrame::SetObjectShell_Impl SwitchToViewShell_Impl( !IsRestoreView_Impl() ? (sal_uInt16) 0 : GetCurViewId() ); rObjSh.PostActivateEvent_Impl( this ); if ( Current() == this ) - SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_ACTIVATEDOC, &rObjSh ) ); + SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_ACTIVATEDOC, GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), &rObjSh ) ); Notify( rObjSh, SfxSimpleHint(SFX_HINT_TITLECHANGED) ); Notify( rObjSh, SfxSimpleHint(SFX_HINT_DOCCHANGED) ); @@ -1518,6 +1518,8 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) case SFX_HINT_MODECHANGED: { // r/o Umschaltung? + SfxBindings& rBind = GetBindings(); + rBind.Invalidate( SID_RELOAD ); SfxDispatcher *pDispat = GetDispatcher(); sal_Bool bWasReadOnly = pDispat->GetReadOnly_Impl(); sal_Bool bIsReadOnly = xObjSh->IsReadOnly(); @@ -1525,8 +1527,9 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { // Dann auch TITLE_CHANGED UpdateTitle(); - GetBindings().Invalidate( SID_FILE_NAME ); - GetBindings().Invalidate( SID_DOCINFO_TITLE ); + rBind.Invalidate( SID_FILE_NAME ); + rBind.Invalidate( SID_DOCINFO_TITLE ); + rBind.Invalidate( SID_EDITDOC ); pDispat->GetBindings()->InvalidateAll(sal_True); pDispat->SetReadOnly_Impl( bIsReadOnly ); @@ -1547,8 +1550,11 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) case SFX_HINT_TITLECHANGED: { UpdateTitle(); - GetBindings().Invalidate( SID_FILE_NAME ); - GetBindings().Invalidate( SID_DOCINFO_TITLE ); + SfxBindings& rBind = GetBindings(); + rBind.Invalidate( SID_FILE_NAME ); + rBind.Invalidate( SID_DOCINFO_TITLE ); + rBind.Invalidate( SID_EDITDOC ); + rBind.Invalidate( SID_RELOAD ); break; } @@ -1576,12 +1582,16 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) rBind.Invalidate( SID_DOC_MODIFIED ); rBind.Invalidate( SID_SAVEDOC ); rBind.Invalidate( SID_RELOAD ); + rBind.Invalidate( SID_EDITDOC ); break; } case SFX_EVENT_OPENDOC: case SFX_EVENT_CREATEDOC: { + SfxBindings& rBind = GetBindings(); + rBind.Invalidate( SID_RELOAD ); + rBind.Invalidate( SID_EDITDOC ); if ( !xObjSh->IsReadOnly() ) { // Im Gegensatz zu oben (TITLE_CHANGED) mu\s das UI nicht diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index e26b788ed1..81809c8980 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -45,6 +45,8 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <svtools/acceleratorexecute.hxx> +#include <queue> + // forward --------------------------------------------------------------- class SfxOfficeDispatch; @@ -54,6 +56,20 @@ typedef SfxShell* SfxShellPtr_Impl; SV_DECL_PTRARR( SfxShellArr_Impl, SfxShellPtr_Impl, 4, 4 ) // struct SfxViewShell_Impl ---------------------------------------------- +class SfxAsyncPrintExec_Impl : public SfxListener +{ + SfxViewShell* pView; + ::std::queue < SfxRequest*> aReqs; + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + +public: + SfxAsyncPrintExec_Impl( SfxViewShell* pShell) + : pView( pShell ) + {} + + void AddRequest( SfxRequest& rReq ); +}; struct SfxViewShell_Impl { @@ -78,6 +94,7 @@ struct SfxViewShell_Impl USHORT nFamily; SfxBaseController* pController; ::svt::AcceleratorExecute* pAccExec; + SfxAsyncPrintExec_Impl* pPrinterCommandQueue; com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts; SfxViewShell_Impl() diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index eb7c3b11ee..0f1ae3d110 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -53,6 +53,7 @@ #include <tools/datetime.hxx> #include <sfx2/viewsh.hxx> +#include <sfx2/dispatch.hxx> #include "viewimp.hxx" #include <sfx2/viewfrm.hxx> #include <sfx2/prnmon.hxx> @@ -71,6 +72,43 @@ TYPEINIT1(SfxPrintingHint, SfxHint); // ----------------------------------------------------------------------- +void SfxAsyncPrintExec_Impl::AddRequest( SfxRequest& rReq ) +{ + if ( rReq.GetArgs() ) + { + // only queue API requests + if ( aReqs.empty() ) + StartListening( *pView->GetObjectShell() ); + + aReqs.push( new SfxRequest( rReq ) ); + } +} + +void SfxAsyncPrintExec_Impl::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) +{ + if ( &rBC == pView->GetObjectShell() ) + { + SfxPrintingHint* pPrintHint = PTR_CAST( SfxPrintingHint, &rHint ); + if ( pPrintHint && pPrintHint->GetWhich() == com::sun::star::view::PrintableState_JOB_COMPLETED ) + { + while ( aReqs.front() ) + { + SfxRequest* pReq = aReqs.front(); + aReqs.pop(); + pView->GetViewFrame()->GetDispatcher()->Execute( pReq->GetSlot(), SFX_CALLMODE_ASYNCHRON, *pReq->GetArgs() ); + USHORT nSlot = pReq->GetSlot(); + delete pReq; + if ( nSlot == SID_PRINTDOC || nSlot == SID_PRINTDOCDIRECT ) + // print jobs must be executed before the next command can be dispatched + break; + } + + if ( aReqs.empty() ) + EndListening( *pView->GetObjectShell() ); + } + } +} + void DisableRanges( PrintDialog& rDlg, SfxPrinter* pPrinter ) /* [Beschreibung] @@ -389,13 +427,19 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { USHORT nCopies=1; USHORT nDialogRet = RET_CANCEL; - BOOL bCollate=FALSE; + BOOL bCollate=TRUE; SfxPrinter* pPrinter = 0; PrintDialog* pPrintDlg = 0; SfxDialogExecutor_Impl* pExecutor = 0; bool bSilent = false; BOOL bIsAPI = rReq.GetArgs() && rReq.GetArgs()->Count(); + if ( bIsAPI && GetPrinter( FALSE ) && GetPrinter( FALSE )->IsPrinting() ) + { + pImp->pPrinterCommandQueue->AddRequest( rReq ); + return; + } + const USHORT nId = rReq.GetSlot(); switch( nId ) { @@ -866,8 +910,11 @@ ErrCode SfxViewShell::DoPrint( SfxPrinter *pPrinter, else if ( pDocPrinter != pPrinter ) { pProgress->RestoreOnEndPrint( pDocPrinter->Clone() ); - SetPrinter( pPrinter, SFX_PRINTER_PRINTER ); + USHORT nError = SetPrinter( pPrinter, SFX_PRINTER_PRINTER ); + if ( nError != SFX_PRINTERROR_NONE ) + return PRINTER_ACCESSDENIED; } + pProgress->SetWaitMode(FALSE); // Drucker starten diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 426e9bb953..7d41d2bfa0 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -47,6 +47,9 @@ #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/container/XContainerQuery.hpp> #include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> +#include <cppuhelper/implbase1.hxx> #include <osl/file.hxx> #include <vos/mutex.hxx> @@ -112,6 +115,68 @@ DBG_NAME(SfxViewShell) //========================================================================= +class SfxClipboardChangeListener : public ::cppu::WeakImplHelper1< + datatransfer::clipboard::XClipboardListener > +{ + SfxViewShell* pViewShell; + + // XEventListener + virtual void SAL_CALL disposing( const lang::EventObject& rEventObject ) + throw ( uno::RuntimeException ); + + // XClipboardListener + virtual void SAL_CALL changedContents( const datatransfer::clipboard::ClipboardEvent& rEventObject ) + throw ( uno::RuntimeException ); + +public: + SfxClipboardChangeListener( SfxViewShell* pView ); + virtual ~SfxClipboardChangeListener(); +}; + +SfxClipboardChangeListener::SfxClipboardChangeListener( SfxViewShell* pView ) +: pViewShell( 0 ) +{ + uno::Reference < lang::XComponent > xCtrl( pView->GetController(), uno::UNO_QUERY ); + if ( xCtrl.is() ) + { + xCtrl->addEventListener( uno::Reference < lang::XEventListener > ( static_cast < lang::XEventListener* >( this ) ) ); + pViewShell = pView; + } +} + +SfxClipboardChangeListener::~SfxClipboardChangeListener() +{ +} + +void SAL_CALL SfxClipboardChangeListener::disposing( const lang::EventObject& /*rEventObject*/ ) +throw ( uno::RuntimeException ) +{ + // either clipboard or ViewShell is going to be destroyed -> no interest in listening anymore + const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( pViewShell ) + { + uno::Reference < lang::XComponent > xCtrl( pViewShell->GetController(), uno::UNO_QUERY ); + if ( xCtrl.is() ) + xCtrl->removeEventListener( uno::Reference < lang::XEventListener > ( static_cast < lang::XEventListener* >( this ) ) ); + pViewShell->AddRemoveClipboardListener( uno::Reference < datatransfer::clipboard::XClipboardListener > (this), FALSE ); + pViewShell = 0; + } +} + +void SAL_CALL SfxClipboardChangeListener::changedContents( const datatransfer::clipboard::ClipboardEvent& ) + throw ( RuntimeException ) +{ + const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if( pViewShell ) + { + SfxBindings& rBind = pViewShell->GetViewFrame()->GetBindings(); + rBind.Invalidate( SID_PASTE ); + rBind.Invalidate( SID_PASTE_SPECIAL ); + rBind.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS ); + } +} + + static ::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& rCommandURL, const css::uno::Reference< css::frame::XFrame >& rFrame ) @@ -687,6 +752,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet ) case SID_PRINTDOC: case SID_PRINTDOCDIRECT: case SID_SETUPPRINTER: + case SID_PRINTER_NAME: { BOOL bEnabled = pImp->bCanPrint && !pImp->nPrinterLocks; bEnabled = bEnabled && !Application::GetSettings().GetMiscSettings().GetDisablePrinting(); @@ -720,9 +786,10 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet ) } if ( !bEnabled ) { - rSet.DisableItem( SID_PRINTDOC ); + // will now be handled by requeing the request + /* rSet.DisableItem( SID_PRINTDOC ); rSet.DisableItem( SID_PRINTDOCDIRECT ); - rSet.DisableItem( SID_SETUPPRINTER ); + rSet.DisableItem( SID_SETUPPRINTER ); */ } break; } @@ -1187,6 +1254,7 @@ SfxViewShell::SfxViewShell { DBG_CTOR(SfxViewShell, 0); + pImp->pPrinterCommandQueue = new SfxAsyncPrintExec_Impl( this ); pImp->pController = 0; pImp->bIsShowView = !(SFX_VIEW_NO_SHOW == (nFlags & SFX_VIEW_NO_SHOW)); @@ -1240,6 +1308,8 @@ SfxViewShell::~SfxViewShell() delete pImp->pAccExec; pImp->pAccExec = 0; } + + delete pImp->pPrinterCommandQueue; delete pImp; delete pIPClientList; } @@ -1926,6 +1996,8 @@ void SfxViewShell::SetController( SfxBaseController* pController ) pImp->pController = pController; pImp->pController->acquire(); pImp->bControllerSet = TRUE; + + AddRemoveClipboardListener( new SfxClipboardChangeListener( this ), TRUE ); } Reference < XController > SfxViewShell::GetController() @@ -2128,3 +2200,25 @@ BOOL SfxViewShell::Escape() { return GetViewFrame()->GetBindings().Execute( SID_TERMINATE_INPLACEACTIVATION ); } + +void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransfer::clipboard::XClipboardListener >& rClp, BOOL bAdd ) +{ + try + { + uno::Reference< datatransfer::clipboard::XClipboard > xClipboard( GetViewFrame()->GetWindow().GetClipboard() ); + if( !xClipboard.is() ) + return; + + uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY ); + if( xClpbrdNtfr.is() ) + { + if( bAdd ) + xClpbrdNtfr->addClipboardListener( rClp ); + else + xClpbrdNtfr->removeClipboardListener( rClp ); + } + } + catch( const uno::Exception& ) + { + } +} |