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 | 5ed3fa4c39a67b2b12b4206bef6680fb757e1b75 (patch) | |
tree | d85ce99214129673a433b6a5c52181367bce2f13 /sw | |
parent | 8493b85dfcbac97bd23393ceec8f057ea5a8cc82 (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 'sw')
36 files changed, 238 insertions, 323 deletions
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index d8cd78622d4c..05ff8add5dd8 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -153,7 +153,6 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr #define FN_GOTO (FN_EDIT + 11) /* Gehe zu */ #define FN_PASTE (FN_EDIT + 13) /* Einfuegen */ -#define FN_PASTESPECIAL (FN_EDIT + 14) /* Verknuepfung einfuegen */ #define FN_PASTESPECIAL_DLG (FN_EDIT + 15) /* Verknuepfung einfuegen */ #define FN_NUMBER_BULLETS (FN_EDIT + 21) /* Bullets */ #define FN_REPEAT (FN_EDIT + 22) /* Letzten Befehl wiederholen */ diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 6bfd5437a20e..6ed3f6d652bd 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -151,6 +151,8 @@ public: static SfxInterface *_GetInterface() { return GetStaticInterface(); } + static rtl::OUString GetEventName( sal_Int32 nId ); + //Das Doc wird fuer SO-Datenaustausch benoetigt! SwDocShell( SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED, sal_Bool _bScriptingSupport = sal_True ); SwDocShell( SwDoc *pDoc, SfxObjectCreateMode eMode = SFX_CREATE_MODE_STANDARD ); diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx index 66a9dadb09eb..7d57e6e2dc52 100644 --- a/sw/inc/swevent.hxx +++ b/sw/inc/swevent.hxx @@ -50,6 +50,20 @@ #define SW_EVENT_FIELD_MERGE_FINISHED ( EVENT_APP_START + 11 ) #define SW_EVENT_LAYOUT_FINISHED ( EVENT_APP_START + 12 ) +#define STR_SW_EVENT_PAGE_COUNT 0 +#define STR_SW_EVENT_MAIL_MERGE 1 +#define STR_SW_EVENT_MAIL_MERGE_END 2 +#define STR_SW_EVENT_FIELD_MERGE 3 +#define STR_SW_EVENT_FIELD_MERGE_FINISHED 4 +#define STR_SW_EVENT_LAYOUT_FINISHED 5 +#define STR_SW_EVENT_OBJECT_SELECT 6 +#define STR_SW_EVENT_START_INS_GLOSSARY 7 +#define STR_SW_EVENT_END_INS_GLOSSARY 8 +#define STR_SW_EVENT_FRM_KEYINPUT_ALPHA 9 +#define STR_SW_EVENT_FRM_KEYINPUT_NOALPHA 10 +#define STR_SW_EVENT_FRM_RESIZE 11 +#define STR_SW_EVENT_FRM_MOVE 12 + class SwFrmFmt; class SwFmtINetFmt; class IMapObject; diff --git a/sw/sdi/_annotsh.sdi b/sw/sdi/_annotsh.sdi index 9b5f411ffd28..e1249a337ee8 100755 --- a/sw/sdi/_annotsh.sdi +++ b/sw/sdi/_annotsh.sdi @@ -93,7 +93,6 @@ interface _Annotation [ ExecMethod = ExecClpbrd ; StateMethod = StateClpbrd ; - Volatile ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] @@ -101,7 +100,6 @@ interface _Annotation [ ExecMethod = ExecClpbrd ; StateMethod = StateClpbrd ; - Volatile ; ] SID_PASTE // api: @@ -111,7 +109,7 @@ interface _Annotation DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] - FN_PASTESPECIAL // api: + SID_PASTE_SPECIAL // api: [ StateMethod = StateClpbrd ; ExecMethod = ExecClpbrd ; diff --git a/sw/sdi/_basesh.sdi b/sw/sdi/_basesh.sdi index 50b85eddfab6..882104509b9e 100644 --- a/sw/sdi/_basesh.sdi +++ b/sw/sdi/_basesh.sdi @@ -95,7 +95,6 @@ interface BaseTextSelection [ ExecMethod = ExecClpbrd ; StateMethod = StateClpbrd ; - Volatile; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] @@ -103,7 +102,6 @@ interface BaseTextSelection [ ExecMethod = ExecClpbrd ; StateMethod = StateClpbrd ; - Volatile; ] SID_PASTE // status(final|play) @@ -127,7 +125,7 @@ interface BaseTextSelection DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] - FN_PASTESPECIAL // status(final|play) + SID_PASTE_SPECIAL // status(final|play) [ ExecMethod = ExecClpbrd ; StateMethod = StateClpbrd ; diff --git a/sw/sdi/_docsh.sdi b/sw/sdi/_docsh.sdi index 6dfd2c78bd47..9154e6ce2578 100644 --- a/sw/sdi/_docsh.sdi +++ b/sw/sdi/_docsh.sdi @@ -133,6 +133,7 @@ interface BaseTextDocument : OfficeDocument ExecMethod = Execute; StateMethod = GetState; ] + FN_PRINT_LAYOUT [ ExecMethod = Execute; diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi index 8f6eb837af86..0da76e212df1 100644 --- a/sw/sdi/drwtxtsh.sdi +++ b/sw/sdi/drwtxtsh.sdi @@ -43,7 +43,6 @@ interface TextDrawText [ ExecMethod = ExecClpbrd ; StateMethod = StateClpbrd ; - Volatile ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] @@ -51,7 +50,6 @@ interface TextDrawText [ ExecMethod = ExecClpbrd ; StateMethod = StateClpbrd ; - Volatile ; ] SID_PASTE // api: @@ -61,7 +59,7 @@ interface TextDrawText DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] - FN_PASTESPECIAL // api: + SID_PASTE_SPECIAL // api: [ StateMethod = StateClpbrd ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; diff --git a/sw/sdi/makefile.mk b/sw/sdi/makefile.mk index cc6ae3bc20bd..25b75feea040 100644 --- a/sw/sdi/makefile.mk +++ b/sw/sdi/makefile.mk @@ -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 @@ -97,8 +97,10 @@ SVSDI1DEPEND= \ annotsh.sdi\ swslots.hrc \ $(INC)$/globals.hrc \ - $(INC)$/cmdid.h + $(INC)$/cmdid.h \ + $(SOLARINCXDIR)$/svxslots.ilb .ENDIF + # --- Targets ------------------------------------------------------- .INCLUDE : target.mk diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 784100694d4a..315d34197715 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -821,7 +821,7 @@ SfxVoidItem ChangeDatabaseField FN_CHANGE_DBFIELD [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = TRUE, @@ -1759,7 +1759,7 @@ SfxVoidItem ExecuteMacroField FN_EXECUTE_MACROFIELD [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -1809,7 +1809,7 @@ SfxVoidItem FieldDialog FN_EDIT_FIELD [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = TRUE, @@ -4370,7 +4370,7 @@ SfxVoidItem InsertMultiIndex FN_INSERT_MULTI_TOX [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = TRUE, @@ -6509,31 +6509,6 @@ SfxVoidItem PageUpSel FN_PAGEUP_SEL ] //-------------------------------------------------------------------------- -SfxInt16Item PasteSpecial FN_PASTESPECIAL -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Volatile, - FastCall = TRUE, - 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; -] - -//-------------------------------------------------------------------------- SfxVoidItem PreviewPrintOptions FN_PREVIEW_PRINT_OPTIONS () [ @@ -6592,7 +6567,7 @@ SfxBoolItem PrintLayout FN_PRINT_LAYOUT [ /* flags: */ AutoUpdate = TRUE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -6873,7 +6848,7 @@ SfxBoolItem Ruler FN_RULER [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -7052,7 +7027,7 @@ SfxUInt16Item SelectionMode FN_STAT_SELMODE [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -7419,7 +7394,7 @@ SfxVoidItem SetOptimalColumnWidth FN_TABLE_ADJUST_CELLS [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = TRUE, HasCoreId = FALSE, HasDialog = FALSE, @@ -7930,7 +7905,7 @@ SfxStringItem StatePageNumber FN_STAT_PAGE [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, @@ -8708,7 +8683,7 @@ SfxBoolItem ViewBounds FN_VIEW_BOUNDS [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, diff --git a/sw/sdi/viewsh.sdi b/sw/sdi/viewsh.sdi index 18d537144c5b..05b41e6e7482 100644 --- a/sw/sdi/viewsh.sdi +++ b/sw/sdi/viewsh.sdi @@ -158,9 +158,17 @@ shell SwView : SfxViewShell interface TextPrintPreview : View [ uuid = "1622A480-111A-101D-9757-6E74207A7520" ] { + SID_BROWSER_MODE + [ + StateMethod = GetState; + ] + FN_PRINT_LAYOUT + [ + ExecMethod = Execute; + StateMethod = GetState; + ] FN_REFRESH_VIEW // status(final|play) [ - ExecMethod = Execute ; StateMethod = GetState ; ] FN_CHAR_LEFT // status(final|play) diff --git a/sw/sdi/wdocsh.sdi b/sw/sdi/wdocsh.sdi index fb704c8c19b4..e2efd025c1df 100644 --- a/sw/sdi/wdocsh.sdi +++ b/sw/sdi/wdocsh.sdi @@ -38,7 +38,6 @@ interface WebDocument : BaseTextDocument [ ExecMethod = Execute ; StateMethod = GetState ; - Volatile = TRUE; Asynchron = TRUE; ] diff --git a/sw/sdi/wviewsh.sdi b/sw/sdi/wviewsh.sdi index e38e99246a36..3eff3db1f4a0 100644 --- a/sw/sdi/wviewsh.sdi +++ b/sw/sdi/wviewsh.sdi @@ -144,7 +144,6 @@ interface WebSourceView : View [ ExecMethod = Execute ; StateMethod = GetState ; - Volatile; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] @@ -152,7 +151,6 @@ interface WebSourceView : View [ ExecMethod = Execute ; StateMethod = GetState ; - Volatile; ] SID_PASTE // status(final|play) @@ -187,6 +185,14 @@ interface WebSourceView : View [ StateMethod = GetState ; ] + SID_BROWSER_MODE + [ + StateMethod = GetState; + ] + FN_PRINT_LAYOUT + [ + StateMethod = GetState; + ] } shell SwSrcView : SfxViewShell diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 9cbf7ace6ea7..fb365e4a5116 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -3031,7 +3031,8 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) : if ( !bInValid ) { pRoot->ResetIdleFormat(); - pImp->GetShell()->GetDoc()->GetDocShell()->Broadcast( SfxEventHint( SW_EVENT_LAYOUT_FINISHED ) ); + SfxObjectShell* pDocShell = pImp->GetShell()->GetDoc()->GetDocShell(); + pDocShell->Broadcast( SfxEventHint( SW_EVENT_LAYOUT_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_LAYOUT_FINISHED), pDocShell ) ); } } diff --git a/sw/source/core/unocore/unoevent.cxx b/sw/source/core/unocore/unoevent.cxx index 339ef87c1ace..26486cb255dc 100644 --- a/sw/source/core/unocore/unoevent.cxx +++ b/sw/source/core/unocore/unoevent.cxx @@ -73,93 +73,6 @@ const sal_Char sAPI_SwHyperlinkEventDescriptor[] = const sal_Char sAPI_SwAutoTextEventDescriptor[] = "SwAutoTextEventDescriptor"; - -// // -// // tables of all known events handled by this class -// // - -// // careful: keep aKnownEventIDs and aKnownEventNames in sync! - -// const USHORT aKnownEventIDs[] = -// { -// SW_EVENT_OBJECT_SELECT, -// SW_EVENT_START_INS_GLOSSARY, -// SW_EVENT_END_INS_GLOSSARY, -// SW_EVENT_MAIL_MERGE, -// SW_EVENT_FRM_KEYINPUT_ALPHA, -// SW_EVENT_FRM_KEYINPUT_NOALPHA, -// SW_EVENT_FRM_RESIZE, -// SW_EVENT_FRM_MOVE, -// SW_EVENT_PAGE_COUNT, -// SFX_EVENT_MOUSEOVER_OBJECT, -// SFX_EVENT_MOUSECLICK_OBJECT, -// SFX_EVENT_MOUSEOUT_OBJECT, -// SFX_EVENT_OPENDOC, -// SFX_EVENT_CLOSEDOC, -// SFX_EVENT_STARTAPP, -// SFX_EVENT_CLOSEAPP, -// SFX_EVENT_CREATEDOC, -// SFX_EVENT_SAVEDOC, -// SFX_EVENT_SAVEASDOC, -// SFX_EVENT_ACTIVATEDOC, -// SFX_EVENT_DEACTIVATEDOC, -// SFX_EVENT_PRINTDOC, -// SFX_EVENT_ONERROR, -// SFX_EVENT_LOADFINISHED, -// SFX_EVENT_SAVEFINISHED, -// SFX_EVENT_MODIFYCHANGED, -// SFX_EVENT_PREPARECLOSEDOC, -// SFX_EVENT_NEWMESSAGE, -// SFX_EVENT_TOGGLEFULLSCREENMODE, -// SFX_EVENT_SAVEDOCDONE, -// SFX_EVENT_SAVEASDOCDONE, -// SVX_EVENT_IMAGE_LOAD, -// SVX_EVENT_IMAGE_ABORT, -// SVX_EVENT_IMAGE_ERROR, -// 0 -// }; - -// const sal_Char* aKnownEventNames[] = -// { -// "OnSelect", // SW_EVENT_OBJECT_SELECT -// "OnInsertStart", // SW_EVENT_START_INS_GLOSSARY -// "OnInsertDone", // SW_EVENT_END_INS_GLOSSARY -// "OnMailMerge", // SW_EVENT_MAIL_MERGE -// "OnAlphaCharInput", // SW_EVENT_FRM_KEYINPUT_ALPHA -// "OnNonAlphaCharInput", // SW_EVENT_FRM_KEYINPUT_NOALPHA -// "OnResize", // SW_EVENT_FRM_RESIZE -// "OnMove", // SW_EVENT_FRM_MOVE -// "PageCountChange", // SW_EVENT_PAGE_COUNT -// "OnMouseOver", // SFX_EVENT_MOUSEOVER_OBJECT -// "OnClick", // SFX_EVENT_MOUSECLICK_OBJECT -// "OnMouseOut", // SFX_EVENT_MOUSEOUT_OBJECT -// "OnLoad", // SFX_EVENT_OPENDOC, -// "OnUnload", // SFX_EVENT_CLOSEDOC, -// "OnStartApp", // SFX_EVENT_STARTAPP, -// "OnCloseApp", // SFX_EVENT_CLOSEAPP, -// "OnNew", // SFX_EVENT_CREATEDOC, -// "OnSave", // SFX_EVENT_SAVEDOC, -// "OnSaveAs", // SFX_EVENT_SAVEASDOC, -// "OnFocus", // SFX_EVENT_ACTIVATEDOC, -// "OnUnfocus", // SFX_EVENT_DEACTIVATEDOC, -// "OnPrint", // SFX_EVENT_PRINTDOC, -// "OnError", // SFX_EVENT_ONERROR, -// "OnLoadFinished", // SFX_EVENT_LOADFINISHED, -// "OnSaveFinished", // SFX_EVENT_SAVEFINISHED, -// "OnModifyChanged", // SFX_EVENT_MODIFYCHANGED, -// "OnPrepareUnload", // SFX_EVENT_PREPARECLOSEDOC, -// "OnNewMail", // SFX_EVENT_NEWMESSAGE, -// "OnToggleFullscreen", // SFX_EVENT_TOGGLEFULLSCREENMODE, -// "OnSaveDone", // SFX_EVENT_SAVEDOCDONE, -// "OnSaveAsDone", // SFX_EVENT_SAVEASDOCDONE, -// "OnLoadError", // SVX_EVENT_IMAGE_LOAD, -// "OnLoadCancel", // SVX_EVENT_IMAGE_ABORT, -// "OnLoadDone", // SVX_EVENT_IMAGE_ERROR, - -// NULL -// }; - - // // tables of allowed events for specific objects // @@ -229,40 +142,6 @@ const struct SvEventDescription aFrameStyleEvents[] = { 0, NULL } }; -const struct SvEventDescription aDocumentEvents[] = -{ - { SFX_EVENT_STARTAPP, "OnStartApp" }, - { SFX_EVENT_CLOSEAPP, "OnCloseApp" }, - { SFX_EVENT_CREATEDOC, "OnNew" }, - { SFX_EVENT_OPENDOC, "OnLoad" }, - { SFX_EVENT_SAVEDOC, "OnSave" }, - { SFX_EVENT_SAVEASDOC, "OnSaveAs" }, -// ??? cf. SAVEDOCDONE, SAVEASDOCDONE - { SFX_EVENT_SAVEFINISHED, "OnSaveFinished" }, - { SFX_EVENT_CLOSEDOC, "OnUnload" }, - { SFX_EVENT_ACTIVATEDOC, "OnFocus" }, - { SFX_EVENT_DEACTIVATEDOC, "OnUnfocus" }, - { SFX_EVENT_ONERROR, "OnError" }, - { SFX_EVENT_NEWMESSAGE, "OnNewMail" }, - { SFX_EVENT_PRINTDOC, "OnPrint" }, - { SW_EVENT_MAIL_MERGE, "OnMailMerge" }, - { SW_EVENT_PAGE_COUNT, "PageCountChange" }, - { SW_EVENT_FIELD_MERGE, "OnFieldMerge" }, - { SW_EVENT_FIELD_MERGE_FINISHED, "OnFieldMergeFinished" }, -// SFX_EVENT_LOADFINISHED, -// SFX_EVENT_MODIFYCHANGED, -// SFX_EVENT_PREPARECLOSEDOC, -// SFX_EVENT_TOGGLEFULLSCREENMODE, -// SFX_EVENT_SAVEDOCDONE, -// SFX_EVENT_SAVEASDOCDONE, - - { 0, NULL } -}; - - - - - // // SwHyperlinkEventDescriptor // diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index bb003d292ed8..e591d2d5e90b 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -47,6 +47,8 @@ #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> +#include <com/sun/star/document/XEventsSupplier.hpp> +#include <com/sun/star/uno/Reference.hxx> #include <fmtornt.hxx> #include <fmtfld.hxx> @@ -251,7 +253,7 @@ void SwHTMLParser::AddScriptSource() } } -void SwHTMLParser::InsertBasicDocEvent( USHORT nEvent, const String& rName, +void SwHTMLParser::InsertBasicDocEvent( rtl::OUString aEvent, const String& rName, ScriptType eScrType, const String& rScrType ) { @@ -270,8 +272,10 @@ void SwHTMLParser::InsertBasicDocEvent( USHORT nEvent, const String& rName, if( EXTENDED_STYPE == eScrType ) sScriptType = rScrType; + rtl::OUString aEventName; + SfxEventConfiguration* pECfg = SFX_APP()->GetEventConfig(); - pECfg->ConfigureEvent( nEvent, SvxMacro( sEvent, sScriptType, eScrType ), + pECfg->ConfigureEvent( aEvent, SvxMacro( sEvent, sScriptType, eScrType ), pDocSh ); } @@ -338,6 +342,10 @@ void SwHTMLWriter::OutBasic() SFX_APP()->LeaveBasicCall(); } +static const char* aEventNames[] = +{ + "OnLoad", "OnPrepareUnload", "OnFocus", "OnUnfocus" +}; void SwHTMLWriter::OutBasicBodyEvents() { @@ -345,14 +353,19 @@ void SwHTMLWriter::OutBasicBodyEvents() if( !pDocSh ) return; - SfxEventConfiguration* pECfg = SFX_APP()->GetEventConfig(); - ASSERT( pECfg, "Wo ist die Event-Konfiguration?" ); - if( !pECfg ) - return; + SvxMacroTableDtor *pDocTable = new SvxMacroTableDtor; + + uno::Reference< document::XEventsSupplier > xSup( pDocSh->GetModel(), uno::UNO_QUERY ); + uno::Reference < container::XNameReplace > xEvents = xSup->getEvents(); + for ( sal_Int32 i=0; i<4; i++ ) + { + SvxMacro* pMacro = SfxEventConfiguration::ConvertToMacro( xEvents->getByName( ::rtl::OUString::createFromAscii(aEventNames[i]) ), pDocSh, TRUE ); + if ( pMacro ) + pDocTable->Insert( aBodyEventTable[i].nEvent, pMacro ); + } - SvxMacroTableDtor *pMacTable = pECfg->GetDocEventTable( pDocSh ); - if( pMacTable && pMacTable->Count() ) - HTMLOutFuncs::Out_Events( Strm(), *pMacTable, aBodyEventTable, + if( pDocTable && pDocTable->Count() ) + HTMLOutFuncs::Out_Events( Strm(), *pDocTable, aBodyEventTable, bCfgStarBasic, eDestEnc, &aNonConvertableCharacters ); } diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index b6ad8bc1d4cb..d18a2b762aa0 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -53,7 +53,7 @@ #include <svtools/imap.hxx> #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> - +#include <svtools/eventcfg.hxx> #include <fmtornt.hxx> #include <fmturl.hxx> @@ -841,7 +841,7 @@ void SwHTMLParser::InsertBodyOptions() { const HTMLOption *pOption = (*pHTMLOptions)[--i]; ScriptType eScriptType2 = eDfltScriptType; - USHORT nEvent = 0; + rtl::OUString aEvent; BOOL bSetEvent = FALSE; switch( pOption->GetToken() ) @@ -872,28 +872,28 @@ void SwHTMLParser::InsertBodyOptions() case HTML_O_SDONLOAD: eScriptType2 = STARBASIC; case HTML_O_ONLOAD: - nEvent = SFX_EVENT_OPENDOC; + aEvent = GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC ); bSetEvent = TRUE; break; case HTML_O_SDONUNLOAD: eScriptType2 = STARBASIC; case HTML_O_ONUNLOAD: - nEvent = SFX_EVENT_PREPARECLOSEDOC; + aEvent = GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEDOC ); bSetEvent = TRUE; break; case HTML_O_SDONFOCUS: eScriptType2 = STARBASIC; case HTML_O_ONFOCUS: - nEvent = SFX_EVENT_ACTIVATEDOC; + aEvent = GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ); bSetEvent = TRUE; break; case HTML_O_SDONBLUR: eScriptType2 = STARBASIC; case HTML_O_ONBLUR: - nEvent = SFX_EVENT_DEACTIVATEDOC; + aEvent = GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC ); bSetEvent = TRUE; break; @@ -919,7 +919,7 @@ void SwHTMLParser::InsertBodyOptions() { const String& rEvent = pOption->GetString(); if( rEvent.Len() ) - InsertBasicDocEvent( nEvent, rEvent, eScriptType2, + InsertBasicDocEvent( aEvent, rEvent, eScriptType2, sDfltScriptType ); } } diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index 45349e626032..61dfb82fc040 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -782,7 +782,7 @@ private: void AddScriptSource(); // ein Event in die SFX-Konfiguation eintragen (htmlbas.cxx) - void InsertBasicDocEvent( sal_uInt16 nEvent, const String& rName, + void InsertBasicDocEvent( rtl::OUString aEventName, const String& rName, ScriptType eScrType, const String& rScrType ); // ein Event an ein VC-Control anhaengen (htmlform.cxx) diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index dd5ecb185c2d..06289c10f38a 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -1083,15 +1083,10 @@ void SwDocShell::GetState(SfxItemSet& rSet) break; case SID_SOURCEVIEW: { - if(IsLoading()) - rSet.DisableItem(nWhich); - else - { - SfxViewShell* pCurrView = GetView() ? (SfxViewShell*)GetView() - : SfxViewShell::Current(); - BOOL bSourceView = 0 != PTR_CAST(SwSrcView, pCurrView); - rSet.Put(SfxBoolItem(SID_SOURCEVIEW, bSourceView)); - } + SfxViewShell* pCurrView = GetView() ? (SfxViewShell*)GetView() + : SfxViewShell::Current(); + BOOL bSourceView = 0 != PTR_CAST(SwSrcView, pCurrView); + rSet.Put(SfxBoolItem(SID_SOURCEVIEW, bSourceView)); } break; case SID_HTML_MODE: @@ -1116,18 +1111,10 @@ void SwDocShell::GetState(SfxItemSet& rSet) case SID_BROWSER_MODE: case FN_PRINT_LAYOUT: { - SfxViewShell* pViewShell = SfxViewShell::Current(); - BOOL bDisable = 0 != PTR_CAST(SwPagePreView, pViewShell) || - 0 != PTR_CAST(SwSrcView, pViewShell); - if (bDisable) - rSet.DisableItem( nWhich ); - else - { - sal_Bool bState = GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE); - if(FN_PRINT_LAYOUT == nWhich) - bState = !bState; - rSet.Put( SfxBoolItem( nWhich, bState)); - } + sal_Bool bState = GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE); + if(FN_PRINT_LAYOUT == nWhich) + bState = !bState; + rSet.Put( SfxBoolItem( nWhich, bState)); } break; @@ -1337,44 +1324,42 @@ uno::Reference< frame::XController > /* -----------------------------12.02.01 12:08-------------------------------- ---------------------------------------------------------------------------*/ +static const char* pEventNames[] = +{ + "OnPageCountChange", + "OnMailMerge", + "OnMailMergeFinished", + "OnFieldMerge", + "OnFieldMergeFinished", + "OnLayoutFinished" +}; + Sequence< OUString > SwDocShell::GetEventNames() { Sequence< OUString > aRet = SfxObjectShell::GetEventNames(); sal_Int32 nLen = aRet.getLength(); - aRet.realloc(nLen + 2); + aRet.realloc(nLen + 6); OUString* pNames = aRet.getArray(); - pNames[nLen++] = OUString::createFromAscii("OnMailMerge"); - pNames[nLen] = OUString::createFromAscii("OnPageCountChange"); + pNames[nLen++] = GetEventName(0); + pNames[nLen++] = GetEventName(1); + pNames[nLen++] = GetEventName(2); + pNames[nLen++] = GetEventName(3); + pNames[nLen++] = GetEventName(4); + pNames[nLen] = GetEventName(5); + return aRet; } -/* -void SwTmpPersist::FillClass( SvGlobalName * pClassName, - ULONG * pClipFormat, - String * pAppName, - String * pLongUserName, - String * pUserName, - sal_Int32 nFileFormat ) const -{ - pDShell->SwDocShell::FillClass( pClassName, pClipFormat, pAppName, - pLongUserName, pUserName, nFileFormat ); -} -BOOL SwTmpPersist::Save() -{ - if( SaveChilds() ) - return SvPersist::Save(); - return FALSE; -} +static sal_Int32 nEvents=13; -BOOL SwTmpPersist::SaveCompleted( SvStorage * pStor ) +rtl::OUString SwDocShell::GetEventName( sal_Int32 nIndex ) { - if( SaveCompletedChilds( pStor ) ) - return SvPersist::SaveCompleted( pStor ); - return FALSE; -} */ + if ( nIndex<nEvents ) + return ::rtl::OUString::createFromAscii(pEventNames[nIndex]); + return rtl::OUString(); +} const ::sfx2::IXmlIdRegistry* SwDocShell::GetXmlIdRegistry() const { return pDoc ? &pDoc->GetXmlIdRegistry() : 0; } - diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 182bda09d7b8..3fd1e879b063 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -943,10 +943,10 @@ void SwDocShell::Execute(SfxRequest& rReq) bDone = TRUE; SfxEventConfiguration* pEvent = SFX_APP()->GetEventConfig(); SvxMacro aMac(aEmptyStr, aEmptyStr, STARBASIC); - pEvent->ConfigureEvent(SFX_EVENT_OPENDOC, aMac, this); - pEvent->ConfigureEvent(SFX_EVENT_CLOSEDOC, aMac, this); - pEvent->ConfigureEvent(SFX_EVENT_ACTIVATEDOC, aMac, this); - pEvent->ConfigureEvent(SFX_EVENT_DEACTIVATEDOC, aMac, this); + pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC ), aMac, this); + pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEDOC ), aMac, this); + pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), aMac, this); + pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC ), aMac, this); ReloadFromHtml(aTempFile.GetURL(), pSrcView); nSlot = 0; } @@ -983,6 +983,8 @@ void SwDocShell::Execute(SfxRequest& rReq) //pSavePrinter darf nicht wieder geloescht werden } pViewFrm->GetBindings().SetState(SfxBoolItem(SID_SOURCEVIEW, nSlot == SID_VIEWSHELL2)); + pViewFrm->GetBindings().Invalidate( SID_BROWSER_MODE ); + pViewFrm->GetBindings().Invalidate( FN_PRINT_LAYOUT ); } break; case SID_GET_COLORTABLE: @@ -1780,7 +1782,10 @@ void SwDocShell::ToggleBrowserMode(BOOL bSet, SwView* _pView ) SwView* pTempView = _pView ? _pView : (SwView*)GetView(); if( pTempView ) { - pTempView->GetViewFrame()->GetBindings().Invalidate(FN_SHADOWCURSOR); + SfxBindings& rBind = pTempView->GetViewFrame()->GetBindings(); + rBind.Invalidate(FN_SHADOWCURSOR); + rBind.Invalidate(SID_BROWSER_MODE); + rBind.Invalidate(FN_PRINT_LAYOUT); if( !GetDoc()->getPrinter( false ) ) { @@ -1793,8 +1798,8 @@ void SwDocShell::ToggleBrowserMode(BOOL bSet, SwView* _pView ) GetDoc()->CheckDefaultPageFmt(); // <-- - //Wenn wir die BrowseView einschalten, darf es nur diese eine - //Sicht auf das Dokument geben, alle anderen werden geschlossen. + // Currently there can be only one view (layout) if the document is viewed in Web layout + // So if there are more views we are in print layout and for toggling to Web layout all other views must be closed SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, 0, FALSE); do { if( pTmpFrm != pTempView->GetViewFrame() ) diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx index 694c2514ef93..c84273770667 100644 --- a/sw/source/ui/app/swmodule.cxx +++ b/sw/source/ui/app/swmodule.cxx @@ -221,11 +221,6 @@ SwModule::SwModule( SfxObjectFactory* pWebFact, ERRCODE_AREA_SW_END, pSwResMgr ); - SfxEventConfiguration::RegisterEvent(SW_EVENT_MAIL_MERGE, SW_RES(STR_PRINT_MERGE_MACRO), String::CreateFromAscii("OnMailMerge")); - SfxEventConfiguration::RegisterEvent(SW_EVENT_MAIL_MERGE_END, SW_RES(STR_PRINT_MERGE_MACRO), String::CreateFromAscii("OnMailMergeFinished")); - SfxEventConfiguration::RegisterEvent(SW_EVENT_FIELD_MERGE, String(), String::CreateFromAscii("OnFieldMerge")); - SfxEventConfiguration::RegisterEvent(SW_EVENT_FIELD_MERGE_FINISHED, String(), String::CreateFromAscii("OnFieldMergeFinished")); - SfxEventConfiguration::RegisterEvent(SW_EVENT_PAGE_COUNT, SW_RES(STR_PAGE_COUNT_MACRO), String::CreateFromAscii("OnPageCountChange")); pModuleConfig = new SwModuleOptions; //Die brauchen wie sowieso diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 202df0a8e027..603af1c31111 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -932,9 +932,9 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, do { nStartRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0; { - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, pSh->GetView().GetViewFrame()->GetObjectShell())); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), pSh->GetView().GetViewFrame()->GetObjectShell())); pSh->ViewShell::UpdateFlds(); - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, pSh->GetView().GetViewFrame()->GetObjectShell())); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE_FINISHED), pSh->GetView().GetViewFrame()->GetObjectShell())); ++rOpt.nMergeAct; // launch MailMergeEvent if required @@ -1455,9 +1455,9 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, SwDoc* pWorkDoc = ((SwDocShell*)(&xWorkDocSh))->GetDoc(); SwNewDBMgr* pOldDBMgr = pWorkDoc->GetNewDBMgr(); pWorkDoc->SetNewDBMgr( this ); - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, xWorkDocSh)); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), xWorkDocSh)); pWorkDoc->UpdateFlds(NULL, false); - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, xWorkDocSh)); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE_FINISHED), xWorkDocSh)); // alle versteckten Felder/Bereiche entfernen pWorkDoc->RemoveInvisibleContent(); @@ -2858,7 +2858,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh, aDescriptor[daCursor] <<= xResSet; SfxObjectShellRef xDocShell = rSh.GetView().GetViewFrame()->GetObjectShell(); - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, xDocShell)); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xDocShell)); { //copy rSh to aTempFile ::rtl::OUString sTempURL; @@ -2924,7 +2924,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh, //remove the temporary file SWUnoHelper::UCB_DeleteFile( sTempURL ); } - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, rSh.GetView().GetViewFrame()->GetObjectShell())); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), rSh.GetView().GetViewFrame()->GetObjectShell())); // reset the cursor inside xResSet = NULL; @@ -3260,9 +3260,9 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, // create a layout rWorkShell.CalcLayout(); rWorkShell.UnlockExpFlds(); - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, rWorkShell.GetView().GetViewFrame()->GetObjectShell())); - rWorkShell.ViewShell::UpdateFlds(); - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, rWorkShell.GetView().GetViewFrame()->GetObjectShell())); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), rWorkShell.GetView().GetViewFrame()->GetObjectShell())); + rWorkShell.ViewShell::UpdateFlds(); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE_FINISHED), rWorkShell.GetView().GetViewFrame()->GetObjectShell())); // strip invisible content and convert fields to text rWorkShell.RemoveInvisibleContent(); diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 72fc1e122a8e..eb1f75d57979 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -1000,14 +1000,14 @@ IMPL_LINK(SwMailMergeOutputPage, PrintHdl_Impl, PushButton*, EMPTYARG) } SfxObjectShell* pObjSh = pTargetView->GetViewFrame()->GetObjectShell(); - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, pObjSh)); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), pObjSh)); rSh.GetNewDBMgr()->SetMergeType( DBMGR_MERGE_DOCUMENTS ); SfxDispatcher *pDis = pTargetView->GetViewFrame()->GetDispatcher(); SfxBoolItem aMergeSilent(SID_SILENT, sal_False); m_pWizard->enableButtons(WZB_CANCEL, sal_False); pDis->Execute(SID_PRINTDOCDIRECT, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aMergeSilent, 0L); - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, pObjSh)); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), pObjSh)); pTargetView->SetMailMergeConfigItem(0, 0, sal_False); m_pWizard->enableButtons(WZB_CANCEL, sal_True); diff --git a/sw/source/ui/docvw/srcedtw.cxx b/sw/source/ui/docvw/srcedtw.cxx index 85036cad7130..19ba5aefdf25 100644 --- a/sw/source/ui/docvw/srcedtw.cxx +++ b/sw/source/ui/docvw/srcedtw.cxx @@ -395,8 +395,10 @@ void TextViewOutWin::MouseButtonUp( const MouseEvent &rEvt ) if ( pTextView ) { pTextView->MouseButtonUp( rEvt ); - ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()-> - GetBindings().Invalidate( SID_TABLE_CELL ); + SfxBindings& rBindings = ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->GetBindings(); + rBindings.Invalidate( SID_TABLE_CELL ); + rBindings.Invalidate( SID_CUT ); + rBindings.Invalidate( SID_COPY ); } } @@ -459,6 +461,7 @@ void TextViewOutWin::KeyInput( const KeyEvent& rKEvt ) if(bChange) bDone = pTextView->KeyInput( rKEvt ); + SfxBindings& rBindings = ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->GetBindings(); if ( !bDone ) { if ( !SfxViewShell::Current()->KeyInput( rKEvt ) ) @@ -466,7 +469,6 @@ void TextViewOutWin::KeyInput( const KeyEvent& rKEvt ) } else { - SfxBindings& rBindings = ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->GetBindings(); rBindings.Invalidate( SID_TABLE_CELL ); if ( rKEvt.GetKeyCode().GetGroup() == KEYGROUP_CURSOR ) rBindings.Update( SID_BASICIDE_STAT_POS ); @@ -478,6 +480,10 @@ void TextViewOutWin::KeyInput( const KeyEvent& rKEvt ) if( rKEvt.GetKeyCode().GetCode() == KEY_INSERT ) rBindings.Invalidate( SID_ATTR_INSERT ); } + + rBindings.Invalidate( SID_CUT ); + rBindings.Invalidate( SID_COPY ); + SwDocShell* pDocShell = pSrcEditWin->GetSrcView()->GetDocShell(); if(pSrcEditWin->GetTextEngine()->IsModified()) { diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx index 5656f6df1ab4..3c526c11d193 100644 --- a/sw/source/ui/inc/wrtsh.hxx +++ b/sw/source/ui/inc/wrtsh.hxx @@ -165,6 +165,8 @@ public: // Selektion von Rahmen aufheben void UnSelectFrm(); + void Invalidate(); + // Tabellenzellen selektieren fuer Bearbeiten von Formeln in der Ribbonbar inline void SelTblCells( const Link &rLink, BOOL bMark = TRUE ); inline void EndSelTblCells(); diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 9bfc00b21660..1a34e2972956 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -799,16 +799,18 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq) switch (nSlot) { case SID_CUT: - pOLV->Cut(); + if ( (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED) && pOLV->HasSelection() ) + pOLV->Cut(); break; case SID_COPY: - pOLV->Copy(); + if( pOLV->HasSelection() ) + pOLV->Copy(); break; case SID_PASTE: if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED) pOLV->Paste(); break; - case FN_PASTESPECIAL: + case SID_PASTE_SPECIAL: { if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED) { @@ -886,7 +888,7 @@ void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet) break; } case SID_PASTE: - case FN_PASTESPECIAL: + case SID_PASTE_SPECIAL: { if( !bPastePossible ) rSet.DisableItem( nWhich ); @@ -1380,6 +1382,8 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq) } } + rView.GetViewFrame()->GetBindings().InvalidateAll(sal_False); + if (rView.GetPostItMgr()->GetActivePostIt()) rView.GetPostItMgr()->GetActivePostIt()->ResizeIfNeccessary(aOldHeight,rView.GetPostItMgr()->GetActivePostIt()->GetPostItTextHeight()); } diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index 0c17c85dd301..9f5ee6195e81 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -301,11 +301,9 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq) if ( rSh.HasSelection() ) { SwTransferable* pTransfer = new SwTransferable( rSh ); -/*??*/ uno::Reference< - datatransfer::XTransferable > xRef( - pTransfer ); +/*??*/ uno::Reference< datatransfer::XTransferable > xRef( pTransfer ); - if ( nId == SID_CUT ) + if ( nId == SID_CUT && !rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT) ) pTransfer->Cut(); else { @@ -405,7 +403,7 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq) } break; - case FN_PASTESPECIAL: + case SID_PASTE_SPECIAL: { TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( @@ -481,10 +479,10 @@ void SwBaseShell::StateClpbrd(SfxItemSet &rSet) rSet.DisableItem( SID_PASTE ); break; - case FN_PASTESPECIAL: + case SID_PASTE_SPECIAL: if( !GetView().IsPasteSpecialAllowed() ) { - rSet.DisableItem( FN_PASTESPECIAL ); + rSet.DisableItem( SID_PASTE_SPECIAL ); rSet.DisableItem( SID_PASTE_UNFORMATTED ); } break; @@ -539,6 +537,8 @@ void SwBaseShell::ExecUndo(SfxRequest &rReq) default: DBG_ERROR("falscher Dispatcher"); } + + GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False); } /*-------------------------------------------------------------------- diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index d56cb88e9db8..11874ca5b151 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -828,15 +828,20 @@ void SwDrawTextShell::ExecClpbrd(SfxRequest &rReq) return; OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); + + ESelection aSel(pOLV->GetSelection()); + const sal_Bool bCopy = (aSel.nStartPara != aSel.nEndPara) || (aSel.nStartPos != aSel.nEndPos); sal_uInt16 nId = rReq.GetSlot(); switch( nId ) { case SID_CUT: - pOLV->Cut(); + if (bCopy) + pOLV->Cut(); return; case SID_COPY: - pOLV->Copy(); + if (bCopy) + pOLV->Copy(); return; case SID_PASTE: @@ -888,8 +893,8 @@ void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet) } break; - case FN_PASTESPECIAL: - rSet.DisableItem( FN_PASTESPECIAL ); + case SID_PASTE_SPECIAL: + rSet.DisableItem( SID_PASTE_SPECIAL ); break; // --> OD 2008-06-20 #151110# case SID_CLIPBOARD_FORMAT_ITEMS: diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index 85b9fa48447b..9f1d49ebe067 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -640,6 +640,7 @@ void SwDrawTextShell::ExecUndo(SfxRequest &rReq) pUndoManager->Redo(0); } bCallBase = FALSE; + GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False); } break; } diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index bd1a00c2f120..93ae56fbca73 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -1580,6 +1580,10 @@ void SwPagePreView::GetState( SfxItemSet& rSet ) { switch(nWhich) { + case SID_BROWSER_MODE: + case FN_PRINT_LAYOUT: + rSet.DisableItem(nWhich); + break; case FN_START_OF_DOCUMENT: { if ( pPagePrevwLay->IsPageVisible( 1 ) ) @@ -2491,6 +2495,10 @@ SfxPrinter* SwPagePreView::GetPrinter( BOOL bCreate ) USHORT SwPagePreView::SetPrinter( SfxPrinter *pNew, USHORT nDiffFlags, bool ) { ViewShell &rSh = *GetViewShell(); + SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false ); + if ( pOld && pOld->IsPrinting() ) + return SFX_PRINTERROR_BUSY; + SwEditShell &rESh = (SwEditShell&)rSh; //Buh... if( ( SFX_PRINTER_PRINTER | SFX_PRINTER_JOBSETUP ) & nDiffFlags ) { diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 34cfebe663a1..d30e85c5ee71 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -57,6 +57,7 @@ #include <sfx2/app.hxx> #include <sfx2/objface.hxx> #include <sfx2/viewfrm.hxx> +#include <sfx2/bindings.hxx> #include <sfx2/docfilt.hxx> #include <sfx2/fcontnr.hxx> #include <sfx2/request.hxx> @@ -457,17 +458,21 @@ void SwSrcView::Execute(SfxRequest& rReq) break; case SID_UNDO: pTextView->Undo(); + GetViewFrame()->GetBindings().InvalidateAll(FALSE); break; case SID_REDO: pTextView->Redo(); + GetViewFrame()->GetBindings().InvalidateAll(FALSE); break; case SID_REPEAT: break; case SID_CUT: - pTextView->Cut(); + if(pTextView->HasSelection()) + pTextView->Cut(); break; case SID_COPY: - pTextView->Copy(); + if(pTextView->HasSelection()) + pTextView->Copy(); break; case SID_PASTE: pTextView->Paste(); @@ -588,6 +593,8 @@ void SwSrcView::GetState(SfxItemSet& rSet) case SID_DIRECTEXPORTDOCASPDF: case SID_EXPORTDOC: case SID_REPEAT: + case SID_BROWSER_MODE: + case FN_PRINT_LAYOUT: rSet.DisableItem(nWhich); break; case SID_CUT: @@ -731,6 +738,10 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, USHORT SwSrcView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) { SwDocShell* pDocSh = GetDocShell(); + SfxPrinter* pOld = pDocSh->GetDoc()->getPrinter( false ); + if ( pOld && pOld->IsPrinting() ) + return SFX_PRINTERROR_BUSY; + if ( (SFX_PRINTER_JOBSETUP | SFX_PRINTER_PRINTER) & nDiffFlags ) { pDocSh->GetDoc()->setPrinter( pNew, true, true ); diff --git a/sw/source/ui/uiview/uivwimp.cxx b/sw/source/ui/uiview/uivwimp.cxx index d9634fc301ec..4154139f6ee1 100644 --- a/sw/source/ui/uiview/uivwimp.cxx +++ b/sw/source/ui/uiview/uivwimp.cxx @@ -335,48 +335,14 @@ void SAL_CALL SwClipboardChangeListener::changedContents( const CLIP_NMSPC::Clip SfxBindings& rBind = pView->GetViewFrame()->GetBindings(); rBind.Invalidate( SID_PASTE ); - rBind.Invalidate( FN_PASTESPECIAL ); + rBind.Invalidate( SID_PASTE_SPECIAL ); rBind.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS ); } } void SwClipboardChangeListener::AddRemoveListener( BOOL bAdd ) { - try - { - do { - -#ifdef _DONT_WORD_FOR_WEBTOP_ -JP 4.7.2001: change for WebTop - get Clipboard from the Window. - Reference< XMultiServiceFactory > xFact( - ::comphelper::getProcessServiceFactory() ); - if( !xFact.is() ) - break; - Reference< XClipboard > xClipboard( xFact->createInstance( - ::rtl::OUString::createFromAscii( - "com.sun.star.datatransfer.clipboard.SystemClipboard" )), - UNO_QUERY ); -#else - Reference< XClipboard > xClipboard( - pView->GetEditWin().GetClipboard() ); -#endif - if( !xClipboard.is() ) - break; - - Reference< XClipboardNotifier > xClpbrdNtfr( xClipboard, UNO_QUERY ); - if( xClpbrdNtfr.is() ) - { - Reference< XClipboardListener > xClipEvtLstnr( this ); - if( bAdd ) - xClpbrdNtfr->addClipboardListener( xClipEvtLstnr ); - else - xClpbrdNtfr->removeClipboardListener( xClipEvtLstnr ); - } - } while ( FALSE ); - } - catch( const uno::Exception& ) - { - } + pView->AddRemoveClipboardListener( Reference< XClipboardListener >( this ), bAdd ); } diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index 6678275cd865..a13f25d8933e 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -624,7 +624,7 @@ void SwView::_CheckReadonlyState() SID_UNDO, SID_REDO, SID_REPEAT, SID_PASTE, SID_PASTE_UNFORMATTED, - FN_PASTESPECIAL, SID_SBA_BRW_INSERT, + SID_PASTE_SPECIAL, SID_SBA_BRW_INSERT, SID_BACKGROUND_COLOR, FN_INSERT_BOOKMARK, SID_CHARMAP, FN_INSERT_SOFT_HYPHEN, FN_INSERT_HARDHYPHEN, FN_INSERT_HARD_SPACE, FN_INSERT_BREAK, diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 6a03909d92f9..77c06f44c494 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -1233,7 +1233,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) if (nPageCnt != nCnt) // Basic benachrichtigen { nPageCnt = nCnt; - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_PAGE_COUNT, GetViewFrame()->GetObjectShell()), FALSE); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_PAGE_COUNT, SwDocShell::GetEventName(STR_SW_EVENT_PAGE_COUNT), GetViewFrame()->GetObjectShell()), FALSE); } } break; diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index 6d219e71ab30..5e45f9a9a48c 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -141,6 +141,10 @@ void SetPrinter( IDocumentDeviceAccess* pIDDA, SfxPrinter* pNew, BOOL bWeb ) USHORT __EXPORT SwView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) { SwWrtShell &rSh = GetWrtShell(); + SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false ); + if ( pOld && pOld->IsPrinting() ) + return SFX_PRINTERROR_BUSY; + if ( (SFX_PRINTER_JOBSETUP | SFX_PRINTER_PRINTER) & nDiffFlags ) { rSh.getIDocumentDeviceAccess()->setPrinter( pNew, true, true ); @@ -431,9 +435,19 @@ ErrCode SwView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilent, } pProgress->Stop(); - pProgress->DeleteOnEndPrint(); - pPrinter->EndJob(); - return pPrinter->GetError(); + if ( pPrinter->IsJobActive() ) + { + pProgress->DeleteOnEndPrint(); + pPrinter->EndJob(); + return pPrinter->GetError(); + } + else + { + // the next call might destroy pPrinter (in case it is not the usual document printer); so get the error before + ULONG nError = pPrinter->GetError(); + pProgress->DeleteOnEndPrint(); + return nError; + } } diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx index 3acb1e25bd31..fed4c2b201cf 100644 --- a/sw/source/ui/uno/unomailmerge.cxx +++ b/sw/source/ui/uno/unomailmerge.cxx @@ -830,9 +830,9 @@ uno::Any SAL_CALL SwXMailMerge::execute( DBG_ASSERT( !pOldSrc || pOldSrc == this, "Ooops... different event source already set." ); pMgr->SetMailMergeEvtSrc( this ); // launch events for listeners - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, xCurDocSh)); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xCurDocSh)); BOOL bSucc = pMgr->MergeNew( aMergeDesc ); - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, xCurDocSh)); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), xCurDocSh)); pMgr->SetMailMergeEvtSrc( pOldSrc ); diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx index 89b0635815d6..b46cbdb3a1a5 100644 --- a/sw/source/ui/wrtsh/select.cxx +++ b/sw/source/ui/wrtsh/select.cxx @@ -73,6 +73,13 @@ using namespace ::com::sun::star::util; static long nStartDragX = 0, nStartDragY = 0; static BOOL bStartDrag = FALSE; +void SwWrtShell::Invalidate() +{ + // to avoid making the slot volatile, invalidate it everytime if something could have been changed + // this is still much cheaper than asking for the state every 200 ms (and avoid background processing) + GetView().GetViewFrame()->GetBindings().Invalidate( FN_STAT_SELMODE ); +} + BOOL SwWrtShell::SelNearestWrd() { MV_KONTEXT(this); @@ -375,6 +382,7 @@ long SwWrtShell::ResetSelect(const Point *,BOOL) */ GetChgLnk().Call(this); } + Invalidate(); SwTransferable::ClearSelection( *this ); return 1; } @@ -409,6 +417,7 @@ void SwWrtShell::SttSelect() fnKillSel = &SwWrtShell::Ignore; fnSetCrsr = &SwWrtShell::SetCrsr; bInSelect = TRUE; + Invalidate(); SwTransferable::CreateSelection( *this ); } /* @@ -577,6 +586,7 @@ void SwWrtShell::EnterStdMode() fnKillSel = &SwWrtShell::ResetSelect; } } + Invalidate(); SwTransferable::ClearSelection( *this ); } @@ -655,6 +665,7 @@ void SwWrtShell::EnterAddMode() bExtMode = FALSE; if(SwCrsrShell::HasSelection()) CreateCrsr(); + Invalidate(); } @@ -665,6 +676,7 @@ void SwWrtShell::LeaveAddMode() fnKillSel = &SwWrtShell::ResetSelect; fnSetCrsr = &SwWrtShell::SetCrsrKillSel; bAddMode = FALSE; + Invalidate(); } /* @@ -677,6 +689,7 @@ void SwWrtShell::EnterBlockMode() EnterStdMode(); bBlockMode = TRUE; CrsrToBlockCrsr(); + Invalidate(); } @@ -686,6 +699,7 @@ void SwWrtShell::LeaveBlockMode() bBlockMode = FALSE; BlockCrsrToCrsr(); EndSelect(); + Invalidate(); } // Einfuegemodus @@ -700,6 +714,7 @@ void SwWrtShell::SetInsMode( BOOL bOn ) GetView().GetViewFrame()->GetBindings().SetState( aTmp ); StartAction(); EndAction(); + Invalidate(); } //Overwrite mode is incompatible with red-lining void SwWrtShell::SetRedlineModeAndCheckInsMode( USHORT eMode ) @@ -744,6 +759,7 @@ void SwWrtShell::EnterSelFrmMode(const Point *pPos) fnDrag = &SwWrtShell::BeginFrmDrag; fnEndDrag = &SwWrtShell::UpdateLayoutFrm; SwBaseShell::SetFrmMode( FLY_DRAG_START, this ); + Invalidate(); } @@ -756,6 +772,7 @@ void SwWrtShell::LeaveSelFrmMode() bStartDrag = FALSE; Edit(); SwBaseShell::SetFrmMode( FLY_DRAG_END, this ); + Invalidate(); } /*------------------------------------------------------------------------ Beschreibung: Rahmengebundenes Macro ausfuehren @@ -799,6 +816,7 @@ long SwWrtShell::UpdateLayoutFrm(const Point *pPt, BOOL ) long SwWrtShell::ToggleAddMode() { bAddMode ? LeaveAddMode(): EnterAddMode(); + Invalidate(); return !bAddMode; } @@ -806,6 +824,7 @@ long SwWrtShell::ToggleAddMode() long SwWrtShell::ToggleBlockMode() { bBlockMode ? LeaveBlockMode(): EnterBlockMode(); + Invalidate(); return !bBlockMode; } @@ -813,6 +832,7 @@ long SwWrtShell::ToggleBlockMode() long SwWrtShell::ToggleExtMode() { bExtMode ? LeaveExtMode() : EnterExtMode(); + Invalidate(); return !bExtMode; } /* |