summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/appl/app.cxx6
-rw-r--r--sfx2/source/appl/app.hrc91
-rw-r--r--sfx2/source/appl/app.src470
-rw-r--r--sfx2/source/appl/appbas.cxx176
-rw-r--r--sfx2/source/appl/appcfg.cxx20
-rw-r--r--sfx2/source/appl/appdata.cxx2
-rw-r--r--sfx2/source/appl/appdde.cxx5
-rw-r--r--sfx2/source/appl/appinit.cxx5
-rw-r--r--sfx2/source/appl/appquit.cxx4
-rw-r--r--sfx2/source/appl/appserv.cxx8
-rw-r--r--sfx2/source/appl/appuno.cxx105
-rw-r--r--sfx2/source/bastyp/fltfnc.cxx48
-rw-r--r--sfx2/source/config/evntconf.cxx2
-rw-r--r--sfx2/source/control/bindings.cxx11
-rwxr-xr-xsfx2/source/control/dispatch.cxx71
-rw-r--r--sfx2/source/control/macrconf.cxx874
-rw-r--r--sfx2/source/control/msgpool.cxx1
-rw-r--r--sfx2/source/control/shell.cxx26
-rw-r--r--sfx2/source/doc/doc.hrc5
-rw-r--r--sfx2/source/doc/doc.src13
-rw-r--r--sfx2/source/doc/doctemplates.cxx28
-rwxr-xr-xsfx2/source/doc/docundomanager.cxx457
-rw-r--r--sfx2/source/doc/guisaveas.cxx2
-rw-r--r--sfx2/source/doc/objmisc.cxx184
-rw-r--r--sfx2/source/doc/objserv.cxx7
-rw-r--r--sfx2/source/doc/objstor.cxx2
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx109
-rw-r--r--sfx2/source/inc/appdata.hxx2
-rwxr-xr-xsfx2/source/inc/docundomanager.hxx116
-rw-r--r--sfx2/source/inc/eventsupplier.hxx13
-rw-r--r--sfx2/source/inc/sfxurlrelocator.hxx5
-rw-r--r--sfx2/source/menu/mnuitem.cxx3
-rwxr-xr-xsfx2/source/menu/mnumgr.cxx1
-rw-r--r--sfx2/source/menu/virtmenu.cxx19
-rw-r--r--sfx2/source/notify/eventsupplier.cxx130
-rw-r--r--sfx2/source/toolbox/tbxitem.cxx1
-rw-r--r--sfx2/source/view/viewfrm.cxx24
37 files changed, 848 insertions, 2198 deletions
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index eb9307ad7538..303586762ac2 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -41,6 +41,8 @@
#include <tools/simplerm.hxx>
#include <tools/config.hxx>
#include <basic/basrdll.hxx>
+#include <basic/sbmeth.hxx>
+#include <basic/sbmod.hxx>
#include <svtools/asynclink.hxx>
#include <svl/stritem.hxx>
#include <vcl/sound.hxx>
@@ -831,3 +833,7 @@ void SfxApplication::MacroOrganizer( INT16 nTabId )
pSymbol( nTabId );
}
+ErrCode SfxApplication::CallBasic( const String& rCode, BasicManager* pMgr, SbxArray* pArgs, SbxValue* pRet )
+{
+ return pMgr->ExecuteMacro( rCode, pArgs, pRet);
+}
diff --git a/sfx2/source/appl/app.hrc b/sfx2/source/appl/app.hrc
index dca172269443..ff01fd358d4d 100644
--- a/sfx2/source/appl/app.hrc
+++ b/sfx2/source/appl/app.hrc
@@ -32,11 +32,6 @@
// #defines *****************************************************************
#define ACC_IBM (RID_SFX_APP_START+2)
-#define MSG_ERR_WRITE_CFG (RID_SFX_APP_START+2)
-#define MSG_ERR_READ_CFG (RID_SFX_APP_START+3)
-#define MSG_ERR_OPEN_CFG (RID_SFX_APP_START+4)
-#define MSG_ERR_FILETYPE_CFG (RID_SFX_APP_START+5)
-#define MSG_ERR_VERSION_CFG (RID_SFX_APP_START+6)
#define MSG_ERR_NO_WEBBROWSER_FOUND (RID_SFX_APP_START+7)
// Note: no longer in use
@@ -45,101 +40,22 @@
#define MSG_ISPRINTING_QUERYABORT (RID_SFX_APP_START+9)
#define MSG_CANT_QUIT (RID_SFX_APP_START+10)
#define STR_ISMODIFIED (RID_SFX_APP_START+11)
-#define STR_AUTOSAVE (RID_SFX_APP_START+12)
-#define STR_MAIL (RID_SFX_APP_START+13)
-#define MSG_ERR_WRITE_SBL (RID_SFX_APP_START+14)
-#define MSG_IS_SERVER (RID_SFX_APP_START+15)
-
-#define STR_RESEXCEPTION (RID_SFX_APP_START+21)
-#define STR_SYSRESEXCEPTION (RID_SFX_APP_START+22)
-#define STR_DOUBLEEXCEPTION (RID_SFX_APP_START+23)
-#define STR_RESWARNING (RID_SFX_APP_START+24)
-#define STR_ERR_NOTEMPLATE (RID_SFX_APP_START+27)
-#define STR_RECOVER_TITLE (RID_SFX_APP_START+28)
-#define STR_RECOVER_QUERY (RID_SFX_APP_START+29)
-#define STR_RECOVER_PREPARED (RID_SFX_APP_START+30)
-#define MSG_ERR_SOINIT (RID_SFX_APP_START+31)
-
-#define MSG_IOERR_FILE_NOT_FOUND (RID_SFX_APP_START+32)
-#define MSG_IOERR_PATH_NOT_FOUND (RID_SFX_APP_START+33)
-#define MSG_IOERR_TOO_MANY_OPEN_FILES (RID_SFX_APP_START+34)
-#define MSG_IOERR_ACCESS_DENIED (RID_SFX_APP_START+35)
-#define MSG_IOERR_INVALID_ACCESS (RID_SFX_APP_START+36)
-#define MSG_IOERR_INVALID_HANDLE (RID_SFX_APP_START+37)
-#define MSG_IOERR_CANNOT_MAKE (RID_SFX_APP_START+38)
-#define MSG_IOERR_SHARING (RID_SFX_APP_START+39)
-#define MSG_IOERR_INVALID_PARAMETER (RID_SFX_APP_START+40)
-#define MSG_IOERR_GENERAL (RID_SFX_APP_START+41)
#define RID_FULLSCREENTOOLBOX (RID_SFX_APP_START+42)
#define RID_RECORDINGTOOLBOX (RID_SFX_APP_START+43)
#define RID_ENVTOOLBOX (RID_SFX_APP_START+44)
#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_ADDRESS_NAME (RID_SFX_APP_START+65)
#define RID_STR_HLPFILENOTEXIST (RID_SFX_APP_START+68)
-#define RID_STR_HLPAPPNOTSTARTED (RID_SFX_APP_START+69)
-
-#define STR_NODOUBLE (RID_SFX_APP_START+75)
-#define STR_NOPRINTER (RID_SFX_APP_START+76)
-
-#define MSG_SIGNAL (RID_SFX_APP_START+77)
#define RID_STR_HELP (RID_SFX_APP_START+79)
#define RID_STR_NOAUTOSTARTHELPAGENT (RID_SFX_APP_START+80)
#define RID_HELPBAR (RID_SFX_APP_START+81)
#define RID_SPECIALCONFIG_ERROR (RID_SFX_APP_START+82)
-#define STR_MEMINFO_HEADER (RID_SFX_APP_START+84)
-#define STR_MEMINFO_FOOTER (RID_SFX_APP_START+85)
-#define STR_MEMINFO_OBJINFO (RID_SFX_APP_START+86)
-
-#define RID_PLUGIN (RID_SFX_APP_START+87)
-
-#define RID_WARN_POST_MAILTO (RID_SFX_APP_START+88)
-
-#define RID_STR_NOWELCOMESCREEN (RID_SFX_APP_START+91)
-
-// --> PB 2004-08-20 #i33095#
-/* obsolete
-#define STR_EDITOBJECT (RID_SFX_APP_START+92)
-#define STR_OPENOBJECT (RID_SFX_APP_START+93)
-*/
-
-#define STR_CORRUPT_INSTALLATION (RID_SFX_APP_START+94)
-#define IDS_SBERR_STOREREF (RID_SFX_APP_START+97)
-
#define CONFIG_PATH_START (RID_SFX_APP_START+98)
-#define STR_KEY_ADDINS_PATH (CONFIG_PATH_START+0)
-#define STR_KEY_AUTOCORRECT_DIR (CONFIG_PATH_START+1)
-#define STR_KEY_GLOSSARY_PATH (CONFIG_PATH_START+2)
-#define STR_KEY_BACKUP_PATH (CONFIG_PATH_START+3)
-#define STR_KEY_BASIC_PATH (CONFIG_PATH_START+4)
-#define STR_KEY_BITMAP_PATH (CONFIG_PATH_START+5)
-#define STR_KEY_CONFIG_DIR (CONFIG_PATH_START+6)
-#define STR_KEY_DICTIONARY_PATH (CONFIG_PATH_START+7)
-#define STR_KEY_FAVORITES_DIR (CONFIG_PATH_START+8)
-#define STR_KEY_FILTER_PATH (CONFIG_PATH_START+9)
-#define STR_KEY_GALLERY_DIR (CONFIG_PATH_START+10)
-#define STR_KEY_GRAPHICS_PATH (CONFIG_PATH_START+11)
-#define STR_KEY_HELP_DIR (CONFIG_PATH_START+12)
-#define STR_KEY_LINGUISTIC_DIR (CONFIG_PATH_START+13)
-#define STR_KEY_MODULES_PATH (CONFIG_PATH_START+14)
-#define STR_KEY_PALETTE_PATH (CONFIG_PATH_START+15)
-#define STR_KEY_PLUGINS_PATH (CONFIG_PATH_START+16)
-#define STR_KEY_STORAGE_DIR (CONFIG_PATH_START+17)
-#define STR_KEY_TEMP_PATH (CONFIG_PATH_START+18)
-#define STR_KEY_TEMPLATE_PATH (CONFIG_PATH_START+19)
-#define STR_KEY_USERCONFIG_PATH (CONFIG_PATH_START+20)
-#define STR_KEY_USERDICTIONARY_DIR (CONFIG_PATH_START+21)
-#define STR_KEY_WORK_PATH (CONFIG_PATH_START+22)
-
#define WIN_HELPINDEX (RID_SFX_APP_START+99)
#define TP_HELP_CONTENT (RID_SFX_APP_START+100)
#define TP_HELP_INDEX (RID_SFX_APP_START+101)
@@ -168,11 +84,6 @@
#define IMG_HELP_CONTENT_DOC_HC (RID_SFX_APP_START+125) // image
-#define IMG_MISSING_1 (RID_SFX_APP_START+126) // image
-#define IMG_MISSING_2 (RID_SFX_APP_START+127) // image
-#define IMG_MISSING_3 (RID_SFX_APP_START+128) // image
-#define IMG_MISSING_4 (RID_SFX_APP_START+129) // image
-
#define STR_HELP_WINDOW_TITLE (RID_SFX_APP_START+125) // string
#define STR_HELP_BUTTON_INDEX_ON (RID_SFX_APP_START+126)
@@ -236,8 +147,6 @@
#define RID_SECURITY_WARNING_HYPERLINK (RID_SFX_APP_START + 180)
#define RID_SECURITY_WARNING_TITLE (RID_SFX_APP_START + 181)
-#define RID_INVALID_URL_MSG (RID_SFX_APP_START + 182)
-#define RID_INVALID_URL_TITLE (RID_SFX_APP_START + 183)
#define RID_DESKTOP (RID_SFX_APP_START + 184)
// #define RID_XMLSEC_WARNING_BROKENSIGNATURE (RID_SFX_APP_START + 185)
diff --git a/sfx2/source/appl/app.src b/sfx2/source/appl/app.src
index f8a387bba79b..fa5a1fc1c335 100644
--- a/sfx2/source/appl/app.src
+++ b/sfx2/source/appl/app.src
@@ -75,60 +75,6 @@ InfoBox RID_DOCALREADYLOADED_DLG
Message [ en-US ] = "Document already open." ;
};
-ErrorBox RID_CANTLOADDOC_DLG
-{
- Message [ en-US ] = "Cannot open document." ;
-};
-
-ErrorBox MSG_ERR_READ_CFG
-{
- BUTTONS = WB_OK ;
- DEFBUTTON = WB_DEF_OK ;
- Message [ en-US ] = "Error reading configuration file." ;
-};
-
-ErrorBox MSG_ERR_WRITE_CFG
-{
- BUTTONS = WB_OK ;
- DEFBUTTON = WB_DEF_OK ;
- Message [ en-US ] = "Error writing configuration file." ;
-};
-
-ErrorBox MSG_ERR_OPEN_CFG
-{
- BUTTONS = WB_OK ;
- DEFBUTTON = WB_DEF_OK ;
- Message [ en-US ] = "Error opening configuration file." ;
-};
-
-ErrorBox MSG_ERR_FILETYPE_CFG
-{
- BUTTONS = WB_OK ;
- DEFBUTTON = WB_DEF_OK ;
- Message [ en-US ] = "File is not a configuration file." ;
-};
-
-ErrorBox MSG_ERR_VERSION_CFG
-{
- BUTTONS = WB_OK ;
- DEFBUTTON = WB_DEF_OK ;
- Message [ en-US ] = "Configuration file contains the wrong version." ;
-};
-
-ErrorBox MSG_ERR_WRITE_SBL
-{
- BUTTONS = WB_OK ;
- DEFBUTTON = WB_DEF_OK ;
- Message [ en-US ] = "Error recording BASIC library in\n'@'." ;
-};
-
-ErrorBox MSG_SIGNAL
-{
- BUTTONS = WB_YES_NO ;
- DEFBUTTON = WB_DEF_YES ;
- Message [ en-US ] = "An unexpected program error has occurred.\n\nDo you want to try to save your changes in all open documents before the program is terminated?" ;
-};
-
ErrorBox MSG_ERR_NO_WEBBROWSER_FOUND
{
BUTTONS = WB_OK ;
@@ -141,89 +87,6 @@ Resource SID_UNKNOWN
String 1 "-" ;
};
-Resource BMP_SFX_COLOR
-{
- ExtraData =
- {
- SID_NEWDOC; // 043
- SID_OPENDOC; // 044
- SID_CLOSEDOC; // 045
- SID_RELOAD; // 046
- SID_SAVEASDOC; // 047
- SID_PRINTDOC; // 051
- SID_SETUPPRINTER; // 053
- SID_QUITAPP; // 054
- SID_UNDO; // 055
- SID_REDO; // 056
- SID_REPEAT; // 057
- SID_CUT; // 058
- SID_COPY; // 059
- SID_PASTE; // 060
- SID_DELETE; // 061
- SID_SELECTALL; // 062
- SID_SAVEDOC; // 063 vormals 046
- SID_EXITANDRETURN; // 064 vormals 054
- SID_RECORDMACRO; // 095
- SID_EDITMACRO; // 096
- SID_HELPMENU; // 098
- SID_CONFIG; // 123
- SID_CONFIGTOOLBOX; // 124
- 0;
- };
- Bitmap BMP_SFX_SMALL { File = "sco.bmp" ; };
- Bitmap BMP_SFX_LARGE { File = "lco.bmp" ; };
-};
-
-Resource BMP_SFX_MONO
-{
- ExtraData =
- {
- SID_NEWDOC; // 043
- SID_OPENDOC; // 044
- SID_CLOSEDOC; // 045
- SID_RELOAD; // 046
- SID_SAVEASDOC; // 047
- SID_PRINTDOC; // 051
- SID_SETUPPRINTER; // 053
- SID_QUITAPP; // 054
- SID_UNDO; // 055
- SID_REDO; // 056
- SID_REPEAT; // 057
- SID_CUT; // 058
- SID_COPY; // 059
- SID_PASTE; // 060
- SID_DELETE; // 061
- SID_SELECTALL; // 062
- SID_SAVEDOC; // 063 vormals 046
- SID_EXITANDRETURN; // 064 vormals 054
- SID_RECORDMACRO; // 095
- SID_EDITMACRO; // 096
- SID_HELPMENU; // 098
- SID_CONFIG; // 123
- SID_CONFIGTOOLBOX; // 124
- 0;
- };
- Bitmap BMP_SFX_SMALL { File = "smo.bmp" ; };
- Bitmap BMP_SFX_LARGE { File = "lmo.bmp" ; };
-};
-
-WarningBox RID_WARN_POST_MAILTO
-{
- BUTTONS = WB_OK_CANCEL ;
- DEFBUTTON = WB_DEF_OK ;
- Message [ en-US ] = "A form is to be sent by e-mail.\nThis means that the receiver will get to see your e-mail address." ;
-};
-
-String STR_RECOVER_TITLE
-{
- Text [ en-US ] = "File Recovery" ;
-};
-
-String STR_RECOVER_QUERY
-{
- Text [ en-US ] = "Should the file \"$1\" be restored?" ;
-};
-
String GID_INTERN
{
Text [ en-US ] = "Internal" ;
@@ -354,155 +217,16 @@ String GID_CONTROLS
Text [ en-US ] = "Controls" ;
};
-TabDialog SID_OPTIONS
-{
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 244 , 155 ) ;
- Text [ en-US ] = "Options" ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- TabControl 1
- {
- SVLook = TRUE ;
- Pos = MAP_APPFONT ( 3 , 15 ) ;
- Size = MAP_APPFONT ( 221 , 130 ) ;
- PageList =
- {
- PageItem
- {
- Identifier = RID_SFXPAGE_GENERAL ;
- Text [ en-US ] = "General" ;
- PageResID = 256 ;
- };
- PageItem
- {
- Identifier = RID_SFXPAGE_SAVE ;
- Text [ en-US ] = "Save" ;
- PageResID = 257 ;
- };
- PageItem
- {
- Identifier = RID_SFXPAGE_PATH ;
- Text [ en-US ] = "Paths" ;
- PageResID = 258 ;
- };
- PageItem
- {
- Identifier = RID_SFXPAGE_SPELL ;
- Text [ en-US ] = "Spellcheck" ;
- PageResID = 259 ;
- };
- };
- };
-};
-
InfoBox MSG_CANT_QUIT
{
Message [ en-US ] = "The application cannot be terminated at the moment.\nPlease wait until all print jobs and/or\nOLE actions have finished and close all dialogs." ;
};
-QueryBox MSG_IS_SERVER
-{
- Buttons = WB_YES_NO ;
- DefButton = WB_DEF_NO ;
- Message [ en-US ] = "This application is as object or print server active.\nDo you want to terminate anyway?" ;
-};
-
-String STR_NODOUBLE
-{
- Text [ en-US ] = "%PRODUCTNAME cannot be started more than once." ;
-};
-
-String STR_NOPRINTER
-{
- Text [ en-US ] = "Some %PRODUCTNAME functions will not work properly without a printer driver.\nPlease install a printer driver." ;
-};
-
String STR_ISMODIFIED
{
Text [ en-US ] = "Do you want to save the changes to %1?" ;
};
-String STR_AUTOSAVE
-{
- Text [ en-US ] = "AutoSave" ;
-};
-
-String STR_RESWARNING
-{
- Text [ en-US ] = "Limited system resources. Please quit other applications or close some windows before continuing." ;
-};
-String STR_RESEXCEPTION
-{
- Text [ en-US ] = "There are files missing. Please check application setup." ;
-};
-
-String STR_DOUBLEEXCEPTION
-{
- Text [ en-US ] = "Another error occurred during the save recovery.\nPossibly, the data could not be entirely saved." ;
-};
-
-String STR_SYSRESEXCEPTION
-{
- Text [ en-US ] = "System resources exhausted. Please restart the application." ;
-};
-
-ErrorBox MSG_ERR_SOINIT
-{
- Message [ en-US ] = "Error initializing object-system." ;
-};
-
-String MSG_IOERR_FILE_NOT_FOUND
-{
- Text [ en-US ] = "The file $(FILE) doesn't exist." ;
-};
-
-String MSG_IOERR_PATH_NOT_FOUND
-{
- Text [ en-US ] = "The path to file $(FILE) doesn't exist." ;
-};
-
-String MSG_IOERR_TOO_MANY_OPEN_FILES
-{
- Text [ en-US ] = "The file $(FILE) could not be opened,\nbecause too many files are open.\nPlease close some files and try again." ;
-};
-
-String MSG_IOERR_ACCESS_DENIED
-{
- Text [ en-US ] = "The file $(FILE) could not be opened due to missing access rights." ;
-};
-
-String MSG_IOERR_INVALID_ACCESS
-{
- Text [ en-US ] = "The file $(FILE) could not be accessed." ;
-};
-
-String MSG_IOERR_INVALID_HANDLE
-{
- Text [ en-US ] = "The file $(FILE) could not be opened due to an invalid file handle." ;
-};
-
-String MSG_IOERR_CANNOT_MAKE
-{
- Text [ en-US ] = "The file $(FILE) could not be created." ;
-};
-
-String MSG_IOERR_SHARING
-{
- Text [ en-US ] = "Error by shared access to $(FILE)." ;
-};
-
-String MSG_IOERR_INVALID_PARAMETER
-{
- Text [ en-US ] = "" ;
-};
-
-String MSG_IOERR_GENERAL
-{
- Text [ en-US ] = "General I/O error accessing $(FILE)." ;
-};
-
String RID_FULLSCREENTOOLBOX
{
Text = "" ;
@@ -538,41 +262,11 @@ ToolBox RID_FULLSCREENTOOLBOX
};
};
-String STR_ERR_NOTEMPLATE
-{
- Text [ en-US ] = "The selected template has an incorrect format" ;
-};
-
-String STR_ERR_NOFILE
-{
- Text [ en-US ] = "Can't open file $." ;
-};
-
String STR_QUITAPP
{
Text [ en-US ] = "E~xit" ;
};
-String STR_EXITANDRETURN
-{
- Text [ en-US ] = "E~xit & return to " ;
-};
-
-String STR_EXTHELPSTATUS
-{
- Text [ en-US ] = "Select a command or click to select a theme." ;
-};
-
-String STR_MAIL
-{
- Text [ en-US ] = "Mail" ;
-};
-
-String STR_ADDRESS_NAME
-{
- Text [ en-US ] = "Addresses" ;
-};
-
String RID_STR_HELP
{
Text [ en-US ] = "Help" ;
@@ -583,11 +277,6 @@ String RID_STR_NOAUTOSTARTHELPAGENT
Text [ en-US ] = "No automatic start at 'XX'" ;
};
-String RID_STR_NOWELCOMESCREEN
-{
- Text [ en-US ] = "Don't display tips" ;
-};
-
String RID_HELPBAR
{
Text [ en-US ] = "Help Bar" ;
@@ -653,11 +342,6 @@ String RID_STR_HLPFILENOTEXIST
Text [ en-US ] = "The help file for this topic is not installed." ;
};
-String RID_STR_HLPAPPNOTSTARTED
-{
- Text [ en-US ] = "The help system could not be started" ;
-};
-
//----------------------------------------------------------------------------
String RID_ENVTOOLBOX
@@ -670,129 +354,6 @@ String RID_SPECIALCONFIG_ERROR
Text [ en-US ] = "An error has occurred in the special configuration.\nPlease contact your administrator." ;
};
-String STR_MEMINFO_HEADER
-{
-};
-
-String STR_MEMINFO_FOOTER
-{
- Text = "</table>" ;
-};
-
-String STR_MEMINFO_OBJINFO
-{
- Text = "<tr><td >$(VISIBLE)</td><td>$(CACHED)</td><td>$(EXPIRE)</td><td>$(JSDIRTY)</td><td>$(JSEXEC)</td><td>$(FORBID)</td><td>$(FACTORY)</td><td>$(URL)</td><td>$(ORIGURL)</td><td>$(POSTSTRING)</td></tr>" ;
-};
-
-String RID_PLUGIN
-{
- Text [ en-US ] = "Enable plug-ins" ;
-};
-
-String STR_CORRUPT_INSTALLATION
-{
- Text [ en-US ] = "Important program components could not be initialized correctly.\nPlease start the setup program with the option /Repair." ;
-};
-
-String IDS_SBERR_STOREREF
-{
- Text [ en-US ] = "Reference will not be saved: " ;
-};
-
-String STR_KEY_CONFIG_DIR
-{
- Text [ en-US ] = "Configuration" ;
-};
-String STR_KEY_WORK_PATH
-{
- Text [ en-US ] = "My Documents" ;
-};
-String STR_KEY_GRAPHICS_PATH
-{
- Text [ en-US ] = "Graphics" ;
-};
-String STR_KEY_BITMAP_PATH
-{
- Text [ en-US ] = "Icons" ;
-};
-String STR_KEY_BASIC_PATH
-{
- Text = "BASIC" ;
-};
-
-String STR_KEY_PALETTE_PATH
-{
- Text [ en-US ] = "Palettes" ;
-};
-String STR_KEY_BACKUP_PATH
-{
- Text [ en-US ] = "Backups" ;
-};
-String STR_KEY_MODULES_PATH
-{
- Text [ en-US ] = "Modules" ;
-};
-String STR_KEY_TEMPLATE_PATH
-{
- Text [ en-US ] = "Templates" ;
-};
-String STR_KEY_GLOSSARY_PATH
-{
- Text [ en-US ] = "AutoText" ;
-};
-String STR_KEY_DICTIONARY_PATH
-{
- Text [ en-US ] = "Dictionaries" ;
-};
-String STR_KEY_HELP_DIR
-{
- Text [ en-US ] = "Help" ;
-};
-String STR_KEY_GALLERY_DIR
-{
- Text [ en-US ] = "Gallery" ;
-};
-
-String STR_KEY_STORAGE_DIR
-{
- Text [ en-US ] = "Message Storage" ;
-};
-String STR_KEY_TEMP_PATH
-{
- Text [ en-US ] = "Temporary files" ;
-};
-String STR_KEY_PLUGINS_PATH
-{
- Text [ en-US ] = "Plug-ins" ;
-};
-String STR_KEY_FAVORITES_DIR
-{
- Text [ en-US ] = "Folder Bookmarks" ;
-};
-String STR_KEY_FILTER_PATH
-{
- Text [ en-US ] = "Filters" ;
-};
-String STR_KEY_ADDINS_PATH
-{
- Text [ en-US ] = "Add-ins" ;
-};
-String STR_KEY_USERCONFIG_PATH
-{
- Text [ en-US ] = "User Configuration" ;
-};
-String STR_KEY_USERDICTIONARY_DIR
-{
- Text [ en-US ] = "User-defined dictionaries" ;
-};
-String STR_KEY_AUTOCORRECT_DIR
-{
- Text [ en-US ] = "AutoCorrect" ;
-};
-String STR_KEY_LINGUISTIC_DIR
-{
- Text [ en-US ] = "Writing aids" ;
-};
String STR_QUICKSTART_EXIT
{
Text [ en-US ] = "Exit Quickstarter" ;
@@ -867,17 +428,6 @@ String RID_SECURITY_WARNING_TITLE
Text [ en-US ] = "Security Warning" ;
};
-ErrorBox RID_INVALID_URL_MSG
-{
- Buttons = WB_OK ;
- Message [ en-US ] = "The URL is not valid." ;
-};
-
-String RID_INVALID_URL_TITLE
-{
- Text = "%PRODUCTNAME %PRODUCTVERSION" ;
-};
-
String RID_DESKTOP
{
Text = "%PRODUCTNAME" ;
@@ -910,26 +460,6 @@ String RID_XMLSEC_DOCUMENTSIGNED
Text [ en-US ] = " (Signed)" ;
};
-Image IMG_MISSING_1
-{
- ImageBitmap = Bitmap { File = "sc05539.bmp" ; };
-};
-
-Image IMG_MISSING_2
-{
- ImageBitmap = Bitmap { File = "sc05700.bmp" ; };
-};
-
-Image IMG_MISSING_3
-{
- ImageBitmap = Bitmap { File = "sc06302.bmp" ; };
-};
-
-Image IMG_MISSING_4
-{
- ImageBitmap = Bitmap { File = "sn064.bmp" ; };
-};
-
String STR_STANDARD
{
Text [ en-US ] = "Standard" ;
diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx
index 7e775cbbb502..3dfe8c6a855b 100644
--- a/sfx2/source/appl/appbas.cxx
+++ b/sfx2/source/appl/appbas.cxx
@@ -73,7 +73,6 @@
#include "sfx2/minfitem.hxx"
#include "app.hrc"
#include <sfx2/evntconf.hxx>
-#include <sfx2/macrconf.hxx>
#include <sfx2/request.hxx>
#include <sfx2/dinfdlg.hxx>
#include "appdata.hxx"
@@ -257,12 +256,6 @@ SbxVariable* MakeVariable( StarBASIC *pBas, SbxObject *pObject,
BasicManager* SfxApplication::GetBasicManager()
{
-// DBG_ASSERT( pAppData_Impl->nBasicCallLevel != 0,
-// "unnecessary call to GetBasicManager() - inefficient!" );
- if ( pAppData_Impl->nBasicCallLevel == 0 )
- // sicherheitshalber
- EnterBasicCall();
-
return BasicManagerRepository::getApplicationBasicManager( true );
}
@@ -291,106 +284,6 @@ StarBASIC* SfxApplication::GetBasic()
return GetBasicManager()->GetLib(0);
}
-//--------------------------------------------------------------------
-
-FASTBOOL SfxApplication::IsInBasicCall() const
-{
- return 0 != pAppData_Impl->nBasicCallLevel;
-}
-
-//--------------------------------------------------------------------
-
-void SfxApplication::EnterBasicCall()
-{
- if ( 1 == ++pAppData_Impl->nBasicCallLevel )
- {
- DBG_TRACE( "SfxShellObject: BASIC-on-demand" );
-
- // das kann l"anger dauern, da Progress nicht geht, wenigstens Sanduhr
-//(mba)/task SfxWaitCursor aWait;
-
- // zuerst das BASIC laden
- GetBasic();
-/*
- // als erstes SfxShellObject das SbxObject der SfxApplication erzeugen
- SbxObject *pSbx = GetSbxObject();
- DBG_ASSERT( pSbx, "SfxShellObject: can't create SbxObject for SfxApplication" );
-
- // die SbxObjects aller Module erzeugen
- SfxModuleArr_Impl& rArr = GetModules_Impl();
- for ( sal_uInt16 n = 0; n < rArr.Count(); ++n )
- {
- SfxModule *pMod = rArr.GetObject(n);
- if ( pMod->IsLoaded() )
- {
- pSbx = pMod->GetSbxObject();
- DBG_ASSERT( pSbx, "SfxModule: can't create SbxObject" );
- }
- }
-
- // die SbxObjects aller Tasks erzeugen
- for ( SfxTask *pTask = SfxTask::GetFirst(); pTask; pTask = SfxTask::GetNext( *pTask ) )
- pTask->GetSbxObject();
-
- // die SbxObjects aller SfxObjectShells erzeugen (ggf. Frame-los!)
- for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst( NULL, sal_False );
- pObjSh;
- pObjSh = SfxObjectShell::GetNext(*pObjSh, NULL, sal_False) )
- {
- // kein IP-Object oder wenn doch dann initialisiert?
- SvStorageRef aStorage;
- if ( !pObjSh->IsHandsOff() )
- aStorage = pObjSh->GetStorage();
- if ( !pObjSh->GetInPlaceObject() || aStorage.Is() )
- {
- DBG( DbgOutf( "SfxShellObject: BASIC-on-demand for %s",
- pObjSh->SfxShell::GetName().GetBuffer() ) );
- pSbx = pObjSh->GetSbxObject();
- DBG_ASSERT( pSbx, "SfxShellObject: can't create SbxObject" );
- }
- }
-
- // die SbxObjects der SfxShells auf den Stacks der Frames erzeugen
- for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(0,sal_False);
- pFrame;
- pFrame = SfxViewFrame::GetNext(*pFrame,0,0,sal_False) )
- {
- // den Dispatcher des Frames rausholen
- SfxDispatcher *pDispat = pFrame->GetDispatcher();
- pDispat->Flush();
-
- // "uber alle SfxShells auf dem Stack des Dispatchers iterieren
- // Frame selbst wird ausgespart, da er indirekt angezogen wird,
- // sofern er ein Dokument enth"alt.
- for ( sal_uInt16 nStackIdx = pDispat->GetShellLevel(*pFrame);
- 0 != nStackIdx;
- --nStackIdx )
- {
- DBG( DbgOutf( "SfxShellObject: BASIC-on-demand for level %u", nStackIdx-1 ); )
- pSbx = pDispat->GetShell(nStackIdx - 1)->GetSbxObject();
- DBG_ASSERT( pSbx, "SfxShellObject: can't create SbxObject" );
- }
-
- if ( !pFrame->GetObjectShell() )
- {
- DBG( DbgOutf( "SfxShellObject: BASIC-on-demand for empty frame" ); )
- pSbx = pFrame->GetSbxObject();
- DBG_ASSERT( pSbx, "SfxShellObject: can't create SbxObject" );
- }
- }
-*/
- // Factories anmelden
-// SbxBase::AddFactory( new SfxSbxObjectFactory_Impl );
- }
-}
-
-//--------------------------------------------------------------------
-
-void SfxApplication::LeaveBasicCall()
-{
- --pAppData_Impl->nBasicCallLevel;
-}
-
//-------------------------------------------------------------------------
void SfxApplication::PropExec_Impl( SfxRequest &rReq )
{
@@ -445,10 +338,6 @@ void SfxApplication::PropExec_Impl( SfxRequest &rReq )
break;
}
- case SID_PLAYMACRO:
- PlayMacro_Impl( rReq, GetBasic() );
- break;
-
case SID_OFFICE_PRIVATE_USE:
case SID_OFFICE_COMMERCIAL_USE:
{
@@ -523,68 +412,3 @@ void SfxApplication::PropState_Impl( SfxItemSet &rSet )
}
}
-//--------------------------------------------------------------------
-void SfxApplication::MacroExec_Impl( SfxRequest& rReq )
-{
- DBG_MEMTEST();
- if ( SfxMacroConfig::IsMacroSlot( rReq.GetSlot() ) )
- {
- // SlotId referenzieren, damit nicht im Execute der Slot abgeschossen
- // werden kann
- GetMacroConfig()->RegisterSlotId(rReq.GetSlot());
- SFX_REQUEST_ARG(rReq, pArgs, SfxStringItem,
- rReq.GetSlot(), sal_False);
- String aArgs;
- if( pArgs ) aArgs = pArgs->GetValue();
- if ( GetMacroConfig()->ExecuteMacro(rReq.GetSlot(), aArgs ) )
- rReq.Done();
- GetMacroConfig()->ReleaseSlotId(rReq.GetSlot());
- }
-}
-
-//--------------------------------------------------------------------
-void SfxApplication::MacroState_Impl( SfxItemSet& )
-{
- DBG_MEMTEST();
-}
-
-//-------------------------------------------------------------------------
-
-void SfxApplication::PlayMacro_Impl( SfxRequest &rReq, StarBASIC *pBasic )
-{
- EnterBasicCall();
- sal_Bool bOK = sal_False;
-
- // Makro und asynch-Flag
- SFX_REQUEST_ARG(rReq,pMacro,SfxStringItem,SID_STATEMENT,sal_False);
- SFX_REQUEST_ARG(rReq,pAsynch,SfxBoolItem,SID_ASYNCHRON,sal_False);
-
- if ( pAsynch && pAsynch->GetValue() )
- {
- // asynchron ausf"uhren
- GetDispatcher_Impl()->Execute( SID_PLAYMACRO, SFX_CALLMODE_ASYNCHRON, pMacro, 0L );
- rReq.Done();
- }
- else if ( pMacro )
- {
- // Statement aufbereiten
- DBG_ASSERT( pBasic, "no BASIC found" ) ;
- String aStatement( '[' );
- aStatement += pMacro->GetValue();
- aStatement += ']';
-
- // P"aventiv den Request abschlie\sen, da er ggf. zerst"ort wird
- rReq.Done();
- rReq.ReleaseArgs();
-
- // Statement ausf"uhren
- pBasic->Execute( aStatement );
- bOK = 0 == SbxBase::GetError();
- SbxBase::ResetError();
- }
-
- LeaveBasicCall();
- rReq.SetReturnValue(SfxBoolItem(0,bOK));
-}
-
-
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index c876db373d35..e94635063727 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -88,7 +88,6 @@
#include <sfx2/evntconf.hxx>
#include "appdata.hxx"
#include "workwin.hxx"
-#include <sfx2/macrconf.hxx>
#include "helper.hxx" // SfxContentHelper::...
#include "app.hrc"
#include "sfx2/sfxresid.hxx"
@@ -718,7 +717,7 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
pSh;
++nIdx, pSh = pDispat->GetShell(nIdx) )
{
- SfxUndoManager *pShUndoMgr = pSh->GetUndoManager();
+ ::svl::IUndoManager *pShUndoMgr = pSh->GetUndoManager();
if ( pShUndoMgr )
pShUndoMgr->SetMaxUndoActionCount( nUndoCount );
}
@@ -987,26 +986,9 @@ BOOL SfxApplication::SaveAll_Impl(BOOL bPrompt, BOOL bAutoSave)
//--------------------------------------------------------------------
-SfxMacroConfig* SfxApplication::GetMacroConfig() const
-{
- return SfxMacroConfig::GetOrCreate();
-}
-
-//--------------------------------------------------------------------
-SfxEventConfiguration* SfxApplication::GetEventConfig() const
-{
- if (!pAppData_Impl->pEventConfig)
- pAppData_Impl->pEventConfig = new SfxEventConfiguration;
- return pAppData_Impl->pEventConfig;
-}
-
-//--------------------------------------------------------------------
-
//--------------------------------------------------------------------
void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, FASTBOOL bSynchron )
{
- //DBG_ASSERT(pAppData_Impl->pEventConfig,"Keine Events angemeldet!");
-
SfxObjectShell *pDoc = rEventHint.GetObjShell();
if ( pDoc && ( pDoc->IsPreview() || !pDoc->Get_Impl()->bInitialized ) )
return;
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index 32b56717293c..ce0dda051886 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -102,7 +102,6 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* ) :
pAppDispatch(NULL),
pTemplates( 0 ),
pPool(0),
- pEventConfig(0),
pDisabledSlotList( 0 ),
pSecureURLs(0),
pSaveOptions( 0 ),
@@ -112,7 +111,6 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* ) :
pTemplateCommon( 0 ),
nDocModalMode(0),
nAutoTabPageId(0),
- nBasicCallLevel(0),
nRescheduleLocks(0),
nInReschedule(0),
nAsynchronCalls(0),
diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx
index 808731f8bba8..55a8764ac0c5 100644
--- a/sfx2/source/appl/appdde.cxx
+++ b/sfx2/source/appl/appdde.cxx
@@ -38,6 +38,7 @@
#include <sfx2/linkmgr.hxx>
#include <tools/urlobj.hxx>
+#include <tools/diagnose_ex.h>
#include <unotools/pathoptions.hxx>
#ifndef GCC
#endif
@@ -197,11 +198,9 @@ long SfxApplication::DdeExecute
else
{
// alle anderen per BASIC
- EnterBasicCall();
StarBASIC* pBasic = GetBasic();
- DBG_ASSERT( pBasic, "Wo ist mein Basic???" );
+ ENSURE_OR_RETURN( pBasic, "where's my basic?", 0 );
SbxVariable* pRet = pBasic->Execute( rCmd );
- LeaveBasicCall();
if( !pRet )
{
SbxBase::ResetError();
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 2aa19901d87c..a3d25de8ee61 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -74,7 +74,6 @@
#include <sfx2/docfac.hxx>
#include <sfx2/evntconf.hxx>
#include "intro.hxx"
-#include <sfx2/macrconf.hxx>
#include <sfx2/mnumgr.hxx>
#include <sfx2/msgpool.hxx>
#include <sfx2/progress.hxx>
@@ -86,7 +85,7 @@
#include <sfx2/fcontnr.hxx>
#include "helper.hxx" // SfxContentHelper::Kill()
#include "sfxpicklist.hxx"
-#include <tools/svlibrary.hxx>
+#include <tools/svlibrary.hxx>
#ifdef UNX
#define stricmp(a,b) strcmp(a,b)
@@ -213,7 +212,7 @@ String GetSpecialCharsForEdit(Window* pParent, const Font& rFont)
{
bDetermineFunction = true;
- static ::rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "cui" ) ) );
+ static ::rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "cui" ) ) );
oslModule handleMod = osl_loadModuleRelative(
&thisModule, aLibName.pData, 0 );
diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx
index e7d0fd70bf58..2a5456989aa7 100644
--- a/sfx2/source/appl/appquit.cxx
+++ b/sfx2/source/appl/appquit.cxx
@@ -44,6 +44,7 @@
#include "app.hrc"
#include <sfx2/app.hxx>
+#include <sfx2/evntconf.hxx>
#include <sfx2/unoctitm.hxx>
#include "appdata.hxx"
#include <sfx2/viewsh.hxx>
@@ -52,7 +53,6 @@
#include "arrdecl.hxx"
#include "sfx2/sfxresid.hxx"
#include <sfx2/event.hxx>
-#include <sfx2/macrconf.hxx>
#include <sfx2/mnumgr.hxx>
#include <sfx2/templdlg.hxx>
#include <sfx2/msgpool.hxx>
@@ -149,8 +149,6 @@ void SfxApplication::Deinitialize()
delete pAppData_Impl->pLabelResMgr;
DELETEX(pAppData_Impl->pSlotPool);
- DELETEX(pAppData_Impl->pEventConfig);
- SfxMacroConfig::Release_Impl();
DELETEX(pAppData_Impl->pFactArr);
DELETEX(pAppData_Impl->pInitLinkList);
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index c1858c5b33fb..d90e68d6c764 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -107,7 +107,6 @@
#include <sfx2/new.hxx>
#include <sfx2/templdlg.hxx>
#include "sfxtypes.hxx"
-#include "sfxbasic.hxx"
#include <sfx2/tabdlg.hxx>
#include "arrdecl.hxx"
#include "fltfnc.hxx"
@@ -118,7 +117,6 @@
#include "arrdecl.hxx"
#include <sfx2/childwin.hxx>
#include "appdata.hxx"
-#include <sfx2/macrconf.hxx>
#include "sfx2/minfitem.hxx"
#include <sfx2/event.hxx>
#include <sfx2/module.hxx>
@@ -129,7 +127,7 @@
#include <sfx2/dialogs.hrc>
#include "sorgitm.hxx"
#include "sfx2/sfxhelp.hxx"
-#include <tools/svlibrary.hxx>
+#include <tools/svlibrary.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::beans;
@@ -746,7 +744,7 @@ extern "C" { static void SAL_CALL thisModule() {} }
::rtl::OUString ChooseMacro( const Reference< XModel >& rxLimitToDocument, BOOL bChooseOnly, const ::rtl::OUString& rMacroDesc = ::rtl::OUString() )
{
// get basctl dllname
- static ::rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "basctl" ) ) );
+ static ::rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "basctl" ) ) );
// load module
oslModule handleMod = osl_loadModuleRelative(
@@ -766,7 +764,7 @@ extern "C" { static void SAL_CALL thisModule() {} }
void MacroOrganizer( INT16 nTabId )
{
// get basctl dllname
- static ::rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "basctl" ) ) );
+ static ::rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "basctl" ) ) );
// load module
oslModule handleMod = osl_loadModuleRelative(
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 60b684d7385f..9d2025d1e23e 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -94,6 +94,7 @@
#include <tools/cachestr.hxx>
#include <osl/mutex.hxx>
#include <comphelper/sequence.hxx>
+#include <framework/documentundoguard.hxx>
#include <rtl/ustrbuf.hxx>
#include <comphelper/interaction.hxx>
@@ -116,7 +117,6 @@ using namespace ::com::sun::star::io;
#include <sfx2/fcontnr.hxx>
#include "frmload.hxx"
#include <sfx2/frame.hxx>
-#include "sfxbasic.hxx"
#include <sfx2/objsh.hxx>
#include <sfx2/objuno.hxx>
#include <sfx2/unoctitm.hxx>
@@ -1770,12 +1770,9 @@ void SAL_CALL SfxMacroLoader::removeStatusListener(
{
}
-// -----------------------------------------------------------------------
ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star::uno::Any& rRetval, SfxObjectShell* pSh )
throw ( ::com::sun::star::uno::RuntimeException )
{
- SfxApplication* pApp = SFX_APP();
- pApp->EnterBasicCall();
SfxObjectShell* pCurrent = pSh;
if ( !pCurrent )
// all not full qualified names use the BASIC of the given or current document
@@ -1821,18 +1818,21 @@ ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star::
if ( pBasMgr )
{
- if ( pSh && pDoc )
+ const bool bIsAppBasic = ( pBasMgr == pAppMgr );
+ const bool bIsDocBasic = ( pBasMgr != pAppMgr );
+
+ if ( pDoc )
{
- // security check for macros from document basic if an SFX context (pSh) is given
+ // security check for macros from document basic if an SFX doc is given
if ( !pDoc->AdjustMacroMode( String() ) )
// check forbids execution
return ERRCODE_IO_ACCESSDENIED;
}
- else if ( pSh && pSh->GetMedium() )
+ else if ( pDoc && pDoc->GetMedium() )
{
- pSh->AdjustMacroMode( String() );
- SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
- SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(), pMacroExecModeItem, SfxUInt16Item, SID_MACROEXECMODE, sal_False);
+ pDoc->AdjustMacroMode( String() );
+ SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
+ SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pMacroExecModeItem, SfxUInt16Item, SID_MACROEXECMODE, sal_False);
if ( pUpdateDocItem && pMacroExecModeItem
&& pUpdateDocItem->GetValue() == document::UpdateDocMode::NO_UPDATE
&& pMacroExecModeItem->GetValue() == document::MacroExecMode::NEVER_EXECUTE )
@@ -1849,79 +1849,49 @@ ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star::
aQualifiedMethod.Erase( nArgsPos - nHashPos - 1 );
}
- SbxMethod *pMethod = SfxQueryMacro( pBasMgr, aQualifiedMethod );
- if ( pMethod )
+ if ( pBasMgr->HasMacro( aQualifiedMethod ) )
{
- // arguments must be quoted
- String aQuotedArgs;
- if ( aArgs.Len()<2 || aArgs.GetBuffer()[1] == '\"')
- // no args or already quoted args
- aQuotedArgs = aArgs;
- else
+ Any aOldThisComponent;
+ const bool bSetDocMacroMode = ( pDoc != NULL ) && bIsDocBasic;
+ const bool bSetGlobalThisComponent = ( pDoc != NULL ) && bIsAppBasic;
+ if ( bSetDocMacroMode )
{
- // quote parameters
- aArgs.Erase(0,1);
- aArgs.Erase( aArgs.Len()-1,1);
-
- aQuotedArgs = '(';
-
- sal_uInt16 nCount = aArgs.GetTokenCount(',');
- for ( sal_uInt16 n=0; n<nCount; n++ )
- {
- aQuotedArgs += '\"';
- aQuotedArgs += aArgs.GetToken( n, ',' );
- aQuotedArgs += '\"';
- if ( n<nCount-1 )
- aQuotedArgs += ',';
- }
-
- aQuotedArgs += ')';
+ // mark document: it executes an own macro, so it's in a modal mode
+ pDoc->SetMacroMode_Impl( TRUE );
}
- Any aOldThisComponent;
- if ( pSh )
+ if ( bSetGlobalThisComponent )
{
- if ( pBasMgr != pAppMgr )
- // mark document: it executes an own macro, so it's in a modal mode
- pSh->SetMacroMode_Impl( TRUE );
- if ( pBasMgr == pAppMgr )
- {
- // document is executed via AppBASIC, adjust ThisComponent variable
- aOldThisComponent = pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pSh->GetModel() ) );
- }
+ // document is executed via AppBASIC, adjust ThisComponent variable
+ aOldThisComponent = pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pDoc->GetModel() ) );
}
- // add quoted arguments and do the call
- String aCall( '[' );
- aCall += pMethod->GetName();
- aCall += aQuotedArgs;
- aCall += ']';
-
// just to let the shell be alive
- SfxObjectShellRef rSh = pSh;
+ SfxObjectShellRef xKeepDocAlive = pDoc;
- // execute function using its Sbx parent,
- //SbxVariable* pRet = pMethod->GetParent()->Execute( aCall );
- //rRetval = sbxToUnoValue( pRet );
-
- SbxVariable* pRet = pMethod->GetParent()->Execute( aCall );
- if ( pRet )
{
- USHORT nFlags = pRet->GetFlags();
- pRet->SetFlag( SBX_READWRITE | SBX_NO_BROADCAST );
- rRetval = sbxToUnoValue( pRet );
- pRet->SetFlags( nFlags );
+ // attempt to protect the document against the script tampering with its Undo Context
+ ::std::auto_ptr< ::framework::DocumentUndoGuard > pUndoGuard;
+ if ( bIsDocBasic )
+ pUndoGuard.reset( new ::framework::DocumentUndoGuard( pDoc->GetModel() ) );
+
+ // execute the method
+ SbxVariableRef retValRef = new SbxVariable;
+ nErr = pBasMgr->ExecuteMacro( aQualifiedMethod, aArgs, retValRef );
+ if ( nErr == ERRCODE_NONE )
+ rRetval = sbxToUnoValue( retValRef );
}
- nErr = SbxBase::GetError();
- if ( ( pBasMgr == pAppMgr ) && pSh )
+ if ( bSetGlobalThisComponent )
{
pAppMgr->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );
}
- if ( pSh && pSh->GetModel().is() )
- // remove flag for modal mode
- pSh->SetMacroMode_Impl( FALSE );
+ if ( bSetDocMacroMode )
+ {
+ // remove flag for modal mode
+ pDoc->SetMacroMode_Impl( FALSE );
+ }
}
else
nErr = ERRCODE_BASIC_PROC_UNDEFINED;
@@ -1940,7 +1910,6 @@ ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star::
nErr = SbxBase::GetError();
}
- pApp->LeaveBasicCall();
SbxBase::ResetError();
return nErr;
}
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index 12f824ea4255..06e17e232041 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -111,7 +111,6 @@ using namespace ::vos;
#include <unotools/syslocale.hxx>
#include "sfx2/sfxhelp.hxx"
-#include "sfxbasic.hxx"
#include <sfx2/docfilt.hxx>
#include <sfx2/docfac.hxx>
#include "sfxtypes.hxx"
@@ -590,37 +589,6 @@ sal_uInt32 SfxFilterMatcher::DetectFilter( SfxMedium& rMedium, const SfxFilter**
if( STRING_NOTFOUND != aFlags.Search( 'H' ) )
bHidden = sal_True;
}
-/*
- if ( ( !pFilter || nErr == ERRCODE_SFX_CONSULTUSER ) && !bAPI && !bHidden )
- {
- if ( !pFilter )
- pFilter = pOldFilter;
-
- String aTmpName;
- if ( pFilter )
- aTmpName = pFilter->GetUIName();
-
- SfxFilterMatcher *pMatcher;
- if( bPlugIn && pFilter )
- pMatcher = new SfxFilterMatcher( (SfxFilterContainer *) pFilter->GetFilterContainer() );
- else
- pMatcher = (SfxFilterMatcher*) this;
-
- SfxFilterDialog *pDlg = new SfxFilterDialog( 0, &rMedium, *pMatcher, pFilter ? &aTmpName: 0, 0 );
- const sal_Bool bOk = RET_OK == pDlg->Execute();
- if (bOk)
- pFilter = pMatcher->GetFilter4UIName( pDlg->GetSelectEntry());
-
- if( bPlugIn && pFilter )
- delete pMatcher;
- delete pDlg;
-
- if ( !bOk)
- nErr = ERRCODE_ABORT;
- else
- nErr = ERRCODE_NONE;
- }
-*/
*ppFilter = pFilter;
if ( bHidden || (bAPI && nErr == ERRCODE_SFX_CONSULTUSER) )
@@ -773,22 +741,6 @@ const SfxFilter* SfxFilterMatcher::GetFilter4Extension( const String& rExt, SfxF
const SfxFilter* SfxFilterMatcher::GetFilter4ClipBoardId( sal_uInt32 nId, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
{
- /*
- if ( pImpl->pList )
- {
- sal_uInt16 nCount = ( sal_uInt16 ) pImpl->pList->Count();
- for( sal_uInt16 n = 0; n < nCount; n++ )
- {
- const SfxFilter* pFilter = pImpl->pList->GetObject( n );
- SfxFilterFlags nFlags = pFilter->GetFilterFlags();
- if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetFormat() == nId )
- return pFilter;
- }
-
- return 0;
- }
- */
-
if (nId == 0)
return 0;
diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx
index 59c56cc291a7..2ab7b1c9602b 100644
--- a/sfx2/source/config/evntconf.cxx
+++ b/sfx2/source/config/evntconf.cxx
@@ -42,7 +42,7 @@
#include <framework/eventsconfiguration.hxx>
#include <comphelper/processfactory.hxx>
#include <sfx2/evntconf.hxx>
-#include <sfx2/macrconf.hxx>
+
#include <sfx2/docfile.hxx>
#include <sfx2/app.hxx>
#include <sfx2/objsh.hxx>
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index 40f6346de8ee..cf04de2cb3a4 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -64,7 +64,6 @@
#include <sfx2/objface.hxx>
#include "sfxtypes.hxx"
#include "workwin.hxx"
-#include <sfx2/macrconf.hxx>
#include <sfx2/unoctitm.hxx>
#include <sfx2/sfx.hrc>
#include <sfx2/sfxuno.hxx>
@@ -1118,13 +1117,7 @@ void SfxBindings::Release( SfxControllerItem& rItem )
delete (*pImp->pCaches)[nPos];
pImp->pCaches->Remove(nPos, 1);
#endif
- if ( SfxMacroConfig::IsMacroSlot( nId ) )
- {
- delete (*pImp->pCaches)[nPos];
- pImp->pCaches->Remove(nPos, 1);
- }
- else
- pImp->bCtrlReleased = sal_True;
+ pImp->bCtrlReleased = sal_True;
}
}
@@ -1474,7 +1467,7 @@ SfxItemSet* SfxBindings::CreateSet_Impl
rFound.Insert( pFound );
USHORT nSlot = pRealSlot->GetSlotId();
- if ( !SfxMacroConfig::IsMacroSlot( nSlot ) && !(nSlot >= SID_VERB_START && nSlot <= SID_VERB_END) )
+ if ( !(nSlot >= SID_VERB_START && nSlot <= SID_VERB_END) )
{
pInterface = pInterface->GetRealInterfaceForSlot( pRealSlot );
DBG_ASSERT (pInterface,"Slot in angegebener Shell nicht gefunden!");
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index c08d713547a0..ddf3422744cb 100755
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -69,7 +69,6 @@
#include "slotserv.hxx"
#include <sfx2/ipclient.hxx>
#include "sfxtypes.hxx"
-#include <sfx2/macrconf.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/viewsh.hxx>
#include <sfx2/childwin.hxx>
@@ -159,7 +158,6 @@ struct SfxDispatcher_Impl
SfxObjectBars_Impl aObjBars[SFX_OBJECTBAR_MAX];
SfxObjectBars_Impl aFixedObjBars[SFX_OBJECTBAR_MAX];
SvULongs aChildWins;
- sal_uInt16 nActionLevel; // in EnterAction
sal_uInt32 nEventId; // EventId UserEvent
sal_Bool bUILocked; // Update abgeklemmt (!zappeln)
sal_Bool bNoUI; // UI nur vom Parent Dispatcher
@@ -367,7 +365,6 @@ void SfxDispatcher::Construct_Impl( SfxDispatcher* pParent )
pImp->pParent = pParent;
pImp->bInvalidateOnUnlock = sal_False;
- pImp->nActionLevel = 0;
for (sal_uInt16 n=0; n<SFX_OBJECTBAR_MAX; n++)
pImp->aObjBars[n].nResId = 0;
@@ -488,9 +485,6 @@ void SfxDispatcher::Pop
DBG_MEMTEST();
DBG_ASSERT( rShell.GetInterface(),
"pushing SfxShell without previous RegisterInterface()" );
- DBG_ASSERT( pImp->nActionLevel == 0, "Push or Pop within Action" );
-// DBG_ASSERT( SFX_APP()->IsInAsynchronCall_Impl(),
-// "Dispatcher Push/Pop in synchron-call-stack" );
bool bDelete = (nMode & SFX_SHELL_POP_DELETE) == SFX_SHELL_POP_DELETE;
bool bUntil = (nMode & SFX_SHELL_POP_UNTIL) == SFX_SHELL_POP_UNTIL;
@@ -1029,10 +1023,6 @@ void SfxDispatcher::_Execute
if ( IsLocked( rSlot.GetSlotId() ) )
return;
- sal_uInt16 nSlot = rSlot.GetSlotId();
- if ( SfxMacroConfig::IsMacroSlot( nSlot ) )
- SFX_APP()->GetMacroConfig()->RegisterSlotId( nSlot );
-
if ( (eCallMode & SFX_CALLMODE_ASYNCHRON) ||
( !(eCallMode & SFX_CALLMODE_SYNCHRON) &&
rSlot.IsMode(SFX_SLOT_ASYNCHRON) ) )
@@ -1618,38 +1608,6 @@ IMPL_LINK( SfxDispatcher, PostMsgHandler, SfxRequest*, pReq )
return 0;
}
//--------------------------------------------------------------------
-void SfxDispatcher::EnterAction( const String& rName )
-
-// marks the beginning of a block of actions
-
-{
- DBG_MEMTEST();
- Flush();
- DBG_ASSERT( pImp->aStack.Count() > 0, "EnterAction on empty dispatcher stack" );
- if ( ++pImp->nActionLevel == 1 )
- {
- SfxUndoManager *pUndoMgr = GetShell(0)->GetUndoManager();
- if ( pUndoMgr )
- pUndoMgr->EnterListAction( rName, rName HACK(RepeatComment), 0 HACK(ID) );
- }
-}
-//--------------------------------------------------------------------
-void SfxDispatcher::LeaveAction()
-
-// marks the end of a block of actions
-
-{
- DBG_MEMTEST();
- DBG_ASSERT( pImp->nActionLevel > 0, "EnterAction without LeaveAction" );
- if ( --pImp->nActionLevel == 0 )
- {
- SfxUndoManager *pUndoMgr = GetShell(0)->GetUndoManager();
- if ( pUndoMgr )
- pUndoMgr->LeaveListAction();
- }
-}
-
-//--------------------------------------------------------------------
void SfxDispatcher::SetMenu_Impl()
{
if ( pImp->pFrame )
@@ -2298,7 +2256,6 @@ sal_Bool SfxDispatcher::_FindServer
SFX_STACK(SfxDispatcher::_FindServer);
// Dispatcher gelockt? (SID_HELP_PI trotzdem durchlassen)
- SfxApplication *pSfxApp = SFX_APP();
if ( IsLocked(nSlot) )
{
pImp->bInvalidateOnUnlock = sal_True;
@@ -2318,25 +2275,8 @@ sal_Bool SfxDispatcher::_FindServer
}
}
- // Makro-Slot?
- if ( SfxMacroConfig::IsMacroSlot( nSlot ) )
- {
- const SfxMacroInfo* pInfo = pSfxApp->GetMacroConfig()->GetMacroInfo(nSlot);
- if ( pInfo )
- {
- const SfxSlot* pSlot = pInfo->GetSlot();
- if ( pSlot )
- {
- rServer.SetShellLevel(nTotCount-1);
- rServer.SetSlot( pSlot );
- return sal_True;
- }
- }
-
- return sal_False;
- }
// Verb-Slot?
- else if (nSlot >= SID_VERB_START && nSlot <= SID_VERB_END)
+ if (nSlot >= SID_VERB_START && nSlot <= SID_VERB_END)
{
for ( sal_uInt16 nShell = 0;; ++nShell )
{
@@ -2474,10 +2414,7 @@ sal_Bool SfxDispatcher::HasSlot_Impl( sal_uInt16 nSlot )
nTotCount = nTotCount + pImp->aStack.Count();
}
- if ( SfxMacroConfig::IsMacroSlot( nSlot ) )
- // Makro-Slot?
- return sal_True;
- else if (nSlot >= SID_VERB_START && nSlot <= SID_VERB_END)
+ if (nSlot >= SID_VERB_START && nSlot <= SID_VERB_END)
{
// Verb-Slot?
for ( sal_uInt16 nShell = 0;; ++nShell )
@@ -2658,10 +2595,6 @@ const SfxPoolItem* SfxDispatcher::_Execute( const SfxSlotServer &rSvr )
{
Flush();
- sal_uInt16 nSlot = pSlot->GetSlotId();
- if ( SfxMacroConfig::IsMacroSlot( nSlot ) )
- SFX_APP()->GetMacroConfig()->RegisterSlotId( nSlot );
-
if ( pSlot->IsMode(SFX_SLOT_ASYNCHRON) )
//! ignoriert rSvr
{
diff --git a/sfx2/source/control/macrconf.cxx b/sfx2/source/control/macrconf.cxx
deleted file mode 100644
index 079c7180ac1a..000000000000
--- a/sfx2/source/control/macrconf.cxx
+++ /dev/null
@@ -1,874 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sfx2.hxx"
-#include <basic/sbstar.hxx>
-#include <basic/basmgr.hxx>
-#ifndef _SBX_HXX //autogen
-#include <basic/sbx.hxx>
-#endif
-#include <svl/intitem.hxx>
-#include <basic/sbmeth.hxx>
-#include <basic/sbmod.hxx>
-#ifndef _BASIC_SBUNO_HXX
-#include <basic/sbuno.hxx>
-#endif
-
-#include <osl/mutex.hxx>
-
-#include <com/sun/star/script/XEngine.hpp>
-#include <com/sun/star/document/MacroExecMode.hpp>
-
-#ifndef GCC
-#endif
-
-#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
-#include <comphelper/processfactory.hxx>
-#endif
-#include <unotools/intlwrapper.hxx>
-
-#include <sfx2/msgpool.hxx>
-#include <sfx2/macrconf.hxx>
-#include "sfxbasic.hxx"
-#include <sfx2/sfx.hrc>
-#include <sfx2/app.hxx>
-#include <sfx2/objsh.hxx>
-#include <sfx2/dispatch.hxx>
-#include "sfx2/minfitem.hxx"
-#include "sfx2/imgmgr.hxx"
-#include <sfx2/evntconf.hxx>
-#include <sfx2/docfile.hxx>
-#include <sfx2/genlink.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <appdata.hxx>
-#include "objshimp.hxx"
-#include <sfx2/request.hxx>
-
-static const sal_uInt16 nCompatVersion = 2;
-static const sal_uInt16 nVersion = 3;
-
-// Static member
-SfxMacroConfig* SfxMacroConfig::pMacroConfig = NULL;
-
-SfxMacroConfig* SfxMacroConfig::GetOrCreate()
-{
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !pMacroConfig )
- pMacroConfig = new SfxMacroConfig;
- return pMacroConfig;
-}
-
-void SfxMacroConfig::Release_Impl()
-{
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- DELETEZ( pMacroConfig );
-}
-
-//==========================================================================
-
-struct SfxMacroConfig_Impl
-{
- SfxMacroInfoArr_Impl aArr;
- sal_uInt32 nEventId;
- sal_Bool bWaitingForCallback;
-
- SfxMacroConfig_Impl()
- : nEventId( 0 )
- , bWaitingForCallback( sal_False )
- {}
-};
-
-//==========================================================================
-
-SbMethod* SfxQueryMacro_Impl( BasicManager* pMgr , const String& rMacro,
- const String &rLibName, const String& rModule )
-{
- IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
- const CollatorWrapper* pCollator = aIntlWrapper.getCollator();
- sal_uInt16 nLibCount = pMgr->GetLibCount();
- for ( sal_uInt16 nLib = 0; nLib < nLibCount; ++nLib )
- {
- if ( COMPARE_EQUAL == pCollator->compareString( pMgr->GetLibName( nLib ), rLibName ) )
- {
- StarBASIC* pLib = pMgr->GetLib( nLib );
- if( !pLib )
- {
- pMgr->LoadLib( nLib );
- pLib = pMgr->GetLib( nLib );
- }
-
- if( pLib )
- {
- sal_uInt16 nModCount = pLib->GetModules()->Count();
- for( sal_uInt16 nMod = 0; nMod < nModCount; ++nMod )
- {
- SbModule* pMod = (SbModule*)pLib->GetModules()->Get( nMod );
- if ( pMod && COMPARE_EQUAL == pCollator->compareString( pMod->GetName(), rModule ) )
- {
- SbMethod* pMethod = (SbMethod*)pMod->Find( rMacro, SbxCLASS_METHOD );
- if( pMethod )
- return pMethod;
- }
- }
- }
- }
- }
- return 0;
-}
-
-SbMethod* SfxQueryMacro( BasicManager* pMgr , const String& rMacro )
-{
- sal_uInt16 nLast = 0;
- String aMacro = rMacro;
- String aLibName = aMacro.GetToken( 0, '.', nLast );
- String aModule = aMacro.GetToken( 0, '.', nLast );
- aMacro.Erase( 0, nLast );
-
- return SfxQueryMacro_Impl( pMgr, aMacro, aLibName, aModule );
-}
-
-ErrCode SfxCallMacro( BasicManager* pMgr, const String& rCode,
- SbxArray *pArgs, SbxValue *pRet )
-{
- ErrCode nErr;
- SfxApplication *pApp = SFX_APP();
- pApp->EnterBasicCall();
- SbMethod* pMethod = SfxQueryMacro( pMgr, rCode );
- if ( pMethod )
- {
- if ( pArgs )
- pMethod->SetParameters( pArgs );
- nErr = pMethod->Call( pRet );
- }
- else
- nErr = ERRCODE_BASIC_PROC_UNDEFINED;
-
- pApp->LeaveBasicCall();
- return nErr;
-}
-
-//==========================================================================
-
-SfxMacroInfo::SfxMacroInfo( const String& rURL ) :
- pHelpText(0),
- nRefCnt(0),
- bAppBasic(TRUE),
- nSlotId(0),
- pSlot(0)
-{
- if ( rURL.CompareToAscii( "macro:", 6 ) == COMPARE_EQUAL )
- {
- String aTmp = rURL.Copy( 6 );
- if ( aTmp.GetTokenCount('/') > 3 )
- {
- // 'macro:///lib.mod.proc(args)' => Macro via App-BASIC-Mgr
- // 'macro://[docname|.]/lib.mod.proc(args)' => Macro via zugehoerigen Doc-BASIC-Mgr
- if ( aTmp.CompareToAscii("///", 3 ) != COMPARE_EQUAL )
- bAppBasic = FALSE;
- aTmp = rURL.GetToken( 3, '/' );
- if ( aTmp.GetTokenCount('.') == 3 )
- {
- aLibName = aTmp.GetToken( 0, '.' );
- aModuleName = aTmp.GetToken( 1, '.' );
- aMethodName = aTmp.GetToken( 2, '.' );
-
- // Remove arguments to be compatible
- aMethodName.SearchAndReplaceAscii( "()", String(), sal::static_int_cast< xub_StrLen >(std::max( aMethodName.Len()-2, 0 )));
- }
- }
-
- DBG_ASSERT( aLibName.Len() && aModuleName.Len() && aMethodName.Len(), "Wrong macro URL!" );
- }
- else
- aMethodName = rURL;
-}
-
-SfxMacroInfo::SfxMacroInfo( bool _bAppBasic ) :
- pHelpText(0),
- nRefCnt(0),
- bAppBasic(_bAppBasic),
- nSlotId(0),
- pSlot(0)
-{}
-
-//==========================================================================
-
-SfxMacroInfo::SfxMacroInfo(bool _bAppBasic, const String& rLibName,
- const String& rModuleName, const String& rMethodName) :
- pHelpText(0),
- nRefCnt(0),
- bAppBasic(_bAppBasic),
- aLibName(rLibName),
- aModuleName(rModuleName),
- aMethodName(rMethodName),
- nSlotId(0),
- pSlot(0)
-{
-}
-
-//==========================================================================
-
-SfxMacroInfo::SfxMacroInfo(bool _bAppBasic, const String& rQualifiedName )
-: pHelpText(0),
- nRefCnt(0),
- bAppBasic(_bAppBasic),
- nSlotId(0),
- pSlot(0)
-{
- sal_uInt16 nCount = rQualifiedName.GetTokenCount('.');
- aMethodName = rQualifiedName.GetToken( nCount-1, '.' );
- if ( nCount > 1 )
- aModuleName = rQualifiedName.GetToken( nCount-2, '.' );
- if ( nCount > 2 )
- aLibName = rQualifiedName.GetToken( 0, '.' );
-}
-
-//==========================================================================
-
-SfxMacroInfo::SfxMacroInfo(SfxMacroInfo& rOther) :
- pHelpText(0),
- nRefCnt(0),
- bAppBasic(rOther.bAppBasic),
- aLibName(rOther.aLibName),
- aModuleName(rOther.aModuleName),
- aMethodName(rOther.aMethodName),
- nSlotId(rOther.nSlotId),
- pSlot(0)
-{}
-
-//==========================================================================
-
-SfxMacroInfo::~SfxMacroInfo()
-{
- delete pSlot;
- delete pHelpText;
-}
-
-//==========================================================================
-
-sal_Bool SfxMacroInfo::operator==(const SfxMacroInfo& rOther) const
-{
- if ( GetQualifiedName() == rOther.GetQualifiedName() &&
- bAppBasic == rOther.bAppBasic )
- return sal_True;
- else
- return sal_False;
-}
-
-//==========================================================================
-
-String SfxMacroInfo::GetMacroName() const
-{
- String aMacroName = aMethodName;
- aMacroName += '(';
- aMacroName += aLibName;
- aMacroName += '.';
- aMacroName += aModuleName;
- aMacroName += ')';
- return aMacroName;
-}
-
-//==========================================================================
-
-String SfxMacroInfo::GetQualifiedName() const
-{
- String aMacroName;
- if( aMacroName.Len() || aLibName.Len() )
- {
- // Altes Format
- aMacroName = aLibName;
- aMacroName += '.';
- aMacroName += aModuleName;
- aMacroName += '.';
- }
-
- // Wg. ::com::sun::star::script::JavaScript kein Zerlegen des Strings mehr
- aMacroName += aMethodName;
- return aMacroName;
-}
-
-String SfxMacroInfo::GetFullQualifiedName() const
-{
- // Liefert nur Unsinn, wenn f"ur ein ::com::sun::star::script::JavaScript aufgerufen !
- String aRet;
- if ( bAppBasic )
- aRet = SFX_APP()->GetName();
- aRet += '.';
- aRet += GetQualifiedName();
- return aRet;
-}
-
-String SfxMacroInfo::GetURL() const
-{
- if ( !aLibName.Len() )
- return aMethodName;
-
- // 'macro:///lib.mod.proc(args)' => Macro via App-BASIC-Mgr
- // 'macro://[docname|.]/lib.mod.proc(args)' => Macro via zugehoerigen Doc-BASIC-Mgr
- // 'macro://obj.method(args)' => Object via App-BASIC-Mgr
- String aURL( String::CreateFromAscii("macro://") );
- if ( !bAppBasic )
- aURL += '.';
- aURL += '/';
- aURL += aLibName;
- aURL += '.';
- aURL += aModuleName;
- aURL += '.';
- aURL += aMethodName;
- aURL += String::CreateFromAscii("()");
-
- return aURL;
-}
-
-//==========================================================================
-
-BasicManager* SfxMacroInfo::GetBasicManager() const
-{
- if (bAppBasic)
- {
- return SFX_APP()->GetBasicManager();
- }
- else
- {
- SfxObjectShell *pCurrDocShell = SfxObjectShell::Current();
- return pCurrDocShell ? pCurrDocShell->GetBasicManager() :
- SFX_APP()->GetBasicManager();
- }
-}
-
-//==========================================================================
-
-String SfxMacroInfo::GetBasicName() const
-{
- if (bAppBasic)
- {
- return SFX_APP()->GetName();
- }
- else
- {
- SfxObjectShell *pCurrDocShell = SfxObjectShell::Current();
- if ( pCurrDocShell )
- return pCurrDocShell->GetTitle();
- else
- return SFX_APP()->GetName();
- }
-}
-
-String SfxMacroInfo::GetHelpText() const
-{
- if ( pHelpText )
- return *pHelpText;
- return String();
-}
-
-String SfxMacroConfig::RequestHelp( sal_uInt16 nId )
-{
- SfxMacroInfo *pInfo = SFX_APP()->GetMacroConfig()->GetMacroInfo( nId );
- if ( !pInfo )
- return String();
-
- if ( !pInfo->pHelpText )
- {
- SbMethod *pMethod =
- SfxQueryMacro_Impl( pInfo->GetBasicManager(), pInfo->aMethodName,
- pInfo->aLibName, pInfo->aModuleName );
- if ( pMethod && pMethod->GetInfo() )
- pInfo->pHelpText = new String( pMethod->GetInfo()->GetComment() );
- }
-
- return pInfo->GetHelpText();
-}
-
-void SfxMacroInfo::SetHelpText( const String& rName )
-{
- if ( !pHelpText )
- pHelpText = new String;
- *pHelpText = rName;
-}
-
-//==========================================================================
-
-SvStream& operator >> (SvStream& rStream, SfxMacroInfo& rInfo)
-{
- sal_uInt16 nAppBasic, nFileVersion;
- String aDocName;
-
- rStream >> nFileVersion;
- if ( nVersion < nCompatVersion )
- {
- // In der 1.Version ohne Versionskennung
- nAppBasic = nVersion;
- nFileVersion = 1;
- rStream.ReadByteString(aDocName,RTL_TEXTENCODING_UTF8);
- rStream.ReadByteString(rInfo.aLibName,RTL_TEXTENCODING_UTF8);
- rStream.ReadByteString(rInfo.aModuleName,RTL_TEXTENCODING_UTF8);
- rStream.ReadByteString(rInfo.aMethodName,RTL_TEXTENCODING_UTF8);
- }
- else
- {
- String aInput;
- rStream >> nAppBasic;
- rStream.ReadByteString(aDocName,RTL_TEXTENCODING_UTF8); // Vorsicht: kann bei AppName Unsinn sein!
- rStream.ReadByteString(rInfo.aLibName,RTL_TEXTENCODING_UTF8);
- rStream.ReadByteString(rInfo.aModuleName,RTL_TEXTENCODING_UTF8);
- rStream.ReadByteString(aInput,RTL_TEXTENCODING_UTF8);
-
- if ( nFileVersion == nCompatVersion )
- rInfo.aMethodName = aInput;
- else
- {
- sal_uInt16 nCount = aInput.GetTokenCount('.');
- rInfo.aMethodName = aInput.GetToken( nCount-1, '.' );
- if ( nCount > 1 )
- rInfo.aModuleName = aInput.GetToken( nCount-2, '.' );
- if ( nCount > 2 )
- rInfo.aLibName = aInput.GetToken( 0, '.' );
- }
- }
-
- rInfo.bAppBasic = (sal_Bool) nAppBasic;
- return rStream;
-}
-
-int SfxMacroInfo::Load( SvStream& rStream )
-{
- rStream >> (*this);
- nSlotId = SFX_APP()->GetMacroConfig()->GetSlotId(this);
- return 0;
-}
-
-//==========================================================================
-
-SvStream& operator << (SvStream& rStream, const SfxMacroInfo& rInfo)
-{
- if ( rInfo.bAppBasic )
- {
- rStream << nVersion
- << (sal_uInt16) rInfo.bAppBasic;
- rStream.WriteByteString(rInfo.GetBasicName(),RTL_TEXTENCODING_UTF8);
- rStream.WriteByteString(rInfo.aLibName,RTL_TEXTENCODING_UTF8);
- rStream.WriteByteString(rInfo.aModuleName,RTL_TEXTENCODING_UTF8);
- rStream.WriteByteString(rInfo.aMethodName,RTL_TEXTENCODING_UTF8);
- }
- else
- {
- rStream << nVersion
- << (sal_uInt16) rInfo.bAppBasic;
- rStream.WriteByteString(SFX_APP()->GetName(),RTL_TEXTENCODING_UTF8);
- rStream.WriteByteString(rInfo.aLibName,RTL_TEXTENCODING_UTF8);
- rStream.WriteByteString(rInfo.aModuleName,RTL_TEXTENCODING_UTF8);
- rStream.WriteByteString(rInfo.aMethodName,RTL_TEXTENCODING_UTF8);
- }
-
- return rStream;
-}
-
-sal_Bool SfxMacroInfo::Compare( const SvxMacro& rMacro ) const
-{
- String aName = rMacro.GetLibName();
- aName += '.';
- aName += rMacro.GetMacName();
- if ( GetFullQualifiedName() == aName )
- return sal_True;
- return sal_False;
-}
-
-//==========================================================================
-
-SfxMacroConfig::SfxMacroConfig()
-{
- pImp = new SfxMacroConfig_Impl;
-}
-
-//==========================================================================
-
-SfxMacroConfig::~SfxMacroConfig()
-{
- if ( pImp->nEventId )
- Application::RemoveUserEvent( pImp->nEventId );
- delete pImp;
-}
-
-//==========================================================================
-
-SFX_STATE_STUB( SfxApplication, MacroState_Impl )
-SFX_EXEC_STUB( SfxApplication, MacroExec_Impl )
-
-sal_uInt16 SfxMacroConfig::GetSlotId(SfxMacroInfoPtr pInfo)
-{
- sal_uInt16 nCount = pImp->aArr.Count(); // Macro suchen
- sal_uInt16 i;
- for (i=0; i<nCount; i++)
- if ((*(pImp->aArr)[i]) == (*pInfo))
- break;
-
- if (i == nCount)
- { // Macro noch unbekannt
- nCount = aIdArray.Count();
- sal_uInt16 n;
- for (n=0; n<nCount; n++) // freie SlotId suchen
- if (aIdArray[n] > SID_MACRO_START + n)
- break;
-
- sal_uInt16 nNewSlotId = SID_MACRO_START + n;
- if ( nNewSlotId > SID_MACRO_END )
- return 0;
- aIdArray.Insert( SID_MACRO_START + n, n );
-
- SfxSlot *pNewSlot = new SfxSlot;
- pNewSlot->nSlotId = SID_MACRO_START + n;
- pNewSlot->nGroupId = 0;
- pNewSlot->nFlags = SFX_SLOT_ASYNCHRON;
- pNewSlot->nMasterSlotId = 0;
- pNewSlot->nValue = 0;
- pNewSlot->fnExec = SFX_STUB_PTR(SfxApplication,MacroExec_Impl);
- pNewSlot->fnState = SFX_STUB_PTR(SfxApplication,MacroState_Impl);
- pNewSlot->pType = 0; HACK(SFX_TYPE(SfxVoidItem))
- pNewSlot->pName = pNewSlot->pMethodName = U2S(pInfo->aMethodName).getStr();
- pNewSlot->pLinkedSlot = 0;
- pNewSlot->nArgDefCount = 0;
- pNewSlot->pFirstArgDef = 0;
- pNewSlot->pUnoName = 0;
-
- if (nCount)
- {
- SfxSlot *pSlot = (pImp->aArr)[0]->pSlot;
- pNewSlot->pNextSlot = pSlot->pNextSlot;
- pSlot->pNextSlot = pNewSlot;
- }
- else
- pNewSlot->pNextSlot = pNewSlot;
-
- // Macro uebernehmen
- SfxMacroInfoPtr pNewInfo = new SfxMacroInfo(*pInfo);
- pNewInfo->nSlotId = SID_MACRO_START + n;
- pImp->aArr.Insert(pNewInfo,n);
- pNewInfo->pSlot = pNewSlot;
- pInfo->nSlotId = pNewInfo->nSlotId;
- pNewInfo->nRefCnt++;
- }
- else
- {
- pInfo->nSlotId = (pImp->aArr)[i]->nSlotId;
- (pImp->aArr)[i]->nRefCnt++;
- }
-
- return pInfo->nSlotId;
-}
-
-//==========================================================================
-
-void SfxMacroConfig::ReleaseSlotId(sal_uInt16 nId)
-{
- DBG_ASSERT( IsMacroSlot( nId ), "SlotId ist kein Macro!");
-
- sal_uInt16 nCount = pImp->aArr.Count();
- for (sal_uInt16 i=0; i<nCount; i++)
- {
- SfxMacroInfo *pInfo = (pImp->aArr)[i];
- if (pInfo->nSlotId == nId)
- {
- pInfo->nRefCnt--;
- if (pInfo->nRefCnt == 0)
- {
- // Slot wird nicht mehr referenziert, also holen
- SfxSlot *pSlot = pInfo->pSlot;
-
- // Slot aus der Verkettung rausnehmen
- while (pSlot->pNextSlot != pInfo->pSlot)
- pSlot = (SfxSlot*) pSlot->pNextSlot;
- pSlot->pNextSlot = pInfo->pSlot->pNextSlot;
-
- // Slot selbst kurz schlie\sen
- pSlot = pInfo->pSlot;
- pSlot->pNextSlot = pSlot;
-
- // MacroInfo aus Array entfernen, damit sie kein Unheil
- // anrichten kann
- pImp->aArr.Remove(i);
-
- // SlotId wieder freigeben
- sal_uInt16 nIdCount = aIdArray.Count();
- for (sal_uInt16 n=0; n<nIdCount; n++)
- {
- if (aIdArray[n] == nId)
- {
- aIdArray.Remove(n);
- break;
- }
- }
-
- // Sofern nicht die Applikation heruntergefahren wird, mu\s
- // der Slot asynchron gel"oscht werden, falls er in seinem
- // eigenen Execute abgeschossen wird!
- if ( !SFX_APP()->Get_Impl()->bInQuit )
- pImp->nEventId = Application::PostUserEvent( LINK(this, SfxMacroConfig, EventHdl_Impl), pInfo );
- else
- EventHdl_Impl( pInfo );
- }
- return;
- }
- }
-
- DBG_ERROR("Macro-SlotId nicht gefunden!");
-}
-
-//==========================================================================
-
-void SfxMacroConfig::RegisterSlotId(sal_uInt16 nId)
-{
- DBG_ASSERT( IsMacroSlot( nId ), "SlotId ist kein Macro!");
-
- sal_uInt16 nCount = pImp->aArr.Count();
- for (sal_uInt16 i=0; i<nCount; i++)
- {
- if ((pImp->aArr)[i]->nSlotId == nId)
- {
- (pImp->aArr)[i]->nRefCnt++;
- return;
- }
- }
-
- DBG_ERROR("Macro-SlotId nicht gefunden!");
-}
-
-//==========================================================================
-
-SfxMacroInfo* SfxMacroConfig::GetMacroInfo(sal_uInt16 nId) const
-{
- sal_uInt16 nCount = pImp->aArr.Count();
- for (sal_uInt16 i=0; i<nCount; i++)
- if ((pImp->aArr)[i]->nSlotId == nId)
- return (pImp->aArr)[i];
-
- return 0;
-}
-
-//==========================================================================
-
-const SfxMacroInfo* SfxMacroConfig::GetMacroInfo_Impl( const SvxMacro *pMacro ) const
-{
- sal_uInt16 nCount = pImp->aArr.Count();
- for (sal_uInt16 i=0; i<nCount; i++)
- if ((pImp->aArr)[i]->Compare(*pMacro) )
- return (pImp->aArr)[i];
- return 0;
-}
-
-//==========================================================================
-
-sal_Bool SfxMacroConfig::ExecuteMacro( sal_uInt16 nId, const String& rArgs ) const
-{
- const SfxMacroInfo* pInfo = GetMacroInfo( nId );
- if ( !pInfo )
- return sal_False;
-
- SfxObjectShell* pSh = SfxObjectShell::Current();
-
- SvxMacro aMacro( pInfo->GetQualifiedName(), pInfo->GetBasicName(), STARBASIC );
- sal_Bool bRet = ExecuteMacro( pSh, &aMacro, rArgs );
-
- // Release, da im Dispatcher-Execute ein Register gemacht wurde
- ((SfxMacroConfig*)this)->ReleaseSlotId( nId );
- return bRet;
-}
-
-sal_Bool SfxMacroConfig::ExecuteMacro( SfxObjectShell *pSh, const SvxMacro* pMacro, const String& /*rArgs*/ ) const
-{
- SfxApplication *pApp = SFX_APP();
-
- // Name des Macros oder Scripts bzw. ScriptCode
- String aCode( pMacro->GetMacName() );
- ErrCode nErr = ERRCODE_NONE;
-
- // Ist es ein Basic-Macro ?
- ScriptType eSType = pMacro->GetScriptType();
- sal_Bool bIsBasic = eSType == STARBASIC;
- sal_Bool bIsStarScript = ( eSType == EXTENDED_STYPE && pMacro->GetLibName().SearchAscii( "StarScript" ) != STRING_NOTFOUND );
- sal_Bool bIsBasicLibBased = bIsBasic || bIsStarScript || !pSh;
-
- if ( bIsBasicLibBased )
- {
- pApp->EnterBasicCall();
- BasicManager *pAppMgr = SFX_APP()->GetBasicManager();
- if( bIsBasic )
- {
- // BasicManager von Document?
- BasicManager *pMgr = pSh ? pSh->GetBasicManager() : NULL;
-
- // Da leider der Name zwischendurch h"aufig gewechselt hat ...
- if( SFX_APP()->GetName() == pMacro->GetLibName() ||
- pMacro->GetLibName().EqualsAscii("StarDesktop") )
- pMgr = pAppMgr;
- else if ( pMgr == pAppMgr )
- pMgr = NULL;
-
- if ( pSh && pMgr && pMgr != pAppMgr )
- {
- if ( !pSh->AdjustMacroMode( String() ) )
- return sal_False;
- }
-
- if ( pSh && pMgr && pMgr == pAppMgr )
- {
- ::com::sun::star::uno::Any aOldThisComponent = pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pSh->GetModel() ) );
- nErr = Call( 0, aCode, pMgr );
- pAppMgr->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );
- }
- else if ( pMgr )
- nErr = Call( 0, aCode, pMgr );
- else
- nErr = SbxERR_NO_METHOD;
-
- }
-
- pApp->LeaveBasicCall();
- }
- else
- {
- nErr = SbxERR_NO_METHOD;
- }
-
- return ( nErr == ERRCODE_NONE );
-}
-
-sal_Bool SfxMacroConfig::CheckMacro( SfxObjectShell *pSh, const SvxMacro* pMacro ) const
-{
- SfxApplication *pApp = SFX_APP();
-
- // Name des Macros oder Scripts bzw. ScriptCode
- String aCode( pMacro->GetMacName() );
- ErrCode nErr = ERRCODE_NONE;
-
- // BasicManager von Document oder Application
- pApp->EnterBasicCall();
- BasicManager *pAppMgr = SFX_APP()->GetBasicManager();
- BasicManager *pMgr = pSh ? pSh->GetBasicManager() : NULL;
-
- // Da leider der Name zwischendurch h"aufig gewechselt hat ...
- if( SFX_APP()->GetName() == pMacro->GetLibName() ||
- pMacro->GetLibName().EqualsAscii("StarDesktop") )
- pMgr = pAppMgr;
- else if ( pMgr == pAppMgr )
- pMgr = NULL;
-
- if ( !pMgr || !SfxQueryMacro( pMgr, aCode ) )
- nErr = SbxERR_NO_METHOD;
- pApp->LeaveBasicCall();
- return ( nErr == ERRCODE_NONE );
-}
-
-//==========================================================================
-
-sal_Bool SfxMacroConfig::CheckMacro( sal_uInt16 nId ) const
-{
- const SfxMacroInfo* pInfo = GetMacroInfo( nId );
- if ( !pInfo )
- return sal_False;
-
- // Basic nur initialisieren, wenn default nicht ::com::sun::star::script::JavaScript; dann mu\s
- // in IsBasic() sowieso das Basic angelegt werden
- SfxObjectShell* pSh = SfxObjectShell::Current();
-
- SfxApplication *pApp = SFX_APP();
- pApp->EnterBasicCall();
-
- // BasicManager von Document oder Application
- BasicManager *pAppMgr = SFX_APP()->GetBasicManager();
- BasicManager *pMgr = pSh ? pSh->GetBasicManager() : NULL;
-
- if( SFX_APP()->GetName() == pInfo->GetBasicName() )
- pMgr = SFX_APP()->GetBasicManager();
- else if ( pMgr == pAppMgr )
- pMgr = NULL;
-
- String aFull( pInfo->GetQualifiedName() );
- sal_Bool bIsBasic = pMgr ? IsBasic( 0, aFull, pMgr ) : sal_False;
- pApp->LeaveBasicCall();
- return bIsBasic;
-}
-
-//==========================================================================
-
-IMPL_LINK( SfxMacroConfig, CallbackHdl_Impl, SfxMacroConfig*, pConfig )
-{
- (void)pConfig; // unused
- pImp->bWaitingForCallback = sal_False;
- return 0;
-}
-
-IMPL_LINK( SfxMacroConfig, EventHdl_Impl, SfxMacroInfo*, pInfo )
-{
- delete pInfo;
- pImp->nEventId = 0;
- return 0;
-}
-
-sal_Bool SfxMacroConfig::IsBasic(
- SbxObject* /*pVCtrl*/,
- const String& rCode,
- BasicManager* pMgr )
-{
- sal_Bool bFound;
- SFX_APP()->EnterBasicCall();
- bFound = SfxQueryMacro( pMgr, rCode ) != 0;
- SFX_APP()->LeaveBasicCall();
- return bFound;
-}
-
-ErrCode SfxMacroConfig::Call(
- SbxObject* /*pVCtrl*/,
- const String& rCode,
- BasicManager* pMgr,
- SbxArray *pArgs,
- SbxValue *pRet )
-{
- SfxApplication *pApp = SFX_APP();
- pApp->EnterBasicCall();
- SbMethod* pMethod = SfxQueryMacro( pMgr, rCode );
- ErrCode nErr = 0;
- if( pMethod )
- {
- if ( pArgs )
- pMethod->SetParameters( pArgs );
- nErr = pMethod->Call( pRet );
- }
- else
- nErr = ERRCODE_BASIC_PROC_UNDEFINED;
-
- pApp->LeaveBasicCall();
- return nErr;
-}
-
-
-sal_Bool SfxMacroConfig::IsMacroSlot( sal_uInt16 nId )
-{
- return ( nId >= SID_MACRO_START && nId <= SID_MACRO_END );
-}
-
-
diff --git a/sfx2/source/control/msgpool.cxx b/sfx2/source/control/msgpool.cxx
index 10359ba20f73..9d3661ef1bc1 100644
--- a/sfx2/source/control/msgpool.cxx
+++ b/sfx2/source/control/msgpool.cxx
@@ -40,7 +40,6 @@
#include <sfx2/app.hxx>
#include <sfx2/objface.hxx>
#include "sfxtypes.hxx"
-#include <sfx2/macrconf.hxx>
#include "sfx2/sfxresid.hxx"
#include "arrdecl.hxx"
#include <sfx2/module.hxx>
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index f3df5dc36d0c..d1605754680a 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -46,7 +46,6 @@
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
-#include "sfxbasic.hxx"
#include <sfx2/objface.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/viewsh.hxx>
@@ -55,7 +54,6 @@
#include <sfx2/request.hxx>
#include <sfx2/mnumgr.hxx>
#include "statcach.hxx"
-#include <sfx2/macrconf.hxx>
#include <sfx2/msgpool.hxx>
//====================================================================
@@ -483,7 +481,7 @@ SfxBroadcaster* SfxShell::GetBroadcaster()
//--------------------------------------------------------------------
-SfxUndoManager* SfxShell::GetUndoManager()
+::svl::IUndoManager* SfxShell::GetUndoManager()
/* [Beschreibung]
@@ -501,7 +499,7 @@ SfxUndoManager* SfxShell::GetUndoManager()
//--------------------------------------------------------------------
-void SfxShell::SetUndoManager( SfxUndoManager *pNewUndoMgr )
+void SfxShell::SetUndoManager( ::svl::IUndoManager *pNewUndoMgr )
/* [Beschreibung]
@@ -517,6 +515,12 @@ void SfxShell::SetUndoManager( SfxUndoManager *pNewUndoMgr )
*/
{
+ OSL_ENSURE( ( pUndoMgr == NULL ) || ( pNewUndoMgr == NULL ) || ( pUndoMgr == pNewUndoMgr ),
+ "SfxShell::SetUndoManager: exchanging one non-NULL manager with another non-NULL manager? Suspicious!" );
+ // there's at least one client of our UndoManager - the DocumentUndoManager at the SfxBaseModel - which
+ // caches the UndoManager, and registers itself as listener. If exchanging non-NULL UndoManagers is really
+ // a supported scenario (/me thinks it is not), then we would need to notify all such clients instances.
+
pUndoMgr = pNewUndoMgr;
if ( pUndoMgr )
pUndoMgr->SetMaxUndoActionCount( (USHORT) SvtUndoOptions().GetUndoCount() );
@@ -947,13 +951,6 @@ const SfxPoolItem* SfxShell::ExecuteSlot
pSlot = GetVerbSlot_Impl(nSlot);
if ( !pSlot )
pSlot = pIF->GetSlot(nSlot);
- if ( !pSlot && SfxMacroConfig::IsMacroSlot( nSlot ) )
- {
- SfxMacroInfo* pInfo = SFX_APP()->GetMacroConfig()->GetMacroInfo(nSlot);
- if ( pInfo )
- pSlot = pInfo->GetSlot();
- }
-
DBG_ASSERT( pSlot, "slot not supported" );
SfxExecFunc pFunc = pSlot->GetExecFnc();
@@ -1022,13 +1019,6 @@ const SfxPoolItem* SfxShell::GetSlotState
pSlot = GetVerbSlot_Impl(nSlotId);
if ( !pSlot )
pSlot = pIF->GetSlot(nSlotId);
- if ( !pSlot && SfxMacroConfig::IsMacroSlot( nSlotId ) )
- {
- SfxMacroInfo* pInfo = SFX_APP()->GetMacroConfig()->GetMacroInfo(nSlotId);
- if ( pInfo )
- pSlot = pInfo->GetSlot();
- }
-
if ( pSlot )
// ggf. auf Which-Id mappen
nSlotId = pSlot->GetWhich( rPool );
diff --git a/sfx2/source/doc/doc.hrc b/sfx2/source/doc/doc.hrc
index 7e8fd688af52..c3cbf01cfc9a 100644
--- a/sfx2/source/doc/doc.hrc
+++ b/sfx2/source/doc/doc.hrc
@@ -146,11 +146,6 @@
#define RID_CNT_STR_WAITING (RID_SFX_DOC_START+ 83)
#define STR_OBJECT (RID_SFX_DOC_START+ 84)
-#define STR_EDITOBJECT (RID_SFX_DOC_START+ 85)
-// --> PB 2004-08-20 #i33095#
-/* obsolete
-#define STR_OPENOBJECT (RID_SFX_DOC_START+ 86)
-*/
#define DLOAD_URL 1
#define DLOAD_STATUS 2
diff --git a/sfx2/source/doc/doc.src b/sfx2/source/doc/doc.src
index 497d4ccd7c97..bbf3ccb33253 100644
--- a/sfx2/source/doc/doc.src
+++ b/sfx2/source/doc/doc.src
@@ -371,19 +371,6 @@ String STR_OBJECT
Text [ en-US ] = "Object" ;
};
-String STR_EDITOBJECT
-{
- Text [ en-US ] = "~Edit";
-};
-
-// --> PB 2004-08-20 #i33095#
-/* obsolete
-String STR_OPENOBJECT
-{
- Text [ en-US ] = "~Open";
-};
-*/
-
QueryBox DLG_MACROQUERY
{
Buttons = WB_OK_CANCEL;
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 8644e79f611d..a84f4a718dc3 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -31,6 +31,7 @@
#include "doctemplates.hxx"
#include <vos/mutex.hxx>
#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
#include <tools/urlobj.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
@@ -42,6 +43,7 @@
#include <comphelper/sequenceashashmap.hxx>
#include <unotools/pathoptions.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
@@ -59,7 +61,6 @@
#include <com/sun/star/ucb/XContentAccess.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/uno/Exception.hpp>
-#include <com/sun/star/util/XOfficeInstallationDirectories.hpp>
#include <svtools/templatefoldercache.hxx>
#include <unotools/configmgr.hxx>
@@ -2876,11 +2877,35 @@ void SfxURLRelocator_Impl::initOfficeInstDirs()
}
// -----------------------------------------------------------------------
+void SfxURLRelocator_Impl::implExpandURL( ::rtl::OUString& io_url )
+{
+ const INetURLObject aParser( io_url );
+ if ( aParser.GetProtocol() != INET_PROT_VND_SUN_STAR_EXPAND )
+ return;
+
+ io_url = aParser.GetURLPath( INetURLObject::DECODE_WITH_CHARSET );
+ try
+ {
+ if ( !mxMacroExpander.is() )
+ {
+ ::comphelper::ComponentContext aContext( mxFactory );
+ mxMacroExpander.set( aContext.getSingleton( "com.sun.star.util.theMacroExpander" ), UNO_QUERY_THROW );
+ }
+ io_url = mxMacroExpander->expandMacros( io_url );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+// -----------------------------------------------------------------------
void SfxURLRelocator_Impl::makeRelocatableURL( rtl::OUString & rURL )
{
if ( rURL.getLength() > 0 )
{
initOfficeInstDirs();
+ implExpandURL( rURL );
rURL = mxOfficeInstDirs->makeRelocatableURL( rURL );
}
}
@@ -2891,6 +2916,7 @@ void SfxURLRelocator_Impl::makeAbsoluteURL( rtl::OUString & rURL )
if ( rURL.getLength() > 0 )
{
initOfficeInstDirs();
+ implExpandURL( rURL );
rURL = mxOfficeInstDirs->makeAbsoluteURL( rURL );
}
}
diff --git a/sfx2/source/doc/docundomanager.cxx b/sfx2/source/doc/docundomanager.cxx
new file mode 100755
index 000000000000..8fa7dd29ac39
--- /dev/null
+++ b/sfx2/source/doc/docundomanager.cxx
@@ -0,0 +1,457 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sfx2.hxx"
+
+#include "docundomanager.hxx"
+#include "sfx2/sfxbasemodel.hxx"
+#include "sfx2/objsh.hxx"
+#include "sfx2/viewfrm.hxx"
+#include "sfx2/viewsh.hxx"
+#include "sfx2/bindings.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/XComponent.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/anytostring.hxx>
+#include <comphelper/flagguard.hxx>
+#include <svl/undo.hxx>
+#include <tools/diagnose_ex.h>
+#include <framework/undomanagerhelper.hxx>
+
+#include <boost/noncopyable.hpp>
+#include <stack>
+
+//......................................................................................................................
+namespace sfx2
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::util::InvalidStateException;
+ using ::com::sun::star::document::EmptyUndoStackException;
+ using ::com::sun::star::util::NotLockedException;
+ using ::com::sun::star::document::UndoContextNotClosedException;
+ using ::com::sun::star::document::XUndoAction;
+ using ::com::sun::star::document::XUndoManagerSupplier;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::lang::NotInitializedException;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::document::UndoManagerEvent;
+ using ::com::sun::star::document::XUndoManagerListener;
+ using ::com::sun::star::document::UndoFailedException;
+ using ::com::sun::star::document::XUndoManager;
+ using ::com::sun::star::lang::NoSupportException;
+ using ::com::sun::star::frame::XModel;
+ /** === end UNO using === **/
+
+ using ::svl::IUndoManager;
+
+ //==================================================================================================================
+ //= DocumentUndoManager_Impl
+ //==================================================================================================================
+ struct DocumentUndoManager_Impl : public ::framework::IUndoManagerImplementation
+ {
+ DocumentUndoManager& rAntiImpl;
+ IUndoManager* pUndoManager;
+ ::framework::UndoManagerHelper aUndoHelper;
+
+ DocumentUndoManager_Impl( DocumentUndoManager& i_antiImpl )
+ :rAntiImpl( i_antiImpl )
+ ,pUndoManager( impl_retrieveUndoManager( i_antiImpl.getBaseModel() ) )
+ // do this *before* the construction of aUndoHelper (which actually means: put pUndoManager before
+ // aUndoHelper in the member list)!
+ ,aUndoHelper( *this )
+ {
+ }
+
+ const SfxObjectShell* getObjectShell() const { return rAntiImpl.getBaseModel().GetObjectShell(); }
+ SfxObjectShell* getObjectShell() { return rAntiImpl.getBaseModel().GetObjectShell(); }
+
+ // IUndoManagerImplementation
+ virtual ::svl::IUndoManager& getImplUndoManager();
+ virtual Reference< XUndoManager > getThis();
+
+ void disposing()
+ {
+ aUndoHelper.disposing();
+ ENSURE_OR_RETURN_VOID( pUndoManager, "DocumentUndoManager_Impl::disposing: already disposed!" );
+ pUndoManager = NULL;
+ }
+
+ void invalidateXDo_nolck();
+
+ private:
+ static IUndoManager* impl_retrieveUndoManager( SfxBaseModel& i_baseModel )
+ {
+ IUndoManager* pUndoManager( NULL );
+ SfxObjectShell* pObjectShell = i_baseModel.GetObjectShell();
+ if ( pObjectShell != NULL )
+ pUndoManager = pObjectShell->GetUndoManager();
+ if ( !pUndoManager )
+ throw NotInitializedException( ::rtl::OUString(), *&i_baseModel );
+ return pUndoManager;
+ }
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::svl::IUndoManager& DocumentUndoManager_Impl::getImplUndoManager()
+ {
+ ENSURE_OR_THROW( pUndoManager != NULL, "DocumentUndoManager_Impl::getImplUndoManager: no access to the doc's UndoManager implementation!" );
+
+#if OSL_DEBUG_LEVEL > 0
+ // in a non-product build, assert if the current UndoManager at the shell is not the same we obtained
+ // (and cached) at construction time
+ SfxObjectShell* pObjectShell = rAntiImpl.getBaseModel().GetObjectShell();
+ OSL_ENSURE( ( pObjectShell != NULL ) && ( pUndoManager == pObjectShell->GetUndoManager() ),
+ "DocumentUndoManager_Impl::getImplUndoManager: the UndoManager changed meanwhile - what about our listener?" );
+#endif
+
+ return *pUndoManager;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XUndoManager > DocumentUndoManager_Impl::getThis()
+ {
+ return static_cast< XUndoManager* >( &rAntiImpl );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DocumentUndoManager_Impl::invalidateXDo_nolck()
+ {
+ SfxModelGuard aGuard( rAntiImpl );
+
+ const SfxObjectShell* pDocShell = getObjectShell();
+ ENSURE_OR_THROW( pDocShell != NULL, "lcl_invalidateUndo: no access to the doc shell!" );
+ SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst( pDocShell );
+ while ( pViewFrame )
+ {
+ pViewFrame->GetBindings().Invalidate( SID_UNDO );
+ pViewFrame->GetBindings().Invalidate( SID_REDO );
+ pViewFrame = SfxViewFrame::GetNext( *pViewFrame, pDocShell );
+ }
+ }
+
+ //==================================================================================================================
+ //= SolarMutexFacade
+ //==================================================================================================================
+ /** a facade for the SolarMutex, implementing ::framework::IMutex (as opposed to ::vos::IMutex)
+ */
+ class SolarMutexFacade : public ::framework::IMutex
+ {
+ public:
+ SolarMutexFacade()
+ {
+ }
+
+ virtual void acquire()
+ {
+ Application::GetSolarMutex().acquire();
+ }
+
+ virtual void release()
+ {
+ Application::GetSolarMutex().release();
+ }
+ };
+
+ //==================================================================================================================
+ //= UndoManagerGuard
+ //==================================================================================================================
+ class UndoManagerGuard :public ::framework::IMutexGuard
+ ,public ::boost::noncopyable
+ {
+ public:
+ UndoManagerGuard( DocumentUndoManager& i_undoManager )
+ :m_guard( i_undoManager )
+ ,m_solarMutexFacade()
+ {
+ }
+
+ ~UndoManagerGuard()
+ {
+ }
+
+ virtual void reset()
+ {
+ m_guard.reset();
+ }
+
+ virtual void clear()
+ {
+ m_guard.clear();
+ }
+
+ virtual ::framework::IMutex& getGuardedMutex()
+ {
+ // note that this means that we *know* that SfxModelGuard also locks the SolarMutex (nothing more, nothing less).
+ // If this ever changes, we need to adjust this code here, too.
+ return m_solarMutexFacade;
+ }
+
+ private:
+ SfxModelGuard m_guard;
+ SolarMutexFacade m_solarMutexFacade;
+ };
+
+ //==================================================================================================================
+ //= DocumentUndoManager
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ DocumentUndoManager::DocumentUndoManager( SfxBaseModel& i_document )
+ :SfxModelSubComponent( i_document )
+ ,m_pImpl( new DocumentUndoManager_Impl( *this ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ DocumentUndoManager::~DocumentUndoManager()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DocumentUndoManager::disposing()
+ {
+ m_pImpl->disposing();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool DocumentUndoManager::isInContext() const
+ {
+ // No mutex locking within this method, no disposal check - this is the responsibility of the owner.
+ return m_pImpl->getImplUndoManager().IsInListAction();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::acquire( ) throw ()
+ {
+ SfxModelSubComponent::acquire();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::release( ) throw ()
+ {
+ SfxModelSubComponent::release();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::enterUndoContext( const ::rtl::OUString& i_title ) throw (RuntimeException)
+ {
+ // SYNCHRONIZED --->
+ UndoManagerGuard aGuard( *this );
+ m_pImpl->aUndoHelper.enterUndoContext( i_title, aGuard );
+ // <--- SYNCHRONIZED
+ m_pImpl->invalidateXDo_nolck();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::enterHiddenUndoContext( ) throw (EmptyUndoStackException, RuntimeException)
+ {
+ // SYNCHRONIZED --->
+ UndoManagerGuard aGuard( *this );
+ m_pImpl->aUndoHelper.enterHiddenUndoContext( aGuard );
+ // <--- SYNCHRONIZED
+ m_pImpl->invalidateXDo_nolck();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::leaveUndoContext( ) throw (InvalidStateException, RuntimeException)
+ {
+ // SYNCHRONIZED --->
+ UndoManagerGuard aGuard( *this );
+ m_pImpl->aUndoHelper.leaveUndoContext( aGuard );
+ // <--- SYNCHRONIZED
+ m_pImpl->invalidateXDo_nolck();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::addUndoAction( const Reference< XUndoAction >& i_action ) throw (RuntimeException, IllegalArgumentException)
+ {
+ // SYNCHRONIZED --->
+ UndoManagerGuard aGuard( *this );
+ m_pImpl->aUndoHelper.addUndoAction( i_action, aGuard );
+ // <--- SYNCHRONIZED
+ m_pImpl->invalidateXDo_nolck();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::undo( ) throw (EmptyUndoStackException, UndoContextNotClosedException, UndoFailedException, RuntimeException)
+ {
+ // SYNCHRONIZED --->
+ UndoManagerGuard aGuard( *this );
+ m_pImpl->aUndoHelper.undo( aGuard );
+ // <--- SYNCHRONIZED
+ m_pImpl->invalidateXDo_nolck();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::redo( ) throw (EmptyUndoStackException, UndoContextNotClosedException, UndoFailedException, RuntimeException)
+ {
+ // SYNCHRONIZED --->
+ UndoManagerGuard aGuard( *this );
+ m_pImpl->aUndoHelper.redo( aGuard );
+ // <--- SYNCHRONIZED
+ m_pImpl->invalidateXDo_nolck();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL DocumentUndoManager::isUndoPossible( ) throw (RuntimeException)
+ {
+ UndoManagerGuard aGuard( *this );
+ return m_pImpl->aUndoHelper.isUndoPossible();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL DocumentUndoManager::isRedoPossible( ) throw (RuntimeException)
+ {
+ UndoManagerGuard aGuard( *this );
+ return m_pImpl->aUndoHelper.isRedoPossible();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL DocumentUndoManager::getCurrentUndoActionTitle( ) throw (EmptyUndoStackException, RuntimeException)
+ {
+ UndoManagerGuard aGuard( *this );
+ return m_pImpl->aUndoHelper.getCurrentUndoActionTitle();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL DocumentUndoManager::getCurrentRedoActionTitle( ) throw (EmptyUndoStackException, RuntimeException)
+ {
+ UndoManagerGuard aGuard( *this );
+ return m_pImpl->aUndoHelper.getCurrentRedoActionTitle();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL DocumentUndoManager::getAllUndoActionTitles( ) throw (RuntimeException)
+ {
+ UndoManagerGuard aGuard( *this );
+ return m_pImpl->aUndoHelper.getAllUndoActionTitles();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL DocumentUndoManager::getAllRedoActionTitles( ) throw (RuntimeException)
+ {
+ UndoManagerGuard aGuard( *this );
+ return m_pImpl->aUndoHelper.getAllRedoActionTitles();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::clear( ) throw (UndoContextNotClosedException, RuntimeException)
+ {
+ // SYNCHRONIZED --->
+ UndoManagerGuard aGuard( *this );
+ m_pImpl->aUndoHelper.clear( aGuard );
+ // <--- SYNCHRONIZED
+ m_pImpl->invalidateXDo_nolck();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::clearRedo( ) throw (UndoContextNotClosedException, RuntimeException)
+ {
+ // SYNCHRONIZED --->
+ UndoManagerGuard aGuard( *this );
+ m_pImpl->aUndoHelper.clearRedo( aGuard );
+ // <--- SYNCHRONIZED
+ m_pImpl->invalidateXDo_nolck();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::reset() throw (RuntimeException)
+ {
+ // SYNCHRONIZED --->
+ UndoManagerGuard aGuard( *this );
+ m_pImpl->aUndoHelper.reset( aGuard );
+ // <--- SYNCHRONIZED
+ m_pImpl->invalidateXDo_nolck();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::lock( ) throw (RuntimeException)
+ {
+ UndoManagerGuard aGuard( *this );
+ m_pImpl->aUndoHelper.lock();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::unlock( ) throw (RuntimeException, NotLockedException)
+ {
+ UndoManagerGuard aGuard( *this );
+ m_pImpl->aUndoHelper.unlock();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL DocumentUndoManager::isLocked( ) throw (RuntimeException)
+ {
+ UndoManagerGuard aGuard( *this );
+ return m_pImpl->aUndoHelper.isLocked();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::addUndoManagerListener( const Reference< XUndoManagerListener >& i_listener ) throw (RuntimeException)
+ {
+ UndoManagerGuard aGuard( *this );
+ return m_pImpl->aUndoHelper.addUndoManagerListener( i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::removeUndoManagerListener( const Reference< XUndoManagerListener >& i_listener ) throw (RuntimeException)
+ {
+ UndoManagerGuard aGuard( *this );
+ return m_pImpl->aUndoHelper.removeUndoManagerListener( i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL DocumentUndoManager::getParent( ) throw (RuntimeException)
+ {
+ UndoManagerGuard aGuard( *this );
+ return static_cast< XModel* >( &getBaseModel() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DocumentUndoManager::setParent( const Reference< XInterface >& i_parent ) throw (NoSupportException, RuntimeException)
+ {
+ (void)i_parent;
+ throw NoSupportException( ::rtl::OUString(), m_pImpl->getThis() );
+ }
+
+//......................................................................................................................
+} // namespace sfx2
+//......................................................................................................................
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index bceb7477a61e..2ccf5fa7a849 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -747,7 +747,7 @@ sal_Int8 ModelData_Impl::CheckFilter( const ::rtl::OUString& aFilterName )
return STATUS_SAVEAS_STANDARDNAME;
}
else if ( ( !( nFiltFlags & SFX_FILTER_OWN ) || ( nFiltFlags & SFX_FILTER_ALIEN ) )
- && !( nFiltFlags & SFX_FILTER_SILENTEXPORT ) && aDefFiltPropsHM.size()
+ && aDefFiltPropsHM.size()
&& ( nDefFiltFlags & SFX_FILTER_EXPORT ) && !( nDefFiltFlags & SFX_FILTER_INTERNAL ))
{
// the default filter is acceptable and the old filter is alian one
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 71c7e0e78383..3b27db855e39 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -118,6 +118,7 @@ using namespace ::com::sun::star::container;
#include <rtl/bootstrap.hxx>
#include <vcl/svapp.hxx>
#include <framework/interaction.hxx>
+#include <framework/documentundoguard.hxx>
#include <comphelper/interaction.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/documentconstants.hxx>
@@ -141,7 +142,6 @@ using namespace ::com::sun::star::container;
#include <sfx2/ctrlitem.hxx>
#include "arrdecl.hxx"
#include <sfx2/module.hxx>
-#include <sfx2/macrconf.hxx>
#include <sfx2/docfac.hxx>
#include "helper.hxx"
#include "doc.hrc"
@@ -1652,15 +1652,8 @@ SfxModule* SfxObjectShell::GetModule() const
return GetFactory().GetModule();
}
-sal_Bool SfxObjectShell::IsBasic(
- const String & rCode, SbxObject * pVCtrl )
-{
- if( !rCode.Len() ) return sal_False;
- return SfxMacroConfig::IsBasic( pVCtrl, rCode, GetBasicManager() );
-}
-
ErrCode SfxObjectShell::CallBasic( const String& rMacro,
- const String& rBasic, SbxObject* pVCtrl, SbxArray* pArgs,
+ const String& rBasic, SbxArray* pArgs,
SbxValue* pRet )
{
SfxApplication* pApp = SFX_APP();
@@ -1670,23 +1663,13 @@ ErrCode SfxObjectShell::CallBasic( const String& rMacro,
return ERRCODE_IO_ACCESSDENIED;
}
- pApp->EnterBasicCall();
BasicManager *pMgr = GetBasicManager();
if( pApp->GetName() == rBasic )
pMgr = pApp->GetBasicManager();
- ErrCode nRet = SfxMacroConfig::Call( pVCtrl, rMacro, pMgr, pArgs, pRet );
- pApp->LeaveBasicCall();
+ ErrCode nRet = SfxApplication::CallBasic( rMacro, pMgr, pArgs, pRet );
return nRet;
}
-ErrCode SfxObjectShell::Call( const String & rCode, sal_Bool bIsBasicReturn, SbxObject * pVCtrl )
-{
- ErrCode nErr = ERRCODE_NONE;
- if ( bIsBasicReturn )
- CallBasic( rCode, String(), pVCtrl );
- return nErr;
-}
-
namespace
{
static bool lcl_isScriptAccessAllowed_nothrow( const Reference< XInterface >& _rxScriptContext )
@@ -1740,9 +1723,11 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon
xScriptProvider.set( xScriptProviderFactory->createScriptProvider( makeAny( _rxScriptContext ) ), UNO_SET_THROW );
}
+ // ry to protect the invocation context's undo manager (if present), just in case the script tampers with it
+ ::framework::DocumentUndoGuard aUndoGuard( _rxScriptContext.get() );
+
// obtain the script, and execute it
Reference< provider::XScript > xScript( xScriptProvider->getScript( _rScriptURL ), UNO_QUERY_THROW );
-
aRet = xScript->invoke( aParams, aOutParamIndex, aOutParam );
}
catch ( const uno::Exception& )
@@ -1782,118 +1767,6 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL,
}
//-------------------------------------------------------------------------
-namespace {
- using namespace ::com::sun::star::uno;
-
- //.....................................................................
- static SbxArrayRef lcl_translateUno2Basic( const void* _pAnySequence )
- {
- SbxArrayRef xReturn;
- if ( _pAnySequence )
- {
- // in real it's a sequence of Any (by convention)
- const Sequence< Any >* pArguments = static_cast< const Sequence< Any >* >( _pAnySequence );
-
- // do we have arguments ?
- if ( pArguments->getLength() )
- {
- // yep
- xReturn = new SbxArray;
- String sEmptyName;
-
- // loop through the sequence
- const Any* pArg = pArguments->getConstArray();
- const Any* pArgEnd = pArg + pArguments->getLength();
-
- for ( sal_uInt16 nArgPos=1; pArg != pArgEnd; ++pArg, ++nArgPos )
- // and create a Sb object for every Any
- xReturn->Put( GetSbUnoObject( sEmptyName, *pArg ), nArgPos );
- }
- }
- return xReturn;
- }
- //.....................................................................
- void lcl_translateBasic2Uno( const SbxVariableRef& _rBasicValue, void* _pAny )
- {
- if ( _pAny )
- *static_cast< Any* >( _pAny ) = sbxToUnoValue( _rBasicValue );
- }
-}
-//-------------------------------------------------------------------------
-ErrCode SfxObjectShell::CallStarBasicScript( const String& _rMacroName, const String& _rLocation,
- const void* _pArguments, void* _pReturn )
-{
- OSL_TRACE("in CallSBS");
- ::vos::OClearableGuard aGuard( Application::GetSolarMutex() );
-
- // the arguments for the call
- SbxArrayRef xMacroArguments = lcl_translateUno2Basic( _pArguments );
-
- // the return value
- SbxVariableRef xReturn = _pReturn ? new SbxVariable : NULL;
-
- // the location (document or application)
- String sMacroLocation;
- if ( _rLocation.EqualsAscii( "application" ) )
- sMacroLocation = SFX_APP()->GetName();
-#ifdef DBG_UTIL
- else
- DBG_ASSERT( _rLocation.EqualsAscii( "document" ),
- "SfxObjectShell::CallStarBasicScript: invalid (unknown) location!" );
-#endif
-
- // call the script
- ErrCode eError = CallBasic( _rMacroName, sMacroLocation, NULL, xMacroArguments, xReturn );
-
- // translate the return value
- lcl_translateBasic2Uno( xReturn, _pReturn );
-
- // outta here
- return eError;
-}
-
-//-------------------------------------------------------------------------
-ErrCode SfxObjectShell::CallScript(
- const String & rScriptType,
- const String & rCode,
- const void *pArgs,
- void *pRet
-)
-{
- ::vos::OClearableGuard aGuard( Application::GetSolarMutex() );
- ErrCode nErr = ERRCODE_NONE;
- if( rScriptType.EqualsAscii( "StarBasic" ) )
- {
- // the arguments for the call
- SbxArrayRef xMacroArguments = lcl_translateUno2Basic( pArgs );
-
- // the return value
- SbxVariableRef xReturn = pRet ? new SbxVariable : NULL;
-
- // call the script
- nErr = CallBasic( rCode, String(), NULL, xMacroArguments, xReturn );
-
- // translate the return value
- lcl_translateBasic2Uno( xReturn, pRet );
-
- // did this fail because the method was not found?
- if ( nErr == ERRCODE_BASIC_PROC_UNDEFINED )
- { // yep-> look in the application BASIC module
- nErr = CallBasic( rCode, SFX_APP()->GetName(), NULL, xMacroArguments, xReturn );
- }
- }
- else if( rScriptType.EqualsAscii( "JavaScript" ) )
- {
- DBG_ERROR( "JavaScript not allowed" );
- return 0;
- }
- else
- {
- DBG_ERROR( "StarScript not allowed" );
- }
- return nErr;
-}
-
SfxFrame* SfxObjectShell::GetSmartSelf( SfxFrame* pSelf, SfxMedium& /*rMedium*/ )
{
return pSelf;
@@ -1911,51 +1784,6 @@ void SfxObjectShell::SetFlags( SfxObjectShellFlags eFlags )
pImp->eFlags = eFlags;
}
-/*
-void SfxObjectShell::SetBaseURL( const String& rURL )
-{
- pImp->aBaseURL = rURL;
- pImp->bNoBaseURL = FALSE;
-}
-
-const String& SfxObjectShell::GetBaseURLForSaving() const
-{
- if ( pImp->bNoBaseURL )
- return String();
- return GetBaseURL();
-}
-
-const String& SfxObjectShell::GetBaseURL() const
-{
- if ( pImp->aBaseURL.Len() )
- return pImp->aBaseURL;
- return pMedium->GetBaseURL();
-}
-
-void SfxObjectShell::SetEmptyBaseURL()
-{
- pImp->bNoBaseURL = TRUE;
-}
-*/
-String SfxObjectShell::QueryTitle( SfxTitleQuery eType ) const
-{
- String aRet;
-
- switch( eType )
- {
- case SFX_TITLE_QUERY_SAVE_NAME_PROPOSAL:
- {
- SfxMedium* pMed = GetMedium();
- const INetURLObject aObj( pMed->GetName() );
- aRet = aObj.GetMainURL( INetURLObject::DECODE_TO_IURI );
- if ( !aRet.Len() )
- aRet = GetTitle( SFX_TITLE_CAPTION );
- break;
- }
- }
- return aRet;
-}
-
void SfxHeaderAttributes_Impl::SetAttributes()
{
bAlert = sal_True;
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index c9b5e6f37293..e53e7148e561 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1089,13 +1089,6 @@ void SfxObjectShell::ExecProps_Impl(SfxRequest &rReq)
rReq.Done();
break;
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- case SID_PLAYMACRO:
- {
- SFX_APP()->PlayMacro_Impl( rReq, GetBasic() );
- break;
- }
-
case SID_DOCINFO_AUTHOR :
{
::rtl::OUString aStr = ( (SfxStringItem&)rReq.GetArgs()->Get(rReq.GetSlot())).GetValue();
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 0575660877a3..60921e825e20 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -3025,7 +3025,7 @@ sal_Bool SfxObjectShell::IsInformationLost()
{
const SfxFilter *pFilt = GetMedium()->GetFilter();
DBG_ASSERT( pFilt && aFilterName.equals( pFilt->GetName() ), "MediaDescriptor contains wrong filter!\n" );
- return ( pFilt && pFilt->IsAlienFormat() && !(pFilt->GetFilterFlags() & SFX_FILTER_SILENTEXPORT ) );
+ return ( pFilt && pFilt->IsAlienFormat() );
}
return sal_False;
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index d24a95332b58..13a42e3721c4 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -127,6 +127,7 @@
#include "sfx2/docstoragemodifylistener.hxx"
#include "sfx2/brokenpackageint.hxx"
#include "graphhelp.hxx"
+#include "docundomanager.hxx"
#include <sfx2/msgpool.hxx>
#include <sfx2/DocumentMetadataAccess.hxx>
@@ -153,6 +154,10 @@ using ::com::sun::star::lang::WrappedTargetException;
using ::com::sun::star::uno::Type;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::document::XDocumentRecovery;
+using ::com::sun::star::document::XUndoManager;
+using ::com::sun::star::document::XUndoAction;
+using ::com::sun::star::document::UndoFailedException;
+using ::com::sun::star::frame::XModel;
/** This Listener is used to get notified when the XDocumentProperties of the
XModel change.
@@ -221,15 +226,17 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
sal_Bool m_bSaving ;
sal_Bool m_bSuicide ;
sal_Bool m_bInitialized ;
+ sal_Bool m_bExternalTitle ;
sal_Bool m_bModifiedSinceLastSave;
uno::Reference< com::sun::star::view::XPrintable> m_xPrintable ;
uno::Reference< script::provider::XScriptProvider > m_xScriptProvider;
uno::Reference< ui::XUIConfigurationManager > m_xUIConfigurationManager;
::rtl::Reference< ::sfx2::DocumentStorageModifyListener > m_pStorageModifyListen;
- ::rtl::OUString m_sModuleIdentifier;
+ ::rtl::OUString m_sModuleIdentifier;
css::uno::Reference< css::frame::XTitle > m_xTitleHelper;
css::uno::Reference< css::frame::XUntitledNumbers > m_xNumberedControllers;
- uno::Reference< rdf::XDocumentMetadataAccess> m_xDocumentMetadata;
+ uno::Reference< rdf::XDocumentMetadataAccess> m_xDocumentMetadata;
+ ::rtl::Reference< ::sfx2::DocumentUndoManager > m_pDocumentUndoManager;
IMPL_SfxBaseModel_DataContainer( ::osl::Mutex& rMutex, SfxObjectShell* pObjectShell )
@@ -241,11 +248,13 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
, m_bSaving ( sal_False )
, m_bSuicide ( sal_False )
, m_bInitialized ( sal_False )
+ , m_bExternalTitle ( sal_False )
, m_bModifiedSinceLastSave( sal_False )
, m_pStorageModifyListen ( NULL )
, m_xTitleHelper ()
, m_xNumberedControllers ()
, m_xDocumentMetadata () // lazy
+ , m_pDocumentUndoManager ()
{
// increase global instance counter.
++g_nInstanceCounter;
@@ -786,6 +795,12 @@ void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeExcept
m_pData->m_pStorageModifyListen = NULL;
}
+ if ( m_pData->m_pDocumentUndoManager.is() )
+ {
+ m_pData->m_pDocumentUndoManager->disposing();
+ m_pData->m_pDocumentUndoManager = NULL;
+ }
+
lang::EventObject aEvent( (frame::XModel *)this );
m_pData->m_aInterfaceContainer.disposeAndClear( aEvent );
@@ -1183,6 +1198,51 @@ void SAL_CALL SfxBaseModel::disconnectController( const uno::Reference< frame::X
m_pData->m_xCurrent = uno::Reference< frame::XController > ();
}
+namespace
+{
+ typedef ::cppu::WeakImplHelper1< XUndoAction > ControllerLockUndoAction_Base;
+ class ControllerLockUndoAction : public ControllerLockUndoAction_Base
+ {
+ public:
+ ControllerLockUndoAction( const Reference< XModel >& i_model, const bool i_undoIsUnlock )
+ :m_xModel( i_model )
+ ,m_bUndoIsUnlock( i_undoIsUnlock )
+ {
+ }
+
+ // XUndoAction
+ virtual ::rtl::OUString SAL_CALL getTitle() throw (RuntimeException);
+ virtual void SAL_CALL undo( ) throw (UndoFailedException, RuntimeException);
+ virtual void SAL_CALL redo( ) throw (UndoFailedException, RuntimeException);
+
+ private:
+ const Reference< XModel > m_xModel;
+ const bool m_bUndoIsUnlock;
+ };
+
+ ::rtl::OUString SAL_CALL ControllerLockUndoAction::getTitle() throw (RuntimeException)
+ {
+ // this action is intended to be used within an UndoContext only, so nobody will ever see this title ...
+ return ::rtl::OUString();
+ }
+
+ void SAL_CALL ControllerLockUndoAction::undo( ) throw (UndoFailedException, RuntimeException)
+ {
+ if ( m_bUndoIsUnlock )
+ m_xModel->unlockControllers();
+ else
+ m_xModel->lockControllers();
+ }
+
+ void SAL_CALL ControllerLockUndoAction::redo( ) throw (UndoFailedException, RuntimeException)
+ {
+ if ( m_bUndoIsUnlock )
+ m_xModel->lockControllers();
+ else
+ m_xModel->unlockControllers();
+ }
+}
+
//________________________________________________________________________________________________________
// frame::XModel
//________________________________________________________________________________________________________
@@ -1192,6 +1252,14 @@ void SAL_CALL SfxBaseModel::lockControllers() throw(::com::sun::star::uno::Runti
SfxModelGuard aGuard( *this );
++m_pData->m_nControllerLockCount ;
+
+ if ( m_pData->m_pDocumentUndoManager.is()
+ && m_pData->m_pDocumentUndoManager->isInContext()
+ && !m_pData->m_pDocumentUndoManager->isLocked()
+ )
+ {
+ m_pData->m_pDocumentUndoManager->addUndoAction( new ControllerLockUndoAction( this, true ) );
+ }
}
//________________________________________________________________________________________________________
@@ -1203,6 +1271,14 @@ void SAL_CALL SfxBaseModel::unlockControllers() throw(::com::sun::star::uno::Run
SfxModelGuard aGuard( *this );
--m_pData->m_nControllerLockCount ;
+
+ if ( m_pData->m_pDocumentUndoManager.is()
+ && m_pData->m_pDocumentUndoManager->isInContext()
+ && !m_pData->m_pDocumentUndoManager->isLocked()
+ )
+ {
+ m_pData->m_pDocumentUndoManager->addUndoAction( new ControllerLockUndoAction( this, false ) );
+ }
}
//________________________________________________________________________________________________________
@@ -1644,6 +1720,17 @@ void SAL_CALL SfxBaseModel::storeAsURL( const ::rtl::OUString&
}
//________________________________________________________________________________________________________
+// XUndoManagerSupplier
+//________________________________________________________________________________________________________
+Reference< XUndoManager > SAL_CALL SfxBaseModel::getUndoManager( ) throw (RuntimeException)
+{
+ SfxModelGuard aGuard( *this );
+ if ( !m_pData->m_pDocumentUndoManager.is() )
+ m_pData->m_pDocumentUndoManager.set( new ::sfx2::DocumentUndoManager( *this ) );
+ return m_pData->m_pDocumentUndoManager.get();
+}
+
+//________________________________________________________________________________________________________
// XStorable
//________________________________________________________________________________________________________
@@ -3747,7 +3834,7 @@ css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitl
SfxModelGuard aGuard( *this );
::rtl::OUString aResult = impl_getTitleHelper()->getTitle ();
- if ( m_pData->m_pObjectShell )
+ if ( !m_pData->m_bExternalTitle && m_pData->m_pObjectShell )
{
SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
if ( pMedium )
@@ -3757,7 +3844,7 @@ css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitl
aResult += String( SfxResId(STR_REPAIREDDOCUMENT) );
}
- if ( m_pData->m_pObjectShell->IsReadOnlyUI() || (m_pData->m_pObjectShell->GetMedium() && m_pData->m_pObjectShell->GetMedium()->IsReadOnly()) )
+ if ( m_pData->m_pObjectShell->IsReadOnlyUI() || (pMedium && pMedium->IsReadOnly()) )
aResult += ::rtl::OUString( String( SfxResId(STR_READONLY) ) );
else if ( m_pData->m_pObjectShell->IsDocShared() )
aResult += ::rtl::OUString( String( SfxResId(STR_SHARED) ) );
@@ -3778,6 +3865,7 @@ void SAL_CALL SfxBaseModel::setTitle( const ::rtl::OUString& sTitle )
SfxModelGuard aGuard( *this );
impl_getTitleHelper()->setTitle (sTitle);
+ m_pData->m_bExternalTitle = sal_True;
}
//=============================================================================
@@ -4371,3 +4459,16 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
return xDMA->storeMetadataToMedium(i_rMedium);
}
+// =====================================================================================================================
+// = SfxModelSubComponent
+// =====================================================================================================================
+
+SfxModelSubComponent::~SfxModelSubComponent()
+{
+}
+
+void SfxModelSubComponent::disposing()
+{
+ // nothing to do here
+}
+
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index bd12f3db80dc..1b3a943c4690 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -116,7 +116,6 @@ public:
// global pointers
SfxItemPool* pPool;
- SfxEventConfiguration* pEventConfig;
SvUShorts* pDisabledSlotList;
SvStrings* pSecureURLs;
SvtSaveOptions* pSaveOptions;
@@ -129,7 +128,6 @@ public:
USHORT nDocModalMode; // counts documents in modal mode
USHORT nAutoTabPageId;
- USHORT nBasicCallLevel;
USHORT nRescheduleLocks;
USHORT nInReschedule;
USHORT nAsynchronCalls;
diff --git a/sfx2/source/inc/docundomanager.hxx b/sfx2/source/inc/docundomanager.hxx
new file mode 100755
index 000000000000..9b37671662fd
--- /dev/null
+++ b/sfx2/source/inc/docundomanager.hxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef DOCUMENT_UNDO_MANAGER_HXX
+#define DOCUMENT_UNDO_MANAGER_HXX
+
+#include "sfx2/sfxbasemodel.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/document/XUndoManager.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/noncopyable.hpp>
+
+namespace svl
+{
+ class IUndoManager;
+}
+
+//......................................................................................................................
+namespace sfx2
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= DocumentUndoManager
+ //==================================================================================================================
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::document::XUndoManager
+ > DocumentUndoManager_Base;
+ struct DocumentUndoManager_Impl;
+ class DocumentUndoManager :public DocumentUndoManager_Base
+ ,public SfxModelSubComponent
+ ,public ::boost::noncopyable
+ {
+ friend struct DocumentUndoManager_Impl;
+
+ public:
+ DocumentUndoManager( SfxBaseModel& i_document );
+ virtual ~DocumentUndoManager();
+
+ // SfxModelSubComponent overridables
+ virtual void disposing();
+
+ // non-UNO API for our owner
+ /** determines whether we have an open Undo context. No mutex locking within this method, no disposal check - this
+ is the responsibility of the owner.
+ */
+ bool isInContext() const;
+
+ // XInterface
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ // XUndoManager
+ virtual void SAL_CALL enterUndoContext( const ::rtl::OUString& i_title ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL enterHiddenUndoContext( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL leaveUndoContext( ) throw (::com::sun::star::util::InvalidStateException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addUndoAction( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoAction >& i_action ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL undo( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL redo( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isUndoPossible( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isRedoPossible( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCurrentUndoActionTitle( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCurrentRedoActionTitle( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllUndoActionTitles( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllRedoActionTitles( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clear( ) throw (::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearRedo( ) throw (::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL reset( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XLockable, base of XUndoManager
+ virtual void SAL_CALL lock( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL unlock( ) throw (::com::sun::star::util::NotLockedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isLocked( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XChild, base of XUndoManager
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+
+ private:
+ ::boost::scoped_ptr< DocumentUndoManager_Impl > m_pImpl;
+ };
+
+//......................................................................................................................
+} // namespace sfx2
+//......................................................................................................................
+
+#endif // DOCUMENT_UNDO_MANAGER_HXX
diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx
index e012eea39c2d..83ed69ccb78e 100644
--- a/sfx2/source/inc/eventsupplier.hxx
+++ b/sfx2/source/inc/eventsupplier.hxx
@@ -57,6 +57,11 @@
#include <svl/lstner.hxx>
#include <unotools/eventcfg.hxx>
+namespace comphelper
+{
+ class NamedValueCollection;
+}
+
//--------------------------------------------------------------------------------------------------------
#define NOSUCHELEMENTEXCEPTION ::com::sun::star::container::NoSuchElementException
@@ -125,8 +130,12 @@ public:
virtual void SAL_CALL disposing( const EVENTOBJECT& Source )
throw( RUNTIMEEXCEPTION );
- static SvxMacro* ConvertToMacro( const ANY& rElement, SfxObjectShell* pDoc, BOOL bBlowUp );
- static void BlowUpMacro( const ANY& rIn, ANY& rOut, SfxObjectShell* pDoc );
+ static SvxMacro* ConvertToMacro( const ANY& rElement, SfxObjectShell* pDoc, BOOL bNormalizeMacro );
+ static void NormalizeMacro( const ANY& rIn, ANY& rOut, SfxObjectShell* pDoc );
+ static void NormalizeMacro(
+ const ::comphelper::NamedValueCollection& i_eventDescriptor,
+ ::comphelper::NamedValueCollection& o_normalizedDescriptor,
+ SfxObjectShell* i_document );
};
//=============================================================================
diff --git a/sfx2/source/inc/sfxurlrelocator.hxx b/sfx2/source/inc/sfxurlrelocator.hxx
index 8acc674b3568..5ab1125b7cb6 100644
--- a/sfx2/source/inc/sfxurlrelocator.hxx
+++ b/sfx2/source/inc/sfxurlrelocator.hxx
@@ -30,6 +30,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/util/XOfficeInstallationDirectories.hpp>
+#include <com/sun/star/util/XMacroExpander.hpp>
#include <rtl/ustring.hxx>
#include <osl/mutex.hxx>
@@ -39,6 +40,7 @@ class SfxURLRelocator_Impl
::osl::Mutex maMutex;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxFactory;
::com::sun::star::uno::Reference< ::com::sun::star::util::XOfficeInstallationDirectories > mxOfficeInstDirs;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XMacroExpander > mxMacroExpander;
public:
static bool propertyCanContainOfficeDir( const rtl::OUString & rPropName );
@@ -48,6 +50,9 @@ public:
SfxURLRelocator_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory );
~SfxURLRelocator_Impl();
+
+private:
+ void implExpandURL( ::rtl::OUString& io_url );
};
#endif
diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx
index f101b0d426b9..3d2f2db47def 100644
--- a/sfx2/source/menu/mnuitem.cxx
+++ b/sfx2/source/menu/mnuitem.cxx
@@ -64,7 +64,6 @@
#include <sfx2/dispatch.hxx>
#include "idpool.hxx"
#include "sfxtypes.hxx"
-#include <sfx2/macrconf.hxx>
#include "virtmenu.hxx"
#include <sfx2/mnuitem.hxx>
#include <sfx2/tbxctrl.hxx>
@@ -232,8 +231,6 @@ SfxMenuControl::SfxMenuControl(USHORT nSlotId, SfxBindings& rBindings):
SfxMenuControl::~SfxMenuControl()
{
- if ( SfxMacroConfig::IsMacroSlot( GetId() ) )
- SFX_APP()->GetMacroConfig()->ReleaseSlotId(GetId());
delete pSubMenu;
}
diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx
index 77dbd0dcb885..f1eadf744863 100755
--- a/sfx2/source/menu/mnumgr.cxx
+++ b/sfx2/source/menu/mnumgr.cxx
@@ -77,7 +77,6 @@
#include <sfx2/bindings.hxx>
#include "mnucfga.hxx"
#include "sfx2/sfxresid.hxx"
-#include <sfx2/macrconf.hxx>
#include <sfx2/msgpool.hxx>
#include <sfx2/sfx.hrc>
#include "menu.hrc"
diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx
index f0408a66a408..b60681e95afa 100644
--- a/sfx2/source/menu/virtmenu.cxx
+++ b/sfx2/source/menu/virtmenu.cxx
@@ -54,7 +54,6 @@
#include <sfx2/sfx.hrc>
#include <sfx2/viewsh.hxx>
#include "sfxpicklist.hxx"
-#include <sfx2/macrconf.hxx>
#include "sfx2/sfxresid.hxx"
#include "menu.hrc"
#include "sfx2/imagemgr.hxx"
@@ -476,24 +475,6 @@ void SfxVirtualMenu::CreateFromSVMenu()
{
SfxMenuControl *pMnuCtrl=0;
String aCmd( pSVMenu->GetItemCommand( nSlotId ) );
- if ( aCmd.CompareToAscii("slot:", 5) == 0 )
- {
- SfxMacroConfig* pCfg = SFX_APP()->GetMacroConfig();
- if ( pCfg->IsMacroSlot( nSlotId ) )
- {
- if ( pCfg->GetMacroInfo( nSlotId ) )
- {
- pCfg->RegisterSlotId( nSlotId );
- pSVMenu->SetItemCommand( nSlotId, String() );
- aCmd.Erase();
- }
- else
- {
- pSVMenu->SetItemCommand( nSlotId, String::CreateFromAscii("macro:///macro.not.founc") );
- }
- }
- }
-
if ( aCmd.Len() && (( nSlotId < SID_SFX_START ) || ( nSlotId > SHRT_MAX )) )
{
// try to create control via comand name
diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx
index 1ca10c6d9390..9ffc2200cfe8 100644
--- a/sfx2/source/notify/eventsupplier.cxx
+++ b/sfx2/source/notify/eventsupplier.cxx
@@ -48,6 +48,7 @@
#include <unotools/securityoptions.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/namedvaluecollection.hxx>
#include "eventsupplier.hxx"
#include <sfx2/app.hxx>
@@ -88,9 +89,9 @@ void SAL_CALL SfxEvents_Impl::replaceByName( const OUSTRING & aName, const ANY &
{
if ( maEventNames[i] == aName )
{
- Sequence< PropertyValue > aProperties;
+ const ::comphelper::NamedValueCollection aEventDescriptor( rElement );
// check for correct type of the element
- if ( rElement.hasValue() && !( rElement >>= aProperties ) )
+ if ( rElement.hasValue() && aEventDescriptor.empty() )
throw ILLEGALARGUMENTEXCEPTION();
// create Configuration at first, creation might call this method also and that would overwrite everything
@@ -98,31 +99,27 @@ void SAL_CALL SfxEvents_Impl::replaceByName( const OUSTRING & aName, const ANY &
if ( mpObjShell && !mpObjShell->IsLoading() )
mpObjShell->SetModified( TRUE );
- if ( aProperties.getLength() )
+ ::comphelper::NamedValueCollection aNormalizedDescriptor;
+ NormalizeMacro( aEventDescriptor, aNormalizedDescriptor, mpObjShell );
+
+ ::rtl::OUString sType;
+ if ( ( aNormalizedDescriptor.size() == 1 )
+ && ( aNormalizedDescriptor.has( PROP_EVENT_TYPE ) == 0 )
+ && ( aNormalizedDescriptor.get( PROP_EVENT_TYPE ) >>= sType )
+ && ( sType.getLength() == 0 )
+ )
{
- // "normalize" the macro descriptor
- ANY aValue;
- BlowUpMacro( rElement, aValue, mpObjShell );
- aValue >>= aProperties;
-
- ::rtl::OUString sType;
- if ( ( aProperties.getLength() == 1 )
- && ( aProperties[0].Name.compareToAscii( PROP_EVENT_TYPE ) == 0 )
- && ( aProperties[0].Value >>= sType )
- && ( sType.getLength() == 0 )
- )
- {
- // An empty event type means no binding. Therefore reset data
- // to reflect that state.
- // (that's for compatibility only. Nowadays, the Tools/Customize dialog should
- // set an empty sequence to indicate the request for resetting the assignment.)
- aProperties.realloc( 0 );
- }
+ // An empty event type means no binding. Therefore reset data
+ // to reflect that state.
+ // (that's for compatibility only. Nowadays, the Tools/Customize dialog should
+ // set an empty sequence to indicate the request for resetting the assignment.)
+ OSL_ENSURE( false, "legacy event assignment format detected" );
+ aNormalizedDescriptor.clear();
}
- if ( aProperties.getLength() )
+ if ( !aNormalizedDescriptor.empty() )
{
- maEventData[i] = makeAny( aProperties );
+ maEventData[i] <<= aNormalizedDescriptor.getPropertyValues();
}
else
{
@@ -378,13 +375,13 @@ SfxEvents_Impl::~SfxEvents_Impl()
}
//--------------------------------------------------------------------------------------------------------
-SvxMacro* SfxEvents_Impl::ConvertToMacro( const ANY& rElement, SfxObjectShell* pObjShell, BOOL bBlowUp )
+SvxMacro* SfxEvents_Impl::ConvertToMacro( const ANY& rElement, SfxObjectShell* pObjShell, BOOL bNormalizeMacro )
{
SvxMacro* pMacro = NULL;
SEQUENCE < PROPERTYVALUE > aProperties;
ANY aAny;
- if ( bBlowUp )
- BlowUpMacro( rElement, aAny, pObjShell );
+ if ( bNormalizeMacro )
+ NormalizeMacro( rElement, aAny, pObjShell );
else
aAny = rElement;
@@ -444,58 +441,38 @@ SvxMacro* SfxEvents_Impl::ConvertToMacro( const ANY& rElement, SfxObjectShell* p
return pMacro;
}
-void SfxEvents_Impl::BlowUpMacro( const ANY& rEvent, ANY& rRet, SfxObjectShell* pDoc )
+void SfxEvents_Impl::NormalizeMacro( const ANY& rEvent, ANY& rRet, SfxObjectShell* pDoc )
{
- if ( !pDoc )
- pDoc = SfxObjectShell::Current();
-
- SEQUENCE < PROPERTYVALUE > aInProps;
- SEQUENCE < PROPERTYVALUE > aOutProps(2);
-
- if ( !( rEvent >>= aInProps ) )
- return;
+ const ::comphelper::NamedValueCollection aEventDescriptor( rEvent );
+ ::comphelper::NamedValueCollection aEventDescriptorOut;
- sal_Int32 nCount = aInProps.getLength();
+ NormalizeMacro( aEventDescriptor, aEventDescriptorOut, pDoc );
- if ( !nCount )
- return;
+ rRet <<= aEventDescriptorOut.getPropertyValues();
+}
- OUSTRING aType;
- OUSTRING aScript;
- OUSTRING aLibrary;
- OUSTRING aMacroName;
+void SfxEvents_Impl::NormalizeMacro( const ::comphelper::NamedValueCollection& i_eventDescriptor,
+ ::comphelper::NamedValueCollection& o_normalizedDescriptor, SfxObjectShell* i_document )
+{
+ SfxObjectShell* pDoc = i_document;
+ if ( !pDoc )
+ pDoc = SfxObjectShell::Current();
- sal_Int32 nIndex = 0;
+ ::rtl::OUString aType = i_eventDescriptor.getOrDefault( PROP_EVENT_TYPE, ::rtl::OUString() );
+ ::rtl::OUString aScript = i_eventDescriptor.getOrDefault( PROP_SCRIPT, ::rtl::OUString() );
+ ::rtl::OUString aLibrary = i_eventDescriptor.getOrDefault( PROP_LIBRARY, ::rtl::OUString() );
+ ::rtl::OUString aMacroName = i_eventDescriptor.getOrDefault( PROP_MACRO_NAME, ::rtl::OUString() );
- while ( nIndex < nCount )
- {
- if ( aInProps[ nIndex ].Name.compareToAscii( PROP_EVENT_TYPE ) == 0 )
- {
- aInProps[nIndex].Value >>= aType;
- aOutProps[0] = aInProps[nIndex];
- }
- else if ( aInProps[ nIndex ].Name.compareToAscii( PROP_SCRIPT ) == 0 )
- {
- aInProps[nIndex].Value >>= aScript;
- aOutProps[1] = aInProps[nIndex];
- }
- else if ( aInProps[ nIndex ].Name.compareToAscii( PROP_LIBRARY ) == 0 )
- {
- aInProps[ nIndex ].Value >>= aLibrary;
- }
- else if ( aInProps[ nIndex ].Name.compareToAscii( PROP_MACRO_NAME ) == 0 )
- {
- aInProps[ nIndex ].Value >>= aMacroName;
- }
- nIndex += 1;
- }
+ if ( aType.getLength() )
+ o_normalizedDescriptor.put( PROP_EVENT_TYPE, aType );
+ if ( aScript.getLength() )
+ o_normalizedDescriptor.put( PROP_SCRIPT, aScript );
if ( aType.compareToAscii( STAR_BASIC ) == 0 )
{
- aOutProps.realloc(4);
if ( aScript.getLength() )
{
- if( ! aMacroName.getLength() || ! aLibrary.getLength() )
+ if ( !aMacroName.getLength() || !aLibrary.getLength() )
{
sal_Int32 nHashPos = aScript.indexOf( '/', 8 );
sal_Int32 nArgsPos = aScript.indexOf( '(' );
@@ -542,22 +519,9 @@ void SfxEvents_Impl::BlowUpMacro( const ANY& rEvent, ANY& rRet, SfxObjectShell*
aLibrary = String::CreateFromAscii("application");
}
- aOutProps[1].Name = OUSTRING::createFromAscii( PROP_SCRIPT );
- aOutProps[1].Value <<= aScript;
- aOutProps[2].Name = OUSTRING::createFromAscii( PROP_LIBRARY );
- aOutProps[2].Value <<= aLibrary;
- aOutProps[3].Name = OUSTRING::createFromAscii( PROP_MACRO_NAME );
- aOutProps[3].Value <<= aMacroName;
- rRet <<= aOutProps;
- }
- else if ( aType.compareToAscii( SVX_MACRO_LANGUAGE_JAVASCRIPT ) == 0 )
- {
- aOutProps[1] = aInProps[1];
- rRet <<= aOutProps;
- }
- else
- {
- rRet <<= aOutProps;
+ o_normalizedDescriptor.put( PROP_SCRIPT, aScript );
+ o_normalizedDescriptor.put( PROP_LIBRARY, aLibrary );
+ o_normalizedDescriptor.put( PROP_MACRO_NAME, aMacroName );
}
}
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 7cc25c872eb1..6bf2dc26edd6 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -90,7 +90,6 @@
#include <sfx2/viewfrm.hxx>
#include "arrdecl.hxx"
#include "sfxtypes.hxx"
-#include <sfx2/macrconf.hxx>
#include <sfx2/genlink.hxx>
#include "sfx2/sfxresid.hxx"
#include <sfx2/sfx.hrc>
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index dbadbc54ebd4..4dcd4bb4709e 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -953,7 +953,7 @@ void SfxViewFrame::ExecHistory_Impl( SfxRequest &rReq )
{
// gibt es an der obersten Shell einen Undo-Manager?
SfxShell *pSh = GetDispatcher()->GetShell(0);
- SfxUndoManager* pShUndoMgr = pSh->GetUndoManager();
+ ::svl::IUndoManager* pShUndoMgr = pSh->GetUndoManager();
sal_Bool bOK = sal_False;
if ( pShUndoMgr )
{
@@ -965,20 +965,20 @@ void SfxViewFrame::ExecHistory_Impl( SfxRequest &rReq )
break;
case SID_UNDO:
- pShUndoMgr->Undo(0);
+ pShUndoMgr->Undo();
GetBindings().InvalidateAll(sal_False);
bOK = sal_True;
break;
case SID_REDO:
- pShUndoMgr->Redo(0);
+ pShUndoMgr->Redo();
GetBindings().InvalidateAll(sal_False);
bOK = sal_True;
break;
case SID_REPEAT:
if ( pSh->GetRepeatTarget() )
- pShUndoMgr->Repeat( *pSh->GetRepeatTarget(), 0);
+ pShUndoMgr->Repeat( *pSh->GetRepeatTarget() );
bOK = sal_True;
break;
}
@@ -1004,7 +1004,7 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet )
// Ich bin gerade am Reloaden und Yielde so vor mich hin ...
return;
- SfxUndoManager *pShUndoMgr = pSh->GetUndoManager();
+ ::svl::IUndoManager *pShUndoMgr = pSh->GetUndoManager();
if ( !pShUndoMgr )
{
// der SW hat eigenes Undo an der View
@@ -1040,10 +1040,10 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet )
rSet.DisableItem( SID_REDO );
SfxRepeatTarget *pTarget = pSh->GetRepeatTarget();
if ( pShUndoMgr && pTarget && pShUndoMgr->GetRepeatActionCount() &&
- pShUndoMgr->CanRepeat(*pTarget, 0) )
+ pShUndoMgr->CanRepeat(*pTarget) )
{
String aTmp( SvtResId(STR_REPEAT) );
- aTmp += pShUndoMgr->GetRepeatActionComment(*pTarget, 0);
+ aTmp += pShUndoMgr->GetRepeatActionComment(*pTarget);
rSet.Put( SfxStringItem( SID_REPEAT, aTmp ) );
}
else
@@ -2876,8 +2876,6 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const ::rtl::OUString& sMacro )
}
}
- pSfxApp->EnterBasicCall();
-
BasicManager* pBasMgr = 0;
if ( aLocation.EqualsIgnoreCaseAscii( "application" ) )
{
@@ -3010,19 +3008,11 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const ::rtl::OUString& sMacro )
}
}
}
-
- pSfxApp->LeaveBasicCall();
}
else
{
// add code for "session only" macro
}
-
- /*
- FILE* pFile = fopen( "macro.bas", "a" );
- fprintf( pFile, "%s", ::rtl::OUStringToOString(sBuffer.makeStringAndClear(),RTL_TEXTENCODING_UTF8).getStr() );
- fclose ( pFile );
- */
}
void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq )