summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Sommerfeld <kso@openoffice.org>2010-06-30 14:10:24 +0200
committerKai Sommerfeld <kso@openoffice.org>2010-06-30 14:10:24 +0200
commit5f5cf90cc926793af7d8ea00465fbf905ae36338 (patch)
treeb3d7534ac42e5457e11b3ebed5d127d389f4108a
parent70b1513db075659d31e9e33f77493581d93caee5 (diff)
parent871f924d559017fcf06a4c691fae6bcd9a82491e (diff)
reync to m84
-rw-r--r--basic/inc/basic/sbmod.hxx10
-rw-r--r--basic/inc/basic/sbobjmod.hxx18
-rw-r--r--basic/inc/basic/sbx.hxx2
-rw-r--r--basic/inc/basic/sbxdef.hxx4
-rw-r--r--basic/inc/basic/sbxvar.hxx11
-rwxr-xr-xbasic/prj/build.lst2
-rw-r--r--basic/source/basmgr/basmgr.cxx2
-rw-r--r--basic/source/classes/disas.cxx3
-rwxr-xr-xbasic/source/classes/sb.cxx81
-rw-r--r--basic/source/classes/sbunoobj.cxx288
-rw-r--r--basic/source/classes/sbxmod.cxx64
-rw-r--r--basic/source/comp/dim.cxx75
-rw-r--r--basic/source/comp/exprgen.cxx6
-rw-r--r--basic/source/comp/exprnode.cxx14
-rw-r--r--basic/source/comp/exprtree.cxx72
-rw-r--r--basic/source/comp/io.cxx37
-rw-r--r--basic/source/comp/parser.cxx62
-rw-r--r--basic/source/comp/symtbl.cxx2
-rw-r--r--basic/source/comp/token.cxx58
-rw-r--r--basic/source/inc/codegen.hxx2
-rw-r--r--basic/source/inc/dlgcont.hxx9
-rw-r--r--basic/source/inc/expr.hxx20
-rw-r--r--basic/source/inc/namecont.hxx35
-rw-r--r--basic/source/inc/opcodes.hxx1
-rw-r--r--basic/source/inc/parser.hxx3
-rw-r--r--basic/source/inc/runtime.hxx5
-rw-r--r--basic/source/inc/sbintern.hxx3
-rw-r--r--basic/source/inc/scriptcont.hxx9
-rw-r--r--basic/source/inc/symtbl.hxx6
-rw-r--r--basic/source/inc/token.hxx20
-rw-r--r--basic/source/runtime/dllmgr.cxx1159
-rw-r--r--basic/source/runtime/dllmgr.hxx73
-rw-r--r--basic/source/runtime/makefile.mk21
-rw-r--r--basic/source/runtime/methods1.cxx15
-rw-r--r--basic/source/runtime/os2.asm103
-rw-r--r--basic/source/runtime/rtlproto.hxx1
-rwxr-xr-xbasic/source/runtime/runtime.cxx7
-rw-r--r--basic/source/runtime/stdobj.cxx7
-rw-r--r--basic/source/runtime/step0.cxx37
-rw-r--r--basic/source/runtime/step1.cxx9
-rw-r--r--basic/source/runtime/step2.cxx32
-rw-r--r--basic/source/runtime/win.asm80
-rw-r--r--basic/source/runtime/wnt-mingw.s98
-rw-r--r--basic/source/runtime/wnt.asm100
-rw-r--r--basic/source/sbx/sbxvar.cxx57
-rw-r--r--basic/source/uno/dlgcont.cxx11
-rw-r--r--basic/source/uno/namecont.cxx126
-rw-r--r--basic/source/uno/scriptcont.cxx142
-rw-r--r--basic/util/makefile.mk1
-rw-r--r--configmgr/source/components.cxx8
-rw-r--r--connectivity/qa/drivers/dbase/test.properties1
-rw-r--r--desktop/inc/app.hxx5
-rw-r--r--desktop/inc/deployment.hrc1
-rw-r--r--desktop/prj/build.lst3
-rw-r--r--desktop/scripts/soffice.sh9
-rw-r--r--desktop/source/app/app.cxx38
-rwxr-xr-x[-rw-r--r--]desktop/source/app/check_ext_deps.cxx305
-rw-r--r--desktop/source/app/makefile.mk14
-rw-r--r--desktop/source/deployment/dp_services.cxx19
-rw-r--r--desktop/source/deployment/gui/dp_gui.h9
-rwxr-xr-x[-rw-r--r--]desktop/source/deployment/gui/dp_gui.hrc3
-rwxr-xr-x[-rw-r--r--]desktop/source/deployment/gui/dp_gui_dialog.src20
-rwxr-xr-x[-rw-r--r--]desktop/source/deployment/gui/dp_gui_dialog2.cxx170
-rwxr-xr-x[-rw-r--r--]desktop/source/deployment/gui/dp_gui_dialog2.hxx40
-rwxr-xr-x[-rw-r--r--]desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx203
-rwxr-xr-x[-rw-r--r--]desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx13
-rw-r--r--[-rwxr-xr-x]desktop/source/deployment/gui/dp_gui_extlistbox.cxx102
-rw-r--r--[-rwxr-xr-x]desktop/source/deployment/gui/dp_gui_extlistbox.hxx26
-rwxr-xr-x[-rw-r--r--]desktop/source/deployment/gui/dp_gui_service.cxx2
-rwxr-xr-x[-rw-r--r--]desktop/source/deployment/gui/dp_gui_theextmgr.cxx181
-rwxr-xr-x[-rw-r--r--]desktop/source/deployment/gui/dp_gui_theextmgr.hxx22
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedata.hxx40
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.cxx413
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.hxx27
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.src12
-rw-r--r--desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx54
-rw-r--r--desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx6
-rw-r--r--desktop/source/deployment/gui/license_dialog.cxx11
-rw-r--r--desktop/source/deployment/gui/license_dialog.hxx1
-rw-r--r--desktop/source/deployment/inc/dp_descriptioninfoset.hxx15
-rw-r--r--desktop/source/deployment/inc/dp_misc.h33
-rw-r--r--desktop/source/deployment/inc/dp_ucb.h7
-rwxr-xr-xdesktop/source/deployment/inc/dp_update.hxx147
-rw-r--r--desktop/source/deployment/inc/dp_version.hxx7
-rw-r--r--desktop/source/deployment/makefile.mk1
-rw-r--r--desktop/source/deployment/manager/dp_activepackages.cxx28
-rw-r--r--desktop/source/deployment/manager/dp_activepackages.hxx19
-rw-r--r--desktop/source/deployment/manager/dp_commandenvironments.cxx286
-rw-r--r--desktop/source/deployment/manager/dp_commandenvironments.hxx160
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.cxx1361
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.hxx307
-rw-r--r--desktop/source/deployment/manager/dp_informationprovider.cxx392
-rw-r--r--desktop/source/deployment/manager/dp_manager.cxx917
-rw-r--r--desktop/source/deployment/manager/dp_manager.h69
-rw-r--r--desktop/source/deployment/manager/dp_manager.hrc2
-rw-r--r--desktop/source/deployment/manager/dp_manager.src4
-rw-r--r--desktop/source/deployment/manager/dp_managerfac.cxx4
-rw-r--r--desktop/source/deployment/manager/dp_properties.cxx169
-rw-r--r--desktop/source/deployment/manager/dp_properties.hxx81
-rw-r--r--desktop/source/deployment/manager/makefile.mk5
-rw-r--r--desktop/source/deployment/migration/dp_migration.cxx251
-rw-r--r--desktop/source/deployment/migration/makefile.mk41
-rw-r--r--desktop/source/deployment/misc/dp_descriptioninfoset.cxx250
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx179
-rw-r--r--desktop/source/deployment/misc/dp_ucb.cxx46
-rwxr-xr-xdesktop/source/deployment/misc/dp_update.cxx397
-rw-r--r--desktop/source/deployment/misc/dp_version.cxx6
-rw-r--r--desktop/source/deployment/misc/makefile.mk6
-rw-r--r--desktop/source/deployment/registry/component/dp_compbackenddb.cxx156
-rw-r--r--desktop/source/deployment/registry/component/dp_compbackenddb.hxx120
-rw-r--r--desktop/source/deployment/registry/component/dp_component.cxx550
-rw-r--r--desktop/source/deployment/registry/component/makefile.mk3
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configuration.cxx277
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx186
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx96
-rw-r--r--desktop/source/deployment/registry/configuration/makefile.mk3
-rw-r--r--desktop/source/deployment/registry/dp_backend.cxx284
-rw-r--r--desktop/source/deployment/registry/dp_backenddb.cxx649
-rw-r--r--desktop/source/deployment/registry/dp_registry.cxx37
-rw-r--r--desktop/source/deployment/registry/executable/dp_executable.cxx98
-rw-r--r--desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx84
-rw-r--r--desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx79
-rw-r--r--desktop/source/deployment/registry/executable/makefile.mk3
-rw-r--r--desktop/source/deployment/registry/help/dp_help.cxx318
-rw-r--r--desktop/source/deployment/registry/help/dp_helpbackenddb.cxx178
-rw-r--r--desktop/source/deployment/registry/help/dp_helpbackenddb.hxx92
-rw-r--r--desktop/source/deployment/registry/help/makefile.mk3
-rw-r--r--desktop/source/deployment/registry/inc/dp_backend.h111
-rw-r--r--desktop/source/deployment/registry/inc/dp_backenddb.hxx170
-rw-r--r--desktop/source/deployment/registry/makefile.mk3
-rw-r--r--desktop/source/deployment/registry/package/dp_description.cxx205
-rw-r--r--desktop/source/deployment/registry/package/dp_description.hxx125
-rw-r--r--desktop/source/deployment/registry/package/dp_extbackenddb.cxx135
-rw-r--r--desktop/source/deployment/registry/package/dp_extbackenddb.hxx96
-rw-r--r--desktop/source/deployment/registry/package/dp_package.cxx572
-rw-r--r--desktop/source/deployment/registry/package/makefile.mk2
-rw-r--r--desktop/source/deployment/registry/script/dp_script.cxx306
-rw-r--r--desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx88
-rw-r--r--desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx76
-rw-r--r--desktop/source/deployment/registry/script/makefile.mk3
-rw-r--r--desktop/source/deployment/registry/sfwk/dp_sfwk.cxx24
-rw-r--r--desktop/source/deployment/unopkg/unopkg.src7
-rw-r--r--desktop/source/inc/exithelper.hxx2
-rwxr-xr-x[-rw-r--r--]desktop/source/migration/migration.cxx2
-rw-r--r--desktop/source/migration/services/cexports.cxx12
-rwxr-xr-xdesktop/source/migration/services/extensionmigration.cxx540
-rwxr-xr-xdesktop/source/migration/services/extensionmigration.hxx130
-rw-r--r--desktop/source/migration/services/makefile.mk2
-rwxr-xr-x[-rw-r--r--]desktop/source/migration/services/oo3extensionmigration.cxx15
-rwxr-xr-x[-rw-r--r--]desktop/source/migration/services/oo3extensionmigration.hxx4
-rw-r--r--desktop/source/offacc/acceptor.cxx6
-rw-r--r--desktop/source/offacc/acceptor.hxx1
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_app.cxx262
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx57
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_misc.cxx42
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_shared.h10
-rw-r--r--desktop/source/splash/splash.cxx27
-rw-r--r--desktop/source/splash/splash.hxx1
-rwxr-xr-xdesktop/unx/source/officeloader/officeloader.cxx2
-rw-r--r--desktop/util/makefile.mk2
-rw-r--r--desktop/win32/source/officeloader/officeloader.cxx11
-rw-r--r--editeng/source/uno/unotext.cxx13
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx2
-rw-r--r--fpicker/source/aqua/FilterHelper.cxx11
-rw-r--r--fpicker/source/aqua/NSURL_OOoAdditions.hxx13
-rw-r--r--fpicker/source/aqua/NSURL_OOoAdditions.mm30
-rw-r--r--fpicker/source/unx/gnome/SalGtkFilePicker.cxx83
-rw-r--r--fpicker/source/unx/gnome/SalGtkFolderPicker.cxx16
-rw-r--r--fpicker/source/unx/gnome/SalGtkPicker.cxx21
-rw-r--r--fpicker/source/unx/gnome/SalGtkPicker.hxx7
-rw-r--r--fpicker/source/unx/gnome/resourceprovider.cxx2
-rw-r--r--framework/inc/filterflags.h172
-rw-r--r--framework/inc/queries.h1
-rw-r--r--framework/inc/threadhelp/transactionmanager.hxx1
-rw-r--r--framework/source/constant/filter.cxx119
-rw-r--r--framework/source/constant/makefile.mk3
-rw-r--r--framework/source/inc/constant/filter.hxx126
-rw-r--r--framework/source/loadenv/loadenv.cxx8
-rw-r--r--framework/source/services/backingwindow.cxx9
-rw-r--r--framework/source/services/backingwindow.hxx1
-rw-r--r--framework/source/services/frame.cxx3
-rw-r--r--framework/source/threadhelp/transactionmanager.cxx36
-rw-r--r--framework/util/makefile.mk1
-rw-r--r--officecfg/registry/data/org/openoffice/Office/Common.xcu5
-rw-r--r--officecfg/registry/data/org/openoffice/Office/Paths.xcu8
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu13
-rw-r--r--officecfg/registry/data/org/openoffice/VCL.xcu44
-rw-r--r--officecfg/registry/schema/oo-ldap-attr-map.properties1
-rw-r--r--officecfg/registry/schema/oo-org-map.properties1
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs13
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs2
-rwxr-xr-xofficecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs2
-rw-r--r--oovbaapi/ooo/vba/XApplicationBase.idl8
-rw-r--r--oovbaapi/ooo/vba/XCollection.idl1
-rw-r--r--oovbaapi/ooo/vba/XCommandBarControl.idl3
-rw-r--r--oovbaapi/ooo/vba/XDocumentBase.idl3
-rwxr-xr-xoovbaapi/ooo/vba/XVBAAppService.idl72
-rwxr-xr-xoovbaapi/ooo/vba/XVBADocService.idl72
-rwxr-xr-xoovbaapi/ooo/vba/excel/SheetObject.idl131
-rwxr-xr-xoovbaapi/ooo/vba/excel/SheetObjects.idl150
-rw-r--r--oovbaapi/ooo/vba/excel/XApplication.idl21
-rw-r--r--oovbaapi/ooo/vba/excel/XComment.idl13
-rw-r--r--oovbaapi/ooo/vba/excel/XHyperlink.idl31
-rwxr-xr-xoovbaapi/ooo/vba/excel/XHyperlinks.idl70
-rw-r--r--oovbaapi/ooo/vba/excel/XPane.idl7
-rw-r--r--oovbaapi/ooo/vba/excel/XRange.idl3
-rw-r--r--oovbaapi/ooo/vba/excel/XWindow.idl10
-rw-r--r--oovbaapi/ooo/vba/excel/XWorksheet.idl21
-rw-r--r--oovbaapi/ooo/vba/excel/makefile.mk3
-rw-r--r--oovbaapi/ooo/vba/makefile.mk5
-rw-r--r--oovbaapi/ooo/vba/msforms/XControl.idl6
-rw-r--r--oovbaapi/ooo/vba/msforms/XControls.idl7
-rw-r--r--oovbaapi/prj/d.lst14
-rw-r--r--[-rwxr-xr-x]readlicense_oo/docs/readme.xsl379
-rwxr-xr-xreadlicense_oo/docs/readme/readme.xrm831
-rwxr-xr-xreadlicense_oo/util/makefile.pmk3
-rw-r--r--scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java35
-rwxr-xr-xscripting/java/com/sun/star/script/framework/provider/ScriptProvider.java18
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties1
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties1
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties1
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties1
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties1
-rw-r--r--scripting/source/provider/ActiveMSPList.cxx7
-rw-r--r--scripting/source/provider/ActiveMSPList.hxx1
-rw-r--r--scripting/source/pyprov/mailmerge.py120
-rwxr-xr-x[-rw-r--r--]sfx2/inc/brokenpackageint.hxx18
-rw-r--r--sfx2/inc/sfx2/app.hxx2
-rw-r--r--sfx2/inc/sfx2/docfile.hxx2
-rw-r--r--sfx2/inc/sfx2/docfilt.hxx23
-rw-r--r--sfx2/inc/sfx2/htmlmode.hxx68
-rwxr-xr-x[-rw-r--r--]sfx2/inc/sfx2/objsh.hxx21
-rwxr-xr-xsfx2/inc/sfx2/securitypage.hxx58
-rwxr-xr-x[-rw-r--r--]sfx2/inc/sfx2/sfx.hrc5
-rw-r--r--sfx2/inc/sfx2/sfxsids.hrc30
-rwxr-xr-x[-rw-r--r--]sfx2/sdi/sfx.sdi28
-rw-r--r--sfx2/source/appl/appdata.cxx5
-rw-r--r--sfx2/source/appl/appmain.cxx3
-rw-r--r--sfx2/source/appl/appquit.cxx50
-rw-r--r--sfx2/source/appl/appserv.cxx63
-rwxr-xr-x[-rw-r--r--]sfx2/source/appl/appuno.cxx57
-rw-r--r--sfx2/source/appl/imestatuswindow.cxx6
-rw-r--r--sfx2/source/appl/imestatuswindow.hxx7
-rw-r--r--sfx2/source/bastyp/progress.cxx2
-rw-r--r--sfx2/source/bastyp/sfxhtml.cxx4
-rw-r--r--sfx2/source/control/unoctitm.cxx2
-rw-r--r--sfx2/source/dialog/about.cxx30
-rwxr-xr-x[-rw-r--r--]sfx2/source/dialog/dinfdlg.cxx5
-rwxr-xr-x[-rw-r--r--]sfx2/source/dialog/dinfdlg.src11
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx101
-rwxr-xr-x[-rw-r--r--]sfx2/source/dialog/makefile.mk2
-rwxr-xr-xsfx2/source/dialog/securitypage.cxx523
-rwxr-xr-xsfx2/source/dialog/securitypage.hrc52
-rwxr-xr-xsfx2/source/dialog/securitypage.src174
-rw-r--r--sfx2/source/doc/docfile.cxx55
-rw-r--r--sfx2/source/doc/docfilt.cxx14
-rw-r--r--sfx2/source/doc/guisaveas.cxx81
-rw-r--r--sfx2/source/doc/objcont.cxx48
-rwxr-xr-xsfx2/source/doc/objmisc.cxx29
-rw-r--r--sfx2/source/doc/objstor.cxx51
-rwxr-xr-x[-rw-r--r--]sfx2/source/doc/objxtor.cxx42
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx28
-rw-r--r--sfx2/source/inc/appdata.hxx3
-rwxr-xr-x[-rw-r--r--]sfx2/source/inc/helpid.hrc11
-rw-r--r--sfx2/source/inc/objshimp.hxx4
-rw-r--r--sfx2/source/view/ipclient.cxx8
-rw-r--r--sfx2/source/view/viewfrm.cxx288
-rw-r--r--sfx2/util/hidother.src4
-rw-r--r--shell/source/unix/misc/gnome-open-url.sh4
-rwxr-xr-xshell/source/unix/misc/open-url.sh54
-rw-r--r--shell/source/unix/sysshell/recently_used_file.cxx3
-rw-r--r--svx/inc/htmlmode.hxx23
-rwxr-xr-x[-rw-r--r--]svx/inc/svx/svxids.hrc42
-rw-r--r--svx/inc/svx/unoshprp.hxx2
-rw-r--r--svx/source/dialog/hdft.cxx2
-rw-r--r--svx/source/smarttags/SmartTagMgr.cxx11
-rw-r--r--svx/source/svdraw/svdoole2.cxx46
-rw-r--r--svx/source/unodraw/unoprov.cxx1
-rw-r--r--svx/source/unodraw/unoshap4.cxx12
-rw-r--r--sysui/desktop/icons/hicolor/128x128/apps/startcenter.pngbin11073 -> 15601 bytes
-rw-r--r--sysui/desktop/icons/hicolor/16x16/apps/startcenter.pngbin1043 -> 893 bytes
-rw-r--r--sysui/desktop/icons/hicolor/32x32/apps/startcenter.pngbin2375 -> 2429 bytes
-rw-r--r--sysui/desktop/icons/hicolor/48x48/apps/startcenter.pngbin3615 -> 4184 bytes
-rw-r--r--sysui/desktop/menus/base.desktop1
-rw-r--r--sysui/desktop/menus/calc.desktop1
-rw-r--r--sysui/desktop/menus/draw.desktop1
-rw-r--r--sysui/desktop/menus/impress.desktop1
-rw-r--r--sysui/desktop/menus/math.desktop1
-rw-r--r--sysui/desktop/menus/startcenter.desktop2
-rw-r--r--sysui/desktop/menus/writer.desktop1
-rw-r--r--ucb/source/ucp/file/shell.cxx10
-rw-r--r--uui/prj/build.lst2
-rwxr-xr-x[-rw-r--r--]uui/source/iahndl-authentication.cxx142
-rwxr-xr-x[-rw-r--r--]uui/source/ids.hrc265
-rwxr-xr-x[-rw-r--r--]uui/source/logindlg.cxx166
-rwxr-xr-x[-rw-r--r--]uui/source/logindlg.hrc30
-rwxr-xr-x[-rw-r--r--]uui/source/logindlg.hxx50
-rwxr-xr-x[-rw-r--r--]uui/source/logindlg.src188
-rwxr-xr-x[-rw-r--r--]uui/source/loginerr.hxx120
-rw-r--r--uui/source/passwordcontainer.hxx2
-rwxr-xr-x[-rw-r--r--]uui/source/passworddlg.cxx30
-rwxr-xr-x[-rw-r--r--]uui/source/passworddlg.hxx2
-rwxr-xr-x[-rw-r--r--]uui/source/passworddlg.src28
-rwxr-xr-x[-rw-r--r--]uui/source/passworderrs.src9
-rw-r--r--vbahelper/inc/vbahelper/vbaapplicationbase.hxx13
-rw-r--r--vbahelper/inc/vbahelper/vbacollectionimpl.hxx94
-rw-r--r--vbahelper/inc/vbahelper/vbadocumentbase.hxx3
-rw-r--r--vbahelper/inc/vbahelper/vbafontbase.hxx9
-rw-r--r--vbahelper/inc/vbahelper/vbahelper.hxx20
-rw-r--r--vbahelper/inc/vbahelper/vbahelperinterface.hxx53
-rw-r--r--vbahelper/source/msforms/makefile.mk1
-rw-r--r--vbahelper/source/msforms/vbacontrol.cxx34
-rw-r--r--vbahelper/source/msforms/vbacontrol.hxx7
-rw-r--r--vbahelper/source/msforms/vbacontrols.cxx184
-rw-r--r--vbahelper/source/msforms/vbacontrols.hxx7
-rwxr-xr-xvbahelper/source/msforms/vbasystemaxcontrol.cxx101
-rwxr-xr-xvbahelper/source/msforms/vbasystemaxcontrol.hxx58
-rw-r--r--vbahelper/source/vbahelper/makefile.mk1
-rw-r--r--vbahelper/source/vbahelper/vbaapplicationbase.cxx293
-rw-r--r--vbahelper/source/vbahelper/vbacommandbar.cxx82
-rw-r--r--vbahelper/source/vbahelper/vbacommandbar.hxx36
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrol.cxx16
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrol.hxx2
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrols.cxx78
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarcontrols.hxx20
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarhelper.cxx25
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarhelper.hxx4
-rw-r--r--vbahelper/source/vbahelper/vbacommandbars.cxx72
-rw-r--r--vbahelper/source/vbahelper/vbacommandbars.hxx2
-rw-r--r--vbahelper/source/vbahelper/vbadocumentbase.cxx40
-rw-r--r--vbahelper/source/vbahelper/vbafontbase.cxx85
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx350
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.cxx183
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.hxx19
-rw-r--r--xmlhelp/source/cxxhelp/provider/urlparameter.cxx10
-rw-r--r--xmlhelp/source/cxxhelp/provider/urlparameter.hxx3
-rw-r--r--xmlhelp/source/treeview/tvread.cxx47
-rw-r--r--xmlhelp/source/treeview/tvread.hxx9
-rw-r--r--xmloff/inc/xmloff/XMLEventExport.hxx8
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx1
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.cxx15
-rw-r--r--xmloff/source/core/xmltoken.cxx1
-rw-r--r--xmloff/source/draw/ximppage.cxx3
-rw-r--r--xmloff/source/script/XMLEventExport.cxx25
-rw-r--r--xmlscript/inc/xmlscript/xmlmod_imexp.hxx1
-rw-r--r--xmlscript/source/xmlmod_imexp/xmlmod_export.cxx3
-rw-r--r--xmlscript/source/xmlmod_imexp/xmlmod_import.cxx7
347 files changed, 16991 insertions, 7339 deletions
diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx
index 9681149936..7f401ef69f 100644
--- a/basic/inc/basic/sbmod.hxx
+++ b/basic/inc/basic/sbmod.hxx
@@ -40,6 +40,7 @@ class SbiBreakpoints;
class SbiImage;
class SbProcedureProperty;
class SbIfaceMapperMethod;
+class SbClassModuleObject;
struct SbClassData;
class SbModuleImpl;
@@ -125,11 +126,12 @@ public:
BOOL LoadBinaryData( SvStream& );
BOOL ExceedsLegacyModuleSize();
void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
- BOOL IsVBACompat();
- void SetVBACompat( BOOL bCompat );
- INT32 GetModuleType() { return mnType; }
- void SetModuleType( INT32 nType ) { mnType = nType; }
+ BOOL IsVBACompat() const;
+ void SetVBACompat( BOOL bCompat );
+ INT32 GetModuleType() { return mnType; }
+ void SetModuleType( INT32 nType ) { mnType = nType; }
bool GetIsProxyModule() { return bIsProxyModule; }
+ bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject );
};
#ifndef __SB_SBMODULEREF_HXX
diff --git a/basic/inc/basic/sbobjmod.hxx b/basic/inc/basic/sbobjmod.hxx
index ad804dcfab..3d638a475f 100644
--- a/basic/inc/basic/sbobjmod.hxx
+++ b/basic/inc/basic/sbobjmod.hxx
@@ -62,6 +62,7 @@ public:
class SbUserFormModule : public SbObjModule
{
+ com::sun::star::script::ModuleInfo m_mInfo;
css::uno::Reference<css::lang::XEventListener> m_DialogListener;
css::uno::Reference<css::awt::XDialog> m_xDialog;
css::uno::Reference<css::frame::XModel> m_xModel;
@@ -70,7 +71,7 @@ class SbUserFormModule : public SbObjModule
SbUserFormModule( const SbUserFormModule& );
SbUserFormModule();
-protected:
+//protected:
virtual void InitObject();
public:
TYPEINFO();
@@ -85,8 +86,23 @@ public:
void triggerDeActivateEvent();
void triggerInitializeEvent();
void triggerTerminateEvent();
+
+ class SbUserFormModuleInstance* CreateInstance();
};
+class SbUserFormModuleInstance : public SbUserFormModule
+{
+ SbUserFormModule* m_pParentModule;
+
+public:
+ SbUserFormModuleInstance( SbUserFormModule* pParentModule, const String& rName,
+ const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
+
+ virtual BOOL IsClass( const String& ) const;
+ virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
+};
+
+
#ifndef __SB_SBOBJMODULEREF_HXX
#define __SB_SBOBJMODULEREF_HXX
diff --git a/basic/inc/basic/sbx.hxx b/basic/inc/basic/sbx.hxx
index 3f5a49f522..647aeea7f7 100644
--- a/basic/inc/basic/sbx.hxx
+++ b/basic/inc/basic/sbx.hxx
@@ -171,8 +171,8 @@ class SbxArray : public SbxBase
{
// #100883 Method to set method directly to parameter array
friend class SbMethod;
- friend class SbTypeFactory;
friend class SbClassModuleObject;
+ friend SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
void PutDirect( SbxVariable* pVar, UINT32 nIdx );
SbxArrayImpl* mpSbxArrayImpl; // Impl data
diff --git a/basic/inc/basic/sbxdef.hxx b/basic/inc/basic/sbxdef.hxx
index cf45aa8d03..42117ce78b 100644
--- a/basic/inc/basic/sbxdef.hxx
+++ b/basic/inc/basic/sbxdef.hxx
@@ -105,6 +105,9 @@ enum SbxDataType {
SbxUSERn = 2047 // last user defined data type
};
+const UINT32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000;
+const UINT32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible
+
#endif
#ifndef _SBX_OPERATOR
@@ -313,6 +316,7 @@ enum SbxError { // Ergebnis einer Rechenoperation/Konversion
#define SBX_NO_BROADCAST 0x2000 // No broadcast on Get/Put
#define SBX_REFERENCE 0x4000 // Parameter is Reference (DLL-call)
#define SBX_NO_MODIFY 0x8000 // SetModified is suppressed
+#define SBX_WITH_EVENTS 0x0080 // Same value as unused SBX_HIDDEN
// Broadcaster-IDs:
#define SBX_HINT_DYING SFX_HINT_DYING
diff --git a/basic/inc/basic/sbxvar.hxx b/basic/inc/basic/sbxvar.hxx
index 2f890a01b8..0e44b07079 100644
--- a/basic/inc/basic/sbxvar.hxx
+++ b/basic/inc/basic/sbxvar.hxx
@@ -230,8 +230,6 @@ class SbxValueImpl;
class SbxValue : public SbxBase
{
- friend class SbiDllMgr; // BASIC-Runtime must access aData
-
SbxValueImpl* mpSbxValueImplImpl; // Impl data
// #55226 Transport additional infos
@@ -289,6 +287,8 @@ public:
const SbxValues& GetValues_Impl() const { return aData; }
virtual BOOL Put( const SbxValues& );
+ inline SbxValues * data() { return &aData; }
+
SbxINT64 GetCurrency() const;
SbxINT64 GetLong64() const;
SbxUINT64 GetULong64() const;
@@ -447,6 +447,9 @@ class SbxVariable : public SbxValue
String maName; // Name, if available
SbxArrayRef mpPar; // Parameter-Array, if set
USHORT nHash; // Hash-ID for search
+
+ SbxVariableImpl* getImpl( void );
+
protected:
SbxInfoRef pInfo; // Probably called information
sal_uIntPtr nUserData; // User data for Call()
@@ -492,6 +495,10 @@ public:
inline SbxObject* GetParent() { return pParent; }
virtual void SetParent( SbxObject* );
+ const String& GetDeclareClassName( void );
+ void SetDeclareClassName( const String& );
+ void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener );
+
static USHORT MakeHashCode( const String& rName );
};
diff --git a/basic/prj/build.lst b/basic/prj/build.lst
index 9453154edf..c00a3d8412 100755
--- a/basic/prj/build.lst
+++ b/basic/prj/build.lst
@@ -1,4 +1,4 @@
-sb basic : l10n offuh oovbaapi svtools xmlscript framework NULL
+sb basic : l10n offuh oovbaapi svtools xmlscript framework salhelper NULL
sb basic usr1 - all sb_mkout NULL
sb basic\inc nmake - all sb_inc NULL
sb basic\source\app nmake - all sb_app sb_class sb_inc NULL
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index a18b9bb081..247a833b3e 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1789,7 +1789,7 @@ bool BasicManager::GetGlobalUNOConstant( const sal_Char* _pAsciiName, ::com::sun
{
bool bRes = false;
StarBASIC* pStandardLib = GetStdLib();
- OSL_PRECOND( pStandardLib, "BasicManager::SetGlobalUNOConstant: no lib to insert into!" );
+ OSL_PRECOND( pStandardLib, "BasicManager::GetGlobalUNOConstant: no lib to read from!" );
if ( pStandardLib )
bRes = pStandardLib->GetUNOConstant( _pAsciiName, aOut );
return bRes;
diff --git a/basic/source/classes/disas.cxx b/basic/source/classes/disas.cxx
index cdb9c78523..82f3c08d61 100644
--- a/basic/source/classes/disas.cxx
+++ b/basic/source/classes/disas.cxx
@@ -89,7 +89,8 @@ static const char* pOp1[] = {
"INITFOREACH",
"VBASET",
"ERASE_CLEAR",
- "ARRAYACCESS"
+ "ARRAYACCESS",
+ "BYVAL"
};
static const char* pOp2[] = {
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index a7d1c50987..9be441e011 100755
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -321,23 +321,52 @@ SbxObject* SbOLEFactory::CreateObject( const String& rClassName )
}
-// Factory class to create user defined objects (type command)
-class SbTypeFactory : public SbxFactory
-{
- SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
+//========================================================================
+// SbFormFactory, show user forms by: dim as new <user form name>
+class SbFormFactory : public SbxFactory
+{
public:
virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX );
virtual SbxObject* CreateObject( const String& );
};
-SbxBase* SbTypeFactory::Create( UINT16, UINT32 )
+SbxBase* SbFormFactory::Create( UINT16, UINT32 )
{
// Not supported
return NULL;
}
-SbxObject* SbTypeFactory::cloneTypeObjectImpl( const SbxObject& rTypeObj )
+SbxObject* SbFormFactory::CreateObject( const String& rClassName )
+{
+ static String aLoadMethodName( RTL_CONSTASCII_USTRINGPARAM("load") );
+
+ SbxObject* pRet = NULL;
+ SbModule* pMod = pMOD;
+ if( pMod )
+ {
+ SbxVariable* pVar = pMod->Find( rClassName, SbxCLASS_OBJECT );
+ if( pVar )
+ {
+ SbxBase* pObj = pVar->GetObject();
+ SbUserFormModule* pFormModule = PTR_CAST( SbUserFormModule, pObj );
+
+ if( pFormModule != NULL )
+ {
+ pFormModule->load();
+ SbUserFormModuleInstance* pFormInstance = pFormModule->CreateInstance();
+ pRet = pFormInstance;
+ }
+ }
+ }
+ return pRet;
+}
+
+
+//========================================================================
+// SbTypeFactory
+
+SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj )
{
SbxObject* pRet = new SbxObject( rTypeObj );
pRet->PutObject( pRet );
@@ -352,7 +381,8 @@ SbxObject* SbTypeFactory::cloneTypeObjectImpl( const SbxObject& rTypeObj )
if( pProp )
{
SbxProperty* pNewProp = new SbxProperty( *pProp );
- if( pVar->GetType() & SbxARRAY )
+ SbxDataType eVarType = pVar->GetType();
+ if( eVarType & SbxARRAY )
{
SbxBase* pParObj = pVar->GetObject();
SbxDimArray* pSource = PTR_CAST(SbxDimArray,pParObj);
@@ -379,12 +409,35 @@ SbxObject* SbTypeFactory::cloneTypeObjectImpl( const SbxObject& rTypeObj )
pNewProp->PutObject( pDest );
pNewProp->SetFlags( nSavFlags );
}
+ if( eVarType == SbxOBJECT )
+ {
+ SbxBase* pObjBase = pVar->GetObject();
+ SbxObject* pSrcObj = PTR_CAST(SbxObject,pObjBase);
+ SbxObject* pDestObj = NULL;
+ if( pSrcObj != NULL )
+ pDestObj = cloneTypeObjectImpl( *pSrcObj );
+ pNewProp->PutObject( pDestObj );
+ }
pProps->PutDirect( pNewProp, i );
}
}
return pRet;
}
+// Factory class to create user defined objects (type command)
+class SbTypeFactory : public SbxFactory
+{
+public:
+ virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX );
+ virtual SbxObject* CreateObject( const String& );
+};
+
+SbxBase* SbTypeFactory::Create( UINT16, UINT32 )
+{
+ // Not supported
+ return NULL;
+}
+
SbxObject* SbTypeFactory::CreateObject( const String& rClassName )
{
SbxObject* pRet = NULL;
@@ -728,6 +781,8 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
AddFactory( pCLASSFAC );
pOLEFAC = new SbOLEFactory;
AddFactory( pOLEFAC );
+ pFORMFAC = new SbFormFactory;
+ AddFactory( pFORMFAC );
}
pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this );
// Search via StarBasic is always global
@@ -748,15 +803,17 @@ StarBASIC::~StarBASIC()
if( !--GetSbData()->nInst )
{
RemoveFactory( pSBFAC );
- pSBFAC = NULL;
+ delete pSBFAC; pSBFAC = NULL;
RemoveFactory( pUNOFAC );
- pUNOFAC = NULL;
+ delete pUNOFAC; pUNOFAC = NULL;
RemoveFactory( pTYPEFAC );
- pTYPEFAC = NULL;
+ delete pTYPEFAC; pTYPEFAC = NULL;
RemoveFactory( pCLASSFAC );
- pCLASSFAC = NULL;
+ delete pCLASSFAC; pCLASSFAC = NULL;
RemoveFactory( pOLEFAC );
- pOLEFAC = NULL;
+ delete pOLEFAC; pOLEFAC = NULL;
+ RemoveFactory( pFORMFAC );
+ delete pFORMFAC; pFORMFAC = NULL;
#ifdef DBG_UTIL
// There is no need to clean SbiData at program end,
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index f80e5e082c..291aaa4f7d 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -49,6 +49,7 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/uno/DeploymentException.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -1074,8 +1075,19 @@ Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType =
if( eBaseType == SbxOBJECT )
{
SbxBaseRef xObj = (SbxBase*)pVar->GetObject();
- if( xObj.Is() && xObj->ISA(SbUnoAnyObject) )
- return ((SbUnoAnyObject*)(SbxBase*)xObj)->getValue();
+ if( xObj.Is() )
+ {
+ if( xObj->ISA(SbUnoAnyObject) )
+ return ((SbUnoAnyObject*)(SbxBase*)xObj)->getValue();
+ if( xObj->ISA(SbClassModuleObject) )
+ {
+ Any aRetAny;
+ SbClassModuleObject* pClassModuleObj = (SbClassModuleObject*)(SbxBase*)xObj;
+ SbModule* pClassModule = pClassModuleObj->getClassModule();
+ if( pClassModule->createCOMWrapperForIface( aRetAny, pClassModuleObj ) )
+ return aRetAny;
+ }
+ }
}
Type aType = getUnoTypeForSbxValue( pVar );
@@ -1581,12 +1593,18 @@ String getBasicObjectTypeName( SbxObject* pObj )
bool checkUnoObjectType( SbUnoObject* pUnoObj,
const String& aClass )
{
- bool result = false;
Any aToInspectObj = pUnoObj->getUnoAny();
TypeClass eType = aToInspectObj.getValueType().getTypeClass();
if( eType != TypeClass_INTERFACE )
return false;
const Reference< XInterface > x = *(Reference< XInterface >*)aToInspectObj.getValue();
+
+ // Return true for XInvocation based objects as interface type names don't count then
+ Reference< XInvocation > xInvocation( x, UNO_QUERY );
+ if( xInvocation.is() )
+ return true;
+
+ bool result = false;
Reference< XTypeProvider > xTypeProvider( x, UNO_QUERY );
if( xTypeProvider.is() )
{
@@ -4135,3 +4153,267 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
refVar->PutObject( xUnoAnyObject );
}
+//==========================================================================
+
+typedef WeakImplHelper1< XInvocation > ModuleInvocationProxyHelper;
+
+class ModuleInvocationProxy : public ModuleInvocationProxyHelper
+{
+ ::rtl::OUString m_aPrefix;
+ SbxObjectRef m_xScopeObj;
+ bool m_bProxyIsClassModuleObject;
+
+public:
+ ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj );
+ ~ModuleInvocationProxy()
+ {}
+
+ // XInvocation
+ virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection() throw();
+ virtual void SAL_CALL setValue( const ::rtl::OUString& rProperty, const Any& rValue )
+ throw( UnknownPropertyException );
+ virtual Any SAL_CALL getValue( const ::rtl::OUString& rProperty )
+ throw( UnknownPropertyException );
+ virtual sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& rName ) throw();
+ virtual sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& rProp ) throw();
+
+ virtual Any SAL_CALL invoke( const ::rtl::OUString& rFunction,
+ const Sequence< Any >& rParams,
+ Sequence< sal_Int16 >& rOutParamIndex,
+ Sequence< Any >& rOutParam )
+ throw( CannotConvertException, InvocationTargetException );
+};
+
+ModuleInvocationProxy::ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj )
+ : m_aPrefix( aPrefix + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_") ) )
+ , m_xScopeObj( xScopeObj )
+{
+ m_bProxyIsClassModuleObject = xScopeObj.Is() ? xScopeObj->ISA(SbClassModuleObject) : false;
+}
+
+Reference< XIntrospectionAccess > SAL_CALL ModuleInvocationProxy::getIntrospection() throw()
+{
+ return Reference< XIntrospectionAccess >();
+}
+
+void SAL_CALL ModuleInvocationProxy::setValue( const ::rtl::OUString& rProperty, const Any& rValue ) throw( UnknownPropertyException )
+{
+ if( !m_bProxyIsClassModuleObject )
+ throw UnknownPropertyException();
+
+ NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() );
+
+ ::rtl::OUString aPropertyFunctionName( RTL_CONSTASCII_USTRINGPARAM( "Property Set ") );
+ aPropertyFunctionName += m_aPrefix;
+ aPropertyFunctionName += rProperty;
+
+ SbxVariable* p = m_xScopeObj->Find( aPropertyFunctionName, SbxCLASS_METHOD );
+ SbMethod* pMeth = p != NULL ? PTR_CAST(SbMethod,p) : NULL;
+ if( pMeth == NULL )
+ {
+ // TODO: Check vba behavior concernig missing function
+ //StarBASIC::Error( SbERR_NO_METHOD, aFunctionName );
+ throw UnknownPropertyException();
+ }
+
+ // Setup parameter
+ SbxArrayRef xArray = new SbxArray;
+ SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
+ unoToSbxValue( (SbxVariable*)xVar, rValue );
+ xArray->Put( xVar, 1 );
+
+ // Call property method
+ SbxVariableRef xValue = new SbxVariable;
+ pMeth->SetParameters( xArray );
+ pMeth->Call( xValue );
+ //aRet = sbxToUnoValue( xValue );
+ pMeth->SetParameters( NULL );
+
+ // TODO: OutParameter?
+
+ // throw InvocationTargetException();
+
+ //return aRet;
+
+}
+
+Any SAL_CALL ModuleInvocationProxy::getValue( const ::rtl::OUString& rProperty ) throw( UnknownPropertyException )
+{
+ if( !m_bProxyIsClassModuleObject )
+ throw UnknownPropertyException();
+
+ NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() );
+
+ ::rtl::OUString aPropertyFunctionName( RTL_CONSTASCII_USTRINGPARAM( "Property Get ") );
+ aPropertyFunctionName += m_aPrefix;
+ aPropertyFunctionName += rProperty;
+
+ SbxVariable* p = m_xScopeObj->Find( aPropertyFunctionName, SbxCLASS_METHOD );
+ SbMethod* pMeth = p != NULL ? PTR_CAST(SbMethod,p) : NULL;
+ if( pMeth == NULL )
+ {
+ // TODO: Check vba behavior concernig missing function
+ //StarBASIC::Error( SbERR_NO_METHOD, aFunctionName );
+ throw UnknownPropertyException();
+ }
+
+ // Call method
+ SbxVariableRef xValue = new SbxVariable;
+ pMeth->Call( xValue );
+ Any aRet = sbxToUnoValue( xValue );
+ return aRet;
+}
+
+sal_Bool SAL_CALL ModuleInvocationProxy::hasMethod( const ::rtl::OUString& ) throw()
+{
+ return sal_False;
+}
+
+sal_Bool SAL_CALL ModuleInvocationProxy::hasProperty( const ::rtl::OUString& ) throw()
+{
+ return sal_False;
+}
+
+Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction,
+ const Sequence< Any >& rParams,
+ Sequence< sal_Int16 >&,
+ Sequence< Any >& )
+ throw( CannotConvertException, InvocationTargetException )
+{
+ NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() );
+
+ Any aRet;
+ if( !m_xScopeObj.Is() )
+ return aRet;
+
+ ::rtl::OUString aFunctionName = m_aPrefix;
+ aFunctionName += rFunction;
+
+ SbxVariable* p = m_xScopeObj->Find( aFunctionName, SbxCLASS_METHOD );
+ SbMethod* pMeth = p != NULL ? PTR_CAST(SbMethod,p) : NULL;
+ if( pMeth == NULL )
+ {
+ // TODO: Check vba behavior concernig missing function
+ //StarBASIC::Error( SbERR_NO_METHOD, aFunctionName );
+ return aRet;
+ }
+
+ // Setup parameters
+ SbxArrayRef xArray;
+ sal_Int32 nParamCount = rParams.getLength();
+ if( nParamCount )
+ {
+ xArray = new SbxArray;
+ const Any *pArgs = rParams.getConstArray();
+ for( sal_Int32 i = 0 ; i < nParamCount ; i++ )
+ {
+ SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
+ unoToSbxValue( (SbxVariable*)xVar, pArgs[i] );
+ xArray->Put( xVar, sal::static_int_cast< USHORT >(i+1) );
+ }
+ }
+
+ // Call method
+ SbxVariableRef xValue = new SbxVariable;
+ if( xArray.Is() )
+ pMeth->SetParameters( xArray );
+ pMeth->Call( xValue );
+ aRet = sbxToUnoValue( xValue );
+ pMeth->SetParameters( NULL );
+
+ // TODO: OutParameter?
+
+ return aRet;
+}
+
+Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::OUString& aVBAType,
+ const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj )
+{
+ Reference< XInterface > xRet;
+
+ Reference< XComponentContext > xContext = getComponentContext_Impl();
+ Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
+
+ Reference< XInvocation > xProxy = new ModuleInvocationProxy( aPrefix, xScopeObj );
+
+ Sequence<Any> args( 3 );
+ args[0] <<= aControlAny;
+ args[1] <<= aVBAType;
+ args[2] <<= xProxy;
+
+ try
+ {
+ xRet = xServiceMgr->createInstanceWithArgumentsAndContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.custom.UnoComListener")),
+ args, xContext );
+ }
+ catch( const Exception& )
+ {
+ implHandleAnyException( ::cppu::getCaughtException() );
+ }
+
+ return xRet;
+}
+
+// Handle module implements mechanism for OLE types
+bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject )
+{
+ // For now: Take first interface that allows to instantiate COM wrapper
+ // TODO: Check if support for multiple interfaces is needed
+
+ Reference< XComponentContext > xContext = getComponentContext_Impl();
+ Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
+ Reference< XSingleServiceFactory > xComImplementsFactory
+ (
+ xServiceMgr->createInstanceWithContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.custom.ComImplementsFactory")), xContext ),
+ UNO_QUERY
+ );
+ if( !xComImplementsFactory.is() )
+ return false;
+
+ bool bSuccess = false;
+
+ SbxArray* pModIfaces = pClassData->mxIfaces;
+ USHORT nCount = pModIfaces->Count();
+ for( USHORT i = 0 ; i < nCount ; ++i )
+ {
+ SbxVariable* pVar = pModIfaces->Get( i );
+ ::rtl::OUString aIfaceName = pVar->GetName();
+
+ if( aIfaceName.getLength() != 0 )
+ {
+ ::rtl::OUString aPureIfaceName = aIfaceName;
+ sal_Int32 indexLastDot = aIfaceName.lastIndexOf('.');
+ if ( indexLastDot > -1 )
+ aPureIfaceName = aIfaceName.copy( indexLastDot + 1 );
+
+ Reference< XInvocation > xProxy = new ModuleInvocationProxy( aPureIfaceName, pProxyClassModuleObject );
+
+ Sequence<Any> args( 2 );
+ args[0] <<= aIfaceName;
+ args[1] <<= xProxy;
+
+ Reference< XInterface > xRet;
+ bSuccess = false;
+ try
+ {
+ xRet = xComImplementsFactory->createInstanceWithArguments( args );
+ bSuccess = true;
+ }
+ catch( const Exception& )
+ {
+ implHandleAnyException( ::cppu::getCaughtException() );
+ }
+
+ if( bSuccess )
+ {
+ o_rRetAny <<= xRet;
+ break;
+ }
+ }
+ }
+
+ return bSuccess;
+}
+
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 8c3ef89017..79ab2071c3 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -190,6 +190,11 @@ SbModule::SbModule( const String& rName, BOOL bVBACompat )
SetName( rName );
SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH );
SetModuleType( script::ModuleType::NORMAL );
+
+ // #i92642: Set name property to intitial name
+ SbxVariable* pNameProp = pProps->Find( String( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_PROPERTY );
+ if( pNameProp != NULL )
+ pNameProp->PutString( GetName() );
}
SbModule::~SbModule()
@@ -366,7 +371,7 @@ SbxVariable* SbModule::Find( const XubString& rName, SbxClassType t )
{
// make sure a search in an uninstatiated class module will fail
SbxVariable* pRes = SbxObject::Find( rName, t );
- if ( bIsProxyModule )
+ if ( bIsProxyModule && !GetSbData()->bRunInit )
return NULL;
if( !pRes && pImage )
{
@@ -452,7 +457,19 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
}
else
- SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
+ {
+ // #i92642: Special handling for name property to avoid
+ // side effects when using name as variable implicitely
+ bool bForwardToSbxObject = true;
+
+ ULONG nId = pHint->GetId();
+ if( (nId == SBX_HINT_DATAWANTED || nId == SBX_HINT_DATACHANGED) &&
+ pVar->GetName().EqualsIgnoreCaseAscii( "name" ) )
+ bForwardToSbxObject = false;
+
+ if( bForwardToSbxObject )
+ SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
+ }
}
}
@@ -646,7 +663,7 @@ void ClearUnoObjectsInRTL_Impl( StarBASIC* pBasic )
if( ((StarBASIC*)p) != pBasic )
ClearUnoObjectsInRTL_Impl_Rek( (StarBASIC*)p );
}
-BOOL SbModule::IsVBACompat()
+BOOL SbModule::IsVBACompat() const
{
return mbVBACompat;
}
@@ -1710,18 +1727,20 @@ public:
};
SbUserFormModule::SbUserFormModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsCompat )
- :SbObjModule( rName, mInfo, bIsCompat ), mbInit( false )
+ : SbObjModule( rName, mInfo, bIsCompat )
+ , m_mInfo( mInfo )
+ , mbInit( false )
{
- m_xModel.set( mInfo.ModuleObject, uno::UNO_QUERY_THROW );
+ m_xModel.set( mInfo.ModuleObject, uno::UNO_QUERY_THROW );
}
void SbUserFormModule::ResetApiObj()
{
- if ( m_xDialog.is() ) // probably someone close the dialog window
+ if ( m_xDialog.is() ) // probably someone close the dialog window
{
- triggerTerminateEvent();
- }
- pDocObject = NULL;
+ triggerTerminateEvent();
+ }
+ pDocObject = NULL;
m_xDialog = NULL;
}
@@ -1807,6 +1826,33 @@ void SbUserFormModule::triggerTerminateEvent( void )
mbInit=false;
}
+SbUserFormModuleInstance* SbUserFormModule::CreateInstance()
+{
+ SbUserFormModuleInstance* pInstance = new SbUserFormModuleInstance( this, GetName(), m_mInfo, IsVBACompat() );
+ return pInstance;
+}
+
+SbUserFormModuleInstance::SbUserFormModuleInstance( SbUserFormModule* pParentModule,
+ const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat )
+ : SbUserFormModule( rName, mInfo, bIsVBACompat )
+ , m_pParentModule( pParentModule )
+{
+}
+
+BOOL SbUserFormModuleInstance::IsClass( const XubString& rName ) const
+{
+ BOOL bParentNameMatches = m_pParentModule->GetName().EqualsIgnoreCaseAscii( rName );
+ BOOL bRet = bParentNameMatches || SbxObject::IsClass( rName );
+ return bRet;
+}
+
+SbxVariable* SbUserFormModuleInstance::Find( const XubString& rName, SbxClassType t )
+{
+ SbxVariable* pVar = m_pParentModule->Find( rName, t );
+ return pVar;
+}
+
+
void SbUserFormModule::load()
{
OSL_TRACE("** load() ");
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index 36bbb8d551..b5131c99f1 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -1,4 +1,4 @@
- /*************************************************************************
+/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -30,6 +30,8 @@
#include <basic/sbx.hxx>
#include "sbcomp.hxx"
+SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
+
// Deklaration einer Variablen
// Bei Fehlern wird bis zum Komma oder Newline geparst.
// Returnwert: eine neue Instanz, die eingefuegt und dann geloescht wird.
@@ -37,6 +39,12 @@
SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, BOOL bStatic, BOOL bConst )
{
+ bool bWithEvents = false;
+ if( Peek() == WITHEVENTS )
+ {
+ Next();
+ bWithEvents = true;
+ }
if( !TestSymbol() ) return NULL;
SbxDataType t = eScanType;
SbiSymDef* pDef = bConst ? new SbiConstDef( aSym ) : new SbiSymDef( aSym );
@@ -47,6 +55,8 @@ SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, BOOL bStatic, BOOL bConst )
pDef->SetType( t );
if( bStatic )
pDef->SetStatic();
+ if( bWithEvents )
+ pDef->SetWithEvents();
TypeDecl( *pDef );
if( !ppDim && pDim )
{
@@ -107,8 +117,10 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed )
Next();
SbiConstExpression aSize( this );
nSize = aSize.GetShortValue();
- if( nSize < 0 )
+ if( nSize < 0 || (bVBASupportOn && nSize <= 0) )
Error( SbERR_OUT_OF_RANGE );
+ else
+ rDef.SetFixedStringLength( nSize );
}
}
break;
@@ -209,7 +221,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
// #110004 It can also be a sub/function
if( !bConst && (eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY ||
- eCurTok == STATIC || eCurTok == ENUM || eCurTok == DECLARE) )
+ eCurTok == STATIC || eCurTok == ENUM || eCurTok == DECLARE || eCurTok == TYPE) )
{
// Next token is read here, because !bConst
bool bPrivate = ( eFirstTok == PRIVATE );
@@ -244,6 +256,13 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
DefDeclare( bPrivate );
return;
}
+ // #i109049
+ else if( eCurTok == TYPE )
+ {
+ Next();
+ DefType( bPrivate );
+ return;
+ }
}
#ifdef SHARED
@@ -349,9 +368,15 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
break;
default: eOp2 = _LOCAL;
}
- aGen.Gen(
- eOp2, pDef->GetId(),
- sal::static_int_cast< UINT16 >( pDef->GetType() ) );
+ UINT32 nOpnd2 = sal::static_int_cast< UINT16 >( pDef->GetType() );
+ if( pDef->IsWithEvents() )
+ nOpnd2 |= SBX_TYPE_WITH_EVENTS_FLAG;
+
+ short nFixedStringLength = pDef->GetFixedStringLength();
+ if( nFixedStringLength >= 0 )
+ nOpnd2 |= (SBX_FIXED_LEN_STRING_FLAG + (UINT32(nFixedStringLength) << 17)); // len = all bits above 0x10000
+
+ aGen.Gen( eOp2, pDef->GetId(), nOpnd2 );
}
// Initialisierung fuer selbstdefinierte Datentypen
@@ -473,7 +498,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
// d.h. pPool muss immer am Schleifen-Ende zurueckgesetzt werden.
// auch bei break
pPool = pOldPool;
- continue; // MyBreak überspingen
+ continue; // MyBreak überspingen
MyBreak:
pPool = pOldPool;
break;
@@ -506,18 +531,7 @@ void SbiParser::Erase()
{
while( !bAbort )
{
- if( !TestSymbol() ) return;
- String aName( aSym );
- SbxDataType eType = eScanType;
- SbiSymDef* pDef = pPool->Find( aName );
- if( !pDef )
- {
- if( bExplicit )
- Error( SbERR_UNDEF_VAR, aName );
- pDef = pPool->AddSym( aName );
- pDef->SetType( eType );
- }
- SbiExpression aExpr( this, *pDef );
+ SbiExpression aExpr( this, SbLVALUE );
aExpr.Gen();
aGen.Gen( _ERASE );
if( !TestComma() ) break;
@@ -576,12 +590,14 @@ void SbiParser::DefType( BOOL bPrivate )
}
if( pElem )
{
- SbxArray *pTypeMembers = pType -> GetProperties();
- if (pTypeMembers -> Find (pElem->GetName(),SbxCLASS_DONTCARE))
+ SbxArray *pTypeMembers = pType->GetProperties();
+ String aElemName = pElem->GetName();
+ if( pTypeMembers->Find( aElemName, SbxCLASS_DONTCARE) )
Error (SbERR_VAR_DEFINED);
else
{
- SbxProperty *pTypeElem = new SbxProperty (pElem->GetName(),pElem->GetType());
+ SbxDataType eElemType = pElem->GetType();
+ SbxProperty *pTypeElem = new SbxProperty( aElemName, eElemType );
if( pDim )
{
SbxDimArray* pArray = new SbxDimArray( pElem->GetType() );
@@ -618,6 +634,21 @@ void SbiParser::DefType( BOOL bPrivate )
pTypeElem->PutObject( pArray );
pTypeElem->SetFlags( nSavFlags );
}
+ // Nested user type?
+ if( eElemType == SbxOBJECT )
+ {
+ USHORT nElemTypeId = pElem->GetTypeId();
+ if( nElemTypeId != 0 )
+ {
+ String aTypeName( aGblStrings.Find( nElemTypeId ) );
+ SbxObject* pTypeObj = static_cast< SbxObject* >( rTypeArray->Find( aTypeName, SbxCLASS_OBJECT ) );
+ if( pTypeObj != NULL )
+ {
+ SbxObject* pCloneObj = cloneTypeObjectImpl( *pTypeObj );
+ pTypeElem->PutObject( pCloneObj );
+ }
+ }
+ }
delete pDim;
pTypeMembers->Insert( pTypeElem, pTypeMembers->Count() );
}
diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx
index 5e28d95ac0..82b2d39dcf 100644
--- a/basic/source/comp/exprgen.cxx
+++ b/basic/source/comp/exprgen.cxx
@@ -148,6 +148,10 @@ void SbiExprNode::Gen( RecursiveMode eRecMode )
pLeft->Gen();
pGen->Gen( _TESTCLASS, nTypeStrId );
}
+ else if( IsNew() )
+ {
+ pGen->Gen( _CREATE, 0, nTypeStrId );
+ }
else
{
pLeft->Gen();
@@ -285,6 +289,8 @@ void SbiExpression::Gen( RecursiveMode eRecMode )
// AB: 17.12.1995, Spezialbehandlung fuer WITH
// Wenn pExpr == .-Ausdruck in With, zunaechst Gen fuer Basis-Objekt
pExpr->Gen( eRecMode );
+ if( bByVal )
+ pParser->aGen.Gen( _BYVAL );
if( bBased )
{
USHORT uBase = pParser->nBase;
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index 2ae9903fec..bf891bc5a2 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -100,6 +100,15 @@ SbiExprNode::SbiExprNode( SbiParser* p, SbiExprNode* l, USHORT nId )
nTypeStrId = nId;
}
+// new <type>
+SbiExprNode::SbiExprNode( SbiParser* p, USHORT nId )
+{
+ BaseInit( p );
+
+ eType = SbxOBJECT;
+ eNodeType = SbxNEW;
+ nTypeStrId = nId;
+}
// AB: 17.12.95, Hilfsfunktion fuer Ctor fuer einheitliche Initialisierung
void SbiExprNode::BaseInit( SbiParser* p )
@@ -253,7 +262,8 @@ void SbiExprNode::CollectBits()
void SbiExprNode::FoldConstants()
{
if( IsOperand() || eTok == LIKE ) return;
- pLeft->FoldConstants();
+ if( pLeft )
+ pLeft->FoldConstants();
if( pRight )
{
pRight->FoldConstants();
@@ -431,7 +441,7 @@ void SbiExprNode::FoldConstants()
}
}
}
- else if( pLeft->IsNumber() )
+ else if( pLeft && pLeft->IsNumber() )
{
nVal = pLeft->nVal;
delete pLeft;
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index eafe38dcdb..604ac61745 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -38,7 +38,8 @@
|*
***************************************************************************/
-SbiExpression::SbiExpression( SbiParser* p, SbiExprType t, SbiExprMode eMode )
+SbiExpression::SbiExpression( SbiParser* p, SbiExprType t,
+ SbiExprMode eMode, const KeywordSymbolInfo* pKeywordSymbolInfo )
{
pParser = p;
bError = bByVal = bBased = bBracket = FALSE;
@@ -46,7 +47,7 @@ SbiExpression::SbiExpression( SbiParser* p, SbiExprType t, SbiExprMode eMode )
eCurExpr = t;
m_eMode = eMode;
pNext = NULL;
- pExpr = (t != SbSTDEXPR ) ? Term() : Boolean();
+ pExpr = (t != SbSTDEXPR ) ? Term( pKeywordSymbolInfo ) : Boolean();
if( t != SbSYMBOL )
pExpr->Optimize();
if( t == SbLVALUE && !pExpr->IsLvalue() )
@@ -114,7 +115,7 @@ static BOOL DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken eTo
if( !p->WhiteSpace() || eCurExpr != SbSYMBOL )
return FALSE;
if ( eTok == NUMBER || eTok == MINUS || eTok == FIXSTRING
- || eTok == SYMBOL || eTok == COMMA || eTok == DOT || eTok == NOT )
+ || eTok == SYMBOL || eTok == COMMA || eTok == DOT || eTok == NOT || eTok == BYVAL )
{
return TRUE;
}
@@ -177,7 +178,7 @@ static SbiSymDef* AddSym
// Zur Zeit sind sogar Keywords zugelassen (wg. gleichnamiger Dflt-Properties)
-SbiExprNode* SbiExpression::Term( void )
+SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
{
if( pParser->Peek() == DOT )
{
@@ -204,11 +205,11 @@ SbiExprNode* SbiExpression::Term( void )
return pNd;
}
- SbiToken eTok = pParser->Next();
+ SbiToken eTok = (pKeywordSymbolInfo == NULL) ? pParser->Next() : pKeywordSymbolInfo->m_eTok;
// Anfang des Parsings merken
pParser->LockColumn();
- String aSym( pParser->GetSym() );
- SbxDataType eType = pParser->GetType();
+ String aSym( (pKeywordSymbolInfo == NULL) ? pParser->GetSym() : pKeywordSymbolInfo->m_aKeywordSymbol );
+ SbxDataType eType = (pKeywordSymbolInfo == NULL) ? pParser->GetType() : pKeywordSymbolInfo->m_eSbxDataType;
SbiParameters* pPar = NULL;
SbiExprListVector* pvMoreParLcl = NULL;
// Folgen Parameter?
@@ -280,6 +281,12 @@ SbiExprNode* SbiExpression::Term( void )
// AB 31.3.1996: In Parser-Methode ausgelagert
// (wird auch in SbiParser::DefVar() in DIM.CXX benoetigt)
pDef = pParser->CheckRTLForSym( aSym, eType );
+
+ // #i109184: Check if symbol is or later will be defined inside module
+ SbModule& rMod = pParser->aGen.GetModule();
+ SbxArray* pModMethods = rMod.GetMethods();
+ if( pModMethods->Find( aSym, SbxCLASS_DONTCARE ) )
+ pDef = NULL;
}
if( !pDef )
{
@@ -417,13 +424,27 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
String aSym( pParser->GetSym() );
SbxDataType eType = pParser->GetType();
SbiParameters* pPar = NULL;
+ SbiExprListVector* pvMoreParLcl = NULL;
eTok = pParser->Peek();
// Parameter?
if( DoParametersFollow( pParser, eCurExpr, eTok ) )
{
- pPar = new SbiParameters( pParser );
+ bool bStandaloneExpression = false;
+ pPar = new SbiParameters( pParser, bStandaloneExpression );
bError |= !pPar->IsValid();
eTok = pParser->Peek();
+
+ // i109624 check for additional sets of parameters
+ while( eTok == LPAREN )
+ {
+ if( pvMoreParLcl == NULL )
+ pvMoreParLcl = new SbiExprListVector();
+ SbiParameters* pAddPar = new SbiParameters( pParser );
+ pvMoreParLcl->push_back( pAddPar );
+ bError |= !pPar->IsValid();
+ eTok = pParser->Peek();
+ }
+
}
BOOL bObj = BOOL( ( eTok == DOT || eTok == EXCLAM ) && !pParser->WhiteSpace() );
if( bObj )
@@ -450,6 +471,7 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
SbiExprNode* pNd = new SbiExprNode( pParser, *pDef, eType );
pNd->aVar.pPar = pPar;
+ pNd->aVar.pvMorePar = pvMoreParLcl;
if( bObj )
{
// Falls wir etwas mit Punkt einscannen, muss der
@@ -483,7 +505,7 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
// Funktionen
// geklammerte Ausdruecke
-SbiExprNode* SbiExpression::Operand()
+SbiExprNode* SbiExpression::Operand( bool bUsedForTypeOf )
{
SbiExprNode *pRes;
SbiToken eTok;
@@ -494,7 +516,7 @@ SbiExprNode* SbiExpression::Operand()
case SYMBOL:
pRes = Term();
// process something like "IF Not r Is Nothing Then .."
- if( pParser->IsVBASupportOn() && pParser->Peek() == IS )
+ if( !bUsedForTypeOf && pParser->IsVBASupportOn() && pParser->Peek() == IS )
{
eTok = pParser->Next();
pRes = new SbiExprNode( pParser, pRes, eTok, Like() );
@@ -576,7 +598,8 @@ SbiExprNode* SbiExpression::Unary()
case TYPEOF:
{
pParser->Next();
- SbiExprNode* pObjNode = Operand();
+ bool bUsedForTypeOf = true;
+ SbiExprNode* pObjNode = Operand( bUsedForTypeOf );
pParser->TestToken( IS );
String aDummy;
SbiSymDef* pTypeDef = new SbiSymDef( aDummy );
@@ -584,6 +607,15 @@ SbiExprNode* SbiExpression::Unary()
pNd = new SbiExprNode( pParser, pObjNode, pTypeDef->GetTypeId() );
break;
}
+ case NEW:
+ {
+ pParser->Next();
+ String aStr;
+ SbiSymDef* pTypeDef = new SbiSymDef( aStr );
+ pParser->TypeDecl( *pTypeDef, TRUE );
+ pNd = new SbiExprNode( pParser, pTypeDef->GetTypeId() );
+ break;
+ }
default:
pNd = Operand();
}
@@ -938,6 +970,14 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa
// Benannte Argumente: entweder .name= oder name:=
else
{
+ bool bByVal = false;
+ if( eTok == BYVAL )
+ {
+ bByVal = true;
+ pParser->Next();
+ eTok = pParser->Peek();
+ }
+
if( bAssumeExprLParenMode )
{
pExpr = new SbiExpression( pParser, SbSTDEXPR, EXPRMODE_LPAREN_PENDING );
@@ -961,12 +1001,22 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa
{
bBracket = TRUE;
delete pExpr;
+ if( bByVal )
+ pParser->Error( SbERR_LVALUE_EXPECTED );
return;
}
}
else
pExpr = new SbiExpression( pParser );
+ if( bByVal )
+ {
+ if( !pExpr->IsLvalue() )
+ pParser->Error( SbERR_LVALUE_EXPECTED );
+ else
+ pExpr->SetByVal();
+ }
+
//pExpr = bConst ? new SbiConstExpression( pParser )
// : new SbiExpression( pParser );
if( !bAssumeArrayMode )
diff --git a/basic/source/comp/io.cxx b/basic/source/comp/io.cxx
index 7575381c24..c7ed83c677 100644
--- a/basic/source/comp/io.cxx
+++ b/basic/source/comp/io.cxx
@@ -115,6 +115,30 @@ void SbiParser::Write()
aGen.Gen( _CHAN0 );
}
+
+// #i92642 Handle LINE keyword outside ::Next()
+void SbiParser::Line()
+{
+ // #i92642: Special handling to allow name as symbol
+ if( Peek() == INPUT )
+ {
+ Next();
+ LineInput();
+ }
+ else
+ {
+ aGen.Statement();
+
+ KeywordSymbolInfo aInfo;
+ aInfo.m_aKeywordSymbol = String( RTL_CONSTASCII_USTRINGPARAM( "line" ) );
+ aInfo.m_eSbxDataType = GetType();
+ aInfo.m_eTok = SYMBOL;
+
+ Symbol( &aInfo );
+ }
+}
+
+
// LINE INPUT [prompt], var$
void SbiParser::LineInput()
@@ -288,6 +312,19 @@ void SbiParser::Open()
void SbiParser::Name()
{
+ // #i92642: Special handling to allow name as symbol
+ if( Peek() == EQ )
+ {
+ aGen.Statement();
+
+ KeywordSymbolInfo aInfo;
+ aInfo.m_aKeywordSymbol = String( RTL_CONSTASCII_USTRINGPARAM( "name" ) );
+ aInfo.m_eSbxDataType = GetType();
+ aInfo.m_eTok = SYMBOL;
+
+ Symbol( &aInfo );
+ return;
+ }
SbiExpression aExpr1( this );
TestToken( AS );
SbiExpression aExpr2( this );
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index eecc2291e3..83e7bbd604 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -83,6 +83,7 @@ static SbiStatement StmntTable [] = {
{ IMPLEMENTS, &SbiParser::Implements, Y, N, }, // IMPLEMENTS
{ INPUT, &SbiParser::Input, N, Y, }, // INPUT
{ LET, &SbiParser::Assign, N, Y, }, // LET
+{ LINE, &SbiParser::Line, N, Y, }, // LINE, -> LINE INPUT (#i92642)
{ LINEINPUT,&SbiParser::LineInput, N, Y, }, // LINE INPUT
{ LOOP, &SbiParser::BadBlock, N, Y, }, // LOOP
{ LSET, &SbiParser::LSet, N, Y, }, // LSET
@@ -237,7 +238,9 @@ void SbiParser::Exit()
SbiToken eTok = Next();
for( SbiParseStack* p = pStack; p; p = p->pNext )
{
- if( eTok == p->eExitTok )
+ SbiToken eExitTok = p->eExitTok;
+ if( eTok == eExitTok ||
+ (eTok == PROPERTY && (eExitTok == GET || eExitTok == LET) ) ) // #i109051
{
p->nChain = aGen.Gen( _JUMP, p->nChain );
return;
@@ -367,7 +370,10 @@ BOOL SbiParser::Parse()
}
// Ende des Parsings?
- if( eCurTok == eEndTok )
+ if( eCurTok == eEndTok ||
+ ( bVBASupportOn && // #i109075
+ (eCurTok == ENDFUNC || eCurTok == ENDPROPERTY || eCurTok == ENDSUB) &&
+ (eEndTok == ENDFUNC || eEndTok == ENDPROPERTY || eEndTok == ENDSUB) ) )
{
Next();
if( eCurTok != NIL )
@@ -477,10 +483,10 @@ SbiExprNode* SbiParser::GetWithVar()
// Zuweisung oder Subroutine Call
-void SbiParser::Symbol()
+void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo )
{
SbiExprMode eMode = bVBASupportOn ? EXPRMODE_STANDALONE : EXPRMODE_STANDARD;
- SbiExpression aVar( this, SbSYMBOL, eMode );
+ SbiExpression aVar( this, SbSYMBOL, eMode, pKeywordSymbolInfo );
bool bEQ = ( Peek() == EQ );
if( !bEQ && bVBASupportOn && aVar.IsBracket() )
@@ -704,11 +710,37 @@ void SbiParser::Implements()
return;
}
- if( TestSymbol() )
+ Peek();
+ if( eCurTok != SYMBOL )
+ {
+ Error( SbERR_SYMBOL_EXPECTED );
+ return;
+ }
+
+ String aImplementedIface = aSym;
+ Next();
+ if( Peek() == DOT )
{
- String aImplementedIface = GetSym();
- aIfaceVector.push_back( aImplementedIface );
+ String aDotStr( '.' );
+ while( Peek() == DOT )
+ {
+ aImplementedIface += aDotStr;
+ Next();
+ SbiToken ePeekTok = Peek();
+ if( ePeekTok == SYMBOL || IsKwd( ePeekTok ) )
+ {
+ Next();
+ aImplementedIface += aSym;
+ }
+ else
+ {
+ Next();
+ Error( SbERR_SYMBOL_EXPECTED );
+ break;
+ }
+ }
}
+ aIfaceVector.push_back( aImplementedIface );
}
void SbiParser::EnableCompatibility()
@@ -745,12 +777,16 @@ void SbiParser::Option()
break;
}
case COMPARE:
- switch( Next() )
- {
- case TEXT: bText = TRUE; return;
- case BINARY: bText = FALSE; return;
- default:;
- } // Fall thru!
+ {
+ SbiToken eTok = Next();
+ if( eTok == BINARY )
+ bText = FALSE;
+ else if( eTok == SYMBOL && GetSym().EqualsIgnoreCaseAscii("text") )
+ bText = TRUE;
+ else
+ Error( SbERR_EXPECTED, "Text/Binary" );
+ break;
+ }
case COMPATIBLE:
EnableCompatibility();
break;
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 08703e7036..a09cc4490b 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -300,12 +300,14 @@ SbiSymDef::SbiSymDef( const String& rName ) : aName( rName )
bStatic =
bOpt =
bParamArray =
+ bWithEvents =
bByVal =
bChained =
bGlobal = FALSE;
pIn =
pPool = NULL;
nDefaultId = 0;
+ nFixedStringLength = -1;
}
SbiSymDef::~SbiSymDef()
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index a41944c852..00690796a7 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -185,6 +185,7 @@ static TokenTable aTokTable_Basic [] = { // Token-Tabelle:
{ WEND, "Wend" },
{ WHILE, "While" },
{ WITH, "With" },
+ { WITHEVENTS, "WithEvents" },
{ WRITE, "Write" }, // auch WRITE #
{ XOR, "Xor" },
{ NIL, "" }
@@ -353,6 +354,29 @@ TokenTable aTokTable_Java [] = { // Token-Tabelle:
};
*/
+// #i109076
+TokenLabelInfo::TokenLabelInfo( void )
+{
+ m_pTokenCanBeLabelTab = new bool[VBASUPPORT+1];
+ for( int i = 0 ; i <= VBASUPPORT ; ++i )
+ m_pTokenCanBeLabelTab[i] = false;
+
+ // Token accepted as label by VBA
+ SbiToken eLabelToken[] = { ACCESS, ALIAS, APPEND, BASE, BINARY, CLASSMODULE,
+ COMPARE, COMPATIBLE, DEFERR, _ERROR_, EXPLICIT, LIB, LINE, LPRINT, NAME,
+ TOBJECT, OUTPUT, PROPERTY, RANDOM, READ, STEP, STOP, TEXT, VBASUPPORT, NIL };
+ SbiToken* pTok = eLabelToken;
+ SbiToken eTok;
+ for( pTok = eLabelToken ; (eTok = *pTok) != NIL ; ++pTok )
+ m_pTokenCanBeLabelTab[eTok] = true;
+}
+
+TokenLabelInfo::~TokenLabelInfo()
+{
+ delete[] m_pTokenCanBeLabelTab;
+}
+
+
// Der Konstruktor ermittelt die Laenge der Token-Tabelle.
SbiTokenizer::SbiTokenizer( const ::rtl::OUString& rSrc, StarBASIC* pb )
@@ -371,7 +395,8 @@ SbiTokenizer::SbiTokenizer( const ::rtl::OUString& rSrc, StarBASIC* pb )
}
SbiTokenizer::~SbiTokenizer()
-{}
+{
+}
// Wiederablage (Pushback) eines Tokens. (Bis zu 2 Tokens)
@@ -513,7 +538,8 @@ SbiToken SbiTokenizer::Next()
tp = &pTokTable[ lb + delta ];
StringCompare res = aSym.CompareIgnoreCaseToAscii( tp->s );
// Gefunden?
- if( res == COMPARE_EQUAL ) goto special;
+ if( res == COMPARE_EQUAL )
+ goto special;
// Groesser? Dann untere Haelfte
if( res == COMPARE_LESS )
{
@@ -534,24 +560,14 @@ SbiToken SbiTokenizer::Next()
return eCurTok = SYMBOL;
}
special:
- // LINE INPUT
- if( tp->t == LINE )
- {
- short nC1 = nCol1;
- String aOldSym = aSym;
- eCurTok = Peek();
- if( eCurTok == INPUT )
- {
- Next();
- nCol1 = nC1;
- return eCurTok = LINEINPUT;
- }
- else
- {
- aSym = aOldSym;
- return eCurTok = LINE;
- }
- }
+ // #i92642
+ if( eCurTok != NIL && eCurTok != REM && eCurTok != EOLN && (tp->t == NAME || tp->t == LINE) )
+ return eCurTok = SYMBOL;
+ else if( tp->t == TEXT )
+ return eCurTok = SYMBOL;
+
+ // #i92642: Special LINE token handling -> SbiParser::Line()
+
// END IF, CASE, SUB, DEF, FUNCTION, TYPE, CLASS, WITH
if( tp->t == END )
{
@@ -639,7 +655,7 @@ special:
BOOL SbiTokenizer::MayBeLabel( BOOL bNeedsColon )
{
- if( eCurTok == SYMBOL )
+ if( eCurTok == SYMBOL || m_aTokenLabelInfo.canTokenBeLabel( eCurTok ) )
return bNeedsColon ? DoesColonFollow() : TRUE;
else
return BOOL( eCurTok == NUMBER
diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx
index 362e9e2947..c9dd546d43 100644
--- a/basic/source/inc/codegen.hxx
+++ b/basic/source/inc/codegen.hxx
@@ -44,6 +44,7 @@ class SbiCodeGen { // Code-Erzeugung:
public:
SbiCodeGen( SbModule&, SbiParser*, short );
SbiParser* GetParser() { return pParser; }
+ SbModule& GetModule() { return rMod; }
UINT32 Gen( SbiOpcode );
UINT32 Gen( SbiOpcode, UINT32 );
UINT32 Gen( SbiOpcode, UINT32, UINT32 );
@@ -53,7 +54,6 @@ public:
void GenStmnt(); // evtl. Statement-Opcode erzeugen
UINT32 GetPC();
UINT32 GetOffset() { return GetPC() + 1; }
- SbModule& GetModule() { return rMod; }
void Save();
// #29955 for-Schleifen-Ebene pflegen
diff --git a/basic/source/inc/dlgcont.hxx b/basic/source/inc/dlgcont.hxx
index b5387ce483..7d22f4d64c 100644
--- a/basic/source/inc/dlgcont.hxx
+++ b/basic/source/inc/dlgcont.hxx
@@ -54,14 +54,17 @@ class SfxDialogLibraryContainer : public SfxLibraryContainer
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
virtual void SAL_CALL writeLibraryElement
(
- ::com::sun::star::uno::Any aElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
const ::rtl::OUString& aElementName,
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput
)
throw(::com::sun::star::uno::Exception);
virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
- ( const ::rtl::OUString& aFile,
+ (
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
+ const ::rtl::OUString& aElementName,
+ const ::rtl::OUString& aFile,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream );
virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile );
diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx
index 712ae8b606..af7302d1e1 100644
--- a/basic/source/inc/expr.hxx
+++ b/basic/source/inc/expr.hxx
@@ -52,6 +52,13 @@ struct SbVar { // Variablen-Element:
SbiExprListVector* pvMorePar; // Array of arrays foo(pPar)(avMorePar[0])(avMorePar[1])...
};
+struct KeywordSymbolInfo
+{
+ String m_aKeywordSymbol;
+ SbxDataType m_eSbxDataType;
+ SbiToken m_eTok;
+};
+
enum SbiExprType { // Expression-Typen:
SbSTDEXPR, // normaler Ausdruck
SbLVALUE, // beliebiger lValue
@@ -76,6 +83,7 @@ enum SbiNodeType {
SbxVARVAL, // aVar = Wert
SbxTYPEOF, // TypeOf ObjExpr Is Type
SbxNODE, // Node
+ SbxNEW, // new <type> expression
SbxDUMMY
};
@@ -107,9 +115,11 @@ class SbiExprNode { // Operatoren (und Operanden)
void FoldConstants(); // Constant Folding durchfuehren
void CollectBits(); // Umwandeln von Zahlen in Strings
BOOL IsOperand() // TRUE, wenn Operand
- { return BOOL( eNodeType != SbxNODE && eNodeType != SbxTYPEOF ); }
+ { return BOOL( eNodeType != SbxNODE && eNodeType != SbxTYPEOF && eNodeType != SbxNEW ); }
BOOL IsTypeOf()
{ return BOOL( eNodeType == SbxTYPEOF ); }
+ BOOL IsNew()
+ { return BOOL( eNodeType == SbxNEW ); }
BOOL IsNumber(); // TRUE bei Zahlen
BOOL IsString(); // TRUE bei Strings
BOOL IsLvalue(); // TRUE, falls als Lvalue verwendbar
@@ -122,6 +132,7 @@ public:
SbiExprNode( SbiParser*, const SbiSymDef&, SbxDataType, SbiExprList* = NULL );
SbiExprNode( SbiParser*, SbiExprNode*, SbiToken, SbiExprNode* );
SbiExprNode( SbiParser*, SbiExprNode*, USHORT ); // #120061 TypeOf
+ SbiExprNode( SbiParser*, USHORT ); // new <type>
virtual ~SbiExprNode();
BOOL IsValid() { return BOOL( !bError ); }
@@ -166,9 +177,9 @@ protected:
BOOL bByVal; // TRUE: ByVal-Parameter
BOOL bBracket; // TRUE: Parameter list with brackets
USHORT nParenLevel;
- SbiExprNode* Term();
+ SbiExprNode* Term( const KeywordSymbolInfo* pKeywordSymbolInfo = NULL );
SbiExprNode* ObjTerm( SbiSymDef& );
- SbiExprNode* Operand();
+ SbiExprNode* Operand( bool bUsedForTypeOf = false );
SbiExprNode* Unary();
SbiExprNode* Exp();
SbiExprNode* MulDiv();
@@ -180,7 +191,8 @@ protected:
SbiExprNode* Comp();
SbiExprNode* Boolean();
public:
- SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR, SbiExprMode eMode = EXPRMODE_STANDARD ); // Parsender Ctor
+ SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR,
+ SbiExprMode eMode = EXPRMODE_STANDARD, const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); // Parsender Ctor
SbiExpression( SbiParser*, const String& );
SbiExpression( SbiParser*, double, SbxDataType = SbxDOUBLE );
SbiExpression( SbiParser*, const SbiSymDef&, SbiExprList* = NULL );
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 7bbe89671e..6db0b96933 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/script/XLibraryContainerExport.hpp>
+#include <com/sun/star/script/XLibraryContainer3.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
@@ -57,8 +58,7 @@
#include <com/sun/star/deployment/XPackage.hpp>
#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/compbase6.hxx>
-#include <cppuhelper/compbase7.hxx>
+#include <cppuhelper/compbase8.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <com/sun/star/script/XVBACompat.hpp>
@@ -67,11 +67,12 @@ class BasicManager;
namespace basic
{
-typedef ::cppu::WeakComponentImplHelper7<
+typedef ::cppu::WeakComponentImplHelper8<
::com::sun::star::lang::XInitialization,
::com::sun::star::script::XStorageBasedLibraryContainer,
::com::sun::star::script::XLibraryContainerPassword,
::com::sun::star::script::XLibraryContainerExport,
+ ::com::sun::star::script::XLibraryContainer3,
::com::sun::star::container::XContainer,
::com::sun::star::script::XVBACompat,
::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
@@ -284,14 +285,17 @@ protected:
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0;
virtual void SAL_CALL writeLibraryElement
(
- ::com::sun::star::uno::Any aElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
const ::rtl::OUString& aElementName,
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput
)
throw(::com::sun::star::uno::Exception) = 0;
virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
- ( const ::rtl::OUString& aFile,
+ (
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
+ const ::rtl::OUString& aElementName,
+ const ::rtl::OUString& aFile,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream ) = 0;
virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ) = 0;
@@ -409,6 +413,12 @@ public:
virtual ::rtl::OUString SAL_CALL getContainerLocationName() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL storeLibraries( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ //Methods XLibraryContainer3
+ virtual ::rtl::OUString SAL_CALL getOriginalLibraryLinkURL( const ::rtl::OUString& Name )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+
// Methods XLibraryContainer2 (base of XPersistentLibraryContainer)
virtual sal_Bool SAL_CALL isLibraryLink( const ::rtl::OUString& Name )
throw (::com::sun::star::container::NoSuchElementException,
@@ -548,6 +558,8 @@ private:
::rtl::OUString maLibInfoFileURL;
::rtl::OUString maStorageURL;
::rtl::OUString maUnexpandedStorageURL;
+ ::rtl::OUString maOrignialStorageURL;
+
sal_Bool mbLink;
sal_Bool mbReadOnly;
sal_Bool mbReadOnlyLink;
@@ -696,6 +708,7 @@ enum IteratorState
{
USER_EXTENSIONS,
SHARED_EXTENSIONS,
+ BUNDLED_EXTENSIONS,
END_REACHED
};
@@ -715,6 +728,8 @@ protected:
implGetNextUserScriptPackage( bool& rbPureDialogLib );
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >
implGetNextSharedScriptPackage( bool& rbPureDialogLib );
+ com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >
+ implGetNextBundledScriptPackage( bool& rbPureDialogLib );
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
@@ -728,8 +743,16 @@ protected:
< com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq;
bool m_bSharedPackagesLoaded;
+ com::sun::star::uno::Sequence< com::sun::star::uno::Reference
+ < com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq;
+ bool m_bBundledPackagesLoaded;
+
+
int m_iUserPackage;
int m_iSharedPackage;
+ int m_iBundledPackage;
+
+
ScriptSubPackageIterator* m_pScriptSubPackageIterator;
diff --git a/basic/source/inc/opcodes.hxx b/basic/source/inc/opcodes.hxx
index f82c8854ba..9eb1a27c8f 100644
--- a/basic/source/inc/opcodes.hxx
+++ b/basic/source/inc/opcodes.hxx
@@ -93,6 +93,7 @@ enum SbiOpcode {
_VBASET, // VBA-like Set
_ERASE_CLEAR, // Erase array and clear variable
_ARRAYACCESS, // Assign parameters to TOS and get value, used for array of arrays
+ _BYVAL, // byref -> byval for lvalue parameter passed in call
SbOP0_END,
// Alle Opcodes mit einem Operanden
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index 04c0269388..4fb7b1886c 100644
--- a/basic/source/inc/parser.hxx
+++ b/basic/source/inc/parser.hxx
@@ -99,7 +99,7 @@ public:
BOOL TestComma(); // Komma oder EOLN?
void TestEoln(); // EOLN?
- void Symbol(); // Let oder Call
+ void Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); // Let oder Call
void ErrorStmnt(); // ERROR n
void NotImp(); // nicht implementiert
void BadBlock(); // LOOP/WEND/NEXT
@@ -119,6 +119,7 @@ public:
void If(); // IF
void Implements(); // IMPLEMENTS
void Input(); // INPUT, INPUT #
+ void Line(); // LINE -> LINE INPUT [#] (#i92642)
void LineInput(); // LINE INPUT, LINE INPUT #
void LSet(); // LSET
void Name(); // NAME .. AS ..
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index 64ecac24a5..96de7e5ce6 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -407,7 +407,7 @@ class SbiRuntime
void StepPRINTF(), StepWRITE(), StepRENAME(), StepPROMPT();
void StepRESTART(), StepEMPTY(), StepLEAVE();
void StepLSET(), StepRSET(), StepREDIMP_ERASE(), StepERASE_CLEAR();
- void StepARRAYACCESS();
+ void StepARRAYACCESS(), StepBYVAL();
// Alle Opcodes mit einem Operanden
void StepLOADNC( UINT32 ), StepLOADSC( UINT32 ), StepLOADI( UINT32 );
void StepARGN( UINT32 ), StepBASED( UINT32 ), StepPAD( UINT32 );
@@ -416,7 +416,7 @@ class SbiRuntime
void StepGOSUB( UINT32 ), StepRETURN( UINT32 );
void StepTESTFOR( UINT32 ), StepCASETO( UINT32 ), StepERRHDL( UINT32 );
void StepRESUME( UINT32 ), StepSETCLASS( UINT32 ), StepVBASETCLASS( UINT32 ), StepTESTCLASS( UINT32 ), StepLIB( UINT32 );
- bool checkClass_Impl( const SbxVariableRef& refVal, const String& aClass, bool bRaiseErrors );
+ bool checkClass_Impl( const SbxVariableRef& refVal, const String& aClass, bool bRaiseErrors, bool bDefault = true );
void StepCLOSE( UINT32 ), StepPRCHAR( UINT32 ), StepARGTYP( UINT32 );
// Alle Opcodes mit zwei Operanden
void StepRTL( UINT32, UINT32 ), StepPUBLIC( UINT32, UINT32 ), StepPUBLIC_P( UINT32, UINT32 );
@@ -434,6 +434,7 @@ class SbiRuntime
void StepDCREATE_REDIMP(UINT32,UINT32), StepDCREATE_IMPL(UINT32,UINT32);
void StepFIND_CM( UINT32, UINT32 );
void StepFIND_STATIC( UINT32, UINT32 );
+ void implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 );
public:
void SetVBAEnabled( bool bEnabled );
USHORT GetImageFlag( USHORT n ) const;
diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx
index 3423f99a84..938315aa12 100644
--- a/basic/source/inc/sbintern.hxx
+++ b/basic/source/inc/sbintern.hxx
@@ -39,6 +39,7 @@ namespace utl
class SbUnoFactory;
class SbTypeFactory;
class SbOLEFactory;
+class SbFormFactory;
class SbiInstance;
class SbModule;
@@ -101,6 +102,7 @@ struct SbiGlobals
SbTypeFactory* pTypeFac; // Factory for user defined types
SbClassFactory* pClassFac; // Factory for user defined classes (based on class modules)
SbOLEFactory* pOLEFac; // Factory for OLE types
+ SbFormFactory* pFormFac; // Factory for user forms
SbModule* pMod; // aktuell aktives Modul
SbModule* pCompMod; // aktuell compiliertes Modul
short nInst; // Anzahl BASICs
@@ -136,6 +138,7 @@ SbiGlobals* GetSbData();
#define pTYPEFAC GetSbData()->pTypeFac
#define pCLASSFAC GetSbData()->pClassFac
#define pOLEFAC GetSbData()->pOLEFac
+#define pFORMFAC GetSbData()->pFormFac
#endif
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index b1abdcd9ee..2c71183918 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -53,14 +53,17 @@ class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPas
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
virtual void SAL_CALL writeLibraryElement
(
- ::com::sun::star::uno::Any aElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
const ::rtl::OUString& aElementName,
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput
)
throw(::com::sun::star::uno::Exception);
virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
- ( const ::rtl::OUString& aFile,
+ (
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
+ const ::rtl::OUString& aElementName,
+ const ::rtl::OUString& aFile,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream );
virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile );
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index cb1301bf83..a2a5896943 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -132,7 +132,9 @@ protected:
BOOL bAs : 1; // TRUE: Datentyp per AS XXX definiert
BOOL bGlobal : 1; // TRUE: Global-Variable
BOOL bParamArray : 1; // TRUE: ParamArray parameter
+ BOOL bWithEvents : 1; // TRUE: Declared WithEvents
USHORT nDefaultId; // Symbol number of default value
+ short nFixedStringLength; // String length in: Dim foo As String*Length
public:
SbiSymDef( const String& );
virtual ~SbiSymDef();
@@ -156,6 +158,7 @@ public:
BOOL IsDefined() const{ return bChained; }
void SetOptional() { bOpt = TRUE; }
void SetParamArray() { bParamArray = TRUE; }
+ void SetWithEvents() { bWithEvents = TRUE; }
void SetByVal() { bByVal = TRUE; }
void SetStatic( BOOL bAsStatic = TRUE ) { bStatic = bAsStatic; }
void SetNew() { bNew = TRUE; }
@@ -165,11 +168,14 @@ public:
USHORT GetDefaultId( void ) { return nDefaultId; }
BOOL IsOptional() const{ return bOpt; }
BOOL IsParamArray() const{ return bParamArray; }
+ BOOL IsWithEvents() const{ return bWithEvents; }
BOOL IsByVal() const { return bByVal; }
BOOL IsStatic() const { return bStatic; }
BOOL IsNew() const { return bNew; }
BOOL IsDefinedAs() const { return bAs; }
BOOL IsGlobal() const { return bGlobal; }
+ short GetFixedStringLength( void ) const { return nFixedStringLength; }
+ void SetFixedStringLength( short n ) { nFixedStringLength = n; }
SbiSymPool& GetPool();
UINT32 Define(); // Symbol in Code definieren
diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx
index 737075a797..7c3ff75332 100644
--- a/basic/source/inc/token.hxx
+++ b/basic/source/inc/token.hxx
@@ -95,7 +95,7 @@ enum SbiToken {
NUMBER=FIRSTEXTRA, FIXSTRING, SYMBOL, _CDECL_, BYVAL, BYREF,
OUTPUT, RANDOM, APPEND, BINARY, ACCESS,
LOCK, READ, PRESERVE, BASE, ANY, LIB, _OPTIONAL_,
- EXPLICIT, COMPATIBLE, CLASSMODULE, PARAMARRAY,
+ EXPLICIT, COMPATIBLE, CLASSMODULE, PARAMARRAY, WITHEVENTS,
// Ab hier kommen JavaScript-Tokens (gleiches enum, damit gleicher Typ)
FIRSTJAVA,
@@ -120,7 +120,25 @@ enum SbiToken {
#undef SbiTokenSHAREDTMPUNDEF
#endif
+// #i109076
+class TokenLabelInfo
+{
+ bool* m_pTokenCanBeLabelTab;
+
+public:
+ TokenLabelInfo( void );
+ TokenLabelInfo( const TokenLabelInfo& rInfo )
+ : m_pTokenCanBeLabelTab( NULL )
+ { (void)rInfo; }
+ ~TokenLabelInfo();
+
+ bool canTokenBeLabel( SbiToken eTok )
+ { return m_pTokenCanBeLabelTab[eTok]; }
+};
+
class SbiTokenizer : public SbiScanner {
+ TokenLabelInfo m_aTokenLabelInfo;
+
protected:
SbiToken eCurTok; // aktuelles Token
SbiToken ePush; // Pushback-Token
diff --git a/basic/source/runtime/dllmgr.cxx b/basic/source/runtime/dllmgr.cxx
index 092548b36f..bc08a8cb64 100644
--- a/basic/source/runtime/dllmgr.cxx
+++ b/basic/source/runtime/dllmgr.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* 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
@@ -25,647 +25,714 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
+#include "sal/config.h"
-#include <stdlib.h>
-#ifdef OS2
-#define INCL_DOSMODULEMGR
-#include <svpm.h>
-#endif
-
-#if defined( WIN ) || defined( WNT )
-#ifndef _SVWIN_H
-#undef WB_LEFT
-#undef WB_RIGHT
-#include <tools/svwin.h>
-#endif
-#endif
-#include <tools/debug.hxx>
-#include <tools/string.hxx>
-#include <tools/errcode.hxx>
-#include <basic/sbxvar.hxx>
-#include <basic/sbx.hxx>
-
-#if defined(WIN)
-typedef HINSTANCE SbiDllHandle;
-typedef FARPROC SbiDllProc;
-#elif defined(WNT)
-typedef HMODULE SbiDllHandle;
-typedef int(*SbiDllProc)();
-#elif defined(OS2)
-typedef HMODULE SbiDllHandle;
-typedef PFN SbiDllProc;
-#else
-typedef void* SbiDllHandle;
-typedef void* SbiDllProc;
-#endif
+#include <algorithm>
+#include <cstddef>
+#include <list>
+#include <map>
+#include <vector>
-#define _DLLMGR_CXX
-#include "dllmgr.hxx"
-#include <basic/sberrors.hxx>
+#include "basic/sbx.hxx"
+#include "basic/sbxvar.hxx"
+#include "osl/thread.h"
+#include "rtl/ref.hxx"
+#include "rtl/string.hxx"
+#include "rtl/ustring.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+#include "tools/svwin.h"
-#ifndef WINAPI
-#ifdef WNT
-#define WINAPI __far __pascal
-#endif
-#endif
+#undef max
-extern "C" {
-#if defined(INTEL) && (defined(WIN) || defined(WNT))
+#include "dllmgr.hxx"
-extern INT16 WINAPI CallINT( SbiDllProc, char *stack, short nstack);
-extern INT32 WINAPI CallLNG( SbiDllProc, char *stack, short nstack);
-#ifndef WNT
-extern float WINAPI CallSNG( SbiDllProc, char *stack, short nstack);
-#endif
-extern double WINAPI CallDBL( SbiDllProc, char *stack, short nstack);
-extern char* WINAPI CallSTR( SbiDllProc, char *stack, short nstack);
-// extern CallFIX( SbiDllProc, char *stack, short nstack);
+/* Open issues:
-#else
+ Only 32-bit Windows for now.
-INT16 CallINT( SbiDllProc, char *, short ) { return 0; }
-INT32 CallLNG( SbiDllProc, char *, short ) { return 0; }
-float CallSNG( SbiDllProc, char *, short ) { return 0; }
-double CallDBL( SbiDllProc, char *, short) { return 0; }
-char* CallSTR( SbiDllProc, char *, short ) { return 0; }
-#endif
-}
+ Missing support for functions returning structs (see TODO in call()).
-SV_IMPL_OP_PTRARR_SORT(ImplDllArr,ByteStringPtr)
+ Missing support for additional data types (64 bit integers, Any, ...; would
+ trigger OSL_ASSERT(false) in various switches).
-/* mit Optimierung An stuerzt unter Win95 folgendes Makro ab:
-declare Sub MessageBeep Lib "user32" (ByVal long)
-sub main
- MessageBeep( 1 )
-end sub
+ It is assumed that the variables passed into SbiDllMgr::Call to represent
+ the arguments and return value have types that exactly match the Declare
+ statement; it would be better if this code had access to the function
+ signature from the Declare statement, so that it could convert the passed
+ variables accordingly.
*/
-#if defined (WNT) && defined (MSC)
-//#pragma optimize ("", off)
-#endif
-
-//
-// ***********************************************************************
-//
-class ImplSbiProc : public ByteString
-{
- SbiDllProc pProc;
- ImplSbiProc();
- ImplSbiProc( const ImplSbiProc& );
+#if defined WNT // only 32-bit Windows, actually
-public:
- ImplSbiProc( const ByteString& rName, SbiDllProc pFunc )
- : ByteString( rName ) { pProc = pFunc; }
- SbiDllProc GetProc() const { return pProc; }
-};
+extern "C" {
-//
-// ***********************************************************************
-//
+int __stdcall DllMgr_call32(FARPROC, void const * stack, std::size_t size);
+double __stdcall DllMgr_callFp(FARPROC, void const * stack, std::size_t size);
-class ImplSbiDll : public ByteString
-{
- ImplDllArr aProcArr;
- SbiDllHandle hDLL;
+}
- ImplSbiDll( const ImplSbiDll& );
-public:
- ImplSbiDll( const ByteString& rName, SbiDllHandle hHandle )
- : ByteString( rName ) { hDLL = hHandle; }
- ~ImplSbiDll();
- SbiDllHandle GetHandle() const { return hDLL; }
- SbiDllProc GetProc( const ByteString& rName ) const;
- void InsertProc( const ByteString& rName, SbiDllProc pProc );
-};
+namespace {
-ImplSbiDll::~ImplSbiDll()
-{
- USHORT nCount = aProcArr.Count();
- for( USHORT nCur = 0; nCur < nCount; nCur++ )
- {
- ImplSbiProc* pProc = (ImplSbiProc*)aProcArr.GetObject( nCur );
- delete pProc;
- }
+char * address(std::vector< char > & blob) {
+ return blob.empty() ? 0 : &blob[0];
}
-SbiDllProc ImplSbiDll::GetProc( const ByteString& rName ) const
-{
- USHORT nPos;
- BOOL bRet = aProcArr.Seek_Entry( (ByteStringPtr)&rName, &nPos );
- if( bRet )
- {
- ImplSbiProc* pImplProc = (ImplSbiProc*)aProcArr.GetObject(nPos);
- return pImplProc->GetProc();
- }
- return (SbiDllProc)0;
+SbError convert(rtl::OUString const & source, rtl::OString * target) {
+ return
+ source.convertToString(
+ target, osl_getThreadTextEncoding(),
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))
+ ? ERRCODE_NONE : ERRCODE_BASIC_BAD_ARGUMENT;
+ //TODO: more specific errcode?
}
-void ImplSbiDll::InsertProc( const ByteString& rName, SbiDllProc pProc )
-{
- DBG_ASSERT(aProcArr.Seek_Entry((ByteStringPtr)&rName,0)==0,"InsertProc: Already in table");
- ImplSbiProc* pImplProc = new ImplSbiProc( rName, pProc );
- aProcArr.Insert( (ByteStringPtr)pImplProc );
+SbError convert(char const * source, sal_Int32 length, rtl::OUString * target) {
+ return
+ rtl_convertStringToUString(
+ &target->pData, source, length, osl_getThreadTextEncoding(),
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))
+ ? ERRCODE_NONE : ERRCODE_BASIC_BAD_ARGUMENT;
+ //TODO: more specific errcode?
}
+struct UnmarshalData {
+ UnmarshalData(SbxVariable * theVariable, void * theBuffer):
+ variable(theVariable), buffer(theBuffer) {}
-//
-// ***********************************************************************
-//
+ SbxVariable * variable;
+ void * buffer;
+};
-SbiDllMgr::SbiDllMgr( const SbiDllMgr& )
-{
-}
+struct StringData: public UnmarshalData {
+ StringData(SbxVariable * theVariable, void * theBuffer, bool theSpecial):
+ UnmarshalData(theVariable, theBuffer), special(theSpecial) {}
-SbiDllMgr::SbiDllMgr()
-{
-}
+ bool special;
+};
-SbiDllMgr::~SbiDllMgr()
-{
- USHORT nCount = aDllArr.Count();
- for( USHORT nCur = 0; nCur < nCount; nCur++ )
- {
- ImplSbiDll* pDll = (ImplSbiDll*)aDllArr.GetObject( nCur );
- FreeDllHandle( pDll->GetHandle() );
- delete pDll;
+class MarshalData: private boost::noncopyable {
+public:
+ std::vector< char > * newBlob() {
+ blobs_.push_front(std::vector< char >());
+ return &blobs_.front();
}
-}
-void SbiDllMgr::FreeDll( const ByteString& rDllName )
-{
- USHORT nPos;
- BOOL bRet = aDllArr.Seek_Entry( (ByteStringPtr)&rDllName, &nPos );
- if( bRet )
- {
- ImplSbiDll* pDll = (ImplSbiDll*)aDllArr.GetObject(nPos);
- FreeDllHandle( pDll->GetHandle() );
- delete pDll;
- aDllArr.Remove( nPos, 1 );
- }
-}
+ std::vector< UnmarshalData > unmarshal;
+ std::vector< StringData > unmarshalStrings;
-ImplSbiDll* SbiDllMgr::GetDll( const ByteString& rDllName )
-{
- USHORT nPos;
- ImplSbiDll* pDll = 0;
- BOOL bRet = aDllArr.Seek_Entry( (ByteStringPtr)&rDllName, &nPos );
- if( bRet )
- pDll = (ImplSbiDll*)aDllArr.GetObject(nPos);
- else
- {
- SbiDllHandle hDll = CreateDllHandle( rDllName );
- if( hDll )
- {
- pDll = new ImplSbiDll( rDllName, hDll );
- aDllArr.Insert( (ByteStringPtr)pDll );
- }
- }
- return pDll;
+private:
+ std::list< std::vector< char > > blobs_;
+};
+
+std::size_t align(std::size_t address, std::size_t alignment) {
+ // alignment = 2^k for some k >= 0
+ return (address + (alignment - 1)) & ~(alignment - 1);
}
-SbiDllProc SbiDllMgr::GetProc( ImplSbiDll* pDll, const ByteString& rProcName )
+char * align(
+ std::vector< char > & blob, std::size_t alignment, std::size_t offset,
+ std::size_t add)
{
- DBG_ASSERT(pDll,"GetProc: No dll-ptr");
- SbiDllProc pProc;
- pProc = pDll->GetProc( rProcName );
- if( !pProc )
- {
- pProc = GetProcAddr( pDll->GetHandle(), rProcName );
- if( pProc )
- pDll->InsertProc( rProcName, pProc );
- }
- return pProc;
+ std::vector< char >::size_type n = blob.size();
+ n = align(n - offset, alignment) + offset; //TODO: overflow in align()
+ blob.resize(n + add); //TODO: overflow
+ return address(blob) + n;
}
-
-SbError SbiDllMgr::Call( const char* pProcName, const char* pDllName,
- SbxArray* pArgs, SbxVariable& rResult, BOOL bCDecl )
+template< typename T > void add(
+ std::vector< char > & blob, T const & data, std::size_t alignment,
+ std::size_t offset)
{
- DBG_ASSERT(pProcName&&pDllName,"Call: Bad parms");
- SbError nSbErr = 0;
- ByteString aDllName( pDllName );
- CheckDllName( aDllName );
- ImplSbiDll* pDll = GetDll( aDllName );
- if( pDll )
- {
- SbiDllProc pProc = GetProc( pDll, pProcName );
- if( pProc )
- {
- if( bCDecl )
- nSbErr = CallProcC( pProc, pArgs, rResult );
- else
- nSbErr = CallProc( pProc, pArgs, rResult );
+ *reinterpret_cast< T * >(align(blob, alignment, offset, sizeof (T))) = data;
+}
+
+std::size_t alignment(SbxVariable * variable) {
+ OSL_ASSERT(variable != 0);
+ if ((variable->GetType() & SbxARRAY) == 0) {
+ switch (variable->GetType()) {
+ case SbxINTEGER:
+ return 2;
+ case SbxLONG:
+ case SbxSINGLE:
+ case SbxSTRING:
+ return 4;
+ case SbxDOUBLE:
+ return 8;
+ case SbxOBJECT:
+ {
+ std::size_t n = 1;
+ SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
+ GetProperties();
+ for (USHORT i = 0; i < props->Count(); ++i) {
+ n = std::max(n, alignment(props->Get(i)));
+ }
+ return n;
+ }
+ case SbxBOOL:
+ case SbxBYTE:
+ return 1;
+ default:
+ OSL_ASSERT(false);
+ return 1;
}
- else
- nSbErr = SbERR_PROC_UNDEFINED;
+ } else {
+ SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
+ int dims = arr->GetDims();
+ std::vector< INT32 > low(dims);
+ for (int i = 0; i < dims; ++i) {
+ INT32 up;
+ arr->GetDim32(i + 1, low[i], up);
+ }
+ return alignment(arr->Get32(&low[0]));
}
- else
- nSbErr = SbERR_BAD_DLL_LOAD;
- return nSbErr;
}
-// ***********************************************************************
-// ******************* abhaengige Implementationen ***********************
-// ***********************************************************************
+SbError marshal(
+ bool outer, SbxVariable * variable, bool special,
+ std::vector< char > & blob, std::size_t offset, MarshalData & data);
-void SbiDllMgr::CheckDllName( ByteString& rDllName )
+SbError marshalString(
+ SbxVariable * variable, bool special, MarshalData & data, void ** buffer)
{
-#if defined(WIN) || defined(WNT) || defined(OS2)
- if( rDllName.Search('.') == STRING_NOTFOUND )
- rDllName += ".DLL";
-#else
- (void)rDllName;
-#endif
+ OSL_ASSERT(variable != 0 && buffer != 0);
+ rtl::OString str;
+ SbError e = convert(variable->GetString(), &str);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ std::vector< char > * blob = data.newBlob();
+ blob->insert(blob->begin(), str.getStr(), str.getStr() + str.getLength());
+ *buffer = address(*blob);
+ data.unmarshalStrings.push_back(StringData(variable, *buffer, special));
+ return ERRCODE_NONE;
}
-
-SbiDllHandle SbiDllMgr::CreateDllHandle( const ByteString& rDllName )
+SbError marshalStruct(
+ SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
+ MarshalData & data)
{
- (void)rDllName;
-
-#if defined(UNX)
- SbiDllHandle hLib=0;
-#else
- SbiDllHandle hLib;
-#endif
-
-#if defined(WIN)
- hLib = LoadLibrary( (const char*)rDllName );
- if( (ULONG)hLib < 32 )
- hLib = 0;
-
-#elif defined(WNT)
- hLib = LoadLibrary( rDllName.GetBuffer() );
- if( !(ULONG)hLib )
- {
-#ifdef DBG_UTIL
- ULONG nLastErr;
- nLastErr = GetLastError();
-#endif
- hLib = 0;
+ OSL_ASSERT(variable != 0);
+ SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
+ GetProperties();
+ for (USHORT i = 0; i < props->Count(); ++i) {
+ SbError e = marshal(false, props->Get(i), false, blob, offset, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
}
-
-#elif defined(OS2)
- char cErr[ 100 ];
- if( DosLoadModule( (PSZ) cErr, 100, (const char*)rDllName.GetBuffer(), &hLib ) )
- hLib = 0;
-#endif
- return hLib;
+ return ERRCODE_NONE;
}
-void SbiDllMgr::FreeDllHandle( SbiDllHandle hLib )
+SbError marshalArray(
+ SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
+ MarshalData & data)
{
-#if defined(WIN) || defined(WNT)
- if( hLib )
- FreeLibrary ((HINSTANCE) hLib);
-#elif defined(OS2)
- if( hLib )
- DosFreeModule( (HMODULE) hLib );
-#else
- (void)hLib;
-#endif
+ OSL_ASSERT(variable != 0);
+ SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
+ int dims = arr->GetDims();
+ std::vector< INT32 > low(dims);
+ std::vector< INT32 > up(dims);
+ for (int i = 0; i < dims; ++i) {
+ arr->GetDim32(i + 1, low[i], up[i]);
+ }
+ for (std::vector< INT32 > idx = low;;) {
+ SbError e = marshal(
+ false, arr->Get32(&idx[0]), false, blob, offset, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ int i = dims - 1;
+ while (idx[i] == up[i]) {
+ idx[i] = low[i];
+ if (i == 0) {
+ return ERRCODE_NONE;
+ }
+ --i;
+ }
+ ++idx[i];
+ }
}
-SbiDllProc SbiDllMgr::GetProcAddr(SbiDllHandle hLib, const ByteString& rProcName)
+// 8-aligned structs are only 4-aligned on stack, so alignment of members in
+// such structs must take that into account via "offset"
+SbError marshal(
+ bool outer, SbxVariable * variable, bool special,
+ std::vector< char > & blob, std::size_t offset, MarshalData & data)
{
- char buf1 [128] = "";
- char buf2 [128] = "";
-
- SbiDllProc pProc = 0;
- int nOrd = 0;
-
- // Ordinal?
- if( rProcName.GetBuffer()[0] == '@' )
- nOrd = atoi( rProcName.GetBuffer()+1 );
-
- // Moegliche Parameter weg:
- DBG_ASSERT( sizeof(buf1) > rProcName.Len(),
- "SbiDllMgr::GetProcAddr: buffer to small!" );
- strncpy( buf1, rProcName.GetBuffer(), sizeof(buf1)-1 );
- char *p = strchr( buf1, '#' );
- if( p )
- *p = 0;
-
- DBG_ASSERT( sizeof(buf2) > strlen(buf1) + 1,
- "SbiDllMgr::GetProcAddr: buffer to small!" );
- strncpy( buf2, "_", sizeof(buf2)-1 );
- strncat( buf2, buf1, sizeof(buf2)-1-strlen(buf2) );
-
-#if defined(WIN) || defined(WNT)
- if( nOrd > 0 )
- pProc = (SbiDllProc)GetProcAddress( hLib, (char*)(long) nOrd );
- else
- {
- // 2. mit Parametern:
- pProc = (SbiDllProc)GetProcAddress ( hLib, rProcName.GetBuffer() );
- // 3. nur der Name:
- if (!pProc)
- pProc = (SbiDllProc)GetProcAddress( hLib, buf1 );
- // 4. der Name mit Underline vorweg:
- if( !pProc )
- pProc = (SbiDllProc)GetProcAddress( hLib, buf2 );
+ OSL_ASSERT(variable != 0);
+ if ((variable->GetFlags() & SBX_REFERENCE) == 0) {
+ if ((variable->GetType() & SbxARRAY) == 0) {
+ switch (variable->GetType()) {
+ case SbxINTEGER:
+ add(blob, variable->GetInteger(), outer ? 4 : 2, offset);
+ break;
+ case SbxLONG:
+ add(blob, variable->GetLong(), 4, offset);
+ break;
+ case SbxSINGLE:
+ add(blob, variable->GetSingle(), 4, offset);
+ break;
+ case SbxDOUBLE:
+ add(blob, variable->GetDouble(), outer ? 4 : 8, offset);
+ break;
+ case SbxSTRING:
+ {
+ void * p;
+ SbError e = marshalString(variable, special, data, &p);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ add(blob, p, 4, offset);
+ break;
+ }
+ case SbxOBJECT:
+ {
+ align(blob, outer ? 4 : alignment(variable), offset, 0);
+ SbError e = marshalStruct(variable, blob, offset, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ break;
+ }
+ case SbxBOOL:
+ add(blob, variable->GetBool(), outer ? 4 : 1, offset);
+ break;
+ case SbxBYTE:
+ add(blob, variable->GetByte(), outer ? 4 : 1, offset);
+ break;
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ } else {
+ SbError e = marshalArray(variable, blob, offset, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ }
+ } else {
+ if ((variable->GetType() & SbxARRAY) == 0) {
+ switch (variable->GetType()) {
+ case SbxINTEGER:
+ case SbxLONG:
+ case SbxSINGLE:
+ case SbxDOUBLE:
+ case SbxBOOL:
+ case SbxBYTE:
+ add(blob, variable->data(), 4, offset);
+ break;
+ case SbxSTRING:
+ {
+ std::vector< char > * blob2 = data.newBlob();
+ void * p;
+ SbError e = marshalString(variable, special, data, &p);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ add(*blob2, p, 4, 0);
+ add(blob, address(*blob2), 4, offset);
+ break;
+ }
+ case SbxOBJECT:
+ {
+ std::vector< char > * blob2 = data.newBlob();
+ SbError e = marshalStruct(variable, *blob2, 0, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ void * p = address(*blob2);
+ if (outer) {
+ data.unmarshal.push_back(UnmarshalData(variable, p));
+ }
+ add(blob, p, 4, offset);
+ break;
+ }
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ } else {
+ std::vector< char > * blob2 = data.newBlob();
+ SbError e = marshalArray(variable, *blob2, 0, data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ void * p = address(*blob2);
+ if (outer) {
+ data.unmarshal.push_back(UnmarshalData(variable, p));
+ }
+ add(blob, p, 4, offset);
+ }
}
+ return ERRCODE_NONE;
+}
-#elif defined(OS2)
- PSZ pp;
- APIRET rc;
- // 1. Ordinal oder mit Parametern:
- rc = DosQueryProcAddr( hLib, nOrd, pp = (char*)rProcName.GetBuffer(), &pProc );
- // 2. nur der Name:
- if( rc )
- rc = DosQueryProcAddr( hLib, 0, pp = (PSZ)buf1, &pProc );
- // 3. der Name mit Underline vorweg:
- if( rc )
- rc = DosQueryProcAddr( hLib, 0, pp = (PSZ)buf2, &pProc );
- if( rc )
- pProc = NULL;
- else
- {
- // 16-bit oder 32-bit?
- ULONG nInfo = 0;
- if( DosQueryProcType( hLib, nOrd, pp, &nInfo ) )
- nInfo = 0;;
- }
-#else
- (void)hLib;
-#endif
- return pProc;
+template< typename T > T read(void const ** pointer) {
+ T const * p = static_cast< T const * >(*pointer);
+ *pointer = static_cast< void const * >(p + 1);
+ return *p;
}
-SbError SbiDllMgr::CallProc( SbiDllProc pProc, SbxArray* pArgs,
- SbxVariable& rResult )
-{
-// ByteString aStr("Calling DLL at ");
-// aStr += (ULONG)pProc;
-// InfoBox( 0, aStr ).Execute();
- INT16 nInt16; int nInt; INT32 nInt32; double nDouble;
- char* pStr;
-
- USHORT nSize;
- char* pStack = (char*)CreateStack( pArgs, nSize );
- switch( rResult.GetType() )
- {
+void const * unmarshal(SbxVariable * variable, void const * data) {
+ OSL_ASSERT(variable != 0);
+ if ((variable->GetType() & SbxARRAY) == 0) {
+ switch (variable->GetType()) {
case SbxINTEGER:
- nInt16 = CallINT(pProc, pStack, (short)nSize );
- rResult.PutInteger( nInt16 );
- break;
-
- case SbxUINT:
- case SbxUSHORT:
- nInt16 = (INT16)CallINT(pProc, pStack, (short)nSize );
- rResult.PutUShort( (USHORT)nInt16 );
- break;
-
- case SbxERROR:
- nInt16 = (INT16)CallINT(pProc, pStack, (short)nSize );
- rResult.PutErr( (USHORT)nInt16 );
- break;
-
- case SbxINT:
- nInt = CallINT(pProc, pStack, (short)nSize );
- rResult.PutInt( nInt );
+ variable->PutInteger(read< sal_Int16 >(&data));
break;
-
case SbxLONG:
- nInt32 = CallLNG(pProc, pStack, (short)nSize );
- rResult.PutLong( nInt32 );
+ variable->PutLong(read< sal_Int32 >(&data));
break;
-
- case SbxULONG:
- nInt32 = CallINT(pProc, pStack, (short)nSize );
- rResult.PutULong( (ULONG)nInt32 );
- break;
-
-#ifndef WNT
case SbxSINGLE:
- {
- float nSingle = CallSNG(pProc, pStack, (short)nSize );
- rResult.PutSingle( nSingle );
+ variable->PutSingle(read< float >(&data));
break;
- }
-#endif
-
case SbxDOUBLE:
-#ifdef WNT
- case SbxSINGLE:
-#endif
- nDouble = CallDBL(pProc, pStack, (short)nSize );
- rResult.PutDouble( nDouble );
+ variable->PutDouble(read< double >(&data));
break;
-
- case SbxDATE:
- nDouble = CallDBL(pProc, pStack, (short)nSize );
- rResult.PutDate( nDouble );
+ case SbxSTRING:
+ read< char * >(&data); // handled by unmarshalString
break;
-
- case SbxCHAR:
- case SbxBYTE:
+ case SbxOBJECT:
+ {
+ data = reinterpret_cast< void const * >(
+ align(
+ reinterpret_cast< sal_uIntPtr >(data),
+ alignment(variable)));
+ SbxArray * props = PTR_CAST(SbxObject, variable->GetObject())->
+ GetProperties();
+ for (USHORT i = 0; i < props->Count(); ++i) {
+ data = unmarshal(props->Get(i), data);
+ }
+ break;
+ }
case SbxBOOL:
- nInt16 = CallINT(pProc, pStack, (short)nSize );
- rResult.PutByte( (BYTE)nInt16 );
- break;
-
- case SbxSTRING:
- case SbxLPSTR:
- pStr = CallSTR(pProc, pStack, (short)nSize );
- rResult.PutString( String::CreateFromAscii( pStr ) );
+ variable->PutBool(read< sal_Bool >(&data));
break;
-
- case SbxNULL:
- case SbxEMPTY:
- nInt16 = CallINT(pProc, pStack, (short)nSize );
- // Rueckgabe nur zulaessig, wenn variant!
- if( !rResult.IsFixed() )
- rResult.PutInteger( nInt16 );
+ case SbxBYTE:
+ variable->PutByte(read< sal_uInt8 >(&data));
break;
-
- case SbxCURRENCY:
- case SbxOBJECT:
- case SbxDATAOBJECT:
default:
- CallINT(pProc, pStack, (short)nSize );
+ OSL_ASSERT(false);
break;
- }
- delete [] pStack;
-
- if( pArgs )
- {
- // die Laengen aller uebergebenen Strings anpassen
- USHORT nCount = pArgs->Count();
- for( USHORT nCur = 1; nCur < nCount; nCur++ )
- {
- SbxVariable* pVar = pArgs->Get( nCur );
- BOOL bIsString = ( pVar->GetType() == SbxSTRING ) ||
- ( pVar->GetType() == SbxLPSTR );
-
- if( pVar->GetFlags() & SBX_REFERENCE )
- {
- pVar->ResetFlag( SBX_REFERENCE ); // Sbx moechte es so
- if( bIsString )
- {
- ByteString aByteStr( (char*)pVar->GetUserData() );
- String aStr( aByteStr, gsl_getSystemTextEncoding() );
- pVar->PutString( aStr );
+ }
+ } else {
+ SbxDimArray * arr = PTR_CAST(SbxDimArray, variable->GetObject());
+ int dims = arr->GetDims();
+ std::vector< INT32 > low(dims);
+ std::vector< INT32 > up(dims);
+ for (int i = 0; i < dims; ++i) {
+ arr->GetDim32(i + 1, low[i], up[i]);
+ }
+ for (std::vector< INT32 > idx = low;;) {
+ data = unmarshal(arr->Get32(&idx[0]), data);
+ int i = dims - 1;
+ while (idx[i] == up[i]) {
+ idx[i] = low[i];
+ if (i == 0) {
+ goto done;
}
+ --i;
}
- if( bIsString )
- {
- delete (char*)(pVar->GetUserData());
- pVar->SetUserData( 0 );
- }
+ ++idx[i];
}
+ done:;
}
- return 0;
+ return data;
}
-SbError SbiDllMgr::CallProcC( SbiDllProc pProc, SbxArray* pArgs,
- SbxVariable& rResult )
-{
- (void)pProc;
- (void)pArgs;
- (void)rResult;
-
- DBG_ERROR("C calling convention not supported");
- return SbERR_BAD_ARGUMENT;
+SbError unmarshalString(StringData const & data, SbxVariable & result) {
+ rtl::OUString str;
+ if (data.buffer != 0) {
+ char const * p = static_cast< char const * >(data.buffer);
+ sal_Int32 len;
+ if (data.special) {
+ len = static_cast< sal_Int32 >(result.GetULong());
+ if (len < 0) { // i.e., DWORD result >= 2^31
+ return ERRCODE_BASIC_BAD_ARGUMENT;
+ //TODO: more specific errcode?
+ }
+ } else {
+ len = rtl_str_getLength(p);
+ }
+ SbError e = convert(p, len, &str);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ }
+ data.variable->PutString(String(str));
+ return ERRCODE_NONE;
}
-void* SbiDllMgr::CreateStack( SbxArray* pArgs, USHORT& rSize )
+struct ProcData {
+ rtl::OString name;
+ FARPROC proc;
+};
+
+SbError call(
+ rtl::OUString const & dll, ProcData const & proc, SbxArray * arguments,
+ SbxVariable & result)
{
- if( !pArgs )
+ std::vector< char > stack;
+ MarshalData data;
+ // For DWORD GetLogicalDriveStringsA(DWORD nBufferLength, LPSTR lpBuffer)
+ // from kernel32, upon return, filled lpBuffer length is result DWORD, which
+ // requires special handling in unmarshalString; other functions might
+ // require similar treatment, too:
+ bool special =
+ dll.equalsIgnoreAsciiCaseAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("KERNEL32.DLL")) &&
+ (proc.name ==
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("GetLogicalDriveStringsA")));
+ for (USHORT i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
+ SbError e = marshal(
+ true, arguments->Get(i), special && i == 2, stack, stack.size(),
+ data);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ align(stack, 4, 0, 0);
+ }
+ switch (result.GetType()) {
+ case SbxEMPTY:
+ DllMgr_call32(proc.proc, address(stack), stack.size());
+ break;
+ case SbxINTEGER:
+ result.PutInteger(
+ static_cast< sal_Int16 >(
+ DllMgr_call32(proc.proc, address(stack), stack.size())));
+ break;
+ case SbxLONG:
+ result.PutLong(
+ static_cast< sal_Int32 >(
+ DllMgr_call32(proc.proc, address(stack), stack.size())));
+ break;
+ case SbxSINGLE:
+ result.PutSingle(
+ static_cast< float >(
+ DllMgr_callFp(proc.proc, address(stack), stack.size())));
+ break;
+ case SbxDOUBLE:
+ result.PutDouble(
+ DllMgr_callFp(proc.proc, address(stack), stack.size()));
+ break;
+ case SbxSTRING:
+ {
+ char const * s1 = reinterpret_cast< char const * >(
+ DllMgr_call32(proc.proc, address(stack), stack.size()));
+ rtl::OUString s2;
+ SbError e = convert(s1, rtl_str_getLength(s1), &s2);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ result.PutString(String(s2));
+ break;
+ }
+ case SbxOBJECT:
+ //TODO
+ DllMgr_call32(proc.proc, address(stack), stack.size());
+ break;
+ case SbxBOOL:
+ result.PutBool(
+ static_cast< sal_Bool >(
+ DllMgr_call32(proc.proc, address(stack), stack.size())));
+ break;
+ case SbxBYTE:
+ result.PutByte(
+ static_cast< sal_uInt8 >(
+ DllMgr_call32(proc.proc, address(stack), stack.size())));
+ break;
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ for (USHORT i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
+ arguments->Get(i)->ResetFlag(SBX_REFERENCE);
+ //TODO: skipped for errors?!?
+ }
+ for (std::vector< UnmarshalData >::iterator i(data.unmarshal.begin());
+ i != data.unmarshal.end(); ++i)
{
- rSize = 0;
- return 0;
+ unmarshal(i->variable, i->buffer);
}
- char* pStack = new char[ 2048 ];
- char* pTop = pStack;
- USHORT nCount = pArgs->Count();
- // erstes Element ueberspringen
-#ifndef WIN
- for( USHORT nCur = 1; nCur < nCount; nCur++ )
-#else
- // unter 16-Bit Windows anders rum (OS/2 ?????)
- for( USHORT nCur = nCount-1; nCur >= 1; nCur-- )
-#endif
+ for (std::vector< StringData >::iterator i(data.unmarshalStrings.begin());
+ i != data.unmarshalStrings.end(); ++i)
{
- SbxVariable* pVar = pArgs->Get( nCur );
- // AB 22.1.1996, Referenz
- if( pVar->GetFlags() & SBX_REFERENCE ) // Es ist eine Referenz
- {
- switch( pVar->GetType() )
- {
- case SbxINTEGER:
- case SbxUINT:
- case SbxINT:
- case SbxUSHORT:
- case SbxLONG:
- case SbxULONG:
- case SbxSINGLE:
- case SbxDOUBLE:
- case SbxCHAR:
- case SbxBYTE:
- case SbxBOOL:
- *((void**)pTop) = (void*)&(pVar->aData);
- pTop += sizeof( void* );
- break;
-
- case SbxSTRING:
- case SbxLPSTR:
- {
- USHORT nLen = 256;
- ByteString rStr( pVar->GetString(), gsl_getSystemTextEncoding() );
- if( rStr.Len() > 255 )
- nLen = rStr.Len() + 1;
-
- char* pStr = new char[ nLen ];
- strcpy( pStr, rStr.GetBuffer() ); // #100211# - checked
- // ist nicht so sauber, aber wir sparen ein Pointerarray
- DBG_ASSERT(sizeof(UINT32)>=sizeof(char*),"Gleich krachts im Basic");
- pVar->SetUserData( (sal_uIntPtr)pStr );
- *((const char**)pTop) = pStr;
- pTop += sizeof( char* );
- }
- break;
+ SbError e = unmarshalString(*i, result);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ }
+ return ERRCODE_NONE;
+}
- case SbxNULL:
- case SbxEMPTY:
- case SbxERROR:
- case SbxDATE:
- case SbxCURRENCY:
- case SbxOBJECT:
- case SbxDATAOBJECT:
- default:
- break;
+SbError getProcData(HMODULE handle, rtl::OUString const & name, ProcData * proc)
+{
+ OSL_ASSERT(proc != 0);
+ if (name.getLength() != 0 && name[0] == '@') { //TODO: "@" vs. "#"???
+ sal_Int32 n = name.copy(1).toInt32(); //TODO: handle bad input
+ if (n <= 0 || n > 0xFFFF) {
+ return ERRCODE_BASIC_BAD_ARGUMENT; //TODO: more specific errcode?
+ }
+ FARPROC p = GetProcAddress(handle, reinterpret_cast< LPCSTR >(n));
+ if (p != 0) {
+ proc->name = rtl::OString(RTL_CONSTASCII_STRINGPARAM("#")) +
+ rtl::OString::valueOf(n);
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ } else {
+ rtl::OString name8;
+ SbError e = convert(name, &name8);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ FARPROC p = GetProcAddress(handle, name8.getStr());
+ if (p != 0) {
+ proc->name = name8;
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ sal_Int32 i = name8.indexOf('#');
+ if (i != -1) {
+ name8 = name8.copy(0, i);
+ p = GetProcAddress(handle, name8.getStr());
+ if (p != 0) {
+ proc->name = name8;
+ proc->proc = p;
+ return ERRCODE_NONE;
}
}
- else
- {
- // ByVal
- switch( pVar->GetType() )
- {
- case SbxINTEGER:
- case SbxUINT:
- case SbxINT:
- case SbxUSHORT:
- *((INT16*)pTop) = pVar->GetInteger();
- pTop += sizeof( INT16 );
- break;
+ rtl::OString real(
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("_")) + name8);
+ p = GetProcAddress(handle, real.getStr());
+ if (p != 0) {
+ proc->name = real;
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ real = name8 + rtl::OString(RTL_CONSTASCII_STRINGPARAM("A"));
+ p = GetProcAddress(handle, real.getStr());
+ if (p != 0) {
+ proc->name = real;
+ proc->proc = p;
+ return ERRCODE_NONE;
+ }
+ }
+ return ERRCODE_BASIC_PROC_UNDEFINED;
+}
- case SbxLONG:
- case SbxULONG:
- *((INT32*)pTop) = pVar->GetLong();
- pTop += sizeof( INT32 );
- break;
+struct Dll: public salhelper::SimpleReferenceObject {
+private:
+ typedef std::map< rtl::OUString, ProcData > Procs;
- case SbxSINGLE:
- *((float*)pTop) = pVar->GetSingle();
- pTop += sizeof( float );
- break;
+ virtual ~Dll();
- case SbxDOUBLE:
- *((double*)pTop) = pVar->GetDouble();
- pTop += sizeof( double );
- break;
+public:
+ Dll(): handle(0) {}
- case SbxSTRING:
- case SbxLPSTR:
- {
- char* pStr = new char[ pVar->GetString().Len() + 1 ];
- ByteString aByteStr( pVar->GetString(), gsl_getSystemTextEncoding() );
- strcpy( pStr, aByteStr.GetBuffer() ); // #100211# - checked
- // ist nicht so sauber, aber wir sparen ein Pointerarray
- DBG_ASSERT(sizeof(UINT32)>=sizeof(char*),"Gleich krachts im Basic");
- pVar->SetUserData( (sal_uIntPtr)pStr );
- *((const char**)pTop) = pStr;
- pTop += sizeof( char* );
- }
- break;
+ SbError getProc(rtl::OUString const & name, ProcData * proc);
- case SbxCHAR:
- case SbxBYTE:
- case SbxBOOL:
- *((BYTE*)pTop) = pVar->GetByte();
- pTop += sizeof( BYTE );
- break;
+ HMODULE handle;
+ Procs procs;
+};
- case SbxNULL:
- case SbxEMPTY:
- case SbxERROR:
- case SbxDATE:
- case SbxCURRENCY:
- case SbxOBJECT:
- case SbxDATAOBJECT:
- default:
- break;
- }
+Dll::~Dll() {
+ if (handle != 0 && !FreeLibrary(handle)) {
+ OSL_TRACE("FreeLibrary(%p) failed with %u", handle, GetLastError());
+ }
+}
+
+SbError Dll::getProc(rtl::OUString const & name, ProcData * proc) {
+ Procs::iterator i(procs.find(name));
+ if (i != procs.end()) {
+ *proc = i->second;
+ return ERRCODE_NONE;
+ }
+ SbError e = getProcData(handle, name, proc);
+ if (e == ERRCODE_NONE) {
+ procs.insert(Procs::value_type(name, *proc));
+ }
+ return e;
+}
+
+rtl::OUString fullDllName(rtl::OUString const & name) {
+ rtl::OUString full(name);
+ if (full.indexOf('.') == -1) {
+ full += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".DLL"));
+ }
+ return full;
+}
+
+}
+
+struct SbiDllMgr::Impl: private boost::noncopyable {
+private:
+ typedef std::map< rtl::OUString, rtl::Reference< Dll > > Dlls;
+
+public:
+ Dll * getDll(rtl::OUString const & name);
+
+ Dlls dlls;
+};
+
+Dll * SbiDllMgr::Impl::getDll(rtl::OUString const & name) {
+ Dlls::iterator i(dlls.find(name));
+ if (i == dlls.end()) {
+ i = dlls.insert(Dlls::value_type(name, new Dll)).first;
+ HMODULE h = LoadLibraryW(name);
+ if (h == 0) {
+ dlls.erase(i);
+ return 0;
}
+ i->second->handle = h;
}
- rSize = (USHORT)((ULONG)pTop - (ULONG)pStack);
- return pStack;
+ return i->second.get();
}
+SbError SbiDllMgr::Call(
+ rtl::OUString const & function, rtl::OUString const & library,
+ SbxArray * arguments, SbxVariable & result, bool cdeclConvention)
+{
+ if (cdeclConvention) {
+ return ERRCODE_BASIC_NOT_IMPLEMENTED;
+ }
+ rtl::OUString dllName(fullDllName(library));
+ Dll * dll = impl_->getDll(dllName);
+ if (dll == 0) {
+ return ERRCODE_BASIC_BAD_DLL_LOAD;
+ }
+ ProcData proc;
+ SbError e = dll->getProc(function, &proc);
+ if (e != ERRCODE_NONE) {
+ return e;
+ }
+ return call(dllName, proc, arguments, result);
+}
+
+void SbiDllMgr::FreeDll(rtl::OUString const & library) {
+ impl_->dlls.erase(library);
+}
+#else
+
+struct SbiDllMgr::Impl {};
+
+SbError SbiDllMgr::Call(
+ rtl::OUString const &, rtl::OUString const &, SbxArray *, SbxVariable &,
+ bool)
+{
+ return ERRCODE_BASIC_NOT_IMPLEMENTED;
+}
+
+void SbiDllMgr::FreeDll(rtl::OUString const &) {}
+
+#endif
+SbiDllMgr::SbiDllMgr(): impl_(new Impl) {}
+SbiDllMgr::~SbiDllMgr() {}
diff --git a/basic/source/runtime/dllmgr.hxx b/basic/source/runtime/dllmgr.hxx
index c57e05e3fc..fdff8c2849 100644
--- a/basic/source/runtime/dllmgr.hxx
+++ b/basic/source/runtime/dllmgr.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* 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
@@ -25,71 +25,36 @@
*
************************************************************************/
-#ifndef _DLLMGR_HXX
-#define _DLLMGR_HXX
+#ifndef INCLUDED_BASIC_SOURCE_RUNTIME_DLLMGR_HXX
+#define INCLUDED_BASIC_SOURCE_RUNTIME_DLLMGR_HXX
-#define _SVSTDARR_BYTESTRINGSSORT
-#include <svl/svarray.hxx>
-#ifndef _SVSTDARR_HXX //autogen
-#include <svl/svstdarr.hxx>
-#endif
+#include "sal/config.h"
-// !!! nur zum debuggen fuer infoboxes !!!
-//#ifndef _SV_HXX
-//#include <sv.hxx>
-//#endif
+#include <memory>
-//#ifndef _TOOLS_HXX
-//#include <tools.hxx>
-//#endif
-#define _SVSTDARR_STRINGS
-//#ifndef _SVSTDARR_HXX
-//#include <svstdarr.hxx>
-//#endif
-#ifndef _SBERRORS_HXX
-#include <basic/sberrors.hxx>
-#endif
+#include "basic/sberrors.hxx"
+#include "boost/noncopyable.hpp"
+namespace rtl { class OUString; }
class SbxArray;
class SbxVariable;
-class ImplSbiDll;
-class ImplSbiProc;
-
-SV_DECL_PTRARR_SORT(ImplDllArr,ByteStringPtr,5,5)
-
-class SbiDllMgr
-{
- ImplDllArr aDllArr;
-
- SbiDllMgr( const SbiDllMgr& );
+class SbiDllMgr: private boost::noncopyable {
+public:
+ SbiDllMgr();
-#ifdef _DLLMGR_CXX
- ImplSbiDll* GetDll( const ByteString& rDllName );
- SbiDllProc GetProc( ImplSbiDll*, const ByteString& rProcName );
+ ~SbiDllMgr();
- SbiDllHandle CreateDllHandle( const ByteString& rDllName );
- void FreeDllHandle( SbiDllHandle );
- SbiDllProc GetProcAddr( SbiDllHandle, const ByteString& pProcName );
- SbError CallProc( SbiDllProc pProc, SbxArray* pArgs,
- SbxVariable& rResult );
- SbError CallProcC( SbiDllProc pProc, SbxArray* pArgs,
- SbxVariable& rResult );
- void* CreateStack( SbxArray* pArgs, USHORT& rSize );
- void CheckDllName( ByteString& rName );
-#endif
+ SbError Call(
+ rtl::OUString const & function, rtl::OUString const & library,
+ SbxArray * arguments, SbxVariable & result, bool cdeclConvention);
-public:
- SbiDllMgr();
- ~SbiDllMgr();
+ void FreeDll(rtl::OUString const & library);
- SbError Call( const char* pFunc, const char* pDll,
- SbxArray* pArgs, SbxVariable& rResult,
- BOOL bCDecl );
+private:
+ struct Impl;
- void FreeDll( const ByteString& rDllName );
+ std::auto_ptr< Impl > impl_;
};
-
-
#endif
diff --git a/basic/source/runtime/makefile.mk b/basic/source/runtime/makefile.mk
index 9bd197975e..f2ed11196b 100644
--- a/basic/source/runtime/makefile.mk
+++ b/basic/source/runtime/makefile.mk
@@ -30,6 +30,8 @@ PRJ=..$/..
PRJNAME=basic
TARGET=runtime
+ENABLE_EXCEPTIONS = TRUE
+
# --- Settings -----------------------------------------------------------
.INCLUDE : settings.mk
@@ -53,29 +55,12 @@ SLOFILES= \
$(SLO)$/ddectrl.obj \
$(SLO)$/dllmgr.obj
-.IF "$(GUI)$(CPU)" == "WINI"
-SLOFILES+= $(SLO)$/win.obj
-.ENDIF
-
.IF "$(GUI)$(COM)$(CPU)" == "WNTMSCI"
SLOFILES+= $(SLO)$/wnt.obj
-.ENDIF
-
-.IF "$(GUI)$(COM)$(CPU)" == "WNTGCCI"
+.ELIF "$(GUI)$(COM)$(CPU)" == "WNTGCCI"
SLOFILES+= $(SLO)$/wnt-mingw.obj
.ENDIF
-.IF "$(GUI)$(CPU)" == "OS2I"
-#FIXME SLOFILES+= $(SLO)$/os2.obj
-.ENDIF
-
-EXCEPTIONSFILES=$(SLO)$/step0.obj \
- $(SLO)$/step2.obj \
- $(SLO)$/methods.obj \
- $(SLO)$/methods1.obj \
- $(SLO)$/iosys.obj \
- $(SLO)$/runtime.obj
-
# --- Targets -------------------------------------------------------------
.INCLUDE : target.mk
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 69c6713122..f22a52c51a 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -523,6 +523,18 @@ RTLFUNC(WaitUntil)
Wait_Impl( true, rPar );
}
+RTLFUNC(DoEvents)
+{
+ (void)pBasic;
+ (void)bWrite;
+ (void)rPar;
+ Timer aTimer;
+ aTimer.SetTimeout( 1 );
+ aTimer.Start();
+ while ( aTimer.IsActive() )
+ Application::Yield();
+}
+
RTLFUNC(GetGUIVersion)
{
(void)pBasic;
@@ -622,8 +634,7 @@ RTLFUNC(FreeLibrary)
if ( rPar.Count() != 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- ByteString aByteDLLName( rPar.Get(1)->GetString(), gsl_getSystemTextEncoding() );
- pINST->GetDllMgr()->FreeDll( aByteDLLName );
+ pINST->GetDllMgr()->FreeDll( rPar.Get(1)->GetString() );
}
bool IsBaseIndexOne()
{
diff --git a/basic/source/runtime/os2.asm b/basic/source/runtime/os2.asm
deleted file mode 100644
index a56f0b74b8..0000000000
--- a/basic/source/runtime/os2.asm
+++ /dev/null
@@ -1,103 +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.
-;
-;*************************************************************************
-
-; Anmerkungen
-; Direktaufruf von C- und PASCAL-Routinen, OS/2
-;
-; Inhalt:
-; type = CallXXX (far *proc, char *stack, short nstack)
-;
-; Kopie des Basic-Stacks (nstack Bytes) auf den C-Stack
-; und Aufruf der Prozedur.
-
- .386
- .MODEL FLAT
-
- .CODE
-
- PUBLIC CallINT
- PUBLIC CallLNG
- PUBLIC CallSNG
- PUBLIC CallDBL
- PUBLIC CallSTR
- PUBLIC CallFIX
-
- PUBLIC _CallINT
- PUBLIC _CallLNG
- PUBLIC _CallSNG
- PUBLIC _CallDBL
- PUBLIC _CallSTR
- PUBLIC _CallFIX
-
-_CallINT LABEL byte
-_CallLNG LABEL byte
-_CallSNG LABEL byte
-_CallDBL LABEL byte
-_CallSTR LABEL byte
-_CallFIX LABEL byte
-
-CallINT LABEL byte
-CallLNG LABEL byte
-CallSNG LABEL byte
-CallDBL LABEL byte
-CallSTR LABEL byte
-CallFIX PROC
-
-p EQU [EBP+8]
-stk EQU [EBP+12]
-n EQU [EBP+16]
-
- PUSH EBP
- MOV EBP,ESP
- PUSH ESI
- PUSH EDI
- MOV DX,DS
- MOVZX ECX,word ptr [n]
- SUB ESP,ECX
- MOV EDI,ESP
- MOV AX,SS
- MOV ES,AX
- MOV ESI,[stk]
- SHR ECX,1
- CLD
- JCXZ $1
- REP MOVSW ; Stack uebernehmen
-$1: MOV DS,DX
- CALL LARGE [p] ; 32-bit
- MOV ECX,EBP
- SUB ECX,8 ; wegen gepushter Register
- MOV ESP,ECX
- POP EDI
- POP ESI
- POP EBP
-; Bei Borland C++ Calling Convention:
-; RET 12
-; CSet System-Calling Convention
- RET
-CallFIX ENDP
-
- END
diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx
index 485abe4794..13485d7bb2 100644
--- a/basic/source/runtime/rtlproto.hxx
+++ b/basic/source/runtime/rtlproto.hxx
@@ -166,6 +166,7 @@ extern RTLFUNC(RmDir); // JSM
extern RTLFUNC(SendKeys); // JSM
extern RTLFUNC(DimArray);
extern RTLFUNC(Dir);
+extern RTLFUNC(DoEvents);
extern RTLFUNC(Exp);
extern RTLFUNC(FileLen);
extern RTLFUNC(Fix);
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index c7d2d4ed4b..b27495099a 100755
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -155,6 +155,7 @@ SbiRuntime::pStep0 SbiRuntime::aStep0[] = { // Alle Opcodes ohne Operanden
&SbiRuntime::StepVBASET,// vba-like set statement
&SbiRuntime::StepERASE_CLEAR,// vba-like set statement
&SbiRuntime::StepARRAYACCESS,// access TOS as array
+ &SbiRuntime::StepBYVAL, // access TOS as array
};
SbiRuntime::pStep1 SbiRuntime::aStep1[] = { // Alle Opcodes mit einem Operanden
@@ -906,7 +907,7 @@ sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, String& rMsg )
{
// TEST, has to be vb here always
#ifdef DBG_UTIL
- SbError nTmp = StarBASIC::GetSfxFromVBError( USHORT( nError ) );
+ SbError nTmp = StarBASIC::GetSfxFromVBError( (USHORT)nError );
DBG_ASSERT( nTmp, "No VB error!" );
#endif
@@ -1231,9 +1232,7 @@ void SbiRuntime::DllCall
SbxVariable* pRes = new SbxVariable( eResType );
SbiDllMgr* pDllMgr = pInst->GetDllMgr();
- ByteString aByteFuncName( aFuncName, gsl_getSystemTextEncoding() );
- ByteString aByteDLLName( aDLLName, gsl_getSystemTextEncoding() );
- SbError nErr = pDllMgr->Call( aByteFuncName.GetBuffer(), aByteDLLName.GetBuffer(), pArgs, *pRes, bCDecl );
+ SbError nErr = pDllMgr->Call( aFuncName, aDLLName, pArgs, *pRes, bCDecl );
if( nErr )
Error( nErr );
PushVar( pRes );
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index c9baf952ed..a4a7f7f68b 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -216,6 +216,7 @@ static Methods aMethods[] = {
{ "Dir", SbxSTRING, 2 | _FUNCTION, RTLNAME(Dir),0 },
{ "FileSpec", SbxSTRING, _OPT, NULL,0 },
{ "attrmask", SbxINTEGER, _OPT, NULL,0 },
+{ "DoEvents", SbxEMPTY, _FUNCTION, RTLNAME(DoEvents),0 },
{ "DumpAllObjects", SbxEMPTY, 2 | _SUB, RTLNAME(DumpAllObjects),0 },
{ "FileSpec", SbxSTRING, 0,NULL,0 },
{ "DumpAll", SbxINTEGER, _OPT, NULL,0 },
@@ -361,6 +362,8 @@ static Methods aMethods[] = {
{ "Count", SbxLONG, 0,NULL,0 },
{ "Len", SbxLONG, 1 | _FUNCTION, RTLNAME(Len),0 },
{ "StringOrVariant", SbxVARIANT, 0,NULL,0 },
+{ "LenB", SbxLONG, 1 | _FUNCTION, RTLNAME(Len),0 },
+ { "StringOrVariant", SbxVARIANT, 0,NULL,0 },
{ "Load", SbxNULL, 1 | _FUNCTION, RTLNAME(Load),0 },
{ "object", SbxOBJECT, 0,NULL,0 },
{ "LoadPicture", SbxOBJECT, 1 | _FUNCTION, RTLNAME(LoadPicture),0 },
@@ -628,6 +631,10 @@ SbiStdObject::SbiStdObject( const String& r, StarBASIC* pb ) : SbxObject( r )
p += ( p->nArgs & _ARGSMASK ) + 1;
}
+ // #i92642: Remove default properties
+ Remove( XubString( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_DONTCARE );
+ Remove( XubString( RTL_CONSTASCII_USTRINGPARAM("Parent") ), SbxCLASS_DONTCARE );
+
SetParent( pb );
pStdFactory = new SbStdFactory;
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 96a3e80a84..2c576e07f6 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -43,6 +43,9 @@
#include <vcl/svapp.hxx>
#include <unotools/textsearch.hxx>
+Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::OUString& aVBAType,
+ const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj );
+
#include <algorithm>
SbxVariable* getDefaultProp( SbxVariable* pRef );
@@ -515,8 +518,29 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
}
}
+ // Handle withevents
+ BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
+ Reference< XInterface > xComListener;
+ if( bWithEvents )
+ {
+ SbxBase* pObj = refVal->GetObject();
+ SbUnoObject* pUnoObj = (pObj != NULL) ? PTR_CAST(SbUnoObject,pObj) : NULL;
+ if( pUnoObj != NULL )
+ {
+ Any aControlAny = pUnoObj->getUnoAny();
+ String aDeclareClassName = refVar->GetDeclareClassName();
+ ::rtl::OUString aVBAType = aDeclareClassName;
+ ::rtl::OUString aPrefix = refVar->GetName();
+ SbxObjectRef xScopeObj = refVar->GetParent();
+ xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
+ }
+ }
+
*refVar = *refVal;
+ if( bWithEvents )
+ refVar->SetComListener( xComListener ); // Hold reference
+
// lhs is a property who's value is currently (Empty e.g. no broadcast yet)
// in this case if there is a default prop involved the value of the
// default property may infact be void so the type will also be SbxEMPTY
@@ -908,6 +932,19 @@ void SbiRuntime::StepARRAYACCESS()
PushVar( CheckArray( refVar ) );
}
+void SbiRuntime::StepBYVAL()
+{
+ // Copy variable on stack to break call by reference
+ SbxVariableRef pVar = PopVar();
+ SbxDataType t = pVar->GetType();
+
+ SbxVariable* pCopyVar = new SbxVariable( t );
+ pCopyVar->SetFlag( SBX_READWRITE );
+ *pCopyVar = *pVar;
+
+ PushVar( pCopyVar );
+}
+
// Einrichten eines Argvs
// nOp1 bleibt so -> 1. Element ist Returnwert
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index cfbea24405..f448f7900b 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -453,9 +453,9 @@ bool SbiRuntime::implIsClass( SbxObject* pObj, const String& aClass )
}
bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
- const String& aClass, bool bRaiseErrors )
+ const String& aClass, bool bRaiseErrors, bool bDefault )
{
- bool bOk = true;
+ bool bOk = bDefault;
SbxDataType t = refVal->GetType();
if( t == SbxOBJECT )
@@ -489,6 +489,8 @@ bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
}
else
{
+ bOk = true;
+
SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pObj);
if( pClassModuleObject != NULL )
pClassModuleObject->triggerInitializeEvent();
@@ -532,7 +534,8 @@ void SbiRuntime::StepTESTCLASS( UINT32 nOp1 )
{
SbxVariableRef xObjVal = PopVar();
String aClass( pImg->GetString( static_cast<short>( nOp1 ) ) );
- bool bOk = checkClass_Impl( xObjVal, aClass, false );
+ bool bDefault = !bVBAEnabled;
+ bool bOk = checkClass_Impl( xObjVal, aClass, false, bDefault );
SbxVariable* pRet = new SbxVariable;
pRet->PutBool( bOk );
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index fb79d2f863..48a0a0da99 100644
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -1068,9 +1068,17 @@ void SbiRuntime::StepTCREATE( UINT32 nOp1, UINT32 nOp2 )
pCopyObj->SetName( aName );
SbxVariable* pNew = new SbxVariable;
pNew->PutObject( pCopyObj );
+ pNew->SetDeclareClassName( aClass );
PushVar( pNew );
}
+void SbiRuntime::implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 )
+{
+ USHORT nCount = static_cast<USHORT>( nOp2 >> 17 ); // len = all bits above 0x10000
+ String aStr;
+ aStr.Fill( nCount, 0 );
+ pStrVar->PutString( aStr );
+}
// Einrichten einer lokalen Variablen (+StringID+Typ)
@@ -1081,9 +1089,15 @@ void SbiRuntime::StepLOCAL( UINT32 nOp1, UINT32 nOp2 )
String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
if( refLocals->Find( aName, SbxCLASS_DONTCARE ) == NULL )
{
- SbxDataType t = (SbxDataType) nOp2;
+ SbxDataType t = (SbxDataType)(nOp2 & 0xffff);
SbxVariable* p = new SbxVariable( t );
p->SetName( aName );
+ bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0);
+ if( bWithEvents )
+ p->SetFlag( SBX_WITH_EVENTS );
+ bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0);
+ if( bFixedString )
+ implCreateFixedString( p, nOp2 );
refLocals->Put( p, refLocals->Count() );
}
}
@@ -1093,7 +1107,7 @@ void SbiRuntime::StepLOCAL( UINT32 nOp1, UINT32 nOp2 )
void SbiRuntime::StepPUBLIC_Impl( UINT32 nOp1, UINT32 nOp2, bool bUsedForClassModule )
{
String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
- SbxDataType t = (SbxDataType) nOp2;
+ SbxDataType t = (SbxDataType)(SbxDataType)(nOp2 & 0xffff);;
BOOL bFlag = pMod->IsSet( SBX_NO_MODIFY );
pMod->SetFlag( SBX_NO_MODIFY );
SbxVariableRef p = pMod->Find( aName, SbxCLASS_PROPERTY );
@@ -1109,6 +1123,13 @@ void SbiRuntime::StepPUBLIC_Impl( UINT32 nOp1, UINT32 nOp2, bool bUsedForClassMo
pProp->SetFlag( SBX_DONTSTORE );
// AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
pProp->SetFlag( SBX_NO_MODIFY);
+
+ bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0);
+ if( bWithEvents )
+ pProp->SetFlag( SBX_WITH_EVENTS );
+ bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0);
+ if( bFixedString )
+ implCreateFixedString( p, nOp2 );
}
}
@@ -1122,7 +1143,10 @@ void SbiRuntime::StepPUBLIC_P( UINT32 nOp1, UINT32 nOp2 )
// Creates module variable that isn't reinitialised when
// between invocations ( for VBASupport & document basic only )
if( pMod->pImage->bFirstInit )
- StepPUBLIC( nOp1, nOp2 );
+ {
+ bool bUsedForClassModule = pImg->GetFlag( SBIMG_CLASSMODULE );
+ StepPUBLIC_Impl( nOp1, nOp2, bUsedForClassModule );
+ }
}
// Einrichten einer globalen Variablen (+StringID+Typ)
@@ -1133,7 +1157,7 @@ void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 )
StepPUBLIC_Impl( nOp1, nOp2, true );
String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
- SbxDataType t = (SbxDataType) nOp2;
+ SbxDataType t = (SbxDataType)(SbxDataType)(nOp2 & 0xffff);;
BOOL bFlag = rBasic.IsSet( SBX_NO_MODIFY );
rBasic.SetFlag( SBX_NO_MODIFY );
SbxVariableRef p = rBasic.Find( aName, SbxCLASS_PROPERTY );
diff --git a/basic/source/runtime/win.asm b/basic/source/runtime/win.asm
deleted file mode 100644
index dea597a4ce..0000000000
--- a/basic/source/runtime/win.asm
+++ /dev/null
@@ -1,80 +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.
-;
-;*************************************************************************
-
-; Anmerkungen
-; Direktaufruf von C- und PASCAL-Routinen, Windows und OS/2
-;
-; Inhalt:
-; type = CallXXX (far *proc, char *stack, short nstack)
-;
-; Kopie des Basic-Stacks (nstack Bytes) auf den C-Stack
-; und Aufruf der Prozedur.
-
- .MODEL LARGE,C
-
- .CODE
-
- PUBLIC CallINT
- PUBLIC CallLNG
- PUBLIC CallSNG
- PUBLIC CallDBL
- PUBLIC CallSTR
- PUBLIC CallFIX
-
-CallINT LABEL byte
-CallLNG LABEL byte
-CallSNG LABEL byte
-CallDBL LABEL byte
-CallSTR LABEL byte
-CallFIX PROC p:PTR,stk:PTR,n:WORD
-
- PUSH SI
- PUSH DI
- MOV DX,DS
- SUB SP,[n]
- MOV DI,SP
- MOV AX,SS
- MOV ES,AX
- LDS SI,[stk]
- MOV CX,[n]
- SHR CX,1
- CLD
- JCXZ $1
- REP MOVSW ; Stack uebernehmen
-$1: MOV DS,DX
- CALL [p] ; Aufruf der Prozedur
- CLI
- MOV SP,BP
- SUB SP,4 ; wegen gepushter Register
- STI
- POP DI
- POP SI
- RET
-
-CallFIX ENDP
-
- END
diff --git a/basic/source/runtime/wnt-mingw.s b/basic/source/runtime/wnt-mingw.s
index 1168804102..7868ddd386 100644
--- a/basic/source/runtime/wnt-mingw.s
+++ b/basic/source/runtime/wnt-mingw.s
@@ -1,7 +1,7 @@
#*************************************************************************
#
# 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
@@ -23,71 +23,31 @@
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
-#*************************************************************************
-
-# Anmerkungen
-# Direktaufruf von C- und PASCAL-Routinen, Windows und OS/2
-#
-# Inhalt:
-# type = CallXXX (far *pProc, char *pStack, short nStack)
-#
-# Kopie des Basic-Stacks (nStack Bytes) auf den C-Stack
-# und Aufruf der Prozedur.
-
- .intel_syntax
- #.386
-
-#_TEXT SEGMENT DWORD PUBLIC 'CODE' USE32
-
- #ASSUME CS:_TEXT
-
-.globl _CallINT
-.globl _CallLNG
-.globl _CallDBL
-.globl _CallSTR
-.globl _CallFIX
-
-_CallINT:
-_CallLNG:
-_CallDBL:
-_CallSTR:
-
-_CallFIX: PUSH EBP
- MOV EBP,ESP
- PUSH ESI
- PUSH EDI
-
- PUSH ECX
- PUSH EDX
-
- MOV DX,DS
- MOVZX EAX,WORD PTR [EBP+16] # EAX == nStack
- SUB ESP,EAX # Stack um nStack Bytes vergroessern
- MOV EDI,ESP
- MOV AX,SS
- MOV ES,AX # ES:EDI = Startadresse des fuer
- # Parameter reservierten Stackbereichs
- MOV ESI,[EBP+12] # DS:ESI == pStack
-
- MOVZX ECX,WORD PTR [EBP+16] # ECX == nStack
- SHR ECX,1
- CLD
- JCXZ $1
- REP MOVSW # Stack uebernehmen
-$1: MOV DS,DX
- CALL DWORD PTR [EBP+8] # Aufruf der Prozedur
- # CLI # unter NT nicht erlaubt (privileged instruction)
- MOV ESP,EBP
- SUB ESP,16 # wegen gepushter Register
- # (ESI, EDI)
- # STI
- POP EDX
- POP ECX
- POP EDI
- POP ESI
- POP EBP
- RET 12
-
-#_TEXT ENDS
-
- #END
+#***********************************************************************/
+
+.intel_syntax
+
+.globl _DllMgr_call32
+.globl _DllMgr_callFp
+
+_DllMgr_call32:
+_DllMgr_callFp:
+ push ebp
+ mov ebp, esp
+ push esi
+ push edi
+ mov ecx, [ebp+16]
+ jecxz $1
+ sub esp, ecx
+ mov edi, esp
+ mov esi, [ebp+12]
+ shr ecx, 2
+ rep movsd
+$1: call DWORD PTR [ebp+8]
+ ; for extra safety, do not trust esp after call (in case the Basic Declare
+ ; signature is wrong):
+ mov edi, [ebp-8]
+ mov esi, [ebp-4]
+ mov esp, ebp
+ pop ebp
+ ret 12
diff --git a/basic/source/runtime/wnt.asm b/basic/source/runtime/wnt.asm
index 3824daae96..2a8710e342 100644
--- a/basic/source/runtime/wnt.asm
+++ b/basic/source/runtime/wnt.asm
@@ -1,7 +1,7 @@
;*************************************************************************
;
; 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
@@ -23,70 +23,34 @@
; <http://www.openoffice.org/license.html>
; for a copy of the LGPLv3 License.
;
-;*************************************************************************
-
-; Anmerkungen
-; Direktaufruf von C- und PASCAL-Routinen, Windows und OS/2
-;
-; Inhalt:
-; type = CallXXX (far *pProc, char *pStack, short nStack)
-;
-; Kopie des Basic-Stacks (nStack Bytes) auf den C-Stack
-; und Aufruf der Prozedur.
-
- .386
-
-_TEXT SEGMENT DWORD PUBLIC 'CODE' USE32
-
- ASSUME CS:_TEXT
-
- PUBLIC _CallINT@12
- PUBLIC _CallLNG@12
- PUBLIC _CallDBL@12
- PUBLIC _CallSTR@12
- PUBLIC _CallFIX@12
-
-_CallINT@12 LABEL byte
-_CallLNG@12 LABEL byte
-_CallDBL@12 LABEL byte
-_CallSTR@12 LABEL byte
-
-_CallFIX@12: PUSH EBP
- MOV EBP,ESP
- PUSH ESI
- PUSH EDI
-
- PUSH ECX
- PUSH EDX
-
- MOV DX,DS
- MOVZX EAX,WORD PTR [EBP+16] ; EAX == nStack
- SUB ESP,EAX ; Stack um nStack Bytes vergroessern
- MOV EDI,ESP
- MOV AX,SS
- MOV ES,AX ; ES:EDI = Startadresse des fuer
- ; Parameter reservierten Stackbereichs
- MOV ESI,[EBP+12] ; DS:ESI == pStack
-
- MOVZX ECX,WORD PTR [EBP+16] ; ECX == nStack
- SHR ECX,1
- CLD
- JCXZ $1
- REP MOVSW ; Stack uebernehmen
-$1: MOV DS,DX
- CALL DWORD PTR [EBP+8] ; Aufruf der Prozedur
- ; CLI ; unter NT nicht erlaubt (privileged instruction)
- MOV ESP,EBP
- SUB ESP,16 ; wegen gepushter Register
- ; (ESI, EDI)
- ; STI
- POP EDX
- POP ECX
- POP EDI
- POP ESI
- POP EBP
- RET 12
-
-_TEXT ENDS
-
- END
+;***********************************************************************/
+
+.386
+
+PUBLIC _DllMgr_call32@12
+PUBLIC _DllMgr_callFp@12
+
+_TEXT SEGMENT
+_DllMgr_call32@12:
+_DllMgr_callFp@12:
+ push ebp
+ mov ebp, esp
+ push esi
+ push edi
+ mov ecx, [ebp+16]
+ jecxz $1
+ sub esp, ecx
+ mov edi, esp
+ mov esi, [ebp+12]
+ shr ecx, 2
+ rep movsd
+$1: call DWORD PTR [ebp+8]
+ ; for extra safety, do not trust esp after call (in case the Basic Declare
+ ; signature is wrong):
+ mov edi, [ebp-8]
+ mov esi, [ebp-4]
+ mov esp, ebp
+ pop ebp
+ ret 12
+_TEXT ENDS
+END
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index fe9734c84e..69ae79cad5 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -39,6 +39,9 @@
#include <math.h>
#include <ctype.h>
+#include "com/sun/star/uno/XInterface.hpp"
+using namespace com::sun::star::uno;
+
///////////////////////////// SbxVariable //////////////////////////////
TYPEINIT1(SbxVariable,SbxValue)
@@ -49,10 +52,28 @@ extern UINT32 nVarCreator; // in SBXBASE.CXX, fuer LoadData()
static ULONG nVar = 0;
#endif
+///////////////////////////// SbxVariableImpl ////////////////////////////
+
+class SbxVariableImpl
+{
+ friend class SbxVariable;
+ String m_aDeclareClassName;
+ Reference< XInterface > m_xComListener;
+
+ SbxVariableImpl( void )
+ {}
+ SbxVariableImpl( const SbxVariableImpl& r )
+ : m_aDeclareClassName( r.m_aDeclareClassName )
+ , m_xComListener( r.m_xComListener )
+ {}
+};
+
+
///////////////////////////// Konstruktoren //////////////////////////////
SbxVariable::SbxVariable() : SbxValue()
{
+ mpSbxVariableImpl = NULL;
pCst = NULL;
pParent = NULL;
nUserData = 0;
@@ -66,6 +87,9 @@ SbxVariable::SbxVariable() : SbxValue()
SbxVariable::SbxVariable( const SbxVariable& r )
: SvRefBase( r ), SbxValue( r ), mpPar( r.mpPar ), pInfo( r.pInfo )
{
+ mpSbxVariableImpl = NULL;
+ if( r.mpSbxVariableImpl != NULL )
+ mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl );
pCst = NULL;
if( r.CanRead() )
{
@@ -91,6 +115,7 @@ SbxVariable::SbxVariable( const SbxVariable& r )
SbxVariable::SbxVariable( SbxDataType t, void* p ) : SbxValue( t, p )
{
+ mpSbxVariableImpl = NULL;
pCst = NULL;
pParent = NULL;
nUserData = 0;
@@ -111,6 +136,7 @@ SbxVariable::~SbxVariable()
maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 );
GetSbxData_Impl()->aVars.Remove( this );
#endif
+ delete mpSbxVariableImpl;
delete pCst;
}
@@ -287,6 +313,11 @@ USHORT SbxVariable::MakeHashCode( const XubString& rName )
SbxVariable& SbxVariable::operator=( const SbxVariable& r )
{
SbxValue::operator=( r );
+ delete mpSbxVariableImpl;
+ if( r.mpSbxVariableImpl != NULL )
+ mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl );
+ else
+ mpSbxVariableImpl = NULL;
return *this;
}
@@ -346,6 +377,32 @@ void SbxVariable::SetParent( SbxObject* p )
pParent = p;
}
+SbxVariableImpl* SbxVariable::getImpl( void )
+{
+ if( mpSbxVariableImpl == NULL )
+ mpSbxVariableImpl = new SbxVariableImpl();
+ return mpSbxVariableImpl;
+}
+
+const String& SbxVariable::GetDeclareClassName( void )
+{
+ SbxVariableImpl* pImpl = getImpl();
+ return pImpl->m_aDeclareClassName;
+}
+
+void SbxVariable::SetDeclareClassName( const String& rDeclareClassName )
+{
+ SbxVariableImpl* pImpl = getImpl();
+ pImpl->m_aDeclareClassName = rDeclareClassName;
+}
+
+void SbxVariable::SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener )
+{
+ SbxVariableImpl* pImpl = getImpl();
+ pImpl->m_xComListener = xComListener;
+}
+
+
////////////////////////////// Laden/Speichern /////////////////////////////
BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 4bbcb31359..aee3d18392 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -187,12 +187,13 @@ bool writeOasis2OOoLibraryElement(
void SAL_CALL SfxDialogLibraryContainer::writeLibraryElement
(
- Any aElement,
- const OUString& /*aElementName*/,
- Reference< XOutputStream > xOutput
+ const Reference < XNameContainer >& xLib,
+ const OUString& aElementName,
+ const Reference< XOutputStream >& xOutput
)
throw(Exception)
{
+ Any aElement = xLib->getByName( aElementName );
Reference< XInputStreamProvider > xISP;
aElement >>= xISP;
if( !xISP.is() )
@@ -256,7 +257,9 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
- ( const OUString& aFile, const uno::Reference< io::XInputStream >& xElementStream )
+ ( const Reference < XNameContainer >& /*xLib*/,
+ const OUString& /*aElementName */, const OUString& aFile,
+ const uno::Reference< io::XInputStream >& xElementStream )
{
Any aRetAny;
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 06f4ecf22d..b641323507 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -65,7 +65,7 @@
#include <com/sun/star/uno/DeploymentException.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/script/LibraryNotLoadedException.hpp>
-#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
+#include "com/sun/star/deployment/ExtensionManager.hpp"
#include <comphelper/storagehelper.hxx>
#ifndef _RTL_USTRING_HXX_
#include <comphelper/anytostring.hxx>
@@ -1080,6 +1080,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
OUString aUserSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" );
OUString aSharedSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" );
+ OUString aBundledSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" );
OUString aInstSearchStr = OUString::createFromAscii( "$(INST)" );
Sequence< OUString > aNames = pPrevCont->getElementNames();
@@ -1111,6 +1112,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
bool bCreateLink = true;
if( aStorageURL.indexOf( aUserSearchStr ) != -1 ||
aStorageURL.indexOf( aSharedSearchStr ) != -1 ||
+ aStorageURL.indexOf( aBundledSearchStr ) != -1 ||
aStorageURL.indexOf( aInstSearchStr ) != -1 )
{
bCreateLink = false;
@@ -1369,8 +1371,8 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
OUString aStreamName = aElementName;
aStreamName += String( RTL_CONSTASCII_USTRINGPARAM(".xml") );
- Any aElement = pLib->getByName( aElementName );
- if( !isLibraryElementValid( aElement ) )
+ /*Any aElement = pLib->getByName( aElementName );*/
+ if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
#if OSL_DEBUG_LEVEL > 0
::rtl::OStringBuffer aMessage;
@@ -1406,7 +1408,8 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
xProps->setPropertyValue( aPropName, uno::makeAny( sal_True ) );
Reference< XOutputStream > xOutput = xElementStream->getOutputStream();
- writeLibraryElement( aElement, aElementName, xOutput );
+ Reference< XNameContainer > xLib( pLib );
+ writeLibraryElement( xLib, aElementName, xOutput );
// writeLibraryElement closes the stream
// xOutput->closeOutput();
}
@@ -1458,8 +1461,8 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
aElementInetObj.setExtension( maLibElementFileExtension );
String aElementPath( aElementInetObj.GetMainURL( INetURLObject::NO_DECODE ) );
- Any aElement = pLib->getByName( aElementName );
- if( !isLibraryElementValid( aElement ) )
+ /*Any aElement = pLib->getByName( aElementName );*/
+ if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
#if OSL_DEBUG_LEVEL > 0
::rtl::OStringBuffer aMessage;
@@ -1477,7 +1480,8 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
if( xSFI->exists( aElementPath ) )
xSFI->kill( aElementPath );
Reference< XOutputStream > xOutput = xSFI->openFileWrite( aElementPath );
- writeLibraryElement( aElement, aElementName, xOutput );
+ Reference< XNameContainer > xLib( pLib );
+ writeLibraryElement( xLib, aElementName, xOutput );
xOutput->closeOutput();
}
catch( Exception& )
@@ -2167,6 +2171,7 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink
SfxLibrary* pNewLib = implCreateLibraryLink( Name, aLibInfoFileURL, aLibDirURL, ReadOnly );
pNewLib->maLibElementFileExtension = maLibElementFileExtension;
pNewLib->maUnexpandedStorageURL = aUnexpandedStorageURL;
+ pNewLib->maOrignialStorageURL = StorageURL;
OUString aInitFileName;
uno::Reference< embed::XStorage > xDummyStor;
@@ -2182,11 +2187,12 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink
OUString aUserSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" );
OUString aSharedSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" );
+ OUString aBundledSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" );
if( StorageURL.indexOf( aUserSearchStr ) != -1 )
{
pNewLib->mbExtension = sal_True;
}
- else if( StorageURL.indexOf( aSharedSearchStr ) != -1 )
+ else if( StorageURL.indexOf( aSharedSearchStr ) != -1 || StorageURL.indexOf( aBundledSearchStr ) != -1 )
{
pNewLib->mbExtension = sal_True;
pNewLib->mbReadOnly = sal_True;
@@ -2380,7 +2386,9 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
aFile = aElementInetObj.GetMainURL( INetURLObject::NO_DECODE );
}
- Any aAny = importLibraryElement( aFile, xInStream );
+ Reference< XNameContainer > xLib( pImplLib );
+ Any aAny = importLibraryElement( xLib, aElementName,
+ aFile, xInStream );
if( pImplLib->hasByName( aElementName ) )
{
if( aAny.hasValue() )
@@ -2785,6 +2793,21 @@ OUString SfxLibraryContainer::expand_url( const OUString& url )
}
}
+
+//XLibraryContainer3
+OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString& Name )
+ throw (IllegalArgumentException, NoSuchElementException, RuntimeException)
+{
+ LibraryContainerMethodGuard aGuard( *this );
+ SfxLibrary* pImplLib = getImplLib( Name );
+ sal_Bool bLink = pImplLib->mbLink;
+ if( !bLink )
+ throw IllegalArgumentException();
+ OUString aRetStr = pImplLib->maOrignialStorageURL;
+ return aRetStr;
+}
+
+
::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatModeOn() throw (RuntimeException)
{
return mbVBACompat;
@@ -3097,8 +3120,10 @@ ScriptExtensionIterator::ScriptExtensionIterator( void )
: m_eState( USER_EXTENSIONS )
, m_bUserPackagesLoaded( false )
, m_bSharedPackagesLoaded( false )
+ , m_bBundledPackagesLoaded( false )
, m_iUserPackage( 0 )
, m_iSharedPackage( 0 )
+ , m_iBundledPackage( 0 )
, m_pScriptSubPackageIterator( NULL )
{
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
@@ -3147,6 +3172,16 @@ rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDia
aRetLib = xScriptPackage->getURL();
break;
}
+ case BUNDLED_EXTENSIONS:
+ {
+ Reference< deployment::XPackage > xScriptPackage =
+ implGetNextBundledScriptPackage( rbPureDialogLib );
+ if( !xScriptPackage.is() )
+ break;
+
+ aRetLib = xScriptPackage->getURL();
+ break;
+ }
case END_REACHED:
VOS_ENSURE( false, "ScriptExtensionIterator::nextBasicOrDialogLibrary(): Invalid case END_REACHED" );
break;
@@ -3317,10 +3352,11 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScript
{
try
{
- Reference< XPackageManager > xUserManager =
- thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("user") );
- m_aUserPackagesSeq = xUserManager->getDeployedPackages
- ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
+ Reference< XExtensionManager > xManager =
+ ExtensionManager::get( m_xContext );
+ m_aUserPackagesSeq = xManager->getDeployedExtensions
+ (rtl::OUString::createFromAscii("user"),
+ Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
}
catch( com::sun::star::uno::DeploymentException& )
{
@@ -3370,10 +3406,11 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri
{
try
{
- Reference< XPackageManager > xSharedManager =
- thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("shared") );
- m_aSharedPackagesSeq = xSharedManager->getDeployedPackages
- ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
+ Reference< XExtensionManager > xSharedManager =
+ ExtensionManager::get( m_xContext );
+ m_aSharedPackagesSeq = xSharedManager->getDeployedExtensions
+ (rtl::OUString::createFromAscii("shared"),
+ Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
}
catch( com::sun::star::uno::DeploymentException& )
{
@@ -3386,7 +3423,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri
if( m_iSharedPackage == m_aSharedPackagesSeq.getLength() )
{
- m_eState = END_REACHED;
+ m_eState = BUNDLED_EXTENSIONS;
}
else
{
@@ -3413,4 +3450,57 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri
return xScriptPackage;
}
+Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScriptPackage
+ ( bool& rbPureDialogLib )
+{
+ Reference< deployment::XPackage > xScriptPackage;
+
+ if( !m_bBundledPackagesLoaded )
+ {
+ try
+ {
+ Reference< XExtensionManager > xManager =
+ ExtensionManager::get( m_xContext );
+ m_aBundledPackagesSeq = xManager->getDeployedExtensions
+ (rtl::OUString::createFromAscii("bundled"),
+ Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
+ }
+ catch( com::sun::star::uno::DeploymentException& )
+ {
+ // Special Office installations may not contain deployment code
+ return xScriptPackage;
+ }
+
+ m_bBundledPackagesLoaded = true;
+ }
+
+ if( m_iBundledPackage == m_aBundledPackagesSeq.getLength() )
+ {
+ m_eState = END_REACHED;
+ }
+ else
+ {
+ if( m_pScriptSubPackageIterator == NULL )
+ {
+ const Reference< deployment::XPackage >* pBundledPackages = m_aBundledPackagesSeq.getConstArray();
+ Reference< deployment::XPackage > xPackage = pBundledPackages[ m_iBundledPackage ];
+ VOS_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextBundledScriptPackage(): Invalid package" );
+ m_pScriptSubPackageIterator = new ScriptSubPackageIterator( xPackage );
+ }
+
+ if( m_pScriptSubPackageIterator != NULL )
+ {
+ xScriptPackage = m_pScriptSubPackageIterator->getNextScriptSubPackage( rbPureDialogLib );
+ if( !xScriptPackage.is() )
+ {
+ delete m_pScriptSubPackageIterator;
+ m_pScriptSubPackageIterator = NULL;
+ m_iBundledPackage++;
+ }
+ }
+ }
+
+ return xScriptPackage;
+}
+
} // namespace basic
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index c490571855..2bc4787a65 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
+#include <com/sun/star/script/ModuleType.hpp>
#include <comphelper/processfactory.hxx>
#ifndef _COMPHELPER_STORAGEHELPER_HXX_
#include <comphelper/storagehelper.hxx>
@@ -60,6 +61,7 @@
#include <svtools/ehdl.hxx>
#include <basic/basmgr.hxx>
#include <basic/sbmod.hxx>
+#include <basic/basicmanagerrepository.hxx>
#include "modsizeexceeded.hxx"
#include <xmlscript/xmlmod_imexp.hxx>
#include <cppuhelper/factory.hxx>
@@ -184,9 +186,9 @@ bool SAL_CALL SfxScriptLibraryContainer::isLibraryElementValid( Any aElement ) c
void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement
(
- Any aElement,
+ const Reference < XNameContainer >& xLib,
const OUString& aElementName,
- Reference< XOutputStream > xOutput
+ const Reference< XOutputStream >& xOutput
)
throw(Exception)
{
@@ -211,13 +213,42 @@ void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement
xmlscript::ModuleDescriptor aMod;
aMod.aName = aElementName;
aMod.aLanguage = maScriptLanguage;
+ Any aElement = xLib->getByName( aElementName );
aElement >>= aMod.aCode;
+
+ Reference < script::XVBAModuleInfo > xModInfo( xLib, UNO_QUERY );
+
+ if( xModInfo.is() && xModInfo->hasModuleInfo( aElementName ) )
+ {
+ script::ModuleInfo aModInfo = xModInfo->getModuleInfo( aElementName );
+ switch( aModInfo.ModuleType )
+ {
+ case ModuleType::NORMAL:
+ aMod.aModuleType = OUString( RTL_CONSTASCII_USTRINGPARAM("normal") );
+ break;
+ case ModuleType::CLASS:
+ aMod.aModuleType = OUString( RTL_CONSTASCII_USTRINGPARAM("class") );
+ break;
+ case ModuleType::FORM:
+ aMod.aModuleType = OUString( RTL_CONSTASCII_USTRINGPARAM("form") );
+ break;
+ case ModuleType::DOCUMENT:
+ aMod.aModuleType = OUString( RTL_CONSTASCII_USTRINGPARAM("document") );
+ break;
+ case ModuleType::UNKNOWN:
+ // nothing
+ break;
+ }
+ }
+
xmlscript::exportScriptModule( xHandler, aMod );
}
Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
- ( const OUString& aFile, const uno::Reference< io::XInputStream >& xInStream )
+ ( const Reference < XNameContainer >& xLib,
+ const OUString& aElementName, const OUString& aFile,
+ const uno::Reference< io::XInputStream >& xInStream )
{
Any aRetAny;
@@ -279,6 +310,86 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
// TODO: Check language
// aMod.aLanguage
// aMod.aName ignored
+ if( aMod.aModuleType.getLength() > 0 )
+ {
+ if( !getVBACompatModeOn() )
+ {
+ setVBACompatModeOn( sal_True );
+
+ Any aGlobs;
+ Sequence< Any > aArgs(1);
+ Reference<frame::XModel > xModel( mxOwnerDocument );
+ aArgs[ 0 ] <<= xModel;
+
+ BasicManager* pBasicMgr = getBasicManager();
+ if( pBasicMgr )
+ {
+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs );
+ pBasicMgr->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
+ }
+ pBasicMgr = BasicManagerRepository::getApplicationBasicManager( sal_False );
+ if( pBasicMgr )
+ pBasicMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[0] );
+ }
+
+ script::ModuleInfo aModInfo;
+ aModInfo.ModuleType = ModuleType::UNKNOWN;
+ if( aMod.aModuleType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("normal") ))
+ {
+ aModInfo.ModuleType = ModuleType::NORMAL;
+ }
+ else if( aMod.aModuleType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("class") ))
+ {
+ aModInfo.ModuleType = ModuleType::CLASS;
+ }
+ else if( aMod.aModuleType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("form") ))
+ {
+ aModInfo.ModuleType = ModuleType::FORM;
+ aModInfo.ModuleObject = mxOwnerDocument;
+ }
+ else if( aMod.aModuleType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("document") ))
+ {
+ aModInfo.ModuleType = ModuleType::DOCUMENT;
+ Reference<frame::XModel > xModel( mxOwnerDocument );
+ Reference< XMultiServiceFactory> xSF( xModel, UNO_QUERY);
+ Reference< container::XNameAccess > xVBACodeNameAccess;
+ if( xSF.is() )
+ {
+ try
+ {
+ xVBACodeNameAccess.set( xSF->createInstance(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "ooo.vba.VBAObjectModuleObjectProvider"))),
+ UNO_QUERY );
+ }
+ catch(uno::Exception&) {}
+ }
+ if( xVBACodeNameAccess.is() )
+ {
+ try
+ {
+ aModInfo.ModuleObject.set( xVBACodeNameAccess->getByName( aElementName), uno::UNO_QUERY );
+ }
+ catch(uno::Exception&)
+ {
+ OSL_TRACE("Failed to get documument object for %s", rtl::OUStringToOString( aElementName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+ }
+ }
+
+ Reference< script::XVBAModuleInfo > xVBAModuleInfo( xLib,
+ UNO_QUERY );
+ if( xVBAModuleInfo.is() )
+ {
+ if( xVBAModuleInfo->hasModuleInfo( aElementName ) )
+ xVBAModuleInfo->removeModuleInfo( aElementName );
+ xVBAModuleInfo->insertModuleInfo( aElementName, aModInfo );
+ }
+ }
return aRetAny;
}
@@ -574,8 +685,8 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
if( pLib->mbPasswordVerified || pLib->mbDoc50Password )
{
- Any aElement = pLib->getByName( aElementName );
- if( !isLibraryElementValid( aElement ) )
+ /*Any aElement = pLib->getByName( aElementName );*/
+ if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
#if OSL_DEBUG_LEVEL > 0
::rtl::OStringBuffer aMessage;
@@ -606,7 +717,8 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
setStreamKey( xSourceStream, pLib->maPassword );
Reference< XOutputStream > xOutput = xSourceStream->getOutputStream();
- writeLibraryElement( aElement, aElementName, xOutput );
+ Reference< XNameContainer > xLib( pLib );
+ writeLibraryElement( xLib, aElementName, xOutput );
// writeLibraryElement should have the stream already closed
// xOutput->closeOutput();
}
@@ -659,8 +771,8 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
aElementInetObj.setExtension( OUString( RTL_CONSTASCII_USTRINGPARAM("pba") ) );
String aElementPath = aElementInetObj.GetMainURL( INetURLObject::NO_DECODE );
- Any aElement = pLib->getByName( aElementName );
- if( !isLibraryElementValid( aElement ) )
+ /*Any aElement = pLib->getByName( aElementName );*/
+ if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
#if OSL_DEBUG_LEVEL > 0
::rtl::OStringBuffer aMessage;
@@ -741,7 +853,8 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
xProps->setPropertyValue( aPropName, uno::makeAny( aMime ) );
Reference< XOutputStream > xOut = xSourceStream->getOutputStream();
- writeLibraryElement( aElement, aElementName, xOut );
+ Reference< XNameContainer > xLib( pLib );
+ writeLibraryElement( xLib, aElementName, xOut );
// i50568: sax writer already closes stream
// xOut->closeOutput();
@@ -903,7 +1016,10 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
if ( !xInStream.is() )
throw io::IOException(); // read access denied, seems to be impossible
- Any aAny = importLibraryElement( aSourceStreamName, xInStream );
+ Reference< XNameContainer > xLib( pLib );
+ Any aAny = importLibraryElement( xLib,
+ aElementName, aSourceStreamName,
+ xInStream );
if( pLib->hasByName( aElementName ) )
{
if( aAny.hasValue() )
@@ -1006,7 +1122,11 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary
if ( !xInStream.is() )
throw io::IOException(); // read access denied, seems to be impossible
- Any aAny = importLibraryElement( aSourceStreamName, xInStream );
+ Reference< XNameContainer > xLib( pLib );
+ Any aAny = importLibraryElement( xLib,
+ aElementName,
+ aSourceStreamName,
+ xInStream );
if( pLib->hasByName( aElementName ) )
{
if( aAny.hasValue() )
diff --git a/basic/util/makefile.mk b/basic/util/makefile.mk
index 645c9b6a3c..629586f044 100644
--- a/basic/util/makefile.mk
+++ b/basic/util/makefile.mk
@@ -59,6 +59,7 @@ SHL1STDLIBS= \
$(VCLLIB) \
$(VOSLIB) \
$(SALLIB) \
+ $(SALHELPERLIB) \
$(COMPHELPERLIB) \
$(UNOTOOLSLIB) \
$(SOTLIB) \
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index 5b30e9491e..b0f525f1c5 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -369,22 +369,22 @@ Components::Components(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"$BRAND_BASE_DIR/share/registry/modules"))));
- parseXcsXcuLayer( //TODO: migrate
+ parseXcsXcuIniLayer(
7,
expand(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno")
- ":UNO_SHARED_PACKAGES_CACHE}/registry/"
+ ":BUNDLED_EXTENSIONS_USER}/registry/"
"com.sun.star.comp.deployment.configuration."
- "PackageRegistryBackend/registry"))));
+ "PackageRegistryBackend/configmgr.ini"))));
parseXcsXcuIniLayer(
9,
expand(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno")
- ":UNO_SHARED_PACKAGES_CACHE}/registry/"
+ ":SHARED_EXTENSIONS_USER}/registry/"
"com.sun.star.comp.deployment.configuration."
"PackageRegistryBackend/configmgr.ini"))));
parseXcsXcuLayer( //TODO: migrate
diff --git a/connectivity/qa/drivers/dbase/test.properties b/connectivity/qa/drivers/dbase/test.properties
index 6f301f972d..c26879f480 100644
--- a/connectivity/qa/drivers/dbase/test.properties
+++ b/connectivity/qa/drivers/dbase/test.properties
@@ -1,3 +1,4 @@
+# x-no-translate
Driver=org.openoffice.comp.drivers.MySQL.Driver
user=testuser
password=
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 2eef01f08e..05309d56ef 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -133,6 +133,10 @@ class Desktop : public Application
static sal_Bool IsFirstStartWizardNeeded();
static sal_Bool CheckExtensionDependencies();
+ void SynchronizeExtensionRepositories();
+ void SetSplashScreenText( const ::rtl::OUString& rText );
+ void SetSplashScreenProgress( sal_Int32 );
+
private:
// Bootstrap methods
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > CreateApplicationServiceManager();
@@ -164,7 +168,6 @@ class Desktop : public Application
Reference<XStatusIndicator> m_rSplashScreen;
void OpenSplashScreen();
- void SetSplashScreenProgress(sal_Int32);
void CloseSplashScreen();
void EnableOleAutomation();
diff --git a/desktop/inc/deployment.hrc b/desktop/inc/deployment.hrc
index 73440bbe0a..92c5742fcd 100644
--- a/desktop/inc/deployment.hrc
+++ b/desktop/inc/deployment.hrc
@@ -63,7 +63,6 @@
#define RID_IMG_JAVA_TYPELIB_HC (RID_DEPLOYMENT_COMPONENT_START+7)
#define RID_DEPLOYMENT_UNOPKG_START (RID_DEPLOYMENT_START+4000)
-#define RID_STR_UNOPKG_NO_SHARED_ALLOWED RID_DEPLOYMENT_UNOPKG_START
#define RID_STR_UNOPKG_ACCEPT_LIC_1 (RID_DEPLOYMENT_UNOPKG_START+1)
#define RID_STR_UNOPKG_ACCEPT_LIC_2 (RID_DEPLOYMENT_UNOPKG_START+2)
#define RID_STR_UNOPKG_ACCEPT_LIC_3 (RID_DEPLOYMENT_UNOPKG_START+3)
diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst
index 6f611926a0..8029b6ecc9 100644
--- a/desktop/prj/build.lst
+++ b/desktop/prj/build.lst
@@ -21,10 +21,9 @@ dt desktop\os2\source\applauncher nmake - p dt_applauncher dt_inc NULL
dt desktop\unx\source\officeloader nmake - u dt_officeloader_unx dt_inc NULL
dt desktop\source\pagein nmake - u dt_pagein dt_inc NULL
dt desktop\source\pkgchk\unopkg nmake - all dt_unopkg dt_dp_misc dt_app dt_inc dt_guiloader.w NULL
-dt desktop\source\deployment nmake - all dt_deployment dt_dp_manager dt_dp_registry dt_dp_registry_package dt_dp_registry_executable dt_dp_registry_help dt_dp_registry_script dt_dp_registry_sfwk dt_dp_registry_component dt_dp_registry_configuration dt_dp_migration dt_dp_unopkg dt_inc dt_dp_misc NULL
+dt desktop\source\deployment nmake - all dt_deployment dt_dp_manager dt_dp_registry dt_dp_registry_package dt_dp_registry_executable dt_dp_registry_help dt_dp_registry_script dt_dp_registry_sfwk dt_dp_registry_component dt_dp_registry_configuration dt_dp_unopkg dt_inc dt_dp_misc NULL
dt desktop\source\deployment\misc nmake - all dt_dp_misc dt_inc NULL
dt desktop\source\deployment\unopkg nmake - all dt_dp_unopkg dt_inc NULL
-dt desktop\source\deployment\migration nmake - all dt_dp_migration dt_inc NULL
dt desktop\source\deployment\gui nmake - all dt_dp_gui dt_dp_misc dt_inc NULL
dt desktop\source\deployment\manager nmake - all dt_dp_manager dt_inc NULL
dt desktop\source\deployment\registry nmake - all dt_dp_registry dt_inc NULL
diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh
index af6a9df908..e2031c2f82 100644
--- a/desktop/scripts/soffice.sh
+++ b/desktop/scripts/soffice.sh
@@ -120,9 +120,14 @@ trap 'kill -9 $!' TERM
wait $!
sd_ret=$?
-while [ $sd_ret -eq 79 ]
+while [ $sd_ret -eq 79 -o $sd_ret -eq 81 ]
do
- "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" &
+ if [ $sd_ret -eq 79 ]; then
+ "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" &
+ elif [ $sd_ret -eq 81 ]; then
+ "$sd_prog/$sd_binary" "$@" &
+ fi
+
wait $!
sd_ret=$?
done
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 1cbb890e0b..d91f56a541 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -84,6 +84,7 @@
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/task/XJobExecutor.hpp>
+#include <com/sun/star/task/XRestartManager.hpp>
#ifndef _COM_SUN_STAR_TASK_XJOBEXECUTOR_HPP_
#include <com/sun/star/task/XJob.hpp>
#endif
@@ -103,6 +104,7 @@
#include <vos/security.hxx>
#include <vos/ref.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/configurationhelper.hxx>
#ifndef _UTL__HXX_
#include <unotools/configmgr.hxx>
@@ -140,6 +142,7 @@
#include <sfx2/sfx.hrc>
#include <ucbhelper/contentbroker.hxx>
#include <unotools/bootstrap.hxx>
+#include <cppuhelper/bootstrap.hxx>
#include "vos/process.hxx"
@@ -1409,10 +1412,13 @@ void Desktop::Main()
tools::InitTestToolLib();
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} tools::InitTestToolLib" );
+ // Check if bundled or shared extensions were added /removed
+ // and process those extensions (has to be done before checking
+ // the extension dependencies!
+ SynchronizeExtensionRepositories();
bool bAbort = CheckExtensionDependencies();
if ( bAbort )
return;
-
// First Start Wizard allowed ?
if ( ! pCmdLineArgs->IsNoFirstStartWizard())
{
@@ -1456,7 +1462,6 @@ void Desktop::Main()
}
SetSplashScreenProgress(50);
-
// Backing Component
sal_Bool bCrashed = sal_False;
sal_Bool bExistsRecoveryData = sal_False;
@@ -1627,6 +1632,7 @@ void Desktop::Main()
// call Application::Execute to process messages in vcl message loop
RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" );
+ Reference< ::com::sun::star::task::XRestartManager > xRestartManager;
try
{
// The JavaContext contains an interaction handler which is used when
@@ -1634,7 +1640,10 @@ void Desktop::Main()
com::sun::star::uno::ContextLayer layer2(
new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) );
- Execute();
+ ::comphelper::ComponentContext aContext( xSMgr );
+ xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY );
+ if ( !xRestartManager.is() || !xRestartManager->isRestartRequested( sal_True ) )
+ Execute();
}
catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg)
{
@@ -1647,6 +1656,9 @@ void Desktop::Main()
FatalError( MakeStartupErrorMessage(exAnyCfg.Message) );
}
+ // check whether the shutdown is caused by restart
+ sal_Bool bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
+
if (xGlobalBroadcaster.is())
{
css::document::EventObject aEvent;
@@ -1655,22 +1667,18 @@ void Desktop::Main()
}
delete pResMgr;
-
// Restore old value
if ( pCmdLineArgs->IsHeadless() )
SvtMiscOptions().SetUseSystemFileDialog( bUseSystemFileDialog );
// remove temp directory
RemoveTemporaryDirectory();
-
// The acceptors in the AcceptorMap must be released (in DeregisterServices)
// with the solar mutex unlocked, to avoid deadlock:
nAcquireCount = Application::ReleaseSolarMutex();
DeregisterServices();
Application::AcquireSolarMutex(nAcquireCount);
-
tools::DeInitTestToolLib();
-
// be sure that path/language options gets destroyed before
// UCB is deinitialized
RTL_LOGFILE_CONTEXT_TRACE( aLog, "-> dispose path/language options" );
@@ -1683,6 +1691,14 @@ void Desktop::Main()
RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- deinit ucb" );
RTL_LOGFILE_CONTEXT_TRACE( aLog, "FINISHED WITH Destop::Main" );
+ if ( bRestartRequested )
+ {
+#ifdef MACOSX
+ DoRestart();
+#endif
+ // wouldn't the solution be more clean if SalMain returns the exit code to the system?
+ _exit( ExitHelper::E_NORMAL_RESTART );
+ }
}
IMPL_LINK( Desktop, ImplInitFilterHdl, ConvertData*, pData )
@@ -2933,6 +2949,14 @@ void Desktop::SetSplashScreenProgress(sal_Int32 iProgress)
}
}
+void Desktop::SetSplashScreenText( const ::rtl::OUString& rText )
+{
+ if( m_rSplashScreen.is() )
+ {
+ m_rSplashScreen->setText( rText );
+ }
+}
+
void Desktop::CloseSplashScreen()
{
if(m_rSplashScreen.is())
diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx
index 5ca1db7c31..bb946c99e3 100644..100755
--- a/desktop/source/app/check_ext_deps.cxx
+++ b/desktop/source/app/check_ext_deps.cxx
@@ -27,35 +27,202 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_desktop.hxx"
+#include "osl/file.hxx"
+#include "osl/mutex.hxx"
+
#include <rtl/bootstrap.hxx>
#include <rtl/ustring.hxx>
+#include <rtl/logfile.hxx>
+#include "cppuhelper/compbase3.hxx"
+
+#include "vcl/wrkwin.hxx"
+#include "vcl/timer.hxx"
+
#include <unotools/configmgr.hxx>
+#include "toolkit/helper/vclunohelper.hxx"
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
#include <cppuhelper/bootstrap.hxx>
-
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include "com/sun/star/deployment/XPackage.hpp"
-#include "com/sun/star/deployment/XPackageManager.hpp"
-#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
+#include "com/sun/star/deployment/ExtensionManager.hpp"
+#include "com/sun/star/deployment/LicenseException.hpp"
+#include "com/sun/star/deployment/ui/LicenseDialog.hpp"
#include <com/sun/star/task/XJob.hpp>
#include <com/sun/star/task/XJobExecutor.hpp>
+#include <com/sun/star/task/XInteractionApprove.hpp>
+#include <com/sun/star/task/XInteractionAbort.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp"
#include <com/sun/star/util/XChangesBatch.hpp>
#include "app.hxx"
+#include "../deployment/inc/dp_misc.h"
+
using rtl::OUString;
using namespace desktop;
using namespace com::sun::star;
-#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+#define UNISTRING(s) OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+
+namespace
+{
+//For use with XExtensionManager.synchronize
+class SilentCommandEnv
+ : public ::cppu::WeakImplHelper3< ucb::XCommandEnvironment,
+ task::XInteractionHandler,
+ ucb::XProgressHandler >
+{
+ Desktop *mpDesktop;
+ sal_Int32 mnLevel;
+ sal_Int32 mnProgress;
+
+public:
+ SilentCommandEnv( Desktop* pDesktop );
+ virtual ~SilentCommandEnv();
+
+ // XCommandEnvironment
+ virtual uno::Reference<task::XInteractionHandler > SAL_CALL
+ getInteractionHandler() throw (uno::RuntimeException);
+ virtual uno::Reference<ucb::XProgressHandler >
+ SAL_CALL getProgressHandler() throw (uno::RuntimeException);
+
+ // XInteractionHandler
+ virtual void SAL_CALL handle(
+ uno::Reference<task::XInteractionRequest > const & xRequest )
+ throw (uno::RuntimeException);
+
+ // XProgressHandler
+ virtual void SAL_CALL push( uno::Any const & Status )
+ throw (uno::RuntimeException);
+ virtual void SAL_CALL update( uno::Any const & Status )
+ throw (uno::RuntimeException);
+ virtual void SAL_CALL pop() throw (uno::RuntimeException);
+};
+
+//-----------------------------------------------------------------------------
+SilentCommandEnv::SilentCommandEnv( Desktop* pDesktop )
+{
+ mpDesktop = pDesktop;
+ mnLevel = 0;
+ mnProgress = 25;
+}
+
+//-----------------------------------------------------------------------------
+SilentCommandEnv::~SilentCommandEnv()
+{
+ mpDesktop->SetSplashScreenText( OUString() );
+}
+
+//-----------------------------------------------------------------------------
+Reference<task::XInteractionHandler> SilentCommandEnv::getInteractionHandler()
+ throw (uno::RuntimeException)
+{
+ return this;
+}
+
+//-----------------------------------------------------------------------------
+Reference<ucb::XProgressHandler> SilentCommandEnv::getProgressHandler()
+ throw (uno::RuntimeException)
+{
+ return this;
+}
+//-----------------------------------------------------------------------------
+// XInteractionHandler
+void SilentCommandEnv::handle( Reference< task::XInteractionRequest> const & xRequest )
+ throw (uno::RuntimeException)
+{
+ deployment::LicenseException licExc;
+
+ uno::Any request( xRequest->getRequest() );
+ bool bApprove = true;
+
+ if ( request >>= licExc )
+ {
+ uno::Reference< uno::XComponentContext > xContext = comphelper_getProcessComponentContext();
+ uno::Reference< ui::dialogs::XExecutableDialog > xDialog(
+ deployment::ui::LicenseDialog::create(
+ xContext, VCLUnoHelper::GetInterface( NULL ),
+ licExc.ExtensionName, licExc.Text ) );
+ sal_Int16 res = xDialog->execute();
+ if ( res == ui::dialogs::ExecutableDialogResults::CANCEL )
+ bApprove = false;
+ else if ( res == ui::dialogs::ExecutableDialogResults::OK )
+ bApprove = true;
+ else
+ {
+ OSL_ASSERT(0);
+ }
+ }
+
+ // We approve everything here
+ uno::Sequence< Reference< task::XInteractionContinuation > > conts( xRequest->getContinuations() );
+ Reference< task::XInteractionContinuation > const * pConts = conts.getConstArray();
+ sal_Int32 len = conts.getLength();
+
+ for ( sal_Int32 pos = 0; pos < len; ++pos )
+ {
+ if ( bApprove )
+ {
+ uno::Reference< task::XInteractionApprove > xInteractionApprove( pConts[ pos ], uno::UNO_QUERY );
+ if ( xInteractionApprove.is() )
+ xInteractionApprove->select();
+ }
+ else
+ {
+ uno::Reference< task::XInteractionAbort > xInteractionAbort( pConts[ pos ], uno::UNO_QUERY );
+ if ( xInteractionAbort.is() )
+ xInteractionAbort->select();
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+// XProgressHandler
+void SilentCommandEnv::push( uno::Any const & rStatus )
+ throw (uno::RuntimeException)
+{
+ OUString sText;
+ mnLevel += 1;
+
+ if ( rStatus.hasValue() && ( rStatus >>= sText) )
+ {
+ if ( mnLevel <= 3 )
+ mpDesktop->SetSplashScreenText( sText );
+ else
+ mpDesktop->SetSplashScreenProgress( ++mnProgress );
+ }
+}
+
+//-----------------------------------------------------------------------------
+void SilentCommandEnv::update( uno::Any const & rStatus )
+ throw (uno::RuntimeException)
+{
+ OUString sText;
+ if ( rStatus.hasValue() && ( rStatus >>= sText) )
+ {
+ mpDesktop->SetSplashScreenText( sText );
+ }
+}
+
+//-----------------------------------------------------------------------------
+void SilentCommandEnv::pop() throw (uno::RuntimeException)
+{
+ mnLevel -= 1;
+}
+
+} // end namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) );
static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) );
-
//------------------------------------------------------------------------------
static sal_Int16 impl_showExtensionDialog( uno::Reference< uno::XComponentContext > &xContext )
{
@@ -79,55 +246,75 @@ static sal_Int16 impl_showExtensionDialog( uno::Reference< uno::XComponentContex
//------------------------------------------------------------------------------
// Check dependencies of all packages
//------------------------------------------------------------------------------
-static bool impl_checkDependencies( const uno::Reference< deployment::XPackageManager > &xPackageManager )
+static bool impl_checkDependencies( const uno::Reference< uno::XComponentContext > &xContext )
{
- uno::Sequence< uno::Reference< deployment::XPackage > > packages;
+ uno::Sequence< uno::Sequence< uno::Reference< deployment::XPackage > > > xAllPackages;
+ uno::Reference< deployment::XExtensionManager > xExtensionManager = deployment::ExtensionManager::get( xContext );
+
+ if ( !xExtensionManager.is() )
+ {
+ OSL_ENSURE( 0, "Could not get the Extension Manager!" );
+ return true;
+ }
try {
- packages = xPackageManager->getDeployedPackages( uno::Reference< task::XAbortChannel >(),
- uno::Reference< ucb::XCommandEnvironment >() );
+ xAllPackages = xExtensionManager->getAllExtensions( uno::Reference< task::XAbortChannel >(),
+ uno::Reference< ucb::XCommandEnvironment >() );
}
- catch ( deployment::DeploymentException & ) { /* handleGeneralError(e.Cause);*/ }
- catch ( ucb::CommandFailedException & ) { /* handleGeneralError(e.Reason);*/ }
- catch ( ucb::CommandAbortedException & ) {}
+ catch ( deployment::DeploymentException & ) { return true; }
+ catch ( ucb::CommandFailedException & ) { return true; }
+ catch ( ucb::CommandAbortedException & ) { return true; }
catch ( lang::IllegalArgumentException & e ) {
throw uno::RuntimeException( e.Message, e.Context );
}
- for ( sal_Int32 i = 0; i < packages.getLength(); ++i )
+ sal_Int32 nMax = 2;
+#ifdef DEBUG
+ nMax = 3;
+#endif
+
+ for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i )
{
- bool bRegistered = false;
- try {
- beans::Optional< beans::Ambiguous< sal_Bool > > option( packages[i]->isRegistered( uno::Reference< task::XAbortChannel >(),
- uno::Reference< ucb::XCommandEnvironment >() ) );
- if ( option.IsPresent )
- {
- ::beans::Ambiguous< sal_Bool > const & reg = option.Value;
- if ( reg.IsAmbiguous )
- bRegistered = false;
- else
- bRegistered = reg.Value ? true : false;
- }
- else
- bRegistered = false;
- }
- catch ( uno::RuntimeException & ) { throw; }
- catch ( uno::Exception & exc) {
- (void) exc;
- OSL_ENSURE( 0, ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
- bRegistered = false;
- }
+ uno::Sequence< uno::Reference< deployment::XPackage > > xPackageList = xAllPackages[i];
- if ( bRegistered )
+ for ( sal_Int32 j = 0; (j<nMax) && (j < xPackageList.getLength()); ++j )
{
- bool bDependenciesValid = false;
- try {
- bDependenciesValid = packages[i]->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
- }
- catch ( deployment::DeploymentException & ) {}
- if ( ! bDependenciesValid )
+ uno::Reference< deployment::XPackage > xPackage = xPackageList[j];
+ if ( xPackage.is() )
{
- return false;
+ bool bRegistered = false;
+ try {
+ beans::Optional< beans::Ambiguous< sal_Bool > > option( xPackage->isRegistered( uno::Reference< task::XAbortChannel >(),
+ uno::Reference< ucb::XCommandEnvironment >() ) );
+ if ( option.IsPresent )
+ {
+ ::beans::Ambiguous< sal_Bool > const & reg = option.Value;
+ if ( reg.IsAmbiguous )
+ bRegistered = false;
+ else
+ bRegistered = reg.Value ? true : false;
+ }
+ else
+ bRegistered = false;
+ }
+ catch ( uno::RuntimeException & ) { throw; }
+ catch ( uno::Exception & exc) {
+ (void) exc;
+ OSL_ENSURE( 0, ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+
+ if ( bRegistered )
+ {
+ bool bDependenciesValid = false;
+ try {
+ bDependenciesValid = xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
+ }
+ catch ( deployment::DeploymentException & ) {}
+ if ( ! bDependenciesValid )
+ {
+ return false;
+ }
+ }
}
}
}
@@ -164,31 +351,11 @@ static void impl_setNeedsCompatCheck()
static bool impl_check()
{
uno::Reference< uno::XComponentContext > xContext = comphelper_getProcessComponentContext();
- uno::Reference< deployment::XPackageManager > xManager;
- bool bDependenciesValid = true;
-
- try {
- xManager = deployment::thePackageManagerFactory::get( xContext )->getPackageManager( UNISTRING("user") );
- }
- catch ( ucb::CommandFailedException & ){}
- catch ( uno::RuntimeException & ) {}
- if ( xManager.is() )
- bDependenciesValid = impl_checkDependencies( xManager );
-
- if ( bDependenciesValid )
- {
- try {
- xManager = deployment::thePackageManagerFactory::get( xContext )->getPackageManager( UNISTRING("shared") );
- }
- catch ( ucb::CommandFailedException & ){}
- catch ( uno::RuntimeException & ) {}
-
- if ( xManager.is() )
- bDependenciesValid = impl_checkDependencies( xManager );
- }
+ bool bDependenciesValid = impl_checkDependencies( xContext );
short nRet = 0;
+
if ( !bDependenciesValid )
nRet = impl_showExtensionDialog( xContext );
@@ -202,7 +369,7 @@ static bool impl_check()
}
//------------------------------------------------------------------------------
-// to check, if we need checking the dependencies of the extensions again, we compare
+// to check if we need checking the dependencies of the extensions again, we compare
// the build id of the office with the one of the last check
//------------------------------------------------------------------------------
static bool impl_needsCompatCheck()
@@ -235,6 +402,9 @@ static bool impl_needsCompatCheck()
pset->setPropertyValue( OUString::createFromAscii("LastCompatibilityCheckID"), result );
Reference< util::XChangesBatch >( pset, UNO_QUERY_THROW )->commitChanges();
}
+#ifdef DEBUG
+ bNeedsCheck = true;
+#endif
}
catch (const Exception&) {}
@@ -254,3 +424,8 @@ sal_Bool Desktop::CheckExtensionDependencies()
return bAbort;
}
+void Desktop::SynchronizeExtensionRepositories()
+{
+ RTL_LOGFILE_CONTEXT(aLog,"desktop (jl) ::Desktop::SynchronizeExtensionRepositories");
+ dp_misc::syncRepositories( new SilentCommandEnv( this ) );
+}
diff --git a/desktop/source/app/makefile.mk b/desktop/source/app/makefile.mk
index d9db7c1634..085d8520e7 100644
--- a/desktop/source/app/makefile.mk
+++ b/desktop/source/app/makefile.mk
@@ -35,11 +35,24 @@ ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
+.INCLUDE : ../deployment/inc/dp_misc.mk
.IF "$(ENABLE_GNOMEVFS)"=="TRUE"
CFLAGS+=-DGNOME_VFS_ENABLED
.ENDIF
+# .IF "$(OS)" == "WNT"
+# .IF "$(COM)" == "GCC"
+# DEPLOYMENTMISCLIB = -ldeploymentmisc$(DLLPOSTFIX)
+# .ELSE
+# DEPLOYMENTMISCLIB = ideploymentmisc$(DLLPOSTFIX).lib
+# .ENDIF
+# .ELIF "$(OS)" == "OS2"
+# DEPLOYMENTMISCLIB = ideploymentmisc$(DLLPOSTFIX).lib
+# .ELSE
+# DEPLOYMENTMISCLIB = -ldeploymentmisc$(DLLPOSTFIX)
+# .ENDIF
+
SHL1TARGET = sofficeapp
SHL1OBJS = \
$(SLO)$/app.obj \
@@ -67,6 +80,7 @@ SHL1STDLIBS = \
$(COMPHELPERLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
+ $(DEPLOYMENTMISCLIB) \
$(I18NISOLANGLIB) \
$(SALLIB) \
$(SFXLIB) \
diff --git a/desktop/source/deployment/dp_services.cxx b/desktop/source/deployment/dp_services.cxx
index 7788e3d745..4e5277ea11 100644
--- a/desktop/source/deployment/dp_services.cxx
+++ b/desktop/source/deployment/dp_services.cxx
@@ -28,7 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_desktop.hxx"
-#define COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS 11
+#define COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS 12
#include "comphelper/servicedecl.hxx"
using namespace com::sun::star;
@@ -69,13 +69,11 @@ namespace factory {
extern sdecl::ServiceDecl const serviceDecl;
bool singleton_entries( uno::Reference<registry::XRegistryKey> const& );
}
-}
-
-namespace dp_log {
extern sdecl::ServiceDecl const serviceDecl;
+bool singleton_entries( uno::Reference<registry::XRegistryKey> const& );
}
-namespace dp_migration {
+namespace dp_log {
extern sdecl::ServiceDecl const serviceDecl;
}
@@ -108,10 +106,11 @@ sal_Bool SAL_CALL component_writeInfo(
dp_registry::backend::executable::serviceDecl,
dp_manager::factory::serviceDecl,
dp_log::serviceDecl,
- dp_migration::serviceDecl,
- dp_info::serviceDecl ) &&
+ dp_info::serviceDecl,
+ dp_manager::serviceDecl) &&
dp_manager::factory::singleton_entries( pRegistryKey ) &&
- dp_info::singleton_entries( pRegistryKey );
+ dp_info::singleton_entries( pRegistryKey ) &&
+ dp_manager::singleton_entries( pRegistryKey);
}
void * SAL_CALL component_getFactory(
@@ -129,8 +128,8 @@ void * SAL_CALL component_getFactory(
dp_registry::backend::executable::serviceDecl,
dp_manager::factory::serviceDecl,
dp_log::serviceDecl,
- dp_migration::serviceDecl,
- dp_info::serviceDecl );
+ dp_info::serviceDecl,
+ dp_manager::serviceDecl);
}
} // extern "C"
diff --git a/desktop/source/deployment/gui/dp_gui.h b/desktop/source/deployment/gui/dp_gui.h
index 57f471b7c3..9d7152b4b5 100644
--- a/desktop/source/deployment/gui/dp_gui.h
+++ b/desktop/source/deployment/gui/dp_gui.h
@@ -79,21 +79,18 @@ enum PackageState { REGISTERED, NOT_REGISTERED, AMBIGUOUS, NOT_AVAILABLE };
class SelectedPackage: public salhelper::SimpleReferenceObject {
public:
SelectedPackage() {}
- SelectedPackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> &xPackage,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> &xPackageManager )
- : m_xPackage( xPackage ),
- m_xPackageManager( xPackageManager )
+ SelectedPackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> &xPackage)
+ : m_xPackage( xPackage )
{}
virtual ~SelectedPackage();
::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> getPackage() const { return m_xPackage; }
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> getPackageManager() const { return m_xPackageManager; }
+
private:
SelectedPackage(SelectedPackage &); // not defined
void operator =(SelectedPackage &); // not defined
::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage;
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager;
};
} // namespace dp_gui
diff --git a/desktop/source/deployment/gui/dp_gui.hrc b/desktop/source/deployment/gui/dp_gui.hrc
index ed3bd6962e..19b2faf129 100644..100755
--- a/desktop/source/deployment/gui/dp_gui.hrc
+++ b/desktop/source/deployment/gui/dp_gui.hrc
@@ -153,6 +153,7 @@
#define RID_STR_REMOVING_PACKAGES (RID_DEPLOYMENT_GUI_START+86)
#define RID_STR_ENABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+87)
#define RID_STR_DISABLING_PACKAGES (RID_DEPLOYMENT_GUI_START+88)
+#define RID_STR_ACCEPT_LICENSE (RID_DEPLOYMENT_GUI_START+89)
#define RID_STR_INSTALL_FOR_ALL (RID_DEPLOYMENT_GUI_START+90)
#define RID_STR_INSTALL_FOR_ME (RID_DEPLOYMENT_GUI_START+91)
@@ -161,6 +162,7 @@
#define RID_STR_EXIT_BTN (RID_DEPLOYMENT_GUI_START+94)
#define RID_STR_NO_ADMIN_PRIVILEGE (RID_DEPLOYMENT_GUI_START+95)
#define RID_STR_ERROR_MISSING_DEPENDENCIES (RID_DEPLOYMENT_GUI_START+96)
+#define RID_STR_ERROR_MISSING_LICENSE (RID_DEPLOYMENT_GUI_START+97)
#define WARNINGBOX_CONCURRENTINSTANCE (RID_DEPLOYMENT_GUI_START+100)
@@ -172,7 +174,6 @@
#define RID_WARNINGBOX_DISABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+106)
#define RID_DLG_LICENSE RID_DEPLOYMENT_LICENSE_START
-#define WARNINGBOX_NOSHAREDALLOWED (RID_DEPLOYMENT_LICENSE_START+1)
diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src
index 0808dbcb2a..db2e09769d 100644..100755
--- a/desktop/source/deployment/gui/dp_gui_dialog.src
+++ b/desktop/source/deployment/gui/dp_gui_dialog.src
@@ -72,6 +72,11 @@ String RID_STR_DISABLING_PACKAGES
Text [ en-US ] = "Disabling %EXTENSION_NAME";
};
+String RID_STR_ACCEPT_LICENSE
+{
+ Text [ en-US ] = "Accept license for %EXTENSION_NAME";
+};
+
String RID_STR_INSTALL_FOR_ALL
{
Text [ en-US ] = "~For all users";
@@ -109,6 +114,11 @@ String RID_STR_ERROR_MISSING_DEPENDENCIES
Text [ en-US ] = "The extension cannot be enabled as the following system dependencies are not fulfilled:";
};
+String RID_STR_ERROR_MISSING_LICENSE
+{
+ Text [ en-US ] = "This extension is disabled because you haven't accepted the license yet.\n";
+};
+
// Dialog layout
// ---------------------------------------------------
// row 1 | multi line edit
@@ -131,7 +141,7 @@ String RID_STR_ERROR_MISSING_DEPENDENCIES
#define ROW1_Y RSC_SP_DLG_INNERBORDER_TOP
#define ROW1_HEIGHT 16*RSC_CD_FIXEDTEXT_HEIGHT
#define ROW2_Y ROW1_Y+ROW1_HEIGHT+RSC_SP_CTRL_GROUP_Y
-#define ROW2_HEIGHT 2*RSC_CD_FIXEDTEXT_HEIGHT
+#define ROW2_HEIGHT 3*RSC_CD_FIXEDTEXT_HEIGHT
#define ROW3_Y ROW2_Y+ROW2_HEIGHT+RSC_SP_CTRL_GROUP_Y
#define ROW3_HEIGHT 3*RSC_CD_FIXEDTEXT_HEIGHT
#define ROW4_Y ROW3_Y+ROW3_HEIGHT+RSC_SP_CTRL_GROUP_Y
@@ -282,14 +292,6 @@ ModalDialog RID_DLG_LICENSE
-WarningBox WARNINGBOX_NOSHAREDALLOWED
-{
- Buttons = WB_OK ;
- DefButton = WB_DEF_OK;
- Message[ en-US ] ="The extension \'%NAME\' cannot be installed under \"%PRODUCTNAME Extensions\", because "
- "every user has to agree to the license agreement of the extension. The extension will not be installed.";
-};
-
WarningBox RID_WARNINGBOX_INSTALL_EXTENSION {
Buttons = WB_OK_CANCEL;
DefButton = WB_DEF_OK;
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index df105adb4d..919ddb4346 100644..100755
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -37,7 +37,10 @@
#include "dp_gui_extlistbox.hxx"
#include "dp_gui_shared.hxx"
#include "dp_gui_theextmgr.hxx"
+#include "dp_gui_extensioncmdqueue.hxx"
#include "dp_misc.h"
+#include "dp_update.hxx"
+#include "dp_identifier.hxx"
#include "vcl/ctrl.hxx"
#include "vcl/menu.hxx"
@@ -74,8 +77,6 @@
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
-#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
-
#include <map>
#include <vector>
#include <boost/shared_ptr.hpp>
@@ -108,17 +109,6 @@ struct StrAllFiles : public rtl::StaticWithInit< const OUString, StrAllFiles >
};
//------------------------------------------------------------------------------
-UpdateListEntry::UpdateListEntry( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager ) :
- m_xPackage( xPackage ),
- m_xPackageManager( xPackageManager )
-{}
-
-//------------------------------------------------------------------------------
-UpdateListEntry::~UpdateListEntry()
-{}
-
-//------------------------------------------------------------------------------
// ExtBoxWithBtns_Impl
//------------------------------------------------------------------------------
@@ -279,6 +269,9 @@ void ExtBoxWithBtns_Impl::SetButtonPos( const Rectangle& rRect )
// -----------------------------------------------------------------------
void ExtBoxWithBtns_Impl::SetButtonStatus( const TEntry_Impl pEntry )
{
+ bool bShowOptionBtn = true;
+
+ pEntry->m_bHasButtons = false;
if ( ( pEntry->m_eState == REGISTERED ) || ( pEntry->m_eState == NOT_AVAILABLE ) )
{
m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
@@ -288,26 +281,36 @@ void ExtBoxWithBtns_Impl::SetButtonStatus( const TEntry_Impl pEntry )
{
m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_ENABLE );
+ bShowOptionBtn = false;
}
- if ( ( pEntry->m_eState == NOT_AVAILABLE ) || pEntry->m_bMissingDeps )
+ if ( ( !pEntry->m_bUser || ( pEntry->m_eState == NOT_AVAILABLE ) || pEntry->m_bMissingDeps )
+ && !pEntry->m_bMissingLic )
m_pEnableBtn->Hide();
else
{
m_pEnableBtn->Enable( !pEntry->m_bLocked );
m_pEnableBtn->Show();
+ pEntry->m_bHasButtons = true;
}
- if ( pEntry->m_bHasOptions )
+ if ( pEntry->m_bHasOptions && bShowOptionBtn )
{
m_pOptionsBtn->Enable( pEntry->m_bHasOptions );
m_pOptionsBtn->Show();
+ pEntry->m_bHasButtons = true;
}
else
m_pOptionsBtn->Hide();
- m_pRemoveBtn->Show();
- m_pRemoveBtn->Enable( !pEntry->m_bLocked );
+ if ( pEntry->m_bUser || pEntry->m_bShared )
+ {
+ m_pRemoveBtn->Enable( !pEntry->m_bLocked );
+ m_pRemoveBtn->Show();
+ pEntry->m_bHasButtons = true;
+ }
+ else
+ m_pRemoveBtn->Hide();
}
// -----------------------------------------------------------------------
@@ -394,17 +397,13 @@ void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt )
switch( ShowPopupMenu( aMousePos, nPos ) )
{
case CMD_NONE: break;
- case CMD_ENABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackageManager,
- GetEntryData( nPos )->m_xPackage, true );
+ case CMD_ENABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackage, true );
break;
- case CMD_DISABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackageManager,
- GetEntryData( nPos )->m_xPackage, false );
+ case CMD_DISABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackage, false );
break;
- case CMD_UPDATE: m_pParent->updatePackage( GetEntryData( nPos )->m_xPackageManager,
- GetEntryData( nPos )->m_xPackage );
+ case CMD_UPDATE: m_pParent->updatePackage( GetEntryData( nPos )->m_xPackage );
break;
- case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackageManager,
- GetEntryData( nPos )->m_xPackage );
+ case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackage );
break;
}
}
@@ -506,11 +505,14 @@ IMPL_LINK( ExtBoxWithBtns_Impl, HandleEnableBtn, void*, EMPTYARG )
if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
{
TEntry_Impl pEntry = GetEntryData( nActive );
- const bool bEnable( pEntry->m_eState != REGISTERED );
- m_pParent->enablePackage( pEntry->m_xPackageManager,
- pEntry->m_xPackage,
- bEnable );
+ if ( pEntry->m_bMissingLic )
+ m_pParent->acceptLicense( pEntry->m_xPackage );
+ else
+ {
+ const bool bEnable( pEntry->m_eState != REGISTERED );
+ m_pParent->enablePackage( pEntry->m_xPackage, bEnable );
+ }
}
return 1;
@@ -524,8 +526,7 @@ IMPL_LINK( ExtBoxWithBtns_Impl, HandleRemoveBtn, void*, EMPTYARG )
if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
{
TEntry_Impl pEntry = GetEntryData( nActive );
- m_pParent->removePackage( pEntry->m_xPackageManager,
- pEntry->m_xPackage );
+ m_pParent->removePackage( pEntry->m_xPackage );
}
return 1;
@@ -571,21 +572,21 @@ String DialogHelper::getResourceString( USHORT id )
}
//------------------------------------------------------------------------------
-bool DialogHelper::IsSharedPkgMgr( const uno::Reference< deployment::XPackageManager > &xPackageManager )
+bool DialogHelper::IsSharedPkgMgr( const uno::Reference< deployment::XPackage > &xPackage )
{
- if ( xPackageManager->getContext().equals( OUSTR("shared") ) )
+ if ( xPackage->getRepositoryName().equals( OUSTR("shared") ) )
return true;
else
return false;
}
//------------------------------------------------------------------------------
-bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::XPackageManager > &xPackageManager,
+bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::XPackage > &xPackage,
Window *pParent,
const USHORT nResID,
bool &bHadWarning )
{
- if ( !bHadWarning && IsSharedPkgMgr( xPackageManager ) )
+ if ( !bHadWarning && IsSharedPkgMgr( xPackage ) )
{
const ::vos::OGuard guard( Application::GetSolarMutex() );
WarningBox aInfoBox( pParent, getResId( nResID ) );
@@ -759,17 +760,16 @@ void ExtMgrDialog::setGetExtensionsURL( const ::rtl::OUString &rURL )
//------------------------------------------------------------------------------
long ExtMgrDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager )
+ bool bLicenseMissing )
{
m_aUpdateBtn.Enable( true );
- return m_pExtensionBox->addEntry( xPackage, xPackageManager );
+ return m_pExtensionBox->addEntry( xPackage, bLicenseMissing );
}
//------------------------------------------------------------------------------
-void ExtMgrDialog::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageManager )
+void ExtMgrDialog::prepareChecking()
{
- if ( xPackageManager.is() )
- m_pExtensionBox->prepareChecking( xPackageManager );
+ m_pExtensionBox->prepareChecking();
}
//------------------------------------------------------------------------------
@@ -793,68 +793,82 @@ bool ExtMgrDialog::removeExtensionWarn( const OUString &rExtensionName ) const
}
//------------------------------------------------------------------------------
-bool ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackageManager > &xPackageManager,
- const uno::Reference< deployment::XPackage > &xPackage,
+bool ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackage > &xPackage,
bool bEnable )
{
- if ( !xPackageManager.is() || !xPackage.is() )
+ if ( !xPackage.is() )
return false;
if ( bEnable )
{
- if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_ENABLE_SHARED_EXTENSION, m_bEnableWarning ) )
+ if ( ! continueOnSharedExtension( xPackage, this, RID_WARNINGBOX_ENABLE_SHARED_EXTENSION, m_bEnableWarning ) )
return false;
}
else
{
- if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_DISABLE_SHARED_EXTENSION, m_bDisableWarning ) )
+ if ( ! continueOnSharedExtension( xPackage, this, RID_WARNINGBOX_DISABLE_SHARED_EXTENSION, m_bDisableWarning ) )
return false;
}
- m_pManager->enablePackage( xPackage, bEnable );
+ m_pManager->getCmdQueue()->enableExtension( xPackage, bEnable );
return true;
}
//------------------------------------------------------------------------------
-bool ExtMgrDialog::removePackage( const uno::Reference< deployment::XPackageManager > &xPackageManager,
- const uno::Reference< deployment::XPackage > &xPackage )
+bool ExtMgrDialog::removePackage( const uno::Reference< deployment::XPackage > &xPackage )
{
- if ( !xPackageManager.is() || !xPackage.is() )
+ if ( !xPackage.is() )
return false;
- if ( !IsSharedPkgMgr( xPackageManager ) || m_bDeleteWarning )
+ if ( !IsSharedPkgMgr( xPackage ) || m_bDeleteWarning )
{
if ( ! removeExtensionWarn( xPackage->getDisplayName() ) )
return false;
}
- if ( ! continueOnSharedExtension( xPackageManager, this, RID_WARNINGBOX_REMOVE_SHARED_EXTENSION, m_bDeleteWarning ) )
+ if ( ! continueOnSharedExtension( xPackage, this, RID_WARNINGBOX_REMOVE_SHARED_EXTENSION, m_bDeleteWarning ) )
return false;
- m_pManager->removePackage( xPackageManager, xPackage );
+ m_pManager->getCmdQueue()->removeExtension( xPackage );
return true;
}
//------------------------------------------------------------------------------
-bool ExtMgrDialog::updatePackage( const uno::Reference< deployment::XPackageManager > &xPackageManager,
- const uno::Reference< deployment::XPackage > &xPackage )
+bool ExtMgrDialog::updatePackage( const uno::Reference< deployment::XPackage > &xPackage )
{
- if ( !xPackageManager.is() || !xPackage.is() )
+ if ( !xPackage.is() )
return false;
- std::vector< TUpdateListEntry > vEntries;
- TUpdateListEntry pEntry( new UpdateListEntry( xPackage, xPackageManager ) );
- vEntries.push_back( pEntry );
+ // get the extension with highest version
+ uno::Sequence<uno::Reference<deployment::XPackage> > seqExtensions =
+ m_pManager->getExtensionManager()->getExtensionsWithSameIdentifier(
+ dp_misc::getIdentifier(xPackage), xPackage->getName(), uno::Reference<ucb::XCommandEnvironment>());
+ uno::Reference<deployment::XPackage> extension =
+ dp_misc::getExtensionWithHighestVersion(seqExtensions);
+ OSL_ASSERT(extension.is());
+ std::vector< css::uno::Reference< css::deployment::XPackage > > vEntries;
+ vEntries.push_back(extension);
- m_pManager->updatePackages( vEntries );
+ m_pManager->getCmdQueue()->checkForUpdates( vEntries );
return true;
}
//------------------------------------------------------------------------------
-uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker( const uno::Reference< deployment::XPackageManager > &xPackageManager )
+bool ExtMgrDialog::acceptLicense( const uno::Reference< deployment::XPackage > &xPackage )
+{
+ if ( !xPackage.is() )
+ return false;
+
+ m_pManager->getCmdQueue()->acceptLicense( xPackage );
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
{
const uno::Any mode( static_cast< sal_Int16 >( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE ) );
const uno::Reference< uno::XComponentContext > xContext( m_pManager->getContext() );
@@ -872,7 +886,8 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker( const uno::Reference< de
t_string2string title2filter;
OUString sDefaultFilter( StrAllFiles::get() );
- const uno::Sequence< uno::Reference< deployment::XPackageTypeInfo > > packageTypes( xPackageManager->getSupportedPackageTypes() );
+ const uno::Sequence< uno::Reference< deployment::XPackageTypeInfo > > packageTypes(
+ m_pManager->getExtensionManager()->getSupportedPackageTypes() );
for ( sal_Int32 pos = 0; pos < packageTypes.getLength(); ++pos )
{
@@ -1026,8 +1041,7 @@ IMPL_LINK( ExtMgrDialog, HandleAddBtn, void*, EMPTYARG )
{
setBusy( true );
- uno::Reference< deployment::XPackageManager > xUserPkgMgr = m_pManager->getUserPkgMgr();
- uno::Sequence< OUString > aFileList = raiseAddPicker( xUserPkgMgr );
+ uno::Sequence< OUString > aFileList = raiseAddPicker();
if ( aFileList.getLength() )
{
@@ -1298,23 +1312,22 @@ UpdateRequiredDialog::~UpdateRequiredDialog()
//------------------------------------------------------------------------------
long UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager )
+ bool bLicenseMissing )
{
// We will only add entries to the list with unsatisfied dependencies
- if ( !checkDependencies( xPackage ) )
+ if ( !bLicenseMissing && !checkDependencies( xPackage ) )
{
- m_bHasLockedEntries |= (bool) xPackageManager->isReadOnly();
+ m_bHasLockedEntries |= m_pManager->isReadOnly( xPackage );
m_aUpdateBtn.Enable( true );
- return m_pExtensionBox->addEntry( xPackage, xPackageManager );
+ return m_pExtensionBox->addEntry( xPackage );
}
return 0;
}
//------------------------------------------------------------------------------
-void UpdateRequiredDialog::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageManager )
+void UpdateRequiredDialog::prepareChecking()
{
- if ( xPackageManager.is() )
- m_pExtensionBox->prepareChecking( xPackageManager );
+ m_pExtensionBox->prepareChecking();
}
//------------------------------------------------------------------------------
@@ -1331,11 +1344,10 @@ void UpdateRequiredDialog::checkEntries()
}
//------------------------------------------------------------------------------
-bool UpdateRequiredDialog::enablePackage( const uno::Reference< deployment::XPackageManager > &,
- const uno::Reference< deployment::XPackage > &xPackage,
- bool bEnable )
+bool UpdateRequiredDialog::enablePackage( const uno::Reference< deployment::XPackage > &xPackage,
+ bool bEnable )
{
- m_pManager->enablePackage( xPackage, bEnable );
+ m_pManager->getCmdQueue()->enableExtension( xPackage, bEnable );
return true;
}
@@ -1451,20 +1463,18 @@ IMPL_LINK( UpdateRequiredDialog, HandleUpdateBtn, void*, EMPTYARG )
{
::osl::ClearableMutexGuard aGuard( m_aMutex );
- std::vector< TUpdateListEntry > vUpdateEntries;
+ std::vector< uno::Reference< deployment::XPackage > > vUpdateEntries;
sal_Int32 nCount = m_pExtensionBox->GetEntryCount();
for ( sal_Int32 i = 0; i < nCount; ++i )
{
TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( i );
- TUpdateListEntry pUpdateEntry( new UpdateListEntry( pEntry->m_xPackage,
- pEntry->m_xPackageManager ) );
- vUpdateEntries.push_back( pUpdateEntry );
+ vUpdateEntries.push_back( pEntry->m_xPackage );
}
aGuard.clear();
- m_pManager->updatePackages( vUpdateEntries );
+ m_pManager->getCmdQueue()->checkForUpdates( vUpdateEntries );
return 1;
}
@@ -1719,7 +1729,7 @@ void UpdateRequiredDialog::disableAllEntries()
for ( long nIndex = 0; nIndex < nCount; nIndex++ )
{
TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nIndex );
- enablePackage( pEntry->m_xPackageManager, pEntry->m_xPackage, false );
+ enablePackage( pEntry->m_xPackage, false );
}
setBusy( false );
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
index 91bfc072e7..b188586e6d 100644..100755
--- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
@@ -46,7 +46,6 @@
#include "com/sun/star/awt/XWindow.hpp"
#include "com/sun/star/deployment/XPackage.hpp"
-#include "com/sun/star/deployment/XPackageManager.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp"
#include "com/sun/star/util/XModifyListener.hpp"
@@ -82,16 +81,16 @@ public:
virtual void updateProgress( const long nProgress ) = 0;
virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) = 0;
- virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & ) = 0;
+ virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ bool bLicenseMissing = false ) = 0;
- virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ) = 0;
+ virtual void prepareChecking() = 0;
virtual void checkEntries() = 0;
static ResId getResId( USHORT nId );
static String getResourceString( USHORT id );
- static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &);
- static bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &,
+ static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &);
+ static bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
Window *pParent,
const USHORT nResID,
bool &bHadWarning );
@@ -160,19 +159,17 @@ public:
void setGetExtensionsURL( const ::rtl::OUString &rURL );
virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & );
- bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
+ bool bLicenseMissing = false );
+ bool enablePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
bool bEnable );
- bool removePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+ bool removePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+ bool updatePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+ bool acceptLicense(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ virtual void prepareChecking();
virtual void checkEntries();
- ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker();
};
//==============================================================================
@@ -235,17 +232,14 @@ public:
void selectEntry( long nPos );
virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & );
- bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
- bool bEnable );
- bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
+ bool bLicenseMissing = false );
+ bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, bool bEnable );
+ bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- virtual void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ virtual void prepareChecking();
virtual void checkEntries();
- ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker();
bool installForAllUsers( bool &bInstallForAll ) const;
bool installExtensionWarn( const ::rtl::OUString &rExtensionURL ) const;
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index 2f3ca34cb6..ea983c5a7f 100644..100755
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -36,10 +36,10 @@
#include <cstddef>
#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/beans/NamedValue.hpp"
#include "com/sun/star/deployment/DependencyException.hpp"
#include "com/sun/star/deployment/LicenseException.hpp"
-#include "com/sun/star/deployment/LicenseIndividualAgreementException.hpp"
#include "com/sun/star/deployment/VersionException.hpp"
#include "com/sun/star/deployment/InstallException.hpp"
#include "com/sun/star/deployment/PlatformException.hpp"
@@ -48,7 +48,6 @@
#include "com/sun/star/deployment/DeploymentException.hpp"
#include "com/sun/star/deployment/UpdateInformationProvider.hpp"
#include "com/sun/star/deployment/XPackage.hpp"
-#include "com/sun/star/deployment/XPackageManager.hpp"
#include "com/sun/star/task/XAbortChannel.hpp"
#include "com/sun/star/task/XInteractionAbort.hpp"
@@ -77,6 +76,7 @@
#include "comphelper/anytostring.hxx"
#include "vcl/msgbox.hxx"
#include "toolkit/helper/vclunohelper.hxx"
+#include "comphelper/processfactory.hxx"
#include "dp_gui.h"
#include "dp_gui_thread.hxx"
@@ -110,12 +110,15 @@ using ::rtl::OUString;
namespace {
-OUString getVersion( const uno::Reference< deployment::XPackage > &rPackage )
+OUString getVersion( OUString const & sVersion )
{
- OUString sVersion( rPackage->getVersion());
return ( sVersion.getLength() == 0 ) ? OUString( RTL_CONSTASCII_USTRINGPARAM( "0" ) ) : sVersion;
}
+OUString getVersion( const uno::Reference< deployment::XPackage > &rPackage )
+{
+ return getVersion( rPackage->getVersion());
+}
}
@@ -193,37 +196,30 @@ public:
//------------------------------------------------------------------------------
struct ExtensionCmd
{
- enum E_CMD_TYPE { ADD, ENABLE, DISABLE, REMOVE, CHECK_FOR_UPDATES };
+ enum E_CMD_TYPE { ADD, ENABLE, DISABLE, REMOVE, CHECK_FOR_UPDATES, ACCEPT_LICENSE };
E_CMD_TYPE m_eCmdType;
bool m_bWarnUser;
OUString m_sExtensionURL;
- uno::Reference< deployment::XPackageManager > m_xPackageManager;
- uno::Reference< deployment::XPackage > m_xPackage;
- std::vector< TUpdateListEntry > m_vExtensionList;
+ OUString m_sRepository;
+ uno::Reference< deployment::XPackage > m_xPackage;
+ std::vector< uno::Reference< deployment::XPackage > > m_vExtensionList;
ExtensionCmd( const E_CMD_TYPE eCommand,
- const uno::Reference< deployment::XPackageManager > &rPackageManager,
const OUString &rExtensionURL,
+ const OUString &rRepository,
const bool bWarnUser )
: m_eCmdType( eCommand ),
m_bWarnUser( bWarnUser ),
m_sExtensionURL( rExtensionURL ),
- m_xPackageManager( rPackageManager ) {};
+ m_sRepository( rRepository ) {};
ExtensionCmd( const E_CMD_TYPE eCommand,
- const uno::Reference< deployment::XPackageManager > &rPackageManager,
const uno::Reference< deployment::XPackage > &rPackage )
: m_eCmdType( eCommand ),
m_bWarnUser( false ),
- m_xPackageManager( rPackageManager ),
m_xPackage( rPackage ) {};
ExtensionCmd( const E_CMD_TYPE eCommand,
- const uno::Reference< deployment::XPackage > &rPackage )
- : m_eCmdType( eCommand ),
- m_bWarnUser( false ),
- m_xPackage( rPackage ) {};
- ExtensionCmd( const E_CMD_TYPE eCommand,
- const std::vector< TUpdateListEntry > &vExtensionList )
+ const std::vector<uno::Reference<deployment::XPackage > > &vExtensionList )
: m_eCmdType( eCommand ),
m_bWarnUser( false ),
m_vExtensionList( vExtensionList ) {};
@@ -239,14 +235,14 @@ public:
TheExtensionManager *pManager,
const uno::Reference< uno::XComponentContext > & rContext );
- void addExtension( const uno::Reference< deployment::XPackageManager > &rPackageManager,
- const OUString &rExtensionURL,
+ void addExtension( const OUString &rExtensionURL,
+ const OUString &rRepository,
const bool bWarnUser );
- void removeExtension( const uno::Reference< deployment::XPackageManager > &rPackageManager,
- const uno::Reference< deployment::XPackage > &rPackage );
+ void removeExtension( const uno::Reference< deployment::XPackage > &rPackage );
void enableExtension( const uno::Reference< deployment::XPackage > &rPackage,
const bool bEnable );
- void checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList );
+ void checkForUpdates( const std::vector<uno::Reference<deployment::XPackage > > &vExtensionList );
+ void acceptLicense( const uno::Reference< deployment::XPackage > &rPackage );
void stop();
bool isBusy();
@@ -263,17 +259,18 @@ private:
virtual void SAL_CALL onTerminated();
void _addExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
const OUString &rPackageURL,
+ const OUString &rRepository,
const bool bWarnUser );
void _removeExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
const uno::Reference< deployment::XPackage > &xPackage );
void _enableExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv,
const uno::Reference< deployment::XPackage > &xPackage );
void _disableExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv,
const uno::Reference< deployment::XPackage > &xPackage );
- void _checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList );
+ void _checkForUpdates( const std::vector<uno::Reference<deployment::XPackage > > &vExtensionList );
+ void _acceptLicense( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv,
+ const uno::Reference< deployment::XPackage > &xPackage );
enum Input { NONE, START, STOP };
@@ -288,6 +285,7 @@ private:
const OUString m_sAddingPackages;
const OUString m_sRemovingPackages;
const OUString m_sDefaultCmd;
+ const OUString m_sAcceptLicense;
osl::Condition m_wakeup;
osl::Mutex m_mutex;
Input m_eInput;
@@ -376,7 +374,6 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
lang::WrappedTargetException wtExc;
deployment::DependencyException depExc;
deployment::LicenseException licExc;
- deployment::LicenseIndividualAgreementException licAgreementExc;
deployment::VersionException verExc;
deployment::InstallException instExc;
deployment::PlatformException platExc;
@@ -438,23 +435,12 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
|| (n == RET_CANCEL && !Application::IsDialogCancelEnabled());
}
}
- else if (request >>= licAgreementExc)
- {
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ResId warnId(WARNINGBOX_NOSHAREDALLOWED, *DeploymentGuiResMgr::get());
- WarningBox warn( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, warnId);
- String msgText = warn.GetMessText();
- msgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
- msgText.SearchAndReplaceAllAscii("%NAME", licAgreementExc.ExtensionName);
- warn.SetMessText(msgText);
- warn.Execute();
- abort = true;
- }
else if (request >>= licExc)
{
uno::Reference< ui::dialogs::XExecutableDialog > xDialog(
deployment::ui::LicenseDialog::create(
- m_xContext, VCLUnoHelper::GetInterface( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL ), licExc.Text ) );
+ m_xContext, VCLUnoHelper::GetInterface( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL ),
+ licExc.ExtensionName, licExc.Text ) );
sal_Int16 res = xDialog->execute();
if ( res == ui::dialogs::ExecutableDialogResults::CANCEL )
abort = true;
@@ -468,7 +454,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
else if (request >>= verExc)
{
sal_uInt32 id;
- switch (dp_misc::comparePackageVersions( verExc.New, verExc.Deployed ))
+ switch (dp_misc::compareVersions(
+ verExc.NewVersion, verExc.Deployed->getVersion() ))
{
case dp_misc::LESS:
id = RID_WARNINGBOX_VERSION_LESS;
@@ -480,8 +467,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
id = RID_WARNINGBOX_VERSION_GREATER;
break;
}
- OSL_ASSERT( verExc.New.is() && verExc.Deployed.is() );
- bool bEqualNames = verExc.New->getDisplayName().equals(
+ OSL_ASSERT( verExc.Deployed.is() );
+ bool bEqualNames = verExc.NewDisplayName.equals(
verExc.Deployed->getDisplayName());
{
vos::OGuard guard(Application::GetSolarMutex());
@@ -506,9 +493,9 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
{
s = String(ResId(RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES, *DeploymentGuiResMgr::get()));
}
- s.SearchAndReplaceAllAscii( "$NAME", verExc.New->getDisplayName());
+ s.SearchAndReplaceAllAscii( "$NAME", verExc.NewDisplayName);
s.SearchAndReplaceAllAscii( "$OLDNAME", verExc.Deployed->getDisplayName());
- s.SearchAndReplaceAllAscii( "$NEW", getVersion(verExc.New) );
+ s.SearchAndReplaceAllAscii( "$NEW", getVersion(verExc.NewVersion) );
s.SearchAndReplaceAllAscii( "$DEPLOYED", getVersion(verExc.Deployed) );
box.SetMessText(s);
approve = box.Execute() == RET_OK;
@@ -527,7 +514,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
{
vos::OGuard guard(Application::GetSolarMutex());
- approve = m_pDialogHelper->installExtensionWarn( instExc.New->getDisplayName() );
+ approve = m_pDialogHelper->installExtensionWarn( instExc.displayName );
}
else
approve = false;
@@ -644,6 +631,7 @@ ExtensionCmdQueue::Thread::Thread( DialogHelper *pDialogHelper,
m_sAddingPackages( DialogHelper::getResourceString( RID_STR_ADDING_PACKAGES ) ),
m_sRemovingPackages( DialogHelper::getResourceString( RID_STR_REMOVING_PACKAGES ) ),
m_sDefaultCmd( DialogHelper::getResourceString( RID_STR_ADD_PACKAGES ) ),
+ m_sAcceptLicense( DialogHelper::getResourceString( RID_STR_ACCEPT_LICENSE ) ),
m_eInput( NONE ),
m_bTerminated( false ),
m_bStopped( false ),
@@ -653,8 +641,8 @@ ExtensionCmdQueue::Thread::Thread( DialogHelper *pDialogHelper,
}
//------------------------------------------------------------------------------
-void ExtensionCmdQueue::Thread::addExtension( const uno::Reference< deployment::XPackageManager > &rPackageManager,
- const ::rtl::OUString &rExtensionURL,
+void ExtensionCmdQueue::Thread::addExtension( const ::rtl::OUString &rExtensionURL,
+ const ::rtl::OUString &rRepository,
const bool bWarnUser )
{
::osl::MutexGuard aGuard( m_mutex );
@@ -665,7 +653,7 @@ void ExtensionCmdQueue::Thread::addExtension( const uno::Reference< deployment::
if ( rExtensionURL.getLength() )
{
- TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::ADD, rPackageManager, rExtensionURL, bWarnUser ) );
+ TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::ADD, rExtensionURL, rRepository, bWarnUser ) );
m_queue.push( pEntry );
m_eInput = START;
@@ -674,8 +662,7 @@ void ExtensionCmdQueue::Thread::addExtension( const uno::Reference< deployment::
}
//------------------------------------------------------------------------------
-void ExtensionCmdQueue::Thread::removeExtension( const uno::Reference< deployment::XPackageManager > &rPackageManager,
- const uno::Reference< deployment::XPackage > &rPackage )
+void ExtensionCmdQueue::Thread::removeExtension( const uno::Reference< deployment::XPackage > &rPackage )
{
::osl::MutexGuard aGuard( m_mutex );
@@ -683,9 +670,28 @@ void ExtensionCmdQueue::Thread::removeExtension( const uno::Reference< deploymen
if ( m_bStopped )
return;
- if ( rPackageManager.is() && rPackage.is() )
+ if ( rPackage.is() )
+ {
+ TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::REMOVE, rPackage ) );
+
+ m_queue.push( pEntry );
+ m_eInput = START;
+ m_wakeup.set();
+ }
+}
+
+//------------------------------------------------------------------------------
+void ExtensionCmdQueue::Thread::acceptLicense( const uno::Reference< deployment::XPackage > &rPackage )
+{
+ ::osl::MutexGuard aGuard( m_mutex );
+
+ //If someone called stop then we do not remove the extension -> game over!
+ if ( m_bStopped )
+ return;
+
+ if ( rPackage.is() )
{
- TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::REMOVE, rPackageManager, rPackage ) );
+ TExtensionCmd pEntry( new ExtensionCmd( ExtensionCmd::ACCEPT_LICENSE, rPackage ) );
m_queue.push( pEntry );
m_eInput = START;
@@ -715,7 +721,8 @@ void ExtensionCmdQueue::Thread::enableExtension( const uno::Reference< deploymen
}
//------------------------------------------------------------------------------
-void ExtensionCmdQueue::Thread::checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList )
+void ExtensionCmdQueue::Thread::checkForUpdates(
+ const std::vector<uno::Reference<deployment::XPackage > > &vExtensionList )
{
::osl::MutexGuard aGuard( m_mutex );
@@ -819,10 +826,10 @@ void ExtensionCmdQueue::Thread::execute()
switch ( pEntry->m_eCmdType ) {
case ExtensionCmd::ADD :
- _addExtension( currentCmdEnv, pEntry->m_xPackageManager, pEntry->m_sExtensionURL, pEntry->m_bWarnUser );
+ _addExtension( currentCmdEnv, pEntry->m_sExtensionURL, pEntry->m_sRepository, pEntry->m_bWarnUser );
break;
case ExtensionCmd::REMOVE :
- _removeExtension( currentCmdEnv, pEntry->m_xPackageManager, pEntry->m_xPackage );
+ _removeExtension( currentCmdEnv, pEntry->m_xPackage );
break;
case ExtensionCmd::ENABLE :
_enableExtension( currentCmdEnv, pEntry->m_xPackage );
@@ -833,6 +840,9 @@ void ExtensionCmdQueue::Thread::execute()
case ExtensionCmd::CHECK_FOR_UPDATES :
_checkForUpdates( pEntry->m_vExtensionList );
break;
+ case ExtensionCmd::ACCEPT_LICENSE :
+ _acceptLicense( currentCmdEnv, pEntry->m_xPackage );
+ break;
}
}
//catch ( deployment::DeploymentException &)
@@ -912,8 +922,8 @@ void ExtensionCmdQueue::Thread::execute()
//------------------------------------------------------------------------------
void ExtensionCmdQueue::Thread::_addExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
const OUString &rPackageURL,
+ const OUString &rRepository,
const bool bWarnUser )
{
//check if we have a string in anyTitle. For example "unopkg gui \" caused anyTitle to be void
@@ -936,17 +946,16 @@ void ExtensionCmdQueue::Thread::_addExtension( ::rtl::Reference< ProgressCmdEnv
}
rCmdEnv->setWarnUser( bWarnUser );
- uno::Reference< task::XAbortChannel > xAbortChannel( xPackageManager->createAbortChannel() );
+ uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager();
+ uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() );
OUString sTitle = searchAndReplaceAll( m_sAddingPackages, OUSTR("%EXTENSION_NAME"), sName );
rCmdEnv->progressSection( sTitle, xAbortChannel );
try
{
- uno::Reference< deployment::XPackage > xPackage( xPackageManager->addPackage(
- rPackageURL, OUString() /* detect media-type */,
- xAbortChannel, rCmdEnv.get() ) );
- OSL_ASSERT( xPackage.is() );
- }
+ xExtMgr->addExtension(rPackageURL, uno::Sequence<beans::NamedValue>(),
+ rRepository, xAbortChannel, rCmdEnv.get() );
+ }
catch ( ucb::CommandFailedException & )
{
// When the extension is already installed we'll get a dialog asking if we want to overwrite. If we then press
@@ -962,18 +971,22 @@ void ExtensionCmdQueue::Thread::_addExtension( ::rtl::Reference< ProgressCmdEnv
//------------------------------------------------------------------------------
void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
const uno::Reference< deployment::XPackage > &xPackage )
{
- uno::Reference< task::XAbortChannel > xAbortChannel( xPackageManager->createAbortChannel() );
+ uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager();
+ uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() );
OUString sTitle = searchAndReplaceAll( m_sRemovingPackages, OUSTR("%EXTENSION_NAME"), xPackage->getDisplayName() );
rCmdEnv->progressSection( sTitle, xAbortChannel );
OUString id( dp_misc::getIdentifier( xPackage ) );
try
{
- xPackageManager->removePackage( id, xPackage->getName(), xAbortChannel, rCmdEnv.get() );
+ xExtMgr->removeExtension( id, xPackage->getName(), xPackage->getRepositoryName(), xAbortChannel, rCmdEnv.get() );
}
+ catch ( deployment::DeploymentException & )
+ {}
+ catch ( ucb::CommandFailedException & )
+ {}
catch ( ucb::CommandAbortedException & )
{}
@@ -983,7 +996,8 @@ void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdE
}
//------------------------------------------------------------------------------
-void ExtensionCmdQueue::Thread::_checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList )
+void ExtensionCmdQueue::Thread::_checkForUpdates(
+ const std::vector<uno::Reference<deployment::XPackage > > &vExtensionList )
{
UpdateDialog* pUpdateDialog;
std::vector< UpdateData > vData;
@@ -1042,13 +1056,14 @@ void ExtensionCmdQueue::Thread::_enableExtension( ::rtl::Reference< ProgressCmdE
if ( !xPackage.is() )
return;
- uno::Reference< task::XAbortChannel > xAbortChannel( xPackage->createAbortChannel() );
+ uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager();
+ uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() );
OUString sTitle = searchAndReplaceAll( m_sEnablingPackages, OUSTR("%EXTENSION_NAME"), xPackage->getDisplayName() );
rCmdEnv->progressSection( sTitle, xAbortChannel );
try
{
- xPackage->registerPackage( xAbortChannel, rCmdEnv.get() );
+ xExtMgr->enableExtension( xPackage, xAbortChannel, rCmdEnv.get() );
if ( m_pDialogHelper )
m_pDialogHelper->updatePackageInfo( xPackage );
}
@@ -1063,13 +1078,36 @@ void ExtensionCmdQueue::Thread::_disableExtension( ::rtl::Reference< ProgressCmd
if ( !xPackage.is() )
return;
- uno::Reference< task::XAbortChannel > xAbortChannel( xPackage->createAbortChannel() );
+ uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager();
+ uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() );
OUString sTitle = searchAndReplaceAll( m_sDisablingPackages, OUSTR("%EXTENSION_NAME"), xPackage->getDisplayName() );
rCmdEnv->progressSection( sTitle, xAbortChannel );
try
{
- xPackage->revokePackage( xAbortChannel, rCmdEnv.get() );
+ xExtMgr->disableExtension( xPackage, xAbortChannel, rCmdEnv.get() );
+ if ( m_pDialogHelper )
+ m_pDialogHelper->updatePackageInfo( xPackage );
+ }
+ catch ( ::ucb::CommandAbortedException & )
+ {}
+}
+
+//------------------------------------------------------------------------------
+void ExtensionCmdQueue::Thread::_acceptLicense( ::rtl::Reference< ProgressCmdEnv > &rCmdEnv,
+ const uno::Reference< deployment::XPackage > &xPackage )
+{
+ if ( !xPackage.is() )
+ return;
+
+ uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager();
+ uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() );
+ OUString sTitle = searchAndReplaceAll( m_sAcceptLicense, OUSTR("%EXTENSION_NAME"), xPackage->getDisplayName() );
+ rCmdEnv->progressSection( sTitle, xAbortChannel );
+
+ try
+ {
+ xExtMgr->checkPrerequisitesAndEnable( xPackage, xAbortChannel, rCmdEnv.get() );
if ( m_pDialogHelper )
m_pDialogHelper->updatePackageInfo( xPackage );
}
@@ -1120,17 +1158,16 @@ ExtensionCmdQueue::~ExtensionCmdQueue() {
stop();
}
-void ExtensionCmdQueue::addExtension( const uno::Reference< deployment::XPackageManager > &rPackageManager,
- const ::rtl::OUString & extensionURL,
+void ExtensionCmdQueue::addExtension( const ::rtl::OUString & extensionURL,
+ const ::rtl::OUString & repository,
const bool bWarnUser )
{
- m_thread->addExtension( rPackageManager, extensionURL, bWarnUser );
+ m_thread->addExtension( extensionURL, repository, bWarnUser );
}
-void ExtensionCmdQueue::removeExtension( const uno::Reference< deployment::XPackageManager > &rPackageManager,
- const uno::Reference< deployment::XPackage > &rPackage )
+void ExtensionCmdQueue::removeExtension( const uno::Reference< deployment::XPackage > &rPackage )
{
- m_thread->removeExtension( rPackageManager, rPackage );
+ m_thread->removeExtension( rPackage );
}
void ExtensionCmdQueue::enableExtension( const uno::Reference< deployment::XPackage > &rPackage,
@@ -1139,11 +1176,21 @@ void ExtensionCmdQueue::enableExtension( const uno::Reference< deployment::XPack
m_thread->enableExtension( rPackage, bEnable );
}
-void ExtensionCmdQueue::checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList )
+void ExtensionCmdQueue::checkForUpdates( const std::vector<uno::Reference<deployment::XPackage > > &vExtensionList )
{
m_thread->checkForUpdates( vExtensionList );
}
+void ExtensionCmdQueue::acceptLicense( const uno::Reference< deployment::XPackage > &rPackage )
+{
+ m_thread->acceptLicense( rPackage );
+}
+
+void ExtensionCmdQueue::syncRepositories( const uno::Reference< uno::XComponentContext > &xContext )
+{
+ dp_misc::syncRepositories( new ProgressCmdEnv( xContext, NULL, OUSTR("Extension Manager") ) );
+}
+
void ExtensionCmdQueue::stop()
{
m_thread->stop();
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx
index 5a3f48d61f..90eb0dab07 100644..100755
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx
@@ -40,7 +40,6 @@
/// @HTML
namespace com { namespace sun { namespace star {
- namespace deployment { class XPackageManager; }
namespace task { class XInteractionRequest; }
namespace uno { class XComponentContext; }
} } }
@@ -78,14 +77,16 @@ public:
/**
*/
- void addExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &rPackageManager,
- const ::rtl::OUString &rExtensionURL,
+ void addExtension( const ::rtl::OUString &rExtensionURL,
+ const ::rtl::OUString &rRepository,
const bool bWarnUser );
- void removeExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &rPackageManager,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage );
+ void removeExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage );
void enableExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage,
const bool bEnable );
- void checkForUpdates( const std::vector< TUpdateListEntry > &vList );
+ void checkForUpdates(const std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::deployment::XPackage > > &vList );
+ void acceptLicense( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &rPackage );
+ static void syncRepositories( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext );
/**
This call does not block. It signals the internal thread
that it should install the remaining extensions and then terminate.
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 54a7bdd378..e1e517a55c 100755..100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -44,6 +44,10 @@
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+#define USER_PACKAGE_MANAGER OUSTR("user")
+#define SHARED_PACKAGE_MANAGER OUSTR("shared")
+#define BUNDLED_PACKAGE_MANAGER OUSTR("bundled")
+
using namespace ::com::sun::star;
namespace dp_gui {
@@ -52,19 +56,20 @@ namespace dp_gui {
// struct Entry_Impl
//------------------------------------------------------------------------------
Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
- PackageState eState ) :
+ const PackageState eState, const bool bReadOnly ) :
m_bActive( false ),
- m_bLocked( false ),
+ m_bLocked( bReadOnly ),
m_bHasOptions( false ),
+ m_bUser( false ),
m_bShared( false ),
m_bNew( false ),
m_bChecked( false ),
m_bMissingDeps( false ),
+ m_bHasButtons( false ),
+ m_bMissingLic( false ),
m_eState( eState ),
m_pPublisher( NULL ),
- m_xPackage( xPackage ),
- m_xPackageManager( xPackageManager )
+ m_xPackage( xPackage )
{
m_sTitle = xPackage->getDisplayName();
m_sVersion = xPackage->getVersion();
@@ -85,8 +90,6 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
else
m_aIconHC = m_aIcon;
- m_bLocked = m_xPackageManager->isReadOnly();
-
if ( eState == AMBIGUOUS )
m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
else if ( eState == NOT_REGISTERED )
@@ -105,15 +108,12 @@ StringCompare Entry_Impl::CompareTo( const CollatorWrapper *pCollator, const TEn
{
eCompare = m_sVersion.CompareTo( pEntry->m_sVersion );
if ( eCompare == COMPARE_EQUAL )
- {
- if ( m_xPackageManager != pEntry->m_xPackageManager )
- {
- sal_Int32 nCompare = m_xPackageManager->getContext().compareTo( pEntry->m_xPackageManager->getContext() );
- if ( nCompare < 0 )
- eCompare = COMPARE_LESS;
- else if ( nCompare > 0 )
- eCompare = COMPARE_GREATER;
- }
+ {
+ sal_Int32 nCompare = m_xPackage->getRepositoryName().compareTo( pEntry->m_xPackage->getRepositoryName() );
+ if ( nCompare < 0 )
+ eCompare = COMPARE_LESS;
+ else if ( nCompare > 0 )
+ eCompare = COMPARE_GREATER;
}
}
return eCompare;
@@ -373,6 +373,8 @@ void ExtensionBox_Impl::CalcActiveHeight( const long nPos )
aSize.Height() = 10000;
rtl::OUString aText( m_vEntries[ nPos ]->m_sErrorText );
+ if ( aText.getLength() )
+ aText += OUSTR("\n");
aText += m_vEntries[ nPos ]->m_sDescription;
Rectangle aRect = GetTextRect( Rectangle( Point(), aSize ), aText,
@@ -382,7 +384,10 @@ void ExtensionBox_Impl::CalcActiveHeight( const long nPos )
if ( aTextHeight < m_nStdHeight )
aTextHeight = m_nStdHeight;
- m_nActiveHeight = aTextHeight + m_nExtraHeight;
+ if ( m_vEntries[ nPos ]->m_bHasButtons )
+ m_nActiveHeight = aTextHeight + m_nExtraHeight;
+ else
+ m_nActiveHeight = aTextHeight + 2;
}
//------------------------------------------------------------------------------
@@ -599,7 +604,12 @@ void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntr
aPos.Y() += aTextHeight;
if ( pEntry->m_bActive )
{
- DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - m_nExtraHeight ),
+ long nExtraHeight = 0;
+
+ if ( pEntry->m_bHasButtons )
+ nExtraHeight = m_nExtraHeight;
+
+ DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - nExtraHeight ),
sDescription, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
}
else
@@ -619,7 +629,7 @@ void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntr
}
// Draw status icons
- if ( pEntry->m_bShared )
+ if ( !pEntry->m_bUser )
{
aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SMALL_ICON_SIZE), TOP_OFFSET );
if ( pEntry->m_bLocked )
@@ -627,7 +637,7 @@ void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntr
else
DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aSharedImageHC : m_aSharedImage );
}
- if ( ( pEntry->m_eState == AMBIGUOUS ) || pEntry->m_bMissingDeps )
+ if ( ( pEntry->m_eState == AMBIGUOUS ) || pEntry->m_bMissingDeps || pEntry->m_bMissingLic )
{
aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SPACE_BETWEEN + 2*SMALL_ICON_SIZE), TOP_OFFSET );
DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aWarningImageHC : m_aWarningImage );
@@ -946,29 +956,24 @@ bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl pEntry, const long nStar
//------------------------------------------------------------------------------
long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager )
+ bool bLicenseMissing )
{
- long nPos = 0;
+ long nPos = 0;
PackageState eState = m_pManager->getPackageState( xPackage );
+ bool bLocked = m_pManager->isReadOnly( xPackage );
- TEntry_Impl pEntry( new Entry_Impl( xPackage, xPackageManager, eState ) );
+ TEntry_Impl pEntry( new Entry_Impl( xPackage, eState, bLocked ) );
xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
::osl::ClearableMutexGuard guard(m_entriesMutex);
if ( m_vEntries.empty() )
{
- pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
- pEntry->m_bNew = m_bInCheckMode;
m_vEntries.push_back( pEntry );
}
else
{
if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) )
{
- pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
- pEntry->m_bNew = m_bInCheckMode;
m_vEntries.insert( m_vEntries.begin()+nPos, pEntry );
}
else if ( !m_bInCheckMode )
@@ -976,6 +981,16 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &
OSL_ENSURE( 0, "ExtensionBox_Impl::addEntry(): Will not add duplicate entries" );
}
}
+
+ pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
+ pEntry->m_bUser = xPackage->getRepositoryName().equals( USER_PACKAGE_MANAGER );
+ pEntry->m_bShared = xPackage->getRepositoryName().equals( SHARED_PACKAGE_MANAGER );
+ pEntry->m_bNew = m_bInCheckMode;
+ pEntry->m_bMissingLic = bLicenseMissing;
+
+ if ( bLicenseMissing )
+ pEntry->m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_MISSING_LICENSE );
+
//access to m_nActive must be guarded
if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) )
m_nActive += 1;
@@ -1005,9 +1020,12 @@ void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage
(*iIndex)->m_sVersion = xPackage->getVersion();
(*iIndex)->m_sDescription = xPackage->getDescription();
+ if ( eState == REGISTERED )
+ (*iIndex)->m_bMissingLic = false;
+
if ( eState == AMBIGUOUS )
(*iIndex)->m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
- else
+ else if ( ! (*iIndex)->m_bMissingLic )
(*iIndex)->m_sErrorText = String();
if ( IsReallyVisible() )
@@ -1091,16 +1109,13 @@ void ExtensionBox_Impl::RemoveUnlocked()
}
//------------------------------------------------------------------------------
-void ExtensionBox_Impl::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr )
+void ExtensionBox_Impl::prepareChecking()
{
m_bInCheckMode = true;
typedef std::vector< TEntry_Impl >::iterator ITER;
for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
{
- if ( (*iIndex)->m_xPackageManager == xPackageMgr )
- (*iIndex)->m_bChecked = false;
- else
- (*iIndex)->m_bChecked = true;
+ (*iIndex)->m_bChecked = false;
(*iIndex)->m_bNew = false;
}
}
@@ -1119,17 +1134,30 @@ void ExtensionBox_Impl::checkEntries()
{
if ( (*iIndex)->m_bChecked == false )
{
+ (*iIndex)->m_bChecked = true;
bNeedsUpdate = true;
nPos = iIndex-m_vEntries.begin();
if ( (*iIndex)->m_bNew )
- {
+ { // add entry to list and correct active pos
if ( nNewPos == - 1)
nNewPos = nPos;
if ( nPos <= m_nActive )
m_nActive += 1;
+ iIndex++;
+ }
+ else
+ { // remove entry from list
+ if ( nPos < m_nActive )
+ m_nActive -= 1;
+ else if ( ( nPos == m_nActive ) && ( nPos == (long) m_vEntries.size() - 1 ) )
+ m_nActive -= 1;
+ m_vRemovedEntries.push_back( *iIndex );
+ m_vEntries.erase( iIndex );
+ iIndex = m_vEntries.begin() + nPos;
}
}
- iIndex++;
+ else
+ iIndex++;
}
guard.clear();
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
index bad80303b4..08d1120ecb 100755..100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
@@ -38,7 +38,6 @@
#include "com/sun/star/lang/Locale.hpp"
#include "com/sun/star/lang/XEventListener.hpp"
#include "com/sun/star/deployment/XPackage.hpp"
-#include "com/sun/star/deployment/XPackageManager.hpp"
#include <boost/shared_ptr.hpp>
@@ -65,13 +64,16 @@ typedef ::boost::shared_ptr< Entry_Impl > TEntry_Impl;
struct Entry_Impl
{
- bool m_bActive;
- bool m_bLocked;
- bool m_bHasOptions;
- bool m_bShared;
- bool m_bNew;
- bool m_bChecked;
- bool m_bMissingDeps;
+ bool m_bActive :1;
+ bool m_bLocked :1;
+ bool m_bHasOptions :1;
+ bool m_bUser :1;
+ bool m_bShared :1;
+ bool m_bNew :1;
+ bool m_bChecked :1;
+ bool m_bMissingDeps :1;
+ bool m_bHasButtons :1;
+ bool m_bMissingLic :1;
PackageState m_eState;
String m_sTitle;
String m_sVersion;
@@ -84,11 +86,9 @@ struct Entry_Impl
svt::FixedHyperlink *m_pPublisher;
::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage;
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager;
Entry_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
- PackageState eState );
+ const PackageState eState, const bool bReadOnly );
~Entry_Impl();
StringCompare CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const;
@@ -207,11 +207,11 @@ public:
//-----------------
virtual void selectEntry( const long nPos );
long addEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
+ bool bLicenseMissing = false );
void updateEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
void removeEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageMgr );
+ void prepareChecking();
void checkEntries();
TheExtensionManager* getExtensionManager() const { return m_pManager; }
diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx
index 7f99cd08cf..aaa6e6f64b 100644..100755
--- a/desktop/source/deployment/gui/dp_gui_service.cxx
+++ b/desktop/source/deployment/gui/dp_gui_service.cxx
@@ -46,6 +46,7 @@
#include "boost/bind.hpp"
#include "license_dialog.hxx"
#include "dp_gui_dialog2.hxx"
+#include "dp_gui_extensioncmdqueue.hxx"
using namespace ::dp_misc;
using namespace ::com::sun::star;
@@ -264,6 +265,7 @@ void ServiceImpl::startExecuteModal(
+ ::utl::ConfigManager::GetDirectConfigProperty(
::utl::ConfigManager::PRODUCTVERSION).get<OUString>();
app->SetDisplayName(sTitle);
+ ExtensionCmdQueue::syncRepositories( m_xComponentContext );
}
}
else
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
index 6a98aed677..17d5e6af39 100644..100755
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
@@ -36,17 +36,20 @@
#include "toolkit/helper/vclunohelper.hxx"
#include "com/sun/star/beans/XPropertySet.hpp"
-#include "com/sun/star/deployment/XPackageManagerFactory.hpp"
-#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
#include "dp_gui_dialog2.hxx"
#include "dp_gui_extensioncmdqueue.hxx"
#include "dp_gui_theextmgr.hxx"
#include "dp_gui_theextmgr.hxx"
#include "dp_identifier.hxx"
+#include "dp_update.hxx"
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+#define USER_PACKAGE_MANAGER OUSTR("user")
+#define SHARED_PACKAGE_MANAGER OUSTR("shared")
+#define BUNDLED_PACKAGE_MANAGER OUSTR("bundled")
+
using namespace ::com::sun::star;
using ::rtl::OUString;
@@ -65,16 +68,11 @@ TheExtensionManager::TheExtensionManager( Window *pParent,
m_xContext( xContext ),
m_pParent( pParent ),
m_pExtMgrDialog( NULL ),
- m_pUpdReqDialog( NULL )
+ m_pUpdReqDialog( NULL ),
+ m_pExecuteCmdQueue( NULL )
{
- m_sPackageManagers.realloc(2);
- m_sPackageManagers[0] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("user") );
- m_sPackageManagers[1] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("shared") );;
-
- for ( sal_Int32 i = 0; i < m_sPackageManagers.getLength(); ++i )
- {
- m_sPackageManagers[i]->addModifyListener( this );
- }
+ m_xExtensionManager = deployment::ExtensionManager::get( xContext );
+ m_xExtensionManager->addModifyListener( this );
uno::Reference< lang::XMultiServiceFactory > xConfig(
xContext->getServiceManager()->createInstanceWithContext(
@@ -121,6 +119,8 @@ TheExtensionManager::~TheExtensionManager()
delete m_pUpdReqDialog;
if ( m_pExtMgrDialog )
delete m_pExtMgrDialog;
+ if ( m_pExecuteCmdQueue )
+ delete m_pExecuteCmdQueue;
}
//------------------------------------------------------------------------------
@@ -133,14 +133,16 @@ void TheExtensionManager::createDialog( const bool bCreateUpdDlg )
if ( !m_pUpdReqDialog )
{
m_pUpdReqDialog = new UpdateRequiredDialog( NULL, this );
- m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( (DialogHelper*) m_pUpdReqDialog, this, m_xContext ) );
+ delete m_pExecuteCmdQueue;
+ m_pExecuteCmdQueue = new ExtensionCmdQueue( (DialogHelper*) m_pUpdReqDialog, this, m_xContext );
createPackageList();
}
}
else if ( !m_pExtMgrDialog )
{
m_pExtMgrDialog = new ExtMgrDialog( m_pParent, this );
- m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( (DialogHelper*) m_pExtMgrDialog, this, m_xContext ) );
+ delete m_pExecuteCmdQueue;
+ m_pExecuteCmdQueue = new ExtensionCmdQueue( (DialogHelper*) m_pExtMgrDialog, this, m_xContext );
m_pExtMgrDialog->setGetExtensionsURL( m_sGetExtensionsURL );
createPackageList();
}
@@ -205,27 +207,29 @@ bool TheExtensionManager::isVisible()
//------------------------------------------------------------------------------
bool TheExtensionManager::checkUpdates( bool /* bShowUpdateOnly */, bool /*bParentVisible*/ )
{
- std::vector< TUpdateListEntry > vEntries;
+ std::vector< uno::Reference< deployment::XPackage > > vEntries;
+ uno::Sequence< uno::Sequence< uno::Reference< deployment::XPackage > > > xAllPackages;
- for ( sal_Int32 i = 0; i < m_sPackageManagers.getLength(); ++i )
+ try {
+ xAllPackages = m_xExtensionManager->getAllExtensions( uno::Reference< task::XAbortChannel >(),
+ uno::Reference< ucb::XCommandEnvironment >() );
+ } catch ( deployment::DeploymentException & ) {
+ return false;
+ } catch ( ucb::CommandFailedException & ) {
+ return false;
+ } catch ( ucb::CommandAbortedException & ) {
+ return false;
+ } catch ( lang::IllegalArgumentException & e ) {
+ throw uno::RuntimeException( e.Message, e.Context );
+ }
+
+ for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i )
{
- uno::Sequence< uno::Reference< deployment::XPackage > > xPackages;
- try {
- xPackages = m_sPackageManagers[i]->getDeployedPackages( uno::Reference< task::XAbortChannel >(),
- uno::Reference< ucb::XCommandEnvironment >() );
- for ( sal_Int32 k = 0; k < xPackages.getLength(); ++k )
- {
- TUpdateListEntry pEntry( new UpdateListEntry( xPackages[k], m_sPackageManagers[i] ) );
- vEntries.push_back( pEntry );
- }
- } catch ( deployment::DeploymentException & ) {
- continue;
- } catch ( ucb::CommandFailedException & ) {
- continue;
- } catch ( ucb::CommandAbortedException & ) {
- return true;
- } catch ( lang::IllegalArgumentException & e ) {
- throw uno::RuntimeException( e.Message, e.Context );
+ uno::Reference< deployment::XPackage > xPackage = dp_misc::getExtensionWithHighestVersion(xAllPackages[i]);
+ OSL_ASSERT(xPackage.is());
+ if ( xPackage.is() )
+ {
+ vEntries.push_back( xPackage );
}
}
@@ -234,32 +238,6 @@ bool TheExtensionManager::checkUpdates( bool /* bShowUpdateOnly */, bool /*bPare
}
//------------------------------------------------------------------------------
-bool TheExtensionManager::enablePackage( const uno::Reference< deployment::XPackage > &xPackage,
- bool bEnable )
-{
- m_pExecuteCmdQueue->enableExtension( xPackage, bEnable );
-
- return true;
-}
-
-//------------------------------------------------------------------------------
-bool TheExtensionManager::removePackage( const uno::Reference< deployment::XPackageManager > &xPackageManager,
- const uno::Reference< deployment::XPackage > &xPackage )
-{
- m_pExecuteCmdQueue->removeExtension( xPackageManager, xPackage );
-
- return true;
-}
-
-//------------------------------------------------------------------------------
-bool TheExtensionManager::updatePackages( const std::vector< TUpdateListEntry > &vList )
-{
- m_pExecuteCmdQueue->checkForUpdates( vList );
-
- return true;
-}
-
-//------------------------------------------------------------------------------
bool TheExtensionManager::installPackage( const OUString &rPackageURL, bool bWarnUser )
{
if ( rPackageURL.getLength() == 0 )
@@ -267,22 +245,20 @@ bool TheExtensionManager::installPackage( const OUString &rPackageURL, bool bWar
createDialog( false );
- uno::Reference< deployment::XPackageManager > xUserPkgMgr = getUserPkgMgr();
- uno::Reference< deployment::XPackageManager > xSharedPkgMgr = getSharedPkgMgr();
-
bool bInstall = true;
bool bInstallForAll = false;
- if ( !bWarnUser && ! xSharedPkgMgr->isReadOnly() )
+ // DV! missing function is read only repository from extension manager
+ if ( !bWarnUser && ! m_xExtensionManager->isReadOnlyRepository( SHARED_PACKAGE_MANAGER ) )
bInstall = getDialogHelper()->installForAllUsers( bInstallForAll );
if ( !bInstall )
return false;
if ( bInstallForAll )
- m_pExecuteCmdQueue->addExtension( xSharedPkgMgr, rPackageURL, false );
+ m_pExecuteCmdQueue->addExtension( rPackageURL, SHARED_PACKAGE_MANAGER, false );
else
- m_pExecuteCmdQueue->addExtension( xUserPkgMgr, rPackageURL, bWarnUser );
+ m_pExecuteCmdQueue->addExtension( rPackageURL, USER_PACKAGE_MANAGER, bWarnUser );
return true;
}
@@ -312,40 +288,52 @@ void TheExtensionManager::terminateDialog()
}
//------------------------------------------------------------------------------
-bool TheExtensionManager::createPackageList( const uno::Reference< deployment::XPackageManager > &xPackageManager )
+void TheExtensionManager::createPackageList()
{
- uno::Sequence< uno::Reference< deployment::XPackage > > packages;
-
+ uno::Sequence< uno::Sequence< uno::Reference< deployment::XPackage > > > xAllPackages;
+
try {
- packages = xPackageManager->getDeployedPackages( uno::Reference< task::XAbortChannel >(),
- uno::Reference< ucb::XCommandEnvironment >() );
+ xAllPackages = m_xExtensionManager->getAllExtensions( uno::Reference< task::XAbortChannel >(),
+ uno::Reference< ucb::XCommandEnvironment >() );
} catch ( deployment::DeploymentException & ) {
- //handleGeneralError(e.Cause);
- return true;
+ return;
} catch ( ucb::CommandFailedException & ) {
- //handleGeneralError(e.Reason);
- return true;
+ return;
} catch ( ucb::CommandAbortedException & ) {
- return false;
+ return;
} catch ( lang::IllegalArgumentException & e ) {
throw uno::RuntimeException( e.Message, e.Context );
}
- for ( sal_Int32 j = 0; j < packages.getLength(); ++j )
+ for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i )
{
- getDialogHelper()->addPackageToList( packages[j], xPackageManager );
- }
+ uno::Sequence< uno::Reference< deployment::XPackage > > xPackageList = xAllPackages[i];
- return true;
-}
+ for ( sal_Int32 j = 0; j < xPackageList.getLength(); ++j )
+ {
+ uno::Reference< deployment::XPackage > xPackage = xPackageList[j];
+ if ( xPackage.is() )
+ {
+ PackageState eState = getPackageState( xPackage );
+ getDialogHelper()->addPackageToList( xPackage );
+ // When the package is enabled, we can stop here, otherwise we have to look for
+ // another version of this package
+ if ( ( eState == REGISTERED ) || ( eState == NOT_AVAILABLE ) )
+ break;
+ }
+ }
+ }
-//------------------------------------------------------------------------------
-void TheExtensionManager::createPackageList()
-{
- for ( sal_Int32 i = 0; i < m_sPackageManagers.getLength(); ++i )
+ uno::Sequence< uno::Reference< deployment::XPackage > > xNoLicPackages;
+ xNoLicPackages = m_xExtensionManager->getExtensionsWithUnacceptedLicenses( SHARED_PACKAGE_MANAGER,
+ uno::Reference< ucb::XCommandEnvironment >() );
+ for ( sal_Int32 i = 0; i < xNoLicPackages.getLength(); ++i )
{
- if ( ! createPackageList( m_sPackageManagers[i] ) )
- break;
+ uno::Reference< deployment::XPackage > xPackage = xNoLicPackages[i];
+ if ( xPackage.is() )
+ {
+ getDialogHelper()->addPackageToList( xPackage, true );
+ }
}
}
@@ -378,6 +366,17 @@ PackageState TheExtensionManager::getPackageState( const uno::Reference< deploym
}
//------------------------------------------------------------------------------
+bool TheExtensionManager::isReadOnly( const uno::Reference< deployment::XPackage > &xPackage ) const
+{
+ if ( m_xExtensionManager.is() && xPackage.is() )
+ {
+ return m_xExtensionManager->isReadOnlyRepository( xPackage->getRepositoryName() );
+ }
+ else
+ return true;
+}
+
+//------------------------------------------------------------------------------
// The function investigates if the extension supports options.
bool TheExtensionManager::supportsOptions( const uno::Reference< deployment::XPackage > &xPackage ) const
{
@@ -488,16 +487,12 @@ void TheExtensionManager::notifyTermination( ::lang::EventObject const & rEvt )
//------------------------------------------------------------------------------
// XModifyListener
-void TheExtensionManager::modified( ::lang::EventObject const & rEvt )
+void TheExtensionManager::modified( ::lang::EventObject const & /*rEvt*/ )
throw ( uno::RuntimeException )
{
- uno::Reference< deployment::XPackageManager > xPackageManager( rEvt.Source, uno::UNO_QUERY );
- if ( xPackageManager.is() )
- {
- getDialogHelper()->prepareChecking( xPackageManager );
- createPackageList( xPackageManager );
- getDialogHelper()->checkEntries();
- }
+ getDialogHelper()->prepareChecking();
+ createPackageList();
+ getDialogHelper()->checkEntries();
}
//------------------------------------------------------------------------------
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
index e16f2cb0e4..4baa797d63 100644..100755
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
@@ -33,7 +33,8 @@
#include "cppuhelper/implbase2.hxx"
#include "com/sun/star/container/XNameAccess.hpp"
-#include "com/sun/star/deployment/XPackageManager.hpp"
+#include "com/sun/star/deployment/XExtensionManager.hpp"
+#include "com/sun/star/deployment/ExtensionManager.hpp"
#include "com/sun/star/frame/XDesktop.hpp"
#include "com/sun/star/frame/XTerminateListener.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
@@ -57,21 +58,17 @@ class TheExtensionManager :
private:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop;
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> > m_sPackageManagers;
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xNameAccessNodes;
- ::std::auto_ptr< ExtensionCmdQueue > m_pExecuteCmdQueue;
-
Window *m_pParent;
ExtMgrDialog *m_pExtMgrDialog;
UpdateRequiredDialog *m_pUpdReqDialog;
+ ExtensionCmdQueue *m_pExecuteCmdQueue;
::rtl::OUString m_sGetExtensionsURL;
- // liste der packages ( xpackage?, mit parent manager, ... )
-
void createPackageList();
- bool createPackageList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
public:
static ::rtl::Reference<TheExtensionManager> s_ExtMgr;
@@ -85,6 +82,7 @@ public:
Dialog* getDialog() { return m_pExtMgrDialog ? (Dialog*) m_pExtMgrDialog : (Dialog*) m_pUpdReqDialog; }
DialogHelper* getDialogHelper() { return m_pExtMgrDialog ? (DialogHelper*) m_pExtMgrDialog : (DialogHelper*) m_pUpdReqDialog; }
+ ExtensionCmdQueue* getCmdQueue() const { return m_pExecuteCmdQueue; }
void SetText( const ::rtl::OUString &rTitle );
void Show();
@@ -94,12 +92,6 @@ public:
//-----------------
bool checkUpdates( bool showUpdateOnly, bool parentVisible );
- bool updatePackages( const std::vector< TUpdateListEntry > &vList );
-
- bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
- bool bEnable );
- bool removePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
bool installPackage( const ::rtl::OUString &rPackageURL, bool bWarnUser = false );
bool queryTermination();
@@ -109,8 +101,8 @@ public:
bool supportsOptions( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
PackageState getPackageState( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const { return m_xContext; }
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > getUserPkgMgr() const { return m_sPackageManagers[0]; }
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > getSharedPkgMgr() const { return m_sPackageManagers[1]; }
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > getExtensionManager() const { return m_xExtensionManager; }
+ bool isReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
//-----------------
static ::rtl::Reference<TheExtensionManager> get(
diff --git a/desktop/source/deployment/gui/dp_gui_updatedata.hxx b/desktop/source/deployment/gui/dp_gui_updatedata.hxx
index a5075cf720..e0dc982dff 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedata.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedata.hxx
@@ -35,7 +35,6 @@
namespace com { namespace sun { namespace star { namespace deployment {
- class XPackageManager;
class XPackage;
}}}}
namespace com { namespace sun { namespace star { namespace xml { namespace dom {
@@ -45,31 +44,42 @@ namespace com { namespace sun { namespace star { namespace xml { namespace dom {
namespace dp_gui {
-struct UpdateListEntry
+struct UpdateData
{
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage;
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager;
-
- UpdateListEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
- ~UpdateListEntry();
-};
-
-typedef ::boost::shared_ptr< UpdateListEntry > TUpdateListEntry;
+ UpdateData( ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > const & aExt):
+ bIsShared(false), aInstalledPackage(aExt){};
+ //When entries added to the listbox then there can be one for the user update and one
+ //for the shared update. However, both list entries will contain the same UpdateData.
+ //isShared is used to indicate which one is used for the shared entry.
+ bool bIsShared;
-struct UpdateData
-{
+ //The currently installed extension which is going to be updated. If the extension exist in
+ //multiple repositories then it is the one with the highest version.
::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > aInstalledPackage;
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > aPackageManager;
- // The content of the update information
+ //The version of the update
+ ::rtl::OUString updateVersion;
+
+ //For online update
+ // ======================
+ // The content of the update information.
+ //Only if aUpdateInfo is set then there is an online update available with a better version
+ //than any of the currently installed extensions with the same identifier.
::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > aUpdateInfo;
//The URL of the locally downloaded extension. It will only be set if there were no errors
//during the download
::rtl::OUString sLocalURL;
//The URL of the website wher the download can be obtained.
::rtl::OUString sWebsiteURL;
+
+ //For local update
+ //=====================
+ //The locale extension which is used as update for the user or shared repository.
+ //If set then the data for the online update (aUpdateInfo, sLocalURL, sWebsiteURL)
+ //are to be ignored.
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage >
+ aUpdateSource;
};
}
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 606f66ff4d..03c63fe56b 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -54,7 +54,8 @@
#include "com/sun/star/deployment/DeploymentException.hpp"
#include "com/sun/star/deployment/UpdateInformationProvider.hpp"
#include "com/sun/star/deployment/XPackage.hpp"
-#include "com/sun/star/deployment/XPackageManager.hpp"
+#include "com/sun/star/deployment/XExtensionManager.hpp"
+#include "com/sun/star/deployment/ExtensionManager.hpp"
#include "com/sun/star/deployment/XUpdateInformationProvider.hpp"
#include "com/sun/star/frame/XDesktop.hpp"
#include "com/sun/star/frame/XDispatch.hpp"
@@ -111,6 +112,7 @@
#include "dp_identifier.hxx"
#include "dp_version.hxx"
#include "dp_misc.h"
+#include "dp_update.hxx"
#include "dp_gui.h"
#include "dp_gui.hrc"
@@ -150,7 +152,6 @@ rtl::OUString confineToParagraph(rtl::OUString const & text) {
struct UpdateDialog::DisabledUpdate {
rtl::OUString name;
css::uno::Sequence< rtl::OUString > unsatisfiedDependencies;
- bool permission;
// We also want to show release notes and publisher for disabled updates
::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > aUpdateInfo;
};
@@ -229,7 +230,7 @@ public:
Thread(
css::uno::Reference< css::uno::XComponentContext > const & context,
UpdateDialog & dialog,
- const std::vector< TUpdateListEntry > &vExtensionList);
+ const std::vector< css::uno::Reference< css::deployment::XPackage > > & vExtensionList);
void stop();
@@ -240,18 +241,21 @@ private:
struct Entry {
explicit Entry(
css::uno::Reference< css::deployment::XPackage > const & thePackage,
- css::uno::Reference< css::deployment::XPackageManager > const &
- thePackageManager,
rtl::OUString const & theVersion);
css::uno::Reference< css::deployment::XPackage > package;
- css::uno::Reference< css::deployment::XPackageManager > packageManager;
rtl::OUString version;
+ //Indicates that the extension provides its own update URLs.
+ //If this is true, then we must not use the default update
+ //URL to find the update information.
+ bool bProvidesOwnUpdate;
css::uno::Reference< css::xml::dom::XNode > info;
+ UpdateDialog::DisabledUpdate disableUpdate;
+ dp_gui::UpdateData updateData;
};
- // A multimap in case an extension is installed in both "user" and "shared":
- typedef std::multimap< rtl::OUString, Entry > Map;
+ // A multimap in case an extension is installed in "user", "shared" or "bundled"
+ typedef std::map< rtl::OUString, Entry > Map;
virtual ~Thread();
@@ -269,21 +273,25 @@ private:
css::uno::Sequence< rtl::OUString > const & urls,
rtl::OUString const & identifier) const;
- void handle(
+ void getOwnUpdateInformation(
css::uno::Reference< css::deployment::XPackage > const & package,
- css::uno::Reference< css::deployment::XPackageManager > const &
- packageManager,
Map * map);
- bool update(
- css::uno::Reference< css::deployment::XPackage > const & package,
- css::uno::Reference< css::deployment::XPackageManager > const &
- packageManager,
- css::uno::Reference< css::xml::dom::XNode > const & updateInfo) const;
+ ::rtl::OUString getUpdateDisplayString(
+ dp_gui::UpdateData const & data, ::rtl::OUString const & version = ::rtl::OUString()) const;
+ void prepareUpdateData(
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > const & updateInfo,
+ UpdateDialog::DisabledUpdate & out_du,
+ dp_gui::UpdateData & out_data) const;
+
+ bool update(
+ UpdateDialog::DisabledUpdate const & du,
+ dp_gui::UpdateData const & data) const;
+
css::uno::Reference< css::uno::XComponentContext > m_context;
UpdateDialog & m_dialog;
- std::vector< dp_gui::TUpdateListEntry > m_vExtensionList;
+ std::vector< css::uno::Reference< css::deployment::XPackage > > m_vExtensionList;
css::uno::Reference< css::deployment::XUpdateInformationProvider > m_updateInformation;
css::uno::Reference< css::task::XInteractionHandler > m_xInteractionHdl;
@@ -295,7 +303,7 @@ private:
UpdateDialog::Thread::Thread(
css::uno::Reference< css::uno::XComponentContext > const & context,
UpdateDialog & dialog,
- const std::vector< dp_gui::TUpdateListEntry > &vExtensionList):
+ const std::vector< css::uno::Reference< css::deployment::XPackage > > &vExtensionList):
m_context(context),
m_dialog(dialog),
m_vExtensionList(vExtensionList),
@@ -333,13 +341,14 @@ void UpdateDialog::Thread::stop() {
UpdateDialog::Thread::Entry::Entry(
css::uno::Reference< css::deployment::XPackage > const & thePackage,
- css::uno::Reference< css::deployment::XPackageManager > const &
- thePackageManager,
rtl::OUString const & theVersion):
+
package(thePackage),
- packageManager(thePackageManager),
- version(theVersion)
-{}
+ version(theVersion),
+ bProvidesOwnUpdate(false),
+ updateData(thePackage)
+{
+}
UpdateDialog::Thread::~Thread()
{
@@ -349,65 +358,94 @@ UpdateDialog::Thread::~Thread()
void UpdateDialog::Thread::execute()
{
- OSL_ASSERT( ! m_vExtensionList.empty() );
- Map map;
-
- typedef std::vector< TUpdateListEntry >::const_iterator ITER;
- for ( ITER iIndex = m_vExtensionList.begin(); iIndex < m_vExtensionList.end(); ++iIndex )
{
- css::uno::Reference< css::deployment::XPackage > p = (*iIndex)->m_xPackage;
- css::uno::Reference< css::deployment::XPackageManager > m = (*iIndex)->m_xPackageManager;
- if ( p.is() )
- {
- {
- vos::OGuard g( Application::GetSolarMutex() );
- if ( m_stop ) {
- return;
- }
- }
- handle( p, m, &map );
+ vos::OGuard g( Application::GetSolarMutex() );
+ if ( m_stop ) {
+ return;
}
}
+ css::uno::Reference<css::deployment::XExtensionManager> extMgr =
+ css::deployment::ExtensionManager::get(m_context);
+
+ std::vector<std::pair<css::uno::Reference<css::deployment::XPackage>, css::uno::Any > > errors;
+
+ dp_misc::UpdateInfoMap updateInfoMap = dp_misc::getOnlineUpdateInfos(
+ m_context, extMgr, m_updateInformation, &m_vExtensionList, errors);
+
+ typedef std::vector<std::pair<css::uno::Reference<css::deployment::XPackage>,
+ css::uno::Any> >::const_iterator ITERROR;
+ for (ITERROR ite = errors.begin(); ite != errors.end(); ite ++)
+ handleSpecificError(ite->first, ite->second);
- if (!map.empty()) {
- const rtl::OUString sDefaultURL(dp_misc::getExtensionDefaultUpdateURL());
- if (sDefaultURL.getLength())
+ for (dp_misc::UpdateInfoMap::iterator i(updateInfoMap.begin()); i != updateInfoMap.end(); i++)
+ {
+ dp_misc::UpdateInfo const & info = i->second;
+ UpdateData updateData(info.extension);
+ DisabledUpdate disableUpdate;
+ //determine if online updates meet the requirements
+ prepareUpdateData(info.info, disableUpdate, updateData);
+
+ //determine if the update is installed in the user or shared repository
+ rtl::OUString sOnlineVersion;
+ if (info.info.is())
+ sOnlineVersion = info.version;
+ rtl::OUString sVersionUser;
+ rtl::OUString sVersionShared;
+ rtl::OUString sVersionBundled;
+ css::uno::Sequence< css::uno::Reference< css::deployment::XPackage> > extensions;
+ try {
+ extensions = extMgr->getExtensionsWithSameIdentifier(
+ dp_misc::getIdentifier(info.extension), info.extension->getName(),
+ css::uno::Reference<css::ucb::XCommandEnvironment>());
+ } catch (css::lang::IllegalArgumentException& ) {
+ OSL_ASSERT(0);
+ }
+ OSL_ASSERT(extensions.getLength() == 3);
+ if (extensions[0].is() )
+ sVersionUser = extensions[0]->getVersion();
+ if (extensions[1].is() )
+ sVersionShared = extensions[1]->getVersion();
+ if (extensions[2].is() )
+ sVersionBundled = extensions[2]->getVersion();
+
+ bool bSharedReadOnly = extMgr->isReadOnlyRepository(OUSTR("shared"));
+
+ dp_misc::UPDATE_SOURCE sourceUser = dp_misc::isUpdateUserExtension(
+ bSharedReadOnly, sVersionUser, sVersionShared, sVersionBundled, sOnlineVersion);
+ dp_misc::UPDATE_SOURCE sourceShared = dp_misc::isUpdateSharedExtension(
+ bSharedReadOnly, sVersionShared, sVersionBundled, sOnlineVersion);
+
+ css::uno::Reference<css::deployment::XPackage> updateSource;
+ if (sourceUser != dp_misc::UPDATE_SOURCE_NONE)
{
- css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > >
- infos(
- getUpdateInformation(
- css::uno::Reference< css::deployment::XPackage >(),
- css::uno::Sequence< rtl::OUString >(&sDefaultURL, 1), rtl::OUString()));
- for (sal_Int32 i = 0; i < infos.getLength(); ++i) {
- css::uno::Reference< css::xml::dom::XNode > node(
- infos[i], css::uno::UNO_QUERY_THROW);
- dp_misc::DescriptionInfoset infoset(m_context, node);
- boost::optional< rtl::OUString > id(infoset.getIdentifier());
- if (!id) {
- continue;
- }
- Map::iterator end(map.upper_bound(*id));
- for (Map::iterator j(map.lower_bound(*id)); j != end; ++j) {
- rtl::OUString v(infoset.getVersion());
- if (dp_misc::compareVersions(v, j->second.version) ==
- dp_misc::GREATER)
- {
- j->second.version = v;
- j->second.info = node;
- }
- }
+ if (sourceUser == dp_misc::UPDATE_SOURCE_SHARED)
+ {
+ updateData.aUpdateSource = extensions[1];
+ updateData.updateVersion = extensions[1]->getVersion();
}
- for (Map::const_iterator i(map.begin()); i != map.end(); ++i) {
- if (i->second.info.is() &&
- !update(
- i->second.package, i->second.packageManager,
- i->second.info))
- {
- break;
- }
+ else if (sourceUser == dp_misc::UPDATE_SOURCE_BUNDLED)
+ {
+ updateData.aUpdateSource = extensions[2];
+ updateData.updateVersion = extensions[2]->getVersion();
}
+ if (!update(disableUpdate, updateData))
+ return;
}
+
+ if (sourceShared != dp_misc::UPDATE_SOURCE_NONE)
+ {
+ if (sourceShared == dp_misc::UPDATE_SOURCE_BUNDLED)
+ {
+ updateData.aUpdateSource = extensions[2];
+ updateData.updateVersion = extensions[2]->getVersion();
+ }
+ updateData.bIsShared = true;
+ if (!update(disableUpdate, updateData))
+ return;
+ }
}
+
+
vos::OGuard g(Application::GetSolarMutex());
if (!m_stop) {
m_dialog.checkingDone();
@@ -446,142 +484,95 @@ void UpdateDialog::Thread::handleSpecificError(
}
}
-css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > >
-UpdateDialog::Thread::getUpdateInformation(
- css::uno::Reference< css::deployment::XPackage > const & package,
- css::uno::Sequence< rtl::OUString > const & urls,
- rtl::OUString const & identifier) const
+::rtl::OUString UpdateDialog::Thread::getUpdateDisplayString(
+ dp_gui::UpdateData const & data, ::rtl::OUString const & version) const
{
- try {
- return m_updateInformation->getUpdateInformation(urls, identifier);
- } catch (css::uno::RuntimeException &) {
- throw;
- } catch (css::ucb::CommandFailedException & e) {
- handleSpecificError(package, e.Reason);
- } catch (css::ucb::CommandAbortedException &) {
- } catch (css::uno::Exception & e) {
- handleSpecificError(package, css::uno::makeAny(e));
+ OSL_ASSERT(data.aInstalledPackage.is());
+ rtl::OUStringBuffer b(data.aInstalledPackage->getDisplayName());
+ b.append(static_cast< sal_Unicode >(' '));
+ {
+ vos::OGuard g( Application::GetSolarMutex() );
+ if(!m_stop)
+ b.append(m_dialog.m_version);
}
- return
- css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > >();
-}
-
-void UpdateDialog::Thread::handle(
- css::uno::Reference< css::deployment::XPackage > const & package,
- css::uno::Reference< css::deployment::XPackageManager > const &
- packageManager,
- Map * map)
-{
- rtl::OUString id(dp_misc::getIdentifier(package));
- css::uno::Sequence< rtl::OUString > urls(
- package->getUpdateInformationURLs());
- if (urls.getLength() == 0) {
- map->insert(
- Map::value_type(
- id, Entry(package, packageManager, package->getVersion())));
- } else {
- css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > >
- infos(getUpdateInformation(package, urls, id));
- rtl::OUString latestVersion(package->getVersion());
- sal_Int32 latestIndex = -1;
- for (sal_Int32 i = 0; i < infos.getLength(); ++i) {
- dp_misc::DescriptionInfoset infoset(
- m_context,
- css::uno::Reference< css::xml::dom::XNode >(
- infos[i], css::uno::UNO_QUERY_THROW));
- boost::optional< rtl::OUString > id2(infoset.getIdentifier());
- if (!id2) {
- continue;
- }
- if (*id2 == id) {
- rtl::OUString v(infoset.getVersion());
- if (dp_misc::compareVersions(v, latestVersion) ==
- dp_misc::GREATER)
- {
- latestVersion = v;
- latestIndex = i;
- }
- }
- }
- if (latestIndex != -1) {
- update(
- package, packageManager,
- css::uno::Reference< css::xml::dom::XNode >(
- infos[latestIndex], css::uno::UNO_QUERY_THROW));
+ b.append(static_cast< sal_Unicode >(' '));
+ if (version.getLength())
+ b.append(version);
+ else
+ b.append(data.updateVersion);
+
+ if (data.sWebsiteURL.getLength())
+ {
+ b.append(static_cast< sal_Unicode >(' '));
+ {
+ vos::OGuard g( Application::GetSolarMutex() );
+ if(!m_stop)
+ b.append(m_dialog.m_browserbased);
}
- }
+ }
+ return b.makeStringAndClear();
}
-bool UpdateDialog::Thread::update(
- css::uno::Reference< css::deployment::XPackage > const & package,
- css::uno::Reference< css::deployment::XPackageManager > const &
- packageManager,
- css::uno::Reference< css::xml::dom::XNode > const & updateInfo) const
+/** out_data will only be filled if all dependencies are ok.
+ */
+void UpdateDialog::Thread::prepareUpdateData(
+ css::uno::Reference< css::xml::dom::XNode > const & updateInfo,
+ UpdateDialog::DisabledUpdate & out_du,
+ dp_gui::UpdateData & out_data) const
{
+ if (!updateInfo.is())
+ return;
dp_misc::DescriptionInfoset infoset(m_context, updateInfo);
OSL_ASSERT(infoset.getVersion().getLength() != 0);
css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > ds(
dp_misc::Dependencies::check(infoset));
- UpdateDialog::DisabledUpdate du;
- du.aUpdateInfo = updateInfo;
- du.unsatisfiedDependencies.realloc(ds.getLength());
+ out_du.aUpdateInfo = updateInfo;
+ out_du.unsatisfiedDependencies.realloc(ds.getLength());
for (sal_Int32 i = 0; i < ds.getLength(); ++i) {
- du.unsatisfiedDependencies[i] = dp_misc::Dependencies::getErrorText(ds[i]);
+ out_du.unsatisfiedDependencies[i] = dp_misc::Dependencies::getErrorText(ds[i]);
}
- du.permission = ! packageManager->isReadOnly();
+
const ::boost::optional< ::rtl::OUString> updateWebsiteURL(infoset.getLocalizedUpdateWebsiteURL());
- rtl::OUStringBuffer b(package->getDisplayName());
- b.append(static_cast< sal_Unicode >(' '));
+
+ out_du.name = getUpdateDisplayString(out_data, infoset.getVersion());
+
+ if (out_du.unsatisfiedDependencies.getLength() == 0)
{
- vos::OGuard g( Application::GetSolarMutex() );
- if ( m_stop )
- return !m_stop;
- else
- b.append(m_dialog.m_version);
+ out_data.aUpdateInfo = updateInfo;
+ out_data.updateVersion = infoset.getVersion();
+ if (updateWebsiteURL)
+ out_data.sWebsiteURL = *updateWebsiteURL;
}
- b.append(static_cast< sal_Unicode >(' '));
- b.append(infoset.getVersion());
- if (updateWebsiteURL)
- {
- b.append(static_cast< sal_Unicode >(' '));
- {
- vos::OGuard g( Application::GetSolarMutex() );
- if ( m_stop )
- return !m_stop;
- else
- b.append(m_dialog.m_browserbased);
- }
- }
- du.name = b.makeStringAndClear();
+}
- if (du.unsatisfiedDependencies.getLength() == 0 && du.permission)
+bool UpdateDialog::Thread::update(
+ UpdateDialog::DisabledUpdate const & du,
+ dp_gui::UpdateData const & data) const
+{
+ bool ret = false;
+ if (du.unsatisfiedDependencies.getLength() == 0)
{
- dp_gui::UpdateData data;
- data.aInstalledPackage = package;
- data.aPackageManager = packageManager;
- data.aUpdateInfo = updateInfo;
- if (updateWebsiteURL)
- data.sWebsiteURL = *updateWebsiteURL;
vos::OGuard g(Application::GetSolarMutex());
if (!m_stop) {
- m_dialog.addEnabledUpdate(du.name, data);
+ m_dialog.addEnabledUpdate(getUpdateDisplayString(data), data);
}
- return !m_stop;
+ ret = !m_stop;
} else {
vos::OGuard g(Application::GetSolarMutex());
if (!m_stop) {
- m_dialog.addDisabledUpdate(du);
+ m_dialog.addDisabledUpdate(du);
}
- return !m_stop;
+ ret = !m_stop;
}
+ return ret;
}
// UpdateDialog ----------------------------------------------------------
UpdateDialog::UpdateDialog(
css::uno::Reference< css::uno::XComponentContext > const & context,
Window * parent,
- const std::vector< dp_gui::TUpdateListEntry > &vExtensionList,
+ const std::vector<css::uno::Reference< css::deployment::XPackage > > &vExtensionList,
std::vector< dp_gui::UpdateData > * updateData):
ModalDialog(parent,DpGuiResId(RID_DLG_UPDATE)),
m_context(context),
@@ -611,8 +602,6 @@ UpdateDialog::UpdateDialog(
m_noInstall(String(DpGuiResId(RID_DLG_UPDATE_NOINSTALL))),
m_noDependency(String(DpGuiResId(RID_DLG_UPDATE_NODEPENDENCY))),
m_noDependencyCurVer(String(DpGuiResId(RID_DLG_UPDATE_NODEPENDENCY_CUR_VER))),
- m_noPermission(String(DpGuiResId(RID_DLG_UPDATE_NOPERMISSION))),
- m_noPermissionVista(String(DpGuiResId(RID_DLG_UPDATE_NOPERMISSION_VISTA))),
m_browserbased(String(DpGuiResId(RID_DLG_UPDATE_BROWSERBASED))),
m_version(String(DpGuiResId(RID_DLG_UPDATE_VERSION))),
m_updateData(*updateData),
@@ -626,6 +615,9 @@ UpdateDialog::UpdateDialog(
// m_extensionManagerDialog(extensionManagerDialog)
{
OSL_ASSERT(updateData != NULL);
+
+ m_xExtensionManager = css::deployment::ExtensionManager::get( context );
+
css::uno::Reference< css::awt::XToolkit > toolkit;
try {
toolkit = css::uno::Reference< css::awt::XToolkit >(
@@ -666,9 +658,6 @@ UpdateDialog::UpdateDialog(
if ( ! dp_misc::office_is_running())
m_help.Disable();
FreeResource();
- String sTemp(m_noPermissionVista);
- sTemp.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() );
- m_noPermissionVista = sTemp;
initDescription();
}
@@ -998,12 +987,25 @@ void UpdateDialog::clearDescription()
bool UpdateDialog::showDescription(css::uno::Reference< css::xml::dom::XNode > const & aUpdateInfo)
{
dp_misc::DescriptionInfoset infoset(m_context, aUpdateInfo);
- std::pair< rtl::OUString, rtl::OUString > pairPub = infoset.getLocalizedPublisherNameAndURL();
- rtl::OUString sPub = pairPub.first;
- rtl::OUString sURL = pairPub.second;
- rtl::OUString sRel = infoset.getLocalizedReleaseNotesURL();
+ return showDescription(infoset.getLocalizedPublisherNameAndURL(),
+ infoset.getLocalizedReleaseNotesURL());
+}
+
+bool UpdateDialog::showDescription(css::uno::Reference< css::deployment::XPackage > const & aExtension)
+{
+ OSL_ASSERT(aExtension.is());
+ css::beans::StringPair pubInfo = aExtension->getPublisherInfo();
+ return showDescription(std::make_pair(pubInfo.First, pubInfo.Second),
+ OUSTR(""));
+}
+
+bool UpdateDialog::showDescription(std::pair< rtl::OUString, rtl::OUString > const & pairPublisher,
+ rtl::OUString const & sReleaseNotes)
+{
+ rtl::OUString sPub = pairPublisher.first;
+ rtl::OUString sURL = pairPublisher.second;
- if ( sPub.getLength() == 0 && sURL.getLength() == 0 && sRel.getLength() == 0 )
+ if ( sPub.getLength() == 0 && sURL.getLength() == 0 && sReleaseNotes.getLength() == 0 )
// nothing to show
return false;
@@ -1017,7 +1019,7 @@ bool UpdateDialog::showDescription(css::uno::Reference< css::xml::dom::XNode > c
bPublisher = true;
}
- if ( sRel.getLength() > 0 )
+ if ( sReleaseNotes.getLength() > 0 )
{
if ( !bPublisher )
{
@@ -1026,7 +1028,7 @@ bool UpdateDialog::showDescription(css::uno::Reference< css::xml::dom::XNode > c
}
m_ReleaseNotesLabel.Show();
m_ReleaseNotesLink.Show();
- m_ReleaseNotesLink.SetURL( sRel );
+ m_ReleaseNotesLink.SetURL( sReleaseNotes );
}
return true;
}
@@ -1055,6 +1057,16 @@ bool UpdateDialog::showDescription( const String& rDescription, bool bWithPublis
return true;
}
+bool UpdateDialog::isReadOnly( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const
+{
+ if ( m_xExtensionManager.is() && xPackage.is() )
+ {
+ return m_xExtensionManager->isReadOnlyRepository( xPackage->getRepositoryName() );
+ }
+ else
+ return true;
+}
+
IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG)
{
rtl::OUStringBuffer b;
@@ -1074,7 +1086,12 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG)
const std::vector< UpdateDialog::DisabledUpdate >::size_type sizeDisabled =
m_disabledUpdates.size();
if (pos < sizeEnabled)
- bInserted = showDescription(m_enabledUpdates[pos].aUpdateInfo);
+ {
+ if (m_enabledUpdates[pos].aUpdateSource.is())
+ bInserted = showDescription(m_enabledUpdates[pos].aUpdateSource);
+ else
+ bInserted = showDescription(m_enabledUpdates[pos].aUpdateInfo);
+ }
else if (pos >= sizeEnabled
&& pos < (sizeEnabled + sizeDisabled))
bInserted = showDescription(m_disabledUpdates[pos - sizeEnabled].aUpdateInfo);
@@ -1120,16 +1137,6 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG)
b.appendAscii(RTL_CONSTASCII_STRINGPARAM(" "));
b.append(m_noDependencyCurVer);
}
- if (!data.permission) {
- if (b.getLength() == 0) {
- b.append(m_noInstall);
- }
- b.append(LF);
- if (isVista())
- b.append(m_noPermissionVista);
- else
- b.append(m_noPermission);
- }
break;
}
case GENERAL_ERROR:
@@ -1233,10 +1240,10 @@ IMPL_LINK(UpdateDialog, okHandler, void *, EMPTYARG)
typedef ::std::vector<UpdateData>::const_iterator CIT;
for (CIT i = m_enabledUpdates.begin(); i < m_enabledUpdates.end(); i++)
{
- OSL_ASSERT(i->aPackageManager.is());
+ OSL_ASSERT(i->aInstalledPackage.is());
//If the user has no write access to the shared folder then the update
//for a shared extension is disable, that is it cannot be in m_enabledUpdates
- OSL_ASSERT(i->aPackageManager->isReadOnly() == sal_False);
+// OSL_ASSERT(isReadOnly(i->aInstalledPackage) == sal_False);
#if 0
// TODO: check!
OSL_ASSERT(m_extensionManagerDialog.get());
@@ -1248,6 +1255,7 @@ IMPL_LINK(UpdateDialog, okHandler, void *, EMPTYARG)
#endif
}
+
for (USHORT i = 0; i < m_updates.getItemCount(); ++i) {
UpdateDialog::Index const * p =
static_cast< UpdateDialog::Index const * >(
@@ -1256,6 +1264,7 @@ IMPL_LINK(UpdateDialog, okHandler, void *, EMPTYARG)
m_updateData.push_back(m_enabledUpdates[p->index.enabledUpdate]);
}
}
+
EndDialog(RET_OK);
return 0;
}
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
index 483885094a..ddc9cc5b77 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
@@ -60,7 +60,8 @@ class Window;
namespace com { namespace sun { namespace star {
namespace awt { class XThrobber; }
- namespace deployment { class XPackageManager; }
+ namespace deployment { class XExtensionManager;
+ class XPackage; }
namespace uno { class XComponentContext; }
} } }
@@ -82,16 +83,17 @@ public:
@param parent
the parent window, may be null
- @param selectedPackages
- if non-null, only check for updates for the selected packages
-
- @param packageManagers
- if non-null, check for updates for all managed packages
+ @param vExtensionList
+ check for updates for the contained extensions. There must only be one extension with
+ a particular identifier. If one extension is installed in several repositories, then the
+ one with the highest version must be used, because it contains the latest known update
+ information.
*/
UpdateDialog(
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context,
Window * parent,
- const std::vector< dp_gui::TUpdateListEntry > &vExtensionList,
+ const std::vector< com::sun::star::uno::Reference<
+ com::sun::star::deployment::XPackage > > & vExtensionList,
std::vector< dp_gui::UpdateData > * updateData);
~UpdateDialog();
@@ -107,7 +109,7 @@ public:
private:
UpdateDialog(UpdateDialog &); // not defined
void operator =(UpdateDialog &); // not defined
-
+
struct DisabledUpdate;
struct SpecificError;
union IndexUnion;
@@ -141,6 +143,7 @@ private:
UpdateDialog & m_dialog;
};
+
friend class CheckListBox;
void insertItem(
@@ -168,9 +171,14 @@ private:
void initDescription();
void clearDescription();
+ bool showDescription(::com::sun::star::uno::Reference<
+ ::com::sun::star::deployment::XPackage > const & aExtension);
+ bool showDescription(std::pair< rtl::OUString, rtl::OUString > const & pairPublisher,
+ rtl::OUString const & sReleaseNotes);
bool showDescription( ::com::sun::star::uno::Reference<
::com::sun::star::xml::dom::XNode > const & aUpdateInfo);
bool showDescription( const String& rDescription, bool bWithPublisher );
+ bool isReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
DECL_LINK(selectionHandler, void *);
DECL_LINK(allHandler, void *);
@@ -204,8 +212,6 @@ private:
rtl::OUString m_noInstall;
rtl::OUString m_noDependency;
rtl::OUString m_noDependencyCurVer;
- rtl::OUString m_noPermission;
- rtl::OUString m_noPermissionVista;
rtl::OUString m_browserbased;
rtl::OUString m_version;
std::vector< dp_gui::UpdateData > m_enabledUpdates;
@@ -214,6 +220,7 @@ private:
std::vector< UpdateDialog::SpecificError > m_specificErrors;
std::vector< dp_gui::UpdateData > & m_updateData;
rtl::Reference< UpdateDialog::Thread > m_thread;
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager;
Point m_aFirstLinePos;
Size m_aFirstLineSize;
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.src b/desktop/source/deployment/gui/dp_gui_updatedialog.src
index 13af12fc10..59539d55c1 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.src
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.src
@@ -244,18 +244,6 @@ ModalDialog RID_DLG_UPDATE {
String RID_DLG_UPDATE_NODEPENDENCY_CUR_VER {
Text[en-US] = "You have OpenOffice.org %VERSION";
};
- String RID_DLG_UPDATE_NOPERMISSION {
- Text[en-US] = "No write permission (shared extension).";
- };
- String RID_DLG_UPDATE_NOPERMISSION_VISTA {
- Text[en-US] = "No write permission. %PRODUCTNAME needs to run as administrator.\n"
- "Please follow these steps to update this shared extension:\n"
- "1. Close Extension Manager dialog.\n"
- "2. Exit %PRODUCTNAME.\n"
- "3. Exit %PRODUCTNAME Quickstarter located in the tray area of Windows.\n"
- "4. Run %PRODUCTNAME as administrator. In order to do this call the context menu of the %PRODUCTNAME program icon and choose \'Run as administrator\'.\n"
- "5. Call the Extension Manager dialog and update this shared extension.\n";
- };
String RID_DLG_UPDATE_BROWSERBASED {
Text[en-US] = "browser based update";
};
diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
index 7f2d85064c..8f0a262bfc 100644
--- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
@@ -46,6 +46,7 @@
#include "cppuhelper/implbase3.hxx"
#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/beans/NamedValue.hpp"
#include "com/sun/star/xml/dom/XElement.hpp"
#include "com/sun/star/xml/dom/XNode.hpp"
#include "com/sun/star/xml/dom/XNodeList.hpp"
@@ -53,7 +54,8 @@
#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp"
#include "com/sun/star/ucb/XCommandEnvironment.hpp"
#include "com/sun/star/ucb/XProgressHandler.hpp"
-#include "com/sun/star/deployment/XPackageManager.hpp"
+#include "com/sun/star/deployment/XExtensionManager.hpp"
+#include "com/sun/star/deployment/ExtensionManager.hpp"
#include "com/sun/star/deployment/XUpdateInformationProvider.hpp"
#include "com/sun/star/deployment/DependencyException.hpp"
#include "com/sun/star/deployment/LicenseException.hpp"
@@ -256,6 +258,8 @@ UpdateInstallDialog::UpdateInstallDialog(
{
FreeResource();
+ m_xExtensionManager = css::deployment::ExtensionManager::get( xCtx );
+
m_cancel.SetClickHdl(LINK(this, UpdateInstallDialog, cancelHandler));
m_mle_info.EnableCursor(FALSE);
if ( ! dp_misc::office_is_running())
@@ -375,14 +379,13 @@ void UpdateInstallDialog::Thread::downloadExtensions()
for (It i = m_aVecUpdateData.begin(); i != m_aVecUpdateData.end(); i++)
{
UpdateData & curData = *i;
-
- OSL_ASSERT(curData.aUpdateInfo.is());
+
+ if (!curData.aUpdateInfo.is() || curData.aUpdateSource.is())
+ continue;
//We assume that m_aVecUpdateData contains only information about extensions which
//can be downloaded directly.
OSL_ASSERT(curData.sWebsiteURL.getLength() == 0);
-
- if (!curData.aUpdateInfo.is())
- continue;
+
//update the name of the extension which is to be downloaded
{
::vos::OGuard g(Application::GetSolarMutex());
@@ -487,15 +490,13 @@ void UpdateInstallDialog::Thread::installExtensions()
// osl::Thread::wait(v);
bool bError = false;
bool bLicenseDeclined = false;
- cssu::Reference<css::deployment::XPackage> xPackage;
+ cssu::Reference<css::deployment::XPackage> xExtension;
UpdateData & curData = *i;
cssu::Exception exc;
try
{
- if (curData.sLocalURL.getLength() == 0)
- continue;
cssu::Reference< css::task::XAbortChannel > xAbortChannel(
- curData.aPackageManager->createAbortChannel() );
+ curData.aInstalledPackage->createAbortChannel() );
{
vos::OGuard g(Application::GetSolarMutex());
if (m_stop) {
@@ -503,8 +504,35 @@ void UpdateInstallDialog::Thread::installExtensions()
}
m_abort = xAbortChannel;
}
- xPackage = curData.aPackageManager->addPackage(
- curData.sLocalURL, OUString(), xAbortChannel, m_updateCmdEnv.get());
+ if (!curData.aUpdateSource.is() && curData.sLocalURL.getLength())
+ {
+ css::beans::NamedValue prop(OUSTR("EXTENSION_UPDATE"), css::uno::makeAny(OUSTR("1")));
+ if (!curData.bIsShared)
+ xExtension = m_dialog.getExtensionManager()->addExtension(
+ curData.sLocalURL, css::uno::Sequence<css::beans::NamedValue>(&prop, 1),
+ OUSTR("user"), xAbortChannel, m_updateCmdEnv.get());
+ else
+ xExtension = m_dialog.getExtensionManager()->addExtension(
+ curData.sLocalURL, css::uno::Sequence<css::beans::NamedValue>(&prop, 1),
+ OUSTR("shared"), xAbortChannel, m_updateCmdEnv.get());
+ }
+ else if (curData.aUpdateSource.is())
+ {
+ OSL_ASSERT(curData.aUpdateSource.is());
+ //I am not sure if we should obtain the install properties and pass them into
+ //add extension. Currently it contains only "SUPPRESS_LICENSE". So it it could happen
+ //that a license is displayed when updating from the shared repository, although the
+ //shared extension was installed using "SUPPRESS_LICENSE".
+ css::beans::NamedValue prop(OUSTR("EXTENSION_UPDATE"), css::uno::makeAny(OUSTR("1")));
+ if (!curData.bIsShared)
+ xExtension = m_dialog.getExtensionManager()->addExtension(
+ curData.aUpdateSource->getURL(), css::uno::Sequence<css::beans::NamedValue>(&prop, 1),
+ OUSTR("user"), xAbortChannel, m_updateCmdEnv.get());
+ else
+ xExtension = m_dialog.getExtensionManager()->addExtension(
+ curData.aUpdateSource->getURL(), css::uno::Sequence<css::beans::NamedValue>(&prop, 1),
+ OUSTR("shared"), xAbortChannel, m_updateCmdEnv.get());
+ }
}
catch (css::deployment::DeploymentException & de)
{
@@ -533,7 +561,7 @@ void UpdateInstallDialog::Thread::installExtensions()
m_dialog.setError(UpdateInstallDialog::ERROR_LICENSE_DECLINED,
curData.aInstalledPackage->getDisplayName(), OUString());
}
- else if (!xPackage.is() || bError)
+ else if (!xExtension.is() || bError)
{
::vos::OGuard g(Application::GetSolarMutex());
if (m_stop) {
diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx
index b70b8fc59f..73041853d3 100644
--- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx
@@ -41,6 +41,9 @@
#include "dp_gui_autoscrolledit.hxx"
/// @HTML
+namespace com { namespace sun { namespace star { namespace deployment {
+ class XExtensionManager;
+}}}}
namespace com { namespace sun { namespace star { namespace uno {
class XComponentContext;
}}}}
@@ -102,9 +105,12 @@ private:
};
void setError(INSTALL_ERROR err, ::rtl::OUString const & sExtension, ::rtl::OUString const & exceptionMessage);
void setError(::rtl::OUString const & exceptionMessage);
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > getExtensionManager() const
+ { return m_xExtensionManager; }
rtl::Reference< Thread > m_thread;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xComponentContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager;
//Signals that an error occurred during download and installation
bool m_bError;
bool m_bNoEntry;
diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx
index d4eec29b49..c8c79dbdbc 100644
--- a/desktop/source/deployment/gui/license_dialog.cxx
+++ b/desktop/source/deployment/gui/license_dialog.cxx
@@ -116,6 +116,7 @@ struct LicenseDialogImpl : public ModalDialog
LicenseDialogImpl(
Window * pParent,
css::uno::Reference< css::uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & sExtensionName,
const ::rtl::OUString & sLicenseText);
virtual void Activate();
@@ -193,6 +194,7 @@ void LicenseView::Notify( SfxBroadcaster&, const SfxHint& rHint )
LicenseDialogImpl::LicenseDialogImpl(
Window * pParent,
cssu::Reference< cssu::XComponentContext > const & xContext,
+ const ::rtl::OUString & sExtensionName,
const ::rtl::OUString & sLicenseText):
ModalDialog(pParent, DpGuiResId(RID_DLG_LICENSE))
,m_xComponentContext(xContext)
@@ -225,6 +227,7 @@ LicenseDialogImpl::LicenseDialogImpl(
m_fiArrow1.Show(true);
m_fiArrow2.Show(false);
m_mlLicense.SetText(sLicenseText);
+ m_ftHead.SetText(m_ftHead.GetText() + OUString('\n') + sExtensionName);
m_mlLicense.SetEndReachedHdl( LINK(this, LicenseDialogImpl, EndReachedHdl) );
m_mlLicense.SetScrolledHdl( LINK(this, LicenseDialogImpl, ScrolledHdl) );
@@ -296,7 +299,7 @@ LicenseDialog::LicenseDialog( Sequence<Any> const& args,
Reference<XComponentContext> const& xComponentContext)
: m_xComponentContext(xComponentContext)
{
- comphelper::unwrapArgs( args, m_parent, m_sLicenseText );
+ comphelper::unwrapArgs( args, m_parent, m_sExtensionName, m_sLicenseText );
}
// XExecutableDialog
@@ -315,8 +318,10 @@ sal_Int16 LicenseDialog::execute() throw (RuntimeException)
sal_Int16 LicenseDialog::solar_execute()
{
- std::auto_ptr<LicenseDialogImpl> dlg(new LicenseDialogImpl(
- VCLUnoHelper::GetWindow(m_parent), m_xComponentContext, m_sLicenseText));
+ std::auto_ptr<LicenseDialogImpl> dlg(
+ new LicenseDialogImpl(
+ VCLUnoHelper::GetWindow(m_parent),
+ m_xComponentContext, m_sExtensionName, m_sLicenseText));
return dlg->Execute();
}
diff --git a/desktop/source/deployment/gui/license_dialog.hxx b/desktop/source/deployment/gui/license_dialog.hxx
index b24c798da1..1f190298ff 100644
--- a/desktop/source/deployment/gui/license_dialog.hxx
+++ b/desktop/source/deployment/gui/license_dialog.hxx
@@ -48,6 +48,7 @@ class LicenseDialog
{
Reference<XComponentContext> const m_xComponentContext;
Reference<awt::XWindow> /* const */ m_parent;
+ OUString m_sExtensionName;
OUString /* const */ m_sLicenseText;
OUString m_initialTitle;
diff --git a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx
index 5d8356e85c..debdae591f 100644
--- a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx
+++ b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx
@@ -62,6 +62,7 @@ struct DESKTOP_DEPLOYMENTMISC_DLLPUBLIC SimpleLicenseAttributes
bool suppressIfRequired;
};
+
/**
Access to the content of an XML <code>description</code> element.
@@ -216,6 +217,8 @@ public:
*/
::rtl::OUString getIconURL( sal_Bool bHighContrast ) const;
+ bool hasDescription() const;
+
private:
SAL_DLLPRIVATE ::boost::optional< ::rtl::OUString > getOptionalValue(
::rtl::OUString const & expression) const;
@@ -279,6 +282,18 @@ private:
::com::sun::star::xml::xpath::XXPathAPI > m_xpath;
};
+inline bool DescriptionInfoset::hasDescription() const
+{
+ return m_element.is();
+}
+
+/** creates a DescriptionInfoset object.
+
+ The argument sExtensionFolderURL is a file URL to extension folder containing
+ the description.xml.
+ */
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+DescriptionInfoset getDescriptionInfoset(::rtl::OUString const & sExtensionFolderURL);
}
#endif
diff --git a/desktop/source/deployment/inc/dp_misc.h b/desktop/source/deployment/inc/dp_misc.h
index fa3f44654a..b6b127579c 100644
--- a/desktop/source/deployment/inc/dp_misc.h
+++ b/desktop/source/deployment/inc/dp_misc.h
@@ -36,6 +36,7 @@
#include "com/sun/star/lang/XComponent.hpp"
#include "com/sun/star/lang/DisposedException.hpp"
#include "com/sun/star/deployment/XPackageRegistry.hpp"
+#include "com/sun/star/ucb/XCommandEnvironment.hpp"
#include "com/sun/star/awt/XWindow.hpp"
#include "dp_misc_api.hxx"
@@ -69,14 +70,33 @@ inline void try_dispose( ::com::sun::star::uno::Reference< ::com::sun::star::uno
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
::rtl::OUString expandUnoRcTerm( ::rtl::OUString const & term );
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+::rtl::OUString makeRcTerm( ::rtl::OUString const & url );
+
//==============================================================================
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
::rtl::OUString expandUnoRcUrl( ::rtl::OUString const & url );
//==============================================================================
+
+/** appends a relative path to a url.
+
+ The relative path must already be correctly encoded for use in an URL.
+ If the URL starts with vnd.sun.star.expand then the relative path will
+ be again encoded for use in an "expand" URL.
+ */
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString makeURL(
::rtl::OUString const & baseURL, ::rtl::OUString const & relPath );
+
+/** appends a relative path to a url.
+
+ This is the same as makeURL, but the relative Path must me a segment
+ of an system path.
+ */
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString makeURLAppendSysPathSegment(
+ ::rtl::OUString const & baseURL, ::rtl::OUString const & relPath );
+
//==============================================================================
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString generateRandomPipeId();
@@ -97,11 +117,6 @@ oslProcess raiseProcess( ::rtl::OUString const & appURL,
::com::sun::star::uno::Sequence< ::rtl::OUString > const & args );
//==============================================================================
-/** returns the default update URL (for the update information) which
- is used when an extension does not provide its own URL.
-*/
-DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
-::rtl::OUString getExtensionDefaultUpdateURL();
/** writes the argument string to the console.
On Linux/Unix/etc. it converts the UTF16 string to an ANSI string using
@@ -151,6 +166,14 @@ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
void TRACE(::rtl::OUString const & sText);
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
void TRACE(::rtl::OString const & sText);
+
+/** registers or revokes shared or bundled extensions which have been
+ recently added or removed.
+*/
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+void syncRepositories(::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment> const & xCmdEnv);
+
}
#endif
diff --git a/desktop/source/deployment/inc/dp_ucb.h b/desktop/source/deployment/inc/dp_ucb.h
index d70cb0bfa2..1409b27d6a 100644
--- a/desktop/source/deployment/inc/dp_ucb.h
+++ b/desktop/source/deployment/inc/dp_ucb.h
@@ -28,6 +28,7 @@
#if ! defined INCLUDED_DP_UCB_H
#define INCLUDED_DP_UCB_H
+#include <list>
#include "rtl/byteseq.hxx"
#include "rtl/instance.hxx"
#include "com/sun/star/ucb/XCommandEnvironment.hpp"
@@ -79,6 +80,12 @@ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
bool readLine( ::rtl::OUString * res, ::rtl::OUString const & startingWith,
::ucbhelper::Content & ucb_content, rtl_TextEncoding textenc );
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+bool readProperties( ::std::list< ::std::pair< ::rtl::OUString, ::rtl::OUString> > & out_result,
+ ::ucbhelper::Content & ucb_content);
+
+
+
}
#endif
diff --git a/desktop/source/deployment/inc/dp_update.hxx b/desktop/source/deployment/inc/dp_update.hxx
new file mode 100755
index 0000000000..28ca18bd52
--- /dev/null
+++ b/desktop/source/deployment/inc/dp_update.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#if ! defined INCLUDED_DP_UPDATE_HXX
+#define INCLUDED_DP_UPDATE_HXX
+
+
+#include "com/sun/star/deployment/XPackage.hpp"
+#include "com/sun/star/deployment/XExtensionManager.hpp"
+#include "com/sun/star/deployment/XUpdateInformationProvider.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/xml/dom/XNode.hpp"
+
+#include "rtl/ustrbuf.hxx"
+#include "dp_misc_api.hxx"
+
+#include <map>
+#include <vector>
+
+namespace dp_misc {
+
+/** returns the default update URL (for the update information) which
+ is used when an extension does not provide its own URL.
+*/
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+::rtl::OUString getExtensionDefaultUpdateURL();
+
+enum UPDATE_SOURCE
+{
+ UPDATE_SOURCE_NONE,
+ UPDATE_SOURCE_SHARED,
+ UPDATE_SOURCE_BUNDLED,
+ UPDATE_SOURCE_ONLINE
+};
+
+/* determine if an update is available which is installed in the
+ user repository.
+
+ If the return value is UPDATE_SOURCE_NONE, then no update is
+ available, otherwise the return value determine from which the
+ repository the update is used.
+*/
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+UPDATE_SOURCE isUpdateUserExtension(
+ bool bReadOnlyShared,
+ ::rtl::OUString const & userVersion,
+ ::rtl::OUString const & sharedVersion,
+ ::rtl::OUString const & bundledVersion,
+ ::rtl::OUString const & onlineVersion);
+
+/* determine if an update is available which is installed in the
+ shared repository.
+
+ If the return value is UPDATE_SOURCE_NONE, then no update is
+ available, otherwise the return value determine from which the
+ repository the update is used.
+*/
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+UPDATE_SOURCE isUpdateSharedExtension(
+ bool bReadOnlyShared,
+ ::rtl::OUString const & sharedVersion,
+ ::rtl::OUString const & bundledVersion,
+ ::rtl::OUString const & onlineVersion);
+
+/* determines the extension with the highest identifier and returns it
+
+ */
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage>
+getExtensionWithHighestVersion(
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::deployment::XPackage> > const & seqExtensionsWithSameId);
+
+
+struct UpdateInfo
+{
+ UpdateInfo( ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> const & ext);
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::deployment::XPackage> extension;
+//version of the update
+ ::rtl::OUString version;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > info;
+};
+
+typedef std::map< ::rtl::OUString, UpdateInfo > UpdateInfoMap;
+
+/*
+ @param extensionList
+ List of extension for which online update information are to be obtained. If NULL, then
+ for update information are obtained for all installed extension. There may be only one extension
+ with a particular identifier contained in the list. If one extension is installed
+ in several repositories, then the one with the highest version must be used, because it contains
+ the more recent URLs for getting the update information (if at all).
+ @param out_errors
+ the first member of the pair is the extension and the second the exception that was produced
+ when processing the extension.
+
+ @return
+ A map of UpdateInfo instances. If the parameter extensionList was given, then the map contains
+ at only information for those extensions.
+ */
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+UpdateInfoMap getOnlineUpdateInfos(
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const &xContext,
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager> const & xExtMgr,
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XUpdateInformationProvider > const & updateInformation,
+ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > > const * extensionList,
+ ::std::vector< ::std::pair< ::com::sun::star::uno::Reference<
+ ::com::sun::star::deployment::XPackage>, ::com::sun::star::uno::Any> > & out_errors);
+
+/* retunrs the highest version from the provided arguments.
+*/
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+::rtl::OUString getHighestVersion(
+ ::rtl::OUString const & userVersion,
+ ::rtl::OUString const & sharedVersion,
+ ::rtl::OUString const & bundledVersion,
+ ::rtl::OUString const & onlineVersion);
+
+}
+
+#endif
diff --git a/desktop/source/deployment/inc/dp_version.hxx b/desktop/source/deployment/inc/dp_version.hxx
index f3d620f7fa..8e364823a1 100644
--- a/desktop/source/deployment/inc/dp_version.hxx
+++ b/desktop/source/deployment/inc/dp_version.hxx
@@ -43,13 +43,6 @@ enum Order { LESS, EQUAL, GREATER };
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC Order compareVersions(
::rtl::OUString const & version1, ::rtl::OUString const & version2);
-
-DESKTOP_DEPLOYMENTMISC_DLLPUBLIC Order comparePackageVersions(
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage >
- const & package1,
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage >
- const & package2);
-
}
#endif
diff --git a/desktop/source/deployment/makefile.mk b/desktop/source/deployment/makefile.mk
index 173ff35bec..6d83a5c100 100644
--- a/desktop/source/deployment/makefile.mk
+++ b/desktop/source/deployment/makefile.mk
@@ -53,7 +53,6 @@ SHL1VERSIONMAP = $(SOLARENV)/src/component.map
SHL1LIBS = \
$(SLB)$/deployment_manager.lib \
- $(SLB)$/deployment_migration.lib \
$(SLB)$/deployment_registry.lib \
$(SLB)$/deployment_registry_executable.lib \
$(SLB)$/deployment_registry_component.lib \
diff --git a/desktop/source/deployment/manager/dp_activepackages.cxx b/desktop/source/deployment/manager/dp_activepackages.cxx
index b7757bb5ba..f5866cb41a 100644
--- a/desktop/source/deployment/manager/dp_activepackages.cxx
+++ b/desktop/source/deployment/manager/dp_activepackages.cxx
@@ -96,9 +96,27 @@ static char const legacyPrefix[] = "org.openoffice.legacy.";
OSL_ASSERT(i2 >= 0);
d.fileName = ::rtl::OUString(
value.getStr() + i1 + 1, i2 - i1 - 1, RTL_TEXTENCODING_UTF8);
- d.mediaType = ::rtl::OUString(
- value.getStr() + i2 + 1, value.getLength() - i2 - 1,
- RTL_TEXTENCODING_UTF8);
+ sal_Int32 i3 = value.indexOf(separator, i2 + 1);
+
+ if (i3 < 0)
+ {
+ //Before ActivePackages::Data::version was added
+ d.mediaType = ::rtl::OUString(
+ value.getStr() + i2 + 1, value.getLength() - i2 - 1,
+ RTL_TEXTENCODING_UTF8);
+ }
+ else
+ {
+ sal_Int32 i4 = value.indexOf(separator, i3 + 1);
+ d.mediaType = ::rtl::OUString(
+ value.getStr() + i2 + 1, i3 - i2 -1, RTL_TEXTENCODING_UTF8);
+ d.version = ::rtl::OUString(
+ value.getStr() + i3 + 1, i4 - i3 - 1,
+ RTL_TEXTENCODING_UTF8);
+ d.failedPrerequisites = ::rtl::OUString(
+ value.getStr() + i4 + 1, value.getLength() - i4 - 1,
+ RTL_TEXTENCODING_UTF8);
+ }
return d;
}
@@ -172,6 +190,10 @@ void ActivePackages::put(::rtl::OUString const & id, Data const & data) {
b.append(::rtl::OUStringToOString(data.fileName, RTL_TEXTENCODING_UTF8));
b.append(separator);
b.append(::rtl::OUStringToOString(data.mediaType, RTL_TEXTENCODING_UTF8));
+ b.append(separator);
+ b.append(::rtl::OUStringToOString(data.version, RTL_TEXTENCODING_UTF8));
+ b.append(separator);
+ b.append(::rtl::OUStringToOString(data.failedPrerequisites, RTL_TEXTENCODING_UTF8));
m_map.put(newKey(id), b.makeStringAndClear());
}
diff --git a/desktop/source/deployment/manager/dp_activepackages.hxx b/desktop/source/deployment/manager/dp_activepackages.hxx
index 76b42ae801..be2c3a20e0 100644
--- a/desktop/source/deployment/manager/dp_activepackages.hxx
+++ b/desktop/source/deployment/manager/dp_activepackages.hxx
@@ -42,9 +42,28 @@ namespace dp_manager {
class ActivePackages {
public:
struct Data {
+ Data(): failedPrerequisites(::rtl::OUString::valueOf((sal_Int32)0))
+ {}
+ /* name of the temporary file (shared, user extension) or the name of
+ the folder of the bundled extension.
+ It does not contain the trailing '_' of the folder.
+ UTF-8 encoded
+ */
::rtl::OUString temporaryName;
+ /* The file name (shared, user) or the folder name (bundled)
+ If the key is the file name, then file name is not encoded.
+ If the key is the idendifier then the file name is UTF-8 encoded.
+ */
::rtl::OUString fileName;
::rtl::OUString mediaType;
+ ::rtl::OUString version;
+ /* If this string contains the value according to
+ com::sun::star::deployment::Prerequisites or "0". That is, if
+ the value is > 0 then
+ the call to XPackage::checkPrerequisites failed.
+ In this case the extension must not be registered.
+ */
+ ::rtl::OUString failedPrerequisites;
};
typedef ::std::vector< ::std::pair< ::rtl::OUString, Data > > Entries;
diff --git a/desktop/source/deployment/manager/dp_commandenvironments.cxx b/desktop/source/deployment/manager/dp_commandenvironments.cxx
new file mode 100644
index 0000000000..789cac177b
--- /dev/null
+++ b/desktop/source/deployment/manager/dp_commandenvironments.cxx
@@ -0,0 +1,286 @@
+/*************************************************************************
+ *
+ * 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_desktop.hxx"
+
+#include "com/sun/star/deployment/VersionException.hpp"
+#include "com/sun/star/deployment/LicenseException.hpp"
+#include "com/sun/star/deployment/InstallException.hpp"
+#include "com/sun/star/task/XInteractionApprove.hpp"
+#include "com/sun/star/task/XInteractionAbort.hpp"
+#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/ucb/XCommandEnvironment.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "dp_commandenvironments.hxx"
+
+namespace deployment = com::sun::star::deployment;
+namespace lang = com::sun::star::lang;
+namespace task = com::sun::star::task;
+namespace ucb = com::sun::star::ucb;
+namespace uno = com::sun::star::uno;
+namespace css = com::sun::star;
+
+#define OUSTR(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+namespace dp_manager {
+
+BaseCommandEnv::BaseCommandEnv()
+{
+}
+
+BaseCommandEnv::BaseCommandEnv(
+ Reference< task::XInteractionHandler> const & handler)
+ : m_forwardHandler(handler)
+{
+}
+
+BaseCommandEnv::~BaseCommandEnv()
+{
+}
+// XCommandEnvironment
+//______________________________________________________________________________
+Reference<task::XInteractionHandler> BaseCommandEnv::getInteractionHandler()
+throw (uno::RuntimeException)
+{
+ return this;
+}
+
+//______________________________________________________________________________
+Reference<ucb::XProgressHandler> BaseCommandEnv::getProgressHandler()
+throw (uno::RuntimeException)
+{
+ return this;
+}
+
+void BaseCommandEnv::handle(
+ Reference< task::XInteractionRequest> const & /*xRequest*/ )
+ throw (uno::RuntimeException)
+{
+}
+
+void BaseCommandEnv::handle_(bool approve, bool abort,
+ Reference< task::XInteractionRequest> const & xRequest )
+{
+ if (approve == false && abort == false)
+ {
+ //not handled so far -> forwarding
+ if (m_forwardHandler.is())
+ m_forwardHandler->handle(xRequest);
+ else
+ return; //cannot handle
+ }
+ else
+ {
+ // select:
+ uno::Sequence< Reference< task::XInteractionContinuation > > conts(
+ xRequest->getContinuations() );
+ Reference< task::XInteractionContinuation > const * pConts =
+ conts.getConstArray();
+ sal_Int32 len = conts.getLength();
+ for ( sal_Int32 pos = 0; pos < len; ++pos )
+ {
+ if (approve) {
+ Reference< task::XInteractionApprove > xInteractionApprove(
+ pConts[ pos ], uno::UNO_QUERY );
+ if (xInteractionApprove.is()) {
+ xInteractionApprove->select();
+ // don't query again for ongoing continuations:
+ approve = false;
+ }
+ }
+ else if (abort) {
+ Reference< task::XInteractionAbort > xInteractionAbort(
+ pConts[ pos ], uno::UNO_QUERY );
+ if (xInteractionAbort.is()) {
+ xInteractionAbort->select();
+ // don't query again for ongoing continuations:
+ abort = false;
+ }
+ }
+ }
+ }
+
+}
+
+// XProgressHandler
+void BaseCommandEnv::push( uno::Any const & /*Status*/ )
+throw (uno::RuntimeException)
+{
+}
+
+
+void BaseCommandEnv::update( uno::Any const & /*Status */)
+throw (uno::RuntimeException)
+{
+}
+
+void BaseCommandEnv::pop() throw (uno::RuntimeException)
+{
+}
+//==============================================================================
+
+TmpRepositoryCommandEnv::TmpRepositoryCommandEnv()
+{
+}
+
+TmpRepositoryCommandEnv::TmpRepositoryCommandEnv(
+ css::uno::Reference< css::task::XInteractionHandler> const & handler):
+ BaseCommandEnv(handler)
+{
+}
+// XInteractionHandler
+void TmpRepositoryCommandEnv::handle(
+ Reference< task::XInteractionRequest> const & xRequest )
+ throw (uno::RuntimeException)
+{
+ uno::Any request( xRequest->getRequest() );
+ OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION );
+
+ deployment::VersionException verExc;
+ deployment::LicenseException licExc;
+ deployment::InstallException instExc;
+
+ bool approve = false;
+ bool abort = false;
+
+ if ((request >>= verExc)
+ || (request >>= licExc)
+ || (request >>= instExc))
+ {
+ approve = true;
+ }
+
+ handle_(approve, abort, xRequest);
+}
+//================================================================================
+
+LicenseCommandEnv::LicenseCommandEnv(
+ css::uno::Reference< css::task::XInteractionHandler> const & handler,
+ bool bSuppressLicense,
+ OUString const & repository):
+ BaseCommandEnv(handler), m_repository(repository),
+ m_bSuppressLicense(bSuppressLicense)
+{
+}
+// XInteractionHandler
+void LicenseCommandEnv::handle(
+ Reference< task::XInteractionRequest> const & xRequest )
+ throw (uno::RuntimeException)
+{
+ uno::Any request( xRequest->getRequest() );
+ OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION );
+
+
+ deployment::LicenseException licExc;
+
+ bool approve = false;
+ bool abort = false;
+
+ if (request >>= licExc)
+ {
+ if (m_bSuppressLicense
+ || m_repository.equals(OUSTR("bundled"))
+ || licExc.AcceptBy.equals(OUSTR("admin")))
+ {
+ //always approve in bundled case, because we do not support
+ //showing licenses anyway.
+ //The "admin" already accepted the license when installing the
+ // shared extension
+ approve = true;
+ }
+ }
+
+ handle_(approve, abort, xRequest);
+}
+
+//================================================================================
+//================================================================================
+
+NoLicenseCommandEnv::NoLicenseCommandEnv(
+ css::uno::Reference< css::task::XInteractionHandler> const & handler):
+ BaseCommandEnv(handler)
+{
+}
+// XInteractionHandler
+void NoLicenseCommandEnv::handle(
+ Reference< task::XInteractionRequest> const & xRequest )
+ throw (uno::RuntimeException)
+{
+ uno::Any request( xRequest->getRequest() );
+ OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION );
+
+
+ deployment::LicenseException licExc;
+
+ bool approve = false;
+ bool abort = false;
+
+ if (request >>= licExc)
+ {
+ approve = true;
+ }
+ handle_(approve, abort, xRequest);
+}
+
+
+// NoExceptionCommandEnv::NoExceptionCommandEnv(
+// css::uno::Reference< css::task::XInteractionHandler> const & handler,
+// css::uno::Type const & type):
+// BaseCommandEnv(handler),
+// m_type(type)
+// {
+// }
+// // XInteractionHandler
+// void NoExceptionCommandEnv::handle(
+// Reference< task::XInteractionRequest> const & xRequest )
+// throw (uno::RuntimeException)
+// {
+// uno::Any request( xRequest->getRequest() );
+// OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION );
+
+
+// deployment::LicenseException licExc;
+
+// bool approve = false;
+// bool abort = false;
+
+// if (request.getValueType() == m_type)
+// {
+// approve = true;
+// }
+// handle_(approve, abort, xRequest);
+// }
+
+
+
+} // namespace dp_manager
+
+
diff --git a/desktop/source/deployment/manager/dp_commandenvironments.hxx b/desktop/source/deployment/manager/dp_commandenvironments.hxx
new file mode 100644
index 0000000000..702b1b331f
--- /dev/null
+++ b/desktop/source/deployment/manager/dp_commandenvironments.hxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#if ! defined INCLUDED_DP_COMMANDENVIRONMENTS_HXX
+#define INCLUDED_DP_COMMANDENVIRONMENTS_HXX
+
+
+#include "cppuhelper/compbase3.hxx"
+//#include "cppuhelper/implbase2.hxx"
+#include "ucbhelper/content.hxx"
+#include "com/sun/star/uno/Type.hxx"
+
+
+namespace css = ::com::sun::star;
+
+namespace dp_manager {
+
+
+
+/**
+ This command environment is to be used when an extension is temporarily
+ stored in the "tmp" repository. It prevents all kind of user interaction.
+ */
+class BaseCommandEnv
+ : public ::cppu::WeakImplHelper3< css::ucb::XCommandEnvironment,
+ css::task::XInteractionHandler,
+ css::ucb::XProgressHandler >
+{
+protected:
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Reference< css::task::XInteractionHandler> m_forwardHandler;
+
+ void handle_(bool approve, bool abort,
+ css::uno::Reference< css::task::XInteractionRequest> const & xRequest );
+public:
+ virtual ~BaseCommandEnv();
+ BaseCommandEnv();
+ BaseCommandEnv(
+ css::uno::Reference< css::task::XInteractionHandler> const & handler);
+
+ // XCommandEnvironment
+ virtual css::uno::Reference<css::task::XInteractionHandler > SAL_CALL
+ getInteractionHandler() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference<css::ucb::XProgressHandler >
+ SAL_CALL getProgressHandler() throw (css::uno::RuntimeException);
+
+ // XInteractionHandler
+ virtual void SAL_CALL handle(
+ css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
+ throw (css::uno::RuntimeException);
+
+ // XProgressHandler
+ virtual void SAL_CALL push( css::uno::Any const & Status )
+ throw (css::uno::RuntimeException);
+ virtual void SAL_CALL update( css::uno::Any const & Status )
+ throw (css::uno::RuntimeException);
+ virtual void SAL_CALL pop() throw (css::uno::RuntimeException);
+};
+
+class TmpRepositoryCommandEnv : public BaseCommandEnv
+{
+public:
+ TmpRepositoryCommandEnv();
+ TmpRepositoryCommandEnv(css::uno::Reference< css::task::XInteractionHandler> const & handler);
+
+// XInteractionHandler
+ virtual void SAL_CALL handle(
+ css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
+ throw (css::uno::RuntimeException);
+
+};
+
+/** this class is for use in XPackageManager::synchronize.
+
+ It handles particular license cases.
+ */
+class LicenseCommandEnv : public BaseCommandEnv
+{
+private:
+ ::rtl::OUString m_repository;
+ bool m_bSuppressLicense;
+public:
+ LicenseCommandEnv(){};
+ LicenseCommandEnv(
+ css::uno::Reference< css::task::XInteractionHandler> const & handler,
+ bool bSuppressLicense,
+ ::rtl::OUString const & repository);
+
+// XInteractionHandler
+ virtual void SAL_CALL handle(
+ css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
+ throw (css::uno::RuntimeException);
+
+};
+
+/** this class is for use in XPackageManager::checkPrerequisites
+
+ It always prohibits a license interaction
+ */
+class NoLicenseCommandEnv : public BaseCommandEnv
+{
+
+public:
+ NoLicenseCommandEnv(){};
+ NoLicenseCommandEnv(css::uno::Reference< css::task::XInteractionHandler> const & handler);
+
+// XInteractionHandler
+ virtual void SAL_CALL handle(
+ css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
+ throw (css::uno::RuntimeException);
+
+};
+
+// class NoExceptionCommandEnv : public BaseCommandEnv
+// {
+// css::uno::Type m_type;
+// public:
+// NoExceptionCommandEnv::NoExceptionCommandEnv(){};
+// NoExceptionCommandEnv::NoExceptionCommandEnv(
+// css::uno::Reference< css::task::XInteractionHandler> const & handler,
+// css::uno::Type const & type);
+
+// // XInteractionHandler
+// virtual void SAL_CALL handle(
+// css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
+// throw (css::uno::RuntimeException);
+
+// };
+
+}
+
+
+
+
+#endif
+
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
new file mode 100644
index 0000000000..3cf6e48595
--- /dev/null
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -0,0 +1,1361 @@
+/*************************************************************************
+ *
+ * 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_desktop.hxx"
+
+#include <cppuhelper/implbase1.hxx>
+
+#include "comphelper/servicedecl.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+#include "rtl/bootstrap.hxx"
+#include "com/sun/star/deployment/ExtensionManager.hpp"
+#include "com/sun/star/deployment/XExtensionManager.hpp"
+#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
+#include "com/sun/star/deployment/XPackageManager.hpp"
+#include "com/sun/star/deployment/XPackageManagerFactory.hpp"
+#include "com/sun/star/deployment/XPackage.hpp"
+#include "com/sun/star/deployment/InstallException.hpp"
+#include "com/sun/star/deployment/VersionException.hpp"
+#include "com/sun/star/deployment/LicenseException.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/registry/XRegistryKey.hpp"
+#include "com/sun/star/beans/Optional.hpp"
+#include "com/sun/star/task/XInteractionApprove.hpp"
+#include "com/sun/star/beans/Ambiguous.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/io/XInputStream.hpp"
+#include "com/sun/star/util/XModifyBroadcaster.hpp"
+#include "comphelper/sequence.hxx"
+#include "xmlscript/xml_helper.hxx"
+#include "osl/diagnose.h"
+#include "dp_interact.h"
+#include "dp_resource.h"
+#include "dp_ucb.h"
+#include "dp_identifier.hxx"
+#include "dp_descriptioninfoset.hxx"
+#include "dp_extensionmanager.hxx"
+#include "dp_commandenvironments.hxx"
+#include "dp_properties.hxx"
+#include "boost/bind.hpp"
+
+#include <list>
+#include <hash_map>
+#include <algorithm>
+
+namespace deploy = com::sun::star::deployment;
+namespace lang = com::sun::star::lang;
+namespace registry = com::sun::star::registry;
+namespace task = com::sun::star::task;
+namespace ucb = com::sun::star::ucb;
+namespace uno = com::sun::star::uno;
+namespace beans = com::sun::star::beans;
+namespace util = com::sun::star::util;
+namespace css = com::sun::star;
+
+
+//#define OUSTR(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+namespace {
+
+struct CompIdentifiers
+{
+ bool operator() (::std::vector<Reference<deploy::XPackage> > const & a,
+ ::std::vector<Reference<deploy::XPackage> > const & b)
+ {
+
+ if (getName(a).compareTo(getName(b)) < 0)
+ return true;
+ return false;
+ }
+
+ OUString getName(::std::vector<Reference<deploy::XPackage> > const & a);
+};
+
+OUString CompIdentifiers::getName(::std::vector<Reference<deploy::XPackage> > const & a)
+{
+ OSL_ASSERT(a.size() == 3);
+ //get the first non-null reference
+ Reference<deploy::XPackage> extension;
+ ::std::vector<Reference<deploy::XPackage> >::const_iterator it = a.begin();
+ for (; it != a.end(); it++)
+ {
+ if (it->is())
+ {
+ extension = *it;
+ break;
+ }
+ }
+ OSL_ASSERT(extension.is());
+ return extension->getDisplayName();
+}
+
+void writeLastModified(OUString & url, Reference<ucb::XCommandEnvironment> const & xCmdEnv)
+{
+ //Write the lastmodified file
+ try {
+ ::rtl::Bootstrap::expandMacros(url);
+ ::ucbhelper::Content ucbStamp(url, xCmdEnv );
+ dp_misc::erase_path( url, xCmdEnv );
+ ::rtl::OString stamp("1" );
+ Reference<css::io::XInputStream> xData(
+ ::xmlscript::createInputStream(
+ ::rtl::ByteSequence(
+ reinterpret_cast<sal_Int8 const *>(stamp.getStr()),
+ stamp.getLength() ) ) );
+ ucbStamp.writeStream( xData, true /* replace existing */ );
+ }
+ catch(...)
+ {
+ uno::Any exc(::cppu::getCaughtException());
+ throw deploy::DeploymentException(
+ OUSTR("Failed to update") + url, 0, exc);
+ }
+}
+} //end namespace
+
+namespace dp_manager {
+
+
+
+//------------------------------------------------------------------------------
+
+//ToDo: bundled extension
+ExtensionManager::ExtensionManager( Reference< uno::XComponentContext > const& xContext) :
+ ::cppu::WeakComponentImplHelper1< css::deployment::XExtensionManager >(getMutex()),
+ m_xContext( xContext )
+{
+ Reference<deploy::XPackageManagerFactory> xPackageManagerFactory(
+ deploy::thePackageManagerFactory::get(m_xContext));
+ m_userRepository = xPackageManagerFactory->getPackageManager(OUSTR("user"));
+ m_sharedRepository = xPackageManagerFactory->getPackageManager(OUSTR("shared"));
+ m_bundledRepository = xPackageManagerFactory->getPackageManager(OUSTR("bundled"));
+ m_tmpRepository = xPackageManagerFactory->getPackageManager(OUSTR("tmp"));
+
+ m_repositoryNames.push_back(OUSTR("user"));
+ m_repositoryNames.push_back(OUSTR("shared"));
+ m_repositoryNames.push_back(OUSTR("bundled"));
+}
+
+//------------------------------------------------------------------------------
+
+ExtensionManager::~ExtensionManager()
+{
+}
+
+Reference<task::XAbortChannel> ExtensionManager::createAbortChannel()
+ throw (uno::RuntimeException)
+{
+ return new dp_misc::AbortChannel;
+}
+
+css::uno::Reference<css::deployment::XPackageManager>
+ExtensionManager::getPackageManager(::rtl::OUString const & repository)
+ throw (css::lang::IllegalArgumentException)
+{
+ Reference<deploy::XPackageManager> xPackageManager;
+ if (repository.equals(OUSTR("user")))
+ xPackageManager = m_userRepository;
+ else if (repository.equals(OUSTR("shared")))
+ xPackageManager = m_sharedRepository;
+ else if (repository.equals(OUSTR("bundled")))
+ xPackageManager = m_bundledRepository;
+ else
+ throw lang::IllegalArgumentException(
+ OUSTR("No valid repository name provided."),
+ static_cast<cppu::OWeakObject*>(this), 0);
+ return xPackageManager;
+}
+
+
+/*
+ Enters the XPackage objects into a map. They must be all from the
+ same repository. The value type of the map is a vector, where each vector
+ represents an extension with a particular identifier. The first member
+ is represents the user extension, the second the shared extension and the
+ third the bundled extension.
+ */
+void ExtensionManager::addExtensionsToMap(
+ id2extensions & mapExt,
+ uno::Sequence<Reference<deploy::XPackage> > const & seqExt,
+ OUString const & repository)
+{
+ //Determine the index in the vector where these extensions are to be
+ //added.
+ ::std::list<OUString>::const_iterator citNames =
+ m_repositoryNames.begin();
+ int index = 0;
+ for (;citNames != m_repositoryNames.end(); citNames++, index++)
+ {
+ if (citNames->equals(repository))
+ break;
+ }
+
+ for (int i = 0; i < seqExt.getLength(); i++)
+ {
+ Reference<deploy::XPackage> const & xExtension = seqExt[i];
+ OUString id = dp_misc::getIdentifier(xExtension);
+ id2extensions::iterator ivec = mapExt.find(id);
+ if (ivec == mapExt.end())
+ {
+ ::std::vector<Reference<deploy::XPackage> > vec(3);
+ vec[index] = xExtension;
+ mapExt[id] = vec;
+ }
+ else
+ {
+ ivec->second[index] = xExtension;
+ }
+ }
+}
+
+/*
+ returns a list containing extensions with the same identifier from
+ all repositories (user, shared, bundled) If one repository does not
+ have this extension, then the list contains an empty Referenc. The list
+ is ordered according to the priority of the repostories:
+ 1. user
+ 2. shared
+ 3. bundled
+
+ The number of elements is always three, unless the number of repository
+ changes.
+ */
+::std::list<Reference<deploy::XPackage> >
+ ExtensionManager::getExtensionsWithSameId(
+ OUString const & identifier, OUString const & fileName,
+ Reference< ucb::XCommandEnvironment> const & /*xCmdEnv*/)
+
+{
+ ::std::list<Reference<deploy::XPackage> > extensionList;
+ try
+ { //will throw an exception if the extension does not exist
+ extensionList.push_back(m_userRepository->getDeployedPackage(
+ identifier, fileName, Reference<ucb::XCommandEnvironment>()));
+ } catch(lang::IllegalArgumentException &)
+ {
+ extensionList.push_back(Reference<deploy::XPackage>());
+ }
+ try
+ {
+ extensionList.push_back(m_sharedRepository->getDeployedPackage(
+ identifier, fileName, Reference<ucb::XCommandEnvironment>()));
+ } catch (lang::IllegalArgumentException &)
+ {
+ extensionList.push_back(Reference<deploy::XPackage>());
+ }
+ try
+ {
+ extensionList.push_back(m_bundledRepository->getDeployedPackage(
+ identifier, fileName, Reference<ucb::XCommandEnvironment>()));
+ } catch (lang::IllegalArgumentException &)
+ {
+ extensionList.push_back(Reference<deploy::XPackage>());
+ }
+ OSL_ASSERT(extensionList.size() == 3);
+ return extensionList;
+}
+
+uno::Sequence<Reference<deploy::XPackage> >
+ExtensionManager::getExtensionsWithSameIdentifier(
+ OUString const & identifier,
+ OUString const & fileName,
+ Reference< ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (
+ deploy::DeploymentException,
+ ucb::CommandFailedException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ try
+ {
+ ::std::list<Reference<deploy::XPackage> > listExtensions =
+ getExtensionsWithSameId(
+ identifier, fileName, xCmdEnv);
+ sal_Bool bHasExtension = false;
+
+ //throw an IllegalArgumentException if there is no extension at all.
+ typedef ::std::list<Reference<deploy::XPackage> >::const_iterator CIT;
+ for (CIT i = listExtensions.begin(); i != listExtensions.end(); i++)
+ bHasExtension |= i->is();
+ if (!bHasExtension)
+ throw lang::IllegalArgumentException(
+ OUSTR("Could not find extension: ") + identifier + OUSTR(", ") + fileName,
+ static_cast<cppu::OWeakObject*>(this), -1);
+
+ return comphelper::containerToSequence<
+ Reference<deploy::XPackage>,
+ ::std::list<Reference<deploy::XPackage> >
+ > (listExtensions);
+ }
+ catch (deploy::DeploymentException & )
+ {
+ throw;
+ }
+ catch ( ucb::CommandFailedException & )
+ {
+ throw;
+ }
+ catch (lang::IllegalArgumentException &)
+ {
+ throw;
+ }
+ catch (...)
+ {
+ uno::Any exc = ::cppu::getCaughtException();
+ throw deploy::DeploymentException(
+ OUSTR("Extension Manager: exception during getExtensionsWithSameIdentifier"),
+ static_cast<OWeakObject*>(this), exc);
+ }
+}
+
+
+
+bool ExtensionManager::isUserDisabled(
+ OUString const & identifier, OUString const & fileName)
+{
+ ::std::list<Reference<deploy::XPackage> > listExtensions;
+
+ try {
+ listExtensions = getExtensionsWithSameId(identifier, fileName);
+ } catch (lang::IllegalArgumentException & ) {
+ }
+ OSL_ASSERT(listExtensions.size() == 3);
+
+ return isUserDisabled( ::comphelper::containerToSequence<
+ Reference<deploy::XPackage>,
+ ::std::list<Reference<deploy::XPackage> >
+ > (listExtensions));
+}
+
+bool ExtensionManager::isUserDisabled(
+ uno::Sequence<Reference<deploy::XPackage> > const & seqExtSameId)
+{
+ OSL_ASSERT(seqExtSameId.getLength() == 3);
+ Reference<deploy::XPackage> const & userExtension = seqExtSameId[0];
+ if (userExtension.is())
+ {
+ beans::Optional<beans::Ambiguous<sal_Bool> > reg =
+ userExtension->isRegistered(Reference<task::XAbortChannel>(),
+ Reference<ucb::XCommandEnvironment>());
+ //If the value is ambiguous is than we assume that the extension
+ //is enabled, but something went wrong during enabling. We do not
+ //automatically disable user extensions.
+ if (reg.IsPresent &&
+ ! reg.Value.IsAmbiguous && ! reg.Value.Value)
+ return true;
+ }
+ return false;
+}
+
+/*
+ This method determines the active extension (XPackage.registerPackage) with a
+ particular identifier.
+
+ The parameter bUserDisabled determines if the user extension is disabled.
+
+ When the user repository contains an extension with the given identifier and
+ it is not disabled by the user, then it is always registered. Otherwise an
+ extension is only registered when there is no registered extension in one of
+ the repositories with a higher priority. That is, if the extension is from
+ the shared repository and an active extension with the same identifer is in
+ the user repository, then the extension is not registered. Similarly a
+ bundled extension is not registered if there is an active extension with the
+ same identifier in the shared or user repository.
+*/
+void ExtensionManager::activateExtension(
+ OUString const & identifier, OUString const & fileName,
+ bool bUserDisabled,
+ bool bStartup,
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+{
+ ::std::list<Reference<deploy::XPackage> > listExtensions;
+ try {
+ listExtensions = getExtensionsWithSameId(identifier, fileName);
+ } catch (lang::IllegalArgumentException &) {
+ }
+ OSL_ASSERT(listExtensions.size() == 3);
+
+ activateExtension(
+ ::comphelper::containerToSequence<
+ Reference<deploy::XPackage>,
+ ::std::list<Reference<deploy::XPackage> >
+ > (listExtensions),
+ bUserDisabled, bStartup, xAbortChannel, xCmdEnv);
+
+ fireModified();
+}
+
+void ExtensionManager::activateExtension(
+ uno::Sequence<Reference<deploy::XPackage> > const & seqExt,
+ bool bUserDisabled,
+ bool bStartup,
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+{
+ bool bActive = false;
+ sal_Int32 len = seqExt.getLength();
+ for (sal_Int32 i = 0; i < len; i++)
+ {
+ Reference<deploy::XPackage> const & aExt = seqExt[i];
+ if (aExt.is())
+ {
+ //get the registration value of the current iteration
+ beans::Optional<beans::Ambiguous<sal_Bool> > optReg =
+ aExt->isRegistered(xAbortChannel, xCmdEnv);
+ //If nothing can be registered then break
+ if (!optReg.IsPresent)
+ break;
+
+ //Check if this is a disabled user extension,
+ if (i == 0 && bUserDisabled)
+ {
+ aExt->revokePackage(xAbortChannel, xCmdEnv);
+ continue;
+ }
+
+ //If we have already determined an active extension then we must
+ //make sure to unregister all extensions with the same id in
+ //repositories with a lower priority
+ if (bActive)
+ {
+ aExt->revokePackage(xAbortChannel, xCmdEnv);
+ }
+ else
+ {
+ //This is the first extension in the ordered list, which becomes
+ //the active extension
+ bActive = true;
+ //Register if not already done.
+ //reregister if the value is ambiguous, which indicates that
+ //something went wrong during last registration.
+ aExt->registerPackage(bStartup, xAbortChannel, xCmdEnv);
+ }
+ }
+ }
+}
+
+Reference<deploy::XPackage> ExtensionManager::backupExtension(
+ OUString const & identifier, OUString const & fileName,
+ Reference<deploy::XPackageManager> const & xPackageManager,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+{
+ Reference<deploy::XPackage> xBackup;
+ Reference<ucb::XCommandEnvironment> tmpCmdEnv(
+ new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler()));
+ Reference<deploy::XPackage> xOldExtension;
+ xOldExtension = xPackageManager->getDeployedPackage(
+ identifier, fileName, tmpCmdEnv);
+
+ if (xOldExtension.is())
+ {
+ xBackup = m_tmpRepository->addPackage(
+ xOldExtension->getURL(), uno::Sequence<beans::NamedValue>(),
+ OUString(), Reference<task::XAbortChannel>(), tmpCmdEnv);
+
+ OSL_ENSURE(xBackup.is(), "Failed to backup extension");
+ }
+ return xBackup;
+}
+
+//The supported package types are actually determined by the registry. However
+//creating a registry
+//(desktop/source/deployment/registry/dp_registry.cxx:PackageRegistryImpl) will
+//create all the backends, so that the registry can obtain from them the package
+//types. Creating the registry will also set up the registry folder containing
+//all the subfolders for the respective backends.
+//Because all repositories support the same backends, we can just delegate this
+//call to one of the repositories.
+uno::Sequence< Reference<deploy::XPackageTypeInfo> >
+ExtensionManager::getSupportedPackageTypes()
+ throw (uno::RuntimeException)
+{
+ return m_userRepository->getSupportedPackageTypes();
+}
+
+// Only add to shared and user repository
+Reference<deploy::XPackage> ExtensionManager::addExtension(
+ OUString const & url, uno::Sequence<beans::NamedValue> const & properties,
+ OUString const & repository,
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (deploy::DeploymentException,
+ ucb::CommandFailedException,
+ ucb::CommandAbortedException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ Reference<deploy::XPackage> xNewExtension;
+ //Determine the repository to use
+ Reference<deploy::XPackageManager> xPackageManager;
+ if (repository.equals(OUSTR("user")))
+ xPackageManager = m_userRepository;
+ else if (repository.equals(OUSTR("shared")))
+ xPackageManager = m_sharedRepository;
+ else
+ throw lang::IllegalArgumentException(
+ OUSTR("No valid repository name provided."),
+ static_cast<cppu::OWeakObject*>(this), 0);
+ ::osl::MutexGuard guard(getMutex());
+ Reference<deploy::XPackage> xTmpExtension =
+ getTempExtension(url, xAbortChannel, xCmdEnv);
+ const OUString sIdentifier = dp_misc::getIdentifier(xTmpExtension);
+ const OUString sFileName = xTmpExtension->getName();
+ const OUString sDisplayName = xTmpExtension->getDisplayName();
+ const OUString sVersion = xTmpExtension->getVersion();
+ dp_misc::DescriptionInfoset info(dp_misc::getDescriptionInfoset(xTmpExtension->getURL()));
+ const ::boost::optional<dp_misc::SimpleLicenseAttributes> licenseAttributes =
+ info.getSimpleLicenseAttributes();
+ Reference<deploy::XPackage> xOldExtension;
+ Reference<deploy::XPackage> xExtensionBackup;
+
+ uno::Any excOccurred1;
+ uno::Any excOccurred2;
+ bool bUserDisabled = false;
+ try
+ {
+ bUserDisabled = isUserDisabled(sIdentifier, sFileName);
+ try
+ {
+ xOldExtension = xPackageManager->getDeployedPackage(
+ sIdentifier, sFileName, xCmdEnv);
+ }
+ catch (lang::IllegalArgumentException &)
+ {
+ }
+ bool bCanInstall = false;
+ try
+ {
+ if (xOldExtension.is())
+ {
+ //throws a CommandFailedException if the user cancels
+ //the action.
+ checkUpdate(sVersion, sDisplayName,xOldExtension, xCmdEnv);
+ }
+ else
+ {
+ //throws a CommandFailedException if the user cancels
+ //the action.
+ checkInstall(sDisplayName, xCmdEnv);
+ }
+ //Prevent showing the license if requested.
+ Reference<ucb::XCommandEnvironment> _xCmdEnv(xCmdEnv);
+ ExtensionProperties props(OUString(), properties, Reference<ucb::XCommandEnvironment>());
+ if (licenseAttributes && licenseAttributes->suppressIfRequired
+ && props.isSuppressedLicense())
+ _xCmdEnv = Reference<ucb::XCommandEnvironment>(
+ new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler()));
+
+ bCanInstall = xTmpExtension->checkPrerequisites(
+ xAbortChannel, _xCmdEnv, xOldExtension.is() || props.isExtensionUpdate()) == 0 ? true : false;
+ }
+ catch (deploy::DeploymentException& ) {
+ excOccurred1 = ::cppu::getCaughtException();
+ } catch (ucb::CommandFailedException & ) {
+ excOccurred1 = ::cppu::getCaughtException();
+ } catch (ucb::CommandAbortedException & ) {
+ excOccurred1 = ::cppu::getCaughtException();
+ } catch (lang::IllegalArgumentException &) {
+ excOccurred1 = ::cppu::getCaughtException();
+ } catch (uno::RuntimeException &) {
+ excOccurred1 = ::cppu::getCaughtException();
+ } catch (...) {
+ excOccurred1 = ::cppu::getCaughtException();
+ deploy::DeploymentException exc(
+ OUSTR("Extension Manager: exception during addExtension, url: ")
+ + url, static_cast<OWeakObject*>(this), excOccurred1);
+ excOccurred1 <<= exc;
+ }
+
+ if (bCanInstall)
+ {
+ if (xOldExtension.is())
+ {
+ xOldExtension->revokePackage(xAbortChannel, xCmdEnv);
+ //save the old user extension in case the user aborts
+ //store the extension in the tmp repository, this will overwrite
+ //xTmpPackage (same identifier). Do not let the user abort or
+ //interact
+ Reference<ucb::XCommandEnvironment> tmpCmdEnv(
+ new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler()));
+ //importing the old extension in the tmp repository will remove
+ //the xTmpExtension
+ xTmpExtension = 0;
+ xExtensionBackup = m_tmpRepository->importExtension(
+ xOldExtension, Reference<task::XAbortChannel>(),
+ tmpCmdEnv);
+ }
+ xNewExtension = xPackageManager->addPackage(
+ url, properties, OUString(), xAbortChannel, xCmdEnv);
+ //If we add a user extension and there is already one which was
+ //disabled by a user, then the newly installed one is enabled. If we
+ //add to another repository then the user extension remains
+ //disabled.
+ bool bUserDisabled2 = bUserDisabled;
+ if (repository.equals(OUSTR("user")))
+ bUserDisabled2 = false;
+ activateExtension(
+ dp_misc::getIdentifier(xNewExtension),
+ xNewExtension->getName(), bUserDisabled2, false, xAbortChannel, xCmdEnv);
+ fireModified();
+ }
+ }
+ catch (deploy::DeploymentException& ) {
+ excOccurred2 = ::cppu::getCaughtException();
+ } catch (ucb::CommandFailedException & ) {
+ excOccurred2 = ::cppu::getCaughtException();
+ } catch (ucb::CommandAbortedException & ) {
+ excOccurred2 = ::cppu::getCaughtException();
+ } catch (lang::IllegalArgumentException &) {
+ excOccurred2 = ::cppu::getCaughtException();
+ } catch (uno::RuntimeException &) {
+ excOccurred2 = ::cppu::getCaughtException();
+ } catch (...) {
+ excOccurred2 = ::cppu::getCaughtException();
+ deploy::DeploymentException exc(
+ OUSTR("Extension Manager: exception during addExtension, url: ")
+ + url, static_cast<OWeakObject*>(this), excOccurred2);
+ excOccurred2 <<= exc;
+ }
+
+ if (excOccurred2.hasValue())
+ {
+ //It does not matter what exception is thrown. We try to
+ //recover the original status.
+ //If the user aborted installation then a ucb::CommandAbortedException
+ //is thrown.
+ //Use a private AbortChannel so the user cannot interrupt.
+ try
+ {
+ Reference<ucb::XCommandEnvironment> tmpCmdEnv(
+ new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler()));
+ if (xExtensionBackup.is())
+ {
+ Reference<deploy::XPackage> xRestored =
+ xPackageManager->importExtension(
+ xExtensionBackup, Reference<task::XAbortChannel>(),
+ tmpCmdEnv);
+ }
+ activateExtension(
+ sIdentifier, sFileName, bUserDisabled, false,
+ Reference<task::XAbortChannel>(), tmpCmdEnv);
+ if (xTmpExtension.is() || xExtensionBackup.is())
+ m_tmpRepository->removePackage(
+ sIdentifier, OUString(), xAbortChannel, xCmdEnv);
+ fireModified();
+ }
+ catch (...)
+ {
+ }
+ ::cppu::throwException(excOccurred2);
+ }
+ if (xTmpExtension.is() || xExtensionBackup.is())
+ m_tmpRepository->removePackage(
+ sIdentifier,OUString(), xAbortChannel, xCmdEnv);
+
+ if (excOccurred1.hasValue())
+ ::cppu::throwException(excOccurred1);
+
+ return xNewExtension;
+}
+
+void ExtensionManager::removeExtension(
+ OUString const & identifier, OUString const & fileName,
+ OUString const & repository,
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (deploy::DeploymentException,
+ ucb::CommandFailedException,
+ ucb::CommandAbortedException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ uno::Any excOccurred1;
+ Reference<deploy::XPackage> xExtensionBackup;
+ Reference<deploy::XPackageManager> xPackageManager;
+ bool bUserDisabled = false;
+ ::osl::MutexGuard guard(getMutex());
+ try
+ {
+//Determine the repository to use
+ if (repository.equals(OUSTR("user")))
+ xPackageManager = m_userRepository;
+ else if (repository.equals(OUSTR("shared")))
+ xPackageManager = m_sharedRepository;
+ else
+ throw lang::IllegalArgumentException(
+ OUSTR("No valid repository name provided."),
+ static_cast<cppu::OWeakObject*>(this), 0);
+
+ bUserDisabled = isUserDisabled(identifier, fileName);
+ //Backup the extension, in case the user cancels the action
+ xExtensionBackup = backupExtension(
+ identifier, fileName, xPackageManager, xCmdEnv);
+
+ //revoke the extension if it is active
+ Reference<deploy::XPackage> xOldExtension =
+ xPackageManager->getDeployedPackage(
+ identifier, fileName, xCmdEnv);
+ xOldExtension->revokePackage(xAbortChannel, xCmdEnv);
+
+ xPackageManager->removePackage(
+ identifier, fileName, xAbortChannel, xCmdEnv);
+ activateExtension(identifier, fileName, bUserDisabled, false,
+ xAbortChannel, xCmdEnv);
+ fireModified();
+ }
+ catch (deploy::DeploymentException& ) {
+ excOccurred1 = ::cppu::getCaughtException();
+ } catch (ucb::CommandFailedException & ) {
+ excOccurred1 = ::cppu::getCaughtException();
+ } catch (ucb::CommandAbortedException & ) {
+ excOccurred1 = ::cppu::getCaughtException();
+ } catch (lang::IllegalArgumentException &) {
+ excOccurred1 = ::cppu::getCaughtException();
+ } catch (uno::RuntimeException &) {
+ excOccurred1 = ::cppu::getCaughtException();
+ } catch (...) {
+ excOccurred1 = ::cppu::getCaughtException();
+ deploy::DeploymentException exc(
+ OUSTR("Extension Manager: exception during removeEtension"),
+ static_cast<OWeakObject*>(this), excOccurred1);
+ excOccurred1 <<= exc;
+ }
+
+ if (excOccurred1.hasValue())
+ {
+ //User aborted installation, restore the previous situation.
+ //Use a private AbortChannel so the user cannot interrupt.
+ try
+ {
+ Reference<ucb::XCommandEnvironment> tmpCmdEnv(
+ new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler()));
+ if (xExtensionBackup.is())
+ {
+ Reference<deploy::XPackage> xRestored =
+ xPackageManager->importExtension(
+ xExtensionBackup, Reference<task::XAbortChannel>(),
+ tmpCmdEnv);
+ activateExtension(
+ identifier, fileName, bUserDisabled, false,
+ Reference<task::XAbortChannel>(),
+ tmpCmdEnv);
+
+ m_tmpRepository->removePackage(
+ dp_misc::getIdentifier(xExtensionBackup),
+ xExtensionBackup->getName(), xAbortChannel, xCmdEnv);
+ fireModified();
+ }
+ }
+ catch (...)
+ {
+ }
+ ::cppu::throwException(excOccurred1);
+ }
+
+ if (xExtensionBackup.is())
+ m_tmpRepository->removePackage(
+ dp_misc::getIdentifier(xExtensionBackup),
+ xExtensionBackup->getName(), xAbortChannel, xCmdEnv);
+}
+
+// Only enable extensions from shared and user repository
+void ExtensionManager::enableExtension(
+ Reference<deploy::XPackage> const & extension,
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv)
+ throw (deploy::DeploymentException,
+ ucb::CommandFailedException,
+ ucb::CommandAbortedException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ ::osl::MutexGuard guard(getMutex());
+ bool bUserDisabled = false;
+ uno::Any excOccurred;
+ try
+ {
+ if (!extension.is())
+ return;
+ OUString repository = extension->getRepositoryName();
+ if (!repository.equals(OUSTR("user")))
+ throw lang::IllegalArgumentException(
+ OUSTR("No valid repository name provided."),
+ static_cast<cppu::OWeakObject*>(this), 0);
+
+ bUserDisabled = isUserDisabled(dp_misc::getIdentifier(extension),
+ extension->getName());
+
+ activateExtension(dp_misc::getIdentifier(extension),
+ extension->getName(), false, false,
+ xAbortChannel, xCmdEnv);
+ }
+ catch (deploy::DeploymentException& ) {
+ excOccurred = ::cppu::getCaughtException();
+ } catch (ucb::CommandFailedException & ) {
+ excOccurred = ::cppu::getCaughtException();
+ } catch (ucb::CommandAbortedException & ) {
+ excOccurred = ::cppu::getCaughtException();
+ } catch (lang::IllegalArgumentException &) {
+ excOccurred = ::cppu::getCaughtException();
+ } catch (uno::RuntimeException &) {
+ excOccurred = ::cppu::getCaughtException();
+ } catch (...) {
+ excOccurred = ::cppu::getCaughtException();
+ deploy::DeploymentException exc(
+ OUSTR("Extension Manager: exception during enableExtension"),
+ static_cast<OWeakObject*>(this), excOccurred);
+ excOccurred <<= exc;
+ }
+
+ if (excOccurred.hasValue())
+ {
+ try
+ {
+ activateExtension(dp_misc::getIdentifier(extension),
+ extension->getName(), bUserDisabled, false,
+ xAbortChannel, xCmdEnv);
+ }
+ catch (...)
+ {
+ }
+ ::cppu::throwException(excOccurred);
+ }
+}
+
+/**
+ */
+sal_Int32 ExtensionManager::checkPrerequisitesAndEnable(
+ Reference<deploy::XPackage> const & extension,
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv)
+ throw (deploy::DeploymentException,
+ ucb::CommandFailedException,
+ ucb::CommandAbortedException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ try
+ {
+ if (!extension.is())
+ return 0;
+ ::osl::MutexGuard guard(getMutex());
+ sal_Int32 ret = 0;
+ Reference<deploy::XPackageManager> mgr =
+ getPackageManager(extension->getRepositoryName());
+ ret = mgr->checkPrerequisites(extension, xAbortChannel, xCmdEnv);
+ if (ret)
+ {
+ //There are some unfulfilled prerequisites, try to revoke
+ extension->revokePackage(xAbortChannel, xCmdEnv);
+ }
+ const OUString id(dp_misc::getIdentifier(extension));
+ activateExtension(id, extension->getName(),
+ isUserDisabled(id, extension->getName()), false,
+ xAbortChannel, xCmdEnv);
+ return ret;
+ }
+ catch (deploy::DeploymentException& ) {
+ throw;
+ } catch (ucb::CommandFailedException & ) {
+ throw;
+ } catch (ucb::CommandAbortedException & ) {
+ throw;
+ } catch (lang::IllegalArgumentException &) {
+ throw;
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (...) {
+ uno::Any excOccurred = ::cppu::getCaughtException();
+ deploy::DeploymentException exc(
+ OUSTR("Extension Manager: exception during disableExtension"),
+ static_cast<OWeakObject*>(this), excOccurred);
+ throw exc;
+ }
+}
+
+
+void ExtensionManager::disableExtension(
+ Reference<deploy::XPackage> const & extension,
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (deploy::DeploymentException,
+ ucb::CommandFailedException,
+ ucb::CommandAbortedException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ ::osl::MutexGuard guard(getMutex());
+ uno::Any excOccurred;
+ bool bUserDisabled = false;
+ try
+ {
+ if (!extension.is())
+ return;
+ const OUString repository( extension->getRepositoryName());
+ if (!repository.equals(OUSTR("user")))
+ throw lang::IllegalArgumentException(
+ OUSTR("No valid repository name provided."),
+ static_cast<cppu::OWeakObject*>(this), 0);
+
+ const OUString id(dp_misc::getIdentifier(extension));
+ bUserDisabled = isUserDisabled(id, extension->getName());
+
+ activateExtension(id, extension->getName(), true, false,
+ xAbortChannel, xCmdEnv);
+ }
+ catch (deploy::DeploymentException& ) {
+ excOccurred = ::cppu::getCaughtException();
+ } catch (ucb::CommandFailedException & ) {
+ excOccurred = ::cppu::getCaughtException();
+ } catch (ucb::CommandAbortedException & ) {
+ excOccurred = ::cppu::getCaughtException();
+ } catch (lang::IllegalArgumentException &) {
+ excOccurred = ::cppu::getCaughtException();
+ } catch (uno::RuntimeException &) {
+ excOccurred = ::cppu::getCaughtException();
+ } catch (...) {
+ excOccurred = ::cppu::getCaughtException();
+ deploy::DeploymentException exc(
+ OUSTR("Extension Manager: exception during disableExtension"),
+ static_cast<OWeakObject*>(this), excOccurred);
+ excOccurred <<= exc;
+ }
+
+ if (excOccurred.hasValue())
+ {
+ try
+ {
+ activateExtension(dp_misc::getIdentifier(extension),
+ extension->getName(), bUserDisabled, false,
+ xAbortChannel, xCmdEnv);
+ }
+ catch (...)
+ {
+ }
+ ::cppu::throwException(excOccurred);
+ }
+}
+
+uno::Sequence< Reference<deploy::XPackage> >
+ ExtensionManager::getDeployedExtensions(
+ OUString const & repository,
+ Reference<task::XAbortChannel> const &xAbort,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (deploy::DeploymentException,
+ ucb::CommandFailedException,
+ ucb::CommandAbortedException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ return getPackageManager(repository)->getDeployedPackages(
+ xAbort, xCmdEnv);
+}
+
+Reference<deploy::XPackage>
+ ExtensionManager::getDeployedExtension(
+ OUString const & repository,
+ OUString const & identifier,
+ OUString const & filename,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (deploy::DeploymentException,
+ ucb::CommandFailedException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ return getPackageManager(repository)->getDeployedPackage(
+ identifier, filename, xCmdEnv);
+}
+
+uno::Sequence< uno::Sequence<Reference<deploy::XPackage> > >
+ ExtensionManager::getAllExtensions(
+ Reference<task::XAbortChannel> const & xAbort,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (deploy::DeploymentException,
+ ucb::CommandFailedException,
+ ucb::CommandAbortedException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ try
+ {
+ id2extensions mapExt;
+
+ uno::Sequence<Reference<deploy::XPackage> > userExt =
+ m_userRepository->getDeployedPackages(xAbort, xCmdEnv);
+ addExtensionsToMap(mapExt, userExt, OUSTR("user"));
+ uno::Sequence<Reference<deploy::XPackage> > sharedExt =
+ m_sharedRepository->getDeployedPackages(xAbort, xCmdEnv);
+ addExtensionsToMap(mapExt, sharedExt, OUSTR("shared"));
+ uno::Sequence<Reference<deploy::XPackage> > bundledExt =
+ m_bundledRepository->getDeployedPackages(xAbort, xCmdEnv);
+ addExtensionsToMap(mapExt, bundledExt, OUSTR("bundled"));
+
+ //copy the values of the map to a vector for sorting
+ ::std::vector< ::std::vector<Reference<deploy::XPackage> > >
+ vecExtensions;
+ id2extensions::const_iterator mapIt = mapExt.begin();
+ for (;mapIt != mapExt.end(); mapIt++)
+ vecExtensions.push_back(mapIt->second);
+
+ //sort the element according to the identifier
+ ::std::sort(vecExtensions.begin(), vecExtensions.end(), CompIdentifiers());
+
+ ::std::vector< ::std::vector<Reference<deploy::XPackage> > >::const_iterator
+ citVecVec = vecExtensions.begin();
+ sal_Int32 j = 0;
+ uno::Sequence< uno::Sequence<Reference<deploy::XPackage> > > seqSeq(vecExtensions.size());
+ for (;citVecVec != vecExtensions.end(); citVecVec++, j++)
+ {
+ seqSeq[j] = comphelper::containerToSequence(*citVecVec);
+ }
+ return seqSeq;
+
+ } catch (deploy::DeploymentException& ) {
+ throw;
+ } catch (ucb::CommandFailedException & ) {
+ throw;
+ } catch (ucb::CommandAbortedException & ) {
+ throw;
+ } catch (lang::IllegalArgumentException &) {
+ throw;
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (...) {
+ uno::Any exc = ::cppu::getCaughtException();
+ throw deploy::DeploymentException(
+ OUSTR("Extension Manager: exception during enableExtension"),
+ static_cast<OWeakObject*>(this), exc);
+ }
+}
+
+//only to be called from unopkg!!!
+void ExtensionManager::reinstallDeployedExtensions(
+ OUString const & repository,
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (deploy::DeploymentException,
+ ucb::CommandFailedException, ucb::CommandAbortedException,
+ lang::IllegalArgumentException, uno::RuntimeException)
+{
+ try
+ {
+ Reference<deploy::XPackageManager>
+ xPackageManager = getPackageManager(repository);
+
+ ::osl::MutexGuard guard(getMutex());
+ xPackageManager->reinstallDeployedPackages(xAbortChannel, xCmdEnv);
+ //We must sync here, otherwise we will get exceptions when extensions
+ //are removed.
+ dp_misc::syncRepositories(xCmdEnv);
+ const uno::Sequence< Reference<deploy::XPackage> > extensions(
+ xPackageManager->getDeployedPackages(xAbortChannel, xCmdEnv));
+
+ for ( sal_Int32 pos = 0; pos < extensions.getLength(); ++pos )
+ {
+ try
+ {
+ const OUString id = dp_misc::getIdentifier(extensions[ pos ]);
+ const OUString fileName = extensions[ pos ]->getName();
+ OSL_ASSERT(id.getLength());
+ activateExtension(id, fileName, false, false, xAbortChannel, xCmdEnv );
+ }
+ catch (lang::DisposedException &)
+ {
+ }
+ }
+ } catch (deploy::DeploymentException& ) {
+ throw;
+ } catch (ucb::CommandFailedException & ) {
+ throw;
+ } catch (ucb::CommandAbortedException & ) {
+ throw;
+ } catch (lang::IllegalArgumentException &) {
+ throw;
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (...) {
+ uno::Any exc = ::cppu::getCaughtException();
+ throw deploy::DeploymentException(
+ OUSTR("Extension Manager: exception during enableExtension"),
+ static_cast<OWeakObject*>(this), exc);
+ }
+}
+
+sal_Bool ExtensionManager::synchronize(
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (deploy::DeploymentException,
+ ucb::CommandFailedException,
+ ucb::CommandAbortedException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ try
+ {
+ sal_Bool bModified = sal_False;
+
+ ::osl::MutexGuard guard(getMutex());
+ String sSynchronizingShared(StrSyncRepository::get());
+ sSynchronizingShared.SearchAndReplaceAllAscii( "%NAME", OUSTR("shared"));
+ dp_misc::ProgressLevel progressShared(xCmdEnv, sSynchronizingShared);
+ bModified = m_sharedRepository->synchronize(xAbortChannel, xCmdEnv);
+ progressShared.update(OUSTR("\n\n"));
+
+ String sSynchronizingBundled(StrSyncRepository::get());
+ sSynchronizingBundled.SearchAndReplaceAllAscii( "%NAME", OUSTR("bundled"));
+ dp_misc::ProgressLevel progressBundled(xCmdEnv, sSynchronizingBundled);
+ bModified |= m_bundledRepository->synchronize(xAbortChannel, xCmdEnv);
+ progressBundled.update(OUSTR("\n\n"));
+
+ try
+ {
+ const uno::Sequence<uno::Sequence<Reference<deploy::XPackage> > >
+ seqSeqExt = getAllExtensions(xAbortChannel, xCmdEnv);
+ for (sal_Int32 i = 0; i < seqSeqExt.getLength(); i++)
+ {
+ uno::Sequence<Reference<deploy::XPackage> > const & seqExt =
+ seqSeqExt[i];
+ activateExtension(seqExt, isUserDisabled(seqExt), true,
+ xAbortChannel, xCmdEnv);
+ }
+ }
+ catch (...)
+ {
+ //We catch the exception, so we can write the lastmodified file
+ //so we will no repeat this everytime OOo starts.
+ OSL_ENSURE(0, "Extensions Manager: synchronize");
+ }
+ OUString lastSyncBundled(RTL_CONSTASCII_USTRINGPARAM(
+ "$BUNDLED_EXTENSIONS_USER/lastsynchronized"));
+ writeLastModified(lastSyncBundled, xCmdEnv);
+ OUString lastSyncShared(RTL_CONSTASCII_USTRINGPARAM(
+ "$SHARED_EXTENSIONS_USER/lastsynchronized"));
+ writeLastModified(lastSyncShared, xCmdEnv);
+ return bModified;
+ } catch (deploy::DeploymentException& ) {
+ throw;
+ } catch (ucb::CommandFailedException & ) {
+ throw;
+ } catch (ucb::CommandAbortedException & ) {
+ throw;
+ } catch (lang::IllegalArgumentException &) {
+ throw;
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (...) {
+ uno::Any exc = ::cppu::getCaughtException();
+ throw deploy::DeploymentException(
+ OUSTR("Extension Manager: exception in synchronize"),
+ static_cast<OWeakObject*>(this), exc);
+ }
+}
+
+// Notify the user when a new extension is to be installed. This is only the
+// case when one uses the system integration to install an extension (double
+// clicking on .oxt file etc.)). The function must only be called if there is no
+// extension with the same identifier already deployed. Then the checkUpdate
+// function will inform the user that the extension is about to be installed In
+// case the user cancels the installation a CommandFailed exception is
+// thrown.
+void ExtensionManager::checkInstall(
+ OUString const & displayName,
+ Reference<ucb::XCommandEnvironment> const & cmdEnv)
+{
+ uno::Any request(
+ deploy::InstallException(
+ OUSTR("Extension ") + displayName +
+ OUSTR(" is about to be installed."),
+ static_cast<OWeakObject *>(this), displayName));
+ bool approve = false, abort = false;
+ if (! dp_misc::interactContinuation(
+ request, task::XInteractionApprove::static_type(),
+ cmdEnv, &approve, &abort ))
+ {
+ OSL_ASSERT( !approve && !abort );
+ throw deploy::DeploymentException(
+ dp_misc::getResourceString(RID_STR_ERROR_WHILE_ADDING) + displayName,
+ static_cast<OWeakObject *>(this), request );
+ }
+ if (abort || !approve)
+ throw ucb::CommandFailedException(
+ dp_misc::getResourceString(RID_STR_ERROR_WHILE_ADDING) + displayName,
+ static_cast<OWeakObject *>(this), request );
+}
+
+/* The function will make the user interaction in case there is an extension
+installed with the same id. This function may only be called if there is already
+an extension.
+*/
+void ExtensionManager::checkUpdate(
+ OUString const & newVersion,
+ OUString const & newDisplayName,
+ Reference<deploy::XPackage> const & oldExtension,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+{
+ // package already deployed, interact --force:
+ uno::Any request(
+ (deploy::VersionException(
+ dp_misc::getResourceString(
+ RID_STR_PACKAGE_ALREADY_ADDED ) + newDisplayName,
+ static_cast<OWeakObject *>(this), newVersion, newDisplayName,
+ oldExtension ) ) );
+ bool replace = false, abort = false;
+ if (! dp_misc::interactContinuation(
+ request, task::XInteractionApprove::static_type(),
+ xCmdEnv, &replace, &abort )) {
+ OSL_ASSERT( !replace && !abort );
+ throw deploy::DeploymentException(
+ dp_misc::getResourceString(
+ RID_STR_ERROR_WHILE_ADDING) + newDisplayName,
+ static_cast<OWeakObject *>(this), request );
+ }
+ if (abort || !replace)
+ throw ucb::CommandFailedException(
+ dp_misc::getResourceString(
+ RID_STR_PACKAGE_ALREADY_ADDED) + newDisplayName,
+ static_cast<OWeakObject *>(this), request );
+}
+
+Reference<deploy::XPackage> ExtensionManager::getTempExtension(
+ OUString const & url,
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<ucb::XCommandEnvironment> const & /*xCmdEnv*/)
+
+{
+ Reference<ucb::XCommandEnvironment> tmpCmdEnvA(new TmpRepositoryCommandEnv());
+ Reference<deploy::XPackage> xTmpPackage = m_tmpRepository->addPackage(
+ url, uno::Sequence<beans::NamedValue>(),OUString(), xAbortChannel, tmpCmdEnvA);
+ if (!xTmpPackage.is())
+ {
+ throw deploy::DeploymentException(
+ OUSTR("Extension Manager: Failed to create temporary XPackage for url: ") + url,
+ static_cast<OWeakObject*>(this), uno::Any());
+
+ }
+ return xTmpPackage;
+}
+
+uno::Sequence<Reference<deploy::XPackage> > SAL_CALL
+ExtensionManager::getExtensionsWithUnacceptedLicenses(
+ OUString const & repository,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv)
+ throw (deploy::DeploymentException,
+ uno::RuntimeException)
+{
+ Reference<deploy::XPackageManager>
+ xPackageManager = getPackageManager(repository);
+ ::osl::MutexGuard guard(getMutex());
+ return xPackageManager->getExtensionsWithUnacceptedLicenses(xCmdEnv);
+}
+
+sal_Bool ExtensionManager::isReadOnlyRepository(::rtl::OUString const & repository)
+ throw (uno::RuntimeException)
+{
+ return getPackageManager(repository)->isReadOnly();
+}
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+namespace sdecl = comphelper::service_decl;
+sdecl::class_<ExtensionManager> servicePIP;
+extern sdecl::ServiceDecl const serviceDecl(
+ servicePIP,
+ // a private one:
+ "com.sun.star.comp.deployment.ExtensionManager",
+ "com.sun.star.comp.deployment.ExtensionManager");
+
+//------------------------------------------------------------------------------
+bool singleton_entries(
+ uno::Reference< registry::XRegistryKey > const & xRegistryKey )
+{
+ try {
+ uno::Reference< registry::XRegistryKey > xKey(
+ xRegistryKey->createKey(
+ serviceDecl.getImplementationName() +
+ // xxx todo: use future generated function to get singleton name
+ OUSTR("/UNO/SINGLETONS/"
+ "com.sun.star.deployment.ExtensionManager") ) );
+ xKey->setStringValue( serviceDecl.getSupportedServiceNames()[0] );
+ return true;
+ }
+ catch (registry::InvalidRegistryException & exc) {
+ (void) exc; // avoid warnings
+ OSL_ENSURE( 0, ::rtl::OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ return false;
+ }
+}
+
+// XModifyBroadcaster
+//______________________________________________________________________________
+void ExtensionManager::addModifyListener(
+ Reference<util::XModifyListener> const & xListener )
+ throw (uno::RuntimeException)
+{
+ check();
+ rBHelper.addListener( ::getCppuType( &xListener ), xListener );
+}
+
+//______________________________________________________________________________
+void ExtensionManager::removeModifyListener(
+ Reference<util::XModifyListener> const & xListener )
+ throw (uno::RuntimeException)
+{
+ check();
+ rBHelper.removeListener( ::getCppuType( &xListener ), xListener );
+}
+
+void ExtensionManager::check()
+{
+ ::osl::MutexGuard guard( getMutex() );
+ if (rBHelper.bInDispose || rBHelper.bDisposed) {
+ throw lang::DisposedException(
+ OUSTR("ExtensionManager instance has already been disposed!"),
+ static_cast<OWeakObject *>(this) );
+ }
+}
+
+void ExtensionManager::fireModified()
+{
+ ::cppu::OInterfaceContainerHelper * pContainer = rBHelper.getContainer(
+ util::XModifyListener::static_type() );
+ if (pContainer != 0) {
+ pContainer->forEach<util::XModifyListener>(
+ boost::bind(&util::XModifyListener::modified, _1,
+ lang::EventObject(static_cast<OWeakObject *>(this))) );
+ }
+}
+
+} // namespace dp_manager
+
+
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx
new file mode 100644
index 0000000000..d928ea1427
--- /dev/null
+++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+#if ! defined INCLUDED_DP_EXTENSIONMANAGER_H
+#define INCLUDED_DP_EXTENSIONMANAGER_H
+
+#include "dp_manager.hrc"
+#include "dp_misc.h"
+#include "dp_interact.h"
+#include "dp_activepackages.hxx"
+#include "rtl/ref.hxx"
+#include "cppuhelper/compbase1.hxx"
+#include "ucbhelper/content.hxx"
+#include "com/sun/star/deployment/XPackageRegistry.hpp"
+#include "com/sun/star/deployment/XPackageManager.hpp"
+#include "osl/mutex.hxx"
+#include <list>
+
+
+namespace css = ::com::sun::star;
+
+namespace dp_manager {
+
+typedef ::std::hash_map<
+ ::rtl::OUString,
+ ::std::vector<css::uno::Reference<css::deployment::XPackage> >,
+ ::rtl::OUStringHash > id2extensions;
+
+
+class ExtensionManager : private ::dp_misc::MutexHolder,
+ public ::cppu::WeakComponentImplHelper1< css::deployment::XExtensionManager >
+{
+public:
+ ExtensionManager( css::uno::Reference< css::uno::XComponentContext >const& xContext);
+ virtual ~ExtensionManager();
+
+ static css::uno::Sequence< ::rtl::OUString > getServiceNames();
+ static ::rtl::OUString getImplName();
+
+ void check();
+ void fireModified();
+
+public:
+
+// XModifyBroadcaster
+ virtual void SAL_CALL addModifyListener(
+ css::uno::Reference<css::util::XModifyListener> const & xListener )
+ throw (css::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ css::uno::Reference<css::util::XModifyListener> const & xListener )
+ throw (css::uno::RuntimeException);
+
+//XExtensionManager
+ virtual css::uno::Sequence<
+ css::uno::Reference<css::deployment::XPackageTypeInfo> > SAL_CALL
+ getSupportedPackageTypes()
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::task::XAbortChannel> SAL_CALL
+ createAbortChannel() throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference<css::deployment::XPackage> SAL_CALL addExtension(
+ ::rtl::OUString const & url,
+ css::uno::Sequence<css::beans::NamedValue> const & properties,
+ ::rtl::OUString const & repository,
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeExtension(
+ ::rtl::OUString const & identifier,
+ ::rtl::OUString const & filename,
+ ::rtl::OUString const & repository,
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL enableExtension(
+ css::uno::Reference<css::deployment::XPackage> const & extension,
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL disableExtension(
+ css::uno::Reference<css::deployment::XPackage> const & extension,
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+
+ virtual sal_Int32 SAL_CALL checkPrerequisitesAndEnable(
+ css::uno::Reference<css::deployment::XPackage> const & extension,
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+
+ virtual css::uno::Sequence< css::uno::Reference<css::deployment::XPackage> >
+ SAL_CALL getDeployedExtensions(
+ ::rtl::OUString const & repository,
+ css::uno::Reference<css::task::XAbortChannel> const &,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::deployment::XPackage>
+ SAL_CALL getDeployedExtension(
+ ::rtl::OUString const & repository,
+ ::rtl::OUString const & identifier,
+ ::rtl::OUString const & filename,
+ css::uno::Reference< css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (
+ css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Sequence<css::uno::Reference<css::deployment::XPackage> >
+ SAL_CALL getExtensionsWithSameIdentifier(
+ ::rtl::OUString const & identifier,
+ ::rtl::OUString const & filename,
+ css::uno::Reference< css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (
+ css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< css::uno::Sequence<css::uno::Reference<css::deployment::XPackage> > >
+ SAL_CALL getAllExtensions(
+ css::uno::Reference<css::task::XAbortChannel> const &,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+
+ virtual void SAL_CALL reinstallDeployedExtensions(
+ ::rtl::OUString const & repository,
+ css::uno::Reference< css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference< css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (
+ css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL synchronize(
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Sequence<css::uno::Reference<css::deployment::XPackage> > SAL_CALL
+ getExtensionsWithUnacceptedLicenses(
+ ::rtl::OUString const & repository,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv)
+ throw (css::deployment::DeploymentException,
+ css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isReadOnlyRepository(::rtl::OUString const & repository)
+ throw (css::uno::RuntimeException);
+
+private:
+
+ struct StrSyncRepository : public ::dp_misc::StaticResourceString<
+ StrSyncRepository, RID_STR_SYNCHRONIZING_REPOSITORY> {};
+
+ struct ExtensionInfos
+ {
+ ::rtl::OUString identifier;
+ ::rtl::OUString fileName;
+ ::rtl::OUString displayName;
+ ::rtl::OUString version;
+ };
+
+ css::uno::Reference< css::uno::XComponentContext> m_xContext;
+
+ css::uno::Reference<css::deployment::XPackageManager> m_userRepository;
+ css::uno::Reference<css::deployment::XPackageManager> m_sharedRepository;
+ css::uno::Reference<css::deployment::XPackageManager> m_bundledRepository;
+ css::uno::Reference<css::deployment::XPackageManager> m_tmpRepository;
+
+ /* contains the names of all repositories (except tmp) in order of there
+ priority. That is, the first element is "user" follod by "shared" and
+ then "bundled"
+ */
+ ::std::list< ::rtl::OUString > m_repositoryNames;
+
+ bool isUserDisabled(::rtl::OUString const & identifier,
+ ::rtl::OUString const & filename);
+
+ bool isUserDisabled(
+ css::uno::Sequence<css::uno::Reference<css::deployment::XPackage> > const & seqExtSameId);
+
+ void activateExtension(
+ ::rtl::OUString const & identifier,
+ ::rtl::OUString const & fileName,
+ bool bUserDisabled, bool bStartup,
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
+
+ void activateExtension(
+ css::uno::Sequence<css::uno::Reference<css::deployment::XPackage> > const & seqExt,
+ bool bUserDisabled, bool bStartup,
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv );
+
+
+ ::std::list<css::uno::Reference<css::deployment::XPackage> >
+ getExtensionsWithSameId(::rtl::OUString const & identifier,
+ ::rtl::OUString const & fileName,
+ css::uno::Reference< css::ucb::XCommandEnvironment> const & xCmdEnv =
+ css::uno::Reference< css::ucb::XCommandEnvironment>());
+
+ css::uno::Reference<css::deployment::XPackage> backupExtension(
+ ::rtl::OUString const & identifier, ::rtl::OUString const & fileName,
+ css::uno::Reference<css::deployment::XPackageManager> const & xPackageManager,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
+
+ void checkInstall(
+ ::rtl::OUString const & displayName,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & cmdEnv);
+
+ void checkUpdate(
+ ::rtl::OUString const & newVersion,
+ ::rtl::OUString const & newDisplayName,
+ css::uno::Reference<css::deployment::XPackage> const & oldExtension,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
+
+ css::uno::Reference<css::deployment::XPackage> getTempExtension(
+ ::rtl::OUString const & url,
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
+
+
+ void addExtensionsToMap(
+ id2extensions & mapExt,
+ css::uno::Sequence<css::uno::Reference<css::deployment::XPackage> > const & seqExt,
+ ::rtl::OUString const & repository);
+
+ css::uno::Reference<css::deployment::XPackageManager>
+ getPackageManager(::rtl::OUString const & repository)
+ throw (css::lang::IllegalArgumentException);
+};
+
+}
+
+
+
+
+#endif
+
diff --git a/desktop/source/deployment/manager/dp_informationprovider.cxx b/desktop/source/deployment/manager/dp_informationprovider.cxx
index 88e84d9744..1f1e619359 100644
--- a/desktop/source/deployment/manager/dp_informationprovider.cxx
+++ b/desktop/source/deployment/manager/dp_informationprovider.cxx
@@ -32,11 +32,10 @@
#include "comphelper/servicedecl.hxx"
-#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
#include "com/sun/star/deployment/UpdateInformationProvider.hpp"
#include "com/sun/star/deployment/XPackage.hpp"
#include "com/sun/star/deployment/XPackageInformationProvider.hpp"
-#include "com/sun/star/deployment/XPackageManager.hpp"
+#include "com/sun/star/deployment/ExtensionManager.hpp"
#include "com/sun/star/deployment/XUpdateInformationProvider.hpp"
#include "com/sun/star/lang/XServiceInfo.hpp"
#include "com/sun/star/registry/XRegistryKey.hpp"
@@ -56,6 +55,7 @@
#include "dp_identifier.hxx"
#include "dp_version.hxx"
#include "dp_misc.h"
+#include "dp_update.hxx"
namespace beans = com::sun::star::beans ;
namespace deployment = com::sun::star::deployment ;
@@ -104,21 +104,10 @@ private:
uno::Reference< uno::XComponentContext> mxContext;
- rtl::OUString getPackageLocation( const uno::Reference< deployment::XPackageManager > _xManager,
+ rtl::OUString getPackageLocation( const rtl::OUString& repository,
const rtl::OUString& _sExtensionId );
uno::Reference< deployment::XUpdateInformationProvider > mxUpdateInformation;
-
- uno::Sequence< uno::Reference< xml::dom::XElement > >
- getUpdateInformation( uno::Sequence< rtl::OUString > const & urls,
- rtl::OUString const & identifier ) const;
- uno::Sequence< uno::Reference< deployment::XPackage > >
- getPackages( const uno::Reference< deployment::XPackageManager > _xManager );
- uno::Sequence< uno::Sequence< rtl::OUString > > isUpdateAvailable( const uno::Reference< deployment::XPackageManager > _xManager,
- const rtl::OUString& _sExtensionId );
- uno::Sequence< uno::Sequence< rtl::OUString > > getExtensionList( const uno::Reference< deployment::XPackageManager > _xManager );
- uno::Sequence< uno::Sequence< rtl::OUString > > concatLists( uno::Sequence< uno::Sequence< rtl::OUString > > aFirst,
- uno::Sequence< uno::Sequence< rtl::OUString > > aSecond );
};
//------------------------------------------------------------------------------
@@ -148,15 +137,18 @@ void SAL_CALL PackageInformationProvider::handle( uno::Reference< task::XInterac
//------------------------------------------------------------------------------
rtl::OUString PackageInformationProvider::getPackageLocation(
- const uno::Reference< deployment::XPackageManager > _xManager,
- const rtl::OUString& _rExtensionId )
+ const rtl::OUString & repository,
+ const rtl::OUString& _rExtensionId )
{
rtl::OUString aLocationURL;
-
- if ( _xManager.is() )
+ uno::Reference<deployment::XExtensionManager> xManager =
+ deployment::ExtensionManager::get(mxContext);
+
+ if ( xManager.is() )
{
const uno::Sequence< uno::Reference< deployment::XPackage > > packages(
- _xManager->getDeployedPackages(
+ xManager->getDeployedExtensions(
+ repository,
uno::Reference< task::XAbortChannel >(),
static_cast < XCommandEnvironment *> (this) ) );
@@ -187,32 +179,21 @@ rtl::OUString SAL_CALL
PackageInformationProvider::getPackageLocation( const rtl::OUString& _sExtensionId )
throw ( uno::RuntimeException )
{
- uno::Reference< deployment::XPackageManager > xManager;
- try {
- xManager = deployment::thePackageManagerFactory::get( mxContext )->getPackageManager( UNISTRING("user") );
- }
- catch ( css_ucb::CommandFailedException & ){}
- catch ( uno::RuntimeException & ) {}
-
- rtl::OUString aLocationURL = getPackageLocation( xManager, _sExtensionId );
+ rtl::OUString aLocationURL = getPackageLocation( UNISTRING("user"), _sExtensionId );
if ( aLocationURL.getLength() == 0 )
{
- try {
- xManager = deployment::thePackageManagerFactory::get( mxContext )->getPackageManager( UNISTRING("shared") );
- }
- catch ( css_ucb::CommandFailedException & ){}
- catch ( uno::RuntimeException & ) {}
-
- aLocationURL = getPackageLocation( xManager, _sExtensionId );
+ aLocationURL = getPackageLocation( UNISTRING("shared"), _sExtensionId );
+ }
+ if ( aLocationURL.getLength() == 0 )
+ {
+ aLocationURL = getPackageLocation( UNISTRING("bundled"), _sExtensionId );
}
-
if ( aLocationURL.getLength() )
{
::ucbhelper::Content aContent( aLocationURL, NULL );
aLocationURL = aContent.getURL();
}
-
return aLocationURL;
}
@@ -222,252 +203,157 @@ uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL
PackageInformationProvider::isUpdateAvailable( const rtl::OUString& _sExtensionId )
throw ( uno::RuntimeException )
{
- uno::Sequence< uno::Sequence< rtl::OUString > > aUpdateListUser;
-
- uno::Reference< deployment::XPackageManager > xManager;
- try {
- xManager = deployment::thePackageManagerFactory::get( mxContext )->getPackageManager( UNISTRING("user") );
- }
- catch ( css_ucb::CommandFailedException & ){}
- catch ( uno::RuntimeException & ) {}
-
- aUpdateListUser = isUpdateAvailable( xManager, _sExtensionId );
-
- uno::Sequence< uno::Sequence< rtl::OUString > > aUpdateListShared;
- try {
- xManager = deployment::thePackageManagerFactory::get( mxContext )->getPackageManager( UNISTRING("shared") );
- }
- catch ( css_ucb::CommandFailedException & ){}
- catch ( uno::RuntimeException & ) {}
-
- aUpdateListShared = isUpdateAvailable( xManager, _sExtensionId );
-
- if ( !aUpdateListUser.hasElements() )
- return aUpdateListShared;
- else if ( !aUpdateListShared.hasElements() )
- return aUpdateListUser;
- else
- return concatLists( aUpdateListUser, aUpdateListShared );
-}
-
-//------------------------------------------------------------------------------
-uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL PackageInformationProvider::getExtensionList()
- throw ( uno::RuntimeException )
-{
- uno::Sequence< uno::Sequence< rtl::OUString > > aListUser;
-
- uno::Reference< deployment::XPackageManager > xManager;
- try {
- xManager = deployment::thePackageManagerFactory::get( mxContext )->getPackageManager( UNISTRING("user") );
- }
- catch ( css_ucb::CommandFailedException & ){}
- catch ( uno::RuntimeException & ) {}
-
- aListUser = getExtensionList( xManager );
-
- uno::Sequence< uno::Sequence< rtl::OUString > > aListShared;
- try {
- xManager = deployment::thePackageManagerFactory::get( mxContext )->getPackageManager( UNISTRING("shared") );
- }
- catch ( css_ucb::CommandFailedException & ){}
- catch ( uno::RuntimeException & ) {}
-
- aListShared = getExtensionList( xManager );
-
- if ( !aListUser.hasElements() )
- return aListShared;
- else if ( !aListShared.hasElements() )
- return aListUser;
- else
- return concatLists( aListUser, aListShared );
-}
+ uno::Sequence< uno::Sequence< rtl::OUString > > aList;
+
+ uno::Reference<deployment::XExtensionManager> extMgr =
+ deployment::ExtensionManager::get(mxContext);
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-uno::Sequence< uno::Reference< deployment::XPackage > >
- PackageInformationProvider::getPackages( const uno::Reference< deployment::XPackageManager > _xMgr )
-{
- uno::Sequence< uno::Reference< deployment::XPackage > > packages;
- try {
- packages = _xMgr->getDeployedPackages( uno::Reference< task::XAbortChannel >(),
- static_cast < XCommandEnvironment *> (this) );
- }
- catch ( deployment::DeploymentException & )
- {}
- catch ( css_ucb::CommandFailedException & )
- {}
- catch ( css_ucb::CommandAbortedException & )
- {}
- catch ( lang::IllegalArgumentException & e )
+ if (!extMgr.is())
{
- throw uno::RuntimeException(e.Message, e.Context);
+ OSL_ASSERT(0);
+ return aList;
}
-
- return packages;
-}
-
-//------------------------------------------------------------------------------
-uno::Sequence< uno::Reference< xml::dom::XElement > >
- PackageInformationProvider::getUpdateInformation( uno::Sequence< rtl::OUString > const & urls,
- rtl::OUString const & identifier ) const
-{
- try
+ std::vector<std::pair<uno::Reference<deployment::XPackage>, uno::Any > > errors;
+ dp_misc::UpdateInfoMap updateInfoMap;
+ if (_sExtensionId.getLength())
{
- return mxUpdateInformation->getUpdateInformation( urls, identifier );
+ std::vector<uno::Reference<deployment::XPackage> > vecExtensions;
+ uno::Reference<deployment::XPackage> extension;
+ try
+ {
+ extension = dp_misc::getExtensionWithHighestVersion(
+ extMgr->getExtensionsWithSameIdentifier(
+ _sExtensionId, _sExtensionId, uno::Reference<css_ucb::XCommandEnvironment>()));
+ vecExtensions.push_back(extension);
+ }
+ catch (lang::IllegalArgumentException &)
+ {
+ OSL_ASSERT(0);
+ }
+ updateInfoMap = dp_misc::getOnlineUpdateInfos(
+ mxContext, extMgr, mxUpdateInformation, &vecExtensions, errors);
}
- catch ( uno::RuntimeException & ) {
- throw;
+ else
+ {
+ updateInfoMap = dp_misc::getOnlineUpdateInfos(
+ mxContext, extMgr, mxUpdateInformation, NULL, errors);
}
- catch ( css_ucb::CommandFailedException & ) {}
- catch ( css_ucb::CommandAbortedException & ) {}
- catch ( uno::Exception & ) {}
-
- return uno::Sequence< uno::Reference< xml::dom::XElement > >();
-}
-
-//------------------------------------------------------------------------------
-uno::Sequence< uno::Sequence< rtl::OUString > >
- PackageInformationProvider::isUpdateAvailable(
- const uno::Reference< deployment::XPackageManager > _xManager,
- const rtl::OUString& _sExtensionId )
-{
- uno::Sequence< uno::Sequence< rtl::OUString > > aList;
- sal_Int32 nCount = 0;
- bool bPackageFound = false;
- // If the package manager is readonly then the user cannot modify anything anyway
- // so we can abort the search here
- if ( _xManager.is() && ! _xManager->isReadOnly() )
+ int nCount = 0;
+ for (dp_misc::UpdateInfoMap::iterator i(updateInfoMap.begin()); i != updateInfoMap.end(); i++)
{
- uno::Sequence< uno::Reference< deployment::XPackage > > packages( getPackages( _xManager ) );
- uno::Sequence< uno::Reference< xml::dom::XElement > > defaultInfos;
+ dp_misc::UpdateInfo const & info = i->second;
- for ( int pos = packages.getLength(); pos-- && !bPackageFound; )
+ rtl::OUString sOnlineVersion;
+ if (info.info.is())
{
- uno::Reference< deployment::XPackage > package( packages[ pos ] );
- uno::Sequence< rtl::OUString > urls( package->getUpdateInformationURLs());
- uno::Sequence< uno::Reference< xml::dom::XElement > > infos;
- rtl::OUString id( dp_misc::getIdentifier( package ) );
-
- if ( _sExtensionId.getLength() )
- {
- if ( _sExtensionId == id )
- bPackageFound = true;
- else /* we have an ID and the IDs don't match, continue with next package */
- continue;
- }
-
- if ( urls.getLength() != 0)
- {
- infos = getUpdateInformation( urls, id );
- }
- else
- {
- if ( defaultInfos.getLength() == 0 )
- {
- const rtl::OUString defaultURL( dp_misc::getExtensionDefaultUpdateURL() );
- if ( defaultURL.getLength() )
- defaultInfos = getUpdateInformation( uno::Sequence< rtl::OUString >( &defaultURL, 1 ),
- rtl::OUString() );
- }
- infos = defaultInfos;
- }
- rtl::OUString latestVersion( package->getVersion() );
- sal_Int32 latestIndex = -1;
- for ( sal_Int32 i = 0; i < infos.getLength(); ++i )
- {
- dp_misc::DescriptionInfoset infoset( mxContext,
- uno::Reference< xml::dom::XNode >( infos[i], uno::UNO_QUERY_THROW));
- boost::optional< rtl::OUString > id2( infoset.getIdentifier() );
-
- if (!id2)
- continue;
-
- if (*id2 == id)
- {
- // check, if there are unsatisfied dependencies and ignore those updates
- uno::Sequence< uno::Reference< xml::dom::XElement > > ds( dp_misc::Dependencies::check( infoset ) );
- if ( ds.getLength() )
- continue;
-
- rtl::OUString v( infoset.getVersion() );
- if ( dp_misc::compareVersions( v, latestVersion ) == dp_misc::GREATER )
- {
- latestVersion = v;
- latestIndex = i;
- }
- }
- }
- if ( latestIndex != -1 )
- {
- rtl::OUString aNewEntry[2];
- aNewEntry[0] = id;
- aNewEntry[1] = latestVersion;
- aList.realloc( ++nCount );
- aList[ nCount-1 ] = ::uno::Sequence< rtl::OUString >( aNewEntry, 2 );
- }
+ // check, if there are unsatisfied dependencies and ignore this online update
+ dp_misc::DescriptionInfoset infoset(mxContext, info.info);
+ uno::Sequence< uno::Reference< xml::dom::XElement > >
+ ds( dp_misc::Dependencies::check( infoset ) );
+ if ( ! ds.getLength() )
+ sOnlineVersion = info.version;
}
- }
- return aList;
-}
-
-//------------------------------------------------------------------------------
-uno::Sequence< uno::Sequence< rtl::OUString > >
- PackageInformationProvider::getExtensionList(
- const uno::Reference< deployment::XPackageManager > _xManager )
-{
- uno::Sequence< uno::Sequence< rtl::OUString > > aList;
-
- if ( _xManager.is() )
- {
- uno::Sequence< uno::Reference< deployment::XPackage > > packages( getPackages( _xManager ) );
-
- aList.realloc( packages.getLength() );
-
- for ( int pos = packages.getLength(); pos--; )
+
+ rtl::OUString sVersionUser;
+ rtl::OUString sVersionShared;
+ rtl::OUString sVersionBundled;
+ uno::Sequence< uno::Reference< deployment::XPackage> > extensions;
+ try {
+ extensions = extMgr->getExtensionsWithSameIdentifier(
+ dp_misc::getIdentifier(info.extension), info.extension->getName(),
+ uno::Reference<css_ucb::XCommandEnvironment>());
+ } catch (lang::IllegalArgumentException& ) {
+ OSL_ASSERT(0);
+ }
+ OSL_ASSERT(extensions.getLength() == 3);
+ if (extensions[0].is() )
+ sVersionUser = extensions[0]->getVersion();
+ if (extensions[1].is() )
+ sVersionShared = extensions[1]->getVersion();
+ if (extensions[2].is() )
+ sVersionBundled = extensions[2]->getVersion();
+
+ bool bSharedReadOnly = extMgr->isReadOnlyRepository(OUSTR("shared"));
+
+ dp_misc::UPDATE_SOURCE sourceUser = dp_misc::isUpdateUserExtension(
+ bSharedReadOnly, sVersionUser, sVersionShared, sVersionBundled, sOnlineVersion);
+ dp_misc::UPDATE_SOURCE sourceShared = dp_misc::isUpdateSharedExtension(
+ bSharedReadOnly, sVersionShared, sVersionBundled, sOnlineVersion);
+
+ rtl::OUString updateVersionUser;
+ rtl::OUString updateVersionShared;
+ if (sourceUser != dp_misc::UPDATE_SOURCE_NONE)
+ updateVersionUser = dp_misc::getHighestVersion(
+ rtl::OUString(), sVersionShared, sVersionBundled, sOnlineVersion);
+ if (sourceShared != dp_misc::UPDATE_SOURCE_NONE)
+ updateVersionShared = dp_misc::getHighestVersion(
+ rtl::OUString(), rtl::OUString(), sVersionBundled, sOnlineVersion);
+ rtl::OUString updateVersion;
+ if (dp_misc::compareVersions(updateVersionUser, updateVersionShared) == dp_misc::GREATER)
+ updateVersion = updateVersionUser;
+ else
+ updateVersion = updateVersionShared;
+ if (updateVersion.getLength())
{
- uno::Reference< deployment::XPackage > package( packages[ pos ] );
+
rtl::OUString aNewEntry[2];
-
- aNewEntry[0] = dp_misc::getIdentifier( package );
- aNewEntry[1] = package->getVersion();
- aList[ pos ] = ::uno::Sequence< rtl::OUString >( aNewEntry, 2 );
- }
+ aNewEntry[0] = i->first;
+ aNewEntry[1] = updateVersion;
+ aList.realloc( ++nCount );
+ aList[ nCount-1 ] = ::uno::Sequence< rtl::OUString >( aNewEntry, 2 );
+ }
}
return aList;
}
//------------------------------------------------------------------------------
-uno::Sequence< uno::Sequence< rtl::OUString > > PackageInformationProvider::concatLists(
- uno::Sequence< uno::Sequence< rtl::OUString > > aFirst,
- uno::Sequence< uno::Sequence< rtl::OUString > > aSecond )
+uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL PackageInformationProvider::getExtensionList()
+ throw ( uno::RuntimeException )
{
- sal_Int32 nFirstCount = aFirst.getLength();
- sal_Int32 nSecondCount = aSecond.getLength();
- sal_Int32 nIndex = nFirstCount;
+ const uno::Reference<deployment::XExtensionManager> mgr =
+ deployment::ExtensionManager::get(mxContext);
+
+ if (!mgr.is())
+ return uno::Sequence< uno::Sequence< rtl::OUString > >();
- for ( sal_Int32 i=0; i < nSecondCount; i++ )
+ const uno::Sequence< uno::Sequence< uno::Reference<deployment::XPackage > > >
+ allExt = mgr->getAllExtensions(
+ uno::Reference< task::XAbortChannel >(),
+ static_cast < XCommandEnvironment *> (this) );
+
+ uno::Sequence< uno::Sequence< rtl::OUString > > retList;
+
+ sal_Int32 cAllIds = allExt.getLength();
+ retList.realloc(cAllIds);
+
+ for (sal_Int32 i = 0; i < cAllIds; i++)
{
- bool bDuplicateEntry = false;
- for ( sal_Int32 j=0; j < nFirstCount; j++ )
+ //The inner sequence contains extensions with the same identifier from
+ //all the different repositories, that is user, share, bundled.
+ const uno::Sequence< uno::Reference< deployment::XPackage > > &
+ seqExtension = allExt[i];
+ sal_Int32 cExt = seqExtension.getLength();
+ OSL_ASSERT(cExt == 3);
+ for (sal_Int32 j = 0; j < cExt; j++)
{
- if ( aFirst[ j ][0] == aSecond[ i ][0] )
+ //ToDo according to the old code the first found extenions is used
+ //even if another one with the same id has a better version.
+ uno::Reference< deployment::XPackage > const & xExtension( seqExtension[j] );
+ if (xExtension.is())
{
- bDuplicateEntry = true;
+ rtl::OUString aNewEntry[2];
+ aNewEntry[0] = dp_misc::getIdentifier(xExtension);
+ aNewEntry[1] = xExtension->getVersion();
+ retList[i] = ::uno::Sequence< rtl::OUString >( aNewEntry, 2 );
break;
}
}
- if ( !bDuplicateEntry )
- {
- nIndex += 1;
- aFirst.realloc( nIndex );
- aFirst[ nIndex - 1 ] = aSecond[ i ];
- }
}
- return aFirst;
+ return retList;
}
+
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx
index 8a3bd27f56..4b11136cb9 100644
--- a/desktop/source/deployment/manager/dp_manager.cxx
+++ b/desktop/source/deployment/manager/dp_manager.cxx
@@ -39,6 +39,7 @@
#include "rtl/bootstrap.hxx"
#include "osl/diagnose.h"
#include "osl/file.hxx"
+#include "osl/security.hxx"
#include "cppuhelper/weakref.hxx"
#include "cppuhelper/exc_hlp.hxx"
#include "cppuhelper/implbase1.hxx"
@@ -57,11 +58,18 @@
#include "com/sun/star/ucb/NameClash.hpp"
#include "com/sun/star/deployment/VersionException.hpp"
#include "com/sun/star/deployment/InstallException.hpp"
+#include "com/sun/star/deployment/Prerequisites.hpp"
#include "com/sun/star/task/XInteractionApprove.hpp"
#include "com/sun/star/ucb/UnsupportedCommandException.hpp"
#include "boost/bind.hpp"
-#include <vector>
+#include "tools/urlobj.hxx"
+#include "osl/file.hxx"
+#include <vector>
+#include <list>
+#include "dp_descriptioninfoset.hxx"
+#include "dp_commandenvironments.hxx"
+#include "dp_properties.hxx"
using namespace ::dp_misc;
using namespace ::com::sun::star;
@@ -91,6 +99,28 @@ struct MatchTempDir
}
};
+
+namespace {
+OUString getExtensionFolder(OUString const & parentFolder,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv)
+{
+ ::ucbhelper::Content tempFolder(
+ parentFolder, xCmdEnv );
+ Reference<sdbc::XResultSet> xResultSet(
+ tempFolder.createCursor(
+ Sequence<OUString>( &StrTitle::get(), 1 ),
+ ::ucbhelper::INCLUDE_FOLDERS_ONLY ) );
+
+ OUString title;
+ while (xResultSet->next())
+ {
+ title = Reference<sdbc::XRow>(
+ xResultSet, UNO_QUERY_THROW )->getString(1 /* Title */ ) ;
+ break;
+ }
+ return title;
+}
+}
//______________________________________________________________________________
void PackageManagerImpl::initActivationLayer(
Reference<XCommandEnvironment> const & xCmdEnv )
@@ -135,7 +165,8 @@ void PackageManagerImpl::initActivationLayer(
{
ActivePackages::Data dbData;
insertToActivationLayer(
- mediaType, sourceContent, title, &dbData );
+ Sequence<css::beans::NamedValue>(),mediaType, sourceContent,
+ title, &dbData );
insertToActivationLayerDB( title, dbData );
//TODO #i73136#: insertToActivationLayerDB needs id not
@@ -151,12 +182,24 @@ void PackageManagerImpl::initActivationLayer(
// user|share:
OSL_ASSERT( m_activePackages.getLength() > 0 );
m_activePackages_expanded = expandUnoRcUrl( m_activePackages );
- create_folder( 0, m_activePackages_expanded, xCmdEnv, !m_readOnly );
+ m_registrationData_expanded = expandUnoRcUrl(m_registrationData);
+ if (!m_readOnly)
+ create_folder( 0, m_activePackages_expanded, xCmdEnv, true);
+
+ OUString dbName;
+ if (m_context.equals(OUSTR("user")))
+ dbName = m_activePackages_expanded + OUSTR(".db");
+ else
+ {
+ //Create the extension data base in the user installation
+ create_folder( 0, m_registrationData_expanded, xCmdEnv, true);
+ dbName = m_registrationData_expanded + OUSTR("/extensions.db");
+ }
+ //The data base can always be written because it it always in the user installation
m_activePackagesDB.reset(
- new ActivePackages(
- m_activePackages_expanded + OUSTR(".db"), m_readOnly ) );
+ new ActivePackages( dbName, false ) );
- if (! m_readOnly)
+ if (! m_readOnly && ! m_context.equals(OUSTR("bundled")))
{
// clean up activation layer, scan for zombie temp dirs:
ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() );
@@ -169,17 +212,37 @@ void PackageManagerImpl::initActivationLayer(
::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) );
// get all temp directories:
::std::vector<OUString> tempEntries;
- while (xResultSet->next()) {
+ ::std::vector<OUString> removedEntries;
+ while (xResultSet->next())
+ {
OUString title(
Reference<sdbc::XRow>(
xResultSet, UNO_QUERY_THROW )->getString(
1 /* Title */ ) );
- tempEntries.push_back( ::rtl::Uri::encode(
- title, rtl_UriCharClassPchar,
- rtl_UriEncodeIgnoreEscapes,
- RTL_TEXTENCODING_UTF8 ) );
+
+ const char extensionRemoved[] = "removed";
+ if (title.endsWithAsciiL(
+ extensionRemoved, sizeof(extensionRemoved) - 1))
+ {
+ //save the file name withouth the "removed" part
+ sal_Int32 index = title.lastIndexOfAsciiL(
+ extensionRemoved, sizeof(extensionRemoved) - 1);
+ OUString remFile = title.copy(0, index);
+ removedEntries.push_back(::rtl::Uri::encode(
+ remFile, rtl_UriCharClassPchar,
+ rtl_UriEncodeIgnoreEscapes,
+ RTL_TEXTENCODING_UTF8 ) );
+ }
+ else
+ {
+ tempEntries.push_back( ::rtl::Uri::encode(
+ title, rtl_UriCharClassPchar,
+ rtl_UriEncodeIgnoreEscapes,
+ RTL_TEXTENCODING_UTF8 ) );
+ }
}
-
+
+ bool bShared = m_context.equals(OUSTR("shared")) ? true : false;
for ( ::std::size_t pos = 0; pos < tempEntries.size(); ++pos )
{
OUString const & tempEntry = tempEntries[ pos ];
@@ -187,14 +250,52 @@ void PackageManagerImpl::initActivationLayer(
if (::std::find_if( id2temp.begin(), id2temp.end(), match ) ==
id2temp.end())
{
+ const OUString url(
+ makeURL(m_activePackages_expanded, tempEntry ) );
+
+ //In case of shared extensions, new entries are regarded as
+ //added extensions if there is no xxx.tmpremoved file.
+ if (bShared)
+ {
+ if (::std::find(removedEntries.begin(), removedEntries.end(), tempEntry) ==
+ removedEntries.end())
+ {
+ continue;
+ }
+ else
+ {
+ //Make sure only the same user removes the extension, who
+ //previously unregistered it. This is avoid races if multiple instances
+ //of OOo are running which all have write access to the shared installation.
+ //For example, a user removes the extension, but keeps OOo
+ //running. Parts of the extension may still be loaded and used by OOo.
+ //Therefore the extension is only deleted the next time the extension manager is
+ //run after restarting OOo. While OOo is still running, another user starts OOo
+ //which would deleted the extension files. If the same user starts another
+ //instance of OOo then the lock file will prevent this.
+ OUString aUserName;
+ ::osl::Security aSecurity;
+ aSecurity.getUserName( aUserName );
+ ucbhelper::Content remFileContent(
+ url + OUSTR("removed"), Reference<XCommandEnvironment>());
+ ::rtl::ByteSequence data = dp_misc::readFile(remFileContent);
+ ::rtl::OString osData(reinterpret_cast<const sal_Char*>(data.getConstArray()),
+ data.getLength());
+ OUString sData = ::rtl::OStringToOUString(
+ osData, RTL_TEXTENCODING_UTF8);
+ if (!sData.equals(aUserName))
+ continue;
+ }
+ }
// temp entry not needed anymore:
- const OUString url( makeURL( m_activePackages_expanded,
- tempEntry ) );
erase_path( url + OUSTR("_"),
Reference<XCommandEnvironment>(),
false /* no throw: ignore errors */ );
erase_path( url, Reference<XCommandEnvironment>(),
false /* no throw: ignore errors */ );
+ //delete the xxx.tmpremoved file
+ erase_path(url + OUSTR("removed"),
+ Reference<XCommandEnvironment>(), false);
}
}
}
@@ -206,9 +307,9 @@ void PackageManagerImpl::initRegistryBackends()
{
if (m_registryCache.getLength() > 0)
create_folder( 0, m_registryCache,
- Reference<XCommandEnvironment>(), !m_readOnly );
+ Reference<XCommandEnvironment>(), false);
m_xRegistry.set( ::dp_registry::create(
- m_context, m_registryCache, m_readOnly,
+ m_context, m_registryCache, false,
m_xComponentContext ) );
}
@@ -223,12 +324,14 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create(
OUString packages, logFile, stampURL;
if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("user") )) {
- that->m_activePackages = OUSTR("vnd.sun.star.expand:$UNO_"
- "USER_PACKAGES_CACHE/uno_packages");
- that->m_registryCache = OUSTR("vnd.sun.star.expand:$UNO_"
- "USER_PACKAGES_CACHE/registry");
- logFile = OUSTR("vnd.sun.star.expand:$UNO_"
- "USER_PACKAGES_CACHE/log.txt");
+ that->m_activePackages = OUSTR(
+ "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/uno_packages");
+ that->m_registrationData = OUSTR(
+ "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE");
+ that->m_registryCache = OUSTR(
+ "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/registry");
+ logFile = OUSTR(
+ "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/log.txt");
//We use the extension .sys for the file because on Windows Vista a sys
//(as well as exe and dll) file
//will not be written in the VirtualStore. For example if the process has no
@@ -240,25 +343,42 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create(
//using virtualization it appears that he/she can. Then a shared extension can
//be installed but is only visible for the user (because the extension is in
//the virtual store).
- stampURL = OUSTR("vnd.sun.star.expand:$UNO_"
- "USER_PACKAGES_CACHE/stamp.sys");
+ stampURL = OUSTR(
+ "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/stamp.sys");
}
else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("shared") )) {
- that->m_activePackages = OUSTR("vnd.sun.star.expand:$UNO_"
- "SHARED_PACKAGES_CACHE/uno_packages");
- that->m_registryCache = OUSTR("vnd.sun.star.expand:$UNO_"
- "SHARED_PACKAGES_CACHE/registry");
-// The current logging implementation does not work for shared, because it requires
-// write access to the logfile. When two users run OOo at the same time on the same machine
-// then the
-// second will fail because it does not get write access. One cannot write into the
-// user's home, because then people may complain that when installing shared extension
-// stuff is written in their home.
-// logFile = OUSTR("vnd.sun.star.expand:$UNO_"
-// "SHARED_PACKAGES_CACHE/log.txt");
- //See description for stampURL for user packages.
- stampURL = OUSTR("vnd.sun.star.expand:$UNO_"
- "SHARED_PACKAGES_CACHE/stamp.sys");
+ that->m_activePackages = OUSTR(
+ "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE/uno_packages");
+ that->m_registrationData = OUSTR(
+ "vnd.sun.star.expand:$SHARED_EXTENSIONS_USER");
+ that->m_registryCache = OUSTR(
+ "vnd.sun.star.expand:$SHARED_EXTENSIONS_USER/registry");
+ logFile = OUSTR(
+ "vnd.sun.star.expand:$SHARED_EXTENSIONS_USER/log.txt");
+ stampURL = OUSTR(
+ "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE/stamp.sys");
+ }
+ else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bundled") )) {
+ that->m_activePackages = OUSTR(
+ "vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
+ that->m_registrationData = OUSTR(
+ "vnd.sun.star.expand:$BUNDLED_EXTENSIONS_USER");
+ that->m_registryCache = OUSTR(
+ "vnd.sun.star.expand:$BUNDLED_EXTENSIONS_USER/registry");
+ logFile = OUSTR(
+ "vnd.sun.star.expand:$BUNDLED_EXTENSIONS_USER/log.txt");
+ //No stamp file. We assume that bundled is always readonly. It must not be
+ //modified from ExtensionManager but only by the installer
+ }
+ else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("tmp") )) {
+ that->m_activePackages = OUSTR(
+ "vnd.sun.star.expand:$TMP_EXTENSIONS/extensions");
+ that->m_registrationData = OUSTR(
+ "vnd.sun.star.expand:$TMP_EXTENSIONS");
+ that->m_registryCache = OUSTR(
+ "vnd.sun.star.expand:$TMP_EXTENSIONS/registry");
+ stampURL = OUSTR(
+ "vnd.sun.star.expand:$TMP_EXTENSIONS/stamp.sys");
}
else if (! context.matchAsciiL(
RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.tdoc:/") )) {
@@ -270,29 +390,15 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create(
Reference<XCommandEnvironment> xCmdEnv;
try {
- bool renewal = false;
-
+ //There is no stampURL for the bundled folder
if (stampURL.getLength() > 0)
- {
- // currently no automatic renewal possible, because quickstarter
- // already hinders from deleting registry directory...
-
+ {
#define CURRENT_STAMP "1"
-// renewal = true;
-// {
-// ::ucbhelper::Content ucbStamp;
-// if (create_ucb_content(
-// &ucbStamp, stampURL, xCmdEnv, false /* no throw */ ))
-// {
-// OUString line;
-// renewal = !readLine( &line, OUSTR(CURRENT_STAMP), ucbStamp,
-// RTL_TEXTENCODING_ASCII_US );
-// }
-// }
-
try {
+ //The osl file API does not allow to find out if one can write
+ //into a folder. Therefore we try to write a file. Then we delete
+ //it, so that it does not hinder uninstallation of OOo
// probe writing:
- erase_path( stampURL, xCmdEnv );
::ucbhelper::Content ucbStamp( stampURL, xCmdEnv );
::rtl::OString stamp(
RTL_CONSTASCII_STRINGPARAM(CURRENT_STAMP) );
@@ -302,8 +408,15 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create(
reinterpret_cast<sal_Int8 const *>(stamp.getStr()),
stamp.getLength() ) ) );
ucbStamp.writeStream( xData, true /* replace existing */ );
+ that->m_readOnly = false;
+ erase_path( stampURL, xCmdEnv );
}
catch (RuntimeException &) {
+ try {
+ erase_path( stampURL, xCmdEnv );
+ } catch (...)
+ {
+ }
throw;
}
catch (Exception &) {
@@ -324,12 +437,6 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create(
xCmdEnv.set( new CmdEnvWrapperImpl( xCmdEnv, that->m_xLogFile ) );
}
- OSL_ENSURE( !that->m_readOnly || !renewal,
- "### ought to reinstall all packages, but cannot write!" );
- if (!that->m_readOnly && renewal) // try to reinstall
- that->reinstallDeployedPackages(
- Reference<task::XAbortChannel>(), xCmdEnv );
-
that->initRegistryBackends();
that->initActivationLayer( xCmdEnv );
@@ -484,7 +591,7 @@ OUString PackageManagerImpl::detectMediaType(
try {
Reference<deployment::XPackage> xPackage(
m_xRegistry->bindPackage(
- url, OUString(), ucbContent.getCommandEnvironment() ) );
+ url, OUString(), false, OUString(), ucbContent.getCommandEnvironment() ) );
const Reference<deployment::XPackageTypeInfo> xPackageType(
xPackage->getPackageType() );
OSL_ASSERT( xPackageType.is() );
@@ -504,6 +611,7 @@ OUString PackageManagerImpl::detectMediaType(
//______________________________________________________________________________
OUString PackageManagerImpl::insertToActivationLayer(
+ Sequence<beans::NamedValue> const & properties,
OUString const & mediaType, ::ucbhelper::Content const & sourceContent_,
OUString const & title, ActivePackages::Data * dbData )
{
@@ -563,11 +671,23 @@ OUString PackageManagerImpl::insertToActivationLayer(
sourceContent, ::ucbhelper::InsertOperation_COPY,
title, NameClash::OVERWRITE ))
throw RuntimeException( OUSTR("UCB transferContent() failed!"), 0 );
+
// write to DB:
+ //bundled extensions should only be added by the synchronizeAddedExtensions
+ //functions. Moreover, there is no "temporary folder" for bundled extensions.
+ OSL_ASSERT(!m_context.equals(OUSTR("bundled")));
+ OUString sFolderUrl = makeURLAppendSysPathSegment(destFolderContent.getURL(), title);
+ DescriptionInfoset info =
+ dp_misc::getDescriptionInfoset(sFolderUrl);
dbData->temporaryName = tempEntry;
dbData->fileName = title;
dbData->mediaType = mediaType;
+ dbData->version = info.getVersion();
+
+ //No write the properties file next to the extension
+ ExtensionProperties props(sFolderUrl, properties, xCmdEnv);
+ props.write();
return destFolder;
}
@@ -575,6 +695,8 @@ OUString PackageManagerImpl::insertToActivationLayer(
void PackageManagerImpl::insertToActivationLayerDB(
OUString const & id, ActivePackages::Data const & dbData )
{
+ //access to the database must be guarded. See removePackage
+ const ::osl::MutexGuard guard( getMutex() );
m_activePackagesDB->put( id, dbData );
}
@@ -582,81 +704,40 @@ void PackageManagerImpl::insertToActivationLayerDB(
/* The function returns true if there is an extension with the same id already
installed which needs to be uninstalled, before the new extension can be installed.
*/
-bool PackageManagerImpl::checkUpdate(
- Reference<deployment::XPackage> const & package,
- Reference<XCommandEnvironment> const & origCmdEnv,
- Reference<XCommandEnvironment> const & wrappedCmdEnv )
+bool PackageManagerImpl::isInstalled(
+ Reference<deployment::XPackage> const & package)
{
OUString id(dp_misc::getIdentifier(package));
OUString fn(package->getName());
- bool removeExisting = false;
+ bool bInstalled = false;
if (m_activePackagesDB->has( id, fn ))
{
- // package already deployed, interact --force:
- Any request(
- (deployment::VersionException(
- getResourceString( RID_STR_PACKAGE_ALREADY_ADDED ) + id,
- static_cast<OWeakObject *>(this), package,
- getDeployedPackage_( id, fn, origCmdEnv ) ) ) );
- bool replace = false, abort = false;
- if (! interactContinuation(
- request, task::XInteractionApprove::static_type(),
- wrappedCmdEnv, &replace, &abort )) {
- OSL_ASSERT( !replace && !abort );
- throw deployment::DeploymentException(
- getResourceString(RID_STR_ERROR_WHILE_ADDING) + id,
- static_cast<OWeakObject *>(this), request );
- }
- if (abort || !replace)
- throw CommandFailedException(
- getResourceString(RID_STR_PACKAGE_ALREADY_ADDED) + id,
- static_cast<OWeakObject *>(this), request );
-
- // remove clashing package before registering new version:
- removeExisting = true;
- }
- return removeExisting;
-}
-//______________________________________________________________________________
-// Notify the user when a new extension is to be installed. This is only the case
-//when unopkg gui extension1 is used (used by system integration (double click on .oxt
-// file etc.)). In case there is already this extension then the function returns
-//true.
-//ToDo: Function always returns true or throws an exception
-bool PackageManagerImpl::checkInstall(
- Reference<deployment::XPackage> const & package,
- Reference<XCommandEnvironment> const & cmdEnv)
-{
- OUString id(dp_misc::getIdentifier(package));
- if ( ! m_activePackagesDB->has( id, package->getName() ))
- {
- Any request(
- deployment::InstallException(
- OUSTR("Extension ") + id + OUSTR(" is about to be installed."),
- static_cast<OWeakObject *>(this), package));
- bool approve = false, abort = false;
- if (! interactContinuation(
- request, task::XInteractionApprove::static_type(),
- cmdEnv, &approve, &abort ))
- {
- OSL_ASSERT( !approve && !abort );
- throw deployment::DeploymentException(
- getResourceString(RID_STR_ERROR_WHILE_ADDING) + id,
- static_cast<OWeakObject *>(this), request );
- }
- if (abort || !approve)
- throw CommandFailedException(
- getResourceString(RID_STR_ERROR_WHILE_ADDING) + id,
- static_cast<OWeakObject *>(this), request );
-
+ bInstalled = true;
}
- return true;
+ return bInstalled;
}
// XPackageManager
//______________________________________________________________________________
+Reference<deployment::XPackage> PackageManagerImpl::importExtension(
+ Reference<deployment::XPackage> const & extension,
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<XCommandEnvironment> const & xCmdEnv_ )
+ throw (deployment::DeploymentException, CommandFailedException,
+ CommandAbortedException, lang::IllegalArgumentException,
+ RuntimeException)
+{
+ return addPackage(extension->getURL(), Sequence<beans::NamedValue>(),
+ OUString(), xAbortChannel, xCmdEnv_);
+}
+
+/* The function adds an extension but does not register it!!!
+ It may not do any user interaction. This is done in XExtensionManager::addExtension
+*/
Reference<deployment::XPackage> PackageManagerImpl::addPackage(
- OUString const & url, OUString const & mediaType_,
+ OUString const & url,
+ css::uno::Sequence<css::beans::NamedValue> const & properties,
+ OUString const & mediaType_,
Reference<task::XAbortChannel> const & xAbortChannel,
Reference<XCommandEnvironment> const & xCmdEnv_ )
throw (deployment::DeploymentException, CommandFailedException,
@@ -729,84 +810,34 @@ Reference<deployment::XPackage> PackageManagerImpl::addPackage(
}
ActivePackages::Data dbData;
destFolder = insertToActivationLayer(
- mediaType, sourceContent, title, &dbData );
+ properties, mediaType, sourceContent, title, &dbData );
// bind activation package:
- //Because every extension will be unpacked in a folder, which was created with a unique name
- //we will always have two different XPackage objects, even if the second extension is the same.
+ //Because every shared/user extension will be unpacked in a folder,
+ //which was created with a unique name we will always have two different
+ //XPackage objects, even if the second extension is the same.
//Therefore bindPackage does not need a guard here.
xPackage = m_xRegistry->bindPackage(
- makeURL( destFolder, title_enc ), mediaType, xCmdEnv );
+ makeURL( destFolder, title_enc ), mediaType, false, OUString(), xCmdEnv );
OSL_ASSERT( xPackage.is() );
if (xPackage.is())
{
bool install = false;
- OUString id;
-
try
{
- id = dp_misc::getIdentifier( xPackage );
- //checkInstall throws an exception if the user denies the installation
- checkInstall(xPackage, xCmdEnv);
- //checkUpdate throws an exception if the user cancels the interaction.
- //For example, he may be asked if he wants to replace the older version
- //with the new version.
- //checkUpdates must be called before checkPrerequisites
- bool bAlreadyInstalled = checkUpdate(
- xPackage, xCmdEnv_, xCmdEnv );
-
- if (xPackage->checkPrerequisites(xAbortChannel, xCmdEnv, bAlreadyInstalled, m_context))
+ OUString const id = dp_misc::getIdentifier( xPackage );
+
+ ::osl::MutexGuard g(m_addMutex);
+ if (isInstalled(xPackage))
{
- //This guard is used to prevent that an extension is installed twice. Do not use it in other
- //functions.
- //Imagine addPackage is called two times by different threads for the same extension quickly
- //after each other.
- //The second call would calculate "bAlreadyInstalled = false" if the first thread has not yet reached
- //insertToActivationLayerDB.
- ::osl::MutexGuard g(m_addMutex);
-
- //Holds the database data of the old extension, in case we need to roll back.
- ActivePackages::Data oldDbData;
- if (bAlreadyInstalled)
- {
- // Remove extension which is already installed. It is not removed from disk, only
- // the different contents are being unregisterd. We remember the databas information
- // in case we need to roll back this operation.
- // When the user canceled the operation (CommandAbortedException) than the package is still
- // fully functional.
- // Do not guard the complete function with the getMutex
- removePackage_(id, xPackage->getName(), xAbortChannel,
- xCmdEnv, & oldDbData);
- }
- install = true;
- const ::osl::MutexGuard guard( getMutex() );
- try
- {
- //throws CommandAbortedException if the user cancelled the installation.
- xPackage->registerPackage(xAbortChannel, xCmdEnv);
- }
- catch(CommandAbortedException & )
- { //ToDo: Interaction so that the gui can display an appropriate string.
- //See also removePackage_
- //User aborted installation, restore the previous situation.
- //Use a private AbortChannel so the user cannot interrupt.
- xPackage->revokePackage(new AbortChannel(), xCmdEnv);
- if (bAlreadyInstalled)
- {
- OUString instFolder = makeURL( m_activePackages, oldDbData.temporaryName)
- + OUSTR("_");
- Reference<deployment::XPackage> xOldPgk = m_xRegistry->bindPackage(
- makeURL( instFolder, oldDbData.fileName ), oldDbData.mediaType, xCmdEnv );
- xOldPgk->registerPackage(new AbortChannel(), xCmdEnv);
- insertToActivationLayerDB(dp_misc::getIdentifier( xOldPgk ), oldDbData);
- }
- throw;
- }
- //access to the database must be guarded. See removePackage_
- insertToActivationLayerDB(id, dbData);
+ //Do not guard the complete function with the getMutex
+ removePackage(id, xPackage->getName(), xAbortChannel,
+ xCmdEnv);
}
+ install = true;
+ insertToActivationLayerDB(id, dbData);
}
catch (...)
{
@@ -817,6 +848,7 @@ Reference<deployment::XPackage> PackageManagerImpl::addPackage(
{
deletePackageFromCache( xPackage, destFolder );
}
+ //ToDo: We should notify only if the extension is registered
fireModified();
}
return xPackage;
@@ -861,57 +893,15 @@ void PackageManagerImpl::deletePackageFromCache(
}
//______________________________________________________________________________
-void PackageManagerImpl::removePackage_(
- OUString const & id, OUString const & fileName,
- Reference<task::XAbortChannel> const & xAbortChannel,
- Reference<XCommandEnvironment> const & xCmdEnv,
- ActivePackages::Data * out_dbData)
-{
- Reference<deployment::XPackage> xPackage;
- {
- try {
- const ::osl::MutexGuard guard(getMutex());
- xPackage = getDeployedPackage_(id, fileName, xCmdEnv );
- m_activePackagesDB->get(out_dbData, id, fileName);
- beans::Optional< beans::Ambiguous<sal_Bool> > option(
- xPackage->isRegistered( Reference<task::XAbortChannel>(),
- xCmdEnv ) );
- if (!option.IsPresent || option.Value.IsAmbiguous || option.Value.Value)
- xPackage->revokePackage( xAbortChannel, xCmdEnv );
- m_activePackagesDB->erase( id, fileName ); // to be removed upon next start
- }
- catch (CommandAbortedException &)
- {
- //ToDo: interaction, so that gui can show an appropriate string
- //reregister the package
- //Create our own XAbortChannel, so the user cannot interrupt the registration.
- xPackage->registerPackage(new AbortChannel(), xCmdEnv);
- throw;
- }
- }
- try_dispose( xPackage );
-}
-
-//______________________________________________________________________________
void PackageManagerImpl::removePackage(
OUString const & id, ::rtl::OUString const & fileName,
- Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<task::XAbortChannel> const & /*xAbortChannel*/,
Reference<XCommandEnvironment> const & xCmdEnv_ )
throw (deployment::DeploymentException, CommandFailedException,
CommandAbortedException, lang::IllegalArgumentException,
RuntimeException)
{
check();
- if (m_readOnly)
- {
- OUString message;
- if (m_context == OUSTR("shared"))
- message = OUSTR("You need write permissions in order to remove a shared extension!");
- else
- message = OUSTR("You need write permissions in order to remove this extension!");
- throw deployment::DeploymentException(
- message, static_cast<OWeakObject *>(this), Any() );
- }
Reference<XCommandEnvironment> xCmdEnv;
if (m_xLogFile.is())
@@ -920,7 +910,48 @@ void PackageManagerImpl::removePackage(
xCmdEnv.set( xCmdEnv_ );
try {
- removePackage_( id, fileName, xAbortChannel, xCmdEnv, NULL);
+ Reference<deployment::XPackage> xPackage;
+ {
+ const ::osl::MutexGuard guard(getMutex());
+ //Check if this extension exist and throw an IllegalArgumentException
+ //if it does not
+ //If the files of the extension are already removed, or there is a
+ //different extension at the same place, for example after updating the
+ //extension, then the returned object is that which uses the database data.
+ xPackage = getDeployedPackage_(id, fileName, xCmdEnv );
+
+
+ //Because the extension is only removed the next time the extension
+ //manager runs after restarting OOo, we need to indicate that a
+ //shared extension was "deleted". When a user starts OOo, then it
+ //will check if something changed in the shared repository. Based on
+ //the flag file it will then recognize, that the extension was
+ //deleted and can then update the extnesion database of the shared
+ //extensions in the user installation.
+ if ( xPackage.is() && !m_readOnly && !xPackage->isRemoved() && m_context.equals(OUSTR("shared")))
+ {
+ ActivePackages::Data val;
+ m_activePackagesDB->get( & val, id, fileName);
+ OSL_ASSERT(val.temporaryName.getLength());
+ OUString url(makeURL(m_activePackages_expanded,
+ val.temporaryName + OUSTR("removed")));
+ ::ucbhelper::Content contentRemoved(url, xCmdEnv );
+ OUString aUserName;
+ ::osl::Security aSecurity;
+ aSecurity.getUserName( aUserName );
+
+ ::rtl::OString stamp = ::rtl::OUStringToOString(aUserName, RTL_TEXTENCODING_UTF8);
+ Reference<css::io::XInputStream> xData(
+ ::xmlscript::createInputStream(
+ ::rtl::ByteSequence(
+ reinterpret_cast<sal_Int8 const *>(stamp.getStr()),
+ stamp.getLength() ) ) );
+ contentRemoved.writeStream( xData, true /* replace existing */ );
+ }
+ m_activePackagesDB->erase( id, fileName ); // to be removed upon next start
+ }
+ try_dispose( xPackage );
+
fireModified();
}
catch (RuntimeException &) {
@@ -955,10 +986,16 @@ OUString PackageManagerImpl::getDeployPath( ActivePackages::Data const & data )
{
::rtl::OUStringBuffer buf;
buf.append( data.temporaryName );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("_/") );
- buf.append( ::rtl::Uri::encode( data.fileName, rtl_UriCharClassPchar,
+ //The bundled extensions are not contained in an additional folder
+ //with a unique name. data.temporaryName contains already the
+ //UTF8 encoded folder name. See PackageManagerImpl::synchronize
+ if (!m_context.equals(OUSTR("bundled")))
+ {
+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("_/") );
+ buf.append( ::rtl::Uri::encode( data.fileName, rtl_UriCharClassPchar,
rtl_UriEncodeIgnoreEscapes,
RTL_TEXTENCODING_UTF8 ) );
+ }
return makeURL( m_activePackages, buf.makeStringAndClear() );
}
@@ -997,8 +1034,22 @@ Reference<deployment::XPackage> PackageManagerImpl::getDeployedPackage_(
static_cast<sal_Int16>(-1) );
}
}
- return m_xRegistry->bindPackage(
- getDeployPath( data ), data.mediaType, xCmdEnv );
+ Reference<deployment::XPackage> xExtension;
+ try
+ {
+ //Ignore extensions where XPackage::checkPrerequisites failed.
+ //They must not be usable for this user.
+ if (data.failedPrerequisites.equals(OUSTR("0")))
+ {
+ xExtension = m_xRegistry->bindPackage(
+ getDeployPath( data ), data.mediaType, false, OUString(), xCmdEnv );
+ }
+ }
+ catch (deployment::InvalidRemovedParameterException& e)
+ {
+ xExtension = e.Extension;
+ }
+ return xExtension;
}
//______________________________________________________________________________
@@ -1012,6 +1063,8 @@ PackageManagerImpl::getDeployedPackages_(
ActivePackages::Entries::const_iterator const iEnd( id2temp.end() );
for ( ; iPos != iEnd; ++iPos )
{
+ if (! iPos->second.failedPrerequisites.equals(OUSTR("0")))
+ continue;
try {
packages.push_back(
getDeployedPackage_(
@@ -1124,25 +1177,18 @@ PackageManagerImpl::getDeployedPackages(
}
//______________________________________________________________________________
+
+
+//ToDo: the function must not call registerPackage, do this in
+//XExtensionManager.reinstallDeployedExtensions
void PackageManagerImpl::reinstallDeployedPackages(
- Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<task::XAbortChannel> const & /*xAbortChannel*/,
Reference<XCommandEnvironment> const & xCmdEnv_ )
throw (deployment::DeploymentException,
CommandFailedException, CommandAbortedException,
lang::IllegalArgumentException, RuntimeException)
{
check();
- if (m_readOnly)
- {
- OUString message;
- if (m_context == OUSTR("shared"))
- message = OUSTR("You need write permissions in order to install shared extensions!");
- else
- message = OUSTR("You need write permissions in order to install extensions!");
- throw deployment::DeploymentException(
- message, static_cast<OWeakObject *>(this), Any() );
- }
-
if (office_is_running())
throw RuntimeException(
OUSTR("You must close any running Office process before "
@@ -1166,13 +1212,8 @@ void PackageManagerImpl::reinstallDeployedPackages(
Reference<util::XUpdatable> xUpdatable( m_xRegistry, UNO_QUERY );
if (xUpdatable.is())
xUpdatable->update();
-
- // reregister all:
- const ::osl::MutexGuard guard( getMutex() );
- const Sequence< Reference<deployment::XPackage> > packages(
- getDeployedPackages_( xCmdEnv ) );
- for ( sal_Int32 pos = 0; pos < packages.getLength(); ++pos )
- packages[ pos ]->registerPackage( xAbortChannel, xCmdEnv );
+
+ //registering is done by the ExtensionManager service.
}
catch (RuntimeException &) {
throw;
@@ -1205,6 +1246,362 @@ void PackageManagerImpl::reinstallDeployedPackages(
{
return m_readOnly;
}
+bool PackageManagerImpl::synchronizeRemovedExtensions(
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<css::ucb::XCommandEnvironment> const & xCmdEnv)
+{
+
+ //find all which are in the extension data base but which
+ //are removed already.
+ OSL_ASSERT(!m_context.equals(OUSTR("user")));
+ bool bModified = false;
+ ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() );
+
+ typedef ActivePackages::Entries::const_iterator ITActive;
+ bool bShared = m_context.equals(OUSTR("shared"));
+
+ for (ITActive i = id2temp.begin(); i != id2temp.end(); i++)
+ {
+ try
+ {
+ //Get the URL to the extensions folder, first make the url for the
+ //shared repository including the temporary name
+ OUString url = makeURL(m_activePackages, i->second.temporaryName);
+ if (bShared)
+ url = makeURLAppendSysPathSegment( url + OUSTR("_"), i->second.fileName);
+
+ bool bRemoved = false;
+ //Check if the URL to the extension is still the same
+ ::ucbhelper::Content contentExtension;
+
+ if (!create_ucb_content(
+ &contentExtension, url,
+ Reference<XCommandEnvironment>(), false))
+ {
+ bRemoved = true;
+ }
+
+ //The folder is in the extension database, but it can still be deleted.
+ //look for the xxx.tmpremoved file
+ //There can also be the case that a different extension was installed
+ //in a "temp" folder with name that is already used.
+ if (!bRemoved && bShared)
+ {
+ ::ucbhelper::Content contentRemoved;
+
+ if (create_ucb_content(
+ &contentRemoved,
+ m_activePackages_expanded + OUSTR("/") +
+ i->second.temporaryName + OUSTR("removed"),
+ Reference<XCommandEnvironment>(), false))
+ {
+ bRemoved = true;
+ }
+ }
+
+ if (!bRemoved)
+ {
+ //There may be another extensions at the same place
+ dp_misc::DescriptionInfoset infoset =
+ dp_misc::getDescriptionInfoset(url);
+ OSL_ENSURE(infoset.hasDescription(),
+ "Extension Manager: bundled and shared extensions "
+ "must have an identifer and a version");
+ if (infoset.hasDescription() &&
+ infoset.getIdentifier() &&
+ (! i->first.equals(*(infoset.getIdentifier()))
+ || ! i->second.version.equals(infoset.getVersion())))
+ {
+ bRemoved = true;
+ }
+
+ }
+ if (bRemoved)
+ {
+ Reference<deployment::XPackage> xPackage = m_xRegistry->bindPackage(
+ url, i->second.mediaType, true, i->first, xCmdEnv );
+ OSL_ASSERT(xPackage.is()); //Even if the files are removed, we must get the object.
+ xPackage->revokePackage(xAbortChannel, xCmdEnv);
+ removePackage(xPackage->getIdentifier().Value, xPackage->getName(),
+ xAbortChannel, xCmdEnv);
+ bModified |= true;
+ }
+ }
+ catch( uno::Exception & )
+ {
+ OSL_ASSERT(0);
+ }
+ }
+ return bModified;
+}
+
+
+bool PackageManagerImpl::synchronizeAddedExtensions(
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<css::ucb::XCommandEnvironment> const & xCmdEnv)
+{
+ bool bModified = false;
+ ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() );
+ //check if the folder exist at all. The shared extension folder
+ //may not exist for a normal user.
+ if (!create_ucb_content(
+ NULL, m_activePackages_expanded, Reference<css::ucb::XCommandEnvironment>(), false))
+ return bModified;
+ ::ucbhelper::Content tempFolder(
+ m_activePackages_expanded, xCmdEnv );
+
+ Reference<sdbc::XResultSet> xResultSet(
+ tempFolder.createCursor(
+ Sequence<OUString>( &StrTitle::get(), 1 ),
+ ::ucbhelper::INCLUDE_FOLDERS_ONLY ) );
+
+ while (xResultSet->next())
+ {
+ try
+ {
+ OUString title(
+ Reference<sdbc::XRow>(
+ xResultSet, UNO_QUERY_THROW )->getString(
+ 1 /* Title */ ) );
+ //The temporary folders of user and shared have an '_' at then end.
+ //But the name in ActivePackages.temporaryName is saved without.
+ OUString title2 = title;
+ bool bNotBundled = !m_context.equals(OUSTR("bundled"));
+ if (bNotBundled)
+ {
+ OSL_ASSERT(title2[title2.getLength() -1] == '_');
+ title2 = title2.copy(0, title2.getLength() -1);
+ }
+ OUString titleEncoded = ::rtl::Uri::encode(
+ title2, rtl_UriCharClassPchar,
+ rtl_UriEncodeIgnoreEscapes,
+ RTL_TEXTENCODING_UTF8);
+
+ //It it sufficient to check for the folder name, because when the administor
+ //installed the extension it was already checked if there is one with the
+ //same identifier.
+ const MatchTempDir match(titleEncoded);
+ if (::std::find_if( id2temp.begin(), id2temp.end(), match ) ==
+ id2temp.end())
+ {
+
+ // The folder was not found in the data base, so it must be
+ // an added extension
+ OUString url(m_activePackages_expanded + OUSTR("/") + titleEncoded);
+ OUString sExtFolder;
+ if (bNotBundled) //that is, shared
+ {
+ //Check if the extension was not "deleted" already which is indicated
+ //by a xxx.tmpremoved file
+ ::ucbhelper::Content contentRemoved;
+ if (create_ucb_content(&contentRemoved, url + OUSTR("removed"),
+ Reference<XCommandEnvironment>(), false))
+ continue;
+ sExtFolder = getExtensionFolder(
+ m_activePackages_expanded +
+ OUString(OUSTR("/")) + titleEncoded + OUSTR("_"), xCmdEnv);
+ url = makeURLAppendSysPathSegment(m_activePackages_expanded, title);
+ url = makeURLAppendSysPathSegment(url, sExtFolder);
+ }
+ Reference<deployment::XPackage> xPackage = m_xRegistry->bindPackage(
+ url, OUString(), false, OUString(), xCmdEnv );
+ if (xPackage.is())
+ {
+ //Prepare the database entry
+ ActivePackages::Data dbData;
+
+ dbData.temporaryName = titleEncoded;
+ if (bNotBundled)
+ dbData.fileName = sExtFolder;
+ else
+ dbData.fileName = title;
+ dbData.mediaType = xPackage->getPackageType()->getMediaType();
+ dbData.version = xPackage->getVersion();
+ OSL_ENSURE(dbData.version.getLength() > 0,
+ "Extension Manager: bundled and shared extensions must have "
+ "an identifier and a version");
+
+ OUString id = dp_misc::getIdentifier( xPackage );
+
+ //We provide a special command environment that will prevent
+ //showing a license if simple-licens/@accept-by = "admin"
+ //It will also prevent showing the license for bundled extensions
+ //which is not supported.
+ OSL_ASSERT(!m_context.equals(OUSTR("user")));
+
+ // shall the license be suppressed?
+ DescriptionInfoset info =
+ dp_misc::getDescriptionInfoset(url);
+ ::boost::optional<dp_misc::SimpleLicenseAttributes>
+ attr = info.getSimpleLicenseAttributes();
+ ExtensionProperties props(url,xCmdEnv);
+ bool bNoLicense = false;
+ if (attr && attr->suppressIfRequired && props.isSuppressedLicense())
+ bNoLicense = true;
+
+ Reference<ucb::XCommandEnvironment> licCmdEnv(
+ new LicenseCommandEnv(xCmdEnv->getInteractionHandler(),
+ bNoLicense, m_context));
+ sal_Int32 failedPrereq = xPackage->checkPrerequisites(
+ xAbortChannel, licCmdEnv, false);
+ //Remember that this failed. For example, the user
+ //could have declined the license. Then the next time the
+ //extension folder is investigated we do not want to
+ //try to install the extension again.
+ dbData.failedPrerequisites = OUString::valueOf(failedPrereq);
+ insertToActivationLayerDB(id, dbData);
+ bModified |= true;
+ }
+ }
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ASSERT(0);
+ }
+ }
+ return bModified;
+}
+
+sal_Bool PackageManagerImpl::synchronize(
+ Reference<task::XAbortChannel> const & xAbortChannel,
+ Reference<css::ucb::XCommandEnvironment> const & xCmdEnv)
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::uno::RuntimeException)
+{
+ check();
+ bool bModified = false;
+ if (m_context.equals(OUSTR("user")))
+ return bModified;
+ bModified |=
+ synchronizeRemovedExtensions(xAbortChannel, xCmdEnv);
+ bModified |= synchronizeAddedExtensions(xAbortChannel, xCmdEnv);
+
+ return bModified;
+}
+
+Sequence< Reference<deployment::XPackage> > PackageManagerImpl::getExtensionsWithUnacceptedLicenses(
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv)
+ throw (deployment::DeploymentException, RuntimeException)
+{
+ ::std::vector<Reference<deployment::XPackage> > vec;
+
+ try
+ {
+ const ::osl::MutexGuard guard( getMutex() );
+ // clean up activation layer, scan for zombie temp dirs:
+ ActivePackages::Entries id2temp( m_activePackagesDB->getEntries() );
+
+ ActivePackages::Entries::const_iterator i = id2temp.begin();
+ bool bShared = m_context.equals(OUSTR("shared"));
+
+ for (; i != id2temp.end(); i++ )
+ {
+ //Get the database entry
+ ActivePackages::Data const & dbData = i->second;
+ sal_Int32 failedPrereq = dbData.failedPrerequisites.toInt32();
+ //If the installation failed for other reason then the license then we
+ //ignore it.
+ if (failedPrereq ^= deployment::Prerequisites::LICENSE)
+ continue;
+
+ //Prepare the URL to the extension
+ OUString url = makeURL(m_activePackages, i->second.temporaryName);
+ if (bShared)
+ url = makeURLAppendSysPathSegment( url + OUSTR("_"), i->second.fileName);
+
+ Reference<deployment::XPackage> p = m_xRegistry->bindPackage(
+ url, OUString(), false, OUString(), xCmdEnv );
+
+ if (p.is())
+ vec.push_back(p);
+
+ }
+ return ::comphelper::containerToSequence(vec);
+ }
+ catch (deployment::DeploymentException &)
+ {
+ throw;
+ }
+ catch (RuntimeException&)
+ {
+ throw;
+ }
+ catch (...)
+ {
+ Any exc = ::cppu::getCaughtException();
+ deployment::DeploymentException de(
+ OUSTR("PackageManagerImpl::getExtensionsWithUnacceptedLicenses"),
+ static_cast<OWeakObject*>(this), exc);
+ exc <<= de;
+ ::cppu::throwException(exc);
+ }
+
+ return ::comphelper::containerToSequence(vec);
+}
+
+sal_Int32 PackageManagerImpl::checkPrerequisites(
+ css::uno::Reference<css::deployment::XPackage> const & extension,
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException)
+{
+ try
+ {
+ if (!extension.is())
+ return 0;
+ if (!m_context.equals(extension->getRepositoryName()))
+ throw lang::IllegalArgumentException(
+ OUSTR("PackageManagerImpl::checkPrerequisites: extension is not"
+ " from this repository."), 0, 0);
+
+ ActivePackages::Data dbData;
+ OUString id = dp_misc::getIdentifier(extension);
+ if (m_activePackagesDB->get( &dbData, id, OUString()))
+ {
+ //If the license was already displayed, then do not show it again
+ Reference<ucb::XCommandEnvironment> _xCmdEnv = xCmdEnv;
+ sal_Int32 prereq = dbData.failedPrerequisites.toInt32();
+ if ( !(prereq & deployment::Prerequisites::LICENSE))
+ _xCmdEnv = new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler());
+
+ sal_Int32 failedPrereq = extension->checkPrerequisites(
+ xAbortChannel, _xCmdEnv, false);
+ dbData.failedPrerequisites = OUString::valueOf(failedPrereq);
+ insertToActivationLayerDB(id, dbData);
+ }
+ else
+ {
+ throw lang::IllegalArgumentException(
+ OUSTR("PackageManagerImpl::checkPrerequisites: unknown extension"),
+ 0, 0);
+
+ }
+ return 0;
+ }
+ catch (deployment::DeploymentException& ) {
+ throw;
+ } catch (ucb::CommandFailedException & ) {
+ throw;
+ } catch (ucb::CommandAbortedException & ) {
+ throw;
+ } catch (lang::IllegalArgumentException &) {
+ throw;
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (...) {
+ uno::Any excOccurred = ::cppu::getCaughtException();
+ deployment::DeploymentException exc(
+ OUSTR("PackageManagerImpl::checkPrerequisites: exception "),
+ static_cast<OWeakObject*>(this), excOccurred);
+ throw exc;
+ }
+}
//##############################################################################
diff --git a/desktop/source/deployment/manager/dp_manager.h b/desktop/source/deployment/manager/dp_manager.h
index 47af7ed110..d99f41d42c 100644
--- a/desktop/source/deployment/manager/dp_manager.h
+++ b/desktop/source/deployment/manager/dp_manager.h
@@ -53,6 +53,8 @@ class PackageManagerImpl : private ::dp_misc::MutexHolder, public t_pm_helper
{
css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;
::rtl::OUString m_context;
+ ::rtl::OUString m_registrationData;
+ ::rtl::OUString m_registrationData_expanded;
::rtl::OUString m_registryCache;
bool m_readOnly;
@@ -73,6 +75,7 @@ class PackageManagerImpl : private ::dp_misc::MutexHolder, public t_pm_helper
::rtl::OUString detectMediaType(
::ucbhelper::Content const & ucbContent, bool throw_exc = true );
::rtl::OUString insertToActivationLayer(
+ css::uno::Sequence<css::beans::NamedValue> const & properties,
::rtl::OUString const & mediaType,
::ucbhelper::Content const & sourceContent,
::rtl::OUString const & title, ActivePackages::Data * dbData );
@@ -83,16 +86,16 @@ class PackageManagerImpl : private ::dp_misc::MutexHolder, public t_pm_helper
css::uno::Reference<css::deployment::XPackage> const & xPackage,
::rtl::OUString const & destFolder );
- bool checkUpdate(
- css::uno::Reference<css::deployment::XPackage> const & package,
- css::uno::Reference<css::ucb::XCommandEnvironment> const & origCmdEnv,
- css::uno::Reference<css::ucb::XCommandEnvironment> const &
- wrappedCmdEnv );
+ bool isInstalled(
+ css::uno::Reference<css::deployment::XPackage> const & package);
- bool checkInstall(
- css::uno::Reference<css::deployment::XPackage> const & package,
- css::uno::Reference<css::ucb::XCommandEnvironment> const & cmdEnv);
+ bool synchronizeRemovedExtensions(
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
+ bool synchronizeAddedExtensions(
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
class CmdEnvWrapperImpl
: public ::cppu::WeakImplHelper2< css::ucb::XCommandEnvironment,
@@ -135,7 +138,7 @@ protected:
: t_pm_helper( getMutex() ),
m_xComponentContext( xComponentContext ),
m_context( context ),
- m_readOnly( false )
+ m_readOnly( true )
{}
public:
@@ -171,7 +174,9 @@ public:
createAbortChannel() throw (css::uno::RuntimeException);
virtual css::uno::Reference<css::deployment::XPackage> SAL_CALL addPackage(
- ::rtl::OUString const & url, ::rtl::OUString const & mediaType,
+ ::rtl::OUString const & url,
+ css::uno::Sequence<css::beans::NamedValue> const & properties,
+ ::rtl::OUString const & mediaType,
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
throw (css::deployment::DeploymentException,
@@ -180,17 +185,15 @@ public:
css::lang::IllegalArgumentException,
css::uno::RuntimeException);
- /* Unregisters the package but does not remove it from disk.
- When the operation is canceled by the user, a CommandAbortedException
- is thrown. Then the package is still fully functional.
- @param out_oldData
- can be NULL
- */
- void removePackage_(
- ::rtl::OUString const & id, ::rtl::OUString const & fileName,
+ virtual css::uno::Reference<css::deployment::XPackage> SAL_CALL importExtension(
+ css::uno::Reference<css::deployment::XPackage> const & extension,
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
- css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv,
- ActivePackages::Data * out_oldData);
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
virtual void SAL_CALL removePackage(
::rtl::OUString const & id, ::rtl::OUString const & fileName,
@@ -242,7 +245,31 @@ public:
virtual ::sal_Bool SAL_CALL isReadOnly( )
throw (::com::sun::star::uno::RuntimeException);
-};
+
+ virtual ::sal_Bool SAL_CALL synchronize(
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Sequence<css::uno::Reference<css::deployment::XPackage> > SAL_CALL
+ getExtensionsWithUnacceptedLicenses(
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv)
+ throw (css::deployment::DeploymentException,
+ css::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL checkPrerequisites(
+ css::uno::Reference<css::deployment::XPackage> const & extension,
+ css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (css::deployment::DeploymentException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::lang::IllegalArgumentException,
+ css::uno::RuntimeException);
+ };
//______________________________________________________________________________
inline void PackageManagerImpl::check()
diff --git a/desktop/source/deployment/manager/dp_manager.hrc b/desktop/source/deployment/manager/dp_manager.hrc
index 5f761303e4..3dd89f57cf 100644
--- a/desktop/source/deployment/manager/dp_manager.hrc
+++ b/desktop/source/deployment/manager/dp_manager.hrc
@@ -35,5 +35,5 @@
#define RID_STR_PACKAGE_ALREADY_ADDED (RID_DEPLOYMENT_MANAGER_START+2)
#define RID_STR_COPYING_PACKAGE (RID_DEPLOYMENT_MANAGER_START+3)
#define RID_STR_NO_SUCH_PACKAGE (RID_DEPLOYMENT_MANAGER_START+4)
-
+#define RID_STR_SYNCHRONIZING_REPOSITORY (RID_DEPLOYMENT_MANAGER_START+5)
#endif
diff --git a/desktop/source/deployment/manager/dp_manager.src b/desktop/source/deployment/manager/dp_manager.src
index 479d09f5fd..7430a8cab0 100644
--- a/desktop/source/deployment/manager/dp_manager.src
+++ b/desktop/source/deployment/manager/dp_manager.src
@@ -53,3 +53,7 @@ String RID_STR_NO_SUCH_PACKAGE
Text [ en-US ] = "There is no such extension deployed: ";
};
+String RID_STR_SYNCHRONIZING_REPOSITORY
+{
+ Text [ en-US ] = "Synchronizing repository for %NAME extensions";
+};
diff --git a/desktop/source/deployment/manager/dp_managerfac.cxx b/desktop/source/deployment/manager/dp_managerfac.cxx
index 21102bed29..ec312621c7 100644
--- a/desktop/source/deployment/manager/dp_managerfac.cxx
+++ b/desktop/source/deployment/manager/dp_managerfac.cxx
@@ -53,6 +53,7 @@ class PackageManagerFactoryImpl : private MutexHolder, public t_pmfac_helper
Reference<deployment::XPackageManager> m_xUserMgr;
Reference<deployment::XPackageManager> m_xSharedMgr;
+ Reference<deployment::XPackageManager> m_xBundledMgr;
typedef ::std::hash_map<
OUString, WeakReference<deployment::XPackageManager>,
::rtl::OUStringHash > t_string2weakref;
@@ -141,6 +142,7 @@ void PackageManagerFactoryImpl::disposing()
// the below are already disposed:
m_xUserMgr.clear();
m_xSharedMgr.clear();
+ m_xBundledMgr.clear();
}
// XPackageManagerFactory
@@ -172,6 +174,8 @@ PackageManagerFactoryImpl::getPackageManager( OUString const & context )
m_xUserMgr = xRet;
else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("shared") ))
m_xSharedMgr = xRet;
+ else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bundled") ))
+ m_xBundledMgr = xRet;
}
else
{
diff --git a/desktop/source/deployment/manager/dp_properties.cxx b/desktop/source/deployment/manager/dp_properties.cxx
new file mode 100644
index 0000000000..65f3d14c75
--- /dev/null
+++ b/desktop/source/deployment/manager/dp_properties.cxx
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_desktop.hxx"
+
+#include "com/sun/star/ucb/XCommandEnvironment.hpp"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "xmlscript/xml_helper.hxx"
+#include "ucbhelper/content.hxx"
+#include <list>
+
+#include "dp_ucb.h"
+#include "rtl/ustrbuf.hxx"
+#include "dp_properties.hxx"
+
+namespace lang = com::sun::star::lang;
+namespace task = com::sun::star::task;
+namespace ucb = com::sun::star::ucb;
+namespace uno = com::sun::star::uno;
+namespace css = com::sun::star;
+
+#define OUSTR(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+#define PROP_SUPPRESS_LICENSE "SUPPRESS_LICENSE"
+#define PROP_EXTENSION_UPDATE "EXTENSION_UPDATE"
+
+namespace dp_manager {
+
+//Reading the file
+ExtensionProperties::ExtensionProperties(
+ OUString const & urlExtension,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv) :
+ m_xCmdEnv(xCmdEnv)
+{
+ m_propFileUrl = urlExtension + OUSTR("properties");
+
+ ::std::list< ::std::pair< OUString, OUString> > props;
+ if (! dp_misc::create_ucb_content(NULL, m_propFileUrl, 0, false))
+ return;
+
+ ::ucbhelper::Content contentProps(m_propFileUrl, m_xCmdEnv);
+ dp_misc::readProperties(props, contentProps);
+
+ typedef ::std::list< ::std::pair< OUString, OUString> >::const_iterator CI;
+ for (CI i = props.begin(); i != props.end(); i++)
+ {
+ if (i->first.equals(OUSTR(PROP_SUPPRESS_LICENSE)))
+ m_prop_suppress_license = i->second;
+ }
+}
+
+//Writing the file
+ExtensionProperties::ExtensionProperties(
+ OUString const & urlExtension,
+ uno::Sequence<css::beans::NamedValue> const & properties,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv) :
+ m_xCmdEnv(xCmdEnv)
+{
+ m_propFileUrl = urlExtension + OUSTR("properties");
+
+ for (sal_Int32 i = 0; i < properties.getLength(); i++)
+ {
+ css::beans::NamedValue const & v = properties[i];
+ if (v.Name.equals(OUSTR(PROP_SUPPRESS_LICENSE)))
+ {
+ m_prop_suppress_license = getPropertyValue(v);
+ }
+ else if (v.Name.equals(OUSTR(PROP_EXTENSION_UPDATE)))
+ {
+ m_prop_extension_update = getPropertyValue(v);
+ }
+ else
+ {
+ throw lang::IllegalArgumentException(
+ OUSTR("Extension Manager: unknown property"), 0, -1);
+ }
+ }
+}
+
+OUString ExtensionProperties::getPropertyValue(css::beans::NamedValue const & v)
+{
+ OUString value(OUSTR("0"));
+ if (v.Value >>= value)
+ {
+ if (value.equals(OUSTR("1")))
+ value = OUSTR("1");
+ }
+ else
+ {
+ throw lang::IllegalArgumentException(
+ OUSTR("Extension Manager: wrong property value"), 0, -1);
+ }
+ return value;
+}
+void ExtensionProperties::write()
+{
+ ::ucbhelper::Content contentProps(m_propFileUrl, m_xCmdEnv);
+ ::rtl::OUStringBuffer buf;
+
+ if (m_prop_suppress_license)
+ {
+ buf.append(OUSTR(PROP_SUPPRESS_LICENSE));
+ buf.append(OUSTR("="));
+ buf.append(*m_prop_suppress_license);
+ }
+
+ ::rtl::OString stamp = ::rtl::OUStringToOString(
+ buf.makeStringAndClear(), RTL_TEXTENCODING_UTF8);
+ Reference<css::io::XInputStream> xData(
+ ::xmlscript::createInputStream(
+ ::rtl::ByteSequence(
+ reinterpret_cast<sal_Int8 const *>(stamp.getStr()),
+ stamp.getLength() ) ) );
+ contentProps.writeStream( xData, true /* replace existing */ );
+}
+
+bool ExtensionProperties::isSuppressedLicense()
+{
+ bool ret = false;
+ if (m_prop_suppress_license)
+ {
+ if (m_prop_suppress_license->equals(OUSTR("1")))
+ ret = true;
+ }
+ return ret;
+}
+
+bool ExtensionProperties::isExtensionUpdate()
+{
+ bool ret = false;
+ if (m_prop_extension_update)
+ {
+ if (m_prop_extension_update->equals(OUSTR("1")))
+ ret = true;
+ }
+ return ret;
+}
+
+} // namespace dp_manager
+
+
diff --git a/desktop/source/deployment/manager/dp_properties.hxx b/desktop/source/deployment/manager/dp_properties.hxx
new file mode 100644
index 0000000000..f135ff9977
--- /dev/null
+++ b/desktop/source/deployment/manager/dp_properties.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dp_manager.h,v $
+ * $Revision: 1.17 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#if ! defined INCLUDED_DP_PROPERTIES_HXX
+#define INCLUDED_DP_PROPERTIES_HXX
+
+
+
+#include "com/sun/star/beans/NamedValue.hpp"
+#include "com/sun/star/ucb/XCommandEnvironment.hpp"
+#include "boost/optional.hpp"
+
+
+namespace css = ::com::sun::star;
+
+namespace dp_manager {
+
+
+
+/**
+
+ */
+class ExtensionProperties
+{
+protected:
+ ::rtl::OUString m_propFileUrl;
+ const css::uno::Reference<css::ucb::XCommandEnvironment> m_xCmdEnv;
+ ::boost::optional< ::rtl::OUString> m_prop_suppress_license;
+ ::boost::optional< ::rtl::OUString> m_prop_extension_update;
+
+ ::rtl::OUString getPropertyValue(css::beans::NamedValue const & v);
+public:
+
+ virtual ~ExtensionProperties() {};
+ ExtensionProperties(::rtl::OUString const & urlExtension,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
+
+ ExtensionProperties(::rtl::OUString const & urlExtension,
+ css::uno::Sequence<css::beans::NamedValue> const & properties,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
+
+ void write();
+
+ bool isSuppressedLicense();
+
+ bool isExtensionUpdate();
+};
+}
+
+
+
+
+#endif
+
diff --git a/desktop/source/deployment/manager/makefile.mk b/desktop/source/deployment/manager/makefile.mk
index a9ff47881f..4dc6405e34 100644
--- a/desktop/source/deployment/manager/makefile.mk
+++ b/desktop/source/deployment/manager/makefile.mk
@@ -45,7 +45,10 @@ SLOFILES = \
$(SLO)$/dp_activepackages.obj \
$(SLO)$/dp_manager.obj \
$(SLO)$/dp_managerfac.obj \
- $(SLO)$/dp_informationprovider.obj
+ $(SLO)$/dp_informationprovider.obj \
+ $(SLO)$/dp_extensionmanager.obj \
+ $(SLO)$/dp_commandenvironments.obj \
+ $(SLO)$/dp_properties.obj
.INCLUDE : ..$/target.pmk
.INCLUDE : target.mk
diff --git a/desktop/source/deployment/migration/dp_migration.cxx b/desktop/source/deployment/migration/dp_migration.cxx
deleted file mode 100644
index ea1b39a28d..0000000000
--- a/desktop/source/deployment/migration/dp_migration.cxx
+++ /dev/null
@@ -1,251 +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_desktop.hxx"
-
-#include "dp_misc.h"
-#include "dp_ucb.h"
-#include "cppuhelper/implbase1.hxx"
-#include "cppuhelper/implbase2.hxx"
-#include "cppuhelper/exc_hlp.hxx"
-#include "ucbhelper/content.hxx"
-#include "comphelper/anytostring.hxx"
-#include "comphelper/servicedecl.hxx"
-#include "com/sun/star/lang/WrappedTargetException.hpp"
-#include "com/sun/star/task/XJob.hpp"
-#include "com/sun/star/task/XInteractionAbort.hpp"
-#include "com/sun/star/task/XInteractionApprove.hpp"
-#include "com/sun/star/sdbc/XResultSet.hpp"
-#include "com/sun/star/sdbc/XRow.hpp"
-#include "com/sun/star/ucb/XContentAccess.hpp"
-#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
-
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::uno;
-using namespace ::dp_misc;
-using ::rtl::OUString;
-
-namespace dp_migration {
-
-class MigrationImpl : public ::cppu::WeakImplHelper1<task::XJob>
-{
- struct CommandEnvironmentImpl
- : public ::cppu::WeakImplHelper2< XCommandEnvironment,
- task::XInteractionHandler >
- {
- // XCommandEnvironment
- virtual Reference<task::XInteractionHandler> SAL_CALL
- getInteractionHandler() throw (RuntimeException);
- virtual Reference<XProgressHandler> SAL_CALL getProgressHandler()
- throw (RuntimeException);
- // XInteractionHandler
- virtual void SAL_CALL handle(
- Reference<task::XInteractionRequest> const & xRequest )
- throw (RuntimeException);
- };
-
- const Reference<XComponentContext> m_xContext;
- OUString m_userData;
-
-protected:
- virtual ~MigrationImpl();
-public:
- MigrationImpl( Sequence<Any> const & args,
- Reference<XComponentContext> const & xComponentContext );
-
- // XJob
- virtual Any SAL_CALL execute( Sequence<beans::NamedValue> const & args )
- throw (lang::IllegalArgumentException, Exception, RuntimeException);
-};
-
-MigrationImpl::~MigrationImpl()
-{
-}
-
-MigrationImpl::MigrationImpl(
- Sequence<Any> const & args, Reference<XComponentContext> const & xContext )
- : m_xContext(xContext)
-{
- for ( sal_Int32 pos = args.getLength(); pos--; )
- {
- const beans::NamedValue nv(args[pos].get<beans::NamedValue>());
- if (nv.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("UserData") ))
- m_userData = nv.Value.get<OUString>();
- }
- if (m_userData.getLength() == 0)
- throw lang::IllegalArgumentException( OUSTR("missing UserData!"), 0,
- static_cast<sal_Int16>(-1) );
-}
-
-// XJob
-Any MigrationImpl::execute( Sequence<beans::NamedValue> const & )
- throw (lang::IllegalArgumentException, Exception, RuntimeException)
-{
- const Reference<deployment::XPackageManager> xManager(
- deployment::thePackageManagerFactory::get(
- m_xContext )->getPackageManager( OUSTR("user") ) );
- ::ucbhelper::Content packagesDir;
- if (create_ucb_content( &packagesDir,
- makeURL( m_userData, OUSTR("user/uno_packages") ),
- Reference<XCommandEnvironment>(),
- false /* no throw */ ))
- {
- const Reference<XCommandEnvironment> xCmdEnv(
- new CommandEnvironmentImpl );
- OUString const & strTitle = StrTitle::get();
- const Reference<sdbc::XResultSet> xResultSet(
- packagesDir.createCursor( Sequence<OUString>( &strTitle, 1 ),
- ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) );
- while (xResultSet->next())
- {
- Reference<sdbc::XRow> xRow( xResultSet, UNO_QUERY_THROW );
- const OUString title( xRow->getString( 1 /* Title */ ) );
- // exclude stampIt, not migratable to OOo 2.0:
- if (title.matchIgnoreAsciiCaseAsciiL(
- RTL_CONSTASCII_STRINGPARAM("SSICONCT.") ))
- continue;
- const OUString sourceURL( Reference<XContentAccess>(
- xResultSet, UNO_QUERY_THROW )
- ->queryContentIdentifierString() );
- try {
- xManager->addPackage(
- sourceURL, OUString() /* detect media-type */,
- Reference<task::XAbortChannel>(), xCmdEnv );
- }
- catch (RuntimeException &) {
- throw;
- }
- catch (Exception &) {
- OSL_ENSURE( 0, ::rtl::OUStringToOString(
- ::comphelper::anyToString(
- ::cppu::getCaughtException() ),
- RTL_TEXTENCODING_UTF8 ).getStr() );
- }
- }
- }
- return Any();
-}
-
-// XCommandEnvironment
-Reference<task::XInteractionHandler>
-MigrationImpl::CommandEnvironmentImpl::getInteractionHandler()
- throw (RuntimeException)
-{
- return this;
-}
-
-Reference<XProgressHandler>
-MigrationImpl::CommandEnvironmentImpl::getProgressHandler()
- throw (RuntimeException)
-{
- return Reference<XProgressHandler>();
-}
-
-// XInteractionHandler
-void MigrationImpl::CommandEnvironmentImpl::handle(
- Reference<task::XInteractionRequest> const & xRequest )
- throw (RuntimeException)
-{
- Any request( xRequest->getRequest() );
- OSL_ASSERT( request.getValueTypeClass() == TypeClass_EXCEPTION );
-#if OSL_DEBUG_LEVEL > 1
- OSL_TRACE( "[dp_migration.cxx] incoming request:\n%s\n",
- ::rtl::OUStringToOString( ::comphelper::anyToString(request),
- RTL_TEXTENCODING_UTF8 ).getStr() );
-#endif
-
- // selections:
- bool approve = false;
- bool abort = false;
-
- lang::WrappedTargetException wtExc;
- if (request >>= wtExc) {
- OSL_ENSURE( 0, ::rtl::OUStringToOString(
- ::comphelper::anyToString(wtExc.TargetException),
- RTL_TEXTENCODING_UTF8 ).getStr() );
-
- // ignore intermediate errors of legacy packages, i.e.
- // former pkgchk behaviour:
- const Reference<deployment::XPackage> xPackage(
- wtExc.Context, UNO_QUERY );
- OSL_ASSERT( xPackage.is() );
- if (xPackage.is()) {
- const Reference<deployment::XPackageTypeInfo> xPackageType(
- xPackage->getPackageType() );
- OSL_ASSERT( xPackageType.is() );
- if (xPackageType.is()) {
- approve = (xPackage->isBundle() &&
- xPackageType->getMediaType().matchAsciiL(
- RTL_CONSTASCII_STRINGPARAM(
- "application/"
- "vnd.sun.star.legacy-package-bundle") ));
- }
- }
- abort = !approve;
- }
- else
- return; // unknown request => no selection at all
-
- // select:
- const Sequence< Reference<task::XInteractionContinuation> > conts(
- xRequest->getContinuations() );
- for ( sal_Int32 pos = 0; pos < conts.getLength(); ++pos )
- {
- if (approve) {
- const Reference<task::XInteractionApprove> xInteractionApprove(
- conts[ pos ], UNO_QUERY );
- if (xInteractionApprove.is()) {
- xInteractionApprove->select();
- // don't query again for ongoing continuations:
- approve = false;
- }
- }
- else if (abort) {
- const Reference<task::XInteractionAbort> xInteractionAbort(
- conts[ pos ], UNO_QUERY );
- if (xInteractionAbort.is()) {
- xInteractionAbort->select();
- // don't query again for ongoing continuations:
- abort = false;
- }
- }
- }
-}
-
-namespace sdecl = comphelper::service_decl;
-sdecl::class_<MigrationImpl, sdecl::with_args<true> > serviceMI;
-extern sdecl::ServiceDecl const serviceDecl(
- serviceMI,
- // a private one (config entry):
- "com.sun.star.comp.deployment.migration.Migration_2_0",
- "com.sun.star.comp.deployment.migration.Migration_2_0" );
-
-} // namespace dp_migration
-
diff --git a/desktop/source/deployment/migration/makefile.mk b/desktop/source/deployment/migration/makefile.mk
deleted file mode 100644
index a37b7e5beb..0000000000
--- a/desktop/source/deployment/migration/makefile.mk
+++ /dev/null
@@ -1,41 +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.
-#
-#*************************************************************************
-
-PRJ = ..$/..$/..
-
-PRJNAME = desktop
-TARGET = deployment_migration
-ENABLE_EXCEPTIONS = TRUE
-
-.INCLUDE : settings.mk
-
-SLOFILES = \
- $(SLO)$/dp_migration.obj
-
-.INCLUDE : ..$/target.pmk
-.INCLUDE : target.mk
-
diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
index 58e17a017b..e73aeb2780 100644
--- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
+++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
@@ -35,6 +35,7 @@
#include "comphelper/sequence.hxx"
#include "comphelper/makesequence.hxx"
+#include "comphelper/processfactory.hxx"
#include "boost/optional.hpp"
#include "com/sun/star/beans/Optional.hpp"
#include "com/sun/star/lang/XMultiComponentFactory.hpp"
@@ -47,17 +48,23 @@
#include "com/sun/star/xml/dom/DOMException.hpp"
#include "com/sun/star/xml/dom/XNode.hpp"
#include "com/sun/star/xml/dom/XNodeList.hpp"
+#include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
+#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp"
#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/implbase2.hxx"
#include "cppuhelper/weak.hxx"
+#include "cppuhelper/exc_hlp.hxx"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
#include "sal/types.h"
-
+#include "ucbhelper/content.hxx"
namespace {
namespace css = ::com::sun::star;
+using css::uno::Reference;
+using ::rtl::OUString;
class EmptyNodeList: public ::cppu::WeakImplHelper1< css::xml::dom::XNodeList >
{
@@ -110,10 +117,251 @@ css::uno::Reference< css::xml::dom::XNode > EmptyNodeList::item(::sal_Int32)
}
}
+/**The class uses the UCB to access the description.xml file in an
+ extension. The UCB must have been initialized already. It also
+ requires that the extension has already be unzipped to a particular
+ location.
+ */
+class ExtensionDescription
+{
+public:
+ /**throws an exception if the description.xml is not
+ available, cannot be read, does not contain the expected data,
+ or any other error occured. Therefore it shoult only be used with
+ new extensions.
+
+ Throws com::sun::star::uno::RuntimeException,
+ com::sun::star::deployment::DeploymentException,
+ dp_registry::backend::bundle::NoDescriptionException.
+ */
+ ExtensionDescription(
+ const css::uno::Reference<css::uno::XComponentContext>& xContext,
+ const ::rtl::OUString& installDir,
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv);
+
+ ~ExtensionDescription();
+
+ css::uno::Reference<css::xml::dom::XNode> getRootElement() const
+ {
+ return m_xRoot;
+ }
+
+ ::rtl::OUString getExtensionRootUrl() const
+ {
+ return m_sExtensionRootUrl;
+ }
+
+
+private:
+ css::uno::Reference<css::xml::dom::XNode> m_xRoot;
+ ::rtl::OUString m_sExtensionRootUrl;
+};
+
+class NoDescriptionException
+{
+};
+
+class FileDoesNotExistFilter
+ : public ::cppu::WeakImplHelper2< css::ucb::XCommandEnvironment,
+ css::task::XInteractionHandler >
+
+{
+ //css::uno::Reference<css::task::XInteractionHandler> m_xHandler;
+ bool m_bExist;
+ css::uno::Reference< css::ucb::XCommandEnvironment > m_xCommandEnv;
+
+public:
+ virtual ~FileDoesNotExistFilter();
+ FileDoesNotExistFilter(
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv);
+
+ bool exist();
+ // XCommandEnvironment
+ virtual css::uno::Reference<css::task::XInteractionHandler > SAL_CALL
+ getInteractionHandler() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference<css::ucb::XProgressHandler >
+ SAL_CALL getProgressHandler() throw (css::uno::RuntimeException);
+
+ // XInteractionHandler
+ virtual void SAL_CALL handle(
+ css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
+ throw (css::uno::RuntimeException);
+};
+
+ExtensionDescription::ExtensionDescription(
+ const Reference<css::uno::XComponentContext>& xContext,
+ const OUString& installDir,
+ const Reference< css::ucb::XCommandEnvironment >& xCmdEnv)
+{
+ try {
+ m_sExtensionRootUrl = installDir;
+ //may throw ::com::sun::star::ucb::ContentCreationException
+ //If there is no description.xml then ucb will start an interaction which
+ //brings up a dialog.We want to prevent this. Therefore we wrap the xCmdEnv
+ //and filter the respective exception out.
+ OUString sDescriptionUri(installDir + OUSTR("/description.xml"));
+ Reference<css::ucb::XCommandEnvironment> xFilter =
+ static_cast<css::ucb::XCommandEnvironment*>(
+ new FileDoesNotExistFilter(xCmdEnv));
+ ::ucbhelper::Content descContent(sDescriptionUri, xFilter);
+
+ //throws an com::sun::star::uno::Exception if the file is not available
+ Reference<css::io::XInputStream> xIn;
+ try
+ { //throws com.sun.star.ucb.InteractiveAugmentedIOException
+ xIn = descContent.openStream();
+ }
+ catch (css::uno::Exception& )
+ {
+ if ( ! static_cast<FileDoesNotExistFilter*>(xFilter.get())->exist())
+ throw NoDescriptionException();
+ throw;
+ }
+ if (!xIn.is())
+ {
+ throw css::uno::Exception(
+ OUSTR("Could not get XInputStream for description.xml of extension ") +
+ sDescriptionUri, 0);
+ }
+
+ //get root node of description.xml
+ Reference<css::xml::dom::XDocumentBuilder> xDocBuilder(
+ xContext->getServiceManager()->createInstanceWithContext(
+ OUSTR("com.sun.star.xml.dom.DocumentBuilder"),
+ xContext ), css::uno::UNO_QUERY);
+ if (!xDocBuilder.is())
+ throw css::uno::Exception(OUSTR(" Could not create service com.sun.star.xml.dom.DocumentBuilder"), 0);
+
+ if (xDocBuilder->isNamespaceAware() == sal_False)
+ {
+ throw css::uno::Exception(
+ OUSTR("Service com.sun.star.xml.dom.DocumentBuilder is not namespace aware."), 0);
+ }
+
+ Reference<css::xml::dom::XDocument> xDoc = xDocBuilder->parse(xIn);
+ if (!xDoc.is())
+ {
+ throw css::uno::Exception(sDescriptionUri + OUSTR(" contains data which cannot be parsed. "), 0);
+ }
+
+ //check for proper root element and namespace
+ Reference<css::xml::dom::XElement> xRoot = xDoc->getDocumentElement();
+ if (!xRoot.is())
+ {
+ throw css::uno::Exception(
+ sDescriptionUri + OUSTR(" contains no root element."), 0);
+ }
+
+ if ( ! xRoot->getTagName().equals(OUSTR("description")))
+ {
+ throw css::uno::Exception(
+ sDescriptionUri + OUSTR(" does not contain the root element <description>."), 0);
+ }
+
+ m_xRoot = Reference<css::xml::dom::XNode>(
+ xRoot, css::uno::UNO_QUERY_THROW);
+ OUString nsDescription = xRoot->getNamespaceURI();
+
+ //check if this namespace is supported
+ if ( ! nsDescription.equals(OUSTR("http://openoffice.org/extensions/description/2006")))
+ {
+ throw css::uno::Exception(sDescriptionUri + OUSTR(" contains a root element with an unsupported namespace. "), 0);
+ }
+ } catch (css::uno::RuntimeException &) {
+ throw;
+ } catch (css::deployment::DeploymentException &) {
+ throw;
+ } catch (css::uno::Exception & e) {
+ css::uno::Any a(cppu::getCaughtException());
+ throw css::deployment::DeploymentException(
+ e.Message, Reference< css::uno::XInterface >(), a);
+ }
+}
+
+ExtensionDescription::~ExtensionDescription()
+{
+}
+
+//======================================================================
+FileDoesNotExistFilter::FileDoesNotExistFilter(
+ const Reference< css::ucb::XCommandEnvironment >& xCmdEnv):
+ m_bExist(true), m_xCommandEnv(xCmdEnv)
+{}
+
+FileDoesNotExistFilter::~FileDoesNotExistFilter()
+{
+};
+
+bool FileDoesNotExistFilter::exist()
+{
+ return m_bExist;
+}
+ // XCommandEnvironment
+Reference<css::task::XInteractionHandler >
+ FileDoesNotExistFilter::getInteractionHandler() throw (css::uno::RuntimeException)
+{
+ return static_cast<css::task::XInteractionHandler*>(this);
+}
+
+Reference<css::ucb::XProgressHandler >
+ FileDoesNotExistFilter::getProgressHandler() throw (css::uno::RuntimeException)
+{
+ return m_xCommandEnv.is()
+ ? m_xCommandEnv->getProgressHandler()
+ : Reference<css::ucb::XProgressHandler>();
+}
+
+// XInteractionHandler
+//If the interaction was caused by a non-existing file which is specified in the ctor
+//of FileDoesNotExistFilter, then we do nothing
+void FileDoesNotExistFilter::handle(
+ Reference<css::task::XInteractionRequest > const & xRequest )
+ throw (css::uno::RuntimeException)
+{
+ css::uno::Any request( xRequest->getRequest() );
+
+ css::ucb::InteractiveAugmentedIOException ioexc;
+ if ((request>>= ioexc) && ioexc.Code == css::ucb::IOErrorCode_NOT_EXISTING )
+ {
+ m_bExist = false;
+ return;
+ }
+ Reference<css::task::XInteractionHandler> xInteraction;
+ if (m_xCommandEnv.is()) {
+ xInteraction = m_xCommandEnv->getInteractionHandler();
+ }
+ if (xInteraction.is()) {
+ xInteraction->handle(xRequest);
+ }
+}
+
}
namespace dp_misc {
+DescriptionInfoset getDescriptionInfoset(OUString const & sExtensionFolderURL)
+{
+ Reference< css::xml::dom::XNode > root;
+ Reference<css::uno::XComponentContext> context =
+ comphelper_getProcessComponentContext();
+ OSL_ASSERT(context.is());
+ try {
+ root =
+ ExtensionDescription(
+ context, sExtensionFolderURL,
+ Reference< css::ucb::XCommandEnvironment >()).
+ getRootElement();
+ } catch (NoDescriptionException &) {
+ } catch (css::deployment::DeploymentException & e) {
+ throw css::uno::RuntimeException(
+ (OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.deployment.DeploymentException: ")) +
+ e.Message), 0);
+ }
+ return DescriptionInfoset(context, root);
+}
+
DescriptionInfoset::DescriptionInfoset(
css::uno::Reference< css::uno::XComponentContext > const & context,
css::uno::Reference< css::xml::dom::XNode > const & element):
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index dba389ff39..689e8cfd0d 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -30,6 +30,7 @@
#include "dp_misc.h"
+#include "dp_version.hxx"
#include "dp_interact.h"
#include "rtl/uri.hxx"
#include "rtl/digest.h"
@@ -42,11 +43,15 @@
#include "osl/thread.hxx"
#include "osl/mutex.hxx"
#include "com/sun/star/ucb/CommandAbortedException.hpp"
+#include "com/sun/star/task/XInteractionHandler.hpp"
#include "com/sun/star/bridge/UnoUrlResolver.hpp"
#include "com/sun/star/bridge/XUnoUrlResolver.hpp"
+#include "com/sun/star/deployment/ExtensionManager.hpp"
+#include "com/sun/star/task/XRestartManager.hpp"
#include "boost/scoped_array.hpp"
#include "boost/shared_ptr.hpp"
-
+#include <comphelper/processfactory.hxx>
+
#ifdef WNT
//#include "tools/prewin.h"
#define UNICODE
@@ -138,6 +143,103 @@ bool existsOfficePipe()
return pipe.is();
}
+
+//Returns true if the Folder was more recently modified then
+//the lastsynchronized file. That is the repository needs to
+//be synchronized.
+bool compareExtensionFolderWithLastSynchronizedFile(
+ OUString const & folderURL, OUString const & fileURL)
+{
+ bool bNeedsSync = false;
+ ::osl::DirectoryItem itemExtFolder;
+ ::osl::File::RC err1 =
+ ::osl::DirectoryItem::get(folderURL, itemExtFolder);
+ //If it does not exist, then there is nothing to be done
+ if (err1 == ::osl::File::E_NOENT)
+ {
+ return false;
+ }
+ else if (err1 != ::osl::File::E_None)
+ {
+ OSL_ENSURE(0, "Cannot access extension folder");
+ return true; //sync just in case
+ }
+
+ //If last synchronized does not exist, then OOo is started for the first time
+ ::osl::DirectoryItem itemFile;
+ ::osl::File::RC err2 = ::osl::DirectoryItem::get(fileURL, itemFile);
+ if (err2 == ::osl::File::E_NOENT)
+ {
+ return true;
+
+ }
+ else if (err2 != ::osl::File::E_None)
+ {
+ OSL_ENSURE(0, "Cannot access file lastsynchronized");
+ return true; //sync just in case
+ }
+
+ //compare the modification time of the extension folder and the last
+ //modified file
+ ::osl::FileStatus statFolder(FileStatusMask_ModifyTime);
+ ::osl::FileStatus statFile(FileStatusMask_ModifyTime);
+ if (itemExtFolder.getFileStatus(statFolder) == ::osl::File::E_None)
+ {
+ if (itemFile.getFileStatus(statFile) == ::osl::File::E_None)
+ {
+ TimeValue timeFolder = statFolder.getModifyTime();
+ TimeValue timeFile = statFile.getModifyTime();
+
+ if (timeFile.Seconds < timeFolder.Seconds)
+ bNeedsSync = true;
+ }
+ else
+ {
+ OSL_ASSERT(0);
+ bNeedsSync = true;
+ }
+ }
+ else
+ {
+ OSL_ASSERT(0);
+ bNeedsSync = true;
+ }
+ return bNeedsSync;
+}
+
+bool needToSyncRepostitory(OUString const & name)
+{
+ OUString folder;
+ OUString file;
+ if (name.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("bundled"))))
+ {
+ folder = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("$BUNDLED_EXTENSIONS"));
+ file = OUString (
+ RTL_CONSTASCII_USTRINGPARAM(
+ "$BUNDLED_EXTENSIONS_USER/lastsynchronized"));
+ }
+ else if (name.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("shared"))))
+ {
+ folder = OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "$UNO_SHARED_PACKAGES_CACHE/uno_packages"));
+ file = OUString (
+ RTL_CONSTASCII_USTRINGPARAM(
+ "$SHARED_EXTENSIONS_USER/lastsynchronized"));
+ }
+ else
+ {
+ OSL_ASSERT(0);
+ return true;
+ }
+ ::rtl::Bootstrap::expandMacros(folder);
+ ::rtl::Bootstrap::expandMacros(file);
+ return compareExtensionFolderWithLastSynchronizedFile(
+ folder, file);
+}
+
+
} // anon namespace
//==============================================================================
@@ -197,6 +299,19 @@ OUString makeURL( OUString const & baseURL, OUString const & relPath_ )
return buf.makeStringAndClear();
}
+OUString makeURLAppendSysPathSegment( OUString const & baseURL, OUString const & relPath_ )
+{
+ OUString segment = relPath_;
+ OSL_ASSERT(segment.indexOf(static_cast<sal_Unicode>('/')) == -1);
+
+ ::rtl::Uri::encode(
+ segment, rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes,
+ RTL_TEXTENCODING_UTF8);
+ return makeURL(baseURL, segment);
+}
+
+
+
//==============================================================================
OUString expandUnoRcTerm( OUString const & term_ )
{
@@ -205,6 +320,22 @@ OUString expandUnoRcTerm( OUString const & term_ )
return term;
}
+OUString makeRcTerm( OUString const & url )
+{
+ OSL_ASSERT( url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "vnd.sun.star.expand:") ) );
+ if (url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:") )) {
+ // cut protocol:
+ OUString rcterm( url.copy( sizeof ("vnd.sun.star.expand:") - 1 ) );
+ // decode uric class chars:
+ rcterm = ::rtl::Uri::decode(
+ rcterm, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
+ return rcterm;
+ }
+ else
+ return url;
+}
+
//==============================================================================
OUString expandUnoRcUrl( OUString const & url )
{
@@ -346,17 +477,6 @@ Reference<XInterface> resolveUnoURL(
}
}
-OUString getExtensionDefaultUpdateURL()
-{
- ::rtl::OUString sUrl(
- RTL_CONSTASCII_USTRINGPARAM(
- "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version")
- ":Version:ExtensionUpdateURL}"));
- ::rtl::Bootstrap::expandMacros(sUrl);
- return sUrl;
-}
-
-
#ifdef WNT
void writeConsoleWithStream(::rtl::OUString const & sText, HANDLE stream)
{
@@ -467,4 +587,39 @@ void TRACE(::rtl::OString const & sText)
#endif
}
+void syncRepositories(Reference<ucb::XCommandEnvironment> const & xCmdEnv)
+{
+ Reference<deployment::XExtensionManager> xExtensionManager;
+ //synchronize shared before bundled otherewise there are
+ //more revoke and registration calls.
+ sal_Bool bModified = false;
+ if (needToSyncRepostitory(OUString(RTL_CONSTASCII_USTRINGPARAM("shared")))
+ || needToSyncRepostitory(OUString(RTL_CONSTASCII_USTRINGPARAM("bundled"))))
+ {
+ xExtensionManager =
+ deployment::ExtensionManager::get(
+ comphelper_getProcessComponentContext());
+
+ if (xExtensionManager.is())
+ {
+ bModified = xExtensionManager->synchronize(
+ Reference<task::XAbortChannel>(), xCmdEnv);
+ }
+ }
+
+ if (bModified)
+ {
+ Reference<task::XRestartManager> restarter(
+ comphelper_getProcessComponentContext()->getValueByName(
+ OUSTR( "/singletons/com.sun.star.task.OfficeRestartManager") ), UNO_QUERY );
+ if (restarter.is())
+ {
+ restarter->requestRestart(xCmdEnv.is() == sal_True ? xCmdEnv->getInteractionHandler() :
+ Reference<task::XInteractionHandler>());
+ }
+ }
+}
+
+
+
}
diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx
index ab086668d8..122cbb6ecf 100644
--- a/desktop/source/deployment/misc/dp_ucb.cxx
+++ b/desktop/source/deployment/misc/dp_ucb.cxx
@@ -271,4 +271,50 @@ bool readLine( OUString * res, OUString const & startingWith,
return false;
}
+bool readProperties( ::std::list< ::std::pair< ::rtl::OUString, ::rtl::OUString> > & out_result,
+ ::ucbhelper::Content & ucb_content )
+{
+ // read whole file:
+ ::rtl::ByteSequence bytes( readFile( ucb_content ) );
+ OUString file( reinterpret_cast<sal_Char const *>(bytes.getConstArray()),
+ bytes.getLength(), RTL_TEXTENCODING_UTF8);
+ sal_Int32 pos = 0;
+
+ for (;;)
+ {
+
+ ::rtl::OUStringBuffer buf;
+ sal_Int32 start = pos;
+
+ bool bEOF = false;
+ pos = file.indexOf( LF, pos );
+ if (pos < 0) { // EOF
+ buf.append( file.copy( start ) );
+ bEOF = true;
+ }
+ else
+ {
+ if (pos > 0 && file[ pos - 1 ] == CR)
+ // consume extra CR
+ buf.append( file.copy( start, pos - start - 1 ) );
+ else
+ buf.append( file.copy( start, pos - start ) );
+ pos++;
+ }
+ OUString aLine = buf.makeStringAndClear();
+
+ sal_Int32 posEqual = aLine.indexOf('=');
+ if (posEqual > 0 && (posEqual + 1) < aLine.getLength())
+ {
+ OUString name = aLine.copy(0, posEqual);
+ OUString value = aLine.copy(posEqual + 1);
+ out_result.push_back(::std::make_pair(name, value));
+ }
+
+ if (bEOF)
+ break;
+ }
+ return false;
+}
+
}
diff --git a/desktop/source/deployment/misc/dp_update.cxx b/desktop/source/deployment/misc/dp_update.cxx
new file mode 100755
index 0000000000..112eb5917b
--- /dev/null
+++ b/desktop/source/deployment/misc/dp_update.cxx
@@ -0,0 +1,397 @@
+/*************************************************************************
+ *
+ * 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_desktop.hxx"
+
+
+#include "dp_update.hxx"
+#include "dp_version.hxx"
+#include "dp_identifier.hxx"
+#include "dp_descriptioninfoset.hxx"
+
+#include "rtl/bootstrap.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+using ::rtl::OString;
+
+
+namespace dp_misc {
+namespace {
+
+int determineHighestVersion(
+ ::rtl::OUString const & userVersion,
+ ::rtl::OUString const & sharedVersion,
+ ::rtl::OUString const & bundledVersion,
+ ::rtl::OUString const & onlineVersion)
+{
+ int index = 0;
+ OUString greatest = userVersion;
+ if (dp_misc::compareVersions(sharedVersion, greatest) == dp_misc::GREATER)
+ {
+ index = 1;
+ greatest = sharedVersion;
+ }
+ if (dp_misc::compareVersions(bundledVersion, greatest) == dp_misc::GREATER)
+ {
+ index = 2;
+ greatest = bundledVersion;
+ }
+ if (dp_misc::compareVersions(onlineVersion, greatest) == dp_misc::GREATER)
+ {
+ index = 3;
+ }
+ return index;
+}
+
+Sequence< Reference< xml::dom::XElement > >
+getUpdateInformation( Reference<deployment::XUpdateInformationProvider > const & updateInformation,
+ Sequence< OUString > const & urls,
+ OUString const & identifier,
+ uno::Any & out_error)
+{
+ try {
+ return updateInformation->getUpdateInformation(urls, identifier);
+ } catch (uno::RuntimeException &) {
+ throw;
+ } catch (ucb::CommandFailedException & e) {
+ out_error = e.Reason;
+ } catch (ucb::CommandAbortedException &) {
+ } catch (uno::Exception & e) {
+ out_error = uno::makeAny(e);
+ }
+ return
+ Sequence<Reference< xml::dom::XElement > >();
+}
+
+//Put in anonymous namespace
+
+void getOwnUpdateInfos(
+ Reference<uno::XComponentContext> const & xContext,
+ Reference<deployment::XUpdateInformationProvider > const & updateInformation,
+ UpdateInfoMap& inout_map, std::vector<std::pair<Reference<deployment::XPackage>, uno::Any> > & out_errors,
+ bool & out_allFound)
+{
+ bool allHaveOwnUpdateInformation = true;
+ for (UpdateInfoMap::iterator i = inout_map.begin(); i != inout_map.end(); i++)
+ {
+ OSL_ASSERT(i->second.extension.is());
+ Sequence<OUString> urls(i->second.extension->getUpdateInformationURLs());
+ if (urls.getLength())
+ {
+ const OUString id = dp_misc::getIdentifier(i->second.extension);
+ uno::Any anyError;
+ //It is unclear from the idl if there can be a null reference returned.
+ //However all valid information should be the same
+ Sequence<Reference< xml::dom::XElement > >
+ infos(getUpdateInformation(updateInformation, urls, id, anyError));
+ if (anyError.hasValue())
+ out_errors.push_back(std::make_pair(i->second.extension, anyError));
+
+ for (sal_Int32 j = 0; j < infos.getLength(); ++j)
+ {
+ dp_misc::DescriptionInfoset infoset(
+ xContext,
+ Reference< xml::dom::XNode >(infos[j], UNO_QUERY_THROW));
+ if (!infoset.hasDescription())
+ continue;
+ boost::optional< OUString > id2(infoset.getIdentifier());
+ if (!id2)
+ continue;
+ OSL_ASSERT(*id2 == id);
+ if (*id2 == id)
+ {
+ i->second.version = infoset.getVersion();
+ i->second.info = Reference< xml::dom::XNode >(
+ infos[j], UNO_QUERY_THROW);
+ }
+ break;
+ }
+ }
+ else
+ {
+ allHaveOwnUpdateInformation &= false;
+ }
+ }
+ out_allFound = allHaveOwnUpdateInformation;
+}
+
+void getDefaultUpdateInfos(
+ Reference<uno::XComponentContext> const & xContext,
+ Reference<deployment::XUpdateInformationProvider > const & updateInformation,
+ UpdateInfoMap& inout_map,
+ std::vector<std::pair<Reference<deployment::XPackage>, uno::Any> > & out_errors)
+{
+ const rtl::OUString sDefaultURL(dp_misc::getExtensionDefaultUpdateURL());
+ OSL_ASSERT(sDefaultURL.getLength());
+
+ Any anyError;
+ Sequence< Reference< xml::dom::XElement > >
+ infos(
+ getUpdateInformation(
+ updateInformation,
+ Sequence< OUString >(&sDefaultURL, 1), OUString(), anyError));
+ if (anyError.hasValue())
+ out_errors.push_back(std::make_pair(Reference<deployment::XPackage>(), anyError));
+ for (sal_Int32 i = 0; i < infos.getLength(); ++i)
+ {
+ Reference< xml::dom::XNode > node(infos[i], UNO_QUERY_THROW);
+ dp_misc::DescriptionInfoset infoset(xContext, node);
+ boost::optional< OUString > id(infoset.getIdentifier());
+ if (!id) {
+ continue;
+ }
+ UpdateInfoMap::iterator j = inout_map.find(*id);
+ if (j != inout_map.end())
+ {
+ //skip those extension which provide its own update urls
+ if (j->second.extension->getUpdateInformationURLs().getLength())
+ continue;
+ OUString v(infoset.getVersion());
+ //look for the highest version in the online repository
+ if (dp_misc::compareVersions(v, j->second.version) ==
+ dp_misc::GREATER)
+ {
+ j->second.version = v;
+ j->second.info = node;
+ }
+ }
+ }
+}
+
+
+} // anon namespace
+
+
+OUString getExtensionDefaultUpdateURL()
+{
+ ::rtl::OUString sUrl(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version")
+ ":Version:ExtensionUpdateURL}"));
+ ::rtl::Bootstrap::expandMacros(sUrl);
+ return sUrl;
+}
+
+/* returns the index of the greatest version, starting with 0
+
+ */
+UPDATE_SOURCE isUpdateUserExtension(
+ bool bReadOnlyShared,
+ ::rtl::OUString const & userVersion,
+ ::rtl::OUString const & sharedVersion,
+ ::rtl::OUString const & bundledVersion,
+ ::rtl::OUString const & onlineVersion)
+{
+ UPDATE_SOURCE retVal = UPDATE_SOURCE_NONE;
+ if (bReadOnlyShared)
+ {
+ if (userVersion.getLength())
+ {
+ int index = determineHighestVersion(
+ userVersion, sharedVersion, bundledVersion, onlineVersion);
+ if (index == 1)
+ retVal = UPDATE_SOURCE_SHARED;
+ else if (index == 2)
+ retVal = UPDATE_SOURCE_BUNDLED;
+ else if (index == 3)
+ retVal = UPDATE_SOURCE_ONLINE;
+ }
+ else if (sharedVersion.getLength())
+ {
+ int index = determineHighestVersion(
+ OUString(), sharedVersion, bundledVersion, onlineVersion);
+ if (index == 2)
+ retVal = UPDATE_SOURCE_BUNDLED;
+ else if (index == 3)
+ retVal = UPDATE_SOURCE_ONLINE;
+
+ }
+ else if (bundledVersion.getLength())
+ {
+ int index = determineHighestVersion(
+ OUString(), OUString(), bundledVersion, onlineVersion);
+ if (index == 3)
+ retVal = UPDATE_SOURCE_ONLINE;
+ }
+ }
+ else
+ {
+ if (userVersion.getLength())
+ {
+ int index = determineHighestVersion(
+ userVersion, sharedVersion, bundledVersion, onlineVersion);
+ if (index == 1)
+ retVal = UPDATE_SOURCE_SHARED;
+ else if (index == 2)
+ retVal = UPDATE_SOURCE_BUNDLED;
+ else if (index == 3)
+ retVal = UPDATE_SOURCE_ONLINE;
+ }
+ }
+
+ return retVal;
+}
+
+UPDATE_SOURCE isUpdateSharedExtension(
+ bool bReadOnlyShared,
+ ::rtl::OUString const & sharedVersion,
+ ::rtl::OUString const & bundledVersion,
+ ::rtl::OUString const & onlineVersion)
+{
+ if (bReadOnlyShared)
+ return UPDATE_SOURCE_NONE;
+ UPDATE_SOURCE retVal = UPDATE_SOURCE_NONE;
+
+ if (sharedVersion.getLength())
+ {
+ int index = determineHighestVersion(
+ OUString(), sharedVersion, bundledVersion, onlineVersion);
+ if (index == 2)
+ retVal = UPDATE_SOURCE_BUNDLED;
+ else if (index == 3)
+ retVal = UPDATE_SOURCE_ONLINE;
+ }
+ else if (bundledVersion.getLength())
+ {
+ int index = determineHighestVersion(
+ OUString(), OUString(), bundledVersion, onlineVersion);
+ if (index == 3)
+ retVal = UPDATE_SOURCE_ONLINE;
+ }
+ return retVal;
+}
+
+Reference<deployment::XPackage>
+getExtensionWithHighestVersion(
+ Sequence<Reference<deployment::XPackage> > const & seqExt)
+{
+ if (seqExt.getLength() == 0)
+ return Reference<deployment::XPackage>();
+
+ Reference<deployment::XPackage> greatest;
+ sal_Int32 len = seqExt.getLength();
+
+ for (sal_Int32 i = 0; i < len; i++)
+ {
+ if (!greatest.is())
+ {
+ greatest = seqExt[i];
+ continue;
+ }
+ Reference<deployment::XPackage> const & current = seqExt[i];
+ //greatest has a value
+ if (! current.is())
+ continue;
+
+ if (dp_misc::compareVersions(current->getVersion(), greatest->getVersion()) == dp_misc::GREATER)
+ greatest = current;
+ }
+ return greatest;
+}
+
+UpdateInfo::UpdateInfo( Reference< deployment::XPackage> const & ext):
+extension(ext)
+{
+}
+
+
+
+UpdateInfoMap getOnlineUpdateInfos(
+ Reference<uno::XComponentContext> const &xContext,
+ Reference<deployment::XExtensionManager> const & xExtMgr,
+ Reference<deployment::XUpdateInformationProvider > const & updateInformation,
+ std::vector<Reference<deployment::XPackage > > const * extensionList,
+ std::vector<std::pair< Reference<deployment::XPackage>, uno::Any> > & out_errors)
+{
+ OSL_ASSERT(xExtMgr.is());
+ UpdateInfoMap infoMap;
+ if (!xExtMgr.is())
+ return infoMap;
+
+ if (!extensionList)
+ {
+ const uno::Sequence< uno::Sequence< Reference<deployment::XPackage > > > seqAllExt = xExtMgr->getAllExtensions(
+ Reference<task::XAbortChannel>(), Reference<ucb::XCommandEnvironment>());
+
+ //fill the UpdateInfoMap. key = extension identifier, value = UpdateInfo
+ for (int pos = seqAllExt.getLength(); pos --; )
+ {
+ uno::Sequence<Reference<deployment::XPackage> > const & seqExt = seqAllExt[pos];
+
+ Reference<deployment::XPackage> extension = getExtensionWithHighestVersion(seqExt);
+ OSL_ASSERT(extension.is());
+
+ std::pair<UpdateInfoMap::iterator, bool> insertRet = infoMap.insert(
+ UpdateInfoMap::value_type(
+ dp_misc::getIdentifier(extension), UpdateInfo(extension)));
+ OSL_ASSERT(insertRet.second == true);
+ }
+ }
+ else
+ {
+ typedef std::vector<Reference<deployment::XPackage > >::const_iterator CIT;
+ for (CIT i = extensionList->begin(); i != extensionList->end(); i++)
+ {
+ OSL_ASSERT(i->is());
+ std::pair<UpdateInfoMap::iterator, bool> insertRet = infoMap.insert(
+ UpdateInfoMap::value_type(
+ dp_misc::getIdentifier(*i), UpdateInfo(*i)));
+ OSL_ASSERT(insertRet.second == true);
+ }
+ }
+
+ //Now find the update information for the extensions which provide their own
+ //URLs to update information.
+ bool allInfosObtained = false;
+ getOwnUpdateInfos(xContext, updateInformation, infoMap, out_errors, allInfosObtained);
+
+ if (!allInfosObtained)
+ getDefaultUpdateInfos(xContext, updateInformation, infoMap, out_errors);
+ return infoMap;
+}
+OUString getHighestVersion(
+ ::rtl::OUString const & userVersion,
+ ::rtl::OUString const & sharedVersion,
+ ::rtl::OUString const & bundledVersion,
+ ::rtl::OUString const & onlineVersion)
+{
+ int index = determineHighestVersion(userVersion, sharedVersion, bundledVersion, onlineVersion);
+ switch (index)
+ {
+ case 0: return userVersion;
+ case 1: return sharedVersion;
+ case 2: return bundledVersion;
+ case 3: return onlineVersion;
+ default: OSL_ASSERT(0);
+ }
+
+ return OUString();
+}
+} //namespace dp_misc
diff --git a/desktop/source/deployment/misc/dp_version.cxx b/desktop/source/deployment/misc/dp_version.cxx
index a4138c5e7a..563612c675 100644
--- a/desktop/source/deployment/misc/dp_version.cxx
+++ b/desktop/source/deployment/misc/dp_version.cxx
@@ -70,11 +70,5 @@ namespace dp_misc {
return ::dp_misc::EQUAL;
}
-::dp_misc::Order comparePackageVersions(
- css::uno::Reference< css::deployment::XPackage > const & package1,
- css::uno::Reference< css::deployment::XPackage > const & package2)
-{
- return compareVersions(package1->getVersion(), package2->getVersion());
-}
}
diff --git a/desktop/source/deployment/misc/makefile.mk b/desktop/source/deployment/misc/makefile.mk
index e191169202..3e4bd68cb4 100644
--- a/desktop/source/deployment/misc/makefile.mk
+++ b/desktop/source/deployment/misc/makefile.mk
@@ -65,7 +65,8 @@ SHL1OBJS = \
$(SLO)$/dp_version.obj \
$(SLO)$/dp_descriptioninfoset.obj \
$(SLO)$/dp_dependencies.obj \
- $(SLO)$/dp_platform.obj
+ $(SLO)$/dp_platform.obj \
+ $(SLO)$/dp_update.obj
SHL1STDLIBS = \
$(BERKELEYLIB) \
@@ -75,7 +76,8 @@ SHL1STDLIBS = \
$(TOOLSLIB) \
$(UCBHELPERLIB) \
$(UNOTOOLSLIB) \
- $(XMLSCRIPTLIB)
+ $(XMLSCRIPTLIB) \
+ $(COMPHELPERLIB)
.IF "$(GUI)"=="OS2"
SHL1IMPLIB = ideploymentmisc$(DLLPOSTFIX)
LIB1TARGET = $(SLB)$/_deplmisc.lib
diff --git a/desktop/source/deployment/registry/component/dp_compbackenddb.cxx b/desktop/source/deployment/registry/component/dp_compbackenddb.cxx
new file mode 100644
index 0000000000..3fd88bae91
--- /dev/null
+++ b/desktop/source/deployment/registry/component/dp_compbackenddb.cxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * 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_desktop.hxx"
+
+#include "rtl/string.h"
+#include "rtl/bootstrap.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
+#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
+#include "dp_misc.h"
+
+#include "dp_compbackenddb.hxx"
+
+
+namespace css = ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+#define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/component-registry/2010"
+#define NS_PREFIX "comp"
+#define ROOT_ELEMENT_NAME "component-backend-db"
+#define KEY_ELEMENT_NAME "component"
+
+namespace dp_registry {
+namespace backend {
+namespace component {
+
+ComponentBackendDb::ComponentBackendDb(
+ Reference<XComponentContext> const & xContext,
+ ::rtl::OUString const & url):BackendDb(xContext, url)
+{
+
+}
+
+OUString ComponentBackendDb::getDbNSName()
+{
+ return OUSTR(EXTENSION_REG_NS);
+}
+
+OUString ComponentBackendDb::getNSPrefix()
+{
+ return OUSTR(NS_PREFIX);
+}
+
+OUString ComponentBackendDb::getRootElementName()
+{
+ return OUSTR(ROOT_ELEMENT_NAME);
+}
+
+OUString ComponentBackendDb::getKeyElementName()
+{
+ return OUSTR(KEY_ELEMENT_NAME);
+}
+
+void ComponentBackendDb::addEntry(::rtl::OUString const & url, Data const & data)
+{
+ try{
+ Reference<css::xml::dom::XNode> componentNode = writeKeyElement(url);
+ writeSimpleElement(OUSTR("java-type-library"),
+ OUString::valueOf((sal_Bool) data.javaTypeLibrary),
+ componentNode);
+
+ writeSimpleList(
+ data.implementationNames,
+ OUSTR("implementation-names"),
+ OUSTR("name"),
+ componentNode);
+
+ writeVectorOfPair(
+ data.singletons,
+ OUSTR("singletons"),
+ OUSTR("item"),
+ OUSTR("key"),
+ OUSTR("value"),
+ componentNode);
+
+ save();
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to write data entry in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+ComponentBackendDb::Data ComponentBackendDb::getEntry(::rtl::OUString const & url)
+{
+ try
+ {
+ ComponentBackendDb::Data retData;
+ Reference<css::xml::dom::XNode> aNode = getKeyElement(url);
+ if (aNode.is())
+ {
+ bool bJava = readSimpleElement(OUSTR("java-type-library"), aNode)
+ .equals(OUSTR("true")) ? true : false;
+ retData.javaTypeLibrary = bJava;
+
+ retData.implementationNames =
+ readList(
+ aNode,
+ OUSTR("implementation-names"),
+ OUSTR("name"));
+
+ retData.singletons =
+ readVectorOfPair(
+ aNode,
+ OUSTR("singletons"),
+ OUSTR("item"),
+ OUSTR("key"),
+ OUSTR("value"));
+ }
+ return retData;
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to read data entry in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+
+} // namespace bundle
+} // namespace backend
+} // namespace dp_registry
+
diff --git a/desktop/source/deployment/registry/component/dp_compbackenddb.hxx b/desktop/source/deployment/registry/component/dp_compbackenddb.hxx
new file mode 100644
index 0000000000..bd4d869143
--- /dev/null
+++ b/desktop/source/deployment/registry/component/dp_compbackenddb.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#if ! defined INCLUDED_DP_COMPBACKENDDB_HXX
+#define INCLUDED_DP_COMPBACKENDDB_HXX
+
+#include "rtl/ustring.hxx"
+#include "rtl/string.hxx"
+#include <vector>
+#include <list>
+#include "dp_backenddb.hxx"
+
+namespace css = ::com::sun::star;
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class XComponentContext;
+ }
+ namespace xml { namespace dom {
+ class XDocument;
+ class XNode;
+ }}
+ namespace xml { namespace xpath {
+ class XXPathAPI;
+ }}
+}}}
+
+namespace dp_registry {
+namespace backend {
+namespace component {
+
+/* The XML file stores the extensions which are currently registered.
+ They will be removed when they are revoked.
+ The format looks like this:
+
+<?xml version="1.0"?>
+<component-backend-db xmlns="http://openoffice.org/extensionmanager/component-registry/2010">
+ <component url="vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/uno_packages/5CD5.tmp_/leaves1.oxt/extensionoptions.jar">
+ <name>FileName</name>
+ <java-type-library>true</java-type-library>
+ <implementation-names>
+ <name>com.sun.star.comp.extensionoptions.OptionsEventHandler$_OptionsEventHandler</name>
+ ...
+ </implementation-names>
+ <singletons>
+ <item>
+ <key>com.sun.star.java.theJavaVirtualMachine</key>
+ <value>com.sun.star.java.JavaVirtualMachine</value>
+ </item>
+ ...
+ </singletons>
+ </component>
+
+ <component ...>
+ ...
+</component-backend-db>
+ */
+class ComponentBackendDb: public dp_registry::backend::BackendDb
+{
+protected:
+ virtual ::rtl::OUString getDbNSName();
+ virtual ::rtl::OUString getNSPrefix();
+ virtual ::rtl::OUString getRootElementName();
+ virtual ::rtl::OUString getKeyElementName();
+
+public:
+ struct Data
+ {
+ Data(): javaTypeLibrary(false) {};
+
+ ::std::list< ::rtl::OUString> implementationNames;
+ /* every singleton has a key and a value
+ */
+ ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString> >singletons;
+ bool javaTypeLibrary;
+ };
+
+public:
+
+ ComponentBackendDb( css::uno::Reference<css::uno::XComponentContext> const & xContext,
+ ::rtl::OUString const & url);
+
+ void addEntry(::rtl::OUString const & url, Data const & data);
+
+ Data getEntry(::rtl::OUString const & url);
+
+
+};
+
+
+
+}
+}
+}
+#endif
+
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index a143a88096..9ae71d5158 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -58,7 +58,7 @@
#include <vector>
#include <memory>
#include <algorithm>
-
+#include "dp_compbackenddb.hxx"
using namespace ::dp_misc;
using namespace ::com::sun::star;
@@ -74,6 +74,8 @@ namespace {
typedef ::std::list<OUString> t_stringlist;
typedef ::std::vector< ::std::pair<OUString, OUString> > t_stringpairvec;
+#define IMPLEMENTATION_NAME "com.sun.star.comp.deployment.component.PackageRegistryBackend"
+
/** return a vector of bootstrap variables which have been provided
as command arguments.
*/
@@ -119,7 +121,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
BackendImpl * getMyBackend() const;
const OUString m_loader;
- Reference<XComponentContext> m_xRemoteContext;
+ ComponentBackendDb::Data m_registeredComponentsDb;
enum reg {
REG_UNINIT, REG_VOID, REG_REGISTERED, REG_NOT_REGISTERED, REG_MAYBE_REGISTERED
@@ -139,6 +141,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
virtual void processPackage_(
::osl::ResettableMutexGuard & guard,
bool registerPackage,
+ bool startup,
::rtl::Reference<AbortChannel> const & abortChannel,
Reference<XCommandEnvironment> const & xCmdEnv );
@@ -149,16 +152,12 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
const Reference<registry::XSimpleRegistry> getRDB_RO() const;
public:
- inline ComponentPackageImpl(
+ ComponentPackageImpl(
::rtl::Reference<PackageRegistryBackend> const & myBackend,
OUString const & url, OUString const & name,
Reference<deployment::XPackageTypeInfo> const & xPackageType,
- OUString const & loader )
- : Package( myBackend, url, name, name /* display-name */,
- xPackageType ),
- m_loader( loader ),
- m_registered( REG_UNINIT )
- {}
+ OUString const & loader, bool bRemoved,
+ OUString const & identifier);
};
friend class ComponentPackageImpl;
@@ -168,7 +167,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
const bool m_jarFile;
Reference<container::XHierarchicalNameAccess> m_xTDprov;
-
+
virtual void SAL_CALL disposing();
// Package
@@ -179,19 +178,17 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
virtual void processPackage_(
::osl::ResettableMutexGuard & guard,
bool registerPackage,
+ bool startup,
::rtl::Reference<AbortChannel> const & abortChannel,
Reference<XCommandEnvironment> const & xCmdEnv );
public:
- inline TypelibraryPackageImpl(
+ TypelibraryPackageImpl(
::rtl::Reference<PackageRegistryBackend> const & myBackend,
OUString const & url, OUString const & name,
Reference<deployment::XPackageTypeInfo> const & xPackageType,
- bool jarFile )
- : Package( myBackend, url, name, name /* display-name */,
- xPackageType ),
- m_jarFile( jarFile )
- {}
+ bool jarFile, bool bRemoved,
+ OUString const & identifier);
};
friend class TypelibraryPackageImpl;
@@ -212,6 +209,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
// PackageRegistryBackend
virtual Reference<deployment::XPackage> bindPackage_(
OUString const & url, OUString const & mediaType,
+ sal_Bool bRemoved, OUString const & identifier,
Reference<XCommandEnvironment> const & xCmdEnv );
virtual void SAL_CALL disposing();
@@ -230,6 +228,13 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
OUString m_commonRDB_RO;
OUString m_nativeRDB_RO;
+ std::auto_ptr<ComponentBackendDb> m_backendDb;
+
+ void addDataToDb(OUString const & url, ComponentBackendDb::Data const & data);
+ void deleteDataFromDb(OUString const & url);
+ ComponentBackendDb::Data readDataFromDb(OUString const & url);
+
+
//These rdbs are for writing new service entries. The rdb files are copies
//which are created when services are added or removed.
Reference<registry::XSimpleRegistry> m_xCommonRDB;
@@ -275,6 +280,25 @@ public:
};
//______________________________________________________________________________
+
+BackendImpl::ComponentPackageImpl::ComponentPackageImpl(
+ ::rtl::Reference<PackageRegistryBackend> const & myBackend,
+ OUString const & url, OUString const & name,
+ Reference<deployment::XPackageTypeInfo> const & xPackageType,
+ OUString const & loader, bool bRemoved,
+ OUString const & identifier)
+ : Package( myBackend, url, name, name /* display-name */,
+ xPackageType, bRemoved, identifier),
+ m_loader( loader ),
+ m_registered( REG_UNINIT )
+{
+ if (bRemoved)
+ {
+ m_registeredComponentsDb = getMyBackend()->readDataFromDb(url);
+ }
+}
+
+
const Reference<registry::XSimpleRegistry>
BackendImpl::ComponentPackageImpl::getRDB() const
{
@@ -332,7 +356,7 @@ BackendImpl * BackendImpl::ComponentPackageImpl::getMyBackend() const
//______________________________________________________________________________
void BackendImpl::ComponentPackageImpl::disposing()
{
- m_xRemoteContext.clear();
+// m_xRemoteContext.clear();
Package::disposing();
}
@@ -371,59 +395,59 @@ void BackendImpl::disposing()
}
}
+
void BackendImpl::initServiceRdbFiles()
{
const Reference<XCommandEnvironment> xCmdEnv;
- if (! m_readOnly)
+
+ ::ucbhelper::Content cacheDir( getCachePath(), xCmdEnv );
+ ::ucbhelper::Content oldRDB;
+ // switch common rdb:
+ if (m_commonRDB_RO.getLength() > 0)
{
- ::ucbhelper::Content cacheDir( getCachePath(), xCmdEnv );
- ::ucbhelper::Content oldRDB;
- // switch common rdb:
- if (m_commonRDB_RO.getLength() > 0)
- {
- create_ucb_content(
- &oldRDB, makeURL( getCachePath(), m_commonRDB_RO),
- xCmdEnv, false /* no throw */ );
- }
- m_commonRDB = m_commonRDB_RO.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("common.rdb") )
- ? OUSTR("common_.rdb") : OUSTR("common.rdb");
- if (oldRDB.get().is())
- {
- if (! cacheDir.transferContent(
+ create_ucb_content(
+ &oldRDB, makeURL( getCachePath(), m_commonRDB_RO),
+ xCmdEnv, false /* no throw */ );
+ }
+ m_commonRDB = m_commonRDB_RO.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("common.rdb") )
+ ? OUSTR("common_.rdb") : OUSTR("common.rdb");
+ if (oldRDB.get().is())
+ {
+ if (! cacheDir.transferContent(
oldRDB, ::ucbhelper::InsertOperation_COPY,
m_commonRDB, NameClash::OVERWRITE ))
- {
-
- throw RuntimeException(
- OUSTR("UCB transferContent() failed!"), 0 );
- }
- oldRDB = ::ucbhelper::Content();
- }
- // switch native rdb:
- if (m_nativeRDB_RO.getLength() > 0)
{
- create_ucb_content(
- &oldRDB, makeURL(getCachePath(), m_nativeRDB_RO),
- xCmdEnv, false /* no throw */ );
+
+ throw RuntimeException(
+ OUSTR("UCB transferContent() failed!"), 0 );
}
- const OUString plt_rdb( getPlatformString() + OUSTR(".rdb") );
- const OUString plt_rdb_( getPlatformString() + OUSTR("_.rdb") );
- m_nativeRDB = m_nativeRDB_RO.equals( plt_rdb ) ? plt_rdb_ : plt_rdb;
- if (oldRDB.get().is())
- {
- if (! cacheDir.transferContent(
+ oldRDB = ::ucbhelper::Content();
+ }
+ // switch native rdb:
+ if (m_nativeRDB_RO.getLength() > 0)
+ {
+ create_ucb_content(
+ &oldRDB, makeURL(getCachePath(), m_nativeRDB_RO),
+ xCmdEnv, false /* no throw */ );
+ }
+ const OUString plt_rdb( getPlatformString() + OUSTR(".rdb") );
+ const OUString plt_rdb_( getPlatformString() + OUSTR("_.rdb") );
+ m_nativeRDB = m_nativeRDB_RO.equals( plt_rdb ) ? plt_rdb_ : plt_rdb;
+ if (oldRDB.get().is())
+ {
+ if (! cacheDir.transferContent(
oldRDB, ::ucbhelper::InsertOperation_COPY,
m_nativeRDB, NameClash::OVERWRITE ))
- throw RuntimeException(
+ throw RuntimeException(
OUSTR("UCB transferContent() failed!"), 0 );
- }
-
- // UNO is bootstrapped, flush for next process start:
- m_unorc_modified = true;
- unorc_flush( Reference<XCommandEnvironment>() );
}
+ // UNO is bootstrapped, flush for next process start:
+ m_unorc_modified = true;
+ unorc_flush( Reference<XCommandEnvironment>() );
+
+
// common rdb for java, native rdb for shared lib components
if (m_commonRDB.getLength() > 0) {
m_xCommonRDB.set(
@@ -433,7 +457,8 @@ void BackendImpl::initServiceRdbFiles()
m_xComponentContext ), UNO_QUERY_THROW );
m_xCommonRDB->open(
makeURL( expandUnoRcUrl(getCachePath()), m_commonRDB ),
- m_readOnly, !m_readOnly );
+// m_readOnly, !m_readOnly );
+ false, true);
}
if (m_nativeRDB.getLength() > 0) {
m_xNativeRDB.set(
@@ -443,7 +468,8 @@ void BackendImpl::initServiceRdbFiles()
m_xComponentContext ), UNO_QUERY_THROW );
m_xNativeRDB->open(
makeURL( expandUnoRcUrl(getCachePath()), m_nativeRDB ),
- m_readOnly, !m_readOnly );
+// m_readOnly, !m_readOnly );
+ false, true);
}
}
@@ -562,9 +588,33 @@ BackendImpl::BackendImpl(
initServiceRdbFiles_RO();
+ OUString dbFile = makeURL(getCachePath(), OUSTR("backenddb.xml"));
+ m_backendDb.reset(
+ new ComponentBackendDb(getComponentContext(), dbFile));
}
}
+void BackendImpl::addDataToDb(
+ OUString const & url, ComponentBackendDb::Data const & data)
+{
+ if (m_backendDb.get())
+ m_backendDb->addEntry(url, data);
+}
+
+void BackendImpl::deleteDataFromDb(OUString const & url)
+{
+ if (m_backendDb.get())
+ m_backendDb->removeEntry(url);
+}
+
+ComponentBackendDb::Data BackendImpl::readDataFromDb(OUString const & url)
+{
+ ComponentBackendDb::Data data;
+ if (m_backendDb.get())
+ data = m_backendDb->getEntry(url);
+ return data;
+}
+
// XPackageRegistry
//______________________________________________________________________________
Sequence< Reference<deployment::XPackageTypeInfo> >
@@ -577,6 +627,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException)
//______________________________________________________________________________
Reference<deployment::XPackage> BackendImpl::bindPackage_(
OUString const & url, OUString const & mediaType_,
+ sal_Bool bRemoved, OUString const & identifier,
Reference<XCommandEnvironment> const & xCmdEnv )
{
OUString mediaType(mediaType_);
@@ -632,9 +683,14 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
{
if (type.EqualsIgnoreCaseAscii("application"))
{
- ::ucbhelper::Content ucbContent( url, xCmdEnv );
- const OUString name( ucbContent.getPropertyValue(
- StrTitle::get() ).get<OUString>() );
+ OUString name;
+ if (!bRemoved)
+ {
+ ::ucbhelper::Content ucbContent( url, xCmdEnv );
+ name = ucbContent.getPropertyValue(
+ StrTitle::get() ).get<OUString>();
+ }
+
if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.uno-component"))
{
// xxx todo: probe and evaluate component xml description
@@ -649,17 +705,20 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
if (value.EqualsIgnoreCaseAscii("native")) {
return new BackendImpl::ComponentPackageImpl(
this, url, name, m_xDynComponentTypeInfo,
- OUSTR("com.sun.star.loader.SharedLibrary") );
+ OUSTR("com.sun.star.loader.SharedLibrary"),
+ bRemoved, identifier);
}
if (value.EqualsIgnoreCaseAscii("Java")) {
return new BackendImpl::ComponentPackageImpl(
this, url, name, m_xJavaComponentTypeInfo,
- OUSTR("com.sun.star.loader.Java2") );
+ OUSTR("com.sun.star.loader.Java2"),
+ bRemoved, identifier);
}
if (value.EqualsIgnoreCaseAscii("Python")) {
return new BackendImpl::ComponentPackageImpl(
this, url, name, m_xPythonComponentTypeInfo,
- OUSTR("com.sun.star.loader.Python") );
+ OUSTR("com.sun.star.loader.Python"),
+ bRemoved, identifier);
}
}
}
@@ -675,12 +734,12 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
{
return new BackendImpl::TypelibraryPackageImpl(
this, url, name, m_xRDBTypelibTypeInfo,
- false /* rdb */ );
+ false /* rdb */, bRemoved, identifier);
}
if (value.EqualsIgnoreCaseAscii("Java")) {
return new BackendImpl::TypelibraryPackageImpl(
this, url, name, m_xJavaTypelibTypeInfo,
- true /* jar */ );
+ true /* jar */, bRemoved, identifier);
}
}
}
@@ -717,16 +776,18 @@ void BackendImpl::unorc_verify_init(
sal_Int32 index = sizeof ("UNO_JAVA_CLASSPATH=") - 1;
do {
OUString token( line.getToken( 0, ' ', index ).trim() );
- if (token.getLength() > 0) {
- // cleanup, check if existing:
+ if (token.getLength() > 0)
+ {
if (create_ucb_content(
0, expandUnoRcTerm(token), xCmdEnv,
- false /* no throw */ )) {
+ false /* no throw */ ))
+ {
+ //The jar file may not exist anymore if a shared or bundled
+ //extension was removed, but it can still be in the unorc
+ //After running XExtensionManager::synchronize, the unorc is
+ //cleaned up
m_jar_typelibs.push_back( token );
}
- else
- OSL_ENSURE(
- 0, "### invalid UNO_JAVA_CLASSPATH entry!" );
}
}
while (index >= 0);
@@ -736,17 +797,20 @@ void BackendImpl::unorc_verify_init(
sal_Int32 index = sizeof ("UNO_TYPES=") - 1;
do {
OUString token( line.getToken( 0, ' ', index ).trim() );
- if (token.getLength() > 0) {
+ if (token.getLength() > 0)
+ {
if (token[ 0 ] == '?')
token = token.copy( 1 );
- // cleanup, check if existing:
- if (create_ucb_content(
- 0, expandUnoRcTerm(token),
- xCmdEnv, false /* no throw */ )) {
- m_rdb_typelibs.push_back( token );
- }
- else
- OSL_ENSURE( 0, "### invalid UNO_TYPES entry!" );
+ if (create_ucb_content(
+ 0, expandUnoRcTerm(token), xCmdEnv,
+ false /* no throw */ ))
+ {
+ //The RDB file may not exist anymore if a shared or bundled
+ //extension was removed, but it can still be in the unorc.
+ //After running XExtensionManager::synchronize, the unorc is
+ //cleaned up
+ m_rdb_typelibs.push_back( token );
+ }
}
}
while (index >= 0);
@@ -785,18 +849,11 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv )
return;
::rtl::OStringBuffer buf;
- // UNO_USER_PACKAGES_CACHE, UNO_SHARED_PACKAGES_CACHE have to be resolved
- // locally:
- if (m_eContext == CONTEXT_USER) {
- buf.append( RTL_CONSTASCII_STRINGPARAM(
- "UNO_USER_PACKAGES_CACHE=$ORIGIN/../..") );
- }
- else if (m_eContext == CONTEXT_SHARED) {
- buf.append( RTL_CONSTASCII_STRINGPARAM(
- "UNO_SHARED_PACKAGES_CACHE=$ORIGIN/../..") );
- }
- else
- OSL_ASSERT(0);
+
+ buf.append(RTL_CONSTASCII_STRINGPARAM("ORIGIN="));
+ OUString sOrigin = dp_misc::makeRcTerm(m_cachePath);
+ ::rtl::OString osOrigin = ::rtl::OUStringToOString(sOrigin, RTL_TEXTENCODING_UTF8);
+ buf.append(osOrigin);
buf.append(LF);
if (! m_jar_typelibs.empty())
@@ -852,6 +909,9 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv )
// write native rc:
::rtl::OStringBuffer buf2;
+ buf2.append(RTL_CONSTASCII_STRINGPARAM("ORIGIN="));
+ buf2.append(osOrigin);
+ buf2.append(LF);
buf2.append( RTL_CONSTASCII_STRINGPARAM("UNO_SERVICES=?$ORIGIN/") );
buf2.append( ::rtl::OUStringToOString(
sNativeRDB, RTL_TEXTENCODING_ASCII_US ) );
@@ -882,28 +942,11 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv )
m_unorc_modified = false;
}
-//------------------------------------------------------------------------------
-inline OUString makeRcTerm( OUString const & url )
-{
- OSL_ASSERT( url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM(
- "vnd.sun.star.expand:") ) );
- if (url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:") )) {
- // cut protocol:
- OUString rcterm( url.copy( sizeof ("vnd.sun.star.expand:") - 1 ) );
- // decode uric class chars:
- rcterm = ::rtl::Uri::decode(
- rcterm, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
- return rcterm;
- }
- else
- return url;
-}
-
//______________________________________________________________________________
bool BackendImpl::addToUnoRc( bool jarFile, OUString const & url_,
Reference<XCommandEnvironment> const & xCmdEnv )
{
- const OUString rcterm( makeRcTerm(url_) );
+ const OUString rcterm( dp_misc::makeRcTerm(url_) );
const ::osl::MutexGuard guard( getMutex() );
unorc_verify_init( xCmdEnv );
t_stringlist & rSet = getTypelibs(jarFile);
@@ -923,7 +966,7 @@ bool BackendImpl::removeFromUnoRc(
bool jarFile, OUString const & url_,
Reference<XCommandEnvironment> const & xCmdEnv )
{
- const OUString rcterm( makeRcTerm(url_) );
+ const OUString rcterm( dp_misc::makeRcTerm(url_) );
const ::osl::MutexGuard guard( getMutex() );
unorc_verify_init( xCmdEnv );
getTypelibs(jarFile).remove( rcterm );
@@ -937,7 +980,7 @@ bool BackendImpl::removeFromUnoRc(
bool BackendImpl::hasInUnoRc(
bool jarFile, OUString const & url_ )
{
- const OUString rcterm( makeRcTerm(url_) );
+ const OUString rcterm( dp_misc::makeRcTerm(url_) );
const ::osl::MutexGuard guard( getMutex() );
t_stringlist const & rSet = getTypelibs(jarFile);
return ::std::find( rSet.begin(), rSet.end(), rcterm ) != rSet.end();
@@ -1174,6 +1217,7 @@ BackendImpl::ComponentPackageImpl::isRegistered_(
void BackendImpl::ComponentPackageImpl::processPackage_(
::osl::ResettableMutexGuard &,
bool doRegisterPackage,
+ bool startup,
::rtl::Reference<AbortChannel> const & abortChannel,
Reference<XCommandEnvironment> const & xCmdEnv )
{
@@ -1183,16 +1227,25 @@ void BackendImpl::ComponentPackageImpl::processPackage_(
const bool java = m_loader.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("com.sun.star.loader.Java2") );
const OUString url( getURL() );
- bool isJavaTypelib = java &&
- !jarManifestHeaderPresent( url, OUSTR("UNO-Type-Path"), xCmdEnv );
-
+ bool isJavaTypelib;
+ if (m_bRemoved)
+ isJavaTypelib = m_registeredComponentsDb.javaTypeLibrary;
+ else
+ isJavaTypelib = java &&
+ !jarManifestHeaderPresent( url, OUSTR("UNO-Type-Path"), xCmdEnv );
+
+ ComponentBackendDb::Data data;
+ data.javaTypeLibrary = isJavaTypelib;
if (doRegisterPackage)
{
- if (! m_xRemoteContext.is()) {
- m_xRemoteContext.set(
+ Reference <uno::XComponentContext> context(that->getComponentContext());
+ if (! startup)
+ {
+ context.set(
that->getObject( url ), UNO_QUERY );
- if (! m_xRemoteContext.is()) {
- m_xRemoteContext.set(
+
+ if (! context.is()) {
+ context.set(
that->insertObject( url, raise_uno_process(
that->getComponentContext(),
abortChannel ) ),
@@ -1202,147 +1255,170 @@ void BackendImpl::ComponentPackageImpl::processPackage_(
const Reference<registry::XSimpleRegistry> xServicesRDB( getRDB() );
const Reference<registry::XImplementationRegistration> xImplReg(
- m_xRemoteContext->getServiceManager()->createInstanceWithContext(
+ context->getServiceManager()->createInstanceWithContext(
OUSTR("com.sun.star.registry.ImplementationRegistration"),
- m_xRemoteContext ), UNO_QUERY_THROW );
+ context ), UNO_QUERY_THROW );
xImplReg->registerImplementation( m_loader, url, xServicesRDB );
//only write to unorc if registration was successful.
//It may fail if there is no suitable java.
if (isJavaTypelib)
+ {
that->addToUnoRc( java, url, xCmdEnv );
+ data.javaTypeLibrary = true;
+ }
t_stringlist implNames;
t_stringpairvec singletons;
- const Reference<loader::XImplementationLoader> xLoader(
- getComponentInfo( &implNames, &singletons, m_xRemoteContext ) );
-
- // factories live insertion:
- const Reference<container::XSet> xSet(
- that->getComponentContext()->getServiceManager(), UNO_QUERY_THROW );
- for ( t_stringlist::const_iterator iPos( implNames.begin() );
- iPos != implNames.end(); ++iPos )
+ const Reference<loader::XImplementationLoader> xLoader(
+ getComponentInfo( &implNames, &singletons, context ) );
+ data.implementationNames = implNames;
+ data.singletons = singletons;
+
+ if (!startup)
{
- checkAborted( abortChannel );
- OUString const & implName = *iPos;
- // activate factory:
- const Reference<XInterface> xFactory(
- xLoader->activate(
- implName, OUString(), url,
- xServicesRDB->getRootKey()->openKey(
- OUSTR("/IMPLEMENTATIONS/") + implName ) ) );
- try {
- xSet->insert( Any(xFactory) );
- } // ignore if factory has already been inserted:
- catch (container::ElementExistException &) {
- OSL_ENSURE( 0, "### factory already registered?" );
+ // factories live insertion:
+ const Reference<container::XSet> xSet(
+ that->getComponentContext()->getServiceManager(), UNO_QUERY_THROW );
+ for ( t_stringlist::const_iterator iPos( implNames.begin() );
+ iPos != implNames.end(); ++iPos )
+ {
+ checkAborted( abortChannel );
+ OUString const & implName = *iPos;
+ // activate factory:
+ const Reference<XInterface> xFactory(
+ xLoader->activate(
+ implName, OUString(), url,
+ xServicesRDB->getRootKey()->openKey(
+ OUSTR("/IMPLEMENTATIONS/") + implName ) ) );
+ try {
+ xSet->insert( Any(xFactory) );
+ } // ignore if factory has already been inserted:
+ catch (container::ElementExistException &) {
+ OSL_ENSURE( 0, "### factory already registered?" );
+ }
}
- }
- if (! singletons.empty())
- {
- // singletons live insertion:
- const Reference<container::XNameContainer> xRootContext(
- that->getComponentContext()->getValueByName(
- OUSTR("_root") ), UNO_QUERY );
- if (xRootContext.is())
+ if (! singletons.empty())
{
- for ( t_stringpairvec::const_iterator iPos(
- singletons.begin() );
- iPos != singletons.end(); ++iPos )
+ // singletons live insertion:
+ const Reference<container::XNameContainer> xRootContext(
+ that->getComponentContext()->getValueByName(
+ OUSTR("_root") ), UNO_QUERY );
+ if (xRootContext.is())
{
- ::std::pair<OUString, OUString> const & sp = *iPos;
- const OUString name( OUSTR("/singletons/") + sp.first );
- // assure no arguments:
- try {
- xRootContext->removeByName( name + OUSTR("/arguments"));
- } catch (container::NoSuchElementException &) {}
- // used service:
- try {
- xRootContext->insertByName(
- name + OUSTR("/service"), Any(sp.second) );
- } catch (container::ElementExistException &) {
- xRootContext->replaceByName(
- name + OUSTR("/service"), Any(sp.second) );
- }
- // singleton entry:
- try {
- xRootContext->insertByName( name, Any() );
- } catch (container::ElementExistException & exc) {
- (void) exc; // avoid warnings
- OSL_ENSURE(
- 0, OUStringToOString(
- exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
- xRootContext->replaceByName( name, Any() );
+ for ( t_stringpairvec::const_iterator iPos(
+ singletons.begin() );
+ iPos != singletons.end(); ++iPos )
+ {
+ ::std::pair<OUString, OUString> const & sp = *iPos;
+ const OUString name( OUSTR("/singletons/") + sp.first );
+ // assure no arguments:
+ try {
+ xRootContext->removeByName( name + OUSTR("/arguments"));
+ } catch (container::NoSuchElementException &) {}
+ // used service:
+ try {
+ xRootContext->insertByName(
+ name + OUSTR("/service"), Any(sp.second) );
+ } catch (container::ElementExistException &) {
+ xRootContext->replaceByName(
+ name + OUSTR("/service"), Any(sp.second) );
+ }
+ // singleton entry:
+ try {
+ xRootContext->insertByName( name, Any() );
+ } catch (container::ElementExistException & exc) {
+ (void) exc; // avoid warnings
+ OSL_ENSURE(
+ 0, OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ xRootContext->replaceByName( name, Any() );
+ }
}
}
}
}
m_registered = REG_REGISTERED;
+ getMyBackend()->addDataToDb(url, data);
}
else // revokePackage()
{
// set to VOID during revocation process:
m_registered = REG_VOID;
-
- Reference<XComponentContext> xContext;
- if (m_xRemoteContext.is()) // has been activated in this process
- xContext = m_xRemoteContext;
- else // has been deployed in former times
+
+ //get the remote context. If it does not exist then use the local one
+ Reference<XComponentContext> xContext(
+ that->getObject( url ), UNO_QUERY );
+ bool bRemoteContext = false;
+ if (!xContext.is())
xContext = that->getComponentContext();
+ else
+ bRemoteContext = true;
t_stringlist implNames;
t_stringpairvec singletons;
- getComponentInfo( &implNames, &singletons, xContext );
-
- // factories live removal:
- const Reference<container::XSet> xSet(
- that->getComponentContext()->getServiceManager(), UNO_QUERY_THROW );
- for ( t_stringlist::const_iterator iPos( implNames.begin() );
- iPos != implNames.end(); ++iPos )
+ if (m_bRemoved)
{
- OUString const & implName = *iPos;
- try {
- xSet->remove( Any(implName) );
- } // ignore if factory has not been live deployed:
- catch (container::NoSuchElementException &) {
- }
+ implNames = m_registeredComponentsDb.implementationNames;
+ singletons = m_registeredComponentsDb.singletons;
}
-
- if (! singletons.empty())
+ else
{
- // singletons live removal:
- const Reference<container::XNameContainer> xRootContext(
- that->getComponentContext()->getValueByName(
- OUSTR("_root") ), UNO_QUERY );
- if (xRootContext.is())
+ getComponentInfo( &implNames, &singletons, xContext );
+ }
+
+ if (!startup)
+ {
+ // factories live removal:
+ const Reference<container::XSet> xSet(
+ that->getComponentContext()->getServiceManager(), UNO_QUERY_THROW );
+ for ( t_stringlist::const_iterator iPos( implNames.begin() );
+ iPos != implNames.end(); ++iPos )
+ {
+ OUString const & implName = *iPos;
+ try {
+ xSet->remove( Any(implName) );
+ } // ignore if factory has not been live deployed:
+ catch (container::NoSuchElementException &) {
+ }
+ }
+
+ if (! singletons.empty())
{
- for ( t_stringpairvec::const_iterator iPos(
- singletons.begin() );
- iPos != singletons.end(); ++iPos )
+ // singletons live removal:
+ const Reference<container::XNameContainer> xRootContext(
+ that->getComponentContext()->getValueByName(
+ OUSTR("_root") ), UNO_QUERY );
+ if (xRootContext.is())
{
- ::std::pair<OUString, OUString> const & sp = *iPos;
- const OUString name( OUSTR("/singletons/") + sp.first );
- // arguments:
- try {
- xRootContext->removeByName( name + OUSTR("/arguments"));
- }
- catch (container::NoSuchElementException &) {}
- // used service:
- try {
- xRootContext->removeByName( name + OUSTR("/service") );
- }
- catch (container::NoSuchElementException &) {}
- // singleton entry:
- try {
- xRootContext->removeByName( name );
- }
- catch (container::NoSuchElementException & exc) {
- (void) exc; // avoid warnings
- OSL_ENSURE(
- 0, OUStringToOString(
- exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ for ( t_stringpairvec::const_iterator iPos(
+ singletons.begin() );
+ iPos != singletons.end(); ++iPos )
+ {
+ ::std::pair<OUString, OUString> const & sp = *iPos;
+ const OUString name( OUSTR("/singletons/") + sp.first );
+ // arguments:
+ try {
+ xRootContext->removeByName( name + OUSTR("/arguments"));
+ }
+ catch (container::NoSuchElementException &) {}
+ // used service:
+ try {
+ xRootContext->removeByName( name + OUSTR("/service") );
+ }
+ catch (container::NoSuchElementException &) {}
+ // singleton entry:
+ try {
+ xRootContext->removeByName( name );
+ }
+ catch (container::NoSuchElementException & exc) {
+ (void) exc; // avoid warnings
+ OSL_ENSURE(
+ 0, OUStringToOString(
+ exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
}
}
}
@@ -1358,16 +1434,25 @@ void BackendImpl::ComponentPackageImpl::processPackage_(
if (isJavaTypelib)
that->removeFromUnoRc( java, url, xCmdEnv );
- if (m_xRemoteContext.is()) {
+ if (bRemoteContext)
that->releaseObject( url );
- m_xRemoteContext.clear();
- }
m_registered = REG_NOT_REGISTERED;
+ getMyBackend()->deleteDataFromDb(url);
}
}
//##############################################################################
+BackendImpl::TypelibraryPackageImpl::TypelibraryPackageImpl(
+ ::rtl::Reference<PackageRegistryBackend> const & myBackend,
+ OUString const & url, OUString const & name,
+ Reference<deployment::XPackageTypeInfo> const & xPackageType,
+ bool jarFile, bool bRemoved, OUString const & identifier)
+ : Package( myBackend, url, name, name /* display-name */,
+ xPackageType, bRemoved, identifier),
+ m_jarFile( jarFile )
+{
+}
// Package
BackendImpl * BackendImpl::TypelibraryPackageImpl::getMyBackend() const
@@ -1403,12 +1488,13 @@ BackendImpl::TypelibraryPackageImpl::isRegistered_(
void BackendImpl::TypelibraryPackageImpl::processPackage_(
::osl::ResettableMutexGuard &,
bool doRegisterPackage,
+ bool /*startup*/,
::rtl::Reference<AbortChannel> const &,
Reference<XCommandEnvironment> const & xCmdEnv )
{
BackendImpl * that = getMyBackend();
const OUString url( getURL() );
-
+
if (doRegisterPackage)
{
// live insertion:
@@ -1490,7 +1576,7 @@ namespace sdecl = comphelper::service_decl;
sdecl::class_<BackendImpl, sdecl::with_args<true> > serviceBI;
extern sdecl::ServiceDecl const serviceDecl(
serviceBI,
- "com.sun.star.comp.deployment.component.PackageRegistryBackend",
+ IMPLEMENTATION_NAME,
BACKEND_SERVICE_NAME );
} // namespace component
diff --git a/desktop/source/deployment/registry/component/makefile.mk b/desktop/source/deployment/registry/component/makefile.mk
index 4c4016f9bf..b7ee5c203c 100644
--- a/desktop/source/deployment/registry/component/makefile.mk
+++ b/desktop/source/deployment/registry/component/makefile.mk
@@ -40,7 +40,8 @@ SRC1FILES = \
INCPRE += ..$/..$/inc
SLOFILES = \
- $(SLO)$/dp_component.obj
+ $(SLO)$/dp_component.obj \
+ $(SLO)$/dp_compbackenddb.obj
.INCLUDE : ..$/..$/target.pmk
.INCLUDE : target.mk
diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index f52a05b529..c50e6bdf42 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -35,7 +35,6 @@
#include "dp_backend.h"
#include "dp_persmap.h"
#include "dp_ucb.h"
-#include "dp_xml.h"
#include "rtl/string.hxx"
#include "rtl/ustrbuf.hxx"
#include "rtl/uri.hxx"
@@ -55,6 +54,7 @@
#include <list>
#include <memory>
+#include "dp_configurationbackenddb.hxx"
using namespace ::dp_misc;
using namespace ::com::sun::star;
@@ -86,6 +86,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
virtual void processPackage_(
::osl::ResettableMutexGuard & guard,
bool registerPackage,
+ bool startup,
::rtl::Reference<AbortChannel> const & abortChannel,
Reference<XCommandEnvironment> const & xCmdEnv );
@@ -94,9 +95,9 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
::rtl::Reference<PackageRegistryBackend> const & myBackend,
OUString const & url, OUString const & name,
Reference<deployment::XPackageTypeInfo> const & xPackageType,
- bool isSchema )
+ bool isSchema, bool bRemoved, OUString const & identifier)
: Package( myBackend, url, name, name /* display-name */,
- xPackageType ),
+ xPackageType, bRemoved, identifier),
m_isSchema( isSchema )
{}
};
@@ -110,10 +111,12 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
bool m_configmgrini_inited;
bool m_configmgrini_modified;
+ std::auto_ptr<ConfigurationBackendDb> m_backendDb;
// PackageRegistryBackend
virtual Reference<deployment::XPackage> bindPackage_(
- OUString const & url, OUString const & mediaType,
+ OUString const & url, OUString const & mediaType, sal_Bool bRemoved,
+ OUString const & identifier,
Reference<XCommandEnvironment> const & xCmdEnv );
::std::auto_ptr<PersistentMap> m_registeredPackages;
@@ -133,7 +136,11 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
Reference<XCommandEnvironment> const & xCmdEnv );
bool removeFromConfigmgrIni( bool isSchema, OUString const & url,
Reference<XCommandEnvironment> const & xCmdEnv );
- bool hasInConfigmgrIni( bool isSchema, OUString const & url );
+
+ void addDataToDb(OUString const & url, ConfigurationBackendDb::Data const & data);
+ ::boost::optional<ConfigurationBackendDb::Data> readDataFromDb(OUString const & url);
+ void deleteDataFromDb(OUString const & url);
+ ::std::list<OUString> getAllIniEntries();
public:
BackendImpl( Sequence<Any> const & args,
@@ -191,18 +198,64 @@ BackendImpl::BackendImpl(
const Reference<XCommandEnvironment> xCmdEnv;
- if (transientMode()) {
+ if (transientMode())
+ {
//TODO
}
- else {
+ else
+ {
+ OUString dbFile = makeURL(getCachePath(), OUSTR("backenddb.xml"));
+ m_backendDb.reset(
+ new ConfigurationBackendDb(getComponentContext(), dbFile));
+ //clean up data folders which are no longer used.
+ //This must not be done in the same process where the help files
+ //are still registers. Only after revoking and restarting OOo the folders
+ //can be removed. This works now, because the extension manager is a singleton
+ //and the backends are only create once per process.
+ ::std::list<OUString> folders = m_backendDb->getAllDataUrls();
+ deleteUnusedFolders(OUString(), folders);
+
+
configmgrini_verify_init( xCmdEnv );
m_registeredPackages.reset(
new PersistentMap(
makeURL( getCachePath(), OUSTR("registered_packages.db") ),
- m_readOnly ) );
- }
+ false ) );
+ }
+}
+
+void BackendImpl::addDataToDb(
+ OUString const & url, ConfigurationBackendDb::Data const & data)
+{
+ if (m_backendDb.get())
+ m_backendDb->addEntry(url, data);
+}
+
+::boost::optional<ConfigurationBackendDb::Data> BackendImpl::readDataFromDb(
+ OUString const & url)
+{
+ ::boost::optional<ConfigurationBackendDb::Data> data;
+ if (m_backendDb.get())
+ data = m_backendDb->getEntry(url);
+ return data;
}
+void BackendImpl::deleteDataFromDb(OUString const & url)
+{
+ if (m_backendDb.get())
+ m_backendDb->removeEntry(url);
+}
+
+::std::list<OUString> BackendImpl::getAllIniEntries()
+{
+ if (m_backendDb.get())
+ return m_backendDb->getAllIniEntries();
+ else
+ return ::std::list<OUString>();
+}
+
+
+
// XPackageRegistry
//______________________________________________________________________________
Sequence< Reference<deployment::XPackageTypeInfo> >
@@ -215,6 +268,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException)
//______________________________________________________________________________
Reference<deployment::XPackage> BackendImpl::bindPackage_(
OUString const & url, OUString const & mediaType_,
+ sal_Bool bRemoved, OUString const & identifier,
Reference<XCommandEnvironment> const & xCmdEnv )
{
OUString mediaType( mediaType_ );
@@ -249,20 +303,27 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
{
if (type.EqualsIgnoreCaseAscii("application"))
{
+ OUString name;
+ if (!bRemoved)
+ {
+ ::ucbhelper::Content ucbContent( url, xCmdEnv );
+ name = ucbContent.getPropertyValue(
+ StrTitle::get() ).get<OUString>();
+ }
+
::ucbhelper::Content ucbContent( url, xCmdEnv );
if (subType.EqualsIgnoreCaseAscii(
- "vnd.sun.star.configuration-data")) {
+ "vnd.sun.star.configuration-data"))
+ {
return new PackageImpl(
- this, url, ucbContent.getPropertyValue(
- StrTitle::get() ).get<OUString>(),
- m_xConfDataTypeInfo, false /* data file */ );
+ this, url, name, m_xConfDataTypeInfo, false /* data file */,
+ bRemoved, identifier);
}
else if (subType.EqualsIgnoreCaseAscii(
"vnd.sun.star.configuration-schema")) {
return new PackageImpl(
- this, url, ucbContent.getPropertyValue(
- StrTitle::get() ).get<OUString>(),
- m_xConfSchemaTypeInfo, true /* schema file */ );
+ this, url, name, m_xConfSchemaTypeInfo, true /* schema file */,
+ bRemoved, identifier);
}
}
}
@@ -302,11 +363,12 @@ void BackendImpl::configmgrini_verify_init(
if (create_ucb_content(
0, expandUnoRcTerm(token), xCmdEnv,
false /* no throw */ )) {
+ //The file may not exist anymore if a shared or bundled
+ //extension was removed, but it can still be in the configmgrini.
+ //After running XExtensionManager::synchronize, the configmgrini is
+ //cleaned up
m_xcs_files.push_back( token );
}
- else
- OSL_ENSURE(
- 0, "### invalid SCHEMA entry!" );
}
}
while (index >= 0);
@@ -323,10 +385,24 @@ void BackendImpl::configmgrini_verify_init(
if (create_ucb_content(
0, expandUnoRcTerm(token),
xCmdEnv, false /* no throw */ )) {
+ //The file may not exist anymore if a shared or bundled
+ //extension was removed, but it can still be in the configmgrini.
+ //After running XExtensionManager::synchronize, the configmgrini is
+ //cleaned up
m_xcu_files.push_back( token );
}
else
- OSL_ENSURE( 0, "### invalid DATA entry!" );
+ {
+ //Check if it was removed. Only when the file contained %origin, so that
+ //a new file was writen in the user installation (e.g. $BUNDLED_EXTENSIONS_USER)
+ //See also ConfigurationBackendDb.iniEntry
+ ::std::list<OUString> iniEntries = getAllIniEntries();
+ if (::std::find(iniEntries.begin(), iniEntries.end(), token)
+ != iniEntries.end())
+ m_xcu_files.push_back( token );
+ else
+ OSL_ENSURE(0, "Extension manager: Invalid configmgr.ini entry.");
+ }
}
}
while (index >= 0);
@@ -347,20 +423,6 @@ void BackendImpl::configmgrini_flush(
return;
::rtl::OStringBuffer buf;
- // UNO_USER_PACKAGES_CACHE, UNO_SHARED_PACKAGES_CACHE have to be resolved
- // locally:
- if (m_eContext == CONTEXT_USER) {
- buf.append( RTL_CONSTASCII_STRINGPARAM(
- "UNO_USER_PACKAGES_CACHE=$ORIGIN/../..") );
- }
- else if (m_eContext == CONTEXT_SHARED) {
- buf.append( RTL_CONSTASCII_STRINGPARAM(
- "UNO_SHARED_PACKAGES_CACHE=$ORIGIN/../..") );
- }
- else
- OSL_ASSERT(0);
- buf.append(LF);
-
if (! m_xcs_files.empty())
{
t_stringlist::const_iterator iPos( m_xcs_files.begin() );
@@ -407,28 +469,11 @@ void BackendImpl::configmgrini_flush(
m_configmgrini_modified = false;
}
-//------------------------------------------------------------------------------
-inline OUString makeRcTerm( OUString const & url )
-{
- OSL_ASSERT( url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM(
- "vnd.sun.star.expand:") ) );
- if (url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:") )) {
- // cut protocol:
- OUString rcterm( url.copy( sizeof ("vnd.sun.star.expand:") - 1 ) );
- // decode uric class chars:
- rcterm = ::rtl::Uri::decode(
- rcterm, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
- return rcterm;
- }
- else
- return url;
-}
-
//______________________________________________________________________________
bool BackendImpl::addToConfigmgrIni( bool isSchema, OUString const & url_,
Reference<XCommandEnvironment> const & xCmdEnv )
{
- const OUString rcterm( makeRcTerm(url_) );
+ const OUString rcterm( dp_misc::makeRcTerm(url_) );
const ::osl::MutexGuard guard( getMutex() );
configmgrini_verify_init( xCmdEnv );
t_stringlist & rSet = getFiles(isSchema);
@@ -448,15 +493,18 @@ bool BackendImpl::removeFromConfigmgrIni(
bool isSchema, OUString const & url_,
Reference<XCommandEnvironment> const & xCmdEnv )
{
- const OUString rcterm( makeRcTerm(url_) );
+ const OUString rcterm( dp_misc::makeRcTerm(url_) );
const ::osl::MutexGuard guard( getMutex() );
configmgrini_verify_init( xCmdEnv );
t_stringlist & rSet = getFiles(isSchema);
t_stringlist::iterator i(std::find(rSet.begin(), rSet.end(), rcterm));
- if (i == rSet.end() && !isSchema) { //TODO: see replaceOrigin()
- i = std::find(
- rSet.begin(), rSet.end(),
- rcterm + OUString(RTL_CONSTASCII_USTRINGPARAM(".mod")));
+ if (i == rSet.end() && !isSchema)
+ {
+ //in case the xcu contained %origin% then the configmr.ini contains the
+ //url to the file in the user installation (e.g. $BUNDLED_EXTENSIONS_USER)
+ ::boost::optional<ConfigurationBackendDb::Data> data = readDataFromDb(url_);
+ if (data)
+ i = std::find(rSet.begin(), rSet.end(), data->iniEntry);
}
if (i == rSet.end()) {
return false;
@@ -468,21 +516,6 @@ bool BackendImpl::removeFromConfigmgrIni(
return true;
}
-//______________________________________________________________________________
-bool BackendImpl::hasInConfigmgrIni(
- bool isSchema, OUString const & url_ )
-{
- const OUString rcterm( makeRcTerm(url_) );
- const ::osl::MutexGuard guard( getMutex() );
- t_stringlist const & rSet = getFiles(isSchema);
- return ::std::find( rSet.begin(), rSet.end(), rcterm ) != rSet.end()
- || (!isSchema && //TODO: see replaceOrigin()
- ::std::find(
- rSet.begin(), rSet.end(),
- rcterm + OUString(RTL_CONSTASCII_USTRINGPARAM(".mod"))) !=
- rSet.end());
-}
-
//##############################################################################
// Package
@@ -509,14 +542,18 @@ BackendImpl::PackageImpl::isRegistered_(
Reference<XCommandEnvironment> const & )
{
BackendImpl * that = getMyBackend();
- rtl::OUString url(getURL());
+ const rtl::OUString url(getURL());
+
+ bool bReg = false;
+ if (that->readDataFromDb(getURL()))
+ bReg = true;
+ if (!bReg)
+ //fallback for user extension registered in berkeley DB
+ bReg = that->m_registeredPackages->has(
+ rtl::OUStringToOString( url, RTL_TEXTENCODING_UTF8 ));
+
return beans::Optional< beans::Ambiguous<sal_Bool> >(
- true /* IsPresent */,
- beans::Ambiguous<sal_Bool>(
- that->hasInConfigmgrIni( m_isSchema, url ) ||
- that->m_registeredPackages->has(
- rtl::OUStringToOString( url, RTL_TEXTENCODING_UTF8 ) ),
- false /* IsAmbiguous */ ) );
+ true, beans::Ambiguous<sal_Bool>( bReg, false ) );
}
//------------------------------------------------------------------------------
@@ -554,7 +591,7 @@ OUString encodeForXml( OUString const & text )
//______________________________________________________________________________
OUString replaceOrigin(
- OUString const & url, Reference< XCommandEnvironment > const & xCmdEnv )
+ OUString const & url, OUString const & destFolder, Reference< XCommandEnvironment > const & xCmdEnv, bool & out_replaced)
{
// looking for %origin%:
::ucbhelper::Content ucb_content( url, xCmdEnv );
@@ -624,10 +661,17 @@ OUString replaceOrigin(
return url;
if (write_pos < filtered.getLength())
filtered.realloc( write_pos );
- rtl::OUString newUrl(url + OUString(RTL_CONSTASCII_USTRINGPARAM(".mod")));
- //TODO: unique name
+ rtl::OUString newUrl(url);
+ if (destFolder.getLength())
+ {
+ //get the file name of the xcu and add it to the url of the temporary folder
+ sal_Int32 i = url.lastIndexOf('/');
+ newUrl = destFolder + url.copy(i);
+ }
+
ucbhelper::Content(newUrl, xCmdEnv).writeStream(
xmlscript::createInputStream(filtered), true);
+ out_replaced = true;
return newUrl;
}
@@ -635,6 +679,7 @@ OUString replaceOrigin(
void BackendImpl::PackageImpl::processPackage_(
::osl::ResettableMutexGuard &,
bool doRegisterPackage,
+ bool startup,
::rtl::Reference<AbortChannel> const &,
Reference<XCommandEnvironment> const & xCmdEnv )
{
@@ -643,21 +688,38 @@ void BackendImpl::PackageImpl::processPackage_(
if (doRegisterPackage)
{
- if (m_isSchema)
+ ConfigurationBackendDb::Data data;
+ if (!m_isSchema)
{
- com::sun::star::configuration::Update::get(
- that->m_xComponentContext)->insertExtensionXcsFile(
- that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url));
+ const OUString sModFolder = that->createFolder(OUString(), xCmdEnv);
+ bool out_replaced = false;
+ url = replaceOrigin(url, sModFolder, xCmdEnv, out_replaced);
+ if (out_replaced)
+ data.dataUrl = sModFolder;
+ else
+ deleteTempFolder(sModFolder);
}
- else
+ //No need for live-deployment for bundled extension, because OOo
+ //restarts after installation
+ if (that->m_eContext != CONTEXT_BUNDLED
+ && !startup)
{
- url = replaceOrigin(url, xCmdEnv);
- com::sun::star::configuration::Update::get(
- that->m_xComponentContext)->insertExtensionXcuFile(
- that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url));
+ if (m_isSchema)
+ {
+ com::sun::star::configuration::Update::get(
+ that->m_xComponentContext)->insertExtensionXcsFile(
+ that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url));
+ }
+ else
+ {
+ com::sun::star::configuration::Update::get(
+ that->m_xComponentContext)->insertExtensionXcuFile(
+ that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url));
+ }
}
-
that->addToConfigmgrIni( m_isSchema, url, xCmdEnv );
+ data.iniEntry = dp_misc::makeRcTerm(url);
+ that->addDataToDb(getURL(), data);
}
else // revoke
{
@@ -667,15 +729,31 @@ void BackendImpl::PackageImpl::processPackage_(
for (t_string2string_map::iterator i(entries.begin());
i != entries.end(); ++i)
{
+ //If the xcu file was installed before the configmgr was chaned
+ //to use the configmgr.ini, one needed to rebuild to whole directory
+ //structur containing the xcu, xcs files from all extensions. Now,
+ //we just add all other xcu/xcs files to the configmgr.ini instead of
+ //rebuilding the directory structure.
rtl::OUString url2(
rtl::OStringToOUString(i->first, RTL_TEXTENCODING_UTF8));
+ ConfigurationBackendDb::Data data;
if (url2 != url) {
- bool schema = i->second.equalsIgnoreAsciiCase(
- "vnd.sun.star.configuration-schema");
- if (!schema) {
- url2 = replaceOrigin(url2, xCmdEnv);
- }
- that->addToConfigmgrIni(schema, url2, xCmdEnv);
+ bool schema = i->second.equalsIgnoreAsciiCase(
+ "vnd.sun.star.configuration-schema");
+ OUString url_replaced(url2);
+ if (!schema)
+ {
+ const OUString sModFolder = that->createFolder(OUString(), xCmdEnv);
+ bool out_replaced = false;
+ url_replaced = replaceOrigin(
+ url2, sModFolder, xCmdEnv, out_replaced);
+ if (out_replaced)
+ data.dataUrl = sModFolder;
+ else
+ deleteTempFolder(sModFolder);
+ }
+ that->addToConfigmgrIni(schema, url_replaced, xCmdEnv);
+ that->addDataToDb(url2, data);
}
that->m_registeredPackages->erase(i->first);
}
@@ -684,10 +762,11 @@ void BackendImpl::PackageImpl::processPackage_(
xCmdEnv ).executeCommand(
OUSTR("delete"), Any( true /* delete physically */ ) );
}
+ that->deleteDataFromDb(getURL());
//TODO: revoking at runtime, possible, sensible?
}
-}
+}
} // anon namespace
diff --git a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx
new file mode 100644
index 0000000000..8665ef16a2
--- /dev/null
+++ b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dp_package.cxx,v $
+ * $Revision: 1.34.16.2 $
+ *
+ * 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_desktop.hxx"
+
+#include "rtl/string.h"
+#include "rtl/bootstrap.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
+#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
+#include "dp_misc.h"
+
+#include "dp_configurationbackenddb.hxx"
+
+
+namespace css = ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+#define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/configuration-registry/2010"
+#define NS_PREFIX "conf"
+#define ROOT_ELEMENT_NAME "configuration-backend-db"
+#define KEY_ELEMENT_NAME "configuration"
+
+namespace dp_registry {
+namespace backend {
+namespace configuration {
+
+ConfigurationBackendDb::ConfigurationBackendDb(
+ Reference<XComponentContext> const & xContext,
+ ::rtl::OUString const & url):BackendDb(xContext, url)
+{
+
+}
+
+OUString ConfigurationBackendDb::getDbNSName()
+{
+ return OUSTR(EXTENSION_REG_NS);
+}
+
+OUString ConfigurationBackendDb::getNSPrefix()
+{
+ return OUSTR(NS_PREFIX);
+}
+
+OUString ConfigurationBackendDb::getRootElementName()
+{
+ return OUSTR(ROOT_ELEMENT_NAME);
+}
+
+OUString ConfigurationBackendDb::getKeyElementName()
+{
+ return OUSTR(KEY_ELEMENT_NAME);
+}
+
+
+void ConfigurationBackendDb::addEntry(::rtl::OUString const & url, Data const & data)
+{
+ try{
+ Reference<css::xml::dom::XNode> helpNode
+ = writeKeyElement(url);
+
+ writeSimpleElement(OUSTR("data-url"), data.dataUrl, helpNode);
+ writeSimpleElement(OUSTR("ini-entry"), data.iniEntry, helpNode);
+ save();
+ }
+ catch (css::deployment::DeploymentException& )
+ {
+ throw;
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to write data entry in configuration backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+
+::boost::optional<ConfigurationBackendDb::Data>
+ConfigurationBackendDb::getEntry(::rtl::OUString const & url)
+{
+ try
+ {
+ ConfigurationBackendDb::Data retData;
+ Reference<css::xml::dom::XNode> aNode = getKeyElement(url);
+ if (aNode.is())
+ {
+ retData.dataUrl = readSimpleElement(OUSTR("data-url"), aNode);
+ retData.iniEntry = readSimpleElement(OUSTR("ini-entry"), aNode);
+ }
+ else
+ {
+ return ::boost::optional<Data>();
+ }
+ return ::boost::optional<Data>(retData);
+ }
+ catch (css::deployment::DeploymentException& )
+ {
+ throw;
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to read data entry in configuration backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+::std::list<OUString> ConfigurationBackendDb::getAllDataUrls()
+{
+ try
+ {
+ ::std::list<OUString> listRet;
+ Reference<css::xml::dom::XDocument> doc = getDocument();
+ Reference<css::xml::dom::XNode> root = doc->getFirstChild();
+
+ Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
+ const OUString sPrefix = getNSPrefix();
+ OUString sExpression(
+ sPrefix + OUSTR(":configuration/") + sPrefix + OUSTR(":data-url/text()"));
+ Reference<css::xml::dom::XNodeList> nodes =
+ xpathApi->selectNodeList(root, sExpression);
+ if (nodes.is())
+ {
+ sal_Int32 length = nodes->getLength();
+ for (sal_Int32 i = 0; i < length; i++)
+ listRet.push_back(nodes->item(i)->getNodeValue());
+ }
+ return listRet;
+ }
+ catch (css::deployment::DeploymentException& )
+ {
+ throw;
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to read data entry in configuration backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+::std::list<OUString> ConfigurationBackendDb::getAllIniEntries()
+{
+ return getOneChildFromAllEntries(OUSTR("ini-entry"));
+}
+
+
+
+} // namespace configuration
+} // namespace backend
+} // namespace dp_registry
+
diff --git a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx
new file mode 100644
index 0000000000..8e685660ca
--- /dev/null
+++ b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dp_backend.h,v $
+ * $Revision: 1.18 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#if ! defined INCLUDED_DP_CONFIGURATIONBACKENDDB_HXX
+#define INCLUDED_DP_CONFIGURATIONBACKENDDB_HXX
+
+#include "rtl/ustring.hxx"
+#include "rtl/string.hxx"
+#include <list>
+#include "boost/optional.hpp"
+#include "dp_backenddb.hxx"
+
+namespace css = ::com::sun::star;
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class XComponentContext;
+ }
+}}}
+
+namespace dp_registry {
+namespace backend {
+namespace configuration {
+
+/* The XML file stores the extensions which are currently registered.
+ They will be removed when they are revoked.
+ */
+class ConfigurationBackendDb: public dp_registry::backend::BackendDb
+{
+protected:
+ virtual ::rtl::OUString getDbNSName();
+
+ virtual ::rtl::OUString getNSPrefix();
+
+ virtual ::rtl::OUString getRootElementName();
+
+ virtual ::rtl::OUString getKeyElementName();
+
+public:
+ struct Data
+ {
+ /* the URL to the folder containing the xcu or xcs files which contained
+ %origin%
+ */
+ ::rtl::OUString dataUrl;
+ /* the URL of the xcu or xcs file which is written in to the configmgr.ini
+ */
+ ::rtl::OUString iniEntry;
+ };
+
+public:
+
+ ConfigurationBackendDb( css::uno::Reference<css::uno::XComponentContext> const & xContext,
+ ::rtl::OUString const & url);
+
+ void addEntry(::rtl::OUString const & url, Data const & data);
+
+ ::boost::optional<Data> getEntry(::rtl::OUString const & url);
+ ::std::list< ::rtl::OUString> getAllDataUrls();
+ ::std::list< ::rtl::OUString> getAllIniEntries();
+};
+
+
+
+}
+}
+}
+#endif
+
diff --git a/desktop/source/deployment/registry/configuration/makefile.mk b/desktop/source/deployment/registry/configuration/makefile.mk
index f549b0e7b0..9bcbd50d42 100644
--- a/desktop/source/deployment/registry/configuration/makefile.mk
+++ b/desktop/source/deployment/registry/configuration/makefile.mk
@@ -44,7 +44,8 @@ SRC1FILES = \
dp_configuration.src
SLOFILES = \
- $(SLO)$/dp_configuration.obj
+ $(SLO)$/dp_configuration.obj \
+ $(SLO)$/dp_configurationbackenddb.obj
.INCLUDE : ..$/..$/target.pmk
.INCLUDE : target.mk
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 8771fc6c7f..7562bb2a8a 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -27,16 +27,23 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_desktop.hxx"
-
+
#include "dp_backend.h"
#include "dp_ucb.h"
#include "rtl/uri.hxx"
+#include "rtl/bootstrap.hxx"
+#include "osl/file.hxx"
#include "cppuhelper/exc_hlp.hxx"
#include "comphelper/servicedecl.hxx"
#include "comphelper/unwrapargs.hxx"
#include "ucbhelper/content.hxx"
#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
+#include "com/sun/star/deployment/InvalidRemovedParameterException.hpp"
+#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp"
+#include "com/sun/star/ucb/IOErrorCode.hpp"
#include "com/sun/star/beans/StringPair.hpp"
+#include "com/sun/star/sdbc/XResultSet.hpp"
+#include "com/sun/star/sdbc/XRow.hpp"
using namespace ::dp_misc;
@@ -88,6 +95,10 @@ PackageRegistryBackend::PackageRegistryBackend(
m_eContext = CONTEXT_USER;
else if (m_context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("shared") ))
m_eContext = CONTEXT_SHARED;
+ else if (m_context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bundled") ))
+ m_eContext = CONTEXT_BUNDLED;
+ else if (m_context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("tmp") ))
+ m_eContext = CONTEXT_TMP;
else if (m_context.matchIgnoreAsciiCaseAsciiL(
RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.tdoc:/") ))
m_eContext = CONTEXT_DOCUMENT;
@@ -127,24 +138,41 @@ void PackageRegistryBackend::disposing()
// XPackageRegistry
//______________________________________________________________________________
Reference<deployment::XPackage> PackageRegistryBackend::bindPackage(
- OUString const & url, OUString const & mediaType,
- Reference<XCommandEnvironment> const & xCmdEnv )
- throw (deployment::DeploymentException, CommandFailedException,
+ OUString const & url, OUString const & mediaType, sal_Bool bRemoved,
+ OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv )
+ throw (deployment::DeploymentException,
+ deployment::InvalidRemovedParameterException,
+ ucb::CommandFailedException,
lang::IllegalArgumentException, RuntimeException)
{
::osl::ResettableMutexGuard guard( getMutex() );
check();
+
t_string2ref::const_iterator const iFind( m_bound.find( url ) );
- if (iFind != m_bound.end()) {
+ if (iFind != m_bound.end())
+ {
Reference<deployment::XPackage> xPackage( iFind->second );
- if (xPackage.is())
- return xPackage;
+ if (xPackage.is())
+ {
+ if (mediaType.getLength() &&
+ mediaType != xPackage->getPackageType()->getMediaType())
+ throw lang::IllegalArgumentException
+ (OUSTR("XPackageRegistry::bindPackage: media type does not match"),
+ static_cast<OWeakObject*>(this), 1);
+ if (xPackage->isRemoved() != bRemoved)
+ throw deployment::InvalidRemovedParameterException(
+ OUSTR("XPackageRegistry::bindPackage: bRemoved parameter does not match"),
+ static_cast<OWeakObject*>(this), xPackage->isRemoved(), xPackage);
+ return xPackage;
+ }
}
+
guard.clear();
Reference<deployment::XPackage> xNewPackage;
try {
- xNewPackage = bindPackage_( url, mediaType, xCmdEnv );
+ xNewPackage = bindPackage_( url, mediaType, bRemoved,
+ identifier, xCmdEnv );
}
catch (RuntimeException &) {
throw;
@@ -166,6 +194,7 @@ Reference<deployment::XPackage> PackageRegistryBackend::bindPackage(
}
guard.reset();
+
::std::pair< t_string2ref::iterator, bool > insertion(
m_bound.insert( t_string2ref::value_type( url, xNewPackage ) ) );
if (insertion.second)
@@ -180,11 +209,105 @@ Reference<deployment::XPackage> PackageRegistryBackend::bindPackage(
return xPackage;
insertion.first->second = xNewPackage;
}
+
guard.clear();
xNewPackage->addEventListener( this ); // listen for disposing events
return xNewPackage;
}
+OUString PackageRegistryBackend::createFolder(
+ OUString const & relUrl,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv)
+{
+ OUString sDataFolder = makeURL(getCachePath(), relUrl);
+ //make sure the folder exist
+ ucbhelper::Content dataContent;
+ ::dp_misc::create_folder(&dataContent, sDataFolder, xCmdEnv);
+
+ OUString sDataFolderURL = dp_misc::expandUnoRcUrl(sDataFolder);
+
+ OUString tempEntry;
+ if (::osl::File::createTempFile(
+ &sDataFolderURL, 0, &tempEntry ) != ::osl::File::E_None)
+ throw RuntimeException(
+ OUSTR("::osl::File::createTempFile() failed!"), 0 );
+ tempEntry = tempEntry.copy( tempEntry.lastIndexOf( '/' ) + 1 );
+ OUString destFolder= makeURL(sDataFolder, tempEntry) + OUSTR("_");
+ ::ucbhelper::Content destFolderContent;
+ dp_misc::create_folder( &destFolderContent, destFolder, xCmdEnv );
+
+ return destFolder;
+}
+
+void PackageRegistryBackend::deleteTempFolder(
+ OUString const & folderUrl)
+{
+ OSL_ASSERT(folderUrl.getLength()
+ && folderUrl[folderUrl.getLength() - 1] == '_');
+ if (folderUrl.getLength()
+ && folderUrl[folderUrl.getLength() - 1] == '_')
+ {
+ const OUString tempFile = folderUrl.copy(0, folderUrl.getLength() - 1);
+ erase_path( folderUrl, Reference<XCommandEnvironment>(),
+ false /* no throw: ignore errors */ );
+ erase_path( tempFile, Reference<XCommandEnvironment>(),
+ false /* no throw: ignore errors */ );
+ }
+}
+
+void PackageRegistryBackend::deleteUnusedFolders(
+ OUString const & relUrl,
+ ::std::list< OUString> const & usedFolders)
+{
+ try
+ {
+ const OUString sDataFolder = makeURL(getCachePath(), relUrl);
+ ::ucbhelper::Content tempFolder(
+ sDataFolder, Reference<ucb::XCommandEnvironment>());
+ Reference<sdbc::XResultSet> xResultSet(
+ tempFolder.createCursor(
+ Sequence<OUString>( &StrTitle::get(), 1 ),
+ ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) );
+ // get all temp directories:
+ ::std::vector<OUString> tempEntries;
+
+ char tmp[] = ".tmp";
+
+ while (xResultSet->next())
+ {
+ OUString title(
+ Reference<sdbc::XRow>(
+ xResultSet, UNO_QUERY_THROW )->getString(
+ 1 /* Title */ ) );
+
+ if (title.endsWithAsciiL(tmp, sizeof(tmp) - 1))
+ tempEntries.push_back(
+ makeURLAppendSysPathSegment(sDataFolder, title));
+ }
+
+ for ( ::std::size_t pos = 0; pos < tempEntries.size(); ++pos )
+ {
+ //usedFolders contains the urls to the folders which have
+ //a trailing underscore
+ const OUString tempFolderName = tempEntries[ pos ] + OUSTR("_");
+
+ if (::std::find( usedFolders.begin(), usedFolders.end(), tempFolderName ) ==
+ usedFolders.end())
+ {
+ deleteTempFolder(tempFolderName);
+ }
+ }
+ }
+ catch (ucb::InteractiveAugmentedIOException& e)
+ {
+ //In case the folder containing all the data folder does not
+ //exist yet, we ignore the exception
+ if (e.Code != ucb::IOErrorCode_NOT_EXISTING)
+ throw e;
+ }
+
+}
+
//##############################################################################
//______________________________________________________________________________
@@ -195,16 +318,30 @@ Package::~Package()
//______________________________________________________________________________
Package::Package( ::rtl::Reference<PackageRegistryBackend> const & myBackend,
OUString const & url,
- OUString const & name,
+ OUString const & rName,
OUString const & displayName,
- Reference<deployment::XPackageTypeInfo> const & xPackageType )
+ Reference<deployment::XPackageTypeInfo> const & xPackageType,
+ bool bRemoved,
+ OUString const & identifier)
: t_PackageBase( getMutex() ),
m_myBackend( myBackend ),
m_url( url ),
- m_name( name ),
+ m_name( rName ),
m_displayName( displayName ),
- m_xPackageType( xPackageType )
+ m_xPackageType( xPackageType ),
+ m_bRemoved(bRemoved),
+ m_identifier(identifier)
{
+ if (m_bRemoved)
+ {
+ //We use the last segment of the URL
+ OSL_ASSERT(m_name.getLength() == 0);
+ OUString name = m_url;
+ rtl::Bootstrap::expandMacros(name);
+ sal_Int32 index = name.lastIndexOf('/');
+ if (index != -1 && index < name.getLength())
+ m_name = name.copy(index + 1);
+ }
}
//______________________________________________________________________________
@@ -294,25 +431,31 @@ sal_Bool Package::isBundle() throw (RuntimeException)
}
//______________________________________________________________________________
-::sal_Bool Package::checkPrerequisites(
+::sal_Int32 Package::checkPrerequisites(
const css::uno::Reference< css::task::XAbortChannel >&,
const css::uno::Reference< css::ucb::XCommandEnvironment >&,
- sal_Bool, ::rtl::OUString const &)
- throw (css::deployment::DeploymentException,
- css::ucb::CommandFailedException,
- css::ucb::CommandAbortedException,
- css::uno::RuntimeException)
+ sal_Bool)
+ throw (css::deployment::DeploymentException,
+ css::deployment::ExtensionRemovedException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::uno::RuntimeException)
{
- return true;
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
+ return 0;
}
//______________________________________________________________________________
::sal_Bool Package::checkDependencies(
const css::uno::Reference< css::ucb::XCommandEnvironment >& )
- throw (css::deployment::DeploymentException,
- css::ucb::CommandFailedException,
- css::uno::RuntimeException)
+ throw (css::deployment::DeploymentException,
+ css::deployment::ExtensionRemovedException,
+ css::ucb::CommandFailedException,
+ css::uno::RuntimeException)
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
return true;
}
@@ -336,12 +479,19 @@ OUString Package::getName() throw (RuntimeException)
beans::Optional<OUString> Package::getIdentifier() throw (RuntimeException)
{
+ if (m_bRemoved)
+ return beans::Optional<OUString>(true, m_identifier);
+
return beans::Optional<OUString>();
}
//______________________________________________________________________________
-OUString Package::getVersion() throw (RuntimeException)
+OUString Package::getVersion() throw (
+ deployment::ExtensionRemovedException,
+ RuntimeException)
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
return OUString();
}
@@ -352,33 +502,49 @@ OUString Package::getURL() throw (RuntimeException)
}
//______________________________________________________________________________
-OUString Package::getDisplayName() throw (RuntimeException)
+OUString Package::getDisplayName() throw (
+ deployment::ExtensionRemovedException, RuntimeException)
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
return m_displayName;
}
//______________________________________________________________________________
-OUString Package::getDescription() throw (RuntimeException)
+OUString Package::getDescription() throw (
+ deployment::ExtensionRemovedException,RuntimeException)
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
return OUString();
}
//______________________________________________________________________________
-Sequence<OUString> Package::getUpdateInformationURLs() throw (RuntimeException)
+Sequence<OUString> Package::getUpdateInformationURLs() throw (
+ deployment::ExtensionRemovedException, RuntimeException)
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
return Sequence<OUString>();
}
//______________________________________________________________________________
-css::beans::StringPair Package::getPublisherInfo() throw (RuntimeException)
+css::beans::StringPair Package::getPublisherInfo() throw (
+ deployment::ExtensionRemovedException, RuntimeException)
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
css::beans::StringPair aEmptyPair;
return aEmptyPair;
}
//______________________________________________________________________________
-uno::Reference< css::graphic::XGraphic > Package::getIcon( sal_Bool /*bHighContrast*/ ) throw ( RuntimeException )
+uno::Reference< css::graphic::XGraphic > Package::getIcon( sal_Bool /*bHighContrast*/ )
+ throw (deployment::ExtensionRemovedException, RuntimeException )
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
+
uno::Reference< css::graphic::XGraphic > aEmpty;
return aEmpty;
}
@@ -394,8 +560,12 @@ Reference<deployment::XPackageTypeInfo> Package::getPackageType()
void Package::exportTo(
OUString const & destFolderURL, OUString const & newTitle,
sal_Int32 nameClashAction, Reference<XCommandEnvironment> const & xCmdEnv )
- throw (CommandFailedException, CommandAbortedException, RuntimeException)
+ throw (deployment::ExtensionRemovedException,
+ CommandFailedException, CommandAbortedException, RuntimeException)
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
+
::ucbhelper::Content destFolder( destFolderURL, xCmdEnv );
::ucbhelper::Content sourceContent( getURL(), xCmdEnv );
if (! destFolder.transferContent(
@@ -461,6 +631,7 @@ beans::Optional< beans::Ambiguous<sal_Bool> > Package::isRegistered(
//______________________________________________________________________________
void Package::processPackage_impl(
bool doRegisterPackage,
+ bool startup,
Reference<task::XAbortChannel> const & xAbortChannel,
Reference<XCommandEnvironment> const & xCmdEnv )
{
@@ -478,7 +649,8 @@ void Package::processPackage_impl(
(doRegisterPackage ? !option.Value.Value
: option.Value.Value)));
if (action) {
- OUString displayName( getDisplayName() );
+
+ OUString displayName = isRemoved() ? getName() : getDisplayName();
ProgressLevel progress(
xCmdEnv,
(doRegisterPackage
@@ -487,6 +659,7 @@ void Package::processPackage_impl(
+ displayName );
processPackage_( guard,
doRegisterPackage,
+ startup,
AbortChannel::get(xAbortChannel),
xCmdEnv );
}
@@ -524,13 +697,17 @@ void Package::processPackage_impl(
//______________________________________________________________________________
void Package::registerPackage(
+ sal_Bool startup,
Reference<task::XAbortChannel> const & xAbortChannel,
Reference<XCommandEnvironment> const & xCmdEnv )
throw (deployment::DeploymentException,
+ deployment::ExtensionRemovedException,
CommandFailedException, CommandAbortedException,
lang::IllegalArgumentException, RuntimeException)
{
- processPackage_impl( true /* register */, xAbortChannel, xCmdEnv );
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
+ processPackage_impl( true /* register */, startup, xAbortChannel, xCmdEnv );
}
//______________________________________________________________________________
@@ -541,7 +718,44 @@ void Package::revokePackage(
CommandFailedException, CommandAbortedException,
lang::IllegalArgumentException, RuntimeException)
{
- processPackage_impl( false /* revoke */, xAbortChannel, xCmdEnv );
+ processPackage_impl( false /* revoke */, false, xAbortChannel, xCmdEnv );
+
+}
+
+PackageRegistryBackend * Package::getMyBackend() const
+{
+ PackageRegistryBackend * pBackend = m_myBackend.get();
+ if (NULL == pBackend)
+ {
+ //May throw a DisposedException
+ check();
+ //We should never get here...
+ throw RuntimeException(
+ OUSTR("Failed to get the BackendImpl"),
+ static_cast<OWeakObject*>(const_cast<Package *>(this)));
+ }
+ return pBackend;
+}
+OUString Package::getRepositoryName()
+ throw (RuntimeException)
+{
+ PackageRegistryBackend * backEnd = getMyBackend();
+ return backEnd->getContext();
+}
+
+beans::Optional< OUString > Package::getRegistrationDataURL()
+ throw (deployment::ExtensionRemovedException,
+ css::uno::RuntimeException)
+{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
+ return beans::Optional<OUString>();
+}
+
+sal_Bool Package::isRemoved()
+ throw (RuntimeException)
+{
+ return m_bRemoved;
}
//##############################################################################
@@ -559,13 +773,15 @@ OUString Package::TypeInfo::getMediaType() throw (RuntimeException)
}
//______________________________________________________________________________
-OUString Package::TypeInfo::getDescription() throw (RuntimeException)
+OUString Package::TypeInfo::getDescription()
+ throw (deployment::ExtensionRemovedException, RuntimeException)
{
return getShortDescription();
}
//______________________________________________________________________________
-OUString Package::TypeInfo::getShortDescription() throw (RuntimeException)
+OUString Package::TypeInfo::getShortDescription()
+ throw (deployment::ExtensionRemovedException, RuntimeException)
{
return m_shortDescr;
}
diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx
new file mode 100644
index 0000000000..351260f162
--- /dev/null
+++ b/desktop/source/deployment/registry/dp_backenddb.cxx
@@ -0,0 +1,649 @@
+/*************************************************************************
+ *
+ * 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_desktop.hxx"
+
+#include "rtl/string.h"
+#include "rtl/strbuf.hxx"
+#include "rtl/bootstrap.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+#include "osl/file.hxx"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
+#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
+#include "com/sun/star/io/XActiveDataSource.hpp"
+#include "com/sun/star/io/XActiveDataControl.hpp"
+#include "dp_ucb.h"
+#include "dp_misc.h"
+#include "ucbhelper/content.hxx"
+#include "xmlscript/xml_helper.hxx"
+#include "dp_backenddb.hxx"
+
+
+namespace css = ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+
+namespace dp_registry {
+namespace backend {
+
+BackendDb::BackendDb(
+ Reference<css::uno::XComponentContext> const & xContext,
+ ::rtl::OUString const & url):
+ m_xContext(xContext)
+{
+ m_urlDb = dp_misc::expandUnoRcUrl(url);
+}
+
+void BackendDb::save()
+{
+ const Reference<css::io::XActiveDataSource> xDataSource(m_doc,css::uno::UNO_QUERY_THROW);
+ ::rtl::ByteSequence bytes;
+ xDataSource->setOutputStream(::xmlscript::createOutputStream(&bytes));
+ const Reference<css::io::XActiveDataControl> xDataControl(m_doc,css::uno::UNO_QUERY_THROW);
+ xDataControl->start();
+
+ const Reference<css::io::XInputStream> xData(
+ ::xmlscript::createInputStream(bytes));
+ ::ucbhelper::Content ucbDb(m_urlDb, 0);
+ ucbDb.writeStream(xData, true /*replace existing*/);
+}
+
+css::uno::Reference<css::xml::dom::XDocument> BackendDb::getDocument()
+{
+ if (!m_doc.is())
+ {
+ const Reference<css::xml::dom::XDocumentBuilder> xDocBuilder(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ OUSTR("com.sun.star.xml.dom.DocumentBuilder"),
+ m_xContext ), css::uno::UNO_QUERY);
+ if (!xDocBuilder.is())
+ throw css::uno::RuntimeException(
+ OUSTR(" Could not create service com.sun.star.xml.dom.DocumentBuilder"), 0);
+
+ ::osl::DirectoryItem item;
+ ::osl::File::RC err = ::osl::DirectoryItem::get(m_urlDb, item);
+ if (err == ::osl::File::E_None)
+ {
+ m_doc = xDocBuilder->parseURI(m_urlDb);
+ }
+ else if (err == ::osl::File::E_NOENT)
+ {
+ //Create a new document and insert some basic stuff
+ m_doc = xDocBuilder->newDocument();
+ const Reference<css::xml::dom::XElement> rootNode =
+ m_doc->createElementNS(getDbNSName(), getNSPrefix() +
+ OUSTR(":") + getRootElementName());
+
+ m_doc->appendChild(Reference<css::xml::dom::XNode>(
+ rootNode, UNO_QUERY_THROW));
+ save();
+ }
+ else
+ throw css::uno::RuntimeException(
+ OUSTR("Extension manager could not access database file:" )
+ + m_urlDb, 0);
+
+ if (!m_doc.is())
+ throw css::uno::RuntimeException(
+ OUSTR("Extension manager could not get root node of data base file: ")
+ + m_urlDb, 0);
+ }
+
+ return m_doc;
+}
+
+Reference<css::xml::xpath::XXPathAPI> BackendDb::getXPathAPI()
+{
+ if (!m_xpathApi.is())
+ {
+ m_xpathApi = Reference< css::xml::xpath::XXPathAPI >(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ OUSTR("com.sun.star.xml.xpath.XPathAPI"),
+ m_xContext), css::uno::UNO_QUERY);
+
+ if (!m_xpathApi.is())
+ throw css::uno::RuntimeException(
+ OUSTR(" Could not create service com.sun.star.xml.xpath.XPathAPI"), 0);
+
+ m_xpathApi->registerNS(
+ getNSPrefix(), getDbNSName());
+ }
+
+ return m_xpathApi;
+}
+
+void BackendDb::removeElement(::rtl::OUString const & sXPathExpression)
+{
+ try
+ {
+ const Reference<css::xml::dom::XDocument> doc = getDocument();
+ const Reference<css::xml::dom::XNode> root = doc->getFirstChild();
+ const Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
+ //find the extension element that is to be removed
+ const Reference<css::xml::dom::XNode> aNode =
+ xpathApi->selectSingleNode(root, sXPathExpression);
+
+ if (aNode.is())
+ {
+ root->removeChild(aNode);
+ save();
+ }
+
+#if OSL_DEBUG_LEVEL > 0
+ //There must not be any other entry with the same url
+ const Reference<css::xml::dom::XNode> nextNode =
+ xpathApi->selectSingleNode(root, sXPathExpression);
+ OSL_ASSERT(! nextNode.is());
+#endif
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to write data entry in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+void BackendDb::removeEntry(::rtl::OUString const & url)
+{
+ const OUString sKeyElement = getKeyElementName();
+ const OUString sPrefix = getNSPrefix();
+ ::rtl::OUStringBuffer sExpression(500);
+ sExpression.append(sPrefix);
+ sExpression.appendAscii(":");
+ sExpression.append(sKeyElement);
+ sExpression.append(OUSTR("[@url = \""));
+ sExpression.append(url);
+ sExpression.appendAscii("\"]");
+
+ removeElement(sExpression.makeStringAndClear());
+}
+
+Reference<css::xml::dom::XNode> BackendDb::getKeyElement(
+ ::rtl::OUString const & url)
+{
+ try
+ {
+ const OUString sPrefix = getNSPrefix();
+ const OUString sKeyElement = getKeyElementName();
+ ::rtl::OUStringBuffer sExpression(500);
+ sExpression.append(sPrefix);
+ sExpression.appendAscii(":");
+ sExpression.append(sKeyElement);
+ sExpression.append(OUSTR("[@url = \""));
+ sExpression.append(url);
+ sExpression.appendAscii("\"]");
+
+ const Reference<css::xml::dom::XDocument> doc = getDocument();
+ const Reference<css::xml::dom::XNode> root = doc->getFirstChild();
+ const Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
+ return xpathApi->selectSingleNode(root, sExpression.makeStringAndClear());
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to read key element in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+//Only writes the data if there is at least one entry
+void BackendDb::writeVectorOfPair(
+ ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > const & vecPairs,
+ OUString const & sVectorTagName,
+ OUString const & sPairTagName,
+ OUString const & sFirstTagName,
+ OUString const & sSecondTagName,
+ css::uno::Reference<css::xml::dom::XNode> const & xParent)
+{
+ try{
+ if (vecPairs.size() == 0)
+ return;
+ const OUString sNameSpace = getDbNSName();
+ OSL_ASSERT(sNameSpace.getLength());
+ const OUString sPrefix(getNSPrefix() + OUSTR(":"));
+ const Reference<css::xml::dom::XDocument> doc = getDocument();
+ const Reference<css::xml::dom::XNode> root = doc->getFirstChild();
+
+ const Reference<css::xml::dom::XElement> vectorNode(
+ doc->createElementNS(sNameSpace, sPrefix + sVectorTagName));
+
+ xParent->appendChild(
+ Reference<css::xml::dom::XNode>(
+ vectorNode, css::uno::UNO_QUERY_THROW));
+ typedef ::std::vector< ::std::pair< OUString, OUString > >::const_iterator CIT;
+ for (CIT i = vecPairs.begin(); i != vecPairs.end(); i++)
+ {
+ const Reference<css::xml::dom::XElement> pairNode(
+ doc->createElementNS(sNameSpace, sPrefix + sPairTagName));
+
+ vectorNode->appendChild(
+ Reference<css::xml::dom::XNode>(
+ pairNode, css::uno::UNO_QUERY_THROW));
+
+ const Reference<css::xml::dom::XElement> firstNode(
+ doc->createElementNS(sNameSpace, sPrefix + sFirstTagName));
+
+ pairNode->appendChild(
+ Reference<css::xml::dom::XNode>(
+ firstNode, css::uno::UNO_QUERY_THROW));
+
+ const Reference<css::xml::dom::XText> firstTextNode(
+ doc->createTextNode( i->first));
+
+ firstNode->appendChild(
+ Reference<css::xml::dom::XNode>(
+ firstTextNode, css::uno::UNO_QUERY_THROW));
+
+ const Reference<css::xml::dom::XElement> secondNode(
+ doc->createElementNS(sNameSpace, sPrefix + sSecondTagName));
+
+ pairNode->appendChild(
+ Reference<css::xml::dom::XNode>(
+ secondNode, css::uno::UNO_QUERY_THROW));
+
+ const Reference<css::xml::dom::XText> secondTextNode(
+ doc->createTextNode( i->second));
+
+ secondNode->appendChild(
+ Reference<css::xml::dom::XNode>(
+ secondTextNode, css::uno::UNO_QUERY_THROW));
+ }
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to write data entry in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+::std::vector< ::std::pair< OUString, OUString > >
+BackendDb::readVectorOfPair(
+ Reference<css::xml::dom::XNode> const & parent,
+ OUString const & sListTagName,
+ OUString const & sPairTagName,
+ OUString const & sFirstTagName,
+ OUString const & sSecondTagName)
+{
+ try
+ {
+ OSL_ASSERT(parent.is());
+ const OUString sPrefix(getNSPrefix() + OUSTR(":"));
+ const Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
+ const OUString sExprPairs(
+ sPrefix + sListTagName + OUSTR("/") + sPrefix + sPairTagName);
+ const Reference<css::xml::dom::XNodeList> listPairs =
+ xpathApi->selectNodeList(parent, sExprPairs);
+
+ ::std::vector< ::std::pair< OUString, OUString > > retVector;
+ sal_Int32 length = listPairs->getLength();
+ for (sal_Int32 i = 0; i < length; i++)
+ {
+ const Reference<css::xml::dom::XNode> aPair = listPairs->item(i);
+ const OUString sExprFirst(sPrefix + sFirstTagName + OUSTR("/text()"));
+ const Reference<css::xml::dom::XNode> first =
+ xpathApi->selectSingleNode(aPair, sExprFirst);
+
+ const OUString sExprSecond(sPrefix + sSecondTagName + OUSTR("/text()"));
+ const Reference<css::xml::dom::XNode> second =
+ xpathApi->selectSingleNode(aPair, sExprSecond);
+ OSL_ASSERT(first.is() && second.is());
+
+ retVector.push_back(::std::make_pair(
+ first->getNodeValue(), second->getNodeValue()));
+ }
+ return retVector;
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to read data entry in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+//Only writes the data if there is at least one entry
+void BackendDb::writeSimpleList(
+ ::std::list< ::rtl::OUString> const & list,
+ OUString const & sListTagName,
+ OUString const & sMemberTagName,
+ Reference<css::xml::dom::XNode> const & xParent)
+{
+ try
+ {
+ if (list.size() == 0)
+ return;
+ const OUString sNameSpace = getDbNSName();
+ const OUString sPrefix(getNSPrefix() + OUSTR(":"));
+ const Reference<css::xml::dom::XDocument> doc = getDocument();
+
+ const Reference<css::xml::dom::XElement> listNode(
+ doc->createElementNS(sNameSpace, sPrefix + sListTagName));
+
+ xParent->appendChild(
+ Reference<css::xml::dom::XNode>(
+ listNode, css::uno::UNO_QUERY_THROW));
+
+ typedef ::std::list<OUString>::const_iterator ITC_ITEMS;
+ for (ITC_ITEMS i = list.begin(); i != list.end(); i++)
+ {
+ const Reference<css::xml::dom::XNode> memberNode(
+ doc->createElementNS(sNameSpace, sPrefix + sMemberTagName), css::uno::UNO_QUERY_THROW);
+
+ listNode->appendChild(memberNode);
+
+ const Reference<css::xml::dom::XNode> textNode(
+ doc->createTextNode( *i), css::uno::UNO_QUERY_THROW);
+
+ memberNode->appendChild(textNode);
+ }
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to write data entry in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+//Writes only the element if is has a value.
+//The prefix is automatically added to the element name
+void BackendDb::writeSimpleElement(
+ OUString const & sElementName, OUString const & value,
+ Reference<css::xml::dom::XNode> const & xParent)
+{
+ try
+ {
+ if (value.getLength() == 0)
+ return;
+ const OUString sPrefix = getNSPrefix();
+ const Reference<css::xml::dom::XDocument> doc = getDocument();
+ const OUString sNameSpace = getDbNSName();
+ const Reference<css::xml::dom::XNode> dataNode(
+ doc->createElementNS(sNameSpace, sPrefix + OUSTR(":") + sElementName),
+ UNO_QUERY_THROW);
+ xParent->appendChild(dataNode);
+
+ const Reference<css::xml::dom::XNode> dataValue(
+ doc->createTextNode(value), UNO_QUERY_THROW);
+ dataNode->appendChild(dataValue);
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to write data entry(writeSimpleElement) in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+
+}
+
+/** The key elements have an url attribute and are always children of the root
+ element.
+*/
+Reference<css::xml::dom::XNode> BackendDb::writeKeyElement(
+ ::rtl::OUString const & url)
+{
+ try
+ {
+ const OUString sNameSpace = getDbNSName();
+ const OUString sPrefix = getNSPrefix();
+ const OUString sElementName = getKeyElementName();
+ const Reference<css::xml::dom::XDocument> doc = getDocument();
+ const Reference<css::xml::dom::XNode> root = doc->getFirstChild();
+
+ //Check if there are an entry with the same url. This can be the case if the
+ //the status of an XPackage is ambiguous. In this case a call to activateExtension
+ //(dp_extensionmanager.cxx), will register the package again. See also
+ //Package::processPackage_impl in dp_backend.cxx.
+ //A package can become
+ //invalid after its successful registration, for example if a second extension with
+ //the same service is installed.
+ const OUString sExpression(
+ sPrefix + OUSTR(":") + sElementName + OUSTR("[@url = \"") + url + OUSTR("\"]"));
+ const Reference<css::xml::dom::XNode> existingNode =
+ getXPathAPI()->selectSingleNode(root, sExpression);
+ if (existingNode.is())
+ {
+ OSL_ASSERT(0);
+ //replace the existing entry.
+ removeEntry(url);
+ }
+
+ const Reference<css::xml::dom::XElement> keyElement(
+ doc->createElementNS(sNameSpace, sPrefix + OUSTR(":") + sElementName));
+
+ keyElement->setAttribute(OUSTR("url"), url);
+
+ const Reference<css::xml::dom::XNode> keyNode(
+ keyElement, UNO_QUERY_THROW);
+ root->appendChild(keyNode);
+ return keyNode;
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to write key element in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+OUString BackendDb::readSimpleElement(
+ OUString const & sElementName, Reference<css::xml::dom::XNode> const & xParent)
+{
+ try
+ {
+ const OUString sPrefix = getNSPrefix();
+ const OUString sExpr(sPrefix + OUSTR(":") + sElementName + OUSTR("/text()"));
+ const Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
+ const Reference<css::xml::dom::XNode> val =
+ xpathApi->selectSingleNode(xParent, sExpr);
+ if (val.is())
+ return val->getNodeValue();
+ return OUString();
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to read data (readSimpleElement) in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+
+::std::list< OUString> BackendDb::readList(
+ Reference<css::xml::dom::XNode> const & parent,
+ OUString const & sListTagName,
+ OUString const & sMemberTagName)
+{
+ try
+ {
+ OSL_ASSERT(parent.is());
+ const OUString sPrefix(getNSPrefix() + OUSTR(":"));
+ const Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
+ const OUString sExprList(
+ sPrefix + sListTagName + OUSTR("/") + sPrefix + sMemberTagName + OUSTR("/text()"));
+ const Reference<css::xml::dom::XNodeList> list =
+ xpathApi->selectNodeList(parent, sExprList);
+
+ ::std::list<OUString > retList;
+ sal_Int32 length = list->getLength();
+ for (sal_Int32 i = 0; i < length; i++)
+ {
+ const Reference<css::xml::dom::XNode> member = list->item(i);
+ retList.push_back(member->getNodeValue());
+ }
+ return retList;
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to read data entry in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+::std::list<OUString> BackendDb::getOneChildFromAllEntries(
+ OUString const & name)
+{
+ try
+ {
+ ::std::list<OUString> listRet;
+ Reference<css::xml::dom::XDocument> doc = getDocument();
+ Reference<css::xml::dom::XNode> root = doc->getFirstChild();
+
+ Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
+ const OUString sPrefix = getNSPrefix();
+ const OUString sKeyElement = getKeyElementName();
+ ::rtl::OUStringBuffer buf(512);
+ buf.append(sPrefix);
+ buf.appendAscii(":");
+ buf.append(sKeyElement);
+ buf.appendAscii("/");
+ buf.append(sPrefix);
+ buf.appendAscii(":");
+ buf.append(name);
+ buf.append(OUSTR("/text()"));
+
+ Reference<css::xml::dom::XNodeList> nodes =
+ xpathApi->selectNodeList(root, buf.makeStringAndClear());
+ if (nodes.is())
+ {
+ sal_Int32 length = nodes->getLength();
+ for (sal_Int32 i = 0; i < length; i++)
+ listRet.push_back(nodes->item(i)->getNodeValue());
+ }
+ return listRet;
+ }
+ catch (css::deployment::DeploymentException& )
+ {
+ throw;
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to read data entry in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+
+
+//================================================================================
+RegisteredDb::RegisteredDb(
+ Reference<XComponentContext> const & xContext,
+ ::rtl::OUString const & url):BackendDb(xContext, url)
+{
+
+}
+
+void RegisteredDb::addEntry(::rtl::OUString const & url)
+{
+ try{
+
+ const OUString sNameSpace = getDbNSName();
+ const OUString sPrefix = getNSPrefix();
+ const OUString sEntry = getKeyElementName();
+
+ Reference<css::xml::dom::XDocument> doc = getDocument();
+ Reference<css::xml::dom::XNode> root = doc->getFirstChild();
+
+#if OSL_DEBUG_LEVEL > 0
+ //There must not be yet an entry with the same url
+ OUString sExpression(
+ sPrefix + OUSTR(":") + sEntry + OUSTR("[@url = \"") + url + OUSTR("\"]"));
+ Reference<css::xml::dom::XNode> _extensionNode =
+ getXPathAPI()->selectSingleNode(root, sExpression);
+ OSL_ASSERT(! _extensionNode.is());
+#endif
+ Reference<css::xml::dom::XElement> helpElement(
+ doc->createElementNS(sNameSpace, sPrefix + OUSTR(":") + sEntry));
+
+ helpElement->setAttribute(OUSTR("url"), url);
+
+ Reference<css::xml::dom::XNode> helpNode(
+ helpElement, UNO_QUERY_THROW);
+ root->appendChild(helpNode);
+
+ save();
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to write data entry in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+bool RegisteredDb::getEntry(::rtl::OUString const & url)
+{
+ try
+ {
+ const OUString sPrefix = getNSPrefix();
+ const OUString sEntry = getKeyElementName();
+ const OUString sExpression(
+ sPrefix + OUSTR(":") + sEntry + OUSTR("[@url = \"") + url + OUSTR("\"]"));
+ Reference<css::xml::dom::XDocument> doc = getDocument();
+ Reference<css::xml::dom::XNode> root = doc->getFirstChild();
+
+ Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
+ //find the extension element that is to be removed
+ Reference<css::xml::dom::XNode> aNode =
+ xpathApi->selectSingleNode(root, sExpression);
+ if (!aNode.is())
+ {
+ return false;
+ }
+ return true;
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to read data entry in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+
+} // namespace backend
+} // namespace dp_registry
+
diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx
index fa4fe53c09..643553ad92 100644
--- a/desktop/source/deployment/registry/dp_registry.cxx
+++ b/desktop/source/deployment/registry/dp_registry.cxx
@@ -114,7 +114,8 @@ protected:
virtual ~PackageRegistryImpl();
PackageRegistryImpl() : t_helper( getMutex() ) {}
-
+
+
public:
static Reference<deployment::XPackageRegistry> create(
OUString const & context,
@@ -126,8 +127,8 @@ public:
// XPackageRegistry
virtual Reference<deployment::XPackage> SAL_CALL bindPackage(
- OUString const & url, OUString const & mediaType,
- Reference<XCommandEnvironment> const & xCmdEnv )
+ OUString const & url, OUString const & mediaType, sal_Bool bRemoved,
+ OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv )
throw (deployment::DeploymentException, CommandFailedException,
lang::IllegalArgumentException, RuntimeException);
virtual Sequence< Reference<deployment::XPackageTypeInfo> > SAL_CALL
@@ -361,9 +362,24 @@ Reference<deployment::XPackageRegistry> PackageRegistryImpl::create(
// Always register as last, because we want to add extensions also as folders
// and as a default we accept every folder, which was not recognized by the other
// backends.
- that->insertBackend(
+ Reference<deployment::XPackageRegistry> extensionBackend =
::dp_registry::backend::bundle::create(
- that, context, cachePath, readOnly, xComponentContext ) );
+ that, context, cachePath, readOnly, xComponentContext);
+ that->insertBackend(extensionBackend);
+
+ Reference<lang::XServiceInfo> xServiceInfo(
+ extensionBackend, UNO_QUERY_THROW );
+
+ OSL_ASSERT(xServiceInfo.is());
+ OUString registryCachePath(
+ makeURL( cachePath,
+ ::rtl::Uri::encode(
+ xServiceInfo->getImplementationName(),
+ rtl_UriCharClassPchar,
+ rtl_UriEncodeIgnoreEscapes,
+ RTL_TEXTENCODING_UTF8 ) ) );
+ create_folder( 0, registryCachePath, Reference<XCommandEnvironment>());
+
#if OSL_DEBUG_LEVEL > 1
// dump tables:
@@ -443,8 +459,8 @@ void PackageRegistryImpl::update() throw (RuntimeException)
// XPackageRegistry
//______________________________________________________________________________
Reference<deployment::XPackage> PackageRegistryImpl::bindPackage(
- OUString const & url, OUString const & mediaType_,
- Reference<XCommandEnvironment> const & xCmdEnv )
+ OUString const & url, OUString const & mediaType_, sal_Bool bRemoved,
+ OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv )
throw (deployment::DeploymentException, CommandFailedException,
lang::IllegalArgumentException, RuntimeException)
{
@@ -482,7 +498,8 @@ Reference<deployment::XPackage> PackageRegistryImpl::bindPackage(
for ( ; iPos != iEnd; ++iPos )
{
try {
- return (*iPos)->bindPackage( url, mediaType, xCmdEnv );
+ return (*iPos)->bindPackage( url, mediaType, bRemoved,
+ identifier, xCmdEnv );
}
catch (lang::IllegalArgumentException &) {
}
@@ -511,7 +528,8 @@ Reference<deployment::XPackage> PackageRegistryImpl::bindPackage(
getResourceString(RID_STR_UNSUPPORTED_MEDIA_TYPE) + mediaType,
static_cast<OWeakObject *>(this), static_cast<sal_Int16>(-1) );
}
- return iFind->second->bindPackage( url, mediaType, xCmdEnv );
+ return iFind->second->bindPackage( url, mediaType, bRemoved,
+ identifier, xCmdEnv );
}
}
@@ -521,7 +539,6 @@ PackageRegistryImpl::getSupportedPackageTypes() throw (RuntimeException)
{
return comphelper::containerToSequence(m_typesInfos);
}
-
} // anon namespace
//==============================================================================
diff --git a/desktop/source/deployment/registry/executable/dp_executable.cxx b/desktop/source/deployment/registry/executable/dp_executable.cxx
index 92e76a3db7..cce2708502 100644
--- a/desktop/source/deployment/registry/executable/dp_executable.cxx
+++ b/desktop/source/deployment/registry/executable/dp_executable.cxx
@@ -28,6 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_desktop.hxx"
+#include "dp_misc.h"
#include "dp_backend.h"
#include "dp_ucb.h"
#include "dp_interact.h"
@@ -37,10 +38,12 @@
#include "comphelper/servicedecl.hxx"
#include "svl/inettype.hxx"
#include "cppuhelper/implbase1.hxx"
+#include "dp_executablebackenddb.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
+using namespace dp_misc;
using ::rtl::OUString;
namespace dp_registry {
@@ -62,19 +65,20 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
virtual void processPackage_(
::osl::ResettableMutexGuard & guard,
bool registerPackage,
+ bool startup,
::rtl::Reference<dp_misc::AbortChannel> const & abortChannel,
Reference<XCommandEnvironment> const & xCmdEnv );
bool getFileAttributes(sal_uInt64& out_Attributes);
bool isUrlTargetInExtension();
-
public:
inline ExecutablePackageImpl(
::rtl::Reference<PackageRegistryBackend> const & myBackend,
OUString const & url, OUString const & name,
- Reference<deployment::XPackageTypeInfo> const & xPackageType)
+ Reference<deployment::XPackageTypeInfo> const & xPackageType,
+ bool bRemoved, OUString const & identifier)
: Package( myBackend, url, name, name /* display-name */,
- xPackageType ) //,
+ xPackageType, bRemoved, identifier)
{}
};
friend class ExecutablePackageImpl;
@@ -84,11 +88,15 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
// PackageRegistryBackend
virtual Reference<deployment::XPackage> bindPackage_(
- OUString const & url, OUString const & mediaType,
- Reference<XCommandEnvironment> const & xCmdEnv );
-
+ OUString const & url, OUString const & mediaType, sal_Bool bRemoved,
+ OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv );
+
+ void addDataToDb(OUString const & url);
+ bool isRegisteredInDb(OUString const & url);
+ void deleteDataFromDb(OUString const & url);
+
Reference<deployment::XPackageTypeInfo> m_xExecutableTypeInfo;
-
+ std::auto_ptr<ExecutableBackendDb> m_backendDb;
public:
BackendImpl( Sequence<Any> const & args,
Reference<XComponentContext> const & xComponentContext );
@@ -112,7 +120,32 @@ BackendImpl::BackendImpl(
RID_IMG_COMPONENT,
RID_IMG_COMPONENT_HC ) )
{
-
+ if (!transientMode())
+ {
+ OUString dbFile = makeURL(getCachePath(), OUSTR("backenddb.xml"));
+ m_backendDb.reset(
+ new ExecutableBackendDb(getComponentContext(), dbFile));
+ }
+}
+
+void BackendImpl::addDataToDb(OUString const & url)
+{
+ if (m_backendDb.get())
+ m_backendDb->addEntry(url);
+}
+
+bool BackendImpl::isRegisteredInDb(OUString const & url)
+{
+ bool ret = false;
+ if (m_backendDb.get())
+ ret = m_backendDb->getEntry(url);
+ return ret;
+}
+
+void BackendImpl::deleteDataFromDb(OUString const & url)
+{
+ if (m_backendDb.get())
+ m_backendDb->removeEntry(url);
}
// XPackageRegistry
@@ -125,8 +158,8 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException)
// PackageRegistryBackend
Reference<deployment::XPackage> BackendImpl::bindPackage_(
- OUString const & url, OUString const & mediaType,
- Reference<XCommandEnvironment> const & xCmdEnv )
+ OUString const & url, OUString const & mediaType, sal_Bool bRemoved,
+ OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv )
{
if (mediaType.getLength() == 0)
{
@@ -141,13 +174,18 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
{
if (type.EqualsIgnoreCaseAscii("application"))
{
- ::ucbhelper::Content ucbContent( url, xCmdEnv );
- const OUString name( ucbContent.getPropertyValue(
- dp_misc::StrTitle::get() ).get<OUString>() );
+ OUString name;
+ if (!bRemoved)
+ {
+ ::ucbhelper::Content ucbContent( url, xCmdEnv );
+ name = ucbContent.getPropertyValue(
+ dp_misc::StrTitle::get() ).get<OUString>();
+ }
if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.executable"))
{
return new BackendImpl::ExecutablePackageImpl(
- this, url, name, m_xExecutableTypeInfo);
+ this, url, name, m_xExecutableTypeInfo, bRemoved,
+ identifier);
}
}
}
@@ -179,23 +217,17 @@ BackendImpl::ExecutablePackageImpl::isRegistered_(
::rtl::Reference<dp_misc::AbortChannel> const &,
Reference<XCommandEnvironment> const & )
{
- //We must return Optional.isPresent = true, otherwise
- //processPackage is not called.
- //The user shall not be able to enable/disable the executable. This is not needed since
- //the executable does not affect the office. The best thing is to show no
- //status at all. See also BackendImpl::PackageImpl::isRegistered_ (dp_package.cxx)
- //On Windows there is no executable file attribute. One has to use security API for this.
- //However, on Windows we do not have the problem, that after unzipping the file cannot be
- //executed.
+ bool registered = getMyBackend()->isRegisteredInDb(getURL());
return beans::Optional< beans::Ambiguous<sal_Bool> >(
sal_True /* IsPresent */,
beans::Ambiguous<sal_Bool>(
- sal_True, sal_True /* IsAmbiguous */ ) );
+ registered, sal_False /* IsAmbiguous */ ) );
}
void BackendImpl::ExecutablePackageImpl::processPackage_(
::osl::ResettableMutexGuard &,
bool doRegisterPackage,
+ bool /*startup*/,
::rtl::Reference<dp_misc::AbortChannel> const & abortChannel,
Reference<XCommandEnvironment> const & /*xCmdEnv*/ )
{
@@ -216,19 +248,27 @@ void BackendImpl::ExecutablePackageImpl::processPackage_(
else if (getMyBackend()->m_context.equals(OUSTR("shared")))
attributes |= (osl_File_Attribute_OwnExe | osl_File_Attribute_GrpExe
| osl_File_Attribute_OthExe);
- else
+ else if (!getMyBackend()->m_context.equals(OUSTR("bundled")))
+ //Bundled extension are required to be in the properly
+ //installed. That is an executable must have the right flags
OSL_ASSERT(0);
//This won't have affect on Windows
- if (osl::File::E_None != osl::File::setAttributes(
- dp_misc::expandUnoRcUrl(m_url), attributes))
- OSL_ENSURE(0, "Extension Manager: Could not set executable file attribute.");
+ osl::File::setAttributes(
+ dp_misc::expandUnoRcUrl(m_url), attributes);
}
+ getMyBackend()->addDataToDb(getURL());
+ }
+ else
+ {
+ getMyBackend()->deleteDataFromDb(getURL());
}
}
-//We currently cannot check if this XPackage represents a content of a particular exension
+//We currently cannot check if this XPackage represents a content of a particular extension
//But we can check if we are within $UNO_USER_PACKAGES_CACHE etc.
+//Done for security reasons. For example an extension manifest could contain a path to
+//an executable outside the extension.
bool BackendImpl::ExecutablePackageImpl::isUrlTargetInExtension()
{
bool bSuccess = false;
@@ -237,6 +277,8 @@ bool BackendImpl::ExecutablePackageImpl::isUrlTargetInExtension()
sExtensionDir = dp_misc::expandUnoRcTerm(OUSTR("$UNO_USER_PACKAGES_CACHE"));
else if (getMyBackend()->m_context.equals(OUSTR("shared")))
sExtensionDir = dp_misc::expandUnoRcTerm(OUSTR("$UNO_SHARED_PACKAGES_CACHE"));
+ else if (getMyBackend()->m_context.equals(OUSTR("bundled")))
+ sExtensionDir = dp_misc::expandUnoRcTerm(OUSTR("$BUNDLED_EXTENSIONS"));
else
OSL_ASSERT(0);
//remove file ellipses
diff --git a/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx b/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx
new file mode 100644
index 0000000000..90f0384067
--- /dev/null
+++ b/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dp_package.cxx,v $
+ * $Revision: 1.34.16.2 $
+ *
+ * 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_desktop.hxx"
+
+#include "rtl/string.h"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "dp_misc.h"
+#include "dp_executablebackenddb.hxx"
+
+
+namespace css = ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+#define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/executable-registry/2010"
+#define NS_PREFIX "exe"
+#define ROOT_ELEMENT_NAME "executable-backend-db"
+#define ENTRY_NAME "executable"
+
+namespace dp_registry {
+namespace backend {
+namespace executable {
+
+ExecutableBackendDb::ExecutableBackendDb(
+ Reference<XComponentContext> const & xContext,
+ ::rtl::OUString const & url):RegisteredDb(xContext, url)
+{
+
+}
+
+OUString ExecutableBackendDb::getDbNSName()
+{
+ return OUSTR(EXTENSION_REG_NS);
+}
+
+OUString ExecutableBackendDb::getNSPrefix()
+{
+ return OUSTR(NS_PREFIX);
+}
+
+OUString ExecutableBackendDb::getRootElementName()
+{
+ return OUSTR(ROOT_ELEMENT_NAME);
+}
+
+OUString ExecutableBackendDb::getKeyElementName()
+{
+ return OUSTR(ENTRY_NAME);
+}
+
+
+} // namespace executable
+} // namespace backend
+} // namespace dp_registry
+
diff --git a/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx b/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx
new file mode 100644
index 0000000000..29f8f89dd6
--- /dev/null
+++ b/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dp_backend.h,v $
+ * $Revision: 1.18 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#if ! defined INCLUDED_DP_EXECUTABLEBACKENDDB_HXX
+#define INCLUDED_DP_EXECUTABLEBACKENDDB_HXX
+
+#include "rtl/ustring.hxx"
+#include "dp_backenddb.hxx"
+
+namespace css = ::com::sun::star;
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class XComponentContext;
+ }
+}}}
+
+namespace dp_registry {
+namespace backend {
+namespace executable {
+
+/* The XML file stores the extensions which are currently registered.
+ They will be removed when they are revoked.
+ The format looks like this:
+
+<?xml version="1.0"?>
+ */
+class ExecutableBackendDb: public dp_registry::backend::RegisteredDb
+{
+protected:
+ virtual ::rtl::OUString getDbNSName();
+
+ virtual ::rtl::OUString getNSPrefix();
+
+ virtual ::rtl::OUString getRootElementName();
+
+ virtual ::rtl::OUString getKeyElementName();
+
+public:
+
+ ExecutableBackendDb( css::uno::Reference<css::uno::XComponentContext> const & xContext,
+ ::rtl::OUString const & url);
+
+};
+
+
+
+}
+}
+}
+#endif
+
diff --git a/desktop/source/deployment/registry/executable/makefile.mk b/desktop/source/deployment/registry/executable/makefile.mk
index 1e57f5ecf3..81b2baa44e 100644
--- a/desktop/source/deployment/registry/executable/makefile.mk
+++ b/desktop/source/deployment/registry/executable/makefile.mk
@@ -36,7 +36,8 @@ ENABLE_EXCEPTIONS = TRUE
INCPRE += ..$/..$/inc
SLOFILES = \
- $(SLO)$/dp_executable.obj
+ $(SLO)$/dp_executable.obj \
+ $(SLO)$/dp_executablebackenddb.obj
.INCLUDE : ..$/..$/target.pmk
.INCLUDE : target.mk
diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx
index ca94a30221..60dd5c414e 100644
--- a/desktop/source/deployment/registry/help/dp_help.cxx
+++ b/desktop/source/deployment/registry/help/dp_help.cxx
@@ -30,9 +30,11 @@
#include "dp_help.hrc"
#include "dp_backend.h"
+#include "dp_helpbackenddb.hxx"
#include "dp_ucb.h"
#include "rtl/uri.hxx"
#include "osl/file.hxx"
+#include "rtl/bootstrap.hxx"
#include "ucbhelper/content.hxx"
#include "comphelper/servicedecl.hxx"
#include "svl/inettype.hxx"
@@ -44,6 +46,7 @@
#include <com/sun/star/uri/XUriReferenceFactory.hpp>
#include <com/sun/star/uri/XVndSunStarExpandUrl.hpp>
#include <com/sun/star/script/XInvocation.hpp>
+#include "boost/optional.hpp"
using namespace ::dp_misc;
using namespace ::com::sun::star;
@@ -62,6 +65,8 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
class PackageImpl : public ::dp_registry::backend::Package
{
BackendImpl * getMyBackend() const;
+
+// HelpBackendDb::Data m_dbData;
// Package
virtual beans::Optional< beans::Ambiguous<sal_Bool> > isRegistered_(
@@ -71,36 +76,44 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
virtual void processPackage_(
::osl::ResettableMutexGuard & guard,
bool registerPackage,
+ bool startup,
::rtl::Reference<AbortChannel> const & abortChannel,
Reference<XCommandEnvironment> const & xCmdEnv );
public:
- inline PackageImpl(
+ PackageImpl(
::rtl::Reference<PackageRegistryBackend> const & myBackend,
OUString const & url, OUString const & name,
- Reference<deployment::XPackageTypeInfo> const & xPackageType )
- : Package( myBackend, url, name, name, xPackageType )
- {}
+ Reference<deployment::XPackageTypeInfo> const & xPackageType,
+ bool bRemoved, OUString const & identifier);
+
+ //XPackage
+ virtual css::beans::Optional< ::rtl::OUString > SAL_CALL getRegistrationDataURL()
+ throw (deployment::ExtensionRemovedException, css::uno::RuntimeException);
};
friend class PackageImpl;
// PackageRegistryBackend
virtual Reference<deployment::XPackage> bindPackage_(
OUString const & url, OUString const & mediaType,
+ sal_Bool bRemoved, OUString const & identifier,
Reference<XCommandEnvironment> const & xCmdEnv );
- void implProcessHelp( Reference< deployment::XPackage > xPackage, bool doRegisterPackage );
+ void implProcessHelp( Reference< deployment::XPackage > xPackage, bool doRegisterPackage,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv);
void implCollectXhpFiles( const rtl::OUString& aDir,
std::vector< rtl::OUString >& o_rXhpFileVector );
- rtl::OUString getFlagFileURL( Reference< deployment::XPackage > xPackage, const char* pFlagStr );
- rtl::OUString getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage );
- rtl::OUString getCompiledFlagFileURL( Reference< deployment::XPackage > xPackage );
- rtl::OUString expandURL( const rtl::OUString& aURL );
+
+ void addDataToDb(OUString const & url, HelpBackendDb::Data const & data);
+ ::boost::optional<HelpBackendDb::Data> readDataFromDb(OUString const & url);
+ void deleteDataFromDb(OUString const & url);
+
Reference< ucb::XSimpleFileAccess > getFileAccess( void );
Reference< ucb::XSimpleFileAccess > m_xSFA;
const Reference<deployment::XPackageTypeInfo> m_xHelpTypeInfo;
Sequence< Reference<deployment::XPackageTypeInfo> > m_typeInfos;
+ std::auto_ptr<HelpBackendDb> m_backendDb;
public:
BackendImpl( Sequence<Any> const & args,
@@ -124,6 +137,20 @@ BackendImpl::BackendImpl(
m_typeInfos( 1 )
{
m_typeInfos[ 0 ] = m_xHelpTypeInfo;
+ if (!transientMode())
+ {
+ OUString dbFile = makeURL(getCachePath(), OUSTR("backenddb.xml"));
+ m_backendDb.reset(
+ new HelpBackendDb(getComponentContext(), dbFile));
+
+ //clean up data folders which are no longer used.
+ //This must not be done in the same process where the help files
+ //are still registers. Only after revoking and restarting OOo the folders
+ //can be removed. This works now, because the extension manager is a singleton
+ //and the backends are only create once per process.
+ ::std::list<OUString> folders = m_backendDb->getAllDataUrls();
+ deleteUnusedFolders(OUString(), folders);
+ }
}
// XPackageRegistry
@@ -138,6 +165,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException)
//______________________________________________________________________________
Reference<deployment::XPackage> BackendImpl::bindPackage_(
OUString const & url, OUString const & mediaType_,
+ sal_Bool bRemoved, OUString const & identifier,
Reference<XCommandEnvironment> const & xCmdEnv )
{
// we don't support auto detection:
@@ -152,12 +180,20 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
{
if (type.EqualsIgnoreCaseAscii("application"))
{
- ::ucbhelper::Content ucbContent( url, xCmdEnv );
+ OUString name;
+ if (!bRemoved)
+ {
+ ::ucbhelper::Content ucbContent( url, xCmdEnv );
+ name = ucbContent.getPropertyValue(
+ StrTitle::get() ).get<OUString>();
+ }
+
if (subType.EqualsIgnoreCaseAscii(
"vnd.sun.star.help"))
{
- return new PackageImpl( this, url,
- ucbContent.getPropertyValue( StrTitle::get() ).get<OUString>(), m_xHelpTypeInfo );
+ return new PackageImpl(
+ this, url, name, m_xHelpTypeInfo, bRemoved,
+ identifier);
}
}
}
@@ -167,8 +203,45 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
static_cast<sal_Int16>(-1) );
}
+void BackendImpl::addDataToDb(
+ OUString const & url, HelpBackendDb::Data const & data)
+{
+ if (m_backendDb.get())
+ m_backendDb->addEntry(url, data);
+}
+
+::boost::optional<HelpBackendDb::Data> BackendImpl::readDataFromDb(
+ OUString const & url)
+{
+ ::boost::optional<HelpBackendDb::Data> data;
+ if (m_backendDb.get())
+ data = m_backendDb->getEntry(url);
+ return data;
+}
+
+void BackendImpl::deleteDataFromDb(OUString const & url)
+{
+ if (m_backendDb.get())
+ m_backendDb->removeEntry(url);
+}
//##############################################################################
+BackendImpl::PackageImpl::PackageImpl(
+ ::rtl::Reference<PackageRegistryBackend> const & myBackend,
+ OUString const & url, OUString const & name,
+ Reference<deployment::XPackageTypeInfo> const & xPackageType,
+ bool bRemoved, OUString const & identifier)
+ : Package( myBackend, url, name, name, xPackageType, bRemoved,
+ identifier)
+{
+// if (bRemoved)
+// {
+// ::boost::optional<HelpBackendDb::Data> opt =
+// getMyBackend()->readDataFromDb(url);
+// if (opt)
+// m_dbData = *opt;
+// }
+}
// Package
BackendImpl * BackendImpl::PackageImpl::getMyBackend() const
@@ -194,11 +267,10 @@ BackendImpl::PackageImpl::isRegistered_(
Reference<XCommandEnvironment> const & )
{
BackendImpl * that = getMyBackend();
- Reference< deployment::XPackage > xThisPackage( this );
- rtl::OUString aRegisteredFlagFile = that->getRegisteredFlagFileURL( xThisPackage );
- Reference< ucb::XSimpleFileAccess > xSFA = that->getFileAccess();
- bool bReg = xSFA->exists( aRegisteredFlagFile );
+ bool bReg = false;
+ if (that->readDataFromDb(getURL()))
+ bReg = true;
return beans::Optional< beans::Ambiguous<sal_Bool> >( true, beans::Ambiguous<sal_Bool>( bReg, false ) );
}
@@ -207,6 +279,7 @@ BackendImpl::PackageImpl::isRegistered_(
void BackendImpl::PackageImpl::processPackage_(
::osl::ResettableMutexGuard &,
bool doRegisterPackage,
+ bool /* startup */,
::rtl::Reference<AbortChannel> const & abortChannel,
Reference<XCommandEnvironment> const & xCmdEnv )
{
@@ -216,39 +289,46 @@ void BackendImpl::PackageImpl::processPackage_(
BackendImpl* that = getMyBackend();
Reference< deployment::XPackage > xThisPackage( this );
- that->implProcessHelp( xThisPackage, doRegisterPackage );
+ that->implProcessHelp( xThisPackage, doRegisterPackage, xCmdEnv);
}
+beans::Optional< OUString > BackendImpl::PackageImpl::getRegistrationDataURL()
+ throw (deployment::ExtensionRemovedException,
+ css::uno::RuntimeException)
+{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
+
+ ::boost::optional<HelpBackendDb::Data> data =
+ getMyBackend()->readDataFromDb(getURL());
+
+ if (data)
+ return beans::Optional<OUString>(true, data->dataUrl);
+
+ return beans::Optional<OUString>(true, OUString());
+}
+
+
//##############################################################################
static rtl::OUString aSlash( rtl::OUString::createFromAscii( "/" ) );
static rtl::OUString aHelpStr( rtl::OUString::createFromAscii( "help" ) );
+
void BackendImpl::implProcessHelp
- ( Reference< deployment::XPackage > xPackage, bool doRegisterPackage )
+( Reference< deployment::XPackage > xPackage, bool doRegisterPackage,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv)
{
- if( !xPackage.is() )
- return;
-
- Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess();
-
- rtl::OUString aRegisteredFlagFile = getRegisteredFlagFileURL( xPackage );
- if( !doRegisterPackage )
+ OSL_ASSERT(xPackage.is());
+ if (doRegisterPackage)
{
- if( xSFA->exists( aRegisteredFlagFile ) )
- xSFA->kill( aRegisteredFlagFile );
- return;
- }
-
- bool bCompile = true;
- rtl::OUString aCompiledFlagFile = getCompiledFlagFileURL( xPackage );
- if( xSFA->exists( aCompiledFlagFile ) )
- bCompile = false;
+ HelpBackendDb::Data data;
+ const OUString sHelpFolder = createFolder(OUString(), xCmdEnv);
+ data.dataUrl = sHelpFolder;
- if( bCompile )
- {
+ Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess();
rtl::OUString aHelpURL = xPackage->getURL();
- rtl::OUString aExpandedHelpURL = expandURL( aHelpURL );
+ rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl( aHelpURL );
rtl::OUString aName = xPackage->getName();
if( !xSFA->isFolder( aExpandedHelpURL ) )
{
@@ -256,7 +336,7 @@ void BackendImpl::implProcessHelp
aErrStr += rtl::OUString::createFromAscii( "No help folder" );
OWeakObject* oWeakThis = static_cast<OWeakObject *>(this);
throw deployment::DeploymentException( rtl::OUString(), oWeakThis,
- makeAny( uno::Exception( aErrStr, oWeakThis ) ) );
+ makeAny( uno::Exception( aErrStr, oWeakThis ) ) );
}
Reference<XComponentContext> const & xContext = getComponentContext();
@@ -267,7 +347,7 @@ void BackendImpl::implProcessHelp
{
xInvocation = Reference< script::XInvocation >(
xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii(
- "com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY );
+ "com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY );
}
catch (Exception &)
{
@@ -286,34 +366,30 @@ void BackendImpl::implProcessHelp
{
std::vector< rtl::OUString > aXhpFileVector;
- // Delete (old) files in any case to allow compiler to be started every time
- rtl::OUString aLangWithPureNameURL( aLangURL );
- aLangWithPureNameURL += aSlash;
- aLangWithPureNameURL += aHelpStr;
- rtl::OUString aDbFile( aLangWithPureNameURL );
- aDbFile += rtl::OUString::createFromAscii( ".db" );
- if( xSFA->exists( aDbFile ) )
- xSFA->kill( aDbFile );
- rtl::OUString aHtFile( aLangWithPureNameURL );
- aHtFile += rtl::OUString::createFromAscii( ".ht" );
- if( xSFA->exists( aHtFile ) )
- xSFA->kill( aHtFile );
- rtl::OUString aKeyFile( aLangWithPureNameURL );
- aKeyFile += rtl::OUString::createFromAscii( ".key" );
- if( xSFA->exists( aKeyFile ) )
- xSFA->kill( aKeyFile );
-
// calculate jar file URL
- rtl::OUString aJarFile( aLangURL );
- aJarFile += aSlash;
- aJarFile += aHelpStr;
- aJarFile += rtl::OUString::createFromAscii( ".jar" );
- // remove in any case to clean up
- if( xSFA->exists( aJarFile ) )
- xSFA->kill( aJarFile );
-
- rtl::OUString aEncodedJarFilePath = rtl::Uri::encode( aJarFile,
- rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 );
+ sal_Int32 indexStartSegment = aLangURL.lastIndexOf('/');
+ // for example "/en"
+ OUString langFolderURLSegment(
+ aLangURL.copy(
+ indexStartSegment + 1, aLangURL.getLength() - indexStartSegment - 1));
+
+ //create the folder in the "temporary folder"
+ ::ucbhelper::Content langFolderContent;
+ const OUString langFolderDest = makeURL(sHelpFolder, langFolderURLSegment);
+ const OUString langFolderDestExpanded = ::dp_misc::expandUnoRcUrl(langFolderDest);
+ ::dp_misc::create_folder(
+ &langFolderContent,
+ langFolderDest, xCmdEnv);
+
+ rtl::OUString aJarFile(
+ makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr +
+ OUSTR(".jar")));
+ aJarFile = ::dp_misc::expandUnoRcUrl(aJarFile);
+
+ rtl::OUString aEncodedJarFilePath = rtl::Uri::encode(
+ aJarFile, rtl_UriCharClassPchar,
+ rtl_UriEncodeIgnoreEscapes,
+ RTL_TEXTENCODING_UTF8 );
rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" );
aDestBasePath += aEncodedJarFilePath;
aDestBasePath += rtl::OUString::createFromAscii( "/" );
@@ -353,8 +429,10 @@ void BackendImpl::implProcessHelp
::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL );
HelpProcessingErrorInfo aErrorInfo;
- bool bSuccess = compileExtensionHelp( aOfficeHelpPathFileURL, aHelpStr, aLangURL,
- nXhpFileCount, pXhpFiles, aErrorInfo );
+ bool bSuccess = compileExtensionHelp(
+ aOfficeHelpPathFileURL, aHelpStr, aLangURL,
+ nXhpFileCount, pXhpFiles,
+ langFolderDestExpanded, aErrorInfo );
if( bSuccess && xInvocation.is() )
{
@@ -375,13 +453,14 @@ void BackendImpl::implProcessHelp
aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) );
rtl::OUString aSystemPath;
- osl::FileBase::getSystemPathFromFileURL( aLangURL, aSystemPath );
+ osl::FileBase::getSystemPathFromFileURL(
+ langFolderDestExpanded, aSystemPath );
aParamsSeq[5] = uno::makeAny( aSystemPath );
Sequence< sal_Int16 > aOutParamIndex;
Sequence< uno::Any > aOutParam;
uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ),
- aParamsSeq, aOutParamIndex, aOutParam );
+ aParamsSeq, aOutParamIndex, aOutParam );
}
if( !bSuccess )
@@ -389,10 +468,10 @@ void BackendImpl::implProcessHelp
USHORT nErrStrId = 0;
switch( aErrorInfo.m_eErrorClass )
{
- case HELPPROCESSING_GENERAL_ERROR:
- case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break;
- case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break;
- default: ;
+ case HELPPROCESSING_GENERAL_ERROR:
+ case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break;
+ case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break;
+ default: ;
};
rtl::OUString aErrStr;
@@ -423,7 +502,7 @@ void BackendImpl::implProcessHelp
aErrStr += rtl::OUString::createFromAscii( " in " );
rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile,
- rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
+ rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
aErrStr += aDecodedFile;
if( aErrorInfo.m_nXMLParsingLine != -1 )
{
@@ -435,96 +514,21 @@ void BackendImpl::implProcessHelp
OWeakObject* oWeakThis = static_cast<OWeakObject *>(this);
throw deployment::DeploymentException( rtl::OUString(), oWeakThis,
- makeAny( uno::Exception( aErrStr, oWeakThis ) ) );
+ makeAny( uno::Exception( aErrStr, oWeakThis ) ) );
}
}
}
- // Write compiled flag file (this code is only reached in case of success)
- Reference< io::XOutputStream > xOutputStream = xSFA->openFileWrite( aCompiledFlagFile );
- if( xOutputStream.is() )
- xOutputStream->closeOutput();
-
- } // if( bCompile )
-
- // Write registered flag file (this code is only reached in case of success)
- if( !xSFA->exists( aRegisteredFlagFile ) )
+ //Writing the data entry replaces writing the flag file. If we got to this
+ //point the registration was successful.
+ addDataToDb(xPackage->getURL(), data);
+ }
+ else
{
- Reference< io::XOutputStream > xOutputStream = xSFA->openFileWrite( aRegisteredFlagFile );
- if( xOutputStream.is() )
- xOutputStream->closeOutput();
+ deleteDataFromDb(xPackage->getURL());
}
}
-rtl::OUString BackendImpl::getFlagFileURL( Reference< deployment::XPackage > xPackage, const char* pFlagStr )
-{
- rtl::OUString aRetURL;
- if( !xPackage.is() )
- return aRetURL;
- rtl::OUString aHelpURL = xPackage->getURL();
- aRetURL = expandURL( aHelpURL );
- aRetURL += rtl::OUString::createFromAscii( pFlagStr );
- return aRetURL;
-}
-
-rtl::OUString BackendImpl::getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage )
-{
- return getFlagFileURL( xPackage, "/RegisteredFlag" );
-}
-
-rtl::OUString BackendImpl::getCompiledFlagFileURL( Reference< deployment::XPackage > xPackage )
-{
- return getFlagFileURL( xPackage, "/CompiledFlag" );
-}
-
-rtl::OUString BackendImpl::expandURL( const rtl::OUString& aURL )
-{
- static Reference< util::XMacroExpander > xMacroExpander;
- static Reference< uri::XUriReferenceFactory > xFac;
-
- if( !xMacroExpander.is() || !xFac.is() )
- {
- Reference<XComponentContext> const & xContext = getComponentContext();
- if( xContext.is() )
- {
- xFac = Reference< uri::XUriReferenceFactory >(
- xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii(
- "com.sun.star.uri.UriReferenceFactory"), xContext ) , UNO_QUERY );
- }
- if( !xFac.is() )
- {
- throw RuntimeException(
- ::rtl::OUString::createFromAscii(
- "dp_registry::backend::help::BackendImpl::expandURL(), "
- "could not instatiate UriReferenceFactory." ),
- Reference< XInterface >() );
- }
-
- xMacroExpander = Reference< util::XMacroExpander >(
- xContext->getValueByName(
- ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.util.theMacroExpander" ) ),
- UNO_QUERY_THROW );
- }
-
- rtl::OUString aRetURL = aURL;
- if( xMacroExpander.is() )
- {
- Reference< uri::XUriReference > uriRef;
- for (;;)
- {
- uriRef = Reference< uri::XUriReference >( xFac->parse( aRetURL ), UNO_QUERY );
- if ( uriRef.is() )
- {
- Reference < uri::XVndSunStarExpandUrl > sxUri( uriRef, UNO_QUERY );
- if( !sxUri.is() )
- break;
-
- aRetURL = sxUri->expand( xMacroExpander );
- }
- }
- }
- return aRetURL;
-}
void BackendImpl::implCollectXhpFiles( const rtl::OUString& aDir,
std::vector< rtl::OUString >& o_rXhpFileVector )
diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx
new file mode 100644
index 0000000000..cadddf82ec
--- /dev/null
+++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dp_package.cxx,v $
+ * $Revision: 1.34.16.2 $
+ *
+ * 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_desktop.hxx"
+
+#include "rtl/string.h"
+#include "rtl/bootstrap.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
+#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
+#include "dp_misc.h"
+
+#include "dp_helpbackenddb.hxx"
+
+
+namespace css = ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+#define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/help-registry/2010"
+#define NS_PREFIX "help"
+#define ROOT_ELEMENT_NAME "help-backend-db"
+#define KEY_ELEMENT_NAME "help"
+
+namespace dp_registry {
+namespace backend {
+namespace help {
+
+HelpBackendDb::HelpBackendDb(
+ Reference<XComponentContext> const & xContext,
+ ::rtl::OUString const & url):BackendDb(xContext, url)
+{
+
+}
+
+OUString HelpBackendDb::getDbNSName()
+{
+ return OUSTR(EXTENSION_REG_NS);
+}
+
+OUString HelpBackendDb::getNSPrefix()
+{
+ return OUSTR(NS_PREFIX);
+}
+
+OUString HelpBackendDb::getRootElementName()
+{
+ return OUSTR(ROOT_ELEMENT_NAME);
+}
+
+OUString HelpBackendDb::getKeyElementName()
+{
+ return OUSTR(KEY_ELEMENT_NAME);
+}
+
+
+void HelpBackendDb::addEntry(::rtl::OUString const & url, Data const & data)
+{
+ try{
+ Reference<css::xml::dom::XNode> helpNode
+ = writeKeyElement(url);
+
+ writeSimpleElement(OUSTR("data-url"), data.dataUrl, helpNode);
+ save();
+ }
+ catch (css::deployment::DeploymentException& )
+ {
+ throw;
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to write data entry in help backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+
+::boost::optional<HelpBackendDb::Data>
+HelpBackendDb::getEntry(::rtl::OUString const & url)
+{
+ try
+ {
+ HelpBackendDb::Data retData;
+ Reference<css::xml::dom::XNode> aNode = getKeyElement(url);
+ if (aNode.is())
+ {
+ retData.dataUrl = readSimpleElement(OUSTR("data-url"), aNode);
+ }
+ else
+ {
+ return ::boost::optional<Data>();
+ }
+ return ::boost::optional<Data>(retData);
+ }
+ catch (css::deployment::DeploymentException& )
+ {
+ throw;
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to read data entry in help backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+::std::list<OUString> HelpBackendDb::getAllDataUrls()
+{
+ try
+ {
+ ::std::list<OUString> listRet;
+ Reference<css::xml::dom::XDocument> doc = getDocument();
+ Reference<css::xml::dom::XNode> root = doc->getFirstChild();
+
+ Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
+ const OUString sPrefix = getNSPrefix();
+ OUString sExpression(
+ sPrefix + OUSTR(":help/") + sPrefix + OUSTR(":data-url/text()"));
+ Reference<css::xml::dom::XNodeList> nodes =
+ xpathApi->selectNodeList(root, sExpression);
+ if (nodes.is())
+ {
+ sal_Int32 length = nodes->getLength();
+ for (sal_Int32 i = 0; i < length; i++)
+ listRet.push_back(nodes->item(i)->getNodeValue());
+ }
+ return listRet;
+ }
+ catch (css::deployment::DeploymentException& )
+ {
+ throw;
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to read data entry in help backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+
+} // namespace help
+} // namespace backend
+} // namespace dp_registry
+
diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx
new file mode 100644
index 0000000000..a0468767fe
--- /dev/null
+++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dp_backend.h,v $
+ * $Revision: 1.18 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#if ! defined INCLUDED_DP_HELPBACKENDDB_HXX
+#define INCLUDED_DP_HELPBACKENDDB_HXX
+
+#include "rtl/ustring.hxx"
+#include <list>
+#include "boost/optional.hpp"
+#include "dp_backenddb.hxx"
+
+namespace css = ::com::sun::star;
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class XComponentContext;
+ }
+}}}
+
+namespace dp_registry {
+namespace backend {
+namespace help {
+
+/* The XML file stores the extensions which are currently registered.
+ They will be removed when they are revoked.
+ */
+class HelpBackendDb: public dp_registry::backend::BackendDb
+{
+protected:
+ virtual ::rtl::OUString getDbNSName();
+
+ virtual ::rtl::OUString getNSPrefix();
+
+ virtual ::rtl::OUString getRootElementName();
+
+ virtual ::rtl::OUString getKeyElementName();
+
+public:
+ struct Data
+ {
+ /* the URL to the folder containing the compiled help files, etc.
+ */
+ ::rtl::OUString dataUrl;
+
+ };
+
+public:
+
+ HelpBackendDb( css::uno::Reference<css::uno::XComponentContext> const & xContext,
+ ::rtl::OUString const & url);
+
+ void addEntry(::rtl::OUString const & url, Data const & data);
+
+ ::boost::optional<Data> getEntry(::rtl::OUString const & url);
+ ::std::list< ::rtl::OUString> getAllDataUrls();
+
+};
+
+
+
+}
+}
+}
+#endif
+
diff --git a/desktop/source/deployment/registry/help/makefile.mk b/desktop/source/deployment/registry/help/makefile.mk
index ba904bb7f2..d4934f71a4 100644
--- a/desktop/source/deployment/registry/help/makefile.mk
+++ b/desktop/source/deployment/registry/help/makefile.mk
@@ -44,7 +44,8 @@ SRC1FILES = \
dp_help.src
SLOFILES = \
- $(SLO)$/dp_help.obj
+ $(SLO)$/dp_help.obj \
+ $(SLO)$/dp_helpbackenddb.obj
.INCLUDE : ..$/..$/target.pmk
.INCLUDE : target.mk
diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h
index 9395922676..624b5fcf16 100644
--- a/desktop/source/deployment/registry/inc/dp_backend.h
+++ b/desktop/source/deployment/registry/inc/dp_backend.h
@@ -40,8 +40,10 @@
#include "com/sun/star/lang/XEventListener.hpp"
#include "com/sun/star/deployment/XPackageRegistry.hpp"
#include "com/sun/star/deployment/XPackageManager.hpp"
+#include "com/sun/star/deployment/InvalidRemovedParameterException.hpp"
#include <memory>
#include <hash_map>
+#include <list>
#include "dp_registry.hrc"
namespace dp_registry
@@ -62,8 +64,10 @@ typedef ::cppu::WeakComponentImplHelper1<
//==============================================================================
class Package : protected ::dp_misc::MutexHolder, public t_PackageBase
{
+ PackageRegistryBackend * getMyBackend() const;
void processPackage_impl(
bool registerPackage,
+ bool startup,
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv );
@@ -73,6 +77,9 @@ protected:
::rtl::OUString m_name;
::rtl::OUString m_displayName;
const css::uno::Reference<css::deployment::XPackageTypeInfo> m_xPackageType;
+ const bool m_bRemoved;
+ //Only set if m_bRemoved = true;
+ const ::rtl::OUString m_identifier;
void check() const;
void fireModified();
@@ -91,6 +98,7 @@ protected:
virtual void processPackage_(
::osl::ResettableMutexGuard & guard,
bool registerPackage,
+ bool startup,
::rtl::Reference< ::dp_misc::AbortChannel > const & abortChannel,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
= 0;
@@ -101,7 +109,9 @@ protected:
::rtl::OUString const & name,
::rtl::OUString const & displayName,
css::uno::Reference<css::deployment::XPackageTypeInfo> const &
- xPackageType );
+ xPackageType,
+ bool bRemoved,
+ ::rtl::OUString const & identifier);
public:
@@ -126,9 +136,11 @@ public:
virtual ::rtl::OUString SAL_CALL getMediaType()
throw (css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getDescription()
- throw (css::uno::RuntimeException);
+ throw (css::deployment::ExtensionRemovedException,
+ css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getShortDescription()
- throw (css::uno::RuntimeException);
+ throw (css::deployment::ExtensionRemovedException,
+ css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getFileFilter()
throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL getIcon( sal_Bool highContrast,
@@ -165,25 +177,29 @@ public:
css::ucb::CommandAbortedException,
css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL checkPrerequisites(
+ virtual ::sal_Int32 SAL_CALL checkPrerequisites(
const css::uno::Reference< css::task::XAbortChannel >& xAbortChannel,
const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv,
- sal_Bool bInstalled, ::rtl::OUString const & aContextName)
- throw (css::deployment::DeploymentException,
- css::ucb::CommandFailedException,
- css::ucb::CommandAbortedException,
- css::uno::RuntimeException);
+ sal_Bool noLicenseChecking)
+ throw (css::deployment::DeploymentException,
+ css::deployment::ExtensionRemovedException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL checkDependencies(
const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv )
- throw (css::deployment::DeploymentException,
- css::ucb::CommandFailedException,
- css::uno::RuntimeException);
+ throw (css::deployment::DeploymentException,
+ css::deployment::ExtensionRemovedException,
+ css::ucb::CommandFailedException,
+ css::uno::RuntimeException);
virtual void SAL_CALL registerPackage(
+ sal_Bool startup,
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
throw (css::deployment::DeploymentException,
+ css::deployment::ExtensionRemovedException,
css::ucb::CommandFailedException,
css::ucb::CommandAbortedException,
css::lang::IllegalArgumentException, css::uno::RuntimeException);
@@ -211,19 +227,27 @@ public:
virtual css::beans::Optional< ::rtl::OUString > SAL_CALL getIdentifier()
throw (css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getVersion()
- throw (css::uno::RuntimeException);
+ throw (css::deployment::ExtensionRemovedException,
+ css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getURL()
throw (css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getDisplayName()
- throw (css::uno::RuntimeException);
+ throw (css::deployment::ExtensionRemovedException,
+ css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getDescription()
- throw (css::uno::RuntimeException);
+ throw (css::deployment::ExtensionRemovedException,
+ css::uno::RuntimeException);
virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL
- getUpdateInformationURLs() throw (css::uno::RuntimeException);
-
- virtual css::beans::StringPair SAL_CALL getPublisherInfo() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getIcon( sal_Bool bHighContrast ) throw (css::uno::RuntimeException);
-
+ getUpdateInformationURLs()
+ throw (css::deployment::ExtensionRemovedException,
+ css::uno::RuntimeException);
+ virtual css::beans::StringPair SAL_CALL getPublisherInfo()
+ throw (css::deployment::ExtensionRemovedException,
+ css::uno::RuntimeException);
+ virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL
+ getIcon( sal_Bool bHighContrast )
+ throw (css::deployment::ExtensionRemovedException,
+ css::uno::RuntimeException);
virtual css::uno::Reference<css::deployment::XPackageTypeInfo> SAL_CALL
getPackageType() throw (css::uno::RuntimeException);
virtual void SAL_CALL exportTo(
@@ -231,8 +255,17 @@ public:
::rtl::OUString const & newTitle,
sal_Int32 nameClashAction,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
- throw (css::ucb::CommandFailedException,
+ throw (css::deployment::ExtensionRemovedException,
+ css::ucb::CommandFailedException,
css::ucb::CommandAbortedException, css::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getRepositoryName()
+ throw (css::uno::RuntimeException);
+ virtual css::beans::Optional< ::rtl::OUString > SAL_CALL getRegistrationDataURL()
+ throw (css::deployment::ExtensionRemovedException,
+ css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isRemoved()
+ throw (css::uno::RuntimeException);
+
};
typedef ::cppu::WeakComponentImplHelper2<
@@ -243,7 +276,6 @@ typedef ::cppu::WeakComponentImplHelper2<
class PackageRegistryBackend
: protected ::dp_misc::MutexHolder, public t_BackendBase
{
- ::rtl::OUString m_cachePath;
//The map held originally WeakReferences. The map entries are removed in the disposing
//function, which is called when the XPackages are destructed or they are
//explicitely disposed. The latter happens, for example, when a extension is
@@ -257,13 +289,14 @@ class PackageRegistryBackend
t_string2ref m_bound;
protected:
+ ::rtl::OUString m_cachePath;
css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;
::rtl::OUString m_context;
// currently only for library containers:
enum context {
CONTEXT_UNKNOWN,
- CONTEXT_USER, CONTEXT_SHARED,
+ CONTEXT_USER, CONTEXT_SHARED,CONTEXT_BUNDLED, CONTEXT_TMP,
CONTEXT_DOCUMENT
} m_eContext;
bool m_readOnly;
@@ -276,6 +309,7 @@ protected:
// @@@ to be implemented by specific backend:
virtual css::uno::Reference<css::deployment::XPackage> bindPackage_(
::rtl::OUString const & url, ::rtl::OUString const & mediaType,
+ sal_Bool bRemoved, ::rtl::OUString const & identifier,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
= 0;
@@ -286,7 +320,29 @@ protected:
PackageRegistryBackend(
css::uno::Sequence<css::uno::Any> const & args,
css::uno::Reference<css::uno::XComponentContext> const & xContext );
-
+
+ /* creates a folder with a unique name.
+ If url is empty then it is created in the the backend folder, otherwise
+ at a location relative to that folder specified by url.
+ */
+ ::rtl::OUString createFolder(
+ ::rtl::OUString const & relUrl,
+ css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
+ /* deletes folders and files.
+
+ All folder all files which end with ".tmp" or ".tmp_" and which are
+ not used are deleted.
+ */
+ void deleteUnusedFolders(
+ ::rtl::OUString const & relUrl,
+ ::std::list< ::rtl::OUString> const & usedFolders);
+ /* deletes one folder with a "temporary" name and the corresponding
+ tmp file, which was used to derive the folder name.
+ */
+ static void deleteTempFolder(
+ ::rtl::OUString const & folderUrl);
+
+
public:
struct StrRegisteringPackage : public ::dp_misc::StaticResourceString<
StrRegisteringPackage, RID_STR_REGISTERING_PACKAGE> {};
@@ -298,6 +354,8 @@ public:
inline ::rtl::OUString const & getCachePath() const { return m_cachePath; }
inline bool transientMode() const { return m_cachePath.getLength() == 0; }
+
+ inline ::rtl::OUString getContext() const {return m_context; }
// XEventListener
virtual void SAL_CALL disposing( css::lang::EventObject const & evt )
@@ -306,13 +364,12 @@ public:
// XPackageRegistry
virtual css::uno::Reference<css::deployment::XPackage> SAL_CALL bindPackage(
::rtl::OUString const & url, ::rtl::OUString const & mediaType,
+ sal_Bool bRemoved, ::rtl::OUString const & identifier,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
throw (css::deployment::DeploymentException,
+ css::deployment::InvalidRemovedParameterException,
css::ucb::CommandFailedException,
css::lang::IllegalArgumentException, css::uno::RuntimeException);
-// virtual css::uno::Sequence<
-// css::uno::Reference<css::deployment::XPackageTypeInfo> > SAL_CALL
-// getSupportedPackageTypes() throw (css::uno::RuntimeException);
};
}
diff --git a/desktop/source/deployment/registry/inc/dp_backenddb.hxx b/desktop/source/deployment/registry/inc/dp_backenddb.hxx
new file mode 100644
index 0000000000..a401053e72
--- /dev/null
+++ b/desktop/source/deployment/registry/inc/dp_backenddb.hxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#if ! defined INCLUDED_DP_BACKENDDB_HXX
+#define INCLUDED_DP_BACKENDDB_HXX
+
+#include "rtl/ustring.hxx"
+#include <list>
+#include <vector>
+
+namespace css = ::com::sun::star;
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class XComponentContext;
+ }
+ namespace xml { namespace dom {
+ class XDocument;
+ class XNode;
+ }}
+ namespace xml { namespace xpath {
+ class XXPathAPI;
+ }}
+}}}
+
+namespace dp_registry {
+namespace backend {
+
+class BackendDb
+{
+private:
+
+ css::uno::Reference<css::xml::dom::XDocument> m_doc;
+ css::uno::Reference<css::xml::xpath::XXPathAPI> m_xpathApi;
+
+ BackendDb(BackendDb const &);
+ BackendDb & operator = (BackendDb const &);
+
+protected:
+ const css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ ::rtl::OUString m_urlDb;
+
+protected:
+
+ /* caller must make sure that only one thread accesses the function
+ */
+ css::uno::Reference<css::xml::dom::XDocument> getDocument();
+
+ /* the namespace prefix is "reg" (without quotes)
+ */
+ css::uno::Reference<css::xml::xpath::XXPathAPI> getXPathAPI();
+ void save();
+ void removeElement(::rtl::OUString const & sXPathExpression);
+
+ css::uno::Reference<css::xml::dom::XNode> getKeyElement(
+ ::rtl::OUString const & url);
+
+ void writeSimpleList(
+ ::std::list< ::rtl::OUString> const & list,
+ ::rtl::OUString const & sListTagName,
+ ::rtl::OUString const & sMemberTagName,
+ css::uno::Reference<css::xml::dom::XNode> const & xParent);
+
+ void writeVectorOfPair(
+ ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > const & vecPairs,
+ ::rtl::OUString const & sVectorTagName,
+ ::rtl::OUString const & sPairTagName,
+ ::rtl::OUString const & sFirstTagName,
+ ::rtl::OUString const & sSecondTagName,
+ css::uno::Reference<css::xml::dom::XNode> const & xParent);
+
+ void writeSimpleElement(
+ ::rtl::OUString const & sElementName, ::rtl::OUString const & value,
+ css::uno::Reference<css::xml::dom::XNode> const & xParent);
+
+ css::uno::Reference<css::xml::dom::XNode> writeKeyElement(
+ ::rtl::OUString const & url);
+
+ ::rtl::OUString readSimpleElement(
+ ::rtl::OUString const & sElementName,
+ css::uno::Reference<css::xml::dom::XNode> const & xParent);
+
+ ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > >
+ readVectorOfPair(
+ css::uno::Reference<css::xml::dom::XNode> const & parent,
+ ::rtl::OUString const & sListTagName,
+ ::rtl::OUString const & sPairTagName,
+ ::rtl::OUString const & sFirstTagName,
+ ::rtl::OUString const & sSecondTagName);
+
+ ::std::list< ::rtl::OUString> readList(
+ css::uno::Reference<css::xml::dom::XNode> const & parent,
+ ::rtl::OUString const & sListTagName,
+ ::rtl::OUString const & sMemberTagName);
+
+ /* returns the values of one particulary child element of all key elements.
+ */
+ ::std::list< ::rtl::OUString> getOneChildFromAllEntries(
+ ::rtl::OUString const & sElementName);
+
+
+ /* returns the namespace which is to be written as xmlns attribute
+ into the root element.
+ */
+ virtual ::rtl::OUString getDbNSName()=0;
+ /* return the namespace prefix which is to be registered with the XPath API.
+
+ The prefix can then be used in XPath expressions.
+ */
+ virtual ::rtl::OUString getNSPrefix()=0;
+ /* returns the name of the root element without any namespace prefix.
+ */
+ virtual ::rtl::OUString getRootElementName()=0;
+ /* returns the name of xml element for each entry
+ */
+ virtual ::rtl::OUString getKeyElementName()=0;
+
+
+
+public:
+ BackendDb(css::uno::Reference<css::uno::XComponentContext> const & xContext,
+ ::rtl::OUString const & url);
+ virtual ~BackendDb() {};
+
+ void removeEntry(::rtl::OUString const & url);
+};
+
+class RegisteredDb: public BackendDb
+{
+
+public:
+ RegisteredDb( css::uno::Reference<css::uno::XComponentContext> const & xContext,
+ ::rtl::OUString const & url);
+ virtual ~RegisteredDb() {};
+
+
+ virtual void addEntry(::rtl::OUString const & url);
+ virtual bool getEntry(::rtl::OUString const & url);
+
+};
+
+
+}
+}
+#endif
+
diff --git a/desktop/source/deployment/registry/makefile.mk b/desktop/source/deployment/registry/makefile.mk
index de0e943654..e45cec272c 100644
--- a/desktop/source/deployment/registry/makefile.mk
+++ b/desktop/source/deployment/registry/makefile.mk
@@ -41,7 +41,8 @@ INCPRE += inc
SLOFILES = \
$(SLO)$/dp_backend.obj \
- $(SLO)$/dp_registry.obj
+ $(SLO)$/dp_registry.obj \
+ $(SLO)$/dp_backenddb.obj
.INCLUDE : ..$/target.pmk
.INCLUDE : target.mk
diff --git a/desktop/source/deployment/registry/package/dp_description.cxx b/desktop/source/deployment/registry/package/dp_description.cxx
deleted file mode 100644
index 144edc685f..0000000000
--- a/desktop/source/deployment/registry/package/dp_description.cxx
+++ /dev/null
@@ -1,205 +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_desktop.hxx"
-
-#include "dp_description.hxx"
-
-#include "cppuhelper/exc_hlp.hxx"
-#include "ucbhelper/content.hxx"
-#include "com/sun/star/deployment/DeploymentException.hpp"
-#include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
-#include "com/sun/star/uno/XComponentContext.hpp"
-#include "com/sun/star/ucb/CommandFailedException.hpp"
-#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp"
-#include "com/sun/star/ucb/IOErrorCode.hpp"
-
-#include "com/sun/star/beans/PropertyValue.hpp"
-
-
-#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
-
-namespace css = com::sun::star;
-namespace cssu = com::sun::star::uno;
-
-namespace dp_registry {
-namespace backend {
-namespace bundle {
-
-ExtensionDescription::ExtensionDescription(
- const cssu::Reference<cssu::XComponentContext>& xContext,
- const ::rtl::OUString& installDir,
- const cssu::Reference< css::ucb::XCommandEnvironment >& xCmdEnv)
-{
- try {
- m_sExtensionRootUrl = installDir;
- //may throw ::com::sun::star::ucb::ContentCreationException
- //If there is no description.xml then ucb will start an interaction which
- //brings up a dialog.We want to prevent this. Therefore we wrap the xCmdEnv
- //and filter the respective exception out.
- ::rtl::OUString sDescriptionUri(installDir + OUSTR("/description.xml"));
- cssu::Reference<css::ucb::XCommandEnvironment> xFilter =
- static_cast<css::ucb::XCommandEnvironment*>(
- new FileDoesNotExistFilter(xCmdEnv));
- ::ucbhelper::Content descContent(sDescriptionUri, xFilter);
-
- //throws an com::sun::star::uno::Exception if the file is not available
- cssu::Reference<css::io::XInputStream> xIn;
- try
- { //throws com.sun.star.ucb.InteractiveAugmentedIOException
- xIn = descContent.openStream();
- }
- catch (cssu::Exception& )
- {
- if ( ! static_cast<FileDoesNotExistFilter*>(xFilter.get())->exist())
- throw NoDescriptionException();
- throw;
- }
- if (!xIn.is())
- {
- throw cssu::Exception(
- OUSTR("Could not get XInputStream for description.xml of extension ") +
- sDescriptionUri, 0);
- }
-
- //get root node of description.xml
- cssu::Reference<css::xml::dom::XDocumentBuilder> xDocBuilder(
- xContext->getServiceManager()->createInstanceWithContext(
- OUSTR("com.sun.star.xml.dom.DocumentBuilder"),
- xContext ), cssu::UNO_QUERY);
- if (!xDocBuilder.is())
- throw css::uno::Exception(OUSTR(" Could not create service com.sun.star.xml.dom.DocumentBuilder"), 0);
-
- if (xDocBuilder->isNamespaceAware() == sal_False)
- {
- throw cssu::Exception(
- OUSTR("Service com.sun.star.xml.dom.DocumentBuilder is not namespace aware."), 0);
- }
-
- cssu::Reference<css::xml::dom::XDocument> xDoc = xDocBuilder->parse(xIn);
- if (!xDoc.is())
- {
- throw cssu::Exception(sDescriptionUri + OUSTR(" contains data which cannot be parsed. "), 0);
- }
-
- //check for proper root element and namespace
- cssu::Reference<css::xml::dom::XElement> xRoot = xDoc->getDocumentElement();
- if (!xRoot.is())
- {
- throw cssu::Exception(
- sDescriptionUri + OUSTR(" contains no root element."), 0);
- }
-
- if ( ! xRoot->getTagName().equals(OUSTR("description")))
- {
- throw cssu::Exception(
- sDescriptionUri + OUSTR(" does not contain the root element <description>."), 0);
- }
-
- m_xRoot = cssu::Reference<css::xml::dom::XNode>(
- xRoot, cssu::UNO_QUERY_THROW);
- ::rtl::OUString nsDescription = xRoot->getNamespaceURI();
-
- //check if this namespace is supported
- if ( ! nsDescription.equals(OUSTR("http://openoffice.org/extensions/description/2006")))
- {
- throw cssu::Exception(sDescriptionUri + OUSTR(" contains a root element with an unsupported namespace. "), 0);
- }
- } catch (css::uno::RuntimeException &) {
- throw;
- } catch (css::deployment::DeploymentException &) {
- throw;
- } catch (css::uno::Exception & e) {
- css::uno::Any a(cppu::getCaughtException());
- throw css::deployment::DeploymentException(
- e.Message, css::uno::Reference< css::uno::XInterface >(), a);
- }
-}
-
-ExtensionDescription::~ExtensionDescription()
-{
-}
-
-//======================================================================
-FileDoesNotExistFilter::FileDoesNotExistFilter(
- const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv):
- m_bExist(true), m_xCommandEnv(xCmdEnv)
-{}
-
-FileDoesNotExistFilter::~FileDoesNotExistFilter()
-{
-};
-
-bool FileDoesNotExistFilter::exist()
-{
- return m_bExist;
-}
- // XCommandEnvironment
-cssu::Reference<css::task::XInteractionHandler >
- FileDoesNotExistFilter::getInteractionHandler() throw (css::uno::RuntimeException)
-{
- return static_cast<css::task::XInteractionHandler*>(this);
-}
-
-cssu::Reference<css::ucb::XProgressHandler >
- FileDoesNotExistFilter::getProgressHandler() throw (css::uno::RuntimeException)
-{
- return m_xCommandEnv.is()
- ? m_xCommandEnv->getProgressHandler()
- : cssu::Reference<css::ucb::XProgressHandler>();
-}
-
-// XInteractionHandler
-//If the interaction was caused by a non-existing file which is specified in the ctor
-//of FileDoesNotExistFilter, then we do nothing
-void FileDoesNotExistFilter::handle(
- cssu::Reference<css::task::XInteractionRequest > const & xRequest )
- throw (css::uno::RuntimeException)
-{
- cssu::Any request( xRequest->getRequest() );
-
- css::ucb::InteractiveAugmentedIOException ioexc;
- if ((request>>= ioexc) && ioexc.Code == css::ucb::IOErrorCode_NOT_EXISTING )
- {
- m_bExist = false;
- return;
- }
- css::uno::Reference<css::task::XInteractionHandler> xInteraction;
- if (m_xCommandEnv.is()) {
- xInteraction = m_xCommandEnv->getInteractionHandler();
- }
- if (xInteraction.is()) {
- xInteraction->handle(xRequest);
- }
-}
-
-
-} // namespace bundle
-} // namespace backend
-} // namespace dp_registry
-
diff --git a/desktop/source/deployment/registry/package/dp_description.hxx b/desktop/source/deployment/registry/package/dp_description.hxx
deleted file mode 100644
index 776d85e698..0000000000
--- a/desktop/source/deployment/registry/package/dp_description.hxx
+++ /dev/null
@@ -1,125 +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.
- *
- ************************************************************************/
-
-#if !defined INCLUDED_DESKTOP_EXTENSION_DESCRIPTION_HXX
-#define INCLUDED_DESKTOP_EXTENSION_DESCRIPTION_HXX
-
-
-
-#include "com/sun/star/uno/Reference.hxx"
-
-#include "com/sun/star/ucb/XCommandEnvironment.hpp"
-#include "com/sun/star/uno/XComponentContext.hpp"
-#include "com/sun/star/xml/dom/XNode.hpp"
-#include "com/sun/star/task/XInteractionHandler.hpp"
-#include "cppuhelper/implbase2.hxx"
-
-
-namespace css = ::com::sun::star;
-
-namespace dp_registry {
-namespace backend {
-namespace bundle {
-
-/**The class uses the UCB to access the description.xml file in an
- extension. The UCB must have been initialized already. It also
- requires that the extension has already be unzipped to a particular
- location.
- */
-class ExtensionDescription
-{
-public:
- /**throws an exception if the description.xml is not
- available, cannot be read, does not contain the expected data,
- or any other error occured. Therefore it shoult only be used with
- new extensions.
-
- Throws com::sun::star::uno::RuntimeException,
- com::sun::star::deployment::DeploymentException,
- dp_registry::backend::bundle::NoDescriptionException.
- */
- ExtensionDescription(
- const css::uno::Reference<css::uno::XComponentContext>& xContext,
- const ::rtl::OUString& installDir,
- const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv);
-
- ~ExtensionDescription();
-
- css::uno::Reference<css::xml::dom::XNode> getRootElement() const
- {
- return m_xRoot;
- }
-
- ::rtl::OUString getExtensionRootUrl() const
- {
- return m_sExtensionRootUrl;
- }
-
-
-private:
- css::uno::Reference<css::xml::dom::XNode> m_xRoot;
- ::rtl::OUString m_sExtensionRootUrl;
-};
-
-class NoDescriptionException
-{
-};
-
-class FileDoesNotExistFilter
- : public ::cppu::WeakImplHelper2< css::ucb::XCommandEnvironment,
- css::task::XInteractionHandler >
-
-{
- //css::uno::Reference<css::task::XInteractionHandler> m_xHandler;
- bool m_bExist;
- css::uno::Reference< css::ucb::XCommandEnvironment > m_xCommandEnv;
-
-public:
- virtual ~FileDoesNotExistFilter();
- FileDoesNotExistFilter(
- const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv);
-
- bool exist();
- // XCommandEnvironment
- virtual css::uno::Reference<css::task::XInteractionHandler > SAL_CALL
- getInteractionHandler() throw (css::uno::RuntimeException);
- virtual css::uno::Reference<css::ucb::XProgressHandler >
- SAL_CALL getProgressHandler() throw (css::uno::RuntimeException);
-
- // XInteractionHandler
- virtual void SAL_CALL handle(
- css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
- throw (css::uno::RuntimeException);
-};
-
-
-} // namespace bundle
-} // namespace backend
-} // namespace dp_registry
-
-
-#endif // INCLUDED_DESKTOP_LICENSE_INTERACT_HXX
diff --git a/desktop/source/deployment/registry/package/dp_extbackenddb.cxx b/desktop/source/deployment/registry/package/dp_extbackenddb.cxx
new file mode 100644
index 0000000000..81f453a421
--- /dev/null
+++ b/desktop/source/deployment/registry/package/dp_extbackenddb.cxx
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * 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_desktop.hxx"
+
+#include "rtl/string.h"
+#include "rtl/bootstrap.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
+#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
+#include "dp_misc.h"
+
+#include "dp_extbackenddb.hxx"
+
+
+namespace css = ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+#define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/extension-registry/2010"
+#define NS_PREFIX "ext"
+#define ROOT_ELEMENT_NAME "extension-backend-db"
+#define KEY_ELEMENT_NAME "extension"
+
+namespace dp_registry {
+namespace backend {
+namespace bundle {
+
+ExtensionBackendDb::ExtensionBackendDb(
+ Reference<XComponentContext> const & xContext,
+ ::rtl::OUString const & url):BackendDb(xContext, url)
+{
+
+}
+
+OUString ExtensionBackendDb::getDbNSName()
+{
+ return OUSTR(EXTENSION_REG_NS);
+}
+
+OUString ExtensionBackendDb::getNSPrefix()
+{
+ return OUSTR(NS_PREFIX);
+}
+
+OUString ExtensionBackendDb::getRootElementName()
+{
+ return OUSTR(ROOT_ELEMENT_NAME);
+}
+
+OUString ExtensionBackendDb::getKeyElementName()
+{
+ return OUSTR(KEY_ELEMENT_NAME);
+}
+
+void ExtensionBackendDb::addEntry(::rtl::OUString const & url, Data const & data)
+{
+ try{
+ Reference<css::xml::dom::XNode> extensionNodeNode = writeKeyElement(url);
+ writeVectorOfPair(
+ data.items,
+ OUSTR("extension-items"),
+ OUSTR("item"),
+ OUSTR("url"),
+ OUSTR("media-type"),
+ extensionNodeNode);
+ save();
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to write data entry in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+ExtensionBackendDb::Data ExtensionBackendDb::getEntry(::rtl::OUString const & url)
+{
+ try
+ {
+ ExtensionBackendDb::Data retData;
+ Reference<css::xml::dom::XNode> aNode = getKeyElement(url);
+
+ if (aNode.is())
+ {
+ retData.items =
+ readVectorOfPair(
+ aNode,
+ OUSTR("extension-items"),
+ OUSTR("item"),
+ OUSTR("url"),
+ OUSTR("media-type"));
+ }
+ return retData;
+ }
+ catch(css::uno::Exception &)
+ {
+ Any exc( ::cppu::getCaughtException() );
+ throw css::deployment::DeploymentException(
+ OUSTR("Extension Manager: failed to read data entry in backend db: ") +
+ m_urlDb, 0, exc);
+ }
+}
+
+} // namespace bundle
+} // namespace backend
+} // namespace dp_registry
+
diff --git a/desktop/source/deployment/registry/package/dp_extbackenddb.hxx b/desktop/source/deployment/registry/package/dp_extbackenddb.hxx
new file mode 100644
index 0000000000..117640f715
--- /dev/null
+++ b/desktop/source/deployment/registry/package/dp_extbackenddb.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+#if ! defined INCLUDED_DP_EXTBACKENDDB_HXX
+#define INCLUDED_DP_EXTBACKENDDB_HXX
+
+#include "rtl/ustring.hxx"
+#include "rtl/string.hxx"
+#include <vector>
+#include "dp_backenddb.hxx"
+
+namespace css = ::com::sun::star;
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class XComponentContext;
+ }
+ namespace xml { namespace dom {
+ class XDocument;
+ class XNode;
+ }}
+ namespace xml { namespace xpath {
+ class XXPathAPI;
+ }}
+}}}
+
+namespace dp_registry {
+namespace backend {
+namespace bundle {
+
+/* The XML file stores the extensions which are currently registered.
+ They will be removed when they are revoked.
+ */
+class ExtensionBackendDb: public dp_registry::backend::BackendDb
+{
+protected:
+ virtual ::rtl::OUString getDbNSName();
+ virtual ::rtl::OUString getNSPrefix();
+ virtual ::rtl::OUString getRootElementName();
+ virtual ::rtl::OUString getKeyElementName();
+
+public:
+ struct Data
+ {
+ /* every element consists of a pair of the url to the item (jar,rdb, etc)
+ and the media type
+ */
+ ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString> > items;
+ typedef ::std::vector<
+ ::std::pair< ::rtl::OUString, ::rtl::OUString> >::const_iterator ITC_ITEMS;
+
+ };
+
+public:
+
+ ExtensionBackendDb( css::uno::Reference<css::uno::XComponentContext> const & xContext,
+ ::rtl::OUString const & url);
+
+ void addEntry(::rtl::OUString const & url, Data const & data);
+
+ Data getEntry(::rtl::OUString const & url);
+
+};
+
+
+
+}
+}
+}
+#endif
+
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx
index 48de481bab..649f85c8db 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -34,7 +34,6 @@
#include "dp_interact.h"
#include "dp_dependencies.hxx"
#include "dp_platform.hxx"
-#include "dp_description.hxx"
#include "dp_descriptioninfoset.hxx"
#include "dp_identifier.hxx"
#include "rtl/uri.hxx"
@@ -65,8 +64,8 @@
#include "com/sun/star/packages/manifest/XManifestWriter.hpp"
#include "com/sun/star/deployment/DependencyException.hpp"
#include "com/sun/star/deployment/LicenseException.hpp"
-#include "com/sun/star/deployment/LicenseIndividualAgreementException.hpp"
#include "com/sun/star/deployment/PlatformException.hpp"
+#include "com/sun/star/deployment/Prerequisites.hpp"
#include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
#include "com/sun/star/deployment/XPackageManager.hpp"
@@ -74,13 +73,13 @@
#include <vector>
#include <stdio.h>
-
+#include "dp_extbackenddb.hxx"
using namespace ::dp_misc;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::ucb;
+
namespace css = ::com::sun::star;
-namespace cssu = ::com::sun::star::uno;
+
using ::rtl::OUString;
namespace dp_registry {
@@ -106,44 +105,48 @@ class BackendImpl : public ImplBaseT
Sequence< Reference<deployment::XPackage> > m_bundle;
Sequence< Reference<deployment::XPackage> > * m_pBundle;
+ ExtensionBackendDb::Data m_dbData;
+
Reference<deployment::XPackage> bindBundleItem(
OUString const & url, OUString const & mediaType,
- Reference<XCommandEnvironment> const & xCmdEnv,
+ sal_Bool bRemoved, //that is, useing data base information
+ OUString const & identifier,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv,
bool notifyDetectionError = true );
typedef ::std::vector< Reference<deployment::XPackage> > t_packagevec;
void scanBundle(
t_packagevec & bundle,
::rtl::Reference<AbortChannel> const & abortChannel,
- Reference<XCommandEnvironment> const & xCmdEnv );
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv );
void scanLegacyBundle(
t_packagevec & bundle,
OUString const & url,
::rtl::Reference<AbortChannel> const & abortChannel,
- Reference<XCommandEnvironment> const & xCmdEnv,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv,
bool skip_registration = false );
-
+ ::std::vector<Reference<deployment::XPackage> > getPackagesFromDb(
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv);
bool checkPlatform(
- css::uno::Reference< css::ucb::XCommandEnvironment > const & environment);
+ Reference<ucb::XCommandEnvironment > const & environment);
bool checkDependencies(
- css::uno::Reference< css::ucb::XCommandEnvironment > const &
+ Reference<ucb::XCommandEnvironment > const &
environment,
- ExtensionDescription const & description);
+ DescriptionInfoset const & description);
// throws css::uno::RuntimeException,
// css::deployment::DeploymentException
::sal_Bool checkLicense(
- css::uno::Reference< css::ucb::XCommandEnvironment > const & xCmdEnv,
- ExtensionDescription const& description, bool bInstalled,
- OUString const & aContextName )
- throw (css::deployment::DeploymentException,
- css::ucb::CommandFailedException,
- css::ucb::CommandAbortedException,
- css::uno::RuntimeException);
+ Reference< ucb::XCommandEnvironment > const & xCmdEnv,
+ DescriptionInfoset const & description, bool bNoLicenseChecking)
+ throw (deployment::DeploymentException,
+ ucb::CommandFailedException,
+ ucb::CommandAbortedException,
+ RuntimeException);
// @throws DeploymentException
OUString getTextFromURL(
- const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv,
+ const Reference< ucb::XCommandEnvironment >& xCmdEnv,
const OUString& licenseUrl);
DescriptionInfoset getDescriptionInfoset();
@@ -152,12 +155,13 @@ class BackendImpl : public ImplBaseT
virtual beans::Optional< beans::Ambiguous<sal_Bool> > isRegistered_(
::osl::ResettableMutexGuard & guard,
::rtl::Reference<AbortChannel> const & abortChannel,
- Reference<XCommandEnvironment> const & xCmdEnv );
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv );
virtual void processPackage_(
::osl::ResettableMutexGuard & guard,
bool registerPackage,
+ bool startup,
::rtl::Reference<AbortChannel> const & abortChannel,
- Reference<XCommandEnvironment> const & xCmdEnv );
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv );
virtual void SAL_CALL disposing();
@@ -169,57 +173,68 @@ class BackendImpl : public ImplBaseT
OUString const & url,
OUString const & name,
Reference<deployment::XPackageTypeInfo> const & xPackageType,
- bool legacyBundle )
- : Package( myBackend, url, name, name /* display-name */,
- xPackageType ),
- m_url_expanded( expandUnoRcUrl( url ) ),
- m_legacyBundle( legacyBundle ),
- m_pBundle( 0 )
- {}
+ bool legacyBundle,
+ bool bRemoved,
+ OUString const & identifier);
// XPackage
virtual sal_Bool SAL_CALL isBundle() throw (RuntimeException);
+
virtual Sequence< Reference<deployment::XPackage> > SAL_CALL getBundle(
Reference<task::XAbortChannel> const & xAbortChannel,
- Reference<XCommandEnvironment> const & xCmdEnv )
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
throw (deployment::DeploymentException,
- CommandFailedException, CommandAbortedException,
+ ucb::CommandFailedException,
+ ucb::CommandAbortedException,
lang::IllegalArgumentException, RuntimeException);
- virtual OUString SAL_CALL getDescription() throw (RuntimeException);
+ virtual OUString SAL_CALL getDescription()
+ throw (deployment::ExtensionRemovedException, RuntimeException);
+
virtual void SAL_CALL exportTo(
OUString const & destFolderURL, OUString const & newTitle,
sal_Int32 nameClashAction,
- Reference<XCommandEnvironment> const & xCmdEnv )
- throw (CommandFailedException, CommandAbortedException,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (deployment::ExtensionRemovedException,
+ ucb::CommandFailedException,
+ ucb::CommandAbortedException,
RuntimeException);
- virtual ::sal_Bool SAL_CALL checkPrerequisites(
- const css::uno::Reference< css::task::XAbortChannel >& xAbortChannel,
- const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv,
- ::sal_Bool bInstalled, OUString const & aContextName)
- throw (css::deployment::DeploymentException,
- css::ucb::CommandFailedException,
- css::ucb::CommandAbortedException,
- css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL checkPrerequisites(
+ const Reference< task::XAbortChannel >& xAbortChannel,
+ const Reference< ucb::XCommandEnvironment >& xCmdEnv,
+ ::sal_Bool noLicenseChecking)
+ throw (deployment::ExtensionRemovedException,
+ deployment::DeploymentException,
+ ucb::CommandFailedException,
+ ucb::CommandAbortedException,
+ RuntimeException);
virtual ::sal_Bool SAL_CALL checkDependencies(
- const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv )
- throw (css::deployment::DeploymentException,
- css::ucb::CommandFailedException,
- css::uno::RuntimeException);
+ const Reference< ucb::XCommandEnvironment >& xCmdEnv )
+ throw (deployment::DeploymentException,
+ deployment::ExtensionRemovedException,
+ ucb::CommandFailedException,
+ RuntimeException);
virtual beans::Optional<OUString> SAL_CALL getIdentifier()
throw (RuntimeException);
- virtual OUString SAL_CALL getVersion() throw (RuntimeException);
+ virtual OUString SAL_CALL getVersion()
+ throw (deployment::ExtensionRemovedException, RuntimeException);
virtual Sequence<OUString> SAL_CALL getUpdateInformationURLs()
- throw (RuntimeException);
+ throw (deployment::ExtensionRemovedException, RuntimeException);
- virtual css::beans::StringPair SAL_CALL getPublisherInfo() throw (css::uno::RuntimeException);
+ virtual beans::StringPair SAL_CALL getPublisherInfo()
+ throw (deployment::ExtensionRemovedException, RuntimeException);
- virtual OUString SAL_CALL getDisplayName() throw (RuntimeException);
- virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getIcon( ::sal_Bool bHighContrast ) throw (css::uno::RuntimeException);
+ virtual OUString SAL_CALL getDisplayName()
+ throw (deployment::ExtensionRemovedException, RuntimeException);
+
+ virtual Reference< graphic::XGraphic > SAL_CALL
+ getIcon( ::sal_Bool bHighContrast )
+ throw (deployment::ExtensionRemovedException,
+ RuntimeException);
};
friend class PackageImpl;
@@ -227,11 +242,18 @@ class BackendImpl : public ImplBaseT
const Reference<deployment::XPackageTypeInfo> m_xBundleTypeInfo;
const Reference<deployment::XPackageTypeInfo> m_xLegacyBundleTypeInfo;
Sequence< Reference<deployment::XPackageTypeInfo> > m_typeInfos;
+
+ std::auto_ptr<ExtensionBackendDb> m_backendDb;
+
+ void addDataToDb(OUString const & url, ExtensionBackendDb::Data const & data);
+ ExtensionBackendDb::Data readDataFromDb(OUString const & url);
+ void deleteDataFromDb(OUString const & url);
// PackageRegistryBackend
virtual Reference<deployment::XPackage> bindPackage_(
OUString const & url, OUString const & mediaType,
- Reference<XCommandEnvironment> const & xCmdEnv );
+ sal_Bool bRemoved, OUString const & identifier,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv );
virtual void SAL_CALL disposing();
@@ -291,6 +313,14 @@ BackendImpl::BackendImpl(
{
m_typeInfos[ 0 ] = m_xBundleTypeInfo;
m_typeInfos[ 1 ] = m_xLegacyBundleTypeInfo;
+
+ if (!transientMode())
+ {
+ OUString dbFile = makeURL(getCachePath(), getImplementationName());
+ dbFile = makeURL(dbFile, OUSTR("backenddb.xml"));
+ m_backendDb.reset(
+ new ExtensionBackendDb(getComponentContext(), dbFile));
+ }
}
//______________________________________________________________________________
@@ -333,7 +363,8 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException)
//______________________________________________________________________________
Reference<deployment::XPackage> BackendImpl::bindPackage_(
OUString const & url, OUString const & mediaType_,
- Reference<XCommandEnvironment> const & xCmdEnv )
+ sal_Bool bRemoved, OUString const & identifier,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
{
OUString mediaType( mediaType_ );
if (mediaType.getLength() == 0)
@@ -347,7 +378,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
//Every .oxt, uno.pkg file must contain a META-INF folder
::ucbhelper::Content metaInfContent;
if (create_ucb_content(
- &metaInfContent, makeURL( url, OUSTR("META-INF/manifest.xml") ),
+ &metaInfContent, makeURL( url, OUSTR("META-INF") ),
xCmdEnv, false /* no throw */ ))
{
mediaType = OUSTR("application/vnd.sun.star.package-bundle");
@@ -381,19 +412,26 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
{
if (type.EqualsIgnoreCaseAscii("application"))
{
- ::ucbhelper::Content ucbContent( url, xCmdEnv );
+
+ //In case a XPackage is created for a removed extension, we cannot
+ //obtain the name
+ OUString name;
+ if (!bRemoved)
+ {
+ ::ucbhelper::Content ucbContent( url, xCmdEnv );
+ name = ucbContent.getPropertyValue(
+ StrTitle::get() ).get<OUString>();
+ }
if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.package-bundle")) {
return new PackageImpl(
- this, url, ucbContent.getPropertyValue(
- StrTitle::get() ).get<OUString>(),
- m_xBundleTypeInfo, false );
+ this, url, name, m_xBundleTypeInfo, false, bRemoved,
+ identifier);
}
else if (subType.EqualsIgnoreCaseAscii(
"vnd.sun.star.legacy-package-bundle")) {
return new PackageImpl(
- this, url, ucbContent.getPropertyValue(
- StrTitle::get() ).get<OUString>(),
- m_xLegacyBundleTypeInfo, true );
+ this, url, name, m_xLegacyBundleTypeInfo, true, bRemoved,
+ identifier);
}
}
}
@@ -403,8 +441,47 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
static_cast<sal_Int16>(-1) );
}
+void BackendImpl::addDataToDb(
+ OUString const & url, ExtensionBackendDb::Data const & data)
+{
+ if (m_backendDb.get())
+ m_backendDb->addEntry(url, data);
+}
+
+ExtensionBackendDb::Data BackendImpl::readDataFromDb(
+ OUString const & url)
+{
+ ExtensionBackendDb::Data data;
+ if (m_backendDb.get())
+ data = m_backendDb->getEntry(url);
+ return data;
+}
+
+void BackendImpl::deleteDataFromDb(OUString const & url)
+{
+ if (m_backendDb.get())
+ m_backendDb->removeEntry(url);
+}
+
+
//##############################################################################
+BackendImpl::PackageImpl::PackageImpl(
+ ::rtl::Reference<PackageRegistryBackend> const & myBackend,
+ OUString const & url,
+ OUString const & name,
+ Reference<deployment::XPackageTypeInfo> const & xPackageType,
+ bool legacyBundle, bool bRemoved, OUString const & identifier)
+ : Package( myBackend, url, name, name /* display-name */,
+ xPackageType, bRemoved, identifier),
+ m_url_expanded( expandUnoRcUrl( url ) ),
+ m_legacyBundle( legacyBundle ),
+ m_pBundle( 0 )
+{
+ if (bRemoved)
+ m_dbData = getMyBackend()->readDataFromDb(url);
+}
+
BackendImpl * BackendImpl::PackageImpl::getMyBackend() const
{
BackendImpl * pBackend = static_cast<BackendImpl *>(m_myBackend.get());
@@ -437,22 +514,23 @@ beans::Optional< beans::Ambiguous<sal_Bool> >
BackendImpl::PackageImpl::isRegistered_(
::osl::ResettableMutexGuard &,
::rtl::Reference<AbortChannel> const & abortChannel,
- Reference<XCommandEnvironment> const & xCmdEnv )
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
{
+ //In case the object was created for a removed extension (m_bRemoved = true)
+ //but the extension is not registered, then bundle will be empty. Then
+ //the return value will be Optional<...>.IsPresent= false. Althoug this is
+ //not true, this does not matter. Then registerPackage or revokePackage
+ //would never be called for the items. But since the extension is removed
+ //and not registered anyway, this does not matter.
const Sequence< Reference<deployment::XPackage> > bundle(
getBundle( abortChannel.get(), xCmdEnv ) );
+
bool reg = false;
bool present = false;
bool ambig = false;
for ( sal_Int32 pos = bundle.getLength(); pos--; )
{
Reference<deployment::XPackage> const & xPackage = bundle[ pos ];
- //disregard executable (application/vnd.sun.star.executable)
- //it will not be disabled/enabled.
- OUString sType = xPackage->getPackageType()->getMediaType();
- if (sType.equals(OUSTR("application/vnd.sun.star.executable")))
- continue;
-
Reference<task::XAbortChannel> xSubAbortChannel(
xPackage->createAbortChannel() );
AbortChannel::Chain chain( abortChannel, xSubAbortChannel );
@@ -510,23 +588,7 @@ OUString BackendImpl::PackageImpl::getTextFromURL(
DescriptionInfoset BackendImpl::PackageImpl::getDescriptionInfoset()
{
- css::uno::Reference< css::xml::dom::XNode > root;
- try {
- root =
- ExtensionDescription(
- getMyBackend()->getComponentContext(), m_url_expanded,
- css::uno::Reference< css::ucb::XCommandEnvironment >()).
- getRootElement();
- } catch (NoDescriptionException &) {
- } catch (css::deployment::DeploymentException & e) {
- throw RuntimeException(
- (OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.deployment.DeploymentException: ")) +
- e.Message),
- static_cast< OWeakObject * >(this));
- }
- return DescriptionInfoset(getMyBackend()->getComponentContext(), root);
+ return dp_misc::getDescriptionInfoset(m_url_expanded);
}
bool BackendImpl::PackageImpl::checkPlatform(
@@ -561,14 +623,11 @@ bool BackendImpl::PackageImpl::checkPlatform(
bool BackendImpl::PackageImpl::checkDependencies(
css::uno::Reference< css::ucb::XCommandEnvironment > const & environment,
- ExtensionDescription const & description)
+ DescriptionInfoset const & description)
{
css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > >
- unsatisfied(
- dp_misc::Dependencies::check(
- DescriptionInfoset(
- getMyBackend()->getComponentContext(),
- description.getRootElement())));
+ unsatisfied(dp_misc::Dependencies::check(description));
+
if (unsatisfied.getLength() == 0) {
return true;
} else {
@@ -590,7 +649,7 @@ bool BackendImpl::PackageImpl::checkDependencies(
::sal_Bool BackendImpl::PackageImpl::checkLicense(
css::uno::Reference< css::ucb::XCommandEnvironment > const & xCmdEnv,
- ExtensionDescription const & desc, bool bInstalled, OUString const & aContextName)
+ DescriptionInfoset const & info, bool alreadyInstalled)
throw (css::deployment::DeploymentException,
css::ucb::CommandFailedException,
css::ucb::CommandAbortedException,
@@ -598,7 +657,6 @@ bool BackendImpl::PackageImpl::checkDependencies(
{
try
{
- DescriptionInfoset info = getDescriptionInfoset();
::boost::optional<SimpleLicenseAttributes> simplLicAttr
= info.getSimpleLicenseAttributes();
if (! simplLicAttr)
@@ -610,7 +668,7 @@ bool BackendImpl::PackageImpl::checkDependencies(
if (sLic.getLength() == 0)
throw css::deployment::DeploymentException(
OUSTR("Could not obtain path to license. Possible error in description.xml"), 0, Any());
- OUString sHref = desc.getExtensionRootUrl() + OUSTR("/") + sLic;
+ OUString sHref = m_url_expanded + OUSTR("/") + sLic;
OUString sLicense = getTextFromURL(xCmdEnv, sHref);
////determine who has to agree to the license
//check correct value for attribute
@@ -618,41 +676,21 @@ bool BackendImpl::PackageImpl::checkDependencies(
throw css::deployment::DeploymentException(
OUSTR("Could not obtain attribute simple-lincense@accept-by or it has no valid value"), 0, Any());
- //If if @accept-by="user" then every user needs to accept the license before it can be installed.
- //Therefore we must prevent the installation as shared extension unless suppress-if-required="true"
- OSL_ASSERT(aContextName.getLength());
- if (simplLicAttr->acceptBy.equals(OUSTR("user")) && aContextName.equals(OUSTR("shared")))
- {
- css::deployment::LicenseIndividualAgreementException
- exc = css::deployment::LicenseIndividualAgreementException(
- OUString(), 0, m_name, simplLicAttr->suppressIfRequired);
-
- bool approve = false;
- bool abort = false;
- if (! interactContinuation(
- Any(exc), task::XInteractionApprove::static_type(), xCmdEnv, &approve, &abort ))
- throw css::deployment::DeploymentException(
- OUSTR("Could not interact with user."), 0, Any());
- if (abort == true)
- return false;
-
- //If the unopkg --suppress-license was used and simplLicAttr->suppressIfRequired == true,
- //then the user implicitely accepts the license
- }
//Only use interaction if there is no version of this extension already installed
//and the suppress-on-update flag is not set for the new extension
- // bInstalled | bSuppressOnUpdate | show license
+ // alreadyInstalled | bSuppressOnUpdate | show license
//----------------------------------------
// 0 | 0 | 1
// 0 | 1 | 1
// 1 | 0 | 1
// 1 | 1 | 0
- if ( !(bInstalled && simplLicAttr->suppressOnUpdate))
+ if ( !(alreadyInstalled && simplLicAttr->suppressOnUpdate))
{
css::deployment::LicenseException licExc(
- OUString(), 0, m_name, sLicense, simplLicAttr->suppressIfRequired);
+ OUString(), 0, getDisplayName(), sLicense,
+ simplLicAttr->acceptBy);
bool approve = false;
bool abort = false;
if (! interactContinuation(
@@ -684,69 +722,88 @@ bool BackendImpl::PackageImpl::checkDependencies(
}
}
-::sal_Bool BackendImpl::PackageImpl::checkPrerequisites(
+::sal_Int32 BackendImpl::PackageImpl::checkPrerequisites(
const css::uno::Reference< css::task::XAbortChannel >&,
const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv,
- sal_Bool bInstalled, OUString const & aContextName)
+ sal_Bool alreadyInstalled)
throw (css::deployment::DeploymentException,
- css::ucb::CommandFailedException,
- css::ucb::CommandAbortedException,
- css::uno::RuntimeException)
+ css::deployment::ExtensionRemovedException,
+ css::ucb::CommandFailedException,
+ css::ucb::CommandAbortedException,
+ css::uno::RuntimeException)
{
- std::auto_ptr<ExtensionDescription> spDescription;
- try {
- spDescription.reset(
- new ExtensionDescription(
- getMyBackend()->getComponentContext(),
- m_url_expanded,
- xCmdEnv));
- } catch (NoDescriptionException& ) {
- return sal_True;
- }
- return checkPlatform(xCmdEnv)
- && checkDependencies(xCmdEnv, *spDescription)
- && checkLicense(xCmdEnv, *spDescription, bInstalled, aContextName);
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
+ DescriptionInfoset info = getDescriptionInfoset();
+ if (!info.hasDescription())
+ return 0;
+
+ //always return LICENSE as long as the user did not accept the license
+ //so that XExtensonManager::checkPrerequisitesAndEnable will again
+ //check the license
+ if (!checkPlatform(xCmdEnv))
+ return deployment::Prerequisites::PLATFORM |
+ deployment::Prerequisites::LICENSE;
+ else if(!checkDependencies(xCmdEnv, info))
+ return deployment::Prerequisites::DEPENDENCIES |
+ deployment::Prerequisites::LICENSE;
+ else if(!checkLicense(xCmdEnv, info, alreadyInstalled))
+ return deployment::Prerequisites::LICENSE;
+ else
+ return 0;
}
::sal_Bool BackendImpl::PackageImpl::checkDependencies(
const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv )
- throw (css::deployment::DeploymentException,
- css::ucb::CommandFailedException,
- css::uno::RuntimeException)
+ throw (deployment::DeploymentException,
+ deployment::ExtensionRemovedException,
+ ucb::CommandFailedException,
+ RuntimeException)
{
- std::auto_ptr<ExtensionDescription> spDescription;
- try {
- spDescription.reset(
- new ExtensionDescription( getMyBackend()->getComponentContext(), m_url_expanded, xCmdEnv ));
- } catch (NoDescriptionException& ) {
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
+ DescriptionInfoset info = getDescriptionInfoset();
+ if (!info.hasDescription())
return sal_True;
- }
- return checkDependencies(xCmdEnv, *spDescription);
+
+ return checkDependencies(xCmdEnv, info);
}
beans::Optional<OUString> BackendImpl::PackageImpl::getIdentifier()
throw (RuntimeException)
{
+ OUString identifier;
+ if (m_bRemoved)
+ identifier = m_identifier;
+ else
+ identifier = dp_misc::generateIdentifier(
+ getDescriptionInfoset().getIdentifier(), m_name);
+
return beans::Optional<OUString>(
- true,
- dp_misc::generateIdentifier(
- getDescriptionInfoset().getIdentifier(), m_name));
+ true, identifier);
}
-OUString BackendImpl::PackageImpl::getVersion() throw (RuntimeException)
+OUString BackendImpl::PackageImpl::getVersion()
+ throw (deployment::ExtensionRemovedException, RuntimeException)
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
return getDescriptionInfoset().getVersion();
}
Sequence<OUString> BackendImpl::PackageImpl::getUpdateInformationURLs()
- throw (RuntimeException)
+ throw (deployment::ExtensionRemovedException, RuntimeException)
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
return getDescriptionInfoset().getUpdateInformationUrls();
}
beans::StringPair BackendImpl::PackageImpl::getPublisherInfo()
- throw (RuntimeException)
+ throw (deployment::ExtensionRemovedException, RuntimeException)
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
::std::pair< OUString, OUString > aInfo = getDescriptionInfoset().getLocalizedPublisherNameAndURL();
beans::StringPair aStrPair( aInfo.first, aInfo.second );
return aStrPair;
@@ -754,8 +811,11 @@ beans::StringPair BackendImpl::PackageImpl::getPublisherInfo()
//______________________________________________________________________________
uno::Reference< graphic::XGraphic > BackendImpl::PackageImpl::getIcon( sal_Bool bHighContrast )
- throw ( RuntimeException )
+ throw (deployment::ExtensionRemovedException, RuntimeException )
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
+
uno::Reference< graphic::XGraphic > xGraphic;
OUString aIconURL = getDescriptionInfoset().getIconURL( bHighContrast );
@@ -785,14 +845,16 @@ uno::Reference< graphic::XGraphic > BackendImpl::PackageImpl::getIcon( sal_Bool
void BackendImpl::PackageImpl::processPackage_(
::osl::ResettableMutexGuard &,
bool doRegisterPackage,
+ bool startup,
::rtl::Reference<AbortChannel> const & abortChannel,
- Reference<XCommandEnvironment> const & xCmdEnv )
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
{
const Sequence< Reference<deployment::XPackage> > bundle(
getBundle( abortChannel.get(), xCmdEnv ) );
if (doRegisterPackage)
- {
+ {
+ ExtensionBackendDb::Data data;
const sal_Int32 len = bundle.getLength();
for ( sal_Int32 pos = 0; pos < len; ++pos )
{
@@ -802,12 +864,12 @@ void BackendImpl::PackageImpl::processPackage_(
xPackage->createAbortChannel() );
AbortChannel::Chain chain( abortChannel, xSubAbortChannel );
try {
- xPackage->registerPackage( xSubAbortChannel, xCmdEnv );
+ xPackage->registerPackage( startup, xSubAbortChannel, xCmdEnv );
}
catch (RuntimeException &) {
throw;
}
- catch (CommandAbortedException &) {
+ catch (ucb::CommandAbortedException &) {
throw;
}
catch (Exception &) {
@@ -845,7 +907,7 @@ void BackendImpl::PackageImpl::processPackage_(
catch (RuntimeException &) {
throw;
}
- catch (CommandAbortedException &) {
+ catch (ucb::CommandAbortedException &) {
throw;
}
catch (Exception &) {
@@ -862,7 +924,7 @@ void BackendImpl::PackageImpl::processPackage_(
deployment::DeploymentException dpExc;
if (exc >>= dpExc) {
- throw CommandFailedException(
+ throw ucb::CommandFailedException(
dpExc.Message, dpExc.Context, dpExc.Cause );
}
else {
@@ -870,7 +932,11 @@ void BackendImpl::PackageImpl::processPackage_(
::cppu::throwException(exc);
}
}
+ data.items.push_back(
+ ::std::make_pair(xPackage->getURL(),
+ xPackage->getPackageType()->getMediaType()));
}
+ getMyBackend()->addDataToDb(getURL(), data);
}
else
{
@@ -888,7 +954,7 @@ void BackendImpl::PackageImpl::processPackage_(
catch (RuntimeException &) {
throw;
}
- catch (CommandAbortedException &) {
+ catch (ucb::CommandAbortedException &) {
throw;
}
catch (Exception &) {
@@ -914,12 +980,17 @@ void BackendImpl::PackageImpl::processPackage_(
// selected
}
}
+ getMyBackend()->deleteDataFromDb(getURL());
}
}
//______________________________________________________________________________
-OUString BackendImpl::PackageImpl::getDescription() throw (RuntimeException)
+OUString BackendImpl::PackageImpl::getDescription()
+ throw (deployment::ExtensionRemovedException, RuntimeException)
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
+
const OUString sRelativeURL(getDescriptionInfoset().getLocalizedDescriptionURL());
OUString sDescription;
if (sRelativeURL.getLength())
@@ -940,9 +1011,14 @@ OUString BackendImpl::PackageImpl::getDescription() throw (RuntimeException)
//______________________________________________________________________________
void BackendImpl::PackageImpl::exportTo(
OUString const & destFolderURL, OUString const & newTitle,
- sal_Int32 nameClashAction, Reference<XCommandEnvironment> const & xCmdEnv )
- throw (CommandFailedException, CommandAbortedException, RuntimeException)
+ sal_Int32 nameClashAction, Reference<ucb::XCommandEnvironment> const & xCmdEnv )
+ throw (ucb::CommandFailedException,
+ deployment::ExtensionRemovedException,
+ ucb::CommandAbortedException, RuntimeException)
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
+
::ucbhelper::Content sourceContent( m_url_expanded, xCmdEnv );
OUString title(newTitle);
if (title.getLength() == 0)
@@ -952,25 +1028,25 @@ void BackendImpl::PackageImpl::exportTo(
rtl_UriEncodeIgnoreEscapes,
RTL_TEXTENCODING_UTF8 ) ) );
- if (nameClashAction == NameClash::ASK)
+ if (nameClashAction == ucb::NameClash::ASK)
{
if (create_ucb_content(
0, destURL, xCmdEnv, false /* no throw */ )) {
bool replace = false, abort = false;
if (! interactContinuation(
- Any( NameClashResolveRequest(
+ Any( ucb::NameClashResolveRequest(
OUSTR("file already exists: ") + title,
static_cast<OWeakObject *>(this),
task::InteractionClassification_QUERY,
destFolderURL, title, OUString() ) ),
- XInteractionReplaceExistingData::static_type(), xCmdEnv,
+ ucb::XInteractionReplaceExistingData::static_type(), xCmdEnv,
&replace, &abort ) || !replace) {
return;
}
}
}
- else if (nameClashAction != NameClash::OVERWRITE) {
- throw CommandFailedException(
+ else if (nameClashAction != ucb::NameClash::OVERWRITE) {
+ throw ucb::CommandFailedException(
OUSTR("unsupported nameClashAction!"),
static_cast<OWeakObject *>(this), Any() );
}
@@ -996,11 +1072,11 @@ void BackendImpl::PackageImpl::exportTo(
while (xResultSet->next())
{
::ucbhelper::Content subContent(
- Reference<XContentAccess>(
+ Reference<ucb::XContentAccess>(
xResultSet, UNO_QUERY_THROW )->queryContent(), xCmdEnv );
if (! destFolderContent.transferContent(
subContent, ::ucbhelper::InsertOperation_COPY,
- OUString(), NameClash::OVERWRITE ))
+ OUString(), ucb::NameClash::OVERWRITE ))
throw RuntimeException( OUSTR("UCB transferContent() failed!"),
static_cast<OWeakObject *>(this) );
progress.update( Any() ); // animating progress bar
@@ -1108,7 +1184,7 @@ void BackendImpl::PackageImpl::exportTo(
if (! metainfFolderContent.transferContent(
manifestContent, ::ucbhelper::InsertOperation_COPY,
- OUString(), NameClash::OVERWRITE ))
+ OUString(), ucb::NameClash::OVERWRITE ))
throw RuntimeException( OUSTR("UCB transferContent() failed!"),
static_cast<OWeakObject *>(this) );
}
@@ -1117,7 +1193,7 @@ void BackendImpl::PackageImpl::exportTo(
try {
destFolderContent.executeCommand( OUSTR("flush"), Any() );
}
- catch (UnsupportedCommandException &) {
+ catch (ucb::UnsupportedCommandException &) {
}
}
@@ -1130,69 +1206,78 @@ sal_Bool BackendImpl::PackageImpl::isBundle() throw (RuntimeException)
//______________________________________________________________________________
Sequence< Reference<deployment::XPackage> > BackendImpl::PackageImpl::getBundle(
Reference<task::XAbortChannel> const & xAbortChannel,
- Reference<XCommandEnvironment> const & xCmdEnv )
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
throw (deployment::DeploymentException,
- CommandFailedException, CommandAbortedException,
+ ucb::CommandFailedException, ucb::CommandAbortedException,
lang::IllegalArgumentException, RuntimeException)
{
Sequence< Reference<deployment::XPackage> > * pBundle = m_pBundle;
if (pBundle == 0)
{
t_packagevec bundle;
- try {
- if (m_legacyBundle)
- {
- // .zip legacy packages allow script.xlb, dialog.xlb in bundle
- // root folder:
- OUString mediaType;
- // probe for script.xlb:
- if (create_ucb_content(
- 0, makeURL( m_url_expanded, OUSTR("script.xlb") ),
- xCmdEnv, false /* no throw */ )) {
- mediaType = OUSTR("application/vnd.sun.star.basic-library");
- }
- // probe for dialog.xlb:
- else if (create_ucb_content(
- 0, makeURL( m_url_expanded, OUSTR("dialog.xlb") ),
- xCmdEnv, false /* no throw */ ))
- mediaType = OUSTR("application/vnd.sun.star."
- "dialog-library");
+ if (m_bRemoved)
+ {
+ bundle = getPackagesFromDb(xCmdEnv);
+ }
+ else
+ {
+ try {
+ if (m_legacyBundle)
+ {
+ // .zip legacy packages allow script.xlb, dialog.xlb in bundle
+ // root folder:
+ OUString mediaType;
+ // probe for script.xlb:
+ if (create_ucb_content(
+ 0, makeURL( m_url_expanded, OUSTR("script.xlb") ),
+ xCmdEnv, false /* no throw */ )) {
+ mediaType = OUSTR("application/vnd.sun.star.basic-library");
+ }
+ // probe for dialog.xlb:
+ else if (create_ucb_content(
+ 0, makeURL( m_url_expanded, OUSTR("dialog.xlb") ),
+ xCmdEnv, false /* no throw */ ))
+ mediaType = OUSTR("application/vnd.sun.star."
+ "dialog-library");
- if (mediaType.getLength() > 0) {
- const Reference<deployment::XPackage> xPackage(
- bindBundleItem( getURL(), mediaType, xCmdEnv ) );
- if (xPackage.is())
- bundle.push_back( xPackage );
- // continue scanning:
+ if (mediaType.getLength() > 0) {
+ const Reference<deployment::XPackage> xPackage(
+ bindBundleItem( getURL(), mediaType, false, OUString(),
+ xCmdEnv ) );
+ if (xPackage.is())
+ bundle.push_back( xPackage );
+ // continue scanning:
+ }
+ scanLegacyBundle( bundle, getURL(),
+ AbortChannel::get(xAbortChannel), xCmdEnv );
}
- scanLegacyBundle( bundle, getURL(),
- AbortChannel::get(xAbortChannel), xCmdEnv );
+ else
+ {
+ // .oxt:
+ scanBundle( bundle, AbortChannel::get(xAbortChannel), xCmdEnv );
+ }
+
}
- else
- {
- // .oxt:
- scanBundle( bundle, AbortChannel::get(xAbortChannel), xCmdEnv );
+ catch (RuntimeException &) {
+ throw;
+ }
+ catch (ucb::CommandFailedException &) {
+ throw;
+ }
+ catch (ucb::CommandAbortedException &) {
+ throw;
+ }
+ catch (deployment::DeploymentException &) {
+ throw;
+ }
+ catch (Exception &) {
+ Any exc( ::cppu::getCaughtException() );
+ throw deployment::DeploymentException(
+ OUSTR("error scanning bundle: ") + getURL(),
+ static_cast<OWeakObject *>(this), exc );
}
}
- catch (RuntimeException &) {
- throw;
- }
- catch (CommandFailedException &) {
- throw;
- }
- catch (CommandAbortedException &) {
- throw;
- }
- catch (deployment::DeploymentException &) {
- throw;
- }
- catch (Exception &) {
- Any exc( ::cppu::getCaughtException() );
- throw deployment::DeploymentException(
- OUSTR("error scanning bundle: ") + getURL(),
- static_cast<OWeakObject *>(this), exc );
- }
-
+
// sort: schema before config data, typelibs before components:
Sequence< Reference<deployment::XPackage> > ret( bundle.size() );
Reference<deployment::XPackage> * pret = ret.getArray();
@@ -1257,7 +1342,8 @@ inline bool isBundle_( OUString const & mediaType )
//______________________________________________________________________________
Reference<deployment::XPackage> BackendImpl::PackageImpl::bindBundleItem(
OUString const & url, OUString const & mediaType,
- Reference<XCommandEnvironment> const & xCmdEnv,
+ sal_Bool bRemoved, OUString const & identifier,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv,
bool notifyDetectionError )
{
// ignore any nested bundles:
@@ -1267,13 +1353,13 @@ Reference<deployment::XPackage> BackendImpl::PackageImpl::bindBundleItem(
Reference<deployment::XPackage>xPackage;
try {
xPackage.set( getMyBackend()->m_xRootRegistry->bindPackage(
- url, mediaType, xCmdEnv ) );
+ url, mediaType, bRemoved, identifier, xCmdEnv ) );
OSL_ASSERT( xPackage.is() );
}
catch (RuntimeException &) {
throw;
}
- catch (CommandFailedException &) {
+ catch (ucb::CommandFailedException &) {
// ignore already handled error
}
catch (Exception &) {
@@ -1306,7 +1392,7 @@ Reference<deployment::XPackage> BackendImpl::PackageImpl::bindBundleItem(
void BackendImpl::PackageImpl::scanBundle(
t_packagevec & bundle,
::rtl::Reference<AbortChannel> const & abortChannel,
- Reference<XCommandEnvironment> const & xCmdEnv )
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv )
{
OSL_ASSERT( !m_legacyBundle );
@@ -1403,7 +1489,7 @@ void BackendImpl::PackageImpl::scanBundle(
if (bundle.end() == std::find_if(bundle.begin(), bundle.end(), XPackage_eq(url)))
{
const Reference<deployment::XPackage> xPackage(
- bindBundleItem( url, mediaType, xCmdEnv ) );
+ bindBundleItem( url, mediaType, false, OUString(), xCmdEnv ) );
if (xPackage.is())
bundle.push_back( xPackage );
}
@@ -1442,7 +1528,7 @@ void BackendImpl::PackageImpl::scanLegacyBundle(
t_packagevec & bundle,
OUString const & url,
::rtl::Reference<AbortChannel> const & abortChannel,
- Reference<XCommandEnvironment> const & xCmdEnv,
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv,
bool skip_registration )
{
::ucbhelper::Content ucbContent( url, xCmdEnv );
@@ -1478,8 +1564,8 @@ void BackendImpl::PackageImpl::scanLegacyBundle(
OUString mediaType;
const Reference<deployment::XPackage> xPackage(
- bindBundleItem( path, OUString() /* detect */, xCmdEnv,
- false /* ignore detection errors */ ) );
+ bindBundleItem( path, OUString() /* detect */, false, OUString(),
+ xCmdEnv, false /* ignore detection errors */ ) );
if (xPackage.is()) {
const Reference<deployment::XPackageTypeInfo> xPackageType(
xPackage->getPackageType() );
@@ -1514,8 +1600,12 @@ void BackendImpl::PackageImpl::scanLegacyBundle(
}
}
-OUString BackendImpl::PackageImpl::getDisplayName() throw (RuntimeException)
+OUString BackendImpl::PackageImpl::getDisplayName()
+ throw (deployment::ExtensionRemovedException, RuntimeException)
{
+ if (m_bRemoved)
+ throw deployment::ExtensionRemovedException();
+
OUString sName = getDescriptionInfoset().getLocalizedDisplayName();
if (sName.getLength() == 0)
return m_displayName;
@@ -1523,6 +1613,24 @@ OUString BackendImpl::PackageImpl::getDisplayName() throw (RuntimeException)
return sName;
}
+::std::vector<Reference<deployment::XPackage> >
+BackendImpl::PackageImpl::getPackagesFromDb(
+ Reference<ucb::XCommandEnvironment> const & xCmdEnv)
+{
+ ::std::vector<Reference<deployment::XPackage> > retVector;
+
+ typedef ::std::vector< ::std::pair<OUString, OUString> >::const_iterator ITC;
+ for (ITC i = m_dbData.items.begin(); i != m_dbData.items.end(); i++)
+ {
+ Reference<deployment::XPackage> xExtension =
+ bindBundleItem(i->first, i->second, true, m_identifier, xCmdEnv);
+ OSL_ASSERT(xExtension.is());
+ retVector.push_back(xExtension);
+ }
+
+ return retVector;
+}
+
} // anon namespace
//==============================================================================
diff --git a/desktop/source/deployment/registry/package/makefile.mk b/desktop/source/deployment/registry/package/makefile.mk
index ccadc20703..203ce176d2 100644
--- a/desktop/source/deployment/registry/package/makefile.mk
+++ b/desktop/source/deployment/registry/package/makefile.mk
@@ -41,7 +41,7 @@ INCPRE += ..$/..$/inc
SLOFILES = \
$(SLO)$/dp_package.obj \
- $(SLO)$/dp_description.obj
+ $(SLO)$/dp_extbackenddb.obj
.INCLUDE : ..$/..$/target.pmk
.INCLUDE : target.mk
diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx
index b817c9b6aa..9e9f7a0336 100644
--- a/desktop/source/deployment/registry/script/dp_script.cxx
+++ b/desktop/source/deployment/registry/script/dp_script.cxx
@@ -39,12 +39,12 @@
#include "comphelper/servicedecl.hxx"
#include "svl/inettype.hxx"
#include "com/sun/star/util/XUpdatable.hpp"
-#include "com/sun/star/script/XLibraryContainer.hpp"
+#include "com/sun/star/script/XLibraryContainer3.hpp"
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
#include <com/sun/star/uri/XUriReferenceFactory.hpp>
-#include <com/sun/star/uri/XVndSunStarExpandUrl.hpp>
#include <memory>
+#include "dp_scriptbackenddb.hxx"
using namespace ::dp_misc;
using namespace ::com::sun::star;
@@ -80,6 +80,7 @@ class BackendImpl : public t_helper
virtual void processPackage_(
::osl::ResettableMutexGuard & guard,
bool registerPackage,
+ bool startup,
::rtl::Reference<AbortChannel> const & abortChannel,
Reference<XCommandEnvironment> const & xCmdEnv );
@@ -88,24 +89,30 @@ class BackendImpl : public t_helper
::rtl::Reference<BackendImpl> const & myBackend,
OUString const & url,
Reference<XCommandEnvironment> const &xCmdEnv,
- OUString const & scriptURL, OUString const & dialogURL );
+ OUString const & scriptURL, OUString const & dialogURL,
+ bool bRemoved, OUString const & identifier);
};
friend class PackageImpl;
// PackageRegistryBackend
virtual Reference<deployment::XPackage> bindPackage_(
OUString const & url, OUString const & mediaType,
+ sal_Bool bRemoved, OUString const & identifier,
Reference<XCommandEnvironment> const & xCmdEnv );
- rtl::OUString getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage );
- rtl::OUString expandURL( const rtl::OUString& aURL );
- Reference< ucb::XSimpleFileAccess > getFileAccess( void );
- Reference< ucb::XSimpleFileAccess > m_xSFA;
+ void addDataToDb(OUString const & url);
+ void deleteDataFromDb(OUString const & url);
+ bool isRegisteredInDb(OUString const & url);
+
+
+
+// Reference< ucb::XSimpleFileAccess > getFileAccess( void );
+// Reference< ucb::XSimpleFileAccess > m_xSFA;
const Reference<deployment::XPackageTypeInfo> m_xBasicLibTypeInfo;
const Reference<deployment::XPackageTypeInfo> m_xDialogLibTypeInfo;
Sequence< Reference<deployment::XPackageTypeInfo> > m_typeInfos;
-
+ std::auto_ptr<ScriptBackendDb> m_backendDb;
public:
BackendImpl( Sequence<Any> const & args,
Reference<XComponentContext> const & xComponentContext );
@@ -123,11 +130,12 @@ BackendImpl::PackageImpl::PackageImpl(
::rtl::Reference<BackendImpl> const & myBackend,
OUString const & url,
Reference<XCommandEnvironment> const &xCmdEnv,
- OUString const & scriptURL, OUString const & dialogURL )
+ OUString const & scriptURL, OUString const & dialogURL, bool bRemoved,
+ OUString const & identifier)
: Package( myBackend.get(), url,
OUString(), OUString(), // will be late-initialized
scriptURL.getLength() > 0 ? myBackend->m_xBasicLibTypeInfo
- : myBackend->m_xDialogLibTypeInfo ),
+ : myBackend->m_xDialogLibTypeInfo, bRemoved, identifier),
m_scriptURL( scriptURL ),
m_dialogURL( dialogURL )
{
@@ -168,6 +176,33 @@ BackendImpl::BackendImpl(
m_typeInfos[ 1 ] = m_xDialogLibTypeInfo;
OSL_ASSERT( ! transientMode() );
+
+ if (!transientMode())
+ {
+ OUString dbFile = makeURL(getCachePath(), OUSTR("backenddb.xml"));
+ m_backendDb.reset(
+ new ScriptBackendDb(getComponentContext(), dbFile));
+ }
+
+}
+void BackendImpl::addDataToDb(OUString const & url)
+{
+ if (m_backendDb.get())
+ m_backendDb->addEntry(url);
+}
+
+bool BackendImpl::isRegisteredInDb(OUString const & url)
+{
+ bool registered = false;
+ if (m_backendDb.get())
+ registered = m_backendDb->getEntry(url);
+ return registered;
+}
+
+void BackendImpl::deleteDataFromDb(OUString const & url)
+{
+ if (m_backendDb.get())
+ m_backendDb->removeEntry(url);
}
// XUpdatable
@@ -189,6 +224,7 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException)
//______________________________________________________________________________
Reference<deployment::XPackage> BackendImpl::bindPackage_(
OUString const & url, OUString const & mediaType_,
+ sal_Bool bRemoved, OUString const & identifier,
Reference<XCommandEnvironment> const & xCmdEnv )
{
OUString mediaType( mediaType_ );
@@ -222,22 +258,31 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
{
if (type.EqualsIgnoreCaseAscii("application"))
{
+ OUString dialogURL( makeURL( url, OUSTR("dialog.xlb") ) );
+ if (! create_ucb_content(
+ 0, dialogURL, xCmdEnv, false /* no throw */ )) {
+ dialogURL = OUString();
+ }
+
if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.basic-library"))
{
- OUString dialogURL( makeURL( url, OUSTR("dialog.xlb") ) );
+ OUString scriptURL( makeURL( url, OUSTR("script.xlb")));
if (! create_ucb_content(
- 0, dialogURL, xCmdEnv, false /* no throw */ )) {
- dialogURL = OUString();
+ 0, scriptURL, xCmdEnv, false /* no throw */ )) {
+ scriptURL = OUString();
}
- return new PackageImpl( this, url, xCmdEnv,
- makeURL( url, OUSTR("script.xlb") ),
- dialogURL );
+
+ return new PackageImpl(
+ this, url, xCmdEnv, scriptURL,
+ dialogURL, bRemoved, identifier);
}
else if (subType.EqualsIgnoreCaseAscii(
"vnd.sun.star.dialog-library")) {
- return new PackageImpl( this, url, xCmdEnv,
- OUString() /* no script lib */,
- makeURL( url, OUSTR("dialog.xlb") ) );
+ return new PackageImpl(
+ this, url, xCmdEnv,
+ OUString() /* no script lib */,
+ dialogURL,
+ bRemoved, identifier);
}
}
}
@@ -247,90 +292,6 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
static_cast<sal_Int16>(-1) );
}
-rtl::OUString BackendImpl::getRegisteredFlagFileURL( Reference< deployment::XPackage > xPackage )
-{
- rtl::OUString aRetURL;
- if( !xPackage.is() )
- return aRetURL;
- rtl::OUString aHelpURL = xPackage->getURL();
- aRetURL = expandURL( aHelpURL );
- aRetURL += rtl::OUString::createFromAscii( "/RegisteredFlag" );
- return aRetURL;
-}
-
-rtl::OUString BackendImpl::expandURL( const rtl::OUString& aURL )
-{
- static Reference< util::XMacroExpander > xMacroExpander;
- static Reference< uri::XUriReferenceFactory > xFac;
-
- if( !xMacroExpander.is() || !xFac.is() )
- {
- Reference<XComponentContext> const & xContext = getComponentContext();
- if( xContext.is() )
- {
- xFac = Reference< uri::XUriReferenceFactory >(
- xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii(
- "com.sun.star.uri.UriReferenceFactory"), xContext ) , UNO_QUERY );
- }
- if( !xFac.is() )
- {
- throw RuntimeException(
- ::rtl::OUString::createFromAscii(
- "dp_registry::backend::help::BackendImpl::expandURL(), "
- "could not instatiate UriReferenceFactory." ),
- Reference< XInterface >() );
- }
-
- xMacroExpander = Reference< util::XMacroExpander >(
- xContext->getValueByName(
- ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.util.theMacroExpander" ) ),
- UNO_QUERY_THROW );
- }
-
- rtl::OUString aRetURL = aURL;
- if( xMacroExpander.is() )
- {
- Reference< uri::XUriReference > uriRef;
- for (;;)
- {
- uriRef = Reference< uri::XUriReference >( xFac->parse( aRetURL ), UNO_QUERY );
- if ( uriRef.is() )
- {
- Reference < uri::XVndSunStarExpandUrl > sxUri( uriRef, UNO_QUERY );
- if( !sxUri.is() )
- break;
-
- aRetURL = sxUri->expand( xMacroExpander );
- }
- }
- }
- return aRetURL;
-}
-
-Reference< ucb::XSimpleFileAccess > BackendImpl::getFileAccess( void )
-{
- if( !m_xSFA.is() )
- {
- Reference<XComponentContext> const & xContext = getComponentContext();
- if( xContext.is() )
- {
- m_xSFA = Reference< ucb::XSimpleFileAccess >(
- xContext->getServiceManager()->createInstanceWithContext(
- rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ),
- xContext ), UNO_QUERY );
- }
- if( !m_xSFA.is() )
- {
- throw RuntimeException(
- ::rtl::OUString::createFromAscii(
- "dp_registry::backend::help::BackendImpl::getFileAccess(), "
- "could not instatiate SimpleFileAccess." ),
- Reference< XInterface >() );
- }
- }
- return m_xSFA;
-}
-
//##############################################################################
// Package
@@ -359,20 +320,18 @@ BackendImpl::PackageImpl::isRegistered_(
BackendImpl * that = getMyBackend();
Reference< deployment::XPackage > xThisPackage( this );
- rtl::OUString aRegisteredFlagFile = that->getRegisteredFlagFileURL( xThisPackage );
-
- Reference< ucb::XSimpleFileAccess > xSFA = that->getFileAccess();
- bool bReg = xSFA->exists( aRegisteredFlagFile );
+ bool registered = that->isRegisteredInDb(getURL());
return beans::Optional< beans::Ambiguous<sal_Bool> >(
true /* IsPresent */,
- beans::Ambiguous<sal_Bool>( bReg, false /* IsAmbiguous */ ) );
+ beans::Ambiguous<sal_Bool>( registered, false /* IsAmbiguous */ ) );
}
//______________________________________________________________________________
void BackendImpl::PackageImpl::processPackage_(
::osl::ResettableMutexGuard &,
bool doRegisterPackage,
+ bool startup,
::rtl::Reference<AbortChannel> const &,
Reference<XCommandEnvironment> const & xCmdEnv )
{
@@ -381,15 +340,13 @@ void BackendImpl::PackageImpl::processPackage_(
BackendImpl * that = getMyBackend();
Reference< deployment::XPackage > xThisPackage( this );
- rtl::OUString aRegisteredFlagFile = that->getRegisteredFlagFileURL( xThisPackage );
- Reference< ucb::XSimpleFileAccess > xSFA = that->getFileAccess();
Reference<XComponentContext> const & xComponentContext = that->getComponentContext();
bool bScript = (m_scriptURL.getLength() > 0);
- Reference<css::script::XLibraryContainer> xScriptLibs;
+ Reference<css::script::XLibraryContainer3> xScriptLibs;
bool bDialog = (m_dialogURL.getLength() > 0);
- Reference<css::script::XLibraryContainer> xDialogLibs;
+ Reference<css::script::XLibraryContainer3> xDialogLibs;
bool bRunning = office_is_running();
if( bRunning )
@@ -410,52 +367,121 @@ void BackendImpl::PackageImpl::processPackage_(
xComponentContext ), UNO_QUERY_THROW );
}
}
-
+ bool bRegistered = getMyBackend()->isRegisteredInDb(getURL());
if( !doRegisterPackage )
{
- if( xSFA->exists( aRegisteredFlagFile ) )
+ //We cannot just call removeLibrary(name) because this could remove a
+ //script which was added by an extension in a different repository. For
+ //example, extension foo is contained in the bundled repository and then
+ //the user adds it it to the user repository. The extension manager will
+ //then register the new script and revoke the script from the bundled
+ //extension. removeLibrary(name) would now remove the script from the
+ //user repository. That is, the script of the newly added user extension does
+ //not work anymore. Therefore we must check if the currently active
+ //script comes in fact from the currently processed extension.
+
+ if (bRegistered)
{
- xSFA->kill( aRegisteredFlagFile );
-
- if( bScript && xScriptLibs.is() && xScriptLibs->hasByName( m_name ) )
- xScriptLibs->removeLibrary( m_name );
-
- if( bDialog && xDialogLibs.is() && xDialogLibs->hasByName( m_dialogName ) )
- xDialogLibs->removeLibrary( m_dialogName );
+ //we also prevent and live deployment at startup
+ if (!isRemoved() && !startup)
+ {
+ if (bScript && xScriptLibs.is() && xScriptLibs->hasByName(m_name))
+ {
+ const OUString sScriptUrl = xScriptLibs->getOriginalLibraryLinkURL(m_name);
+ if (sScriptUrl.equals(m_scriptURL))
+ xScriptLibs->removeLibrary(m_name);
+ }
+
+ if (bDialog && xDialogLibs.is() && xDialogLibs->hasByName(m_dialogName))
+ {
+ const OUString sDialogUrl = xDialogLibs->getOriginalLibraryLinkURL(m_dialogName);
+ if (sDialogUrl.equals(m_dialogURL))
+ xDialogLibs->removeLibrary(m_dialogName);
+ }
+ }
+ getMyBackend()->deleteDataFromDb(getURL());
+ return;
}
- return;
}
-
- if( xSFA->exists( aRegisteredFlagFile ) )
+ if (bRegistered)
return; // Already registered
// Update LibraryContainer
bool bScriptSuccess = false;
const bool bReadOnly = false;
- if( bScript && xScriptLibs.is() && !xScriptLibs->hasByName( m_name ) )
- {
- xScriptLibs->createLibraryLink( m_name, m_scriptURL, bReadOnly );
- bScriptSuccess = xScriptLibs->hasByName( m_name );
- }
bool bDialogSuccess = false;
- if( bDialog && xDialogLibs.is() && !xDialogLibs->hasByName( m_dialogName ) )
+ if (!startup)
{
- xDialogLibs->createLibraryLink( m_dialogName, m_dialogURL, bReadOnly );
- bDialogSuccess = xDialogLibs->hasByName( m_dialogName );
- }
+ //If there is a bundled extension, and the user installes the same extension
+ //then the script from the bundled extension must be removed. If this does not work
+ //then live deployment does not work for scripts.
+ if (bScript && xScriptLibs.is())
+ {
+ bool bCanAdd = true;
+ if (xScriptLibs->hasByName(m_name))
+ {
+ const OUString sOriginalUrl = xScriptLibs->getOriginalLibraryLinkURL(m_name);
+ //We assume here that library names in extensions are unique, which may not be the case
+ //ToDo: If the script exist in another extension, then both extensions must have the
+ //same id
+ if (sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE"))
+ || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE"))
+ || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$BUNDLED_EXTENSIONS")))
+ {
+ xScriptLibs->removeLibrary(m_name);
+ bCanAdd = true;
+ }
+ else
+ {
+ bCanAdd = false;
+ }
+ }
+
+ if (bCanAdd)
+ {
+ xScriptLibs->createLibraryLink( m_name, m_scriptURL, bReadOnly );
+ bScriptSuccess = xScriptLibs->hasByName( m_name );
+ }
+ }
+
+ if (bDialog && xDialogLibs.is())
+ {
+ bool bCanAdd = true;
+ if (xDialogLibs->hasByName(m_dialogName))
+ {
+ const OUString sOriginalUrl = xDialogLibs->getOriginalLibraryLinkURL(m_dialogName);
+ //We assume here that library names in extensions are unique, which may not be the case
+ //ToDo: If the script exist in another extension, then both extensions must have the
+ //same id
+ if (sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE"))
+ || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE"))
+ || sOriginalUrl.match(OUSTR("vnd.sun.star.expand:$BUNDLED_EXTENSIONS")))
+ {
+ xDialogLibs->removeLibrary(m_dialogName);
+ bCanAdd = true;
+ }
+ else
+ {
+ bCanAdd = false;
+ }
+ }
+
+ if (bCanAdd)
+ {
+ xDialogLibs->createLibraryLink( m_dialogName, m_dialogURL, bReadOnly );
+ bDialogSuccess = xDialogLibs->hasByName(m_dialogName);
+ }
+ }
+ }
bool bSuccess = bScript || bDialog; // Something must have happened
- if( bRunning )
+ if( bRunning && !startup)
if( (bScript && !bScriptSuccess) || (bDialog && !bDialogSuccess) )
bSuccess = false;
- if( bSuccess && !xSFA->exists( aRegisteredFlagFile ) )
- {
- Reference< io::XOutputStream > xOutputStream = xSFA->openFileWrite( aRegisteredFlagFile );
- if( xOutputStream.is() )
- xOutputStream->closeOutput();
- }
+ if (bSuccess)
+ getMyBackend()->addDataToDb(getURL());
}
} // anon namespace
diff --git a/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx b/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx
new file mode 100644
index 0000000000..d8e47eecb4
--- /dev/null
+++ b/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dp_package.cxx,v $
+ * $Revision: 1.34.16.2 $
+ *
+ * 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_desktop.hxx"
+
+#include "rtl/string.h"
+#include "cppuhelper/exc_hlp.hxx"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/xml/dom/XDocument.hpp"
+#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
+#include "dp_misc.h"
+#include "dp_scriptbackenddb.hxx"
+
+
+namespace css = ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+#define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/script-registry/2010"
+#define NS_PREFIX "script"
+#define ROOT_ELEMENT_NAME "script-backend-db"
+#define KEY_ELEMENT_NAME "script"
+
+namespace dp_registry {
+namespace backend {
+namespace script {
+
+ScriptBackendDb::ScriptBackendDb(
+ Reference<XComponentContext> const & xContext,
+ ::rtl::OUString const & url):RegisteredDb(xContext, url)
+{
+
+}
+
+OUString ScriptBackendDb::getDbNSName()
+{
+ return OUSTR(EXTENSION_REG_NS);
+}
+
+OUString ScriptBackendDb::getNSPrefix()
+{
+ return OUSTR(NS_PREFIX);
+}
+
+OUString ScriptBackendDb::getRootElementName()
+{
+ return OUSTR(ROOT_ELEMENT_NAME);
+}
+
+OUString ScriptBackendDb::getKeyElementName()
+{
+ return OUSTR(KEY_ELEMENT_NAME);
+}
+
+
+
+} // namespace executable
+} // namespace backend
+} // namespace dp_registry
+
diff --git a/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx b/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx
new file mode 100644
index 0000000000..6b6d4d364c
--- /dev/null
+++ b/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dp_backend.h,v $
+ * $Revision: 1.18 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#if ! defined INCLUDED_DP_SCRIPTBACKENDDB_HXX
+#define INCLUDED_DP_SCRIPTBACKENDDB_HXX
+
+#include "rtl/ustring.hxx"
+#include "dp_backenddb.hxx"
+#include "boost/optional.hpp"
+namespace css = ::com::sun::star;
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class XComponentContext;
+ }
+}}}
+
+namespace dp_registry {
+namespace backend {
+namespace script {
+
+/* The XML file stores the extensions which are currently registered.
+ They will be removed when they are revoked.
+ */
+class ScriptBackendDb: public dp_registry::backend::RegisteredDb
+{
+protected:
+ virtual ::rtl::OUString getDbNSName();
+
+ virtual ::rtl::OUString getNSPrefix();
+
+ virtual ::rtl::OUString getRootElementName();
+
+ virtual ::rtl::OUString getKeyElementName();
+
+
+public:
+
+ ScriptBackendDb( css::uno::Reference<css::uno::XComponentContext> const & xContext,
+ ::rtl::OUString const & url);
+};
+
+
+
+}
+}
+}
+#endif
+
diff --git a/desktop/source/deployment/registry/script/makefile.mk b/desktop/source/deployment/registry/script/makefile.mk
index ae159914a5..708def3580 100644
--- a/desktop/source/deployment/registry/script/makefile.mk
+++ b/desktop/source/deployment/registry/script/makefile.mk
@@ -41,7 +41,8 @@ INCPRE += ..$/..$/inc
SLOFILES = \
$(SLO)$/dp_script.obj \
- $(SLO)$/dp_lib_container.obj
+ $(SLO)$/dp_lib_container.obj \
+ $(SLO)$/dp_scriptbackenddb.obj
.INCLUDE : ..$/..$/target.pmk
.INCLUDE : target.mk
diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx
index 049e9c9e88..5609affb0c 100644
--- a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx
+++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx
@@ -77,12 +77,15 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
virtual void processPackage_(
::osl::ResettableMutexGuard & guard,
bool registerPackage,
+ bool startup,
::rtl::Reference<AbortChannel> const & abortChannel,
Reference<XCommandEnvironment> const & xCmdEnv );
public:
- PackageImpl( ::rtl::Reference<BackendImpl> const & myBackend,
- OUString const & url, OUString const & libType );
+ PackageImpl(
+ ::rtl::Reference<BackendImpl> const & myBackend,
+ OUString const & url, OUString const & libType, bool bRemoved,
+ OUString const & identifier);
// XPackage
virtual OUString SAL_CALL getDescription() throw (RuntimeException);
};
@@ -91,6 +94,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
// PackageRegistryBackend
virtual Reference<deployment::XPackage> bindPackage_(
OUString const & url, OUString const & mediaType,
+ sal_Bool bRemoved, OUString const & identifier,
Reference<XCommandEnvironment> const & xCmdEnv );
const Reference<deployment::XPackageTypeInfo> m_xTypeInfo;
@@ -131,9 +135,10 @@ OUString BackendImpl::PackageImpl::getDescription() throw (RuntimeException)
//______________________________________________________________________________
BackendImpl::PackageImpl::PackageImpl(
::rtl::Reference<BackendImpl> const & myBackend,
- OUString const & url, OUString const & libType )
+ OUString const & url, OUString const & libType, bool bRemoved,
+ OUString const & identifier)
: Package( myBackend.get(), url, OUString(), OUString(),
- myBackend->m_xTypeInfo ),
+ myBackend->m_xTypeInfo, bRemoved, identifier),
m_descr(libType)
{
initPackageHandler();
@@ -217,8 +222,8 @@ BackendImpl::getSupportedPackageTypes() throw (RuntimeException)
// PackageRegistryBackend
//______________________________________________________________________________
Reference<deployment::XPackage> BackendImpl::bindPackage_(
- OUString const & url, OUString const & mediaType_,
- Reference<XCommandEnvironment> const & xCmdEnv )
+ OUString const & url, OUString const & mediaType_, sal_Bool bRemoved,
+ OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv )
{
OUString mediaType( mediaType_ );
if (mediaType.getLength() == 0)
@@ -294,7 +299,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
dp_misc::TRACE(OUSTR(" BackEnd detected lang = ") + lang + OUSTR("\n"));
dp_misc::TRACE(OUSTR(" for url ") + sParcelDescURL + OUSTR("\n") );
dp_misc::TRACE("******************************\n");
- return new PackageImpl( this, url, sfwkLibType );
+ return new PackageImpl( this, url, sfwkLibType, bRemoved, identifier);
}
}
}
@@ -322,6 +327,10 @@ void BackendImpl::PackageImpl:: initPackageHandler()
{
aContext <<= OUSTR("share");
}
+ else if ( that->m_eContext == CONTEXT_BUNDLED )
+ {
+ aContext <<= OUSTR("bundled");
+ }
else
{
OSL_ASSERT( 0 );
@@ -363,6 +372,7 @@ BackendImpl::PackageImpl::isRegistered_(
void BackendImpl::PackageImpl::processPackage_(
::osl::ResettableMutexGuard &,
bool doRegisterPackage,
+ bool /* startup */,
::rtl::Reference<AbortChannel> const &,
Reference<XCommandEnvironment> const & )
{
diff --git a/desktop/source/deployment/unopkg/unopkg.src b/desktop/source/deployment/unopkg/unopkg.src
index e044c0efc2..b40b505af2 100644
--- a/desktop/source/deployment/unopkg/unopkg.src
+++ b/desktop/source/deployment/unopkg/unopkg.src
@@ -27,15 +27,10 @@
#include "deployment.hrc"
-String RID_STR_UNOPKG_NO_SHARED_ALLOWED
-{
- Text [ en-US ] = "The option \"--shared\" cannot be used to install the extension \'%NAME\', "
- "because every user has to agree to the license agreement of the extension. The extension will not be installed.";
-};
String RID_STR_UNOPKG_ACCEPT_LIC_1
{
- Text [ en-US ] = "Extension License Agreement:";
+ Text [ en-US ] = "Extension Software License Agreement of $NAME:";
};
String RID_STR_UNOPKG_ACCEPT_LIC_2
diff --git a/desktop/source/inc/exithelper.hxx b/desktop/source/inc/exithelper.hxx
index 682410c6b7..1d3e8a99dc 100644
--- a/desktop/source/inc/exithelper.hxx
+++ b/desktop/source/inc/exithelper.hxx
@@ -58,6 +58,8 @@ class ExitHelper
E_FATAL_ERROR = 333, // Only the low 8 bits are significant 333 % 256 = 77
/// user force automatic restart after crash
E_CRASH_WITH_RESTART = 79,
+ /// the office restarts itself
+ E_NORMAL_RESTART = 81
};
};
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 54902e73a1..6396ef1091 100644..100755
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -413,7 +413,7 @@ static void insertSorted(migrations_available& rAvailableMigrations, supported_m
{
rAvailableMigrations.insert(pIter, aSupportedMigration );
bInserted = true;
- break;
+ break; // i111193: insert invalidates iterator!
}
++pIter;
}
diff --git a/desktop/source/migration/services/cexports.cxx b/desktop/source/migration/services/cexports.cxx
index b1449b0408..a5b9bc8aab 100644
--- a/desktop/source/migration/services/cexports.cxx
+++ b/desktop/source/migration/services/cexports.cxx
@@ -31,7 +31,7 @@
#include "cppuhelper/implementationentry.hxx"
#include "basicmigration.hxx"
#include "wordbookmigration.hxx"
-#include "extensionmigration.hxx"
+//#include "extensionmigration.hxx"
extern "C"
{
@@ -48,11 +48,11 @@ extern "C"
migration::WordbookMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory,
0, 0
},
- {
- migration::ExtensionMigration_create, migration::ExtensionMigration_getImplementationName,
- migration::ExtensionMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory,
- 0, 0
- },
+// {
+// migration::ExtensionMigration_create, migration::ExtensionMigration_getImplementationName,
+// migration::ExtensionMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory,
+// 0, 0
+// },
{ 0, 0, 0, 0, 0, 0 }
};
diff --git a/desktop/source/migration/services/extensionmigration.cxx b/desktop/source/migration/services/extensionmigration.cxx
deleted file mode 100755
index dc268aad37..0000000000
--- a/desktop/source/migration/services/extensionmigration.cxx
+++ /dev/null
@@ -1,540 +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_desktop.hxx"
-#include "extensionmigration.hxx"
-#include <tools/urlobj.hxx>
-#include <unotools/bootstrap.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-#include <ucbhelper/content.hxx>
-#include <com/sun/star/ucb/XCommandInfo.hpp>
-#include <com/sun/star/ucb/TransferInfo.hpp>
-#include <com/sun/star/ucb/NameClash.hpp>
-#include "comphelper/processfactory.hxx"
-#include "com/sun/star/deployment/XPackageManagerFactory.hpp"
-#include "com/sun/star/ucb/XCommandEnvironment.hpp"
-#include "com/sun/star/xml/sax/XParser.hpp"
-#include "rtl/instance.hxx"
-#include "osl/file.hxx"
-#include "osl/thread.h"
-
-#include "xmlscript/xmllib_imexp.hxx"
-#include "../../deployment/inc/dp_ucb.h"
-
-#ifdef SYSTEM_DB
-#include <db.h>
-#else
-#include <berkeleydb/db.h>
-#endif
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-namespace {
-
- struct LibDescriptor :
- public rtl::StaticWithInit<const ::xmlscript::LibDescriptorArray, LibDescriptor> {
- const ::xmlscript::LibDescriptorArray operator () () {
-
-
- return ::xmlscript::LibDescriptorArray();
- }
-};
-}
-//.........................................................................
-namespace migration
-{
-//.........................................................................
-
-
- static ::rtl::OUString sExtensionSubDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/uno_packages/" ) );
- static ::rtl::OUString sSubDirName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cache" ) );
- static ::rtl::OUString sConfigDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data" ) );
- static ::rtl::OUString sOrgDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org" ) );
- static ::rtl::OUString sExcludeDir1 = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org" ) );
- static ::rtl::OUString sExcludeDir2 = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org/openoffice" ) );
-
- static ::rtl::OUString sBasicType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.basic-library"));
- static ::rtl::OUString sDialogType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.dialog-library"));
-
- static ::rtl::OUString sConfigurationDataType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.configuration-data"));
- static ::rtl::OUString sConfigurationSchemaType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.configuration-schema"));
-
- // =============================================================================
- // component operations
- // =============================================================================
-
- ::rtl::OUString ExtensionMigration_getImplementationName()
- {
- static ::rtl::OUString* pImplName = 0;
- if ( !pImplName )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !pImplName )
- {
- static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.desktop.migration.Extensions" ) );
- pImplName = &aImplName;
- }
- }
- return *pImplName;
- }
-
- // -----------------------------------------------------------------------------
-
- Sequence< ::rtl::OUString > ExtensionMigration_getSupportedServiceNames()
- {
- static Sequence< ::rtl::OUString >* pNames = 0;
- if ( !pNames )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !pNames )
- {
- static Sequence< ::rtl::OUString > aNames(1);
- aNames.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.migration.Extensions" ) );
- pNames = &aNames;
- }
- }
- return *pNames;
- }
-
- // =============================================================================
- // ExtensionMigration
- // =============================================================================
-
- ExtensionMigration::ExtensionMigration(Reference< XComponentContext > const & ctx) :
- m_ctx(ctx)
- {
- }
-
- // -----------------------------------------------------------------------------
-
- ExtensionMigration::~ExtensionMigration()
- {
- }
-
- ::osl::FileBase::RC ExtensionMigration::checkAndCreateDirectory( INetURLObject& rDirURL )
- {
- ::osl::FileBase::RC aResult = ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) );
- if ( aResult == ::osl::FileBase::E_NOENT )
- {
- INetURLObject aBaseURL( rDirURL );
- aBaseURL.removeSegment();
- checkAndCreateDirectory( aBaseURL );
- return ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) );
- }
- else
- {
- return aResult;
- }
- }
-
- void ExtensionMigration::prepareBasicLibs()
- {
- prepareBasicLibs(m_sSourceDir + ::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("/user/basic/script.xlc")), m_scriptElements);
- prepareBasicLibs(m_sSourceDir + ::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("/user/basic/dialog.xlc")), m_dialogElements);
- }
-
- void ExtensionMigration::prepareBasicLibs(const ::rtl::OUString & sURL,
- ::xmlscript::LibDescriptorArray & out_elements)
- {
-
- ::ucbhelper::Content ucb_content;
- if (dp_misc::create_ucb_content( &ucb_content, sURL,
- uno::Reference< ucb::XCommandEnvironment>(), false /* no throw */ ))
- {
- uno::Reference<xml::sax::XParser> xParser(
- m_ctx->getServiceManager()->createInstanceWithContext(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")),
- m_ctx ), UNO_QUERY_THROW );
-
- xParser->setDocumentHandler( ::xmlscript::importLibraryContainer( &out_elements ) );
- xml::sax::InputSource source;
- source.aInputStream = ucb_content.openStream();
- source.sSystemId = ucb_content.getURL();
- xParser->parseStream( source );
- }
- //else
- //The file need not exists
- }
- /* Checks if basic package is enabled in StarOffice 8. This is the case when the dialog.xlc or
- the script.xlc in the user installation contains an entry for this package.
- The passed package MUST be a basic package.
- */
- bool ExtensionMigration::isBasicPackageEnabled( const uno::Reference< deployment::XPackage > & xPkg)
- {
- ::rtl::OUString sScriptURL = xPkg->getURL();
- if ( sScriptURL[ sScriptURL.getLength()-1 ] != '/' )
- sScriptURL += ::rtl::OUString::createFromAscii("/");
- sScriptURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("script.xlb") );
-
- bool bEntryFound = false;
- for ( sal_Int32 nPos = m_scriptElements.mnLibCount; nPos--; )
- {
- ::xmlscript::LibDescriptor const & descr =
- m_scriptElements.mpLibs[ nPos ];
-
- if (descr.aStorageURL.equals(sScriptURL))
- {
- bEntryFound = true;
- break;
- }
- }
-
- ::rtl::OUString sDialogURL = xPkg->getURL();
- if ( sDialogURL[ sDialogURL.getLength()-1 ] != '/' )
- sDialogURL += ::rtl::OUString::createFromAscii("/");
- sScriptURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("dialog.xlb") );
-
- if (!bEntryFound)
- {
- for ( sal_Int32 nPos = m_dialogElements.mnLibCount; nPos--; )
- {
- ::xmlscript::LibDescriptor const & descr =
- m_dialogElements.mpLibs[ nPos ];
-
- if (descr.aStorageURL.equals(sDialogURL))
- {
- bEntryFound = true;
- break;
- }
- }
- }
- return bEntryFound;
- }
- /* This function only registers basic and dialog packages.
- */
- void ExtensionMigration::registerBasicPackage( const uno::Reference< deployment::XPackage > & xPkg)
- {
- const ::rtl::OUString sMediaType = xPkg->getPackageType()->getMediaType();
- if ( (sMediaType.equals(sBasicType) || sMediaType.equals(sDialogType))
- && isBasicPackageEnabled(xPkg))
- {
- xPkg->registerPackage(uno::Reference< task::XAbortChannel >(),
- uno::Reference< ucb::XCommandEnvironment> ());
- }
- }
-
- bool ExtensionMigration::processExtensions( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir )
- {
- if (!copy(sSourceDir, sTargetDir))
- return false;
-
- // Find all basic and script packages and reregister them
- uno::Reference< deployment::XPackageManagerFactory > xPMF;
- if (! ( m_ctx->getValueByName( ::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.deployment.thePackageManagerFactory")))
- >>= xPMF))
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "ExtensionsMigration: could not get thePackageManagerFactory")), 0);
-
- const uno::Reference< deployment::XPackageManager > xPackageMgr =
- xPMF->getPackageManager(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")));
-
- if (!xPackageMgr.is())
- throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "ExtensionsMigration: could not get XPackageManager")), 0);
-
- const uno::Sequence< uno::Reference< deployment::XPackage > > allPackages =
- xPackageMgr->getDeployedPackages(
- uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ());
-
- for (int i = 0; i < allPackages.getLength(); i ++)
- {
- const uno::Reference< deployment::XPackage > aPackage = allPackages[i];
- if ( aPackage->isBundle() )
- {
- const uno::Sequence< uno::Reference < deployment::XPackage > > seqPkg =
- aPackage->getBundle(
- uno::Reference< task::XAbortChannel >(),
- uno::Reference< ucb::XCommandEnvironment> ());
-
- for ( int k = 0; k < seqPkg.getLength(); k++ )
- registerBasicPackage(seqPkg[k]);
-
- for (int l = 0; l < seqPkg.getLength(); l++)
- {
- const ::rtl::OUString sMediaType = seqPkg[l]->getPackageType()->getMediaType();
- beans::Optional<beans::Ambiguous<sal_Bool> > opt =
- seqPkg[l]->isRegistered(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ());
- bool bRegistered = opt.IsPresent && opt.Value.IsAmbiguous == sal_False && opt.Value.Value == sal_True ? true : false;
-
- if ( bRegistered && !sMediaType.equals(sBasicType) && !sMediaType.equals(sDialogType) )
- {
- seqPkg[l]->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ());
- seqPkg[l]->registerPackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ());
- }
- }
- }
- else
- {
- registerBasicPackage(aPackage);
- {
- aPackage->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ());
- aPackage->registerPackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ());
- }
- }
- }
-
-
- return true;
-
- }
-
-bool ExtensionMigration::isCompatibleBerkleyDb(const ::rtl::OUString& sSourceDir)
-{
- try
- {
- ::rtl::OUString sDb(sSourceDir + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "/uno_packages.db")));
- //check if the db exist at all. If not then the call to db_create would create
- //the file.
- ::osl::File f(sDb);
- if (::osl::File::E_None != f.open(OpenFlag_Read))
- {
- f.close();
- return false;
- }
- f.close();
-
- //create a system path
- ::rtl::OUString sSysPath;
- if (::osl::File::getSystemPathFromFileURL(sDb, sSysPath ) != ::osl::File::E_None)
- return false;
-
- ::rtl::OString cstr_sysPath(
- ::rtl::OUStringToOString( sSysPath, osl_getThreadTextEncoding() ) );
- char const * pcstr_sysPath = cstr_sysPath.getStr();
-
- //Open the db. If it works then we assume that the file was written with a
- //compatible version of Berkeley Db
- DB* pDB = NULL;
- //using DB_RDONLY will return an "Invalid argument" error.
- //DB_CREATE: only creates the file if it does not exist.
- //An existing db is not modified.
- if (0 != db_create(& pDB, 0, DB_CREATE))
- return false;
-
- if (0 != pDB->open(pDB, 0, pcstr_sysPath , 0, DB_HASH, DB_RDONLY, 0664 /* fs mode */))
- return false;
-
- pDB->close(pDB, 0);
- }
- catch (uno::Exception& )
- {
- return false;
- }
-
- return true;
-}
-
-bool ExtensionMigration::copy( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir )
-{
- bool bRet = false;
- if (! isCompatibleBerkleyDb(sSourceDir))
- return false;
-
- INetURLObject aSourceObj( sSourceDir );
- INetURLObject aDestObj( sTargetDir );
- String aName = aDestObj.getName();
- aDestObj.removeSegment();
- aDestObj.setFinalSlash();
-
- try
- {
- ::ucbhelper::Content aDestPath( aDestObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () );
- uno::Reference< ucb::XCommandInfo > xInfo = aDestPath.getCommands();
- ::rtl::OUString aTransferName = ::rtl::OUString::createFromAscii( "transfer" );
- if ( xInfo->hasCommandByName( aTransferName ) )
- {
- aDestPath.executeCommand( aTransferName, uno::makeAny(
- ucb::TransferInfo( sal_False, aSourceObj.GetMainURL( INetURLObject::NO_DECODE ), aName, ucb::NameClash::OVERWRITE ) ) );
- bRet = true;
- }
- }
- catch( uno::Exception& )
- {
- }
-
- return bRet;
-}
-
-
- // -----------------------------------------------------------------------------
- // XServiceInfo
- // -----------------------------------------------------------------------------
-
- ::rtl::OUString ExtensionMigration::getImplementationName() throw (RuntimeException)
- {
- return ExtensionMigration_getImplementationName();
- }
-
- // -----------------------------------------------------------------------------
-
- sal_Bool ExtensionMigration::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
- {
- Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
- const ::rtl::OUString* pNames = aNames.getConstArray();
- const ::rtl::OUString* pEnd = pNames + aNames.getLength();
- for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
- ;
-
- return pNames != pEnd;
- }
-
- // -----------------------------------------------------------------------------
-
- Sequence< ::rtl::OUString > ExtensionMigration::getSupportedServiceNames() throw (RuntimeException)
- {
- return ExtensionMigration_getSupportedServiceNames();
- }
-
- // -----------------------------------------------------------------------------
- // XInitialization
- // -----------------------------------------------------------------------------
-
- void ExtensionMigration::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
- {
- ::osl::MutexGuard aGuard( m_aMutex );
-
- const Any* pIter = aArguments.getConstArray();
- const Any* pEnd = pIter + aArguments.getLength();
- for ( ; pIter != pEnd ; ++pIter )
- {
- beans::NamedValue aValue;
- *pIter >>= aValue;
- if ( aValue.Name.equalsAscii( "UserData" ) )
- {
- if ( !(aValue.Value >>= m_sSourceDir) )
- {
- OSL_ENSURE( false, "ExtensionMigration::initialize: argument UserData has wrong type!" );
- }
- break;
- }
- }
- prepareBasicLibs();
- }
-
- TStringVectorPtr getContent( const ::rtl::OUString& rBaseURL )
- {
- TStringVectorPtr aResult( new TStringVector );
- ::osl::Directory aDir( rBaseURL);
- if ( aDir.open() == ::osl::FileBase::E_None )
- {
- // iterate over directory content
- TStringVector aSubDirs;
- ::osl::DirectoryItem aItem;
- while ( aDir.getNextItem( aItem ) == ::osl::FileBase::E_None )
- {
- ::osl::FileStatus aFileStatus( FileStatusMask_Type | FileStatusMask_FileURL );
- if ( aItem.getFileStatus( aFileStatus ) == ::osl::FileBase::E_None )
- aResult->push_back( aFileStatus.getFileURL() );
- }
- }
-
- return aResult;
- }
-
- // -----------------------------------------------------------------------------
- // XJob
- // -----------------------------------------------------------------------------
-
-void ExtensionMigration::copyConfig( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir )
-{
- ::rtl::OUString sEx1( m_sSourceDir );
- sEx1 += sExcludeDir1;
- ::rtl::OUString sEx2( m_sSourceDir );
- sEx2 += sExcludeDir2;
-
- TStringVectorPtr aList = getContent( sSourceDir );
- TStringVector::const_iterator aI = aList->begin();
- while ( aI != aList->end() )
- {
- ::rtl::OUString sSourceLocalName = aI->copy( sSourceDir.getLength() );
- ::rtl::OUString aTemp = aI->copy( m_sSourceDir.getLength() );
- if ( aTemp != sExcludeDir1 && aTemp != sExcludeDir2 )
- {
- ::rtl::OUString sTargetName = sTargetDir + sSourceLocalName;
- copy( (*aI), sTargetName );
- }
- ++aI;
- }
-}
-
- Any ExtensionMigration::execute( const Sequence< beans::NamedValue >& )
- throw (lang::IllegalArgumentException, Exception, RuntimeException)
- {
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ::utl::Bootstrap::PathStatus aStatus = ::utl::Bootstrap::locateUserInstallation( m_sTargetDir );
- if ( aStatus == ::utl::Bootstrap::PATH_EXISTS )
- {
- // copy all extensions
- ::rtl::OUString sTargetDir(m_sTargetDir), sSourceDir( m_sSourceDir );
- sTargetDir += sExtensionSubDir;
- sSourceDir += sExtensionSubDir;
- sSourceDir += sSubDirName;
- sTargetDir += sSubDirName;
- processExtensions( sSourceDir, sTargetDir );
-
- // copy all user config settings in user/registry/data (except user/registry/data/org)
- sSourceDir = m_sSourceDir;
- sSourceDir += sConfigDir;
- sTargetDir = m_sTargetDir;
- sTargetDir += sConfigDir;
- copyConfig( sSourceDir, sTargetDir );
-
- // copy all user config settings in user/registry/data/org (except user/registry/data/org/openoffice)
- sSourceDir = m_sSourceDir;
- sSourceDir += sOrgDir;
- sTargetDir = m_sTargetDir;
- sTargetDir += sOrgDir;
- copyConfig( sSourceDir, sTargetDir );
- }
-
- return Any();
- }
-
- // =============================================================================
- // component operations
- // =============================================================================
-
- Reference< XInterface > SAL_CALL ExtensionMigration_create(
- Reference< XComponentContext > const & ctx )
- SAL_THROW( () )
- {
- return static_cast< lang::XTypeProvider * >( new ExtensionMigration(
- ctx) );
- }
-
- // -----------------------------------------------------------------------------
-
-//.........................................................................
-} // namespace migration
-//.........................................................................
diff --git a/desktop/source/migration/services/extensionmigration.hxx b/desktop/source/migration/services/extensionmigration.hxx
deleted file mode 100755
index 2ca9d74b2c..0000000000
--- a/desktop/source/migration/services/extensionmigration.hxx
+++ /dev/null
@@ -1,130 +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.
- *
- ************************************************************************/
-
-#ifndef _DESKTOP_EXTENSIONMIGRATION_HXX_
-#define _DESKTOP_EXTENSIONMIGRATION_HXX_
-
-#include "misc.hxx"
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/task/XJob.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <cppuhelper/implbase3.hxx>
-#include <osl/mutex.hxx>
-#include <osl/file.hxx>
-#include "xmlscript/xmllib_imexp.hxx"
-
-namespace com { namespace sun { namespace star {
- namespace uno {
- class XComponentContext;
- }
- namespace deployment {
- class XPackage;
- }
-}}}
-
-
-
-class INetURLObject;
-
-
-//.........................................................................
-namespace migration
-{
-//.........................................................................
-
- ::rtl::OUString SAL_CALL ExtensionMigration_getImplementationName();
- ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ExtensionMigration_getSupportedServiceNames();
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ExtensionMigration_create(
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
-
- // =============================================================================
- // class ExtensionMigration
- // =============================================================================
-
- typedef ::cppu::WeakImplHelper3<
- ::com::sun::star::lang::XServiceInfo,
- ::com::sun::star::lang::XInitialization,
- ::com::sun::star::task::XJob > ExtensionMigration_BASE;
-
- class ExtensionMigration : public ExtensionMigration_BASE
- {
- private:
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_ctx;
- ::osl::Mutex m_aMutex;
- ::rtl::OUString m_sSourceDir;
- ::rtl::OUString m_sTargetDir;
-
- ::xmlscript::LibDescriptorArray m_scriptElements;
- ::xmlscript::LibDescriptorArray m_dialogElements;
-
- ::osl::FileBase::RC checkAndCreateDirectory( INetURLObject& rDirURL );
- void copyConfig( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir );
- bool isCompatibleBerkleyDb(const ::rtl::OUString& sSourceDir);
- bool copy( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir );
- bool processExtensions( const ::rtl::OUString& sSourceDir,
- const ::rtl::OUString& sTargetDir );
- /* fills m_scriptElements and m_dialogElements
- */
- void prepareBasicLibs();
- void prepareBasicLibs(const ::rtl::OUString & sURL,
- ::xmlscript::LibDescriptorArray & out_elements);
- bool isBasicPackageEnabled( const ::com::sun::star::uno::Reference<
- ::com::sun::star::deployment::XPackage > & xPkg);
- void registerBasicPackage(
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & xPkg);
-
- public:
- ExtensionMigration(::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XComponentContext > const & ctx);
- virtual ~ExtensionMigration();
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName()
- throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName )
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw (::com::sun::star::uno::RuntimeException);
-
- // XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
- throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XJob
- virtual ::com::sun::star::uno::Any SAL_CALL execute(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments )
- throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException);
- };
-
-//.........................................................................
-} // namespace migration
-//.........................................................................
-
-#endif // _DESKTOP_AUTOCORRMIGRATION_HXX_
diff --git a/desktop/source/migration/services/makefile.mk b/desktop/source/migration/services/makefile.mk
index 55ecff6bc0..2f3eb9308e 100644
--- a/desktop/source/migration/services/makefile.mk
+++ b/desktop/source/migration/services/makefile.mk
@@ -51,7 +51,6 @@ SLOFILES= \
$(SLO)$/cexports.obj \
$(SLO)$/basicmigration.obj \
$(SLO)$/wordbookmigration.obj \
- $(SLO)$/extensionmigration.obj \
$(SLO)$/autocorrmigration.obj \
$(SLO)$/oo3extensionmigration.obj \
$(SLO)$/cexportsoo3.obj
@@ -61,7 +60,6 @@ SHL1OBJS= \
$(SLO)$/cexports.obj \
$(SLO)$/basicmigration.obj \
$(SLO)$/wordbookmigration.obj \
- $(SLO)$/extensionmigration.obj \
$(SLO)$/autocorrmigration.obj
SHL1TARGET=$(TARGET)
diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx
index 23f7cf019e..578dda0c1b 100644..100755
--- a/desktop/source/migration/services/oo3extensionmigration.cxx
+++ b/desktop/source/migration/services/oo3extensionmigration.cxx
@@ -43,8 +43,6 @@
#include <comphelper/processfactory.hxx>
#include <ucbhelper/content.hxx>
-#include <com/sun/star/deployment/thePackageManagerFactory.hpp>
-#include <com/sun/star/deployment/XPackageManagerFactory.hpp>
#include <com/sun/star/task/XInteractionApprove.hpp>
#include <com/sun/star/task/XInteractionAbort.hpp>
#include <com/sun/star/ucb/XCommandInfo.hpp>
@@ -52,6 +50,8 @@
#include <com/sun/star/ucb/NameClash.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/xml/xpath/XXPathAPI.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/deployment/ExtensionManager.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -332,18 +332,17 @@ bool OO3ExtensionMigration::scanDescriptionXml( const ::rtl::OUString& sDescript
bool OO3ExtensionMigration::migrateExtension( const ::rtl::OUString& sSourceDir )
{
- if ( !m_xPackageManager.is() )
+ if ( !m_xExtensionManager.is() )
{
try
{
- m_xPackageManager = deployment::thePackageManagerFactory::get( m_ctx )->getPackageManager(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "user" )) );
+ m_xExtensionManager = deployment::ExtensionManager::get( m_ctx );
}
catch ( ucb::CommandFailedException & ){}
catch ( uno::RuntimeException & ) {}
}
- if ( m_xPackageManager.is() )
+ if ( m_xExtensionManager.is() )
{
try
{
@@ -353,7 +352,9 @@ bool OO3ExtensionMigration::migrateExtension( const ::rtl::OUString& sSourceDir
static_cast< cppu::OWeakObject* >( pCmdEnv ), uno::UNO_QUERY );
uno::Reference< task::XAbortChannel > xAbortChannel;
uno::Reference< deployment::XPackage > xPackage =
- m_xPackageManager->addPackage( sSourceDir, ::rtl::OUString(), xAbortChannel, xCmdEnv );
+ m_xExtensionManager->addExtension(
+ sSourceDir, uno::Sequence<beans::NamedValue>(),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")), xAbortChannel, xCmdEnv );
if ( xPackage.is() )
return true;
diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx
index 30dee04178..124bc1b250 100644..100755
--- a/desktop/source/migration/services/oo3extensionmigration.hxx
+++ b/desktop/source/migration/services/oo3extensionmigration.hxx
@@ -37,7 +37,7 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <com/sun/star/deployment/XPackageManager.hpp>
+#include <com/sun/star/deployment/XExtensionManager.hpp>
#include <osl/mutex.hxx>
#include <osl/file.hxx>
@@ -83,7 +83,7 @@ namespace migration
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_ctx;
::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XDocumentBuilder > m_xDocBuilder;
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > m_xSimpleFileAccess;
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > m_xPackageManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager;
::osl::Mutex m_aMutex;
::rtl::OUString m_sSourceDir;
::rtl::OUString m_sTargetDir;
diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx
index b4ffc5aad7..17d445a1ad 100644
--- a/desktop/source/offacc/acceptor.cxx
+++ b/desktop/source/offacc/acceptor.cxx
@@ -67,6 +67,7 @@ Acceptor::Acceptor( const Reference< XMultiServiceFactory >& rFactory )
, m_aConnectString()
, m_aProtocol()
, m_bInit(sal_False)
+ , m_bDying(false)
{
m_rSMgr = rFactory;
m_rAcceptor = Reference< XAcceptor > (m_rSMgr->createInstance(
@@ -88,6 +89,9 @@ Acceptor::~Acceptor()
osl::MutexGuard g(m_aMutex);
t = m_thread;
}
+ //prevent locking if the thread is still waiting
+ m_bDying = true;
+ m_cEnable.set();
osl_joinWithThread(t);
{
// Make the final state of m_bridges visible to this thread (since
@@ -117,6 +121,8 @@ void SAL_CALL Acceptor::run()
RTL_LOGFILE_CONTEXT_TRACE( aLog, "desktop (lo119109)"\
"Acceptor::run waiting for office to come up");
m_cEnable.wait();
+ if (m_bDying) //see destructor
+ break;
RTL_LOGFILE_CONTEXT_TRACE( aLog, "desktop (lo119109)"\
"Acceptor::run now enabled and continuing");
diff --git a/desktop/source/offacc/acceptor.hxx b/desktop/source/offacc/acceptor.hxx
index a66d243d30..eea88984d8 100644
--- a/desktop/source/offacc/acceptor.hxx
+++ b/desktop/source/offacc/acceptor.hxx
@@ -83,6 +83,7 @@ private:
OUString m_aProtocol;
sal_Bool m_bInit;
+ bool m_bDying;
public:
Acceptor( const Reference< XMultiServiceFactory >& aFactory );
diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
index dc976718dc..4b7b112e53 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
@@ -35,13 +35,16 @@
#include "tools/extendapplicationenvironment.hxx"
#include "rtl/ustrbuf.hxx"
#include "rtl/uri.hxx"
+#include "rtl/bootstrap.hxx"
#include "osl/thread.h"
#include "osl/process.h"
#include "osl/conditn.hxx"
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/exc_hlp.hxx"
#include "comphelper/anytostring.hxx"
-#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
+#include "comphelper/sequence.hxx"
+#include "com/sun/star/deployment/ExtensionManager.hpp"
+
#include "com/sun/star/deployment/ui/PackageManagerDialog.hpp"
#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp"
#include "com/sun/star/lang/DisposedException.hpp"
@@ -59,10 +62,24 @@ using ::rtl::OUString;
namespace css = ::com::sun::star;
namespace {
+struct ExtensionName
+{
+ OUString m_str;
+ ExtensionName( OUString const & str ) : m_str( str ) {}
+ bool operator () ( Reference<deployment::XPackage> const & e ) const
+ {
+ if (m_str.equals(dp_misc::getIdentifier(e))
+ || m_str.equals(e->getName()))
+ return true;
+ return false;
+ }
+};
+
//------------------------------------------------------------------------------
const char s_usingText [] =
"\n"
"using: " APP_NAME " add <options> extension-path...\n"
+" " APP_NAME " validate <options> extension-identifier...\n"
" " APP_NAME " remove <options> extension-identifier...\n"
" " APP_NAME " list <options> extension-identifier...\n"
" " APP_NAME " reinstall <options>\n"
@@ -72,6 +89,8 @@ const char s_usingText [] =
"\n"
"sub-commands:\n"
" add add extension\n"
+" validate checks the prerequisites of an installed extension and"
+" registers it if possible\n"
" remove remove extensions by identifier\n"
" reinstall expert feature: reinstall all deployed extensions\n"
" list list information about deployed extensions\n"
@@ -89,6 +108,8 @@ const char s_usingText [] =
" deployment context;\n"
" run only when no concurrent Office\n"
" process(es) are running!\n"
+" --bundled expert feature: operate on bundled extensions. Only\n"
+" works with list, validate, reinstall;\n"
" --deployment-context expert feature: explicit deployment context\n"
" <context>\n"
"\n"
@@ -149,12 +170,13 @@ void DialogClosedListenerImpl::dialogClosed(
// installed with OOo 2.2 or later could not normally be found via its file
// name.
Reference<deployment::XPackage> findPackage(
- Reference<deployment::XPackageManager> const & manager,
+ OUString const & repository,
+ Reference<deployment::XExtensionManager> const & manager,
Reference<ucb::XCommandEnvironment > const & environment,
OUString const & idOrFileName )
{
Sequence< Reference<deployment::XPackage> > ps(
- manager->getDeployedPackages(
+ manager->getDeployedExtensions(repository,
Reference<task::XAbortChannel>(), environment ) );
for ( sal_Int32 i = 0; i < ps.getLength(); ++i )
if ( dp_misc::getIdentifier( ps[i] ) == idOrFileName )
@@ -214,7 +236,7 @@ extern "C" int unopkg_main()
bool subcmd_add = false;
bool subcmd_gui = false;
OUString logFile;
- OUString deploymentContext;
+ OUString repository;
OUString cmdArg;
::std::vector<OUString> cmdPackages;
@@ -250,7 +272,7 @@ extern "C" int unopkg_main()
return 0;
}
else if (isOption( info_version, &nPos )) {
- dp_misc::writeConsole("\n"APP_NAME" Version 3.0\n");
+ dp_misc::writeConsole("\n"APP_NAME" Version 3.3\n");
return 0;
}
//consume all bootstrap variables which may occur before the subcommannd
@@ -279,7 +301,7 @@ extern "C" int unopkg_main()
!readOption( &option_force, info_force, &nPos ) &&
!readOption( &option_bundled, info_bundled, &nPos ) &&
!readOption( &option_suppressLicense, info_suppressLicense, &nPos ) &&
- !readArgument( &deploymentContext, info_context, &nPos ) &&
+ !readArgument( &repository, info_context, &nPos ) &&
!isBootstrapVariable(&nPos))
{
osl_getCommandArg( nPos, &cmdArg.pData );
@@ -311,26 +333,19 @@ extern "C" int unopkg_main()
}
}
}
-
- //make sure the bundled option was provided together with shared
- if (option_bundled && !option_shared)
- {
- dp_misc::writeConsoleError(
- "\nERROR: option --bundled can only be used together with --shared!");
- return 1;
- }
-
-
- xComponentContext = getUNO(
- disposeGuard, option_verbose, option_shared, subcmd_gui,
- xLocalComponentContext );
- if (deploymentContext.getLength() == 0) {
- deploymentContext = option_shared ? OUSTR("shared") : OUSTR("user");
+ if (repository.getLength() == 0)
+ {
+ if (option_shared)
+ repository = OUSTR("shared");
+ else if (option_bundled)
+ repository = OUSTR("bundled");
+ else
+ repository = OUSTR("user");
}
else
{
- if (deploymentContext.equalsAsciiL(
+ if (repository.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("shared") )) {
option_shared = true;
}
@@ -342,17 +357,46 @@ extern "C" int unopkg_main()
OUSTR("!\n") );
}
}
-
- Reference<deployment::XPackageManagerFactory> xPackageManagerFactory(
- deployment::thePackageManagerFactory::get( xComponentContext ) );
- Reference<deployment::XPackageManager> xPackageManager(
- xPackageManagerFactory->getPackageManager( deploymentContext ) );
-
+
+ if (subCommand.equals(OUSTR("reinstall")))
+ {
+ //We must prevent that services and types are loaded by UNO,
+ //otherwise we cannot delete the registry data folder.
+ OUString extensionUnorc;
+ if (repository.equals(OUSTR("user")))
+ extensionUnorc = OUSTR("$UNO_USER_PACKAGES_CACHE/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc");
+ else if (repository.equals(OUSTR("shared")))
+ extensionUnorc = OUSTR("$SHARED_EXTENSIONS_USER/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc");
+ else if (repository.equals(OUSTR("bundled")))
+ extensionUnorc = OUSTR("$BUNDLED_EXTENSIONS_USER/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc");
+ else
+ OSL_ASSERT(0);
+
+ ::rtl::Bootstrap::expandMacros(extensionUnorc);
+ oslFileError e = osl_removeFile(extensionUnorc.pData);
+ if (e != osl_File_E_None && e != osl_File_E_NOENT)
+ throw Exception(OUSTR("Could not delete ") + extensionUnorc, 0);
+ }
+
+ xComponentContext = getUNO(
+ disposeGuard, option_verbose, option_shared, subcmd_gui,
+ xLocalComponentContext );
+
+ Reference<deployment::XExtensionManager> xExtensionManager(
+ deployment::ExtensionManager::get( xComponentContext ) );
+
Reference< ::com::sun::star::ucb::XCommandEnvironment > xCmdEnv(
createCmdEnv( xComponentContext, logFile,
- option_force, option_verbose, option_bundled,
- option_suppressLicense) );
+ option_force, option_verbose) );
+ //synchronize bundled/shared extensions
+ //Do not synchronize when command is "reinstall". This could add types and services to UNO and
+ //prevent the deletion of the registry data folder
+ //synching is done in XExtensionManager.reinstall
+ if (!subcmd_gui && ! subCommand.equals(OUSTR("reinstall"))
+ && ! dp_misc::office_is_running())
+ dp_misc::syncRepositories(xCmdEnv);
+
if (subcmd_add ||
subCommand.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("remove") ))
@@ -362,35 +406,32 @@ extern "C" int unopkg_main()
OUString const & cmdPackage = cmdPackages[ pos ];
if (subcmd_add)
{
- Reference<deployment::XPackage> xPackage(
- xPackageManager->addPackage(
- cmdPackage, OUString() /* to be detected */,
- Reference<task::XAbortChannel>(), xCmdEnv ) );
- OSL_ASSERT( xPackage.is() );
+ beans::NamedValue nvSuppress(
+ OUSTR("SUPPRESS_LICENSE"), option_suppressLicense ?
+ makeAny(OUSTR("1")):makeAny(OUSTR("0")));
+ xExtensionManager->addExtension(
+ cmdPackage, Sequence<beans::NamedValue>(&nvSuppress, 1),
+ repository, Reference<task::XAbortChannel>(), xCmdEnv);
}
else
{
try
{
- xPackageManager->removePackage(
- cmdPackage, cmdPackage,
+ xExtensionManager->removeExtension(
+ cmdPackage, cmdPackage, repository,
Reference<task::XAbortChannel>(), xCmdEnv );
}
catch (lang::IllegalArgumentException &)
{
Reference<deployment::XPackage> p(
- findPackage(
- xPackageManager, xCmdEnv, cmdPackage ) );
- //Todo. temporary preventing exception in bundled case.
- //In case of a bundled extension, remove would be called as a result of
- //uninstalling a rpm. Then we do not want to show an error when the
- //extension does not exist, because the package will be uninstalled anyway
- //and the error would only confuse people.
- if ( !p.is() && !option_bundled)
+ findPackage(repository,
+ xExtensionManager, xCmdEnv, cmdPackage ) );
+ if ( !p.is())
throw;
else if (p.is())
- xPackageManager->removePackage(
- ::dp_misc::getIdentifier(p), p->getName(),
+ xExtensionManager->removeExtension(
+ ::dp_misc::getIdentifier(p), p->getName(),
+ repository,
Reference<task::XAbortChannel>(), xCmdEnv );
}
}
@@ -399,37 +440,136 @@ extern "C" int unopkg_main()
else if (subCommand.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("reinstall") ))
{
- xPackageManager->reinstallDeployedPackages(
- Reference<task::XAbortChannel>(), xCmdEnv );
+ xExtensionManager->reinstallDeployedExtensions(
+ repository, Reference<task::XAbortChannel>(), xCmdEnv);
}
else if (subCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("list") ))
{
- Sequence< Reference<deployment::XPackage> > packages;
+ ::std::vector<Reference<deployment::XPackage> > vecExtUnaccepted;
+ ::comphelper::sequenceToContainer(vecExtUnaccepted,
+ xExtensionManager->getExtensionsWithUnacceptedLicenses(
+ repository, xCmdEnv));
+
+ //This vector tells what XPackage in allExtensions has an
+ //unaccepted license.
+ std::vector<bool> vecUnaccepted;
+ std::vector<Reference<deployment::XPackage> > allExtensions;
if (cmdPackages.empty())
{
- packages = xPackageManager->getDeployedPackages(
- Reference<task::XAbortChannel>(), xCmdEnv );
+ Sequence< Reference<deployment::XPackage> >
+ packages = xExtensionManager->getDeployedExtensions(
+ repository, Reference<task::XAbortChannel>(), xCmdEnv );
+
+ ::std::vector<Reference<deployment::XPackage> > vec_packages;
+ ::comphelper::sequenceToContainer(vec_packages, packages);
+
+ //First copy the extensions with the unaccepted license
+ //to vector allExtensions.
+ allExtensions.resize(vecExtUnaccepted.size() + vec_packages.size());
+
+ ::std::vector<Reference<deployment::XPackage> >::iterator i_all_ext =
+ ::std::copy(vecExtUnaccepted.begin(), vecExtUnaccepted.end(),
+ allExtensions.begin());
+ //Now copy those we got from getDeployedExtensions
+ ::std::copy(vec_packages.begin(), vec_packages.end(), i_all_ext);
+
+ //Now prepare the vector which tells what extension has an
+ //unaccepted license
+ vecUnaccepted.resize(vecExtUnaccepted.size() + vec_packages.size());
+ ::std::vector<bool>::iterator i_unaccepted =
+ ::std::fill_n(vecUnaccepted.begin(),
+ vecExtUnaccepted.size(), true);
+ ::std::fill_n(i_unaccepted, vec_packages.size(), false);
+
dp_misc::writeConsole(
- OUSTR("all deployed ") + deploymentContext + OUSTR(" packages:\n"));
+ OUSTR("All deployed ") + repository + OUSTR(" extensions:\n\n"));
}
else
{
- packages.realloc( cmdPackages.size() );
+ //The user provided the names (ids or file names) of the extensions
+ //which shall be listed
for ( ::std::size_t pos = 0; pos < cmdPackages.size(); ++pos )
+ {
+ Reference<deployment::XPackage> extension;
try
{
- packages[ pos ] = xPackageManager->getDeployedPackage(
- cmdPackages[ pos ], cmdPackages[ pos ], xCmdEnv );
+ extension = xExtensionManager->getDeployedExtension(
+ repository, cmdPackages[ pos ], cmdPackages[ pos ], xCmdEnv );
}
catch (lang::IllegalArgumentException &)
{
- packages[ pos ] = findPackage(
- xPackageManager, xCmdEnv, cmdPackages[ pos ] );
- if ( !packages[ pos ].is() )
- throw;
+ extension = findPackage(repository,
+ xExtensionManager, xCmdEnv, cmdPackages[ pos ] );
+ }
+
+ //Now look if the requested extension has an unaccepted license
+ bool bUnacceptedLic = false;
+ if (!extension.is())
+ {
+ ::std::vector<Reference<deployment::XPackage> >::const_iterator
+ i = ::std::find_if(
+ vecExtUnaccepted.begin(),
+ vecExtUnaccepted.end(), ExtensionName(cmdPackages[pos]));
+ if (i != vecExtUnaccepted.end())
+ {
+ extension = *i;
+ bUnacceptedLic = true;
+ }
+ }
+
+ if (extension.is())
+ {
+ allExtensions.push_back(extension);
+ vecUnaccepted.push_back(bUnacceptedLic);
+ }
+
+ else
+ throw lang::IllegalArgumentException(
+ OUSTR("There is no such extension deployed: ") +
+ cmdPackages[pos],0,-1);
+ }
+
+ }
+
+ printf_packages(allExtensions, vecUnaccepted, xCmdEnv );
+ }
+ else if (subCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("validate") ))
+ {
+ ::std::vector<Reference<deployment::XPackage> > vecExtUnaccepted;
+ ::comphelper::sequenceToContainer(
+ vecExtUnaccepted, xExtensionManager->getExtensionsWithUnacceptedLicenses(
+ repository, xCmdEnv));
+
+ for ( ::std::size_t pos = 0; pos < cmdPackages.size(); ++pos )
+ {
+ Reference<deployment::XPackage> extension;
+ try
+ {
+ extension = xExtensionManager->getDeployedExtension(
+ repository, cmdPackages[ pos ], cmdPackages[ pos ], xCmdEnv );
+ }
+ catch (lang::IllegalArgumentException &)
+ {
+ extension = findPackage(
+ repository, xExtensionManager, xCmdEnv, cmdPackages[ pos ] );
+ }
+
+ if (!extension.is())
+ {
+ ::std::vector<Reference<deployment::XPackage> >::const_iterator
+ i = ::std::find_if(
+ vecExtUnaccepted.begin(),
+ vecExtUnaccepted.end(), ExtensionName(cmdPackages[pos]));
+ if (i != vecExtUnaccepted.end())
+ {
+ extension = *i;
}
+ }
+
+ if (extension.is())
+ xExtensionManager->checkPrerequisitesAndEnable(
+ extension, Reference<task::XAbortChannel>(), xCmdEnv);
}
- printf_packages( packages, xCmdEnv );
}
else if (subCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("gui") ))
{
diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx
index 808f30712f..785c79a759 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx
@@ -49,7 +49,7 @@
#include "com/sun/star/deployment/PlatformException.hpp"
#include "com/sun/star/i18n/XCollator.hpp"
#include "com/sun/star/i18n/CollatorOptions.hpp"
-#include "com/sun/star/deployment/LicenseIndividualAgreementException.hpp"
+
#include <stdio.h>
#include "deployment.hrc"
#include "dp_version.hxx"
@@ -85,13 +85,12 @@ class CommandEnvironmentImpl
sal_Int32 m_logLevel;
bool m_option_force_overwrite;
bool m_option_verbose;
- bool m_option_bundled;
- bool m_option_suppressLicense;
Reference< XComponentContext > m_xComponentContext;
Reference< XProgressHandler > m_xLogFile;
void update_( Any const & Status ) throw (RuntimeException);
- void printLicense(const OUString& sLicense, bool & accept, bool & decline);
+ void printLicense(const OUString & sName,const OUString& sLicense,
+ bool & accept, bool & decline);
public:
virtual ~CommandEnvironmentImpl();
@@ -99,9 +98,7 @@ public:
Reference<XComponentContext> const & xComponentContext,
OUString const & log_file,
bool option_force_overwrite,
- bool option_verbose,
- bool option_bundled,
- bool option_suppressLicense);
+ bool option_verbose);
// XCommandEnvironment
virtual Reference< task::XInteractionHandler > SAL_CALL
@@ -120,19 +117,16 @@ public:
virtual void SAL_CALL pop() throw (RuntimeException);
};
+
//______________________________________________________________________________
CommandEnvironmentImpl::CommandEnvironmentImpl(
Reference<XComponentContext> const & xComponentContext,
OUString const & log_file,
bool option_force_overwrite,
- bool option_verbose,
- bool option_bundled,
- bool option_suppressLicense)
+ bool option_verbose)
: m_logLevel(0),
m_option_force_overwrite( option_force_overwrite ),
m_option_verbose( option_verbose ),
- m_option_bundled( option_bundled),
- m_option_suppressLicense( option_suppressLicense),
m_xComponentContext(xComponentContext)
{
if (log_file.getLength() > 0) {
@@ -162,10 +156,13 @@ CommandEnvironmentImpl::~CommandEnvironmentImpl()
}
//May throw exceptions
-void CommandEnvironmentImpl::printLicense(const OUString& sLicense, bool & accept, bool &decline)
+void CommandEnvironmentImpl::printLicense(
+ const OUString & sName, const OUString& sLicense, bool & accept, bool &decline)
{
ResMgr * pResMgr = DeploymentResMgr::get();
- OUString s1 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_1, *pResMgr));
+ String s1tmp(ResId(RID_STR_UNOPKG_ACCEPT_LIC_1, *pResMgr));
+ s1tmp.SearchAndReplaceAllAscii( "$NAME", sName );
+ OUString s1(s1tmp);
OUString s2 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_2, *pResMgr));
OUString s3 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_3, *pResMgr));
OUString s4 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_4, *pResMgr));
@@ -246,7 +243,6 @@ void CommandEnvironmentImpl::handle(
lang::WrappedTargetException wtExc;
deployment::LicenseException licExc;
deployment::InstallException instExc;
- deployment::LicenseIndividualAgreementException licAgreementExc;
deployment::PlatformException platExc;
deployment::VersionException verExc;
@@ -281,27 +277,9 @@ void CommandEnvironmentImpl::handle(
update_( wtExc.TargetException );
}
}
- else if (request >>= licAgreementExc)
- {
- if (m_option_suppressLicense && licAgreementExc.SuppressIfRequired)
- {
- approve = true;
- }
- else
- {
- String sResMsg( ResId( RID_STR_UNOPKG_NO_SHARED_ALLOWED, *DeploymentResMgr::get() ) );
- sResMsg.SearchAndReplaceAllAscii( "%NAME", licAgreementExc.ExtensionName );
- dp_misc::writeConsole(OUSTR("\n") + sResMsg + OUSTR("\n\n"));
- abort = true;
- }
- }
else if (request >>= licExc)
{
- bLicenseException = true;
- if (m_option_suppressLicense && licExc.SuppressIfRequired)
- approve = true;
- else
- printLicense(licExc.Text, approve, abort);
+ printLicense(licExc.ExtensionName, licExc.Text, approve, abort);
}
else if (request >>= instExc)
{
@@ -320,7 +298,7 @@ void CommandEnvironmentImpl::handle(
deployment::VersionException nc_exc;
if (request >>= nc_exc) {
approve = m_option_force_overwrite ||
- (::dp_misc::comparePackageVersions(nc_exc.New, nc_exc.Deployed)
+ (::dp_misc::compareVersions(nc_exc.NewVersion, nc_exc.Deployed->getVersion())
== ::dp_misc::GREATER);
abort = !approve;
}
@@ -436,6 +414,7 @@ void CommandEnvironmentImpl::pop() throw (RuntimeException)
m_xLogFile->pop();
}
+
} // anon namespace
namespace unopkg {
@@ -445,14 +424,10 @@ Reference< XCommandEnvironment > createCmdEnv(
Reference< XComponentContext > const & xContext,
OUString const & logFile,
bool option_force_overwrite,
- bool option_verbose,
- bool option_bundled,
- bool option_suppressLicense)
+ bool option_verbose)
{
return new CommandEnvironmentImpl(
- xContext, logFile, option_force_overwrite, option_verbose, option_bundled,
- option_suppressLicense);
+ xContext, logFile, option_force_overwrite, option_verbose);
}
-
} // unopkg
diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
index 2d8b575dad..5ecf18d651 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -48,6 +48,7 @@
#include "unotools/configmgr.hxx"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "cppuhelper/bootstrap.hxx"
+#include "comphelper/sequence.hxx"
#include <stdio.h>
using ::rtl::OUString;
@@ -317,7 +318,10 @@ void printf_package(
xPackage->getBundle( Reference<task::XAbortChannel>(), xCmdEnv ) );
printf_space( level + 1 );
dp_misc::writeConsole("bundled Packages: {\n");
- printf_packages( seq, xCmdEnv, level + 2 );
+ ::std::vector<Reference<deployment::XPackage> >vec_bundle;
+ ::comphelper::sequenceToContainer(vec_bundle, seq);
+ printf_packages( vec_bundle, ::std::vector<bool>(vec_bundle.size()),
+ xCmdEnv, level + 2 );
printf_space( level + 1 );
dp_misc::writeConsole("}\n");
}
@@ -325,23 +329,45 @@ void printf_package(
} // anon namespace
+void printf_unaccepted_licenses(
+ Reference<deployment::XPackage> const & ext)
+{
+ OUString id(
+ dp_misc::getIdentifier(ext) );
+ printf_line( OUSTR("Identifier"), id, 0 );
+ printf_space(1);
+ dp_misc::writeConsole(OUSTR("License not accepted\n\n"));
+}
+
//==============================================================================
void printf_packages(
- Sequence< Reference<deployment::XPackage> > const & seq,
+ ::std::vector< Reference<deployment::XPackage> > const & allExtensions,
+ ::std::vector<bool> const & vecUnaccepted,
Reference<XCommandEnvironment> const & xCmdEnv, sal_Int32 level )
{
- sal_Int32 len = seq.getLength();
- Reference< deployment::XPackage > const * p = seq.getConstArray();
- if (len == 0) {
+ OSL_ASSERT(allExtensions.size() == vecUnaccepted.size());
+
+ if (allExtensions.size() == 0)
+ {
printf_space( level );
dp_misc::writeConsole("<none>\n");
}
- else {
- for ( sal_Int32 pos = 0; pos < len; ++pos )
- printf_package( p[ pos ], xCmdEnv, level );
+ else
+ {
+ typedef ::std::vector< Reference<deployment::XPackage> >::const_iterator I_EXT;
+ int index = 0;
+ for (I_EXT i = allExtensions.begin(); i != allExtensions.end(); i++, index++)
+ {
+ if (vecUnaccepted[index])
+ printf_unaccepted_licenses(*i);
+ else
+ printf_package( *i, xCmdEnv, level );
+ dp_misc::writeConsole(OUSTR("\n"));
+ }
}
}
+
//##############################################################################
namespace {
diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h
index 07a30abfb3..8898e42d27 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_shared.h
+++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h
@@ -162,14 +162,12 @@ css::uno::Reference<css::ucb::XCommandEnvironment> createCmdEnv(
css::uno::Reference<css::uno::XComponentContext> const & xContext,
::rtl::OUString const & logFile,
bool option_force_overwrite,
- bool option_verbose,
- bool option_bundled,
- bool option_suppressLicense);
-
+ bool option_verbose);
//==============================================================================
void printf_packages(
- css::uno::Sequence<
- css::uno::Reference<css::deployment::XPackage> > const & seq,
+ ::std::vector<
+ css::uno::Reference<css::deployment::XPackage> > const & allExtensions,
+ ::std::vector<bool> const & vecUnaccepted,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv,
sal_Int32 level = 0 );
diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index 7e2313b5eb..566b378b58 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -135,14 +135,21 @@ void SAL_CALL SplashScreen::reset()
}
}
-void SAL_CALL SplashScreen::setText(const OUString&)
+void SAL_CALL SplashScreen::setText(const OUString& rText)
throw (RuntimeException)
{
- if (_bVisible && !_bProgressEnd) {
- if ( _eBitmapMode == BM_FULLSCREEN )
- ShowFullScreenMode( TRUE );
- Show();
- Flush();
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ if ( _sProgressText != rText )
+ {
+ _sProgressText = rText;
+
+ if (_bVisible && !_bProgressEnd)
+ {
+ if ( _eBitmapMode == BM_FULLSCREEN )
+ ShowFullScreenMode( TRUE );
+ Show();
+ updateStatus();
+ }
}
}
@@ -647,7 +654,7 @@ void SplashScreen::Paint( const Rectangle&)
}
if( (bNativeOK = DrawNativeControl( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
- CTRL_STATE_ENABLED, aValue, rtl::OUString() )) != FALSE )
+ CTRL_STATE_ENABLED, aValue, _sProgressText )) != FALSE )
{
return;
}
@@ -668,10 +675,8 @@ void SplashScreen::Paint( const Rectangle&)
_vdev.DrawRect(Rectangle(_tlx, _tly, _tlx+_barwidth, _tly+_barheight));
_vdev.SetFillColor( _cProgressBarColor );
_vdev.SetLineColor();
- Rectangle aRect(_tlx+_barspace, _tly+_barspace, _tlx+_barspace+length, _tly+_barheight-_barspace);
- _vdev.DrawRect(Rectangle(_tlx+_barspace, _tly+_barspace,
- _tlx+_barspace+length, _tly+_barheight-_barspace));
-
+ _vdev.DrawRect(Rectangle(_tlx+_barspace, _tly+_barspace, _tlx+_barspace+length, _tly+_barheight-_barspace));
+ _vdev.DrawText( Rectangle(_tlx, _tly+_barheight+5, _tlx+_barwidth, _tly+_barheight+5+20), _sProgressText, TEXT_DRAW_CENTER );
}
Size aSize = GetOutputSizePixel();
Size bSize = _vdev.GetOutputSizePixel();
diff --git a/desktop/source/splash/splash.hxx b/desktop/source/splash/splash.hxx
index 8d1bfb7dbe..2090a64a82 100644
--- a/desktop/source/splash/splash.hxx
+++ b/desktop/source/splash/splash.hxx
@@ -91,6 +91,7 @@ private:
Color _cProgressBarColor;
bool _bNativeProgress;
OUString _sAppName;
+ OUString _sProgressText;
std::vector< FullScreenProgressRatioValue > _sFullScreenProgressRatioValues;
sal_Int32 _iMax;
diff --git a/desktop/unx/source/officeloader/officeloader.cxx b/desktop/unx/source/officeloader/officeloader.cxx
index 41510c14a0..613eea1ea3 100755
--- a/desktop/unx/source/officeloader/officeloader.cxx
+++ b/desktop/unx/source/officeloader/officeloader.cxx
@@ -93,7 +93,7 @@ SAL_IMPLEMENT_MAIN()
if ( info.Fields & osl_Process_EXITCODE )
{
exitcode = info.Code;
- bRestart = (ExitHelper::E_CRASH_WITH_RESTART == exitcode);
+ bRestart = (ExitHelper::E_CRASH_WITH_RESTART == exitcode || ExitHelper::E_NORMAL_RESTART == exitcode);
}
else
break;
diff --git a/desktop/util/makefile.mk b/desktop/util/makefile.mk
index 47885dfd6b..8cf03f1572 100644
--- a/desktop/util/makefile.mk
+++ b/desktop/util/makefile.mk
@@ -108,7 +108,7 @@ APP5RPATH=BRAND
APP5OBJS=$(OBJ)$/copyright_ascii_ooo.obj $(OBJ)$/main.obj
APP5STDLIBS = $(SALLIB) $(SOFFICELIB)
.IF "$(OS)" == "LINUX"
-APP5STDLIBS+= -lXext
+APP5STDLIBS+= -lXext -lX11
#APP5STDLIBS+= -lXext -lSM -lICE
.ENDIF # LINUX
diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx
index 40bc7e8784..a1a352ecb9 100644
--- a/desktop/win32/source/officeloader/officeloader.cxx
+++ b/desktop/win32/source/officeloader/officeloader.cxx
@@ -212,7 +212,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
LPTSTR lpCommandLine = NULL;
int argc = 0;
LPTSTR * argv = NULL;
- bool first = true;
+ bool bFirst = true;
WCHAR cwd[MAX_PATH];
DWORD cwdLen = GetCurrentDirectoryW(MAX_PATH, cwd);
if (cwdLen >= MAX_PATH) {
@@ -318,7 +318,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
}
}
- if (first) {
+ if ( bFirst ) {
argv = GetCommandArgs(&argc);
std::size_t n = wcslen(argv[0]) + 2;
for (int i = 1; i < argc; ++i) {
@@ -334,7 +334,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
lpCommandLine, MY_STRING(L"\""));
p = desktop_win32::commandLineAppend(p, argv[0]);
for (int i = 1; i < argc; ++i) {
- if (first || wcsncmp(argv[i], MY_STRING(L"-env:")) == 0) {
+ if (bFirst || ::desktop::ExitHelper::E_NORMAL_RESTART == dwExitCode || wcsncmp(argv[i], MY_STRING(L"-env:")) == 0) {
p = desktop_win32::commandLineAppend(p, MY_STRING(L"\" \""));
p = desktop_win32::commandLineAppend(p, argv[i]);
}
@@ -348,7 +348,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
p = desktop_win32::commandLineAppendEncoded(p, cwd);
}
desktop_win32::commandLineAppend(p, MY_STRING(L"\""));
- first = false;
+ bFirst = false;
TCHAR szParentProcessId[64]; // This is more than large enough for a 128 bit decimal value
BOOL bHeadlessMode( FALSE );
@@ -416,7 +416,8 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
CloseHandle( aProcessInfo.hProcess );
CloseHandle( aProcessInfo.hThread );
}
- } while ( fSuccess && ::desktop::ExitHelper::E_CRASH_WITH_RESTART == dwExitCode );
+ } while ( fSuccess
+ && ( ::desktop::ExitHelper::E_CRASH_WITH_RESTART == dwExitCode || ::desktop::ExitHelper::E_NORMAL_RESTART == dwExitCode ));
delete[] lpCommandLine;
return fSuccess ? dwExitCode : -1;
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 9a4a888afa..98a993e9f7 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -260,12 +260,14 @@ SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxEditSource* pSource, const Sv
DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!");
mpEditSource = pSource->Clone();
- ESelection aSelection;
- ::GetSelection( aSelection, mpEditSource->GetTextForwarder() );
- SetSelection( aSelection );
+ if (mpEditSource != NULL)
+ {
+ ESelection aSelection;
+ ::GetSelection( aSelection, mpEditSource->GetTextForwarder() );
+ SetSelection( aSelection );
- if( mpEditSource )
mpEditSource->addRange( this );
+ }
#ifdef DEBUG
gNumRanges.add(this);
#endif
@@ -348,7 +350,8 @@ void SvxUnoTextRangeBase::SetSelection( const ESelection& rSelection ) throw()
OGuard aGuard( Application::GetSolarMutex() );
maSelection = rSelection;
- CheckSelection( maSelection, mpEditSource->GetTextForwarder() );
+ if (mpEditSource != NULL)
+ CheckSelection( maSelection, mpEditSource->GetTextForwarder() );
}
// Interface XTextRange ( XText )
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 5bac848086..51e2ca99f1 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -493,7 +493,7 @@ void FormulaCompiler::OpCodeMap::putOpCode( const String & rStr, const OpCode eO
DBG_ASSERT( 0 < eOp && USHORT(eOp) < mnSymbols, "OpCodeMap::putOpCode: OpCode out of range");
if (0 < eOp && USHORT(eOp) < mnSymbols)
{
- DBG_ASSERT( (mpTable[eOp].Len() == 0) || (mpTable[eOp] == rStr),
+ DBG_ASSERT( (mpTable[eOp].Len() == 0) || (mpTable[eOp] == rStr) || (eOp == ocCurrency),
ByteString( "OpCodeMap::putOpCode: reusing OpCode ").
Append( ByteString::CreateFromInt32( sal_Int32( eOp))).Append( " (").
Append( ByteString( rStr, RTL_TEXTENCODING_ASCII_US)).Append( ')').GetBuffer());
diff --git a/fpicker/source/aqua/FilterHelper.cxx b/fpicker/source/aqua/FilterHelper.cxx
index e2b4eaca35..4b3116849a 100644
--- a/fpicker/source/aqua/FilterHelper.cxx
+++ b/fpicker/source/aqua/FilterHelper.cxx
@@ -35,6 +35,7 @@
// #endif
#include "CFStringUtilities.hxx"
#include "NSString_OOoAdditions.hxx"
+#include "NSURL_OOoAdditions.hxx"
#include "FilterHelper.hxx"
@@ -427,6 +428,16 @@ sal_Bool FilterHelper::filenameMatchesFilter(NSString* sFilename)
}
}
}
+
+ // might be an alias
+ NSString* pResolved = resolveAlias( sFilename );
+ if( pResolved )
+ {
+ sal_Bool bResult = filenameMatchesFilter( pResolved );
+ [pResolved autorelease];
+ if( bResult )
+ return sal_True;
+ }
DBG_PRINT_EXIT(CLASS_NAME, __func__);
diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.hxx b/fpicker/source/aqua/NSURL_OOoAdditions.hxx
index f38941f9e7..a5fd8f9551 100644
--- a/fpicker/source/aqua/NSURL_OOoAdditions.hxx
+++ b/fpicker/source/aqua/NSURL_OOoAdditions.hxx
@@ -29,15 +29,20 @@
#define _NSURL_OOOADDITIONS_HXX_
#include <premac.h>
-#include <Foundation/Foundation.h>
+#include <CoreFoundation/CoreFoundation.h>
#include <postmac.h>
#include "CFStringUtilities.hxx"
#include <rtl/ustring.hxx>
-// #include <sal/types.h>
-
@interface NSURL (OOoAdditions)
- (rtl::OUString) OUStringForInfo:(InfoType)info;
@end
-#endif \ No newline at end of file
+/*
+ returns the resolved string if there was an alias
+ if there was no alias, nil is returned
+*/
+
+NSString* resolveAlias( NSString* i_pSystemPath );
+
+#endif
diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.mm b/fpicker/source/aqua/NSURL_OOoAdditions.mm
index 56fc198650..ecc38b7e23 100644
--- a/fpicker/source/aqua/NSURL_OOoAdditions.mm
+++ b/fpicker/source/aqua/NSURL_OOoAdditions.mm
@@ -80,3 +80,33 @@
return sResult;
}
@end
+
+NSString* resolveAlias( NSString* i_pSystemPath )
+{
+ NSString* pResolvedPath = nil;
+ CFURLRef rUrl = CFURLCreateWithFileSystemPath( kCFAllocatorDefault,
+ (CFStringRef)i_pSystemPath,
+ kCFURLPOSIXPathStyle, false);
+ if( rUrl != NULL )
+ {
+ FSRef rFS;
+ if( CFURLGetFSRef( rUrl, &rFS ) )
+ {
+ MacOSBoolean bIsFolder = false;
+ MacOSBoolean bAlias = false;
+ OSErr err = FSResolveAliasFile( &rFS, true, &bIsFolder, &bAlias);
+ if( (err == noErr) && bAlias )
+ {
+ CFURLRef rResolvedUrl = CFURLCreateFromFSRef( kCFAllocatorDefault, &rFS );
+ if( rResolvedUrl != NULL )
+ {
+ pResolvedPath = (NSString*)CFURLCopyFileSystemPath( rResolvedUrl, kCFURLPOSIXPathStyle );
+ CFRelease( rResolvedUrl );
+ }
+ }
+ }
+ CFRelease( rUrl );
+ }
+
+ return pResolvedPath;
+}
diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx
index 4b3859399b..8ae2017935 100644
--- a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx
+++ b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx
@@ -96,6 +96,8 @@ namespace
static void expandexpanders(GtkContainer *pWidget)
{
+ GdkThreadLock aLock;
+
GList *pChildren = gtk_container_get_children(pWidget);
for( GList *p = pChildren; p; p = p->next )
{
@@ -114,6 +116,8 @@ void SalGtkFilePicker::dialog_mapped_cb(GtkWidget *, SalGtkFilePicker *pobjFP)
void SalGtkFilePicker::InitialMapping()
{
+ GdkThreadLock aLock;
+
if (!mbPreviewState )
{
gtk_widget_hide( m_pPreview );
@@ -208,6 +212,8 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFact
CResourceProvider aResProvider;
OUString aFilePickerTitle = aResProvider.getResString( FILE_PICKER_TITLE_OPEN );
+ GdkThreadLock aLock;
+
m_pDialog = gtk_file_chooser_dialog_new(
OUStringToOString( aFilePickerTitle, RTL_TEXTENCODING_UTF8 ).getStr(),
NULL,
@@ -385,14 +391,12 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFact
void SAL_CALL SalGtkFilePicker::addFilePickerListener( const uno::Reference<XFilePickerListener>& xListener )
throw( uno::RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
m_xListener = xListener;
}
void SAL_CALL SalGtkFilePicker::removeFilePickerListener( const uno::Reference<XFilePickerListener>& )
throw( uno::RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
m_xListener.clear();
}
@@ -591,6 +595,8 @@ shrinkFilterName( const rtl::OUString &rFilterName, bool bAllowNoStar = false )
static void
dialog_remove_buttons( GtkDialog *pDialog )
{
+ GdkThreadLock aLock;
+
g_return_if_fail( GTK_IS_DIALOG( pDialog ) );
GList *pChildren =
@@ -700,7 +706,6 @@ void SAL_CALL SalGtkFilePicker::appendFilter( const rtl::OUString& aTitle, const
throw( lang::IllegalArgumentException, uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
if( FilterNameExists( aTitle ) )
throw IllegalArgumentException();
@@ -721,7 +726,6 @@ void SAL_CALL SalGtkFilePicker::setCurrentFilter( const rtl::OUString& aTitle )
throw( lang::IllegalArgumentException, uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
OSL_TRACE( "Setting current filter to %s\n",
OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ).getStr() );
@@ -763,6 +767,9 @@ void SalGtkFilePicker::UpdateFilterfromUI()
// from the filter of the files glob on which he is currently searching
if (!mnHID_FolderChange || !mnHID_SelectionChange)
return;
+
+ GdkThreadLock aLock;
+
GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_pFilterView));
GtkTreeIter iter;
GtkTreeModel *model;
@@ -782,7 +789,6 @@ void SalGtkFilePicker::UpdateFilterfromUI()
rtl::OUString SAL_CALL SalGtkFilePicker::getCurrentFilter() throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
OSL_TRACE( "GetCURRENTfilter\n" );
@@ -802,7 +808,6 @@ void SAL_CALL SalGtkFilePicker::appendFilterGroup( const rtl::OUString& /*sGroup
throw( lang::IllegalArgumentException, uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
// TODO m_pImpl->appendFilterGroup( sGroupTitle, aFilters );
// check the names
@@ -832,7 +837,8 @@ void SAL_CALL SalGtkFilePicker::appendFilterGroup( const rtl::OUString& /*sGroup
void SAL_CALL SalGtkFilePicker::setMultiSelectionMode( sal_Bool bMode ) throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ GdkThreadLock aLock;
gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER(m_pDialog), bMode );
}
@@ -841,7 +847,8 @@ void SAL_CALL SalGtkFilePicker::setDefaultName( const rtl::OUString& aName )
throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ GdkThreadLock aLock;
OString aStr = OUStringToOString( aName, RTL_TEXTENCODING_UTF8 );
GtkFileChooserAction eAction = gtk_file_chooser_get_action( GTK_FILE_CHOOSER( m_pDialog ) );
@@ -877,7 +884,8 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getFiles() throw( uno::R
uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ GdkThreadLock aLock;
GSList* pPathList = gtk_file_chooser_get_uris( GTK_FILE_CHOOSER(m_pDialog) );
@@ -1014,7 +1022,8 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
{
OSL_TRACE( "1: HERE WE ARE\n");
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ GdkThreadLock aLock;
sal_Int16 retVal = 0;
@@ -1171,6 +1180,8 @@ namespace
{
void HackWidthToFirst(GtkComboBox *pWidget)
{
+ GdkThreadLock aLock;
+
GtkRequisition requisition;
gtk_widget_size_request(GTK_WIDGET(pWidget), &requisition);
gtk_widget_set_size_request(GTK_WIDGET(pWidget), requisition.width, -1);
@@ -1179,6 +1190,8 @@ namespace
void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nControlAction, const uno::Any& rValue)
{
+ GdkThreadLock aLock;
+
switch (nControlAction)
{
case ControlActions::ADD_ITEM:
@@ -1253,6 +1266,8 @@ void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nContr
uno::Any SalGtkFilePicker::HandleGetListValue(GtkComboBox *pWidget, sal_Int16 nControlAction) const
{
+ GdkThreadLock aLock;
+
uno::Any aAny;
switch (nControlAction)
{
@@ -1312,15 +1327,15 @@ void SAL_CALL SalGtkFilePicker::setValue( sal_Int16 nControlId, sal_Int16 nContr
throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
OSL_TRACE( "SETTING VALUE %d\n", nControlAction );
GType tType;
GtkWidget *pWidget;
+ GdkThreadLock aLock;
+
if( !( pWidget = getWidget( nControlId, &tType ) ) )
OSL_TRACE("enable unknown control %d\n", nControlId);
-
else if( tType == GTK_TYPE_TOGGLE_BUTTON )
{
sal_Bool bChecked = false;
@@ -1340,15 +1355,16 @@ uno::Any SAL_CALL SalGtkFilePicker::getValue( sal_Int16 nControlId, sal_Int16 nC
throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
uno::Any aRetval;
GType tType;
GtkWidget *pWidget;
+ GdkThreadLock aLock;
+
if( !( pWidget = getWidget( nControlId, &tType ) ) )
OSL_TRACE("enable unknown control %d\n", nControlId);
-
else if( tType == GTK_TYPE_TOGGLE_BUTTON )
aRetval <<= (sal_Bool) gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( pWidget ) );
else if( tType == GTK_TYPE_COMBO_BOX )
@@ -1364,13 +1380,13 @@ void SAL_CALL SalGtkFilePicker::enableControl( sal_Int16 nControlId, sal_Bool bE
throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
GtkWidget *pWidget;
+ GdkThreadLock aLock;
+
if ( nControlId == ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR )
gtk_expander_set_expanded( GTK_EXPANDER( m_pFilterExpander ), bEnable );
-
else if( ( pWidget = getWidget( nControlId ) ) )
{
if( bEnable )
@@ -1392,11 +1408,12 @@ void SAL_CALL SalGtkFilePicker::setLabel( sal_Int16 nControlId, const ::rtl::OUS
throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
GType tType;
GtkWidget *pWidget;
+ GdkThreadLock aLock;
+
if( !( pWidget = getWidget( nControlId, &tType ) ) )
{
OSL_TRACE("Set label on unknown control %d\n", nControlId);
@@ -1428,18 +1445,17 @@ rtl::OUString SAL_CALL SalGtkFilePicker::getLabel( sal_Int16 nControlId )
throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
GType tType;
OString aTxt;
GtkWidget *pWidget;
+ GdkThreadLock aLock;
+
if( !( pWidget = getWidget( nControlId, &tType ) ) )
OSL_TRACE("Get label on unknown control %d\n", nControlId);
-
else if( tType == GTK_TYPE_TOGGLE_BUTTON || tType == GTK_TYPE_BUTTON || tType == GTK_TYPE_LABEL )
aTxt = gtk_button_get_label( GTK_BUTTON( pWidget ) );
-
else
OSL_TRACE("Can't get label on list\n");
@@ -1453,7 +1469,6 @@ rtl::OUString SAL_CALL SalGtkFilePicker::getLabel( sal_Int16 nControlId )
uno::Sequence<sal_Int16> SAL_CALL SalGtkFilePicker::getSupportedImageFormats() throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
// TODO return m_pImpl->getSupportedImageFormats();
return 0;
@@ -1462,7 +1477,6 @@ uno::Sequence<sal_Int16> SAL_CALL SalGtkFilePicker::getSupportedImageFormats() t
sal_Int32 SAL_CALL SalGtkFilePicker::getTargetColorDepth() throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
// TODO return m_pImpl->getTargetColorDepth();
return 0;
@@ -1471,18 +1485,14 @@ sal_Int32 SAL_CALL SalGtkFilePicker::getTargetColorDepth() throw( uno::RuntimeEx
sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableWidth() throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- // TODO return m_pImpl->getAvailableWidth();
return m_PreviewImageWidth;
}
sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableHeight() throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- // TODO return m_pImpl->getAvailableHeight();
return m_PreviewImageHeight;
}
@@ -1490,7 +1500,6 @@ void SAL_CALL SalGtkFilePicker::setImage( sal_Int16 /*aImageFormat*/, const uno:
throw( lang::IllegalArgumentException, uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
// TODO m_pImpl->setImage( aImageFormat, aImage );
}
@@ -1499,6 +1508,9 @@ void SalGtkFilePicker::implChangeType( GtkTreeSelection *selection )
{
CResourceProvider aResProvider;
OUString aLabel = aResProvider.getResString( FILE_PICKER_FILE_TYPE );
+
+ GdkThreadLock aLock;
+
GtkTreeIter iter;
GtkTreeModel *model;
if (gtk_tree_selection_get_selected (selection, &model, &iter))
@@ -1523,6 +1535,8 @@ void SalGtkFilePicker::type_changed_cb( GtkTreeSelection *selection, SalGtkFileP
void SalGtkFilePicker::unselect_type()
{
+ GdkThreadLock aLock;
+
gtk_tree_selection_unselect_all(gtk_tree_view_get_selection(GTK_TREE_VIEW(m_pFilterView)));
}
@@ -1589,11 +1603,12 @@ void SalGtkFilePicker::update_preview_cb( GtkFileChooser *file_chooser, SalGtkFi
sal_Bool SAL_CALL SalGtkFilePicker::setShowState( sal_Bool bShowState ) throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
// TODO return m_pImpl->setShowState( bShowState );
if( bShowState != mbPreviewState )
{
+ GdkThreadLock aLock;
+
if( bShowState )
{
// Show
@@ -1622,9 +1637,7 @@ sal_Bool SAL_CALL SalGtkFilePicker::setShowState( sal_Bool bShowState ) throw( u
sal_Bool SAL_CALL SalGtkFilePicker::getShowState() throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- // TODO return m_pImpl->getShowState();
return mbPreviewState;
}
@@ -1740,6 +1753,8 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
1 );
}
+ GdkThreadLock aLock;
+
if( GTK_FILE_CHOOSER_ACTION_SAVE == eAction )
{
CResourceProvider aResProvider;
@@ -1801,7 +1816,6 @@ void SalGtkFilePicker::preview_toggled_cb( GtkObject *cb, SalGtkFilePicker* pobj
void SAL_CALL SalGtkFilePicker::cancel() throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
// TODO m_pImpl->cancel();
}
@@ -1848,6 +1862,8 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSupportedServiceNames
//-------------------------------------------------
void SalGtkFilePicker::SetCurFilter( const OUString& rFilter )
{
+ GdkThreadLock aLock;
+
// Get all the filters already added
GSList *filters = gtk_file_chooser_list_filters ( GTK_FILE_CHOOSER( m_pDialog ) );
bool bFound = false;
@@ -1903,6 +1919,8 @@ case_insensitive_filter (const GtkFileFilterInfo *filter_info, gpointer data)
int SalGtkFilePicker::implAddFilter( const OUString& rFilter, const OUString& rType )
{
+ GdkThreadLock aLock;
+
GtkFileFilter *filter = gtk_file_filter_new();
OUString aShrunkName = shrinkFilterName( rFilter );
@@ -1981,6 +1999,9 @@ int SalGtkFilePicker::implAddFilterGroup( const OUString& /*_rFilter*/, const Se
void SalGtkFilePicker::SetFilters()
{
OSL_TRACE( "start setting filters\n");
+
+ GdkThreadLock aLock;
+
int nAdded = 0;
if( m_pFilterList && !m_pFilterList->empty() )
{
diff --git a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx
index 775484eb5c..956d3bfc5c 100644
--- a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx
+++ b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx
@@ -87,6 +87,9 @@ SalGtkFolderPicker::SalGtkFolderPicker( const uno::Reference<lang::XMultiService
m_xServiceMgr( xServiceMgr )
{
CResourceProvider aResProvider;
+
+ GdkThreadLock aLock;
+
m_pDialog = gtk_file_chooser_dialog_new(
OUStringToOString( aResProvider.getResString( FOLDERPICKER_TITLE ), RTL_TEXTENCODING_UTF8 ).getStr(),
NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@@ -110,7 +113,6 @@ void SAL_CALL SalGtkFolderPicker::setDisplayDirectory( const rtl::OUString& aDir
throw( lang::IllegalArgumentException, uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
OString aTxt = unicodetouri( aDirectory );
@@ -119,14 +121,17 @@ void SAL_CALL SalGtkFolderPicker::setDisplayDirectory( const rtl::OUString& aDir
OSL_TRACE( "setting path to %s\n", aTxt.getStr() );
+ GdkThreadLock aLock;
+
gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ),
- aTxt.getStr() );
+ aTxt.getStr() );
}
rtl::OUString SAL_CALL SalGtkFolderPicker::getDisplayDirectory() throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ GdkThreadLock aLock;
gchar* pCurrentFolder =
gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ) );
@@ -156,9 +161,10 @@ void SAL_CALL SalGtkFolderPicker::setDescription( const rtl::OUString& rDescript
void SAL_CALL SalGtkFolderPicker::setTitle( const rtl::OUString& aTitle ) throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
::rtl::OString aWindowTitle = OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 );
+
+ GdkThreadLock aLock;
gtk_window_set_title( GTK_WINDOW( m_pDialog ), aWindowTitle.getStr() );
}
@@ -166,7 +172,6 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException )
{
OSL_TRACE( "1: HERE WE ARE\n");
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
sal_Int16 retVal = 0;
@@ -199,7 +204,6 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException )
void SAL_CALL SalGtkFolderPicker::cancel() throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
// TODO m_pImpl->cancel();
}
diff --git a/fpicker/source/unx/gnome/SalGtkPicker.cxx b/fpicker/source/unx/gnome/SalGtkPicker.cxx
index 9c8dc395cf..c5a977bcbc 100644
--- a/fpicker/source/unx/gnome/SalGtkPicker.cxx
+++ b/fpicker/source/unx/gnome/SalGtkPicker.cxx
@@ -148,6 +148,8 @@ RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit
}
}
+ GdkThreadLock aLock;
+
GdkDisplay *pDisplay = aWindowHandle.DisplayPointer ? gdk_x11_lookup_xdisplay(reinterpret_cast<void*>(static_cast<sal_IntPtr>(aWindowHandle.DisplayPointer))) : NULL;
GdkWindow* pParent = pDisplay ? gdk_window_lookup_for_display(pDisplay, aWindowHandle.WindowHandle) : NULL;
if (!pParent && pDisplay)
@@ -163,17 +165,22 @@ RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit
RunDialog::~RunDialog()
{
if (mpCreatedParent)
+ {
+ GdkThreadLock aLock;
gdk_window_destroy (mpCreatedParent);
+ }
}
void SAL_CALL RunDialog::windowOpened( const ::com::sun::star::lang::EventObject& )
throw (::com::sun::star::uno::RuntimeException)
{
+ GdkThreadLock aLock;
g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL);
}
void RunDialog::cancel()
{
+ GdkThreadLock aLock;
gtk_dialog_response( GTK_DIALOG( mpDialog ), GTK_RESPONSE_CANCEL );
gtk_widget_hide( mpDialog );
}
@@ -183,6 +190,7 @@ gint RunDialog::run()
if (mxToolkit.is())
mxToolkit->addTopWindowListener(this);
+ GdkThreadLock aLock;
gint nStatus = gtk_dialog_run( GTK_DIALOG( mpDialog ) );
if (mxToolkit.is())
@@ -197,14 +205,16 @@ gint RunDialog::run()
SalGtkPicker::~SalGtkPicker()
{
if (m_pDialog)
+ {
+ GdkThreadLock aLock;
gtk_widget_destroy(m_pDialog);
+ }
}
void SAL_CALL SalGtkPicker::implsetDisplayDirectory( const rtl::OUString& aDirectory )
throw( lang::IllegalArgumentException, uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
OString aTxt = unicodetouri(aDirectory);
@@ -213,15 +223,17 @@ void SAL_CALL SalGtkPicker::implsetDisplayDirectory( const rtl::OUString& aDirec
OSL_TRACE( "setting path to %s\n", aTxt.getStr() );
+ GdkThreadLock aLock;
gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ),
- aTxt.getStr() );
+ aTxt.getStr() );
}
rtl::OUString SAL_CALL SalGtkPicker::implgetDisplayDirectory() throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ GdkThreadLock aLock;
+
gchar* pCurrentFolder =
gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( m_pDialog ) );
::rtl::OUString aCurrentFolderName = uritounicode(pCurrentFolder);
@@ -233,8 +245,9 @@ rtl::OUString SAL_CALL SalGtkPicker::implgetDisplayDirectory() throw( uno::Runti
void SAL_CALL SalGtkPicker::implsetTitle( const rtl::OUString& aTitle ) throw( uno::RuntimeException )
{
OSL_ASSERT( m_pDialog != NULL );
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
::rtl::OString aWindowTitle = OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 );
+
+ GdkThreadLock aLock;
gtk_window_set_title( GTK_WINDOW( m_pDialog ), aWindowTitle.getStr() );
}
diff --git a/fpicker/source/unx/gnome/SalGtkPicker.hxx b/fpicker/source/unx/gnome/SalGtkPicker.hxx
index b9957e59bf..87c0cb9ea0 100644
--- a/fpicker/source/unx/gnome/SalGtkPicker.hxx
+++ b/fpicker/source/unx/gnome/SalGtkPicker.hxx
@@ -71,6 +71,13 @@ class SalGtkPicker
static rtl::OString unicodetouri(const rtl::OUString &rURL);
};
+class GdkThreadLock
+{
+public:
+ GdkThreadLock() { gdk_threads_enter(); }
+ ~GdkThreadLock() { gdk_threads_leave(); }
+};
+
//Run the Gtk Dialog. Watch for any "new windows" created while we're
//executing and consider that a CANCEL event to avoid e.g. "file cannot be opened"
//modal dialogs and this one getting locked if some other API call causes this
diff --git a/fpicker/source/unx/gnome/resourceprovider.cxx b/fpicker/source/unx/gnome/resourceprovider.cxx
index 56739b9b75..35d718c0df 100644
--- a/fpicker/source/unx/gnome/resourceprovider.cxx
+++ b/fpicker/source/unx/gnome/resourceprovider.cxx
@@ -168,8 +168,6 @@ public:
String aResString;
OUString aResOUString;
- const ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
try
{
OSL_ASSERT( m_ResMgr && m_OtherResMgr );
diff --git a/framework/inc/filterflags.h b/framework/inc/filterflags.h
deleted file mode 100644
index b2f6382fa8..0000000000
--- a/framework/inc/filterflags.h
+++ /dev/null
@@ -1,172 +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.
- *
- ************************************************************************/
-
-#ifndef __FRAMEWORK_FILTERFLAGS_H_
-#define __FRAMEWORK_FILTERFLAGS_H_
-
-namespace framework{
-
-/*-************************************************************************************************************//**
- @short These values describe our supported filter flags.
- @attention Don't change flag values without reason - we must support old functionality and position
- in flag combined values!
-*//*-*************************************************************************************************************/
-
-#define FILTERFLAGNAME_IMPORT DECLARE_ASCII("Import" ) // x
-#define FILTERFLAGNAME_EXPORT DECLARE_ASCII("Export" ) // x
-#define FILTERFLAGNAME_TEMPLATE DECLARE_ASCII("Template" ) // x
-#define FILTERFLAGNAME_INTERNAL DECLARE_ASCII("Internal" ) // x
-#define FILTERFLAGNAME_TEMPLATEPATH DECLARE_ASCII("TemplatePath" ) // x
-#define FILTERFLAGNAME_OWN DECLARE_ASCII("Own" ) // x
-#define FILTERFLAGNAME_ALIEN DECLARE_ASCII("Alien" ) // x
-#define FILTERFLAGNAME_USESOPTIONS DECLARE_ASCII("UsesOptions" ) // x
-#define FILTERFLAGNAME_DEFAULT DECLARE_ASCII("Default" ) // x
-#define FILTERFLAGNAME_EXECUTABLE DECLARE_ASCII("Executable" ) // deprecated
-#define FILTERFLAGNAME_SUPPORTSSELECTION DECLARE_ASCII("SupportsSelection") // x
-#define FILTERFLAGNAME_MAPTOAPPPLUG DECLARE_ASCII("MapToAppPlug" ) // deprecated
-#define FILTERFLAGNAME_NOTINFILEDIALOG DECLARE_ASCII("NotInFileDialog" ) // x
-#define FILTERFLAGNAME_NOTINCHOOSER DECLARE_ASCII("NotInChooser" ) // x
-#define FILTERFLAGNAME_ASYNCHRON DECLARE_ASCII("Asynchron" ) // x
-#define FILTERFLAGNAME_CREATOR DECLARE_ASCII("Creator" ) // deprecated
-#define FILTERFLAGNAME_READONLY DECLARE_ASCII("Readonly" ) // x
-#define FILTERFLAGNAME_NOTINSTALLED DECLARE_ASCII("NotInstalled" ) // deprecated
-#define FILTERFLAGNAME_CONSULTSERVICE DECLARE_ASCII("ConsultService" ) // deprecated
-#define FILTERFLAGNAME_3RDPARTYFILTER DECLARE_ASCII("3rdPartyFilter" ) // x
-#define FILTERFLAGNAME_PACKED DECLARE_ASCII("Packed" ) // x
-#define FILTERFLAGNAME_SILENTEXPORT DECLARE_ASCII("SilentExport" ) // x
-#define FILTERFLAGNAME_BROWSERPREFERED DECLARE_ASCII("BrowserPrefered" ) // deprecated
-#define FILTERFLAGNAME_PREFERED DECLARE_ASCII("Prefered" ) // x
-
-#define FILTERFLAG_IMPORT 0x00000001L // 1
-#define FILTERFLAG_EXPORT 0x00000002L // 2
-#define FILTERFLAG_TEMPLATE 0x00000004L // 4
-#define FILTERFLAG_INTERNAL 0x00000008L // 8
-#define FILTERFLAG_TEMPLATEPATH 0x00000010L // 16
-#define FILTERFLAG_OWN 0x00000020L // 32
-#define FILTERFLAG_ALIEN 0x00000040L // 64
-#define FILTERFLAG_USESOPTIONS 0x00000080L // 128
-#define FILTERFLAG_DEFAULT 0x00000100L // 256
-#define FILTERFLAG_EXECUTABLE 0x00000200L // 512
-#define FILTERFLAG_SUPPORTSSELECTION 0x00000400L // 1024
-#define FILTERFLAG_MAPTOAPPPLUG 0x00000800L // 2048
-#define FILTERFLAG_NOTINFILEDIALOG 0x00001000L // 4096
-#define FILTERFLAG_NOTINCHOOSER 0x00002000L // 8192
-#define FILTERFLAG_ASYNCHRON 0x00004000L // 16384
-#define FILTERFLAG_CREATOR 0x00008000L // 32768
-#define FILTERFLAG_READONLY 0x00010000L // 65536
-#define FILTERFLAG_NOTINSTALLED 0x00020000L // 131072
-#define FILTERFLAG_CONSULTSERVICE 0x00040000L // 262144
-#define FILTERFLAG_3RDPARTYFILTER 0x00080000L // 524288
-#define FILTERFLAG_PACKED 0x00100000L // 1048576
-#define FILTERFLAG_SILENTEXPORT 0x00200000L // 2097152
-#define FILTERFLAG_BROWSERPREFERED 0x00400000L // 4194304
-//FREE! ... 0x00800000L
-#define FILTERFLAG_PREFERED 0x10000000L // 268435456
-
-class FlagCheck
-{
- public:
-
- //___________________________________________
-
- /** @short checks if the given flag mask is set.
-
- @param nFlags the flag field, which should be checked.
- @param nMask this mask field is searched inside parameter nFlags.
-
- @return TRUE if mask match to the given flag field.
- */
- static sal_Bool isMaskSet( sal_Int32 nFlags, sal_Int32 nMask )
- {
- return((nFlags & nMask) == nMask);
- }
-
- //___________________________________________
-
- /** @short checks if the given flag field contains unknown flags.
-
- @descr Of course it can work only, if not the whole range of an int32
- is used!
-
- @param nFlags the flag field, which should be checked.
-
- @return TRUE if only well known flags are set.
- */
- static sal_Bool isValid( sal_Int32 nFlags )
- {
- sal_Int32 nCheck = nFlags;
- nCheck &= ~FILTERFLAG_IMPORT;
- nCheck &= ~FILTERFLAG_EXPORT;
- nCheck &= ~FILTERFLAG_TEMPLATE;
- nCheck &= ~FILTERFLAG_INTERNAL;
- nCheck &= ~FILTERFLAG_TEMPLATEPATH;
- nCheck &= ~FILTERFLAG_OWN;
- nCheck &= ~FILTERFLAG_ALIEN;
- nCheck &= ~FILTERFLAG_USESOPTIONS;
- nCheck &= ~FILTERFLAG_DEFAULT;
- nCheck &= ~FILTERFLAG_EXECUTABLE;
- nCheck &= ~FILTERFLAG_SUPPORTSSELECTION;
- nCheck &= ~FILTERFLAG_MAPTOAPPPLUG;
- nCheck &= ~FILTERFLAG_NOTINFILEDIALOG;
- nCheck &= ~FILTERFLAG_NOTINCHOOSER;
- nCheck &= ~FILTERFLAG_ASYNCHRON;
- nCheck &= ~FILTERFLAG_CREATOR;
- nCheck &= ~FILTERFLAG_READONLY;
- nCheck &= ~FILTERFLAG_NOTINSTALLED;
- nCheck &= ~FILTERFLAG_CONSULTSERVICE;
- nCheck &= ~FILTERFLAG_3RDPARTYFILTER;
- nCheck &= ~FILTERFLAG_PACKED;
- nCheck &= ~FILTERFLAG_SILENTEXPORT;
- nCheck &= ~FILTERFLAG_BROWSERPREFERED;
- nCheck &= ~FILTERFLAG_PREFERED;
- return(nCheck == 0);
- }
-
- //___________________________________________
-
- /** @short checks if the given flag field uses deprecated flag values.
-
- @param nFlags the flag field, which should be checked.
-
- @return TRUE if one deprecated flag item could be found.
- */
- static sal_Bool useDeprecated( sal_Int32 nFlags )
- {
- return(
- isMaskSet(nFlags, FILTERFLAG_EXECUTABLE ) ||
- isMaskSet(nFlags, FILTERFLAG_MAPTOAPPPLUG ) ||
- isMaskSet(nFlags, FILTERFLAG_CREATOR ) ||
- isMaskSet(nFlags, FILTERFLAG_NOTINSTALLED ) ||
- isMaskSet(nFlags, FILTERFLAG_CONSULTSERVICE ) ||
- isMaskSet(nFlags, FILTERFLAG_BROWSERPREFERED )
- );
- }
-};
-
-} // namespace framework
-
-#endif // #ifndef __FRAMEWORK_FILTERFLAGS_H_
diff --git a/framework/inc/queries.h b/framework/inc/queries.h
index c7a2a451c5..50f18078c1 100644
--- a/framework/inc/queries.h
+++ b/framework/inc/queries.h
@@ -32,7 +32,6 @@
// own includes
//_________________________________________________________________________________________________________________
-#include <filterflags.h>
#include <general.h>
//_________________________________________________________________________________________________________________
diff --git a/framework/inc/threadhelp/transactionmanager.hxx b/framework/inc/threadhelp/transactionmanager.hxx
index 536cb86234..e8cf8f9bd9 100644
--- a/framework/inc/threadhelp/transactionmanager.hxx
+++ b/framework/inc/threadhelp/transactionmanager.hxx
@@ -93,7 +93,6 @@ class TransactionManager : public ITransactionManager
virtual sal_Bool isCallRejected ( ERejectReason& eReason ) const;
virtual void registerTransaction ( EExceptionMode eMode, ERejectReason& eReason ) throw( css::uno::RuntimeException, css::lang::DisposedException );
virtual void unregisterTransaction ( ) throw( css::uno::RuntimeException, css::lang::DisposedException );
- static TransactionManager& getGlobalTransactionManager ( );
//-------------------------------------------------------------------------------------------------------------
// private methods
diff --git a/framework/source/constant/filter.cxx b/framework/source/constant/filter.cxx
deleted file mode 100644
index 38f92a557e..0000000000
--- a/framework/source/constant/filter.cxx
+++ /dev/null
@@ -1,119 +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_framework.hxx"
-
-#ifndef __FRAMEWORK_CONSTANT_FILTER_HXX_
-#include <constant/filter.hxx>
-#endif
-
-namespace framework{
- namespace constant{
-
-const ::rtl::OUString Filter::PROP_NAME = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name" ));
-const ::rtl::OUString Filter::PROP_TYPE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Type" ));
-const ::rtl::OUString Filter::PROP_DOCUMENTSERVICE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService"));
-const ::rtl::OUString Filter::PROP_FILTERSERVICE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterService" ));
-const ::rtl::OUString Filter::PROP_UICOMPONENT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIComponent" ));
-const ::rtl::OUString Filter::PROP_FLAGS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags" ));
-const ::rtl::OUString Filter::PROP_USERDATA = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UserData" ));
-const ::rtl::OUString Filter::PROP_TEMPLATENAME = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TemplateName" ));
-
-const ::rtl::OUString Filter::QUERY_GET_DEFAULT_FILTER_FOR_TYPE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("getDefaultFilterForType"));
-const ::rtl::OUString Filter::QUERY_ALL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_all" ));
-const ::rtl::OUString Filter::QUERY_WRITER = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_writer" ));
-const ::rtl::OUString Filter::QUERY_WEB = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_web" ));
-const ::rtl::OUString Filter::QUERY_GLOBAL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_global" ));
-const ::rtl::OUString Filter::QUERY_CHART = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_chart" ));
-const ::rtl::OUString Filter::QUERY_CALC = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_calc" ));
-const ::rtl::OUString Filter::QUERY_IMPRESS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_impress" ));
-const ::rtl::OUString Filter::QUERY_DRAW = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_draw" ));
-const ::rtl::OUString Filter::QUERY_MATH = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_math" ));
-
-const ::rtl::OUString Filter::QUERYPARAM_IFLAGS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("iflags" ));
-const ::rtl::OUString Filter::QUERYPARAM_EFLAGS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("eflags" ));
-const ::rtl::OUString Filter::QUERYPARAM_SORT_PROP = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sort_prop" ));
-const ::rtl::OUString Filter::QUERYPARAM_DESCENDING = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("descending" ));
-const ::rtl::OUString Filter::QUERYPARAM_USE_ORDER = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("use_order" ));
-const ::rtl::OUString Filter::QUERYPARAM_DEFAULT_FIRST = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default_first" ));
-const ::rtl::OUString Filter::QUERYPARAM_CASE_SENSITIVE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("case_sensitive"));
-const ::rtl::OUString Filter::QUERYPARAMVALUE_SORT_PROP_NAME = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name" ));
-const ::rtl::OUString Filter::QUERYPARAMVALUE_SORT_PROP_UINAME = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uiname" ));
-
-const ::rtl::OUString Filter::FLAGNAME_IMPORT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Import" ));
-const ::rtl::OUString Filter::FLAGNAME_EXPORT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Export" ));
-const ::rtl::OUString Filter::FLAGNAME_TEMPLATE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Template" ));
-const ::rtl::OUString Filter::FLAGNAME_INTERNAL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Internal" ));
-const ::rtl::OUString Filter::FLAGNAME_TEMPLATEPATH = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TemplatePath" ));
-const ::rtl::OUString Filter::FLAGNAME_OWN = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Own" ));
-const ::rtl::OUString Filter::FLAGNAME_ALIEN = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Alien" ));
-const ::rtl::OUString Filter::FLAGNAME_USESOPTIONS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UsesOptions" ));
-const ::rtl::OUString Filter::FLAGNAME_DEFAULT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Default" ));
-const ::rtl::OUString Filter::FLAGNAME_EXECUTABLE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Executable" ));
-const ::rtl::OUString Filter::FLAGNAME_SUPPORTSSELECTION = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SupportsSelection"));
-const ::rtl::OUString Filter::FLAGNAME_MAPTOAPPPLUG = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MapToAppPlug" ));
-const ::rtl::OUString Filter::FLAGNAME_NOTINFILEDIALOG = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NotInFileDialog" ));
-const ::rtl::OUString Filter::FLAGNAME_NOTINCHOOSER = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NotInChooser" ));
-const ::rtl::OUString Filter::FLAGNAME_ASYNCHRON = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Asynchron" ));
-const ::rtl::OUString Filter::FLAGNAME_CREATOR = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Creator" ));
-const ::rtl::OUString Filter::FLAGNAME_READONLY = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Readonly" ));
-const ::rtl::OUString Filter::FLAGNAME_NOTINSTALLED = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NotInstalled" ));
-const ::rtl::OUString Filter::FLAGNAME_CONSULTSERVICE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ConsultService" ));
-const ::rtl::OUString Filter::FLAGNAME_3RDPARTYFILTER = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("3rdPartyFilter" ));
-const ::rtl::OUString Filter::FLAGNAME_PACKED = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Packed" ));
-const ::rtl::OUString Filter::FLAGNAME_SILENTEXPORT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SilentExport" ));
-const ::rtl::OUString Filter::FLAGNAME_BROWSERPREFERED = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BrowserPrefered" ));
-const ::rtl::OUString Filter::FLAGNAME_PREFERED = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Prefered" ));
-
-const sal_Int32 Filter::FLAGVALUE_IMPORT = 0x00000001L; // 1
-const sal_Int32 Filter::FLAGVALUE_EXPORT = 0x00000002L; // 2
-const sal_Int32 Filter::FLAGVALUE_TEMPLATE = 0x00000004L; // 4
-const sal_Int32 Filter::FLAGVALUE_INTERNAL = 0x00000008L; // 8
-const sal_Int32 Filter::FLAGVALUE_TEMPLATEPATH = 0x00000010L; // 16
-const sal_Int32 Filter::FLAGVALUE_OWN = 0x00000020L; // 32
-const sal_Int32 Filter::FLAGVALUE_ALIEN = 0x00000040L; // 64
-const sal_Int32 Filter::FLAGVALUE_USESOPTIONS = 0x00000080L; // 128
-const sal_Int32 Filter::FLAGVALUE_DEFAULT = 0x00000100L; // 256
-const sal_Int32 Filter::FLAGVALUE_EXECUTABLE = 0x00000200L; // 512
-const sal_Int32 Filter::FLAGVALUE_SUPPORTSSELECTION = 0x00000400L; // 1024
-const sal_Int32 Filter::FLAGVALUE_MAPTOAPPPLUG = 0x00000800L; // 2048
-const sal_Int32 Filter::FLAGVALUE_NOTINFILEDIALOG = 0x00001000L; // 4096
-const sal_Int32 Filter::FLAGVALUE_NOTINCHOOSER = 0x00002000L; // 8192
-const sal_Int32 Filter::FLAGVALUE_ASYNCHRON = 0x00004000L; // 16384
-const sal_Int32 Filter::FLAGVALUE_CREATOR = 0x00008000L; // 32768
-const sal_Int32 Filter::FLAGVALUE_READONLY = 0x00010000L; // 65536
-const sal_Int32 Filter::FLAGVALUE_NOTINSTALLED = 0x00020000L; // 131072
-const sal_Int32 Filter::FLAGVALUE_CONSULTSERVICE = 0x00040000L; // 262144
-const sal_Int32 Filter::FLAGVALUE_3RDPARTYFILTER = 0x00080000L; // 524288
-const sal_Int32 Filter::FLAGVALUE_PACKED = 0x00100000L; // 1048576
-const sal_Int32 Filter::FLAGVALUE_SILENTEXPORT = 0x00200000L; // 2097152
-const sal_Int32 Filter::FLAGVALUE_BROWSERPREFERED = 0x00400000L; // 4194304
-const sal_Int32 Filter::FLAGVALUE_PREFERED = 0x10000000L; // 268435456
-
- } // namespace constant
-} // namespace framework
diff --git a/framework/source/constant/makefile.mk b/framework/source/constant/makefile.mk
index 1c050db57d..05fc28870d 100644
--- a/framework/source/constant/makefile.mk
+++ b/framework/source/constant/makefile.mk
@@ -35,8 +35,7 @@ ENABLE_EXCEPTIONS= TRUE
# --- Generate -----------------------------------------------------
-SLOFILES= $(SLO)$/filter.obj \
- $(SLO)$/frameloader.obj \
+SLOFILES= $(SLO)$/frameloader.obj \
$(SLO)$/contenthandler.obj \
$(SLO)$/containerquery.obj
diff --git a/framework/source/inc/constant/filter.hxx b/framework/source/inc/constant/filter.hxx
deleted file mode 100644
index 20f7ad48d9..0000000000
--- a/framework/source/inc/constant/filter.hxx
+++ /dev/null
@@ -1,126 +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.
- *
- ************************************************************************/
-
-#ifndef __FRAMEWORK_CONSTANT_FILTER_H_
-#define __FRAMEWORK_CONSTANT_FILTER_H_
-
-#include <rtl/ustring.hxx>
-
-namespace framework{
- namespace constant{
-
-struct Filter
-{
- public:
-
- static const ::rtl::OUString PROP_NAME; // string
- static const ::rtl::OUString PROP_TYPE; // string
- static const ::rtl::OUString PROP_DOCUMENTSERVICE; // string
- static const ::rtl::OUString PROP_FILTERSERVICE; // string
- static const ::rtl::OUString PROP_UICOMPONENT; // string
- static const ::rtl::OUString PROP_FLAGS; // int32
- static const ::rtl::OUString PROP_USERDATA; // seq< string >
- static const ::rtl::OUString PROP_TEMPLATENAME; // string
-
- static const ::rtl::OUString QUERY_GET_DEFAULT_FILTER_FOR_TYPE;
- static const ::rtl::OUString QUERY_ALL;
- static const ::rtl::OUString QUERY_WRITER;
- static const ::rtl::OUString QUERY_WEB;
- static const ::rtl::OUString QUERY_GLOBAL;
- static const ::rtl::OUString QUERY_CHART;
- static const ::rtl::OUString QUERY_CALC;
- static const ::rtl::OUString QUERY_IMPRESS;
- static const ::rtl::OUString QUERY_DRAW;
- static const ::rtl::OUString QUERY_MATH;
-
- static const ::rtl::OUString QUERYPARAM_IFLAGS;
- static const ::rtl::OUString QUERYPARAM_EFLAGS;
- static const ::rtl::OUString QUERYPARAM_SORT_PROP;
- static const ::rtl::OUString QUERYPARAM_DESCENDING;
- static const ::rtl::OUString QUERYPARAM_USE_ORDER;
- static const ::rtl::OUString QUERYPARAM_DEFAULT_FIRST;
- static const ::rtl::OUString QUERYPARAM_CASE_SENSITIVE;
- static const ::rtl::OUString QUERYPARAMVALUE_SORT_PROP_NAME;
- static const ::rtl::OUString QUERYPARAMVALUE_SORT_PROP_UINAME;
-
- static const ::rtl::OUString FLAGNAME_IMPORT;
- static const ::rtl::OUString FLAGNAME_EXPORT;
- static const ::rtl::OUString FLAGNAME_TEMPLATE;
- static const ::rtl::OUString FLAGNAME_INTERNAL;
- static const ::rtl::OUString FLAGNAME_TEMPLATEPATH;
- static const ::rtl::OUString FLAGNAME_OWN;
- static const ::rtl::OUString FLAGNAME_ALIEN;
- static const ::rtl::OUString FLAGNAME_USESOPTIONS;
- static const ::rtl::OUString FLAGNAME_DEFAULT;
- static const ::rtl::OUString FLAGNAME_EXECUTABLE;
- static const ::rtl::OUString FLAGNAME_SUPPORTSSELECTION;
- static const ::rtl::OUString FLAGNAME_MAPTOAPPPLUG;
- static const ::rtl::OUString FLAGNAME_NOTINFILEDIALOG;
- static const ::rtl::OUString FLAGNAME_NOTINCHOOSER;
- static const ::rtl::OUString FLAGNAME_ASYNCHRON;
- static const ::rtl::OUString FLAGNAME_CREATOR;
- static const ::rtl::OUString FLAGNAME_READONLY;
- static const ::rtl::OUString FLAGNAME_NOTINSTALLED;
- static const ::rtl::OUString FLAGNAME_CONSULTSERVICE;
- static const ::rtl::OUString FLAGNAME_3RDPARTYFILTER;
- static const ::rtl::OUString FLAGNAME_PACKED;
- static const ::rtl::OUString FLAGNAME_SILENTEXPORT;
- static const ::rtl::OUString FLAGNAME_BROWSERPREFERED;
- static const ::rtl::OUString FLAGNAME_PREFERED;
-
- static const sal_Int32 FLAGVALUE_IMPORT;
- static const sal_Int32 FLAGVALUE_EXPORT;
- static const sal_Int32 FLAGVALUE_TEMPLATE;
- static const sal_Int32 FLAGVALUE_INTERNAL;
- static const sal_Int32 FLAGVALUE_TEMPLATEPATH;
- static const sal_Int32 FLAGVALUE_OWN;
- static const sal_Int32 FLAGVALUE_ALIEN;
- static const sal_Int32 FLAGVALUE_USESOPTIONS;
- static const sal_Int32 FLAGVALUE_DEFAULT;
- static const sal_Int32 FLAGVALUE_EXECUTABLE;
- static const sal_Int32 FLAGVALUE_SUPPORTSSELECTION;
- static const sal_Int32 FLAGVALUE_MAPTOAPPPLUG;
- static const sal_Int32 FLAGVALUE_NOTINFILEDIALOG;
- static const sal_Int32 FLAGVALUE_NOTINCHOOSER;
- static const sal_Int32 FLAGVALUE_ASYNCHRON;
- static const sal_Int32 FLAGVALUE_CREATOR;
- static const sal_Int32 FLAGVALUE_READONLY;
- static const sal_Int32 FLAGVALUE_NOTINSTALLED;
- static const sal_Int32 FLAGVALUE_CONSULTSERVICE;
- static const sal_Int32 FLAGVALUE_3RDPARTYFILTER;
- static const sal_Int32 FLAGVALUE_PACKED;
- static const sal_Int32 FLAGVALUE_SILENTEXPORT;
- static const sal_Int32 FLAGVALUE_BROWSERPREFERED;
- //FREE! ... 0x00800000L
- static const sal_Int32 FLAGVALUE_PREFERED;
-
-};
-
- } // namespace constant
-} // namespace framework
-
-#endif // #ifndef __FRAMEWORK_CONSTANT_FILTER_H_
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 380943b8ba..392b98eb6e 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -36,9 +36,6 @@
#endif
#include <classes/framelistanalyzer.hxx>
-#ifndef __FRAMEWORK_CONSTANT_FILTER_HXX_
-#include <constant/filter.hxx>
-#endif
#include <dispatch/interaction.hxx>
#ifndef __FRAMEWORK_CONSTANT_FRAMELOADER_HXX_
@@ -1774,7 +1771,10 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X
::comphelper::ConfigurationHelper::E_READONLY);
a >>= bForceFrontAndFocus;
- pWindow->Show(sal_True, (bForceFrontAndFocus || bForceToFront) ? SHOW_FOREGROUNDTASK : 0 );
+ if( pWindow->IsVisible() && (bForceFrontAndFocus || bForceToFront) )
+ pWindow->ToTop();
+ else
+ pWindow->Show(sal_True, (bForceFrontAndFocus || bForceToFront) ? SHOW_FOREGROUNDTASK : 0 );
}
/* #i19976#
diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx
index 0252a068eb..8817e60e92 100644
--- a/framework/source/services/backingwindow.cxx
+++ b/framework/source/services/backingwindow.cxx
@@ -460,7 +460,7 @@ void BackingWindow::initBackground()
maOpenButton.SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
maOpenButton.SetSelectHdl( LINK( this, BackingWindow, SelectHdl ) );
- prepareRecentFileMenu();
+ maOpenButton.SetActivateHdl( LINK( this, BackingWindow, ActivateHdl ) );
}
void BackingWindow::initControls()
@@ -1056,6 +1056,13 @@ IMPL_LINK( BackingWindow, SelectHdl, Button*, pButton )
return 0;
}
+IMPL_LINK( BackingWindow, ActivateHdl, Button*, pButton )
+{
+ if( pButton == &maOpenButton )
+ prepareRecentFileMenu();
+ return 0;
+}
+
struct ImplDelayedDispatch
{
Reference< XDispatch > xDispatch;
diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx
index fdd8cf258d..c81c975a33 100644
--- a/framework/source/services/backingwindow.hxx
+++ b/framework/source/services/backingwindow.hxx
@@ -159,6 +159,7 @@ namespace framework
DECL_LINK( ClickHdl, Button* );
DECL_LINK( SelectHdl, Button* );
+ DECL_LINK( ActivateHdl, Button* );
DECL_LINK( ToolboxHdl, void* );
void initControls();
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 08f9b171a9..b2bd849417 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -1551,8 +1551,9 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL Frame::getComponentWindow() th
css::uno::Reference< css::frame::XController > SAL_CALL Frame::getController() throw( css::uno::RuntimeException )
{
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
+ // It seems to be unavoidable that disposed frames allow to ask for a Controller (#111452)
// Register transaction and reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+ // TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
ReadGuard aReadLock( m_aLock );
diff --git a/framework/source/threadhelp/transactionmanager.cxx b/framework/source/threadhelp/transactionmanager.cxx
index d1bb759dfc..0c09f309a6 100644
--- a/framework/source/threadhelp/transactionmanager.cxx
+++ b/framework/source/threadhelp/transactionmanager.cxx
@@ -319,42 +319,6 @@ sal_Bool TransactionManager::isCallRejected( ERejectReason& eReason ) const
}
/*-****************************************************************************************************//**
- @short return a reference to a static manager
- @descr Sometimes we need the global member! (e.g. in our own static methods)
- We create our own "class global static" member threadsafe.
- It will be created at first call only!
- All other requests use these created one then directly.
-
- @seealso -
-
- @param -
- @return A reference to a static member.
-
- @onerror No error should occure.
-*//*-*****************************************************************************************************/
-TransactionManager& TransactionManager::getGlobalTransactionManager()
-{
- // Initialize static member only for one time!
- static TransactionManager* pManager = NULL;
- // If these method first called (member not already exist!) ...
- if( pManager == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- // We must check our pointer again - because ... another instance of ouer class could be faster then these one!
- if( pManager == NULL )
- {
- // Create the new manager and set it for return on static variable.
- static TransactionManager aManager;
- pManager = &aManager;
- }
- }
- // Return new created or already existing object.
- return *pManager;
-}
-
-/*-****************************************************************************************************//**
@short throw any exceptions for rejected calls
@descr If user whish to use our automaticly exception mode we use this impl-method.
We check all combinations of eReason and eExceptionMode and throw right exception with some
diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk
index 6a65b9986f..91532cda76 100644
--- a/framework/util/makefile.mk
+++ b/framework/util/makefile.mk
@@ -256,7 +256,6 @@ SHL4OBJS= \
$(SLO)$/droptargetlistener.obj \
$(SLO)$/edittoolbarcontroller.obj \
$(SLO)$/factoryconfiguration.obj \
- $(SLO)$/filter.obj \
$(SLO)$/framecontainer.obj \
$(SLO)$/frameloader.obj \
$(SLO)$/frame.obj \
diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu
index bb3c7795a4..28fd176c79 100644
--- a/officecfg/registry/data/org/openoffice/Office/Common.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu
@@ -157,6 +157,11 @@
<value install:module="wnt">WIN</value>
</prop>
</node>
+ <node oor:name="Dictionaries">
+ <prop oor:name="RepositoryURL" install:module="brand">
+ <value>${DICT_REPO_URL}</value>
+ </prop>
+ </node>
<node oor:name="AutoCorrect">
<prop oor:name="ReplaceSingleQuote" install:module="korea">
<value>true</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/Paths.xcu b/officecfg/registry/data/org/openoffice/Office/Paths.xcu
index bb062d94a8..8fef51ca23 100644
--- a/officecfg/registry/data/org/openoffice/Office/Paths.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Paths.xcu
@@ -98,7 +98,13 @@
</node>
</node>
- <node oor:name="Gallery" oor:op="fuse" oor:mandatory="true">
+ <node oor:name="Libraries" oor:op="fuse" oor:mandatory="true">
+ <node oor:name="InternalPaths">
+ <node oor:name="$(progpath)/libraries" oor:op="fuse" />
+ </node>
+ </node>
+
+ <node oor:name="Gallery" oor:op="fuse" oor:mandatory="true">
<node oor:name="InternalPaths">
<node oor:name="$(insturl)/share/gallery" oor:op="fuse" />
</node>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index d3db05206a..33e5109405 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -1254,6 +1254,19 @@
<value xml:lang="en-US">Rename Sheet</value>
</prop>
</node>
+ <node oor:name=".uno:SetTabBgColor" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">~Tab Color...</value>
+ </prop>
+ <prop oor:name="ContextLabel" oor:type="xs:string">
+ <value xml:lang="en-US">~Tab Color...</value>
+ </prop>
+ </node>
+ <node oor:name=".uno:TabBgColor" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Tab Color</value>
+ </prop>
+ </node>
<node oor:name=".uno:Move" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">~Move/Copy Sheet...</value>
diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu
index 739e14f73c..fa79715054 100644
--- a/officecfg/registry/data/org/openoffice/VCL.xcu
+++ b/officecfg/registry/data/org/openoffice/VCL.xcu
@@ -547,22 +547,22 @@
</node>
<node oor:name="zh-cn" oor:op="replace">
<prop oor:name="CJK_DISPLAY" oor:type="xs:string" oor:op="replace">
- <value>方正宋体;MSung Light SC;SimSun;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正宋体;MSung Light SC;SimSun;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="LATIN_FIXED" oor:type="xs:string" oor:op="replace">
<value>方正宋体;新宋体;NSimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced</value>
</prop>
<prop oor:name="CJK_HEADING" oor:type="xs:string" oor:op="replace">
- <value>方正黑体;方正宋体;宋体;SimSun;黑体;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正黑体;方正宋体;宋体;SimSun;黑体;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_PRESENTATION" oor:type="xs:string" oor:op="replace">
- <value>方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_SPREADSHEET" oor:type="xs:string" oor:op="replace">
- <value>方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_TEXT" oor:type="xs:string" oor:op="replace">
- <value>方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>方正宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Song;FZSongYi;FZShuSong;NSimSun;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="UI_FIXED" oor:type="xs:string" oor:op="replace">
<value>方正宋体;新宋体;NSimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced</value>
@@ -571,7 +571,7 @@
<value>方正宋体;新宋体;NSimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light SC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced</value>
</prop>
<prop oor:name="UI_SANS" oor:type="xs:string" oor:op="replace">
- <value>方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Arial Unicode MS;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif</value>
+ <value>方正宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Arial Unicode MS;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif</value>
</prop>
</node>
<node oor:name="zh-tw" oor:op="replace">
@@ -579,19 +579,19 @@
<value>方正明體;細明體;MingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced</value>
</prop>
<prop oor:name="CJK_DISPLAY" oor:type="xs:string" oor:op="replace">
- <value>方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_HEADING" oor:type="xs:string" oor:op="replace">
<value>方正黑体;新細明體;PMingLiU;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_PRESENTATION" oor:type="xs:string" oor:op="replace">
- <value>方正明體;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正明體;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_SPREADSHEET" oor:type="xs:string" oor:op="replace">
- <value>方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_TEXT" oor:type="xs:string" oor:op="replace">
- <value>方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="UI_FIXED" oor:type="xs:string" oor:op="replace">
<value>方正明體;細明體;MingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced</value>
@@ -600,7 +600,7 @@
<value>方正明體;細明體;MingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced</value>
</prop>
<prop oor:name="UI_SANS" oor:type="xs:string" oor:op="replace">
- <value>方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;Arial Unicode MS;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif</value>
+ <value>微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;Arial Unicode MS;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif</value>
</prop>
</node>
<node oor:name="zh-hk" oor:op="replace">
@@ -608,16 +608,16 @@
<value>方正明體;細明體;MingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced</value>
</prop>
<prop oor:name="CJK_DISPLAY" oor:type="xs:string" oor:op="replace">
- <value>方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_HEADING" oor:type="xs:string" oor:op="replace">
- <value>FZHeiTi;方正明體;新細明體;PMingLiU;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;FZHeiTi;方正明體;新細明體;PMingLiU;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_PRESENTATION" oor:type="xs:string" oor:op="replace">
- <value>方正明體;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正明體;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_SPREADSHEET" oor:type="xs:string" oor:op="replace">
- <value>方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_TEXT" oor:type="xs:string" oor:op="replace">
<value>方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;MingLiU;Ming;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
@@ -629,7 +629,7 @@
<value>方正明體;細明體;MingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced</value>
</prop>
<prop oor:name="UI_SANS" oor:type="xs:string" oor:op="replace">
- <value>方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;Arial Unicode MS;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif</value>
+ <value>微软雅黑;方正明體;新細明體;PMingLiU;文鼎PL細上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;Arial Unicode MS;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif</value>
</prop>
</node>
<node oor:name="zh-sg" oor:op="replace">
@@ -637,19 +637,19 @@
<value>方正宋体;新宋体;NSimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced</value>
</prop>
<prop oor:name="CJK_DISPLAY" oor:type="xs:string" oor:op="replace">
- <value>方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_HEADING" oor:type="xs:string" oor:op="replace">
- <value>方正黑体;方正宋体;宋体;SimSun;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正黑体;方正宋体;宋体;SimSun;文鼎PL中楷Uni;AR PL ZenKai Uni;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_PRESENTATION" oor:type="xs:string" oor:op="replace">
- <value>方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_SPREADSHEET" oor:type="xs:string" oor:op="replace">
- <value>方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="CJK_TEXT" oor:type="xs:string" oor:op="replace">
- <value>方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
+ <value>微软雅黑;方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Song;FZSongYi;FZShuSong;MSung Light TC;MingLiU;Ming;PMingLiU;Andale Sans UI;Arial Unicode MS;Lucida Sans Unicode;Tahoma</value>
</prop>
<prop oor:name="UI_FIXED" oor:type="xs:string" oor:op="replace">
<value>方正宋体;新宋体;NSimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced</value>
@@ -658,7 +658,7 @@
<value>方正宋体;新宋体;NSimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;MSung Light TC;Cumberland AMT;Cumberland;Courier New;Nimbus Mono L;Courier;Lucida Sans Typewriter;Lucida Typewriter;Monaco;Monospaced</value>
</prop>
<prop oor:name="UI_SANS" oor:type="xs:string" oor:op="replace">
- <value>方正宋体;宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Arial Unicode MS;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif</value>
+ <value>方正宋体;SimSun;文鼎PL细上海宋Uni;AR PL ShanHeiSun Uni;文鼎PL新宋;AR PL New Sung;Andale Sans UI;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Arial Unicode MS;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;WarpSans;Geneva;Tahoma;MS Sans Serif;Helv;Dialog;Albany AMT;Albany;Lucida;Arial;Nimbus Sans L;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif</value>
</prop>
</node>
<node oor:name="ko-kr" oor:op="replace">
diff --git a/officecfg/registry/schema/oo-ldap-attr-map.properties b/officecfg/registry/schema/oo-ldap-attr-map.properties
index c67cd5262f..684dfbdebf 100644
--- a/officecfg/registry/schema/oo-ldap-attr-map.properties
+++ b/officecfg/registry/schema/oo-ldap-attr-map.properties
@@ -1,4 +1,5 @@
# inetOrgPerson.givenName
+# x-no-translate
org.openoffice.UserProfile/Data/givenname = givenname
# person.sn
diff --git a/officecfg/registry/schema/oo-org-map.properties b/officecfg/registry/schema/oo-org-map.properties
index 1f4b437767..dc87a4346c 100644
--- a/officecfg/registry/schema/oo-org-map.properties
+++ b/officecfg/registry/schema/oo-org-map.properties
@@ -1,5 +1,6 @@
# attribute and objectclass identifying a user
# multi values are supported, separated by comma
+# x-no-translate
User/ObjectClass=inetorgperson
User/NamingAttribute=uid
User/Container=ou=People
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index cb19bb01e1..02e05a9329 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -974,6 +974,19 @@
<value>false</value>
</prop>
</group>
+ <group oor:name="Dictionaries">
+ <info>
+ <author>CD</author>
+ <desc>Contains settings related to dictionaries.</desc>
+ </info>
+ <prop oor:name="RepositoryURL" oor:type="xs:string">
+ <info>
+ <author>CD</author>
+ <desc>Specifies a repository URL where users can download additional dictionaries.</desc>
+ </info>
+ <value/>
+ </prop>
+ </group>
<group oor:name="Drawinglayer">
<info>
<author>AW</author>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs b/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs
index 7cb13b7070..8762f839b7 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs
@@ -252,7 +252,7 @@
<desc>Specifies the custom dictionaries to be used. The Ignore list (IgnoreAllList (All)) is administered in the RAM only for the current spellcheck.</desc>
<label>Custom dictionaries</label>
</info>
- <value oor:separator=";">IgnoreAllList;soffice.dic;standard.dic;sun.dic</value>
+ <value oor:separator=";">IgnoreAllList;soffice.dic;standard.dic;oracle.dic</value>
</prop>
<prop oor:name="IsUseDictionaryList" oor:type="xs:boolean">
<!-- OldLocation: NEW -->
diff --git a/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs b/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs
index 7ff9146472..7b0b221f15 100755
--- a/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs
@@ -15,7 +15,7 @@
OpenOffice.org Improvement Program. If this is zero the user will get asked.
</desc>
</info>
- <value>1</value>
+ <value>2</value>
</prop>
<prop oor:name="InvitationAccepted" oor:type="xs:boolean">
<info>
diff --git a/oovbaapi/ooo/vba/XApplicationBase.idl b/oovbaapi/ooo/vba/XApplicationBase.idl
index bfcc75ecca..6157d38079 100644
--- a/oovbaapi/ooo/vba/XApplicationBase.idl
+++ b/oovbaapi/ooo/vba/XApplicationBase.idl
@@ -38,19 +38,27 @@
module ooo { module vba {
//=============================================================================
+
+
interface XApplicationBase
{
interface ::ooo::vba::XHelperInterface;
[attribute] boolean ScreenUpdating;
[attribute] boolean DisplayStatusBar;
+ [attribute] boolean Interactive;
[attribute, readonly] string Version;
+ //mbn
+ [attribute, readonly] any VBE;
+ [attribute, readonly] any VBProjects;
void Quit();
any CommandBars( [in] any aIndex );
void Run([in] string MacroName, [in] /*Optional*/ any varg1, [in] /*Optional*/ any varg2, [in] /*Optional*/ any varg3, [in] /*Optional*/ any varg4, [in] /*Optional*/ any varg5, [in] /*Optional*/ any varg6, [in] /*Optional*/ any varg7, [in] /*Optional*/ any varg8, [in] /*Optional*/ any varg9, [in] /*Optional*/ any varg10, [in] /*Optional*/ any varg11, [in] /*Optional*/ any varg12, [in] /*Optional*/ any varg13, [in] /*Optional*/ any varg14, [in] /*Optional*/ any varg15, [in] /*Optional*/ any varg16, [in] /*Optional*/ any varg17, [in] /*Optional*/ any varg18, [in] /*Optional*/ any varg19, [in] /*Optional*/ any varg20, [in] /*Optional*/ any varg21, [in] /*Optional*/ any varg22, [in] /*Optional*/ any varg23, [in] /*Optional*/ any varg24, [in] /*Optional*/ any varg25, [in] /*Optional*/ any varg26, [in] /*Optional*/ any varg27, [in] /*Optional*/ any varg28, [in] /*Optional*/ any varg29, [in] /*Optional*/ any varg30);
+ void OnTime( [in] any aEarliestTime, [in] string aFunction, [in] any aLatestTime, [in] any aSchedule );
float CentimetersToPoints([in] float Centimeters );
+ void Undo();
};
}; };
diff --git a/oovbaapi/ooo/vba/XCollection.idl b/oovbaapi/ooo/vba/XCollection.idl
index b984bccd64..7b41e9e682 100644
--- a/oovbaapi/ooo/vba/XCollection.idl
+++ b/oovbaapi/ooo/vba/XCollection.idl
@@ -52,6 +52,7 @@ interface XCollection
interface ::com::sun::star::container::XEnumerationAccess;
[attribute, readonly] long Count;
+
any Item( [in] any Index1, [in] any Index2 );
};
diff --git a/oovbaapi/ooo/vba/XCommandBarControl.idl b/oovbaapi/ooo/vba/XCommandBarControl.idl
index 5bf7aeb700..2049cf5342 100644
--- a/oovbaapi/ooo/vba/XCommandBarControl.idl
+++ b/oovbaapi/ooo/vba/XCommandBarControl.idl
@@ -48,7 +48,8 @@ interface XCommandBarControl
[attribute] boolean Visible;
[attribute, readonly] long Type;
[attribute] boolean Enabled;
-
+ [attribute] boolean BeginGroup;
+
void Delete() raises ( com::sun::star::script::BasicErrorException );
any Controls( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
};
diff --git a/oovbaapi/ooo/vba/XDocumentBase.idl b/oovbaapi/ooo/vba/XDocumentBase.idl
index 5845d8b4b5..bb45cafdac 100644
--- a/oovbaapi/ooo/vba/XDocumentBase.idl
+++ b/oovbaapi/ooo/vba/XDocumentBase.idl
@@ -38,6 +38,8 @@
module ooo { module vba {
//=============================================================================
+
+
interface XDocumentBase
{
interface ::ooo::vba::XHelperInterface;
@@ -46,6 +48,7 @@ interface XDocumentBase
[attribute, readonly] string Path;
[attribute, readonly] string FullName;
[attribute] boolean Saved;
+ [attribute, readonly] any VBProject; // Michael E. Bohn
void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook);
void Save();
diff --git a/oovbaapi/ooo/vba/XVBAAppService.idl b/oovbaapi/ooo/vba/XVBAAppService.idl
new file mode 100755
index 0000000000..38cb0f9a1a
--- /dev/null
+++ b/oovbaapi/ooo/vba/XVBAAppService.idl
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XWorkbook.idl,v $
+ * $Revision: 1.4 $
+ *
+ * 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 __ooo_vba_appservice_idl__
+#define __ooo_vba_appservice_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __com_sun_star_uno_XComponentContext_idl__
+#include <com/sun/star/uno/XComponentContext.idl>
+#endif
+
+#ifndef __com_sun_star_frame_XModel_idl__
+#include <com/sun/star/frame/XModel.idl>
+#endif
+
+#ifndef __com_sun_star_script_XLibraryContainer_idl__
+#include <com/sun/star/script/XLibraryContainer.idl>
+#endif
+
+//=============================================================================
+
+module ooo { module vba {
+
+//=============================================================================
+
+
+interface XHelperInterface;
+interface XComponentContext;
+interface XModel;
+
+interface XVBAAppService
+{
+ interface ::com::sun::star::uno::XInterface;
+
+ any getVBE([in] XHelperInterface xParent, [in] ::com::sun::star::uno::XComponentContext xContext, [in] ::com::sun::star::frame::XModel xModel);
+ any getVBProjects([in] XHelperInterface xParent, [in] ::com::sun::star::uno::XComponentContext xContext, [in] ::com::sun::star::frame::XModel xModel, [in] ::com::sun::star::script::XLibraryContainer xMacroLibraryContainer, [in] com::sun::star::script::XLibraryContainer xDialogLibraryContainer);
+
+
+};
+
+ }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/XVBADocService.idl b/oovbaapi/ooo/vba/XVBADocService.idl
new file mode 100755
index 0000000000..2028772702
--- /dev/null
+++ b/oovbaapi/ooo/vba/XVBADocService.idl
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XVBADocService.idl,v $
+ * $Revision: 1.4 $
+ *
+ * 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 __ooo_vba_socservice_idl__
+#define __ooo_vba_appservice_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __com_sun_star_uno_XComponentContext_idl__
+#include <com/sun/star/uno/XComponentContext.idl>
+#endif
+
+#ifndef __com_sun_star_frame_XModel_idl__
+#include <com/sun/star/frame/XModel.idl>
+#endif
+
+#ifndef __com_sun_star_script_XLibraryContainer_idl__
+#include <com/sun/star/script/XLibraryContainer.idl>
+#endif
+
+//=============================================================================
+
+module ooo { module vba {
+
+//=============================================================================
+
+
+interface XHelperInterface;
+interface XComponentContext;
+interface XModel;
+
+interface XVBADocService
+{
+ interface ::com::sun::star::uno::XInterface;
+
+
+ any getVBProject([in] XHelperInterface xParent, [in] ::com::sun::star::uno::XComponentContext xContext, [in] ::com::sun::star::frame::XModel xModel, [in] ::com::sun::star::script::XLibraryContainer xMacroLibraryContainer, [in] com::sun::star::script::XLibraryContainer xDialogLibraryContainer);
+
+
+};
+
+ }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/excel/SheetObject.idl b/oovbaapi/ooo/vba/excel/SheetObject.idl
new file mode 100755
index 0000000000..5d8e6efb39
--- /dev/null
+++ b/oovbaapi/ooo/vba/excel/SheetObject.idl
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * 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 __ooo_vba_excel_SheetObject_idl__
+#define __ooo_vba_excel_SheetObject_idl__
+
+#include <ooo/vba/excel/XCharacters.idl>
+
+//=============================================================================
+
+/* Note: This file collects all compatibility interfaces for drawing objects
+ and drawing controls embedded in sheets. All these symbols are deprecated
+ in VBA and kept for compatibility with old VBA scripts. */
+
+//=============================================================================
+
+module ooo { module vba { module excel {
+
+//=============================================================================
+
+/** Base interface for graphic objects and drawing controls in a single sheet.
+
+ <p>The objects supporting this interface are now deprecated in VBA in
+ favour of the Shapes and OLEObjects collections, but are kept for
+ compatibility with old VBA scripts. All form control objects do NOT belong
+ to ActiveX form controls but to the old-style drawing controls.</p>
+ */
+interface XSheetObject : ooo::vba::XHelperInterface
+{
+ /** Left coordinate of the drawing object, in points. */
+ [attribute] double Left;
+
+ /** Top coordinate of the drawing object, in points. */
+ [attribute] double Top;
+
+ /** Width of the drawing object, in points. */
+ [attribute] double Width;
+
+ /** Height of the drawing object, in points. */
+ [attribute] double Height;
+
+ /** The name of the drawing object, used as collection key. */
+ [attribute] string Name;
+
+ /** Name of a macro that will be executed when the drawing object is clicked. */
+ [attribute] string OnAction;
+
+ /** Anchor mode of the object (fixed or variable position and size). Must
+ be a value from <type>ooo::vba::excel::XlPlacement</type>. */
+ [attribute] long Placement;
+
+ /** True = print object, false = skip object on printing. */
+ [attribute] boolean PrintObject;
+};
+
+//=============================================================================
+
+/** Additional attributes for all drawing controls (this interface does not
+ belong to ActiveX form controls).
+ */
+interface XControlObject : com::sun::star::uno::XInterface
+{
+ [attribute] boolean AutoSize;
+};
+
+//=============================================================================
+
+/** Additional attributes for a push button drawing control (this interface
+ does not belong to ActiveX form controls).
+ */
+interface XButton : com::sun::star::uno::XInterface
+{
+ /** Visible caption of the button. */
+ [attribute] string Caption;
+
+ /** Font settings for the entire caption text. */
+ [attribute] XFont Font;
+
+ /** Horizontal alignment of the caption. */
+ [attribute] long HorizontalAlignment;
+
+ /** Vertical alignment of the caption. */
+ [attribute] long VerticalAlignment;
+
+ /** Orientation (rotation) of the text. Must be a value from
+ <type>ooo::vba::excel::XlOrientation</type>. */
+ [attribute] long Orientation;
+
+ /** Access to text and text formatting of the button caption. */
+ XCharacters Characters( [in] any aStart, [in] any aLength );
+};
+
+//=============================================================================
+
+/** Represents a drawing button control in a spreadsheet. */
+service Button
+{
+ interface XSheetObject;
+ interface XControlObject;
+ interface XButton;
+};
+
+//=============================================================================
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/excel/SheetObjects.idl b/oovbaapi/ooo/vba/excel/SheetObjects.idl
new file mode 100755
index 0000000000..4c93bb3bf5
--- /dev/null
+++ b/oovbaapi/ooo/vba/excel/SheetObjects.idl
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * 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 __ooo_vba_excel_SheetObjects_idl__
+#define __ooo_vba_excel_SheetObjects_idl__
+
+#include <ooo/vba/XCollection.idl>
+
+//=============================================================================
+
+/* Note: This file collects all compatibility interfaces for collections of
+ drawing objects and drawing controls embedded in sheets. All these symbols
+ are deprecated in VBA and kept for compatibility with old VBA scripts. */
+
+//=============================================================================
+
+module ooo { module vba { module excel {
+
+//=============================================================================
+
+/** Collections that implement this interface provide access to a specific type
+ of drawing objects in a single sheet.
+
+ <p>The following sheet symbols represent collections of graphic objects,
+ and therefore implement this interface:</p>
+ <ul><li>Buttons: push button (command button) controls,</li>
+ <li>ChartObjects: chart objects embedded in the sheet,</li>
+ <li>CheckBoxes: check box controls,</li>
+ <li>DropDowns: drop-down listbox controls,</li>
+ <li>EditBoxes: text edit controls (dialog sheets only),</li>
+ <li>GroupBoxes: group frame controls,</li>
+ <li>GroupObjects: group objects containing other child objects,</li>
+ <li>Labels: fixed text controls,</li>
+ <li>ListBoxes: plain listbox controls,</li>
+ <li>OptionButtons: option button (radio button) controls,</li>
+ <li>Ovals: simple ovals and circles,</li>
+ <li>Pictures: picture objects,</li>
+ <li>Rectangles: simple rectangle objects,</li>
+ <li>ScrollBars: scrollbar controls,</li>
+ <li>Spinners: spinner (spin button) controls,</li>
+ <li>TextBoxes: rectangle objects with embedded text.</li></ul>
+
+ <p>These symbols are now deprecated in VBA but kept for compatibility with
+ old VBA scripts. All symbols representing collections of form controls do
+ NOT belong to ActiveX form controls but to the old-style drawing controls.
+ </p>
+ */
+interface XGraphicObjects : com::sun::star::uno::XInterface
+{
+ /** Adds a new graphic object to the sheet this collection belongs to. The
+ type of the object is determined by the type of the collection.
+
+ @param fLeft Position of the left border in points (1/72 inch).
+ @param fTop Position of the top border in points (1/72 inch).
+ @param fWidth Width of the object in points (1/72 inch).
+ @param fHeight Height of the object in points (1/72 inch).
+
+ @return The created graphic object.
+ */
+ any Add( [in] any fLeft, [in] any fTop, [in] any fWidth, [in] any fHeight );
+};
+
+//=============================================================================
+
+/** Collections that implement this interface provide access to a specific type
+ of drawing objects in a single sheet.
+
+ <p>The following sheet symbols represent collections of line objects, and
+ therefore implement this interface:</p>
+ <ul><li>Arcs: arc objects, and</li>
+ <li>Lines: straight line ojects.</li></ul>
+
+ <p>These symbols are now deprecated in VBA but kept for compatibility with
+ old VBA scripts.</p>
+ */
+interface XLineObjects : com::sun::star::uno::XInterface
+{
+ /** Adds a new line object to the sheet this collection belongs to. The
+ type of the object is determined by the type of the collection.
+
+ @param fX1 Position of the first X coordinate in points (1/72 inch).
+ @param fY1 Position of the first Y coordinate in points (1/72 inch).
+ @param fX2 Position of the last X coordinate in points (1/72 inch).
+ @param fY2 Position of the last Y coordinate in points (1/72 inch).
+
+ @return The created line object.
+ */
+ any Add( [in] any fX1, [in] any fY1, [in] any fX2, [in] any fY2 );
+};
+
+//=============================================================================
+
+/** A collection providing access to all polygon objects in a single sheet.
+
+ <p>This symbol is now deprecated in VBA but kept for compatibility with old
+ VBA scripts.</p>
+ */
+interface XDrawings : com::sun::star::uno::XInterface
+{
+ /** Adds a new polygon object to the sheet this collection belongs to.
+
+ @param fX1 Position of the first X coordinate in points (1/72 inch).
+ @param fY1 Position of the first Y coordinate in points (1/72 inch).
+ @param fX2 Position of the last X coordinate in points (1/72 inch).
+ @param fY2 Position of the last Y coordinate in points (1/72 inch).
+ @param bClosed True = outline closed (last and first point connected).
+
+ @return The created polygon object.
+ */
+ any Add( [in] any fX1, [in] any fY1, [in] any fX2, [in] any fY2, [in] any bClosed );
+};
+
+//=============================================================================
+
+/** Represents the collection of drawing button controls in a spreadsheet. */
+service Buttons
+{
+ interface ooo::vba::XCollection;
+ interface XGraphicObjects;
+};
+
+//=============================================================================
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index cae978d917..e7b9aee618 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -27,17 +27,10 @@
#ifndef __ooo_vba_excel_XApplication_idl__
#define __ooo_vba_excel_XApplication_idl__
-#ifndef __com_sun_star_uno_XInterface_idl__
-#include <com/sun/star/uno/XInterface.idl>
-#endif
-
-#ifndef __ooo_vba_XHelperInterface_idl__
+#include <com/sun/star/beans/XExactName.idl>
+#include <com/sun/star/script/XInvocation.idl>
#include <ooo/vba/XHelperInterface.idl>
-#endif
-
-#ifndef __ooo_vba_XAssistant_idl__
#include <ooo/vba/XAssistant.idl>
-#endif
module ooo { module vba { module excel {
@@ -49,9 +42,12 @@ interface XWorksheetFunction;
interface XWindow;
interface XWorksheet;
-interface XApplication : com::sun::star::uno::XInterface
+interface XApplication
{
-
+ // Application serves as WorksheetFunction object with little differences
+ interface ::com::sun::star::beans::XExactName;
+ interface ::com::sun::star::script::XInvocation;
+
// interface ::ooo::vba::XHelperInterface;
[attribute, readonly] any Selection;
@@ -86,8 +82,7 @@ interface XApplication : com::sun::star::uno::XInterface
any Range( [in] any Cell1, [in] any Cell2 );
any Names( [in] any Index );
void GoTo( [in] any Reference, [in] any Scroll );
- // #FIXME #TODO up to 30 args needed
- double CountA( [in] any arg1 );
+
void wait( [in] double time );
void Calculate() raises(com::sun::star::script::BasicErrorException);
XRange Intersect([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
diff --git a/oovbaapi/ooo/vba/excel/XComment.idl b/oovbaapi/ooo/vba/excel/XComment.idl
index f5271e20f5..e691c1f0d7 100644
--- a/oovbaapi/ooo/vba/excel/XComment.idl
+++ b/oovbaapi/ooo/vba/excel/XComment.idl
@@ -27,15 +27,8 @@
#ifndef __ooo_vba_excel_XComment_idl__
#define __ooo_vba_excel_XComment_idl__
-#ifndef __com_sun_star_uno_XInterface_idl__
-#include <com/sun/star/uno/XInterface.idl>
-#endif
-#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
-#include <com/sun/star/lang/IllegalArgumentException.idl>
-#endif
-#ifndef __ooo_vba_XHelperInterface_idl__
-#include <ooo/vba/XHelperInterface.idl>
-#endif
+#include <ooo/vba/msforms/XShape.idl>
+
//=============================================================================
module ooo { module vba { module excel {
@@ -48,7 +41,7 @@ interface XComment
interface ::ooo::vba::XHelperInterface;
[attribute] string Author;
-// [attribute, readonly] Shape Shape;
+ [attribute, readonly] ooo::vba::msforms::XShape Shape;
[attribute] boolean Visible;
void Delete();
diff --git a/oovbaapi/ooo/vba/excel/XHyperlink.idl b/oovbaapi/ooo/vba/excel/XHyperlink.idl
index 8ee5ddf938..76a2694c25 100644
--- a/oovbaapi/ooo/vba/excel/XHyperlink.idl
+++ b/oovbaapi/ooo/vba/excel/XHyperlink.idl
@@ -27,31 +27,38 @@
#ifndef __ooo_vba_excel_XHyperlink_idl__
#define __ooo_vba_excel_XHyperlink_idl__
-#ifndef __com_sun_star_uno_XInterface_idl__
-#include <com/sun/star/uno/XInterface.idl>
-#endif
-
-#ifndef __ooo_vba_XHelperInterface_idl__
#include <ooo/vba/XHelperInterface.idl>
-#endif
//=============================================================================
-
+
+module ooo { module vba { module msforms {
+ interface XShape;
+}; }; };
+
module ooo { module vba { module excel {
-//=============================================================================
interface XRange;
+
+//=============================================================================
+
interface XHyperlink
{
interface ::ooo::vba::XHelperInterface;
-
- [attribute] string Address;
+
[attribute] string Name;
+ [attribute] string Address;
+ [attribute] string SubAddress;
+ [attribute] string ScreenTip;
[attribute] string TextToDisplay;
-
- XRange Range();
+ [attribute, readonly] long Type;
+ [attribute, readonly] XRange Range;
+ [attribute, readonly] ooo::vba::msforms::XShape Shape;
};
+//=============================================================================
+
}; }; };
+//=============================================================================
+
#endif
diff --git a/oovbaapi/ooo/vba/excel/XHyperlinks.idl b/oovbaapi/ooo/vba/excel/XHyperlinks.idl
new file mode 100755
index 0000000000..76c6daf3e3
--- /dev/null
+++ b/oovbaapi/ooo/vba/excel/XHyperlinks.idl
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * 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 __ooo_vba_excel_XHyperlinks_idl__
+#define __ooo_vba_excel_XHyperlinks_idl__
+
+#include <ooo/vba/XCollection.idl>
+
+//=============================================================================
+
+module ooo { module vba { module excel {
+
+//=============================================================================
+
+interface XHyperlink;
+
+interface XHyperlinks
+{
+ // ------------------------------------------------------------------------
+
+ interface ::ooo::vba::XCollection;
+
+ // ------------------------------------------------------------------------
+
+ XHyperlink Add(
+ [in] any aAnchor,
+ [in] any aAddress,
+ [in] any aSubAddress,
+ [in] any aScreenTip,
+ [in] any aTextToDisplay );
+
+ // ------------------------------------------------------------------------
+
+ void Delete();
+
+ // ------------------------------------------------------------------------
+
+};
+
+//=============================================================================
+
+}; }; };
+
+//=============================================================================
+
+#endif
diff --git a/oovbaapi/ooo/vba/excel/XPane.idl b/oovbaapi/ooo/vba/excel/XPane.idl
index f3e74f87d9..93330f9648 100644
--- a/oovbaapi/ooo/vba/excel/XPane.idl
+++ b/oovbaapi/ooo/vba/excel/XPane.idl
@@ -27,9 +27,7 @@
#ifndef __com_sun_star_helper_XPane_idl__
#define __com_sun_star_helper_XPane_idl__
-#ifndef __com_sun_star_uno_XInterface_idl__
#include <com/sun/star/uno/XInterface.idl>
-#endif
//============================================================================
@@ -37,10 +35,13 @@ module ooo { module vba { module excel {
//============================================================================
-interface XPane: com::sun::star::uno::XInterface
+interface XRange;
+
+interface XPane : com::sun::star::uno::XInterface
{
[attribute] long ScrollColumn;
[attribute] long ScrollRow;
+ [attribute, readonly] XRange VisibleRange;
void SmallScroll([in] /*Optional*/ any Down, [in] /*Optional*/ any Up, [in] /*Optional*/ any ToRight, [in] /*Optional*/ any ToLeft);
void LargeScroll([in] /*Optional*/ any Down, [in] /*Optional*/ any Up, [in] /*Optional*/ any ToRight, [in] /*Optional*/ any ToLeft);
diff --git a/oovbaapi/ooo/vba/excel/XRange.idl b/oovbaapi/ooo/vba/excel/XRange.idl
index afb1de6d4d..5d59a3baec 100644
--- a/oovbaapi/ooo/vba/excel/XRange.idl
+++ b/oovbaapi/ooo/vba/excel/XRange.idl
@@ -98,6 +98,7 @@ interface XRange
[attribute, readonly ] any Left;
[attribute] any PageBreak;
[attribute, readonly] XValidation Validation;
+ [attribute, readonly] any PrefixCharacter;
[attribute] any Style;
[attribute] any AddIndent;
[attribute] any ShowDetail;
@@ -164,7 +165,7 @@ interface XRange
void RemoveSubtotal() raises ( com::sun::star::script::BasicErrorException );
void Subtotal( [in] long GroupBy, [in] long Function, [in] /*Optional*/ sequence<long> TotalList, [in] /*Optional*/ any Replace, [in] /*Optional*/ any PageBreaks, [in] any SummaryBelowData ) raises ( com::sun::star::script::BasicErrorException );
XRange MergeArea( ) raises ( com::sun::star::script::BasicErrorException );
-
+ any Hyperlinks( [in] any aIndex );
};
//=============================================================================
diff --git a/oovbaapi/ooo/vba/excel/XWindow.idl b/oovbaapi/ooo/vba/excel/XWindow.idl
index 47b3846248..e2bf39a699 100644
--- a/oovbaapi/ooo/vba/excel/XWindow.idl
+++ b/oovbaapi/ooo/vba/excel/XWindow.idl
@@ -27,22 +27,18 @@
#ifndef __ooo_vba_excel_XWindow_idl__
#define __ooo_vba_excel_XWindow_idl__
-#ifndef __com_sun_star_uno_XInterface_idl__
-#include <com/sun/star/uno/XInterface.idl>
-#endif
-
-#ifndef __ooo_vba_XHelperInterface_idl__
#include <ooo/vba/XHelperInterface.idl>
-#endif
//=============================================================================
module ooo { module vba { module excel {
//=============================================================================
+
interface XRange;
interface XWorksheet;
interface XPane;
+
interface XWindow : com::sun::star::uno::XInterface
{
[attribute] any Caption;
@@ -61,6 +57,7 @@ interface XWindow : com::sun::star::uno::XInterface
[attribute] any ScrollColumn;
[attribute] any ScrollRow;
[attribute] any View;
+ [attribute, readonly] XRange VisibleRange;
[attribute] any WindowState;
[attribute] any Zoom;
any SelectedSheets( [in] any aIndex );
@@ -71,6 +68,7 @@ interface XWindow : com::sun::star::uno::XInterface
void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook);
XRange ActiveCell() raises(com::sun::star::script::BasicErrorException);
any Selection() raises(com::sun::star::script::BasicErrorException);
+ XRange RangeSelection() raises(com::sun::star::script::BasicErrorException);
long PointsToScreenPixelsX([in] long Points) raises(com::sun::star::script::BasicErrorException);
long PointsToScreenPixelsY([in] long Points) raises(com::sun::star::script::BasicErrorException);
void PrintOut([in] /*optional short*/ any From,
diff --git a/oovbaapi/ooo/vba/excel/XWorksheet.idl b/oovbaapi/ooo/vba/excel/XWorksheet.idl
index fb133abaf3..f59c9eb345 100644
--- a/oovbaapi/ooo/vba/excel/XWorksheet.idl
+++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl
@@ -83,6 +83,8 @@ interface XWorksheet
void Protect([in] any Password,[in] any DrawingObjects ,[in] any Contents,[in] any Scenarios,[in] any UserInterfaceOnly);
void Unprotect([in] any Password );
void CheckSpelling([in] any CustomDictionary,[in] any IgnoreUppercase, [in] any AlwaysSuggest,[in] any SpellingLang );
+ void ShowDataForm();
+
XRange Range([in] any Cell1, [in] any Cell2 );
any ChartObjects([in] any Index);
any PivotTables([in] any Index);
@@ -92,23 +94,32 @@ interface XWorksheet
any HPageBreaks([in] any Index);
any VPageBreaks([in] any Index);
any OLEObjects([in] any Index);
- void ShowDataForm();
any Shapes([in] any Index);
+ /* The following form control related symbols do not refer to ActiveX form
+ controls embedded in the sheet, but to the old-style drawing controls
+ of Excel. This is an Excel-only feature. */
+ any Buttons( [in] any aIndex );
+ any CheckBoxes( [in] any aIndex );
+ any DropDowns( [in] any aIndex );
+ any GroupBoxes( [in] any aIndex );
+ any Labels( [in] any aIndex );
+ any ListBoxes( [in] any aIndex );
+ any OptionButtons( [in] any aIndex );
+ any ScrollBars( [in] any aIndex );
+ any Spinners( [in] any aIndex );
// FIXME: should prolly inherit from Range somehow...
XRange Cells([in] any RowIndex, [in] any ColumnIndex);
XRange Rows([in] any aIndex);
XRange Columns([in] any aIndex);
+ any Hyperlinks( [in] any aIndex );
any Evaluate( [in] string Name);
-
void setEnableCalculation([in] boolean EnableCalculation) raises(com::sun::star::script::BasicErrorException);
boolean getEnableCalculation() raises(com::sun::star::script::BasicErrorException);
void PrintOut( [in] any From, [in] any To, [in] any Copies, [in] any Preview, [in] any ActivePrinter, [in] any PrintToFile, [in] any Collate, [in] any PrToFileName, [in] any IgnorePrintAreas );
-
-
};
//=============================================================================
@@ -116,5 +127,3 @@ interface XWorksheet
}; }; };
#endif
-
-
diff --git a/oovbaapi/ooo/vba/excel/makefile.mk b/oovbaapi/ooo/vba/excel/makefile.mk
index 01e26d4cb1..12dcf025e4 100644
--- a/oovbaapi/ooo/vba/excel/makefile.mk
+++ b/oovbaapi/ooo/vba/excel/makefile.mk
@@ -39,6 +39,8 @@ PACKAGE=ooo$/vba$/Excel
IDLFILES= XGlobals.idl\
Globals.idl\
+ SheetObject.idl\
+ SheetObjects.idl\
XApplication.idl\
XComment.idl\
XComments.idl\
@@ -92,6 +94,7 @@ IDLFILES= XGlobals.idl\
Window.idl \
XHyperlink.idl \
Hyperlink.idl \
+ XHyperlinks.idl \
XPageSetup.idl \
XPageBreak.idl \
XHPageBreak.idl \
diff --git a/oovbaapi/ooo/vba/makefile.mk b/oovbaapi/ooo/vba/makefile.mk
index 7fc70303d9..75f6465bf4 100644
--- a/oovbaapi/ooo/vba/makefile.mk
+++ b/oovbaapi/ooo/vba/makefile.mk
@@ -1,4 +1,4 @@
-#*************************************************************************
+ #*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
@@ -62,7 +62,8 @@ IDLFILES=\
XDialogsBase.idl\
XDialogBase.idl\
XPageSetupBase.idl \
-
+ XVBAAppService.idl\
+ XVBADocService.idl\
# ------------------------------------------------------------------
.ENDIF
.INCLUDE : target.mk
diff --git a/oovbaapi/ooo/vba/msforms/XControl.idl b/oovbaapi/ooo/vba/msforms/XControl.idl
index c3a050b068..50d15db3aa 100644
--- a/oovbaapi/ooo/vba/msforms/XControl.idl
+++ b/oovbaapi/ooo/vba/msforms/XControl.idl
@@ -45,13 +45,16 @@ interface XControl
{
interface ::ooo::vba::XHelperInterface;
void SetFocus();
+ void Move( [in] double Left, [in] double Top, [in] any Width, [in] any Height );
+
[attribute, readonly ] com::sun::star::uno::XInterface Object;
[attribute] string ControlSource;
[attribute] string RowSource;
[attribute] boolean Enabled;
[attribute] boolean Visible;
//Size. there are some defferent between Mso and OOo.
- //Mso use double but OOo use long. OOo 1 = 1/100mm but Mso use pt
+ //Mso use double but OOo use long. OOo 1 = 1/100mm but Mso use pt.
+ //in Dialogs Mso uses pixels
[attribute] double Height;
[attribute] double Width;
//Postion
@@ -59,6 +62,7 @@ interface XControl
[attribute] double Top;
[attribute] string Name;
[attribute] string ControlTipText;
+ [attribute] string Tag;
};
//=============================================================================
diff --git a/oovbaapi/ooo/vba/msforms/XControls.idl b/oovbaapi/ooo/vba/msforms/XControls.idl
index 5f475157e6..e197bd3e1e 100644
--- a/oovbaapi/ooo/vba/msforms/XControls.idl
+++ b/oovbaapi/ooo/vba/msforms/XControls.idl
@@ -41,6 +41,13 @@ interface XControls
{
interface ooo::vba::XCollection;
void Move( [in] double cx, [in] double cy );
+
+ // the following two methods should be actually part of XCollection, but at least Add conflicts with
+ // methods in the derived from XCollection interfaces
+ // thus the methods are declared in the top-level interface
+ any Add( [in] any Object, [in] any StringKey, [in] any Before, [in] any After );
+ void Remove( [in] any StringKeyOrIndex );
+
};
}; }; };
diff --git a/oovbaapi/prj/d.lst b/oovbaapi/prj/d.lst
index 1acd2acd5b..ac5924e2d6 100644
--- a/oovbaapi/prj/d.lst
+++ b/oovbaapi/prj/d.lst
@@ -1 +1,15 @@
+mkdir: %COMMON_DEST%\idl%_EXT%\ooo
+
+mkdir: %COMMON_DEST%\idl%_EXT%\ooo\vba
+mkdir: %COMMON_DEST%\idl%_EXT%\ooo\vba\constants
+mkdir: %COMMON_DEST%\idl%_EXT%\ooo\vba\excel
+mkdir: %COMMON_DEST%\idl%_EXT%\ooo\vba\msforms
+mkdir: %COMMON_DEST%\idl%_EXT%\ooo\vba\word
+
..\%__SRC%\ucr\oovbaapi.db %_DEST%\bin%_EXT%\oovbaapi.rdb
+
+..\ooo\vba\*.idl %COMMON_DEST%\idl%_EXT%\ooo\vba\
+..\ooo\vba\constants\*.idl %COMMON_DEST%\idl%_EXT%\ooo\vba\constants
+..\ooo\vba\excel\*.idl %COMMON_DEST%\idl%_EXT%\ooo\vba\excel
+..\ooo\vba\msforms\*.idl %COMMON_DEST%\idl%_EXT%\ooo\vba\msforms
+..\ooo\vba\word\*.idl %COMMON_DEST%\idl%_EXT%\ooo\vba\word
diff --git a/readlicense_oo/docs/readme.xsl b/readlicense_oo/docs/readme.xsl
index 2c98b011c3..4e77fa522c 100755..100644
--- a/readlicense_oo/docs/readme.xsl
+++ b/readlicense_oo/docs/readme.xsl
@@ -1,232 +1,173 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="html" doctype-public="-//W3C//DTD HTML 3.2//EN" />
-
- <!-- inputvariable declaration -->
- <xsl:param name="os1"/>
- <xsl:param name="gui1"/>
- <xsl:param name="cp1" />
- <xsl:param name="com1"/>
- <xsl:param name="lang1"/>
- <xsl:param name="type"/>
- <xsl:param name="file"/>
- <xsl:strip-space elements="*"/>
-<xsl:template match="/Readme">
- <!-- creates the HTML-output-->
- <xsl:if test="$type='html'">
- <!-- the outputname for htlm-files-->
- <html>
- <!-- HTML utf-8 encoding enable -->
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- </head>
- <body>
- <xsl:apply-templates/>
- </body>
- </html>
+<!-- <xsl:output method="text" doctype-public="-//W3C//DTD HTML 3.2//EN" omit-xml-declaration="yes"/> -->
- </xsl:if>
- <!-- creates the Textoutput -->
- <xsl:if test="$type='text'">
- <!-- the outputfilename for Textfiles -->
- <xsl:apply-templates/>
- </xsl:if>
-</xsl:template>
-
-<xsl:template match="Section">
- <xsl:apply-templates/>
-</xsl:template>
-
-
-<xsl:template match="Paragraph">
- <!-- match the given parameters one of the xmlattributes? -->
- <xsl:if test="@os=$os1 or @os='all'">
- <xsl:if test="@cpuname=$cp1 or @cpuname='all'">
- <xsl:if test="@gui=$gui1 or @gui='all'">
- <xsl:if test="@com=$com1 or @com='all'">
- <!--html-output -->
- <xsl:if test="$type='html'">
- <xsl:element name="{@style}">
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:if>
- <!--text-output -->
- <xsl:if test="$type='text'">
- <xsl:if test="@style='h1' or @style='h2' or @style='h3' or @style='H1' or @style='H2' or @style='H3'">
- <xsl:choose>
- <xsl:when test='$os1="WNT"'>
- <xsl:text>&#xD;&#xA;------------------------------------------------------------&#xD;&#xA;</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>&#xA;------------------------------------------------------------&#xA;</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- <!-- enter an carriage return line feed -->
- <xsl:if test="@style='p' or @style='P'">
- <xsl:choose>
- <xsl:when test='$os1="WNT"'>
- <xsl:text>&#xD;&#xA;</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>&#xA;</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- <xsl:apply-templates/>
- <xsl:if test="@style='h1' or @style='h2' or @style='h3' or @style='hr' or @style='H1' or @style='H2' or @style='H3' or @style='HR'">
- <xsl:choose>
- <xsl:when test='$os1="WNT"'>
- <xsl:text>------------------------------------------------------------&#xD;&#xA;</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>------------------------------------------------------------&#xA;</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:if>
- </xsl:if>
- </xsl:if>
- </xsl:if>
- </xsl:if>
-</xsl:template>
-
-<xsl:template match="List">
- <!-- creates the listoutput, the html-tags will be ignored if textoutput is choosen -->
- <xsl:choose>
- <xsl:when test="@Enum='false'">
- <ul type="circle">
- <xsl:apply-templates/>
- </ul>
- </xsl:when>
- <xsl:when test="@Enum='true'">
- <ol>
- <xsl:apply-templates/>
- </ol>
- </xsl:when>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template match="List//Text">
- <!-- create the list -->
- <xsl:if test="$type='html'">
- <xsl:if test="@xml:lang=$lang1">
- <li><xsl:apply-templates/></li>
- </xsl:if>
- </xsl:if>
- <xsl:if test="$type='text'">
- <xsl:if test="@xml:lang=$lang1">
- <xsl:text>- </xsl:text>
- <xsl:apply-templates/>
- <xsl:choose>
- <xsl:when test='$os1="WNT"'>
- <xsl:text>&#xD;&#xA;</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>&#xA;</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:if>
-</xsl:template>
-
-<!-- the textoutput of normal paragraph nodes -->
-<!-- these template will be used if an attribute xml:lang exists -->
-<xsl:template match="Section/Paragraph/Text[@xml:lang]">
- <xsl:if test="@xml:lang=$lang1">
- <!-- make the output with the given template -->
- <xsl:call-template name="out"/>
- </xsl:if>
-</xsl:template>
-
-<!-- these template will be used if no attribute xml:lang exists -->
-<xsl:template match="Section/Paragraph/Text[not (@xml:lang)]">
- <xsl:call-template name="out"/>
-</xsl:template>
-
-<!-- creates the outputtemplate out -->
-<xsl:template name="out">
- <!-- creates output with an extra CR/LF -->
- <xsl:if test="@Wrap='true'">
- <xsl:if test="$type='html'">
- <xsl:element name="br"/>
- <xsl:call-template name="prelinked"/>
+ <!-- inputvariable declaration -->
+ <xsl:param name="os1"/>
+ <xsl:param name="gui1"/>
+ <xsl:param name="cp1"/>
+ <xsl:param name="com1"/>
+ <xsl:param name="lang1"/>
+ <xsl:param name="type"/>
+ <xsl:param name="file"/>
+ <xsl:strip-space elements="*"/>
+
+ <xsl:param name="platform">
+ <xsl:if test="$os1='LINUX'">
+ <xsl:value-of select="'LINUX'"/>
</xsl:if>
- <xsl:if test="$type='text'">
- <xsl:choose>
- <xsl:when test='$os1="WNT"'>
- <xsl:text>&#xD;&#xA;</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>&#xA;</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:call-template name="linked"/>
+ <xsl:if test="$os1='WNT'">
+ <xsl:value-of select="'WIN'"/>
</xsl:if>
- </xsl:if>
-
- <!-- here without the extra CR/LF-->
- <xsl:if test="@Wrap='false'">
- <xsl:if test="$type='html'">
- <xsl:call-template name="prelinked"/>
+ <xsl:if test="$os1='SOLARIS'">
+ <xsl:if test="$cp1='SPARC'">
+ <xsl:value-of select="'SOLSPARC'"/>
+ </xsl:if>
+ <xsl:if test="$cp1='INTEL'">
+ <xsl:value-of select="'SOLX86'"/>
+ </xsl:if>
</xsl:if>
- <xsl:if test="$type='text'">
- <xsl:call-template name="linked"/>
+ <xsl:if test="$os1='MACOSX'">
+ <xsl:value-of select="'MAC'"/>
</xsl:if>
- </xsl:if>
-</xsl:template>
+ </xsl:param>
+
+ <xsl:template match="/">
+ <xsl:choose>
+ <xsl:when test="$type='html'">
+
+ <xsl:document method="html" href="{$file}" doctype-public="-//W3C//DTD HTML 3.2//EN">
+ <xsl:apply-templates mode="html"/>
+ </xsl:document>
+
+ </xsl:when>
+ <xsl:when test="$type='text'">
+
+ <xsl:document method="text" href="{$file}">
+ <xsl:call-template name="textout" />
+ </xsl:document>
+
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="*" mode="html">
+ <xsl:choose>
+ <xsl:when test="(contains(@class,$platform) or not(@class) or (name(.)='p'))">
+ <xsl:if test="(@xml:lang=$lang1 or not(@xml:lang))"> <!-- check for correct language -->
+ <xsl:element name="{name(.)}">
+ <xsl:if test="(name(.)='a')">
+ <xsl:attribute name="href">
+ <xsl:value-of select="@href"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(name(.)='p') and (@class)">
+ <xsl:attribute name="class">
+ <xsl:value-of select="@class"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="name(.)='div'">
+ <xsl:attribute name="id">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="html"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="textout">
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="*">
+ <xsl:if test="(@xml:lang=$lang1 or not(@xml:lang))"> <!-- check for correct language -->
+ <xsl:choose>
+ <xsl:when test="name(.)='html'">
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:when test="name(.)='body'">
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:when test="name(.)='hr'">
+ <xsl:text>
+
+----------------------------------------------------------------------------------------------------------
-<xsl:template name="prelinked">
- <xsl:if test=" @style='b ' or @style='B ' or @style='i ' or @style='I ' or @style='u ' or @style='U '">
- <xsl:element name="{@style}">
- <xsl:call-template name="linked"/>
- </xsl:element>
- </xsl:if>
- <xsl:if test="@style='none'">
- <xsl:call-template name="linked"/>
- </xsl:if>
-</xsl:template>
+</xsl:text>
+ </xsl:when>
+ <xsl:when test="name(.)='div'">
+ <xsl:if test="(contains(@class,$platform) or not(@class))">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="name(.)='a'">
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:when test="name(.)='tt'">
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:when test="name(.)='li'">
+ <xsl:text>
+</xsl:text>* <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:when test="name(.)='ul'">
+ <xsl:text>
+</xsl:text>
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:when test="name(.)='ol'">
+ <xsl:text>
+</xsl:text>
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:when test="name(.)='p'">
+ <xsl:if test="(not(name(..)='li') and (count(a) = 0))">
+ <xsl:text>
-<xsl:template name="linked">
- <xsl:if test="$type='html'">
- <!--this template creates a link if the url attribute is true -->
- <xsl:if test="@url='false'">
- <xsl:apply-templates/>
- </xsl:if>
- <xsl:if test="@url='true'">
- <xsl:if test="@path='none'">
- <a><xsl:attribute name="href"> <xsl:apply-templates/></xsl:attribute><xsl:apply-templates/></a>
- </xsl:if>
- <xsl:if test="@path='file'">
- <a><xsl:attribute name="href"><xsl:text>file://localhost/</xsl:text><xsl:apply-templates/></xsl:attribute><xsl:apply-templates/></a>
- </xsl:if>
- <xsl:if test="@path='url'">
- <a><xsl:attribute name="href"><xsl:text>http://</xsl:text><xsl:apply-templates/></xsl:attribute><xsl:apply-templates/></a>
- </xsl:if>
- </xsl:if>
- <!-- this code is needed for the line before an link, if not an <p> will be added-->
- <xsl:if test="@url='ahead'">
- <xsl:apply-templates/>
- </xsl:if>
- </xsl:if>
- <xsl:if test="$type='text'">
- <xsl:if test="@url='false'">
- <xsl:apply-templates/>
- <xsl:choose>
- <xsl:when test='$os1="WNT"'>
- <xsl:text>&#xD;&#xA;</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>&#xA;</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- <xsl:if test="@url='true' or @url='ahead'">
- <xsl:apply-templates/>
- </xsl:if>
+</xsl:text>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:when test="name(.)='h1'">
+ <xsl:text>
+
+======================================================================
+</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>
+======================================================================</xsl:text>
+ </xsl:when>
+ <xsl:when test="name(.)='h2'">
+ <xsl:text>
+
+----------------------------------------------------------------------
+</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>
+----------------------------------------------------------------------</xsl:text>
+
+ </xsl:when>
+ <xsl:when test="name(.)='h3'">
+ <xsl:text>
+
+</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>
+----------------------------------------------------------------------</xsl:text>
+
+ </xsl:when>
+ </xsl:choose>
</xsl:if>
-</xsl:template>
+ </xsl:template>
+
+
</xsl:stylesheet>
diff --git a/readlicense_oo/docs/readme/readme.xrm b/readlicense_oo/docs/readme/readme.xrm
index 2a8a409b4e..78716869e8 100755
--- a/readlicense_oo/docs/readme/readme.xrm
+++ b/readlicense_oo/docs/readme/readme.xrm
@@ -1,524 +1,309 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE Readme SYSTEM "../readme.dtd"><!-- A paragraph id has to be unique within one section -->
-<Readme name="ooo_readme" col-span="0">
-
- <Section id="Welcome"> <!-- ALL PLATFORMS -->
-
- <Paragraph id="Welcome" style="H1">
- <Text id="a" xml:lang="en-US">Welcome</Text>
- </Paragraph>
-
- <Paragraph id="ReadMeTitle" style="H1">
- <Text id="a" xml:lang="en-US">${PRODUCTNAME} ${PRODUCTVERSION} ReadMe</Text>
- </Paragraph>
-
- <Paragraph id="LaterstUpdates">
- <Text id="a" xml:lang="en-US" url="ahead">For latest updates to this readme file, see </Text>
- <Text id="b" xml:lang="en-US" url="true">http://www.openoffice.org/welcome/readme.html</Text>
- </Paragraph>
-
- <Paragraph id="A5">
- <Text id="c" xml:lang="en-US">Dear User</Text>
- </Paragraph>
-
- <Paragraph id="A6">
- <Text id="d" xml:lang="en-US">This file contains important information about this program. Please read this information very carefully before starting work.</Text>
- </Paragraph>
-
- <Paragraph id="A7">
- <Text id="a" xml:lang="en-US" url="ahead">The OpenOffice.org Community, responsible for the development of this product, would like to invite you to participate as a community member. As a new user, you can check out the ${PRODUCTNAME} site with helpful user information at </Text>
- </Paragraph>
-
- <Paragraph id="A8">
- <Text id="empty" xml:lang="en-US"/>
- <Text id="b" xml:lang="en-US" url="true">http://www.openoffice.org/about_us/introduction.html </Text>
- </Paragraph>
-
- <Paragraph id="A9">
- <Text id="empty" xml:lang="en-US"/>
- <Text id="c" xml:lang="en-US">Also read the sections below about getting involved in the OpenOffice.org project. </Text>
- </Paragraph>
-
- <Paragraph id="A10" style="H3">
- <Text id="c" xml:lang="en-US">Is ${PRODUCTNAME} really free for any user? </Text>
- </Paragraph>
-
- <Paragraph id="A11">
- <Text id="empty" xml:lang="en-US"/>
- <Text id="a" xml:lang="en-US" url="ahead">${PRODUCTNAME} is free for use by everybody. You may take this copy of ${PRODUCTNAME} and install it on as many computers as you like, and use it for any purpose you like (including commercial, government, public administration and educational use). For further details see the license text delivered together with ${PRODUCTNAME} or </Text>
- <Text id="b" xml:lang="en-US" url="true">http://www.openoffice.org/license.html </Text>
- <Text id="d" xml:lang="en-US"></Text>
- </Paragraph>
-
- <Paragraph id="A12" style="H3">
- <Text id="A12a" xml:lang="en-US">Why is ${PRODUCTNAME} free for any user?</Text>
- </Paragraph>
-
- <Paragraph id="A13">
- <Text id="empty" xml:lang="en-US"/>
- <Text id="A13a" xml:lang="en-US">
- You can use this copy of ${PRODUCTNAME} today free of charge because individual contributors and corporate sponsors have designed, developed, tested, translated, documented, supported, marketed, and helped in many other ways to make ${PRODUCTNAME} what it is today - the world's leading open-source office software.</Text>
- <Text id="A13b" xml:lang="en-US" url="ahead">If you appreciate their efforts, and would like to ensure OpenOffice.org continues into the future, please consider contributing to the project - see </Text>
- <Text id="A13c" xml:lang="en-US" url="true">http://contributing.openoffice.org</Text>
- <Text id="A13d" xml:lang="en-US"> for details. Everyone has a contribution to make.</Text>
- </Paragraph>
-
- </Section>
-
- <Section id="Installation">
-
- <Paragraph id="Header" style="H2">
- <Text id="rr3fgf42r" xml:lang="en-US">Notes on Installation</Text>
- </Paragraph>
-
- <Paragraph id="All">
- <Text id="sdfsdfgf42r" xml:lang="en-US">System Requirements:</Text>
- </Paragraph>
-
- <Paragraph id="MacX_INTEL" os="MACOSX" cpuname="INTEL"><!-- MAC -->
- <List>
- <Text id="macxiOSX" xml:lang="en-US">MacOSX 10.4 (Tiger) or higher</Text>
- <Text id="macxicpu" xml:lang="en-US">Intel processor</Text>
- <Text id="macxiRAM" xml:lang="en-US">512 MB RAM</Text>
- <Text id="macxHardDiksSpace" xml:lang="en-US">500 MB available hard disk space</Text>
- <Text id="macxHardDiksSpaceCJK" xml:lang="en-US">Chinese, Japanese and Korean versions: 600 MB (multi-language version: 800 MB) available hard disk space)</Text>
- <Text id="macxivideo" xml:lang="en-US">1024 x 768 graphic device with 256 colors (higher resolution recommended)</Text>
- </List>
- </Paragraph>
-
- <Paragraph id="WNT2" os="WNT"><!-- WINDOWS -->
- <List>
- <Text id="s2s3sdf2" xml:lang="en-US">Microsoft Windows 2000 (Service Pack 4 or higher), XP, or Vista</Text>
- <Text id="utzu6" xml:lang="en-US">Pentium compatible PC (Pentium III or Athlon recommended)</Text>
- <Text id="ghuj67" xml:lang="en-US">256 MB RAM (512 MB RAM recommended)</Text>
- <Text id="jzjtzu6" xml:lang="en-US">370 MB available hard disk space</Text>
- <Text id="WinHDCJK" xml:lang="en-US">Chinese, Japanese and Korean versions: 650 MB available hard disk space</Text>
- <Text id="jtzu56" xml:lang="en-US">1024x768 resolution (higher resolution recommended), at least 256 colors</Text>
- </List>
- </Paragraph>
-
- <Paragraph id="Sols2" os="SOLARIS" cpuname="SPARC"><!-- SOLARIS SPARC-->
- <List>
- <Text id="s2335" xml:lang="en-US">Solaris 10 operating system (SPARC platform) or higher</Text>
- <Text id="s253" xml:lang="en-US">256 MB RAM (512 MB RAM recommended)</Text>
- <Text id="s23seg" xml:lang="en-US">480 MB available hard disk space</Text>
- <Text id="SolsHDCJK" xml:lang="en-US">Chinese, Japanese and Korean versions: 480 MB available hard disk space</Text>
- <Text id="s2s43gfe" xml:lang="en-US">X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors</Text>
- <Text id="n4234rw" xml:lang="en-US">Window Manager</Text>
- <Text id="wd2dff" xml:lang="en-US">Gnome 2.6 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools)</Text>
- </List>
- </Paragraph>
-
- <Paragraph id="Solia2" os="SOLARIS" cpuname="INTEL"><!-- SOLARIS INTEL -->
- <List>
- <Text id="s23h" xml:lang="en-US">Solaris 10 operating system (x86 platform) or higher</Text>
- <Text id="s24f" xml:lang="en-US">256 MB RAM (512 MB RAM recommended)</Text>
- <Text id="fgheg" xml:lang="en-US">480 MB available hard disk space</Text>
- <Text id="SoliHDCJK" xml:lang="en-US">Chinese, Japanese and Korean versions: 480 MB available hard disk space</Text>
- <Text id="fghfgh" xml:lang="en-US">X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors</Text>
- <Text id="mgjfg" xml:lang="en-US">Window Manager</Text>
- <Text id="wd2dff" xml:lang="en-US">Gnome 2.6 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools)</Text>
- </List>
- </Paragraph>
-
- <Paragraph id="Linuxi2" os="LINUX" cpuname="INTEL"><!-- LINUX -->
- <List>
- <Text id="s2we35" xml:lang="en-US">Linux Kernel version 2.4 or higher</Text>
- <Text id="s253we" xml:lang="en-US">glibc2 version 2.3.2 or higher</Text>
- <Text id="s256we" xml:lang="en-US">gtk version 2.2.0 or higher</Text>
- <Text id="s2etfseg" xml:lang="en-US">Pentium compatible PC (Pentium III or Athlon recommended)</Text>
- <Text id="s2ssdfe" xml:lang="en-US">256 MB RAM (512 MB RAM recommended)</Text>
- <Text id="n42dfgf" xml:lang="en-US">440 MB available hard disk space</Text>
- <Text id="LinHDCJK" xml:lang="en-US">Chinese, Japanese and Korean versions: 440 MB available hard disk space</Text>
- <Text id="ghjhhr" xml:lang="en-US">X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors</Text>
- <Text id="fhrtz5" xml:lang="en-US">Window Manager</Text>
- <Text id="wd2dff" xml:lang="en-US">Gnome 2.6 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools)</Text>
- </List>
- </Paragraph>
-
- <Paragraph id="Linuxi3" os="LINUX">
- <Text id="Linuxi3a" xml:lang="en-US">There is a wide variety of Linux distributions, and even within the same distribution there may be different installation options (KDE vs Gnome, etc.). Some distributions ship with their own ‘native’ version of ${PRODUCTNAME}, which may have different features from this Community ${PRODUCTNAME}. Sometimes you can install the Community ${PRODUCTNAME} alongside the ‘native’ version. However, it’s usually safer to remove the ‘native’ version before installing this Community version. Consult the documentation for your distribution for details of how to do this. </Text>
- </Paragraph>
-
- <Paragraph id="Linuxi4" os="LINUX">
- <Text id="Linuxi4a" xml:lang="en-US">It is recommended that you always backup your system before you remove or install software.</Text>
- </Paragraph>
-
- <Paragraph id="MSOReg" os="WNT">
- <Text id="MSOReg1" xml:lang="en-US">Registration of ${PRODUCTNAME} as default application for Microsoft Office formats can be forced or suppressed by using the following command line switches with the installer:</Text>
- <List>
- <Text id="MSOReg2" xml:lang="en-US">/msoreg=1 will force registration of ${PRODUCTNAME} as default application for Microsoft Office formats.</Text>
- <Text id="MSOReg3" xml:lang="en-US">/msoreg=0 will suppress registration of ${PRODUCTNAME} as default application for Microsoft Office formats.</Text>
- </List>
- </Paragraph>
-
- <Paragraph id="DLLA" os="WNT">
- <Text id="DLLA1" xml:lang="en-US" url="ahead">If you perform an administrative installation using setup /a, you need to make sure that the file msvc90.dll is installed on the system. This file is required for ${PRODUCTNAME} to start after an administrative installation. You can get the file from </Text>
- <Text id="DLLA2" xml:lang="en-US" url="true">http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF </Text>
- <Text id="DLLA3" xml:lang="en-US"></Text>
- </Paragraph>
-
- <Section id="BerkeleyDB">
- <Paragraph id="BDB1" style="H2">
- <Text id="BDB11" xml:lang="en-US">Extension Database Incompatibility</Text>
- </Paragraph>
- </Section>
-
- <Paragraph id="BDB2">
- <Text id="BDB2a" xml:lang="en-US">The Berkeley database engine has been upgraded in this version of ${PRODUCTNAME}. The database engine upgrade introduces an incompatibility with user data for installed extensions for ${PRODUCTNAME} versions prior to 3.2 that may require your action if you downgrade your version of ${PRODUCTNAME}.</Text>
- </Paragraph>
-
- <Paragraph id="BDB3">
- <Text id="BDB3a" xml:lang="en-US">This version of ${PRODUCTNAME} will convert your extension database to the new Berkeley database format when extensions are installed or removed. After this conversion, the database can no longer be read by earlier versions of ${PRODUCTNAME}. Downgrading to an earlier version may result in a dysfunctional installation.</Text>
- </Paragraph>
-
- <Paragraph id="BDB4">
- <Text id="BDB4a" xml:lang="en-US">If you downgrade to an earlier version of ${PRODUCTNAME}, you must remove the user data directory {user data}/uno_packages, for example ~/.openoffice.org/3/user/uno_packages, and reinstall all extensions.</Text>
- </Paragraph>
-
-
- <Paragraph id="StartupProblemsHeader" style="H2" os="all">
- <Text id="naso" xml:lang="en-US">Problems During Program Startup</Text>
- </Paragraph>
-
- <Paragraph id="GnomeStartupProblems" os="LINUX">
- <Text id="naso2" xml:lang="en-US">If you experience ${PRODUCTNAME} startup problems (most notably while using Gnome) please &apos;unset&apos; the SESSION_MANAGER environment variable inside the shell you use to start ${PRODUCTNAME}. This can be done by adding the line &quot;unset SESSION_MANAGER&quot; to the beginning of the soffice shell script found in the &quot;[office folder]/program&quot; directory.</Text>
- </Paragraph>
-
- <Paragraph id="GraphicsCardDriverWIN" os="WNT">
- <Text id="abcdef" xml:lang="en-US">Difficulties starting ${PRODUCTNAME} (e.g. applications hang) as well as problems with the screen display are often caused by the graphics card driver. If these problems occur, please update your graphics card driver or try using the graphics driver delivered with your operating system. Difficulties displaying 3D objects can often be solved by deactivating the option &quot;Use OpenGL&quot; under &apos;Tools - Options - ${PRODUCTNAME} - View - 3D view&apos;.</Text>
- </Paragraph>
-
- <Paragraph id="GraphicsCardDriver" os="LINUX">
- <Text id="abcdef" xml:lang="en-US">Difficulties starting ${PRODUCTNAME} (e.g. applications hang) as well as problems with the screen display are often caused by the graphics card driver. If these problems occur, please update your graphics card driver or try using the graphics driver delivered with your operating system. Difficulties displaying 3D objects can often be solved by deactivating the option &quot;Use OpenGL&quot; under &apos;Tools - Options - ${PRODUCTNAME} - View - 3D view&apos;.</Text>
- </Paragraph>
-
- <!--
- <Paragraph id="PatchSolaris" os="SOLARIS">
- <Text id="ghtz5" xml:lang="en-US">Before installing ${PRODUCTNAME}, one or more operating system patches from SUN Microsystems must be installed. You can find them on the program CD in the following directories or download them at http://sunsolve.sun.com</Text>
- </Paragraph>
-
- <Paragraph id="ListOfPatchesSolaris" os="SOLARIS">
- <Text id="dfg4tr" xml:lang="en-US">Operating system patches required:</Text>
- </Paragraph>
-
- <Paragraph id="SolS_PatchList" os="SOLARIS" cpuname="SPARC">
- <List>
- <Text id="SPatches2" xml:lang="en-US">for Solaris 9: 111711-04, 111712-10 (64 bit), and 113713-03</Text>
- </List>
- </Paragraph>
-
- <Paragraph id="SolI_PatchList" os="SOLARIS" cpuname="INTEL">
- <List>
- <Text id="IPatches2" xml:lang="en-US">for Solaris 9: 111713-02, 114568-02</Text>
- </List>
- </Paragraph>
-
- <Paragraph id="SOLPatch_Note" os="SOLARIS">
- <Text id="Note" xml:lang="en-US">The versions mentioned above are the minimum requirements, newer (higher) version numbers are also allowed.</Text>
- </Paragraph>
-
- //-->
-
- <!--
- <Paragraph id="ParallelInstall" os="WNT">
- <Text id="Parallel" xml:lang="en-US">You can install ${PRODUCTNAME} ${PRODUCTVERSION} alongside of an older version of ${PRODUCTNAME}. If you later choose to deinstall the older version of ${PRODUCTNAME}, you must call the installation program of the newer version and choose &apos;Repair&apos;. This ensures that the new version is correctly registered in your system.</Text>
- </Paragraph>
- //-->
-
- <Paragraph id="CopyProblem">
- <Text id="CopyProblemsV1toV2" xml:lang="en-US">Please note that copy and paste via clipboard between ${PRODUCTNAME} 1.x and ${PRODUCTNAME} ${PRODUCTVERSION} might not work in OpenOffice.org format. If that happens, choose &apos;Edit - Paste Special&apos; and choose a format other than ${PRODUCTNAME}, or open the document in ${PRODUCTNAME} ${PRODUCTVERSION} directly.</Text>
- </Paragraph>
-
- <Paragraph id="GlobalPrecautions">
- <Text id="Precautions" xml:lang="en-US">Please make sure you have enough free memory in the temporary directory on your system and that read, write and run access rights have been granted. Close all other programs before starting the installation.</Text>
- </Paragraph>
-
- <Paragraph id="AdminNeededWIN" os="WNT">
- <Text id="AdminNeeded" xml:lang="en-US">Note: Please be aware that administrator rights are needed for the installation process.</Text>
- </Paragraph>
-
- </Section>
-
- <Section id="Scroll">
-
- <Paragraph id="F1a" style="H2" gui="WNT">
- <Text id="naso" xml:lang="en-US">ALPS/Synaptics notebook touchpads in Windows</Text>
- </Paragraph>
-
- <Paragraph id="F1b" gui="WNT">
- <Text id="naso2" xml:lang="en-US">Due to a Windows driver issue, you cannot scroll through ${PRODUCTNAME} documents when you slide your finger across an ALPS/Synaptics touchpad.</Text>
- </Paragraph>
-
- <Paragraph id="F1c" gui="WNT">
- <Text id="naso2" xml:lang="en-US">To enable touchpad scrolling, add the following lines to the &quot;C:\Program Files\Synaptics\SynTP\SynTPEnh.ini&quot; configuration file, and restart your computer:</Text>
- </Paragraph>
-
- <Paragraph id="F1d" gui="WNT">
- <Text id="naso2" xml:lang="en-US">[${PRODUCTNAME}]</Text>
- <Text id="naso3" xml:lang="en-US">FC = &quot;SALFRAME&quot;</Text>
- <Text id="naso4" xml:lang="en-US">SF = 0x10000000</Text>
- <Text id="naso5" xml:lang="en-US">SF |= 0x00004000</Text>
- </Paragraph>
-
- <Paragraph id="F1e" gui="WNT">
- <Text id="naso2" xml:lang="en-US">Note: The location of the configuration file might vary on different versions of Windows.</Text>
- </Paragraph>
- </Section>
-
- <Section id="NetscapeAdressBook">
-
- <Paragraph id="AdressBookHeader" style="H2" os="SOLARIS">
- <Text id="sdfsd32asrc" xml:lang="en-US">Mozilla Address Book Driver</Text>
- </Paragraph>
-
- <Paragraph id="AdressBookDriver" os="SOLARIS">
- <Text id="sdcc32asrc" xml:lang="en-US">The Mozilla address book driver requires the SUNWzlib package. This package is not part of the minimum Solaris operating system installation. If you require access to the Mozilla address book, then add this package to your Solaris operating system using the command &quot;pkgadd&quot; from the installation CD.</Text>
- </Paragraph>
- </Section>
-
- <Section id="Keyboard">
-
- <Paragraph id="abc2" style="H2">
- <Text id="awe1" xml:lang="en-US">Shortcut Keys</Text>
- </Paragraph>
-
- <Paragraph id="abc12">
- <Text id="w32e1" xml:lang="en-US">Only shortcut keys (key combinations) not used by the operating system can be used in ${PRODUCTNAME}. If a key combination in ${PRODUCTNAME} does not work as described in the ${PRODUCTNAME} Help, check if that shortcut is already used by the operating system. To rectify such conflicts, you can change the keys assigned by your operating system. Alternatively, you can change almost any key assignment in ${PRODUCTNAME}. For more information on this topic, refer to the ${PRODUCTNAME} Help or the Help documentation of your operating system.</Text>
- </Paragraph>
-
- <Paragraph id="MACKeysBETA" os="MACOSX">
- <Text id="mackeys1" xml:lang="en-US">The application help of ${PRODUCTNAME} may use shortcut combinations for PC keyboards only.</Text>
- </Paragraph>
-
- <Paragraph id="KeysChanged">
- <Text id="KeysChanged1" xml:lang="en-US">Due to a conflict with input method switching on multiple platforms, the following shortcut keys required to be changed at last minute:</Text>
- </Paragraph>
-
- <Paragraph id="KeysChangedMAC" os="MACOSX">
- <List>
- <Text id="KeysChangedMAC2" xml:lang="en-US">Cmd-Space is now Cmd-Shift-Space</Text>
- <Text id="KeysChangedMAC3" xml:lang="en-US">Cmd-Shift-Space is now Cmd-M</Text>
- </List>
- </Paragraph>
-
- <Paragraph id="KeysChangedWNT" os="WNT">
- <List>
- <Text id="KeysChangedWNT2" xml:lang="en-US">Ctrl-Space is now Ctrl-Shift-Space</Text>
- <Text id="KeysChangedWNT3" xml:lang="en-US">Ctrl-Shift-Space is now Ctrl-M</Text>
- </List>
- </Paragraph>
-
- <Paragraph id="KeysChangedLIN" os="LINUX">
- <List>
- <Text id="KeysChangedLIN2" xml:lang="en-US">Ctrl-Space is now Ctrl-Shift-Space</Text>
- <Text id="KeysChangedLIN" xml:lang="en-US">Ctrl-Shift-Space is now Ctrl-M</Text>
- </List>
- </Paragraph>
-
- <Paragraph id="KeysChangedSOL" os="SOLARIS">
- <List>
- <Text id="KeysChangedSOL2" xml:lang="en-US">Ctrl-Space is now Ctrl-Shift-Space</Text>
- <Text id="KeysChangedSOL3" xml:lang="en-US">Ctrl-Shift-Space is now Ctrl-M</Text>
- </List>
- </Paragraph>
-
- </Section>
-
- <Section id="FileLocking">
-
- <Paragraph id="G1" style="H2" gui="UNX">
- <Text id="gfh6w" xml:lang="en-US">File Locking</Text>
- </Paragraph>
-
- <Paragraph id="G2" gui="UNX">
- <Text id="pji76w" xml:lang="en-US">In the default setting, file locking is turned on in ${PRODUCTNAME}. To deactivate it, you have to set the appropriate environment variables SAL_ENABLE_FILE_LOCKING=0 and export SAL_ENABLE_FILE_LOCKING. These entries are already in enabled form in the soffice script file.</Text>
- </Paragraph>
-
- <Paragraph id="G3" gui="UNX">
- <Text id="pji76wsdf" xml:lang="en-US">Warning: The activated file locking feature can cause problems with Solaris 2.5.1 and 2.7 used in conjunction with Linux NFS 2.0. If your system environment has these parameters, we strongly recommend that you avoid using the file locking feature. Otherwise, ${PRODUCTNAME} will hang when you try to open a file from a NFS mounted directory from a Linux computer.</Text>
- </Paragraph>
- </Section>
-
- <Section id="Mapi">
-
- <Paragraph id="G1a" style="H2" gui="WNT">
- <Text id="gfh6w" xml:lang="en-US">Problems When Sending Documents as E-mails From ${PRODUCTNAME}</Text>
- </Paragraph>
-
- <Paragraph id="G2a" gui="WNT">
- <Text id="pji76w" xml:lang="en-US">When sending a document via &apos;File - Send - Document as E-mail&apos; or &apos;Document as PDF Attachment&apos; problems might occur (program crashes or hangs). This is due to the Windows system file &quot;Mapi&quot; (Messaging Application Programming Interface) which causes problems in some file versions. Unfortunately, the problem cannot be narrowed down to a certain version number. For more information visit http://www.microsoft.com to search the Microsoft Knowledge Base for &quot;mapi dll&quot;.</Text>
- </Paragraph>
- </Section>
-
- <Section id="A11y">
- <Paragraph id="aw44" style="H2">
- <Text id="aw22" xml:lang="en-US">Important Accessibility Notes</Text>
- </Paragraph>
-
- <Paragraph id="F2c" os="all">
- <Text id="access7" xml:lang="en-US">For information on the accessibility features in ${PRODUCTNAME}, see </Text>
- <Text id="abdfs2b" url="true" xml:lang="en-US">http://www.openoffice.org/access/</Text>
- <Text id="abdfs2c" xml:lang="en-US">.</Text>
- </Paragraph>
-
- </Section>
-
- <Section id="Registration"> <!-- ALL PLATFORMS -->
-
- <Paragraph id="A1" style="H2">
- <Text id="a" xml:lang="en-US">Registration </Text>
- </Paragraph>
-
- <Paragraph id="A2">
- <Text id="a" xml:lang="en-US" url="ahead">Please take a little time to complete the minimal Product Registration process when you install the software. While registration is optional, we encourage you to register, since the information enables the community to make an even better software suite and address user needs directly. Through its Privacy Policy, the ${PRODUCTNAME} Community takes every precaution to safeguard your personal data. If you missed the registration at installation, you can return and register at any time at by choosing "Help > Registration" from the main menu.</Text>
- </Paragraph>
- </Section>
-
- <Section id="UserSurvey">
-
- <Paragraph id="A1" style="H2">
- <Text id="a" xml:lang="en-US">User Survey </Text>
- </Paragraph>
-
- <Paragraph id="A2">
- <Text id="a" xml:lang="en-US">There is also a User Survey located online which we encourage you to fill out. The User Survey results will help ${PRODUCTNAME} move more rapidly in setting new standards for the creation of the next-generation office suite. Through its Privacy Policy, the ${PRODUCTNAME} Community takes every precaution to safeguard your personal data.</Text>
- </Paragraph>
- </Section>
-
- <Section id="UserSupport"> <!-- ALL PLATFORMS -->
-
- <Paragraph id="A1" style="H2">
- <Text id="a" xml:lang="en-US">User Support</Text>
- </Paragraph>
-
- <Paragraph id="A2">
- <Text id="a" xml:lang="en-US" url="ahead">The main support page </Text>
- <Text id="b" xml:lang="en-US" url="true">http://support.openoffice.org/</Text>
- <Text id="c" xml:lang="en-US" url="ahead">offers various possibilities for help with ${PRODUCTNAME}. Your question may have already been answered - check the Community Forum.</Text>
- <Text id="d" xml:lang="en-US" url="true">http://user.services.openoffice.org</Text>
- <Text id="e" xml:lang="en-US" url="ahead"> or search the archives of the 'users@openoffice.org' mailing list at </Text>
- <Text id="f" xml:lang="en-US" url="true">http://www.openoffice.org/mail_list.html</Text>
- <Text id="g" xml:lang="en-US" url="ahead">. Alternatively, you can send in your questions to </Text>
- <Text id="h" xml:lang="en-US" url="true">users@openoffice.org</Text>
- <Text id="i" xml:lang="en-US" url="ahead">. How to subscribe to the list (to get an email response) is explained on this page: </Text>
- <Text id="j" xml:lang="en-US" url="true">http://wiki.services.openoffice.org/wiki/Website/Content/help/mailinglists</Text>
- <Text id="k" xml:lang="en-US">.</Text>
- </Paragraph>
-
- <Paragraph id="A3">
- <Text id="a" xml:lang="en-US" url="ahead">Also check the FAQ section at </Text>
- <Text id="b" xml:lang="en-US" url="true">http://wiki.services.openoffice.org/wiki/Documentation/FAQ</Text>
- <Text id="c" xml:lang="en-US">.</Text>
- </Paragraph>
- </Section>
-
- <Section id="ReportBugsIssues"> <!-- ALL PLATFORMS -->
-
- <Paragraph id="A1" style="H2">
- <Text id="a" xml:lang="en-US">Report Bugs &amp; Issues </Text>
- </Paragraph>
-
- <Paragraph id="A2">
- <Text id="a" xml:lang="en-US">The ${PRODUCTNAME} Web site hosts IssueZilla, our mechanism for reporting, tracking and solving bugs and issues. We encourage all users to feel entitled and welcome to report issues that may arise on your particular platform. Energetic reporting of issues is one of the most important contributions that the user community can make to the ongoing development and improvement of the suite. </Text>
- </Paragraph>
- </Section>
-
- <Section id="GettingInvolved"> <!-- ALL PLATFORMS -->
-
- <Paragraph id="A1" style="H2">
- <Text id="a" xml:lang="en-US">Getting Involved </Text>
- </Paragraph>
-
- <Paragraph id="A2">
- <Text id="a" xml:lang="en-US">The ${PRODUCTNAME} Community would very much benefit from your active participation in the development of this important open source project.</Text>
- </Paragraph>
-
- <Paragraph id="A3">
- <Text id="a" xml:lang="en-US" url="ahead">As a user, you are already a valuable part of the suite&apos;s development process and we would like to encourage you to take an even more active role with a view to being a long-term contributor to the community. Please join and check out the user page at: </Text>
- <Text id="b" xml:lang="en-US" url="true">http://www.openoffice.org </Text>
- </Paragraph>
-
- <Paragraph id="emptyparagraph" localized="false" />
-
- <Paragraph id="A4" style="H3">
- <Text id="a" xml:lang="en-US">Way to Start</Text>
- </Paragraph>
-
- <Paragraph id="A5">
- <Text id="a" xml:lang="en-US" url="ahead">The best way to start contributing is to subscribe to one or more of the mailing lists, lurk for a while, and gradually use the mail archives to familiarize yourself with many of the topics covered since the ${PRODUCTNAME} source code was released back in October 2000. When you&apos;re comfortable, all you need to do is send an email self-introduction and jump right in. If you are familiar with Open Source Projects, check out our To-Dos list and see if there is anything you would like to help with at </Text>
- <Text id="b" xml:lang="en-US" url="true">http://development.openoffice.org/todo.html</Text>
- <Text id="c" xml:lang="en-US">.</Text>
- </Paragraph>
-
-
- <Paragraph id="A6" style="H3">
- <Text id="a" xml:lang="en-US">Subscribe</Text>
- </Paragraph>
-
- <Paragraph id="A7">
- <Text id="a" xml:lang="en-US" url="ahead">Here are a few of the Project mailing lists to which you can subscribe at </Text>
- <Text id="b" xml:lang="en-US" url="true">http://www.openoffice.org/mail_list.html</Text>
- </Paragraph>
-
- <Paragraph id="A8">
- <List>
- <Text id="a" xml:lang="en-US">News: announce@openoffice.org *recommended to all users* (light traffic) </Text>
- <Text id="c" xml:lang="en-US">Main user forum: user@openoffice.org *easy way to lurk on discussions* (heavy traffic) </Text>
- <Text id="d" xml:lang="en-US">Marketing project: dev@marketing.openoffice.org *beyond development* (getting heavy) </Text>
- <Text id="e" xml:lang="en-US">General code contributor list: dev@openoffice.org (moderate/heavy) </Text>
- </List>
- </Paragraph>
-
-
- <Paragraph id="A9" style="H3">
- <Text id="a" xml:lang="en-US">Join one or more Projects</Text>
- </Paragraph>
-
- <Paragraph id="A10">
- <Text id="a" xml:lang="en-US">You can make major contributions to this important open source project even if you have limited software design or coding experience. Yes, you!</Text>
- </Paragraph>
-
- <Paragraph id="A11">
- <Text id="a" xml:lang="en-US" url="ahead">At </Text>
- <Text id="b" xml:lang="en-US" url="true">http://projects.openoffice.org/index.html</Text>
- <Text id="c" xml:lang="en-US"> you will find projects ranging from Localization, Porting and Groupware to some real core coding projects. If you are not a developer, try the Documentation or the Marketing Project. The OpenOffice.org Marketing Project is applying both guerrilla and traditional commercial techniques to marketing open source software, and we are doing it across language and cultural barriers, so you can help just by spreading the word and telling a friend about this office suite.</Text>
- </Paragraph>
-
- <Paragraph id="A12">
- <Text id="a" xml:lang="en-US" url="ahead">You can help by joining the Marketing Communications &amp; Information Network here: </Text>
- <Text id="b" xml:lang="en-US" url="true">http://marketing.openoffice.org/contacts.html </Text>
- <Text id="c" xml:lang="en-US"> where you can provide point communication contact with press, media, government agencies, consultants, schools, Linux Users Groups and developers in your country and local community.</Text>
- </Paragraph>
- </Section>
-
-
- <Section id="Credits"> <!-- ALL PLATFORMS -->
-
- <Paragraph id="emptyparagraph" localized="false" />
-
- <Paragraph id="A1">
- <Text id="a" xml:lang="en-US">We hope you enjoy working with the new ${PRODUCTNAME} ${PRODUCTVERSION} and will join us online.</Text>
- </Paragraph>
-
- <Paragraph id="A2">
- <Text id="a" xml:lang="en-US">The OpenOffice.org Community</Text>
- </Paragraph>
-
- <Paragraph id="A3" localized="false">
- <Text id="a" xml:lang="en-US" />
- <Text id="b" xml:lang="en-US" />
- </Paragraph>
- </Section>
-
- <Section id="ModifiedSourceCode"> <!-- ALL PLATFORMS -->
-
- <Paragraph id="HH1" style="H2">
- <Text id="sdffd23r3cefwefew" xml:lang="en-US">Used / Modified Source Code</Text>
- </Paragraph>
-
- <Paragraph id="HH2">
- <Text id="sdffd23red32efew" xml:lang="en-US">Portions Copyright 1998, 1999 James Clark. Portions Copyright 1996, 1998 Netscape Communications Corporation.</Text>
- </Paragraph>
- </Section>
-</Readme>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
+
+ <title id="title" xml:lang="en-US">${PRODUCTNAME} Readme File</title>
+
+ <style type="text/css">
+ #Copyright_Trademark * {font-size: .7em;}
+ .note {border: 1px solid #993333; padding: 3px;}
+ p { margin-top: .1em; margin-bottom: .1em;}
+ .code {font-family: monospace;}
+ </style>
+ </head>
+
+ <body>
+ <div id="Intro">
+ <h1 id="Welcome" xml:lang="en-US">${PRODUCTNAME} ${PRODUCTVERSION} ReadMe</h1>
+ <p id="LatestUpdates" xml:lang="en-US">For latest updates to this readme file, see <a href="http://www.openoffice.org/welcome/readme.html">http://www.openoffice.org/welcome/readme.html</a></p>
+ <p id="A6" xml:lang="en-US">This file contains important information about this program. Please read this information very carefully before starting work.</p>
+ <p id="A7" xml:lang="en-US">The OpenOffice.org Community, responsible for the development of this product, would like to invite you to participate as a community member. As a new user, you can check out the ${PRODUCTNAME} site with helpful user information at <a href="http://www.openoffice.org/about_us/introduction.html">http://www.openoffice.org/about_us/introduction.html</a></p>
+ <p id="A9" xml:lang="en-US">Also read the sections below about getting involved in the OpenOffice.org project.</p>
+ <h3 id="A10" xml:lang="en-US">Is ${PRODUCTNAME} really free for any user? </h3>
+ <p id="A11" xml:lang="en-US">${PRODUCTNAME} is free for use by everybody. You may take this copy of ${PRODUCTNAME} and install it on as many computers as you like, and use it for any purpose you like (including commercial, government, public administration and educational use). For further details see the license text delivered together with ${PRODUCTNAME} or <a href="http://www.openoffice.org/license.html">http://www.openoffice.org/license.html</a></p>
+ <h3 id="A12" xml:lang="en-US">Why is ${PRODUCTNAME} free for any user?</h3>
+ <p id="A13" xml:lang="en-US">You can use this copy of ${PRODUCTNAME} today free of charge because individual contributors and corporate sponsors have designed, developed, tested, translated, documented, supported, marketed, and helped in many other ways to make ${PRODUCTNAME} what it is today - the world's leading open-source office software.</p>
+ <p id="A13b" xml:lang="en-US">If you appreciate their efforts, and would like to ensure OpenOffice.org continues into the future, please consider contributing to the project - see <a href="http://contributing.openoffice.org">http://contributing.openoffice.org</a> for details. Everyone has a contribution to make.</p>
+ </div>
+
+ <div id="Installation">
+ <h2 id="rr3fgf42r" xml:lang="en-US">Notes on Installation</h2>
+ <h3 id="sdfsdfgf42r" xml:lang="en-US">System Requirements</h3>
+ <div class="MAC" id="SystemRequirements_OSX">
+ <ul>
+ <li>
+ <p id="macxiOSX" xml:lang="en-US">MacOSX 10.4 (Tiger) or higher</p>
+ </li>
+
+ <li>
+ <p id="macxicpu" xml:lang="en-US">Intel processor</p>
+ </li>
+
+ <li>
+ <p id="macxiRAM" xml:lang="en-US">512 MB RAM</p>
+ </li>
+
+ <li>
+ <p id="macxHardDiksSpace" xml:lang="en-US">Up to 1.5 GB available hard disk space</p>
+ </li>
+
+ <li>
+ <p id="macxivideo" xml:lang="en-US">1024 x 768 graphic device with 256 colors (higher resolution recommended)</p>
+ </li>
+ </ul>
+ </div>
+ <div class="WIN" id="SystemRequirements_WIN">
+ <ul>
+ <li>
+ <p id="s2s3sdf2" xml:lang="en-US">Microsoft Windows 2000 (Service Pack 4 or higher), XP, Vista, or Windows 7</p>
+ </li>
+
+ <li>
+ <p id="utzu6" xml:lang="en-US">Pentium compatible PC (Pentium III or Athlon recommended)</p>
+ </li>
+
+ <li>
+ <p id="ghuj67" xml:lang="en-US">256 MB RAM (512 MB RAM recommended)</p>
+ </li>
+
+ <li>
+ <p id="jzjtzu6" xml:lang="en-US">Up to 1.5 GB available hard disk space</p>
+ </li>
+
+ <li>
+ <p id="jtzu56" xml:lang="en-US">1024x768 resolution (higher resolution recommended), at least 256 colors</p>
+ </li>
+ </ul>
+ <p class="note" id="edssc3d" xml:lang="en-US">Please be aware that administrator rights are needed for the installation process.</p>
+ <p id="MSOReg1" xml:lang="en-US">Registration of ${PRODUCTNAME} as default application for Microsoft Office formats can be forced or suppressed by using the following command line switches with the installer:</p>
+ <ul>
+ <li>
+ <p id="MSOReg2" xml:lang="en-US"><tt>/msoreg=1</tt> will force registration of ${PRODUCTNAME} as default application for Microsoft Office formats.</p>
+ </li>
+
+ <li>
+ <p id="MSOReg3" xml:lang="en-US"><tt>/msoreg=0</tt> will suppress registration of ${PRODUCTNAME} as default application for Microsoft Office formats.</p>
+ </li>
+ </ul>
+ <p id="DLLA1" xml:lang="en-US">If you perform an administrative installation using setup /a, you need to make sure that the file msvc90.dll is installed on the system. This file is required for ${PRODUCTNAME} to start after an administrative installation. You can get the file from <a href="http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF">http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF</a></p>
+ <p class="note" id="AdminNeeded" xml:lang="en-US">Please be aware that administrator rights are needed for the installation process.</p>
+ </div>
+ <div class="SOLSPARC" id="Sols2">
+ <ul>
+ <li>
+ <p id="s2335" xml:lang="en-US">Solaris 10 operating system (SPARC platform) or higher</p>
+ </li>
+
+ <li>
+ <p id="s253" xml:lang="en-US">256 MB RAM (512 MB RAM recommended)</p>
+ </li>
+
+ <li>
+ <p id="s23seg" xml:lang="en-US">Up to 1.55 GB available hard disk space</p>
+ </li>
+
+ <li>
+ <p id="s2s43gfe" xml:lang="en-US">X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors</p>
+ </li>
+
+ <li>
+ <p id="n4234rw" xml:lang="en-US">Window Manager</p>
+ </li>
+
+ <li>
+ <p id="wd2dff2" xml:lang="en-US">Gnome 2.6 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools)</p>
+ </li>
+ </ul>
+ </div>
+ <div class="SOLX86" id="Solia2">
+ <ul>
+ <li>
+ <p id="s23h" xml:lang="en-US">Solaris 10 operating system (x86 platform) or higher</p>
+ </li>
+
+ <li>
+ <p id="s24f" xml:lang="en-US">256 MB RAM (512 MB RAM recommended)</p>
+ </li>
+
+ <li>
+ <p id="fgheg" xml:lang="en-US">Up to 1.55 GB available hard disk space</p>
+ </li>
+
+ <li>
+ <p id="fghfgh" xml:lang="en-US">X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors</p>
+ </li>
+
+ <li>
+ <p id="mgjfg" xml:lang="en-US">Window Manager</p>
+ </li>
+
+ <li>
+ <p id="wd2dff1" xml:lang="en-US">Gnome 2.6 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools)</p>
+ </li>
+ </ul>
+ </div>
+ <div class="LINUX" id="Linuxi2">
+ <ul>
+ <li>
+ <p id="s2we35" xml:lang="en-US">Linux Kernel version 2.6.18 or higher</p>
+ </li>
+
+ <li>
+ <p id="s253we" xml:lang="en-US">glibc2 version 2.5 or higher</p>
+ </li>
+
+ <li>
+ <p id="s256we" xml:lang="en-US">gtk version 2.10.4 or higher</p>
+ </li>
+
+ <li>
+ <p id="s2etfseg" xml:lang="en-US">Pentium compatible PC (Pentium III or Athlon recommended)</p>
+ </li>
+
+ <li>
+ <p id="s2ssdfe" xml:lang="en-US">256 MB RAM (512 MB RAM recommended)</p>
+ </li>
+
+ <li>
+ <p id="n42dfgf" xml:lang="en-US">Up to 1.55 GB available hard disk space</p>
+ </li>
+
+ <li>
+ <p id="ghjhhr" xml:lang="en-US">X Server with 1024x768 resolution (higher resolution recommended), with at least 256 colors</p>
+ </li>
+
+ <li>
+ <p id="fhrtz5" xml:lang="en-US">Window Manager</p>
+ </li>
+
+ <li>
+ <p id="wd2dff" xml:lang="en-US">Gnome 2.16 or higher, with the gail 1.8.6 and the at-spi 1.7 packages, required for support of assistive technology tools (AT tools)</p>
+ </li>
+ </ul>
+ <p id="Linuxi3a" xml:lang="en-US">There is a wide variety of Linux distributions, and even within the same distribution there may be different installation options (KDE vs Gnome, etc.). Some distributions ship with their own ‘native’ version of ${PRODUCTNAME}, which may have different features from this Community ${PRODUCTNAME}. Sometimes you can install the Community ${PRODUCTNAME} alongside the ‘native’ version. However, it’s usually safer to remove the ‘native’ version before installing this Community version. Consult the documentation for your distribution for details of how to do this.</p>
+ <p class="note" id="Linuxi4a" xml:lang="en-US">It is recommended that you always backup your system before you remove or install software.</p>
+ </div>
+ <p id="Precautions" xml:lang="en-US">Please make sure you have enough free memory in the temporary directory on your system and that read, write and run access rights have been granted. Close all other programs before starting the installation.</p>
+ </div>
+
+ <div id="BerkeleyDB">
+ <h2 id="BDB11" xml:lang="en-US">Extension Database Incompatibility</h2>
+ <p id="BDB2a" xml:lang="en-US">The Berkeley database engine has been upgraded in this version of ${PRODUCTNAME}. The database engine upgrade introduces an incompatibility with user data for installed extensions for ${PRODUCTNAME} versions prior to 3.2 that may require your action if you downgrade your version of ${PRODUCTNAME}.</p>
+ <p id="BDB3a" xml:lang="en-US">This version of ${PRODUCTNAME} will convert your extension database to the new Berkeley database format when extensions are installed or removed. After this conversion, the database can no longer be read by earlier versions of ${PRODUCTNAME}. Downgrading to an earlier version may result in a dysfunctional installation.</p>
+ <p id="BDB4a" xml:lang="en-US">If you downgrade to an earlier version of ${PRODUCTNAME}, you must remove the user data directory <tt>{user data}/uno_packages</tt>, for example <tt>~/.openoffice.org/3/user/uno_packages</tt>, and reinstall all extensions.</p>
+ </div>
+
+ <div class="LINUX WIN" id="StartupProblems">
+ <h2 id="naso01" xml:lang="en-US">Problems During Program Startup</h2>
+ <div class="LINUX" id="GnomeStartupProblems">
+ <p id="naso02" xml:lang="en-US">If you experience ${PRODUCTNAME} startup problems (most notably while using Gnome) please 'unset' the <tt>SESSION_MANAGER</tt> environment variable inside the shell you use to start ${PRODUCTNAME}. This can be done by adding the line "<tt>unset SESSION_MANAGER</tt>" to the beginning of the soffice shell script found in the "<tt>[office folder]/program</tt>" directory.</p>
+ </div>
+ <p id="abcdef" xml:lang="en-US">Difficulties starting ${PRODUCTNAME} (e.g. applications hang) as well as problems with the screen display are often caused by the graphics card driver. If these problems occur, please update your graphics card driver or try using the graphics driver delivered with your operating system. Difficulties displaying 3D objects can often be solved by deactivating the option "Use OpenGL" under 'Tools - Options - ${PRODUCTNAME} - View - 3D view'.</p>
+ </div>
+
+ <div class="WIN" id="Scroll">
+ <h2 id="naso" xml:lang="en-US">ALPS/Synaptics notebook touchpads in Windows</h2>
+ <p id="naso2" xml:lang="en-US">Due to a Windows driver issue, you cannot scroll through ${PRODUCTNAME} documents when you slide your finger across an ALPS/Synaptics touchpad.</p>
+ <p id="naso6" xml:lang="en-US">To enable touchpad scrolling, add the following lines to the "<tt>C:\Program Files\Synaptics\SynTP\SynTPEnh.ini</tt>" configuration file, and restart your computer:</p>
+ <p class="code" id="naso7">[${PRODUCTNAME}]</p>
+ <p class="code" id="naso3">FC = "SALFRAME"</p>
+ <p class="code" id="naso4">SF = 0x10000000</p>
+ <p class="code" id="naso5">SF |= 0x00004000</p>
+ <p class="note" id="naso8" xml:lang="en-US">The location of the configuration file might vary on different versions of Windows.</p>
+ </div>
+
+ <div class="SOLSPARC SOLX86" id="NetscapeAdressBook">
+ <h2 id="sdfsd32asrc" xml:lang="en-US">Mozilla Address Book Driver</h2>
+ <p id="sdcc32asrc" xml:lang="en-US">The Mozilla address book driver requires the <tt>SUNWzlib</tt> package. This package is not part of the minimum Solaris operating system installation. If you require access to the Mozilla address book, then add this package to your Solaris operating system using the command "<tt>pkgadd</tt>" from the installation CD.</p>
+ </div>
+
+ <div id="Keyboard">
+ <h2 id="awe1" xml:lang="en-US">Shortcut Keys</h2>
+ <p id="w32e1" xml:lang="en-US">Only shortcut keys (key combinations) not used by the operating system can be used in ${PRODUCTNAME}. If a key combination in ${PRODUCTNAME} does not work as described in the ${PRODUCTNAME} Help, check if that shortcut is already used by the operating system. To rectify such conflicts, you can change the keys assigned by your operating system. Alternatively, you can change almost any key assignment in ${PRODUCTNAME}. For more information on this topic, refer to the ${PRODUCTNAME} Help or the Help documention of your operating system.</p>
+ <div class="MAC" id="MACKeysBETA">
+ <p id="mackeys1" xml:lang="en-US">The application help of ${PRODUCTNAME} may use shortcut combinations for PC keyboards only.</p>
+ </div>
+ </div>
+
+ <div class="LINUX MAC SOLSPARC SOLX86" id="FileLocking">
+ <h2 id="gfh6w" xml:lang="en-US">File Locking</h2>
+ <p id="pji76w" xml:lang="en-US">File locking is enabled by default in ${PRODUCTNAME}. On a network that uses the Network File System protocol (NFS), the locking daemon for NFS clients must be active. To disable file locking, edit the <tt>soffice</tt> script and change the line "<tt>export SAL_ENABLE_FILE_LOCKING</tt>" to "<tt># export SAL_ENABLE_FILE_LOCKING</tt>". If you disable file locking, the write access of a document is not restricted to the user who first opens the document.</p>
+ <p class="note" id="pji76wsdf" xml:lang="en-US">Warning: The activated file locking feature can cause problems with Solaris 2.5.1 and 2.7 used in conjunction with Linux NFS 2.0. If your system environment has these parameters, we strongly recommend that you avoid using the file locking feature. Otherwise, ${PRODUCTNAME} will hang when you try to open a file from a NFS mounted directory from a Linux computer.</p>
+ </div>
+
+ <div class="WIN" id="Mapi">
+ <h2 id="gfh6w1" xml:lang="en-US">Problems When Sending Documents as E-mails From ${PRODUCTNAME}</h2>
+ <p id="pji76w1" xml:lang="en-US">When sending a document via 'File - Send - Document as E-mail' or 'Document as PDF Attachment' problems might occur (program crashes or hangs). This is due to the Windows system file "Mapi" (Messaging Application Programming Interface) which causes problems in some file versions. Unfortunately, the problem cannot be narrowed down to a certain version number. For more information visit <a href="http://www.microsoft.com">http://www.microsoft.com</a> to search the Microsoft Knowledge Base for "mapi dll".</p>
+ </div>
+
+ <div id="A11y">
+ <h2 id="aw22" xml:lang="en-US">Important Accessibility Notes</h2>
+ <p id="access7" xml:lang="en-US">For more information on the accessibility features in ${PRODUCTNAME}, see <a href="http://www.openoffice.org/access/">http://www.openoffice.org/access/</a></p>
+ </div>
+
+ <div id="Registration">
+ <h2 id="reg1" xml:lang="en-US">Registration </h2>
+ <p id="reg2" xml:lang="en-US">Please take a little time to complete the minimal Product Registration process when you install the software. While registration is optional, we encourage you to register, since the information enables the community to make an even better software suite and address user needs directly. Through its Privacy Policy, the ${PRODUCTNAME} Community takes every precaution to safeguard your personal data. If you missed the registration at installation, you can return and register at any time at by choosing "Help - Registration" from the main menu.</p>
+ </div>
+
+ <div id="UserSurvey">
+ <h2 id="survey" xml:lang="en-US">User Survey</h2>
+ <p id="survey1" xml:lang="en-US">There is also a User Survey located online which we encourage you to fill out. The User Survey results will help ${PRODUCTNAME} move more rapidly in setting new standards for the creation of the next-generation office suite. Through its Privacy Policy, the ${PRODUCTNAME} Community takes every precaution to safeguard your personal data.</p>
+ </div>
+
+ <div id="UserSupport">
+ <h2 id="support" xml:lang="en-US">User Support</h2>
+ <p id="support1" xml:lang="en-US">The main support page <a href="http://support.openoffice.org/">http://support.openoffice.org/</a> offers various possibilities for help with ${PRODUCTNAME}. Your question may have already been answered - check the Community Forum at <a href="http://user.services.openoffice.org">http://user.services.openoffice.org</a> or search the archives of the 'users@openoffice.org' mailing list at <a href="http://www.openoffice.org/mail_list.html">http://www.openoffice.org/mail_list.html</a>. Alternatively, you can send in your questions to <a href="mailto:users@openoffice.org">users@openoffice.org</a>. How to subscribe to the list (to get an email response) is explained on this page: <a href="http://wiki.services.openoffice.org/wiki/Website/Content/help/mailinglists">http://wiki.services.openoffice.org/wiki/Website/Content/help/mailinglists</a>.</p>
+ <p id="faq" url="ahead" xml:lang="en-US">Also check the FAQ section at <a href="http://wiki.services.openoffice.org/wiki/Documentation/FAQ">http://wiki.services.openoffice.org/wiki/Documentation/FAQ.</a></p>
+ </div>
+
+ <div id="ReportBugsIssues">
+ <h2 id="reportbugs" xml:lang="en-US">Reporting Bugs &amp; Issues</h2>
+ <p id="reportbugs1" xml:lang="en-US">The ${PRODUCTNAME} Web site hosts IssueZilla, our mechanism for reporting, tracking and solving bugs and issues. We encourage all users to feel entitled and welcome to report issues that may arise on your particular platform. Energetic reporting of issues is one of the most important contributions that the user community can make to the ongoing development and improvement of the suite.</p>
+ </div>
+
+ <div id="GettingInvolved">
+ <h2 id="gettinginvolved1" xml:lang="en-US">Getting Involved</h2>
+ <p id="gettinginvolved2" xml:lang="en-US">The ${PRODUCTNAME} Community would very much benefit from your active participation in the development of this important open source project.</p>
+ <p id="gettingimvolved3" xml:lang="en-US">As a user, you are already a valuable part of the suite's development process and we would like to encourage you to take an even more active role with a view to being a long-term contributor to the community. Please join and check out the user page at <a href="http://www.openoffice.org">http://www.openoffice.org</a></p>
+ <h3 id="howtostart" xml:lang="en-US">How to Start</h3>
+ <p id="howtostart1" xml:lang="en-US">The best way to start contributing is to subscribe to one or more of the mailing lists, lurk for a while, and gradually use the mail archives to familiarize yourself with many of the topics covered since the ${PRODUCTNAME} source code was released back in October 2000. When you're comfortable, all you need to do is send an email self-introduction and jump right in. If you are familiar with Open Source Projects, check out our To-Dos list and see if there is anything you would like to help with at <a href="http://development.openoffice.org/todo.html">http://development.openoffice.org/todo.html</a>.</p>
+ <h3 id="subscribe" xml:lang="en-US">Subscribe</h3>
+ <p id="subscribe1" xml:lang="en-US">Here are a few of the Project mailing lists to which you can subscribe at <a href="http://www.openoffice.org/mail_list.html">http://www.openoffice.org/mail_list.html</a></p>
+ <ul>
+ <li>
+ <p id="subscribelist1" xml:lang="en-US">News: announce@openoffice.org *recommended to all users* (light traffic)</p>
+ </li>
+
+ <li>
+ <p id="subscribelist2" xml:lang="en-US">Main user forum: user@openoffice.org *easy way to lurk on discussions* (heavy traffic)</p>
+ </li>
+
+ <li>
+ <p id="subscribelist3" xml:lang="en-US">Marketing project: dev@marketing.openoffice.org *beyond development* (getting heavy)</p>
+ </li>
+
+ <li>
+ <p id="subscribelist4" xml:lang="en-US">General code contributor list: dev@openoffice.org (moderate/heavy)</p>
+ </li>
+ </ul>
+ <h3 xml:lang="en-US">Joining one or more Projects</h3>
+ <p id="joining" xml:lang="en-US">You can make major contributions to this important open source project even if you have limited software design or coding experience. Yes, you!</p>
+ <p id="joining1" url="ahead" xml:lang="en-US">At <a href="http://projects.openoffice.org/index.html">http://projects.openoffice.org/index.html</a> you will find projects ranging from Localization, Porting and Groupware to some real core coding projects. If you are not a developer, try the Documentation or the Marketing Project. The OpenOffice.org Marketing Project is applying both guerilla and traditional commercial techniques to marketing open source software, and we are doing it across language and cultural barriers, so you can help just by spreading the word and telling a friend about this office suite.</p>
+ <p id="joining3" xml:lang="en-US">You can help by joining the Marketing Communications &amp; Information Network on <a href="http://marketing.openoffice.org/contacts.html">http://marketing.openoffice.org/contacts.html</a> where you can provide point communication contact with press, media, government agencies, consultants, schools, Linux Users Groups and developers in your country and local community.</p>
+ </div>
+
+ <div id="Credits">
+ <p id="credits" xml:lang="en-US">We hope you enjoy working with the new ${PRODUCTNAME} ${PRODUCTVERSION} and will join us online.</p>
+ <p id="credits2" xml:lang="en-US">The OpenOffice.org Community</p>
+ </div>
+
+ <div id="ModifiedSourceCode">
+ <h2 id="sdffd23r3cefwefew" xml:lang="en-US">Used / Modified Source Code</h2>
+ <p id="sdffd23red32efew">Portions Copyright 1998, 1999 James Clark. Portions Copyright 1996, 1998 Netscape Communications Corporation.</p>
+ </div>
+ </body>
+</html>
diff --git a/readlicense_oo/util/makefile.pmk b/readlicense_oo/util/makefile.pmk
index 8aee1ce3b6..30e0777945 100755
--- a/readlicense_oo/util/makefile.pmk
+++ b/readlicense_oo/util/makefile.pmk
@@ -53,7 +53,7 @@ $(COMMONMISC)$/readme.dtd : ..$/readme.dtd
virtual : $(MERGEDXRM) $(COMMONMISC)$/readme.dtd $(PRJ)$/docs/readme.xsl
$(MISC)$/readme_text.xsl : virtual
- $(SED) 's#method="html".*>#method="text"/>#' < ..$/readme.xsl > $@
+ $(SED) '' < ..$/readme.xsl > $@
$(MISC)$/$(GUI)$/$(eq,$(GUI),WNT readme README)_%.html : 'virtual'
@@-$(MKDIRHIER) $(@:d)
@@ -79,6 +79,7 @@ $(SYSTEXTDOCS) : $(MISC)$/readme_text.xsl
--stringparam os1 $(OS) --stringparam gui1 $(GUI) --stringparam com1 $(COM) \
--stringparam cp1 $(CPUNAME) --stringparam type text --stringparam lang1 $(@:b:s/readme_//:s/README_//) \
$< $(MERGEDXRM)
+
.IF "$(GUI)"=="UNX"
chmod g+w $(MISC)$/$(GUI)
.ENDIF # "$(GUI)"=="UNX"
diff --git a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java
index ac3988e8da..fc1dec7f7d 100644
--- a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java
+++ b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java
@@ -44,15 +44,21 @@ import com.sun.star.io.XOutputStream;
import com.sun.star.io.XTruncate;
import com.sun.star.deployment.XPackage;
+import com.sun.star.deployment.ExtensionRemovedException;
public class UnoPkgContainer extends ParcelContainer
{
private Map registeredPackages = new HashMap();
-
- public UnoPkgContainer( XComponentContext xCtx, String locationURL, String language ) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException
+ protected String extensionDb;
+ protected String extensionRepository;
+
+ public UnoPkgContainer( XComponentContext xCtx, String locationURL,
+ String _extensionDb, String _extensionRepository, String language ) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException
{
super( xCtx, locationURL, language, false );
+ extensionDb = _extensionDb;
+ extensionRepository = _extensionRepository;
init();
}
@@ -217,8 +223,8 @@ public class UnoPkgContainer extends ParcelContainer
DeployedUnoPackagesDB dp = null;
try
{
- String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") );
- String packagesUrl = PathUtils.make_url( path, "Scripts/unopkg-desc.xml" );
+// String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") );
+ String packagesUrl = PathUtils.make_url( extensionDb, "/Scripts/" + extensionRepository + "-extension-desc.xml" );
LogUtils.DEBUG("getUnoPackagesDB() looking for existing db in " + packagesUrl );
if ( m_xSFA.exists( packagesUrl ) )
{
@@ -276,8 +282,8 @@ public class UnoPkgContainer extends ParcelContainer
OutputStream os = null;
try
{
- String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") );
- String packagesUrl = PathUtils.make_url( path, "Scripts/unopkg-desc.xml" );
+// String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") );
+ String packagesUrl = PathUtils.make_url( extensionDb, "/Scripts/" + extensionRepository + "-extension-desc.xml" );
xos = m_xSFA.openFileWrite( packagesUrl );
XTruncate xTrc = (XTruncate) UnoRuntime.queryInterface( XTruncate.class, xos );
if ( xTrc != null )
@@ -335,8 +341,16 @@ public class UnoPkgContainer extends ParcelContainer
LogUtils.DEBUG("** processUnoPackage getURL() -> " + uri );
LogUtils.DEBUG("** processUnoPackage getName() -> " + dPackage.getName() );
- LogUtils.DEBUG("** processUnoPackage getMediaType() -> " + dPackage.getPackageType().getMediaType() );
- LogUtils.DEBUG("** processUnoPackage getDisplayName() -> " + dPackage.getDisplayName() );
+ LogUtils.DEBUG("** processUnoPackage getMediaType() -> " + dPackage.getPackageType().getMediaType() );
+ try
+ {
+ LogUtils.DEBUG("** processUnoPackage getDisplayName() -> " + dPackage.getDisplayName() );
+ }
+ catch (com.sun.star.deployment.ExtensionRemovedException e)
+ {
+ throw new com.sun.star.lang.WrappedTargetException(e.toString(), this, e);
+ }
+
processUnoPackage( uri, language );
db = getUnoPackagesDB();
@@ -366,7 +380,10 @@ public class UnoPkgContainer extends ParcelContainer
String parentUrl = uri;
if ( uri.indexOf( "%2Funo_packages%2F" ) > -1 ||
- uri.indexOf( "/uno_packages/" ) > -1 )
+ uri.indexOf( "/uno_packages/" ) > -1 ||
+ uri.indexOf("$UNO_USER_PACKAGES_CACHE/") > -1 ||
+ uri.indexOf("$UNO_SHARED_PACKAGES_CACHE/") > -1 ||
+ uri.indexOf("$BUNDLED_EXTENSIONS/") > -1 )
{
//its in a bundle need to determine the uno-package file its in
LogUtils.DEBUG("processUnoPackage - is part of a uno bundle");
diff --git a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
index ec3a6b9233..c1c785ba19 100755
--- a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
+++ b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
@@ -213,26 +213,40 @@ public abstract class ScriptProvider
}
else
{
+ String extensionDb = null;
+ String extensionRepository = null;
+ if ( originalContextURL.startsWith( "bundled" ) )
+ {
+ contextUrl = "vnd.sun.star.expand:$BUNDLED_EXTENSIONS";
+ extensionDb = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user";
+ extensionRepository = "bundled";
+ }
+
if ( originalContextURL.startsWith( "share" ) )
{
contextUrl = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::BaseInstallation}/share";
+ extensionDb = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user";
+ extensionRepository = "shared";
}
else if ( originalContextURL.startsWith( "user" ) )
{
contextUrl = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user";
+ extensionDb = "vnd.sun.star.expand:${$BRAND_BASE_DIR/program/" + PathUtils.BOOTSTRAP_NAME + "::UserInstallation}/user";
+ extensionRepository = "user";
}
if ( originalContextURL.endsWith( "uno_packages") )
{
isPkgProvider = true;
}
- if ( originalContextURL.endsWith( "uno_packages") && !originalContextURL.equals( contextUrl ) )
+ if ( originalContextURL.endsWith( "uno_packages") && !originalContextURL.equals( contextUrl )
+ && !extensionRepository.equals("bundled"))
{
contextUrl = PathUtils.make_url( contextUrl, "uno_packages" );
}
if ( isPkgProvider )
{
- m_container = new UnoPkgContainer( m_xContext, contextUrl, language );
+ m_container = new UnoPkgContainer( m_xContext, contextUrl, extensionDb, extensionRepository, language );
}
else
{
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties
index 3137b89dde..f776ff9e79 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties
+++ b/scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties
@@ -1,5 +1,6 @@
# Filesystems API
# {0} - root path
+# x-no-translate
LAB_invalid_file_system=invalid OpenOffice.org document {0}
# {0} - root path
LAB_valid_file_system={0}
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties
index a3bf474476..eab2fa1f3f 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties
+++ b/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties
@@ -3,6 +3,7 @@
#HINT_myProp=<description of my property>
#LBL_DataNode_exec_sheet=Execution
#HINT_DataNode_exec_sheet=Properties pertaining to compiling, running, and debugging.
+# x-no-translate
LBL_loaderName=<display name of the data loader>
# Datasystems API
#PROP_myProp=<name of my property>
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties
index b823204cb2..6a9112e8c7 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties
+++ b/scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties
@@ -1,4 +1,5 @@
# Options API
+# x-no-translate
LBL_settings=Office Settings
PROP_OfficeDirectory=Path to Office installation
HINT_OfficeDirectory=Path to the Office installation
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties
index 58989c2506..22aea6525f 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties
+++ b/scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties
@@ -1,3 +1,4 @@
+# x-no-translate
Templates/OfficeScripting=Office Scripting
Templates/OfficeScripting/parcel.xml=Script Parcel Descriptor
Services/MIMEResolver/org-netbeans-modules-office-mime-resolver.xml=Script Parcel Descriptor File
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties
index 0e4f2bd100..a40b4b3739 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties
+++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties
@@ -1,4 +1,5 @@
# Window System API
+# x-no-translate
# TopComponent
LBL_component_name=<name of component>
diff --git a/scripting/source/provider/ActiveMSPList.cxx b/scripting/source/provider/ActiveMSPList.cxx
index b4f3709b72..380c124ba0 100644
--- a/scripting/source/provider/ActiveMSPList.cxx
+++ b/scripting/source/provider/ActiveMSPList.cxx
@@ -59,6 +59,7 @@ ActiveMSPList::ActiveMSPList( const Reference< XComponentContext > & xContext )
{
userDirString = ::rtl::OUString::createFromAscii("user");
shareDirString = ::rtl::OUString::createFromAscii("share");
+ bundledDirString = ::rtl::OUString::createFromAscii("bundled");
}
ActiveMSPList::~ActiveMSPList()
@@ -307,6 +308,12 @@ ActiveMSPList::createNonDocMSPs()
Reference< provider::XScriptProvider > shareMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY );
// should check if provider reference is valid
m_hMsps[ shareDirString ] = shareMsp;
+
+ args[ 0 ] <<= bundledDirString;
+ Reference< provider::XScriptProvider > bundledMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY );
+ // should check if provider reference is valid
+ m_hMsps[ bundledDirString ] = bundledMsp;
+
created = true;
}
diff --git a/scripting/source/provider/ActiveMSPList.hxx b/scripting/source/provider/ActiveMSPList.hxx
index 526c2522aa..b0418ebaa4 100644
--- a/scripting/source/provider/ActiveMSPList.hxx
+++ b/scripting/source/provider/ActiveMSPList.hxx
@@ -107,6 +107,7 @@ private:
osl::Mutex m_mutex;
::rtl::OUString userDirString;
::rtl::OUString shareDirString;
+ ::rtl::OUString bundledDirString;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
};
} // func_provider
diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py
index f9c2f0f70b..55c204f87d 100644
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -16,6 +16,8 @@ import uno
import re
#to implement com::sun::star::mail::XMailServiceProvider
+#and
+#to implement com.sun.star.mail.XMailMessage
from com.sun.star.mail import XMailServiceProvider
from com.sun.star.mail import XMailService
@@ -37,7 +39,7 @@ from email import Encoders
from email.Header import Header
from email.MIMEMultipart import MIMEMultipart
from email.Utils import formatdate
-from email.Utils import formataddr
+from email.Utils import parseaddr
import sys, smtplib, imaplib, poplib
@@ -118,30 +120,46 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
print >> sys.stderr, "PyMailSMPTService sendMailMessage"
recipients = xMailMessage.getRecipients()
sendermail = xMailMessage.SenderAddress
- sendername = xMailMessage.SenderName
+ sendername = xMailMessage.SenderName
subject = xMailMessage.Subject
ccrecipients = xMailMessage.getCcRecipients()
bccrecipients = xMailMessage.getBccRecipients()
if dbg:
print >> sys.stderr, "PyMailSMPTService subject", subject
- print >> sys.stderr, "PyMailSMPTService from", sendername.encode('utf-8'), sendermail
- print >> sys.stderr, "PyMailSMTPService from", formataddr((sendername.encode('utf-8'), sendermail))
+ print >> sys.stderr, "PyMailSMPTService from", sendername.encode('utf-8')
+ print >> sys.stderr, "PyMailSMTPService from", sendermail
print >> sys.stderr, "PyMailSMPTService send to", recipients
attachments = xMailMessage.getAttachments()
+ textmsg = Message()
+
content = xMailMessage.Body
flavors = content.getTransferDataFlavors()
- flavor = flavors[0]
if dbg:
- print >> sys.stderr, "PyMailSMPTService mimetype is", flavor.MimeType
- textbody = content.getTransferData(flavor)
+ print >> sys.stderr, "PyMailSMPTService flavors len", len(flavors)
- textmsg = Message()
- mimeEncoding = re.sub("charset=.*", "charset=UTF-8", flavor.MimeType)
- textmsg['Content-Type'] = mimeEncoding
- textmsg['MIME-Version'] = '1.0'
- textmsg.set_payload(textbody.encode('utf-8'))
+ #Use first flavor that's sane for an email body
+ for flavor in flavors:
+ if flavor.MimeType.find('text/html') != -1 or flavor.MimeType.find('text/plain') != -1:
+ if dbg:
+ print >> sys.stderr, "PyMailSMPTService mimetype is", flavor.MimeType
+ textbody = content.getTransferData(flavor)
+ try:
+ textbody = textbody.value
+ except:
+ pass
+ textbody = textbody.encode('utf-8')
+
+ if len(textbody):
+ mimeEncoding = re.sub("charset=.*", "charset=UTF-8", flavor.MimeType)
+ if mimeEncoding.find('charset=UTF-8') == -1:
+ mimeEncoding = mimeEncoding + "; charset=UTF-8"
+ textmsg['Content-Type'] = mimeEncoding
+ textmsg['MIME-Version'] = '1.0'
+ textmsg.set_payload(textbody)
+
+ break
if (len(attachments)):
msg = MIMEMultipart()
@@ -150,15 +168,31 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
else:
msg = textmsg
- msg['Subject'] = subject
- msg['From'] = formataddr((sendername.encode('utf-8'), sendermail))
+ hdr = Header(sendername, 'utf-8')
+ hdr.append('<'+sendermail+'>','us-ascii')
+ msg['Subject'] = subject
+ msg['From'] = hdr
msg['To'] = COMMASPACE.join(recipients)
if len(ccrecipients):
msg['Cc'] = COMMASPACE.join(ccrecipients)
if xMailMessage.ReplyToAddress != '':
msg['Reply-To'] = xMailMessage.ReplyToAddress
- msg['X-Mailer'] = "OpenOffice.org 2.0 via Caolan's mailmerge component"
+ mailerstring = "OpenOffice.org 2.0 via Caolan's mailmerge component"
+ try:
+ ctx = uno.getComponentContext()
+ aConfigProvider = ctx.ServiceManager.createInstance("com.sun.star.configuration.ConfigurationProvider")
+ prop = uno.createUnoStruct('com.sun.star.beans.PropertyValue')
+ prop.Name = "nodepath"
+ prop.Value = "/org.openoffice.Setup/Product"
+ aSettings = aConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess",
+ (prop,))
+ mailerstring = aSettings.getByName("ooName") + " " + \
+ aSettings.getByName("ooSetupVersion") + " via Caolan's mailmerge component"
+ except:
+ pass
+
+ msg['X-Mailer'] = mailerstring
msg['Date'] = formatdate(localtime=True)
for attachment in attachments:
@@ -344,9 +378,63 @@ class PyMailServiceProvider(unohelper.Base, XMailServiceProvider):
else:
print >> sys.stderr, "PyMailServiceProvider, unknown TYPE", aType
+class PyMailMessage(unohelper.Base, XMailMessage):
+ def __init__( self, ctx, sTo='', sFrom='', Subject='', Body=None, aMailAttachment=None ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage init"
+ self.ctx = ctx
+
+ self.recipients = sTo,
+ self.ccrecipients = ()
+ self.bccrecipients = ()
+ self.aMailAttachments = ()
+ if aMailAttachment != None:
+ self.aMailAttachments = aMailAttachment,
+
+ self.SenderName, self.SenderAddress = parseaddr(sFrom)
+ self.ReplyToAddress = sFrom
+ self.Subject = Subject
+ self.Body = Body
+ if dbg:
+ print >> sys.stderr, "post PyMailMessage init"
+ def addRecipient( self, recipient ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.addRecipient", recipient
+ self.recipients = self.recipients, recipient
+ def addCcRecipient( self, ccrecipient ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.addCcRecipient", ccrecipient
+ self.ccrecipients = self.ccrecipients, ccrecipient
+ def addBccRecipient( self, bccrecipient ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.addBccRecipient", bccrecipient
+ self.bccrecipients = self.bccrecipients, bccrecipient
+ def getRecipients( self ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.getRecipients", self.recipients
+ return self.recipients
+ def getCcRecipients( self ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.getCcRecipients", self.ccrecipients
+ return self.ccrecipients
+ def getBccRecipients( self ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.getBccRecipients", self.bccrecipients
+ return self.bccrecipients
+ def addAttachment( self, aMailAttachment ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.addAttachment"
+ self.aMailAttachments = self.aMailAttachments, aMailAttachment
+ def getAttachments( self ):
+ if dbg:
+ print >> sys.stderr, "PyMailMessage.getAttachments"
+ return self.aMailAttachments
+
# pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation( \
PyMailServiceProvider, "org.openoffice.pyuno.MailServiceProvider",
("com.sun.star.mail.MailServiceProvider",),)
-
+g_ImplementationHelper.addImplementation( \
+ PyMailMessage, "org.openoffice.pyuno.MailMessage",
+ ("com.sun.star.mail.MailMessage",),)
diff --git a/sfx2/inc/brokenpackageint.hxx b/sfx2/inc/brokenpackageint.hxx
index 35ea5acf1c..293557399d 100644..100755
--- a/sfx2/inc/brokenpackageint.hxx
+++ b/sfx2/inc/brokenpackageint.hxx
@@ -36,7 +36,9 @@ using namespace ::framework;
typedef ContinuationBase< ::com::sun::star::task::XInteractionApprove > SfxContinuationApprove;
typedef ContinuationBase< ::com::sun::star::task::XInteractionDisapprove > SfxContinuationDisapprove;
-class SFX2_DLLPUBLIC RequestPackageReparation : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest >
+class SFX2_DLLPUBLIC RequestPackageReparation :
+ public ::com::sun::star::task::XInteractionRequest,
+ public ::cppu::OWeakObject
{
::com::sun::star::uno::Any m_aRequest;
@@ -50,6 +52,11 @@ class SFX2_DLLPUBLIC RequestPackageReparation : public ::cppu::WeakImplHelper1<
public:
RequestPackageReparation( ::rtl::OUString aName );
+ // XInterface / OWeakObject
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
sal_Bool isApproved() { return m_pApprove->isSelected(); }
virtual ::com::sun::star::uno::Any SAL_CALL getRequest()
@@ -61,7 +68,9 @@ public:
throw( ::com::sun::star::uno::RuntimeException );
};
-class SFX2_DLLPUBLIC NotifyBrokenPackage : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest >
+class SFX2_DLLPUBLIC NotifyBrokenPackage :
+ public ::com::sun::star::task::XInteractionRequest,
+ public ::cppu::OWeakObject
{
::com::sun::star::uno::Any m_aRequest;
@@ -74,6 +83,11 @@ class SFX2_DLLPUBLIC NotifyBrokenPackage : public ::cppu::WeakImplHelper1< ::com
public:
NotifyBrokenPackage( ::rtl::OUString aName );
+ // XInterface / OWeakObject
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
sal_Bool isAborted() { return m_pAbort->isSelected(); }
virtual ::com::sun::star::uno::Any SAL_CALL getRequest()
diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx
index 9811bf838b..6c330b023a 100644
--- a/sfx2/inc/sfx2/app.hxx
+++ b/sfx2/inc/sfx2/app.hxx
@@ -259,7 +259,7 @@ public:
void ResetLastDir();
//#if 0 // _SOLAR__PRIVATE
- SAL_DLLPRIVATE static SfxApplication* Is_Impl() { return pApp;}
+ SAL_DLLPRIVATE static SfxApplication* Get() { return pApp;}
SAL_DLLPRIVATE SfxDispatcher* GetAppDispatcher_Impl();
SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl();
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index e6961a1a1b..cd43e0989d 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -154,6 +154,7 @@ public:
const SfxFilter * GetFilter() const { return pFilter; }
const SfxFilter * GetOrigFilter( sal_Bool bNotCurrent = sal_False ) const;
const String& GetOrigURL() const;
+
SfxItemSet * GetItemSet() const;
void SetItemSet(SfxItemSet *pSet);
void Close();
@@ -327,6 +328,7 @@ public:
static sal_Bool CallApproveHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler, ::com::sun::star::uno::Any aRequest, sal_Bool bAllowAbort );
static sal_Bool SetWritableForUserOnly( const ::rtl::OUString& aURL );
+ static sal_uInt32 CreatePasswordToModifyHash( const ::rtl::OUString& aPasswd, sal_Bool bWriter );
};
SV_DECL_IMPL_REF( SfxMedium )
diff --git a/sfx2/inc/sfx2/docfilt.hxx b/sfx2/inc/sfx2/docfilt.hxx
index f7ed7db1af..9c6c0b18ac 100644
--- a/sfx2/inc/sfx2/docfilt.hxx
+++ b/sfx2/inc/sfx2/docfilt.hxx
@@ -37,6 +37,7 @@
#include <com/sun/star/uno/RuntimeException.hpp>
#include <tools/wldcrd.hxx>
+// TODO/LATER: The flags should be part of the UNO specification
#define SFX_FILTER_IMPORT 0x00000001L
#define SFX_FILTER_EXPORT 0x00000002L
#define SFX_FILTER_TEMPLATE 0x00000004L
@@ -45,13 +46,13 @@
#define SFX_FILTER_OWN 0x00000020L
#define SFX_FILTER_ALIEN 0x00000040L
#define SFX_FILTER_USESOPTIONS 0x00000080L
-#define SFX_FILTER_NOTINFILEDLG 0x00001000L
-#define SFX_FILTER_NOTINCHOOSER 0x00002000L
#define SFX_FILTER_DEFAULT 0x00000100L
#define SFX_FILTER_EXECUTABLE 0x00000200L
#define SFX_FILTER_SUPPORTSSELECTION 0x00000400L
#define SFX_FILTER_MAPTOAPPPLUG 0x00000800L
+#define SFX_FILTER_NOTINFILEDLG 0x00001000L
+#define SFX_FILTER_NOTINCHOOSER 0x00002000L
#define SFX_FILTER_ASYNC 0x00004000L
// Legt Objekt nur an, kein Laden
#define SFX_FILTER_CREATOR 0x00008000L
@@ -64,6 +65,10 @@
#define SFX_FILTER_SILENTEXPORT 0x00200000L
#define SFX_FILTER_BROWSERPREFERED 0x00400000L
+
+#define SFX_FILTER_ENCRYPTION 0x01000000L
+#define SFX_FILTER_PASSWORDTOMODIFY 0x02000000L
+
#define SFX_FILTER_PREFERED 0x10000000L
#define SFX_FILTER_VERSION_NONE 0
@@ -72,20 +77,6 @@
#include <sfx2/sfxdefs.hxx>
//========================================================================
-
-namespace sfx2 {
-
-/** Returns true if the passed string is the name of a Microsoft Office file
- format filter supporting export of password protected documents.
-
- This function is just a hack for #i105076# is fixed and needs to be removed
- then.
- */
-SFX2_DLLPUBLIC bool CheckMSPasswordCapabilityForExport( const String& rFilterName );
-
-} // namespace sfx2
-
-//========================================================================
class SfxFilterContainer;
class SotStorage;
class SFX2_DLLPUBLIC SfxFilter
diff --git a/sfx2/inc/sfx2/htmlmode.hxx b/sfx2/inc/sfx2/htmlmode.hxx
new file mode 100644
index 0000000000..f02de328db
--- /dev/null
+++ b/sfx2/inc/sfx2/htmlmode.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * 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 _SFX_HTMLMODE_HXX_
+#define _SFX_HTMLMODE_HXX_
+
+
+#define HTMLMODE_ON 0x0001
+#define HTMLMODE_PARA_BORDER 0x0002 /* Absatzumrandungen */
+#define HTMLMODE_PARA_DISTANCE 0x0004 /* bestimmte Absatzabstaende */
+#define HTMLMODE_SMALL_CAPS 0x0008 /* Kapitaelchen */
+#define HTMLMODE_FRM_COLUMNS 0x0010 /* spaltige Rahmen */
+#define HTMLMODE_SOME_STYLES 0x0020 /* mind. MS IE */
+#define HTMLMODE_FULL_STYLES 0x0040 /* == SW */
+#define HTMLMODE_BLINK 0x0080 /* blinkende Zeichen*/
+#define HTMLMODE_PARA_BLOCK 0x0100 /* Blocksatz */
+#define HTMLMODE_DROPCAPS 0x0200 /* Initialen*/
+#define HTMLMODE_FIRSTLINE 0x0400 /* Erstzeileneinzug mit Spacer == NS 3.0 */
+#define HTMLMODE_GRAPH_POS 0x0800 /* Grafikpositionen Hintergrund */
+#define HTMLMODE_FULL_ABS_POS 0x1000 /* abs. Rahmenpositionierung */
+#define HTMLMODE_SOME_ABS_POS 0x2000 /* abs. Rahmenpositionierung vollst.*/
+#define HTMLMODE_RESERVED1 0x4000
+#define HTMLMODE_RESERVED0 0x8000
+
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
index 42021778b4..f2e6fb5c50 100644..100755
--- a/sfx2/inc/sfx2/objsh.hxx
+++ b/sfx2/inc/sfx2/objsh.hxx
@@ -286,9 +286,10 @@ public:
sal_Bool HasName() const { return bHasName; }
virtual String GetAPIName() const;
void SetHasName( sal_Bool bSet = sal_True ) { bHasName = bSet; }
+ void SetReadOnly();
sal_Bool IsReadOnly() const;
sal_Bool IsReadOnlyMedium() const;
- void SetReadOnlyUI( sal_Bool bReadOnly = sal_True );
+ void SetReadOnlyUI( sal_Bool bReadOnly = sal_True );
sal_Bool IsReadOnlyUI() const;
void SetNoName();
sal_Bool IsInModalMode() const;
@@ -438,6 +439,13 @@ public:
void SetSaveVersionOnClose( sal_Bool bSet );
void ResetFromTemplate( const String& rTemplateName, const String& rFileName );
+ // TODO/LATER: the following two methods should be replaced by Get/SetModifPasswordInfo in future
+ sal_uInt32 GetModifyPasswordHash() const;
+ sal_Bool SetModifyPasswordHash( sal_uInt32 nHash );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetModifyPasswordInfo() const;
+ sal_Bool SetModifyPasswordInfo( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aInfo );
+
static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc );
virtual void ViewAssigned();
@@ -685,6 +693,15 @@ public:
sal_Int32 nVersion,
sal_Bool bTemplate = sal_False) const = 0;
+ // change recording and respective passwword protection for Writer and Calc
+ // slots available for Writer: FN_REDLINE_ON, FN_REDLINE_ON
+ // slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT
+ virtual bool IsChangeRecording() const;
+ virtual bool HasChangeRecordProtection() const;
+ virtual void SetChangeRecording( bool bActivate );
+ virtual bool SetProtectionPassword( const String &rPassword );
+ virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash );
+
// =================================
//#if 0 // _SOLAR__PRIVATE
@@ -713,6 +730,8 @@ public:
SAL_DLLPRIVATE sal_uInt16 ImplCheckSignaturesInformation(
const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos );
SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
+ SAL_DLLPRIVATE void SetModifyPasswordEntered( sal_Bool bEntered = sal_True );
+ SAL_DLLPRIVATE sal_Bool IsModifyPasswordEntered();
SAL_DLLPRIVATE void InitBasicManager_Impl();
SAL_DLLPRIVATE SfxObjectShell_Impl* Get_Impl() { return pImp; }
diff --git a/sfx2/inc/sfx2/securitypage.hxx b/sfx2/inc/sfx2/securitypage.hxx
new file mode 100755
index 0000000000..ade48ac8f4
--- /dev/null
+++ b/sfx2/inc/sfx2/securitypage.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * 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 _SECURITYPAGE_HXX_
+#define _SECURITYPAGE_HXX_
+
+#include "sfx2/tabdlg.hxx"
+#include "sfx2/htmlmode.hxx"
+
+#include <memory>
+
+
+//////////////////////////////////////////////////////////////////////
+
+struct SfxSecurityPage_Impl;
+
+class SfxSecurityPage : public SfxTabPage
+{
+ std::auto_ptr< SfxSecurityPage_Impl > m_pImpl;
+
+protected:
+ SfxSecurityPage( Window* pParent, const SfxItemSet& );
+ virtual ~SfxSecurityPage();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
+};
+
+//////////////////////////////////////////////////////////////////////
+
+#endif // #ifndef _SECURITYPAGE_HXX_
+
diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc
index b0d91faf9e..4dc2fc575f 100644..100755
--- a/sfx2/inc/sfx2/sfx.hrc
+++ b/sfx2/inc/sfx2/sfx.hrc
@@ -229,10 +229,15 @@
#define TP_DOCINFOUSER (RID_SFX_START+5)
#define TP_DOCINFORELOAD (RID_SFX_START+13)
#define TP_CUSTOMPROPERTIES (RID_SFX_START+14)
+#define TP_DOCINFOSECURITY (RID_SFX_START+215)
#define DLG_DOCINFO_EDT (RID_SFX_START+6)
#define TP_MANAGE_STYLES (RID_SFX_START+7)
#define DLG_STYLE_DESIGNER (RID_SFX_START+8)
+#define RID_SFX_PROTECT_RECORDS (RID_SFX_START+216)
+#define RID_SFX_UNPROTECT_RECORDS (RID_SFX_START+217)
+#define RID_SFX_INCORRECT_PASSWORD (RID_SFX_START+218)
+
#define STR_STYLE_FILTER_AUTO (RID_SFX_START+9)
#define STR_STYLE_FILTER_USED (RID_SFX_START+10)
#define STR_STYLE_FILTER_USERDEF (RID_SFX_START+11)
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index 846b6c547f..457dbad41c 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -155,6 +155,7 @@
#define SID_RELOAD (SID_SFX_START + 508)
#define SID_PRINTDOCDIRECT (SID_SFX_START + 509)
#define SID_PICKLIST (SID_SFX_START + 510)
+#define SID_ATTR_XWINDOW (SID_SFX_START + 777)
#define SID_PLUGIN_MODE (SID_SFX_START + 827)
#define SID_EXPORTDOC (SID_SFX_START + 829)
#define SID_EXPORTDOCASPDF (SID_SFX_START + 1673)
@@ -306,7 +307,9 @@
#define SID_ACTIVATE_STYLE_APPLY (SID_SFX_START + 1715)
#define SID_FONT_NAME (SID_SFX_START + 1716)
#define SID_DEFAULTFILENAME (SID_SFX_START + 1717)
-#define SID_SFX_free_START (SID_SFX_START + 1718)
+#define SID_MODIFYPASSWORDINFO (SID_SFX_START + 1718)
+#define SID_RECOMMENDREADONLY (SID_SFX_START + 1719)
+#define SID_SFX_free_START (SID_SFX_START + 1720)
#define SID_SFX_free_END (SID_SFX_START + 3999)
#define SID_OPEN_NEW_VIEW (SID_SFX_START + 520)
@@ -1002,5 +1005,30 @@
#endif // #ifndef _SFXSIDS_HRC
+//-----------------------------------------------------------------------
+// SfxSecurityPage related stuff
+
+#define FN_EDIT2 (SID_SW_START + 1800)
+#define FN_REDLINE_PROTECT (FN_EDIT2 + 23)
+#define FN_REDLINE_ON (FN_EDIT2 + 25)
+
+#define SID_HTML_MODE (SID_SVX_START + 414)
+
+// Calc-Id's used for SfxSecurityPage
+#ifndef SC_FUNCTION_START
+#define SC_FUNCTION_START (SID_SC_START + 200)
+#endif
+#ifndef FILE_MENU_END
+#define FILE_MENU_END (SC_FUNCTION_START + 20)
+#endif
+#ifndef EDIT_MENU_START
+#define EDIT_MENU_START (FILE_MENU_END)
+#endif
+#ifndef SC_VIEW_START
+#define SC_VIEW_START (SID_SC_START)
+#endif
+#define FID_CHG_RECORD (EDIT_MENU_START + 18)
+#define SID_CHG_PROTECT (SC_VIEW_START + 84)
+
// eof ------------------------------------------------------------------------
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index bfff1068d9..df825c4ef1 100644..100755
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -3594,6 +3594,34 @@ SfxVoidItem MacroOrganizer SID_MACROORGANIZER
]
//--------------------------------------------------------------------------
+SfxBoolItem ReccomendReadonly SID_RECOMMENDREADONLY
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = TRUE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+
+//--------------------------------------------------------------------------
SfxVoidItem RunMacro SID_RUNMACRO
()
[
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index 7936110356..148f44cc1c 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -89,7 +89,7 @@ void SfxBasicManagerCreationListener::onBasicManagerCreated( const Reference< XM
m_rAppData.OnApplicationBasicManagerCreated( _rBasicManager );
}
-SfxAppData_Impl::SfxAppData_Impl( SfxApplication* pApp ) :
+SfxAppData_Impl::SfxAppData_Impl( SfxApplication* ) :
pDdeService( 0 ),
pDocTopics( 0 ),
pTriggerTopic(0),
@@ -116,8 +116,7 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* pApp ) :
nRescheduleLocks(0),
nInReschedule(0),
nAsynchronCalls(0),
- m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow(
- *pApp, comphelper::getProcessServiceFactory()))
+ m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow(comphelper::getProcessServiceFactory()))
, pTbxCtrlFac(0)
, pStbCtrlFac(0)
, pViewFrames(0)
diff --git a/sfx2/source/appl/appmain.cxx b/sfx2/source/appl/appmain.cxx
index aee82150a8..89de71d7c6 100644
--- a/sfx2/source/appl/appmain.cxx
+++ b/sfx2/source/appl/appmain.cxx
@@ -93,9 +93,6 @@ static SfxItemInfo __READONLY_DATA aItemInfos[] =
//===================================================================
-typedef Link* LinkPtr;
-SV_DECL_PTRARR(SfxInitLinkList, LinkPtr, 4, 4)
-
TYPEINIT2(SfxApplication,SfxShell,SfxBroadcaster);
//--------------------------------------------------------------------
diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx
index 7c41c802bb..4cde428a57 100644
--- a/sfx2/source/appl/appquit.cxx
+++ b/sfx2/source/appl/appquit.cxx
@@ -74,57 +74,11 @@
using ::basic::BasicManagerRepository;
-#ifdef DBG_UTIL
-DECLARE_LIST( SfxFrameWindowFactoryArray_Impl, SfxFrameWindowFactory* )
-SV_DECL_PTRARR(SfxInitLinkList, Link*, 2, 2)
-#endif
-
//===================================================================
BOOL SfxApplication::QueryExit_Impl()
{
BOOL bQuit = TRUE;
-/*
- BOOL bPrinting = FALSE;
- for ( SfxViewShell *pViewSh = SfxViewShell::GetFirst();
- !bPrinting && pViewSh;
- pViewSh = SfxViewShell::GetNext(*pViewSh) )
- {
- SfxPrinter *pPrinter = pViewSh->GetPrinter();
- bPrinting = pPrinter && pPrinter->IsPrinting();
- }
-
- if ( bPrinting )
- {
- // Benutzer fragen, ob abgebrochen werden soll
- if ( RET_OK == QueryBox( 0, SfxResId( MSG_ISPRINTING_QUERYABORT ) ).Execute() )
- {
- // alle Jobs canceln
- for ( SfxViewShell *pViewSh = SfxViewShell::GetFirst();
- !bPrinting && pViewSh;
- pViewSh = SfxViewShell::GetNext(*pViewSh) )
- {
- SfxPrinter *pPrinter = pViewSh->GetPrinter();
- if ( pPrinter && pPrinter->IsPrinting() )
- pPrinter->AbortJob();
- }
-
- // da das Canceln asynchron ist, Quit erstmal wieder verlassen
- GetDispatcher_Impl()->Execute( SID_QUITAPP, SFX_CALLMODE_ASYNCHRON );
- DBG_TRACE( "QueryExit => FALSE (printing)" );
- return FALSE;
- }
- }
-*/
-/*
- SfxObjectShell *pLastDocSh = SfxObjectShell::GetFirst();
- if ( bQuit )
- {
- // Jetzt zur Sicherheit auch hidden Frames abr"aumen
- SfxViewFrame::CloseHiddenFrames_Impl();
- pLastDocSh = SfxObjectShell::GetFirst();
- }
-*/
// will trotzdem noch jemand, den man nicht abschiessen kann, die App haben?
if ( !bQuit )
{
@@ -197,22 +151,18 @@ void SfxApplication::Deinitialize()
delete pAppData_Impl->pLabelResMgr;
-#ifdef DBG_UTIL
DELETEX(pAppData_Impl->pSlotPool);
DELETEX(pAppData_Impl->pEventConfig);
SfxMacroConfig::Release_Impl();
DELETEX(pAppData_Impl->pFactArr);
DELETEX(pAppData_Impl->pInitLinkList);
-#endif
-#ifdef DBG_UTIL
DELETEX(pAppData_Impl->pTbxCtrlFac);
DELETEX(pAppData_Impl->pStbCtrlFac);
DELETEX(pAppData_Impl->pMenuCtrlFac);
DELETEX(pAppData_Impl->pViewFrames);
DELETEX(pAppData_Impl->pViewShells);
DELETEX(pAppData_Impl->pObjShells);
-#endif
//TODO/CLEANTUP
//ReleaseArgs could be used instead!
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index c079a5a5f0..2f4c757121 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -51,20 +51,15 @@
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/system/SystemShellExecuteException.hpp>
-#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
#include <comphelper/processfactory.hxx>
-#endif
#include <comphelper/storagehelper.hxx>
+#include "comphelper/configurationhelper.hxx"
-#ifndef _SVT_DOC_ADDRESSTEMPLATE_HXX_
#include <svtools/addresstemplate.hxx>
-#endif
#include <svl/visitem.hxx>
#include <unotools/intlwrapper.hxx>
-#ifndef _UNOTOOLS_CONFIGMGR_HXX_
#include <unotools/configmgr.hxx>
-#endif
#include <tools/config.hxx>
#include <tools/diagnose_ex.h>
#include <vcl/msgbox.hxx>
@@ -90,6 +85,7 @@
#include <vos/process.hxx>
#include <rtl/bootstrap.hxx>
#include <cppuhelper/exc_hlp.hxx>
+#include <rtl/ustrbuf.hxx>
#include <com/sun/star/script/provider/XScriptProviderFactory.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
@@ -879,6 +875,31 @@ namespace
}
}
+static ::rtl::OUString getConfigurationStringValue(
+ const ::rtl::OUString& rPackage,
+ const ::rtl::OUString& rRelPath,
+ const ::rtl::OUString& rKey,
+ const ::rtl::OUString& rDefaultValue )
+{
+ ::rtl::OUString aDefVal( rDefaultValue );
+
+ try
+ {
+ ::comphelper::ConfigurationHelper::readDirectKey(
+ comphelper::getProcessServiceFactory(),
+ rPackage,
+ rRelPath,
+ rKey,
+ ::comphelper::ConfigurationHelper::E_READONLY) >>= aDefVal;
+ }
+ catch(const com::sun::star::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const com::sun::star::uno::Exception&)
+ {}
+
+ return aDefVal;
+}
+
void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
{
DBG_MEMTEST();
@@ -924,8 +945,34 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
uno::Reference< css::system::XSystemShellExecute > xSystemShell(
xSMGR->createInstance( DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute" ) ),
uno::UNO_QUERY_THROW );
- if ( xSystemShell.is() )
- xSystemShell->execute( DEFINE_CONST_UNICODE("http://extensions.services.openoffice.org/dictionary?cid=926385"), ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS );
+
+ // read repository URL from configuration
+ ::rtl::OUString sTemplRepoURL =
+ getConfigurationStringValue(
+ ::rtl::OUString::createFromAscii("org.openoffice.Office.Common"),
+ ::rtl::OUString::createFromAscii("Dictionaries"),
+ ::rtl::OUString::createFromAscii("RepositoryURL"),
+ ::rtl::OUString());
+
+ if ( xSystemShell.is() && sTemplRepoURL.getLength() > 0 )
+ {
+ ::rtl::OUStringBuffer aURLBuf( sTemplRepoURL );
+ aURLBuf.appendAscii( "?" );
+ aURLBuf.appendAscii( "lang=" );
+
+ // read locale from configuration
+ ::rtl::OUString sLocale = getConfigurationStringValue(
+ ::rtl::OUString::createFromAscii("org.openoffice.Setup"),
+ ::rtl::OUString::createFromAscii("L10N"),
+ ::rtl::OUString::createFromAscii("ooLocale"),
+ ::rtl::OUString::createFromAscii("en-US"));
+
+ aURLBuf.append( sLocale );
+ xSystemShell->execute(
+ aURLBuf.makeStringAndClear(),
+ ::rtl::OUString(),
+ css::system::SystemShellExecuteFlags::DEFAULTS );
+ }
}
catch( const ::com::sun::star::uno::Exception& )
{
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index f08cd7d546..2a7bb3f56d 100644..100755
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -191,6 +191,7 @@ static char const sFolderName[] = "FolderName";
static char const sUseSystemDialog[] = "UseSystemDialog";
static char const sStandardDir[] = "StandardDir";
static char const sBlackList[] = "BlackList";
+static char const sModifyPasswordInfo[] = "ModifyPasswordInfo";
void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot )
{
@@ -846,6 +847,10 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque
if (bOK)
rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) );
}
+ else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sModifyPasswordInfo)) )
+ {
+ rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
+ }
#ifdef DBG_UTIL
else
--nFoundArgs;
@@ -1058,6 +1063,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta
nAdditional++;
if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SFX_ITEM_SET )
nAdditional++;
+ if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SFX_ITEM_SET )
+ nAdditional++;
// consider additional arguments
nProps += nAdditional;
@@ -1197,7 +1204,9 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta
// used only internally
if ( nId == SID_SAVETO )
continue;
- }
+ if ( nId == SID_MODIFYPASSWORDINFO )
+ continue;
+ }
ByteString aDbg( "Unknown item detected: ");
aDbg += ByteString::CreateFromInt32( nId );
@@ -1555,7 +1564,11 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sNoAutoSave));
pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
}
-
+ if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO, sal_False, &pItem ) == SFX_ITEM_SET )
+ {
+ pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModifyPasswordInfo));
+ pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
+ }
}
}
@@ -2411,6 +2424,26 @@ RequestPackageReparation::RequestPackageReparation( ::rtl::OUString aName )
m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pDisapprove );
}
+/*uno::*/Any SAL_CALL RequestPackageReparation::queryInterface( const /*uno::*/Type& rType ) throw (RuntimeException)
+{
+ return ::cppu::queryInterface ( rType,
+ // OWeakObject interfaces
+ dynamic_cast< XInterface* > ( (XInteractionRequest *) this ),
+ static_cast< XWeak* > ( this ),
+ // my own interfaces
+ static_cast< XInteractionRequest* > ( this ) );
+}
+
+void SAL_CALL RequestPackageReparation::acquire( ) throw ()
+{
+ OWeakObject::acquire();
+}
+
+void SAL_CALL RequestPackageReparation::release( ) throw ()
+{
+ OWeakObject::release();
+}
+
::com::sun::star::uno::Any SAL_CALL RequestPackageReparation::getRequest()
throw( ::com::sun::star::uno::RuntimeException )
{
@@ -2442,6 +2475,26 @@ NotifyBrokenPackage::NotifyBrokenPackage( ::rtl::OUString aName )
m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort );
}
+/*uno::*/Any SAL_CALL NotifyBrokenPackage::queryInterface( const /*uno::*/Type& rType ) throw (RuntimeException)
+{
+ return ::cppu::queryInterface ( rType,
+ // OWeakObject interfaces
+ dynamic_cast< XInterface* > ( (XInteractionRequest *) this ),
+ static_cast< XWeak* > ( this ),
+ // my own interfaces
+ static_cast< XInteractionRequest* > ( this ) );
+}
+
+void SAL_CALL NotifyBrokenPackage::acquire( ) throw ()
+{
+ OWeakObject::acquire();
+}
+
+void SAL_CALL NotifyBrokenPackage::release( ) throw ()
+{
+ OWeakObject::release();
+}
+
::com::sun::star::uno::Any SAL_CALL NotifyBrokenPackage::getRequest()
throw( ::com::sun::star::uno::RuntimeException )
{
diff --git a/sfx2/source/appl/imestatuswindow.cxx b/sfx2/source/appl/imestatuswindow.cxx
index 2885f60bb9..53639a65df 100644
--- a/sfx2/source/appl/imestatuswindow.cxx
+++ b/sfx2/source/appl/imestatuswindow.cxx
@@ -57,10 +57,8 @@ namespace css = com::sun::star;
using sfx2::appl::ImeStatusWindow;
ImeStatusWindow::ImeStatusWindow(
- SfxApplication & rApplication,
css::uno::Reference< css::lang::XMultiServiceFactory > const &
rServiceFactory):
- m_rApplication(rApplication),
m_xServiceFactory(rServiceFactory),
m_bDisposed(false)
{}
@@ -161,7 +159,9 @@ ImeStatusWindow::propertyChange(css::beans::PropertyChangeEvent const & )
throw (css::uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- m_rApplication.Invalidate(SID_SHOW_IME_STATUS_WINDOW);
+ SfxApplication* pApp = SfxApplication::Get();
+ if (pApp)
+ pApp->Invalidate(SID_SHOW_IME_STATUS_WINDOW);
}
css::uno::Reference< css::beans::XPropertySet > ImeStatusWindow::getConfig()
diff --git a/sfx2/source/appl/imestatuswindow.hxx b/sfx2/source/appl/imestatuswindow.hxx
index cbfe2c4748..2d310c60c7 100644
--- a/sfx2/source/appl/imestatuswindow.hxx
+++ b/sfx2/source/appl/imestatuswindow.hxx
@@ -37,7 +37,6 @@ namespace com { namespace sun { namespace star {
namespace beans { class XPropertySet; }
namespace lang { class XMultiServiceFactory; }
} } }
-class SfxApplication;
namespace sfx2 { namespace appl {
@@ -56,10 +55,7 @@ ImeStatusWindow_Impl;
class ImeStatusWindow: private ImeStatusWindow_Impl
{
public:
- ImeStatusWindow(SfxApplication & rApplication,
- com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > const &
- rServiceFactory);
+ ImeStatusWindow( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > const& rServiceFactory );
/** Set up VCL according to the configuration.
@@ -115,7 +111,6 @@ private:
com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >
getConfig();
- SfxApplication & m_rApplication;
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
m_xServiceFactory;
diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx
index 9fd7a95a3c..1e3f5dde97 100644
--- a/sfx2/source/bastyp/progress.cxx
+++ b/sfx2/source/bastyp/progress.cxx
@@ -706,7 +706,7 @@ SfxProgress* SfxProgress::GetActiveProgress
*/
{
- if ( !SfxApplication::Is_Impl() )
+ if ( !SfxApplication::Get() )
return 0;
SfxProgress *pProgress = 0;
diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx
index eb73fee75a..b649d9d925 100644
--- a/sfx2/source/bastyp/sfxhtml.cxx
+++ b/sfx2/source/bastyp/sfxhtml.cxx
@@ -62,11 +62,7 @@ sal_Char __FAR_DATA sHTML_MIME_application[] = "application/";
sal_Char __FAR_DATA sHTML_MIME_experimental[] = "x-";
// <INPUT TYPE=xxx>
-#ifdef __MINGW32__ // for runtime pseudo reloc
-static HTMLOptionEnum aAreaShapeOptEnums[] =
-#else
static HTMLOptionEnum __READONLY_DATA aAreaShapeOptEnums[] =
-#endif
{
{ OOO_STRING_SVTOOLS_HTML_SH_rect, IMAP_OBJ_RECTANGLE },
{ OOO_STRING_SVTOOLS_HTML_SH_rectangle, IMAP_OBJ_RECTANGLE },
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 8159fc8430..14b3fe06e9 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -823,7 +823,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
pItem = pDispatcher->Execute( GetId(), nCall, 0, &aInternalSet, nModifier );
// no bindings, no invalidate ( usually done in SfxDispatcher::Call_Impl()! )
- if ( SfxApplication::Is_Impl() )
+ if ( SfxApplication::Get() )
{
SfxDispatcher* pAppDispat = SFX_APP()->GetAppDispatcher_Impl();
if ( pAppDispat )
diff --git a/sfx2/source/dialog/about.cxx b/sfx2/source/dialog/about.cxx
index 77b60b7fe8..fba842e129 100644
--- a/sfx2/source/dialog/about.cxx
+++ b/sfx2/source/dialog/about.cxx
@@ -172,20 +172,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS
rtl::OUString sProduct;
utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct;
- if ( sProduct.equals( rtl::OUString::createFromAscii("StarOffice") ) ||
- sProduct.equals( rtl::OUString::createFromAscii("StarSuite") ) )
- {
- // --> PB 2004-11-18 #118455# new copyright text (only in french version show a french text)
- ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
- ::rtl::OUString sFrenchLang( DEFINE_CONST_OUSTRING( "fr" ) );
- if ( aLocale.Language.equals( sFrenchLang ) )
- {
- String sNewCopyrightText( ResId( ABOUT_STR_FRENCH_COPYRIGHT, *rId.GetResMgr() ) );
- aCopyrightText.SetText( sNewCopyrightText );
- }
- // <--
- }
-
// load image from module path
aAppLogo = SfxApplication::GetApplicationLogo();
@@ -299,22 +285,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS
// explizite Help-Id
SetHelpId( SID_ABOUT );
-
- //#112429# replace occurences of "StarOffice" in the "StarSuite" version
- String sCopyright( aCopyrightText.GetText() );
- if(sProduct.equals(rtl::OUString::createFromAscii("StarSuite")))
- {
- String sSO(String::CreateFromAscii("StarOffice"));
- sCopyright.SearchAndReplaceAll(sSO, sProduct);
- }
-
- String sNewYear( DEFINE_CONST_UNICODE("2005") );
- xub_StrLen nIdx = sCopyright.SearchAndReplace( DEFINE_CONST_UNICODE("2002"), sNewYear );
- if ( STRING_NOTFOUND == nIdx )
- nIdx = sCopyright.SearchAndReplace( DEFINE_CONST_UNICODE("2003"), sNewYear );
- if ( STRING_NOTFOUND == nIdx )
- nIdx = sCopyright.SearchAndReplace( DEFINE_CONST_UNICODE("2004"), sNewYear );
- aCopyrightText.SetText( sCopyright );
}
// -----------------------------------------------------------------------
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 409e29c1e4..521a6c3257 100644..100755
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -27,6 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sfx2.hxx"
+
#include <tools/urlobj.hxx>
#include <vcl/msgbox.hxx>
#include <svl/eitem.hxx>
@@ -59,7 +60,8 @@
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <vcl/timer.hxx>
-#include <sfx2/dinfdlg.hxx>
+#include "sfx2/dinfdlg.hxx"
+#include "sfx2/securitypage.hxx"
#include "sfxresid.hxx"
#include "dinfedt.hxx"
#include <sfx2/frame.hxx>
@@ -1564,6 +1566,7 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( Window* pParent,
AddTabPage(TP_DOCINFODOC, SfxDocumentPage::Create, 0);
AddTabPage(TP_CUSTOMPROPERTIES, SfxCustomPropertiesPage::Create, 0);
AddTabPage(TP_DOCINFORELOAD, SfxInternetPage::Create, 0);
+ AddTabPage(TP_DOCINFOSECURITY, SfxSecurityPage::Create, 0);
}
// -----------------------------------------------------------------------
diff --git a/sfx2/source/dialog/dinfdlg.src b/sfx2/source/dialog/dinfdlg.src
index c8c7d09099..3290983c5b 100644..100755
--- a/sfx2/source/dialog/dinfdlg.src
+++ b/sfx2/source/dialog/dinfdlg.src
@@ -27,11 +27,11 @@
// include ---------------------------------------------------------------
-#include <sfx2/sfx.hrc>
+#include "sfx2/sfx.hrc"
#include "helpid.hrc"
#include "sfxlocal.hrc"
#include "dinfdlg.hrc"
-#include <dialog.hrc>
+#include "dialog.hrc"
// TP_DOCINFODESC --------------------------------------------------------
String STR_SFX_NEWOFFICEDOC
@@ -685,8 +685,6 @@ QueryBox SFX_QB_WRONG_TYPE
Message [ en-US ] = "The value entered does not match the specified type.\nThe value will be stored as text." ;
};
- // SID_DOCINFO -----------------------------------------------------------
-
TabDialog SID_DOCINFO
{
OutputSize = TRUE ;
@@ -718,6 +716,11 @@ TabDialog SID_DOCINFO
Identifier = TP_DOCINFORELOAD ;
Text [ en-US ] = "Internet" ;
};
+ PageItem
+ {
+ Identifier = TP_DOCINFOSECURITY ;
+ Text [ en-US ] = "Security" ;
+ };
};
};
};
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 3167c13ccd..0d76af8d26 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -81,11 +81,13 @@
#include <svtools/helpid.hrc>
#include <svl/pickerhelper.hxx>
#include <comphelper/docpasswordrequest.hxx>
+#include <comphelper/docpasswordhelper.hxx>
#include <ucbhelper/content.hxx>
#include <ucbhelper/commandenvironment.hxx>
#include <comphelper/storagehelper.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <sfx2/app.hxx>
+#include <sfx2/frame.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/docfac.hxx>
#include "openflag.hxx"
@@ -465,31 +467,6 @@ sal_Bool FileDialogHelper_Impl::isInOpenMode() const
// ------------------------------------------------------------------------
-namespace {
-
-bool lclCheckODFPasswordCapability( const SfxFilter* pFilter )
-{
- return pFilter && pFilter->IsOwnFormat() && pFilter->UsesStorage() && (pFilter->GetVersion() >= SOFFICE_FILEFORMAT_60);
-}
-
-bool lclCheckMSPasswordCapability( const SfxFilter* pFilter )
-{
- // TODO #i105076# this should be in the filter configuration!!!
- return pFilter && CheckMSPasswordCapabilityForExport( pFilter->GetFilterName() );
-}
-
-bool lclCheckPasswordCapability( const SfxFilter* pFilter )
-{
- return
- lclCheckODFPasswordCapability( pFilter ) ||
- // TODO #i105076# this should be in the filter configuration!!!
- lclCheckMSPasswordCapability( pFilter );
-}
-
-}
-
-// ------------------------------------------------------------------------
-
void FileDialogHelper_Impl::updateFilterOptionsBox()
{
if ( !m_bHaveFilterOptions )
@@ -546,10 +523,30 @@ void FileDialogHelper_Impl::updateSelectionBox()
if ( !mbHasSelectionBox )
return;
- const SfxFilter* pFilter = getCurentSfxFilter();
- mbSelectionFltrEnabled = updateExtendedControl(
- ExtendedFilePickerElementIds::CHECKBOX_SELECTION,
- ( mbSelectionEnabled && pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_SUPPORTSSELECTION ) != 0 ) );
+ // Does the selection box exist?
+ sal_Bool bSelectionBoxFound = sal_False;
+ uno::Reference< XControlInformation > xCtrlInfo( mxFileDlg, UNO_QUERY );
+ if ( xCtrlInfo.is() )
+ {
+ Sequence< ::rtl::OUString > aCtrlList = xCtrlInfo->getSupportedControls();
+ sal_uInt32 nCount = aCtrlList.getLength();
+ for ( sal_uInt32 nCtrl = 0; nCtrl < nCount; ++nCtrl )
+ if ( aCtrlList[ nCtrl ].equalsAscii("SelectionBox") )
+ {
+ bSelectionBoxFound = sal_False;
+ break;
+ }
+ }
+
+ if ( bSelectionBoxFound )
+ {
+ const SfxFilter* pFilter = getCurentSfxFilter();
+ mbSelectionFltrEnabled = updateExtendedControl(
+ ExtendedFilePickerElementIds::CHECKBOX_SELECTION,
+ ( mbSelectionEnabled && pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_SUPPORTSSELECTION ) != 0 ) );
+ uno::Reference< XFilePickerControlAccess > xCtrlAccess( mxFileDlg, UNO_QUERY );
+ xCtrlAccess->setValue( ExtendedFilePickerElementIds::CHECKBOX_SELECTION, 0, makeAny( (sal_Bool)mbSelection ) );
+ }
}
// ------------------------------------------------------------------------
@@ -560,9 +557,10 @@ void FileDialogHelper_Impl::enablePasswordBox( sal_Bool bInit )
sal_Bool bWasEnabled = mbIsPwdEnabled;
+ const SfxFilter* pCurrentFilter = getCurentSfxFilter();
mbIsPwdEnabled = updateExtendedControl(
ExtendedFilePickerElementIds::CHECKBOX_PASSWORD,
- lclCheckPasswordCapability( getCurentSfxFilter() )
+ pCurrentFilter && ( pCurrentFilter->GetFilterFlags() & SFX_FILTER_ENCRYPTION )
);
if( bInit )
@@ -1534,6 +1532,10 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
{
SFX_ITEMSET_ARG( rpSet, pPassItem, SfxStringItem, SID_PASSWORD, FALSE );
mbPwdCheckBoxState = ( pPassItem != NULL );
+
+ // in case the document has password to modify, the dialog should be shown
+ SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUnoAnyItem, SID_MODIFYPASSWORDINFO, FALSE );
+ mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue().hasValue() );
}
SFX_ITEMSET_ARG( rpSet, pSelectItem, SfxBoolItem, SID_SELECTION, FALSE );
@@ -1544,6 +1546,9 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
// the password will be set in case user decide so
rpSet->ClearItem( SID_PASSWORD );
+ rpSet->ClearItem( SID_RECOMMENDREADONLY );
+ rpSet->ClearItem( SID_MODIFYPASSWORDINFO );
+
}
if ( mbHasPassword && !mbPwdCheckBoxState )
@@ -1620,13 +1625,15 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
// set the filter
getRealFilter( rFilter );
+ const SfxFilter* pCurrentFilter = getCurentSfxFilter();
+
// fill the rpURLList
- implGetAndCacheFiles(mxFileDlg, rpURLList, getCurentSfxFilter());
+ implGetAndCacheFiles( mxFileDlg, rpURLList, pCurrentFilter );
if ( rpURLList == NULL || rpURLList->GetObject(0) == NULL )
return ERRCODE_ABORT;
// check, wether or not we have to display a password box
- if ( mbHasPassword && mbIsPwdEnabled && xCtrlAccess.is() )
+ if ( pCurrentFilter && mbHasPassword && mbIsPwdEnabled && xCtrlAccess.is() )
{
try
{
@@ -1640,18 +1647,38 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
if( xInteractionHandler.is() )
{
// TODO: need a save way to distinguish MS filters from other filters
- bool bMSType = CheckMSPasswordCapabilityForExport( rFilter );
+ // for now MS-filters are the only alien filters that support encryption
+ sal_Bool bMSType = !pCurrentFilter->IsOwnFormat();
::comphelper::DocPasswordRequestType eType = bMSType ?
::comphelper::DocPasswordRequestType_MS :
::comphelper::DocPasswordRequestType_STANDARD;
- ::comphelper::DocPasswordRequest* pPasswordRequest = new ::comphelper::DocPasswordRequest(
- eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) );
+ ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), ( pCurrentFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ) != 0 ) );
- uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest );
+ uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest.get() );
xInteractionHandler->handle( rRequest );
if ( pPasswordRequest->isPassword() )
- rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) );
+ {
+ if ( pPasswordRequest->getPassword().getLength() )
+ rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) );
+
+ if ( pPasswordRequest->getRecommendReadOnly() )
+ rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) );
+
+ if ( bMSType )
+ {
+ // the empty password has 0 as Hash
+ sal_Int32 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pCurrentFilter->GetServiceName() ) );
+ if ( nHash )
+ rpSet->Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, uno::makeAny( nHash ) ) );
+ }
+ else
+ {
+ uno::Sequence< beans::PropertyValue > aModifyPasswordInfo = ::comphelper::DocPasswordHelper::GenerateNewModifyPasswordInfo( pPasswordRequest->getPasswordToModify() );
+ if ( aModifyPasswordInfo.getLength() )
+ rpSet->Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, uno::makeAny( aModifyPasswordInfo ) ) );
+ }
+ }
else
return ERRCODE_ABORT;
}
diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk
index 3d0c53cdb9..4c56cd683e 100644..100755
--- a/sfx2/source/dialog/makefile.mk
+++ b/sfx2/source/dialog/makefile.mk
@@ -69,6 +69,7 @@ SLOFILES =\
$(SLO)$/tplcitem.obj \
$(SLO)$/tplpitem.obj \
$(SLO)$/versdlg.obj \
+ $(SLO)$/securitypage.obj \
$(SLO)$/titledockwin.obj
SRS1NAME=$(TARGET)
@@ -87,6 +88,7 @@ SRC1FILES =\
versdlg.src \
printopt.src \
srchdlg.src \
+ securitypage.src \
titledockwin.src \
taskpane.src
diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx
new file mode 100755
index 0000000000..5577170c90
--- /dev/null
+++ b/sfx2/source/dialog/securitypage.cxx
@@ -0,0 +1,523 @@
+/*************************************************************************
+ *
+ * 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 "sfx2/securitypage.hxx"
+
+#include "securitypage.hrc"
+#include "sfxresid.hxx"
+
+#include <sfx2/sfx.hrc>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/passwd.hxx>
+
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/eitem.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/intitem.hxx>
+#include <svl/PasswordHelper.hxx>
+#include <svtools/xwindowitem.hxx>
+
+
+using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////
+
+
+namespace
+{
+ enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC };
+ enum RedlineFunc { RF_ON, RF_PROTECT };
+
+/*
+ bool QueryIsEnabled( USHORT _nSlot )
+ {
+ bool bRes = false;
+ SfxViewShell* pViewSh = SfxViewShell::Current();
+ if (pViewSh)
+ {
+ const SfxPoolItem* pItem;
+ SfxDispatcher* pDisp = pViewSh->GetDispatcher();
+ SfxItemState eState = pDisp->QueryState( _nSlot, pItem );
+ bRes = (eState & SFX_ITEM_DISABLED) == 0;
+ }
+ return bRes;
+ }
+*/
+
+ bool QueryState( USHORT _nSlot, bool& _rValue )
+ {
+ bool bRet = false;
+ SfxViewShell* pViewSh = SfxViewShell::Current();
+ if (pViewSh)
+ {
+ const SfxPoolItem* pItem;
+ SfxDispatcher* pDisp = pViewSh->GetDispatcher();
+ SfxItemState nState = pDisp->QueryState( _nSlot, pItem );
+ bRet = SFX_ITEM_AVAILABLE <= nState;
+ if (bRet)
+ _rValue = ( static_cast< const SfxBoolItem* >( pItem ) )->GetValue();
+ }
+ return bRet;
+ }
+
+
+ bool QueryRecordChangesProtectionState( RedliningMode _eMode, bool& _rValue )
+ {
+ bool bRet = false;
+ if (_eMode != RL_NONE)
+ {
+ USHORT nSlot = _eMode == RL_WRITER ? FN_REDLINE_PROTECT : SID_CHG_PROTECT;
+ bRet = QueryState( nSlot, _rValue );
+ }
+ return bRet;
+ }
+
+
+ bool QueryRecordChangesState( RedliningMode _eMode, bool& _rValue )
+ {
+ bool bRet = false;
+ if (_eMode != RL_NONE)
+ {
+ USHORT nSlot = _eMode == RL_WRITER ? FN_REDLINE_ON : FID_CHG_RECORD;
+ bRet = QueryState( nSlot, _rValue );
+ }
+ return bRet;
+ }
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+
+static short lcl_GetPassword(
+ Window *pParent,
+ bool bProtect,
+ /*out*/String &rPassword )
+{
+ bool bRes = false;
+ SfxPasswordDialog aPasswdDlg( pParent );
+ const String aTitle( SfxResId( bProtect ? RID_SFX_PROTECT_RECORDS : RID_SFX_UNPROTECT_RECORDS ) );
+ aPasswdDlg.SetText( aTitle );
+ aPasswdDlg.SetMinLen( 1 );
+ if (bProtect)
+ aPasswdDlg.ShowExtras( SHOWEXTRAS_CONFIRM );
+ if (RET_OK == aPasswdDlg.Execute() && aPasswdDlg.GetPassword().Len() > 0)
+ {
+ rPassword = aPasswdDlg.GetPassword();
+ bRes = true;
+ }
+ return bRes;
+}
+
+
+static bool lcl_IsPasswordCorrect( const String &rPassword )
+{
+ bool bRes = false;
+
+ SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
+ uno::Sequence< sal_Int8 > aPasswordHash;
+ pCurDocShell->GetProtectionHash( aPasswordHash );
+
+ // check if supplied password was correct
+ uno::Sequence< sal_Int8 > aNewPasswd( aPasswordHash );
+ SvPasswordHelper::GetHashPassword( aNewPasswd, rPassword );
+ if (SvPasswordHelper::CompareHashPassword( aPasswordHash, rPassword ))
+ bRes = true; // password was correct
+ else
+ InfoBox( NULL, String( SfxResId( RID_SFX_INCORRECT_PASSWORD ) ) ).Execute();
+
+ return bRes;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+
+struct SfxSecurityPage_Impl
+{
+ SfxSecurityPage & m_rMyTabPage;
+
+ FixedLine m_aNewPasswordToOpenFL;
+ FixedText m_aNewPasswordToOpenFT;
+ Edit m_aNewPasswordToOpenED;
+ FixedText m_aConfirmPasswordToOpenFT;
+ Edit m_aConfirmPasswordToOpenED;
+ FixedText m_aNewPasswordInfoFT;
+
+ FixedLine m_aNewPasswordToModifyFL;
+ FixedText m_aNewPasswordToModifyFT;
+ Edit m_aNewPasswordToModifyED;
+ FixedText m_aConfirmPasswordToModifyFT;
+ Edit m_aConfirmPasswordToModifyED;
+
+ FixedLine m_aOptionsFL;
+ CheckBox m_aOpenReadonlyCB;
+ CheckBox m_aRecordChangesCB; // for record changes
+ PushButton m_aChangeProtectionPB; // for record changes
+ String m_aProtectSTR; // for record changes
+ String m_aUnProtectSTR; // for record changes
+ RedliningMode m_eRedlingMode; // for record changes
+
+ bool m_bOrigPasswordIsConfirmed;
+ bool m_bNewPasswordIsValid;
+ String m_aNewPassword;
+
+ String m_aEndRedliningWarning;
+ bool m_bEndRedliningWarningDone;
+
+ DECL_LINK( RecordChangesCBToggleHdl, void* );
+ DECL_LINK( ChangeProtectionPBHdl, void* );
+
+ SfxSecurityPage_Impl( SfxSecurityPage &rDlg, const SfxItemSet &rItemSet );
+ ~SfxSecurityPage_Impl();
+
+ BOOL FillItemSet_Impl( SfxItemSet & );
+ void Reset_Impl( const SfxItemSet & );
+};
+
+
+SfxSecurityPage_Impl::SfxSecurityPage_Impl( SfxSecurityPage &rTabPage, const SfxItemSet & ) :
+ m_rMyTabPage (rTabPage),
+ m_aNewPasswordToOpenFL (&rTabPage, SfxResId( PASSWORD_TO_OPEN_FL ) ),
+ m_aNewPasswordToOpenFT (&rTabPage, SfxResId( PASSWORD_TO_OPEN_FT ) ),
+ m_aNewPasswordToOpenED (&rTabPage, SfxResId( PASSWORD_TO_OPEN_ED ) ),
+ m_aConfirmPasswordToOpenFT (&rTabPage, SfxResId( CONFIRM_PASSWORD_TO_OPEN_FT ) ),
+ m_aConfirmPasswordToOpenED (&rTabPage, SfxResId( CONFIRM_PASSWORD_TO_OPEN_ED ) ),
+ m_aNewPasswordInfoFT (&rTabPage, SfxResId( PASSWORD_INFO_FT ) ),
+ m_aNewPasswordToModifyFL (&rTabPage, SfxResId( PASSWORD_TO_MODIFY_FL ) ),
+ m_aNewPasswordToModifyFT (&rTabPage, SfxResId( PASSWORD_TO_MODIFY_FT ) ),
+ m_aNewPasswordToModifyED (&rTabPage, SfxResId( PASSWORD_TO_MODIFY_ED ) ),
+ m_aConfirmPasswordToModifyFT (&rTabPage, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_FT ) ),
+ m_aConfirmPasswordToModifyED (&rTabPage, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_ED ) ),
+ m_aOptionsFL (&rTabPage, SfxResId( OPTIONS_FL ) ),
+ m_aOpenReadonlyCB (&rTabPage, SfxResId( OPEN_READONLY_CB ) ),
+ m_aRecordChangesCB (&rTabPage, SfxResId( RECORD_CHANGES_CB ) ),
+ m_aChangeProtectionPB (&rTabPage, SfxResId( CHANGE_PROTECTION_PB ) ),
+ m_aProtectSTR ( SfxResId( STR_PROTECT ) ),
+ m_aUnProtectSTR ( SfxResId( STR_UNPROTECT ) ),
+ m_eRedlingMode ( RL_NONE ),
+ m_bOrigPasswordIsConfirmed ( false ),
+ m_bNewPasswordIsValid ( false ),
+ m_aEndRedliningWarning ( SfxResId( STR_END_REDLINING_WARNING ) ),
+ m_bEndRedliningWarningDone ( false )
+{
+ m_aChangeProtectionPB.SetText( m_aProtectSTR );
+ // adjust button width if necessary
+ long nBtnTextWidth = 0;
+ long nTemp = m_aChangeProtectionPB.GetCtrlTextWidth( m_aChangeProtectionPB.GetText() );
+ if (nTemp > nBtnTextWidth)
+ nBtnTextWidth = nTemp;
+
+ // force toggle hdl called before visual change of checkbox
+ m_aRecordChangesCB.SetStyle( m_aRecordChangesCB.GetStyle() | WB_EARLYTOGGLE );
+ m_aRecordChangesCB.SetToggleHdl( LINK( this, SfxSecurityPage_Impl, RecordChangesCBToggleHdl ) );
+ m_aChangeProtectionPB.SetClickHdl( LINK( this, SfxSecurityPage_Impl, ChangeProtectionPBHdl ) );
+}
+
+
+SfxSecurityPage_Impl::~SfxSecurityPage_Impl()
+{
+}
+
+
+BOOL SfxSecurityPage_Impl::FillItemSet_Impl( SfxItemSet & )
+{
+ bool bModified = false;
+
+ SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
+ if (pCurDocShell&& !pCurDocShell->IsReadOnly())
+ {
+ if (m_eRedlingMode != RL_NONE )
+ {
+ const bool bDoRecordChanges = m_aRecordChangesCB.IsChecked();
+ const bool bDoChangeProtection = m_aChangeProtectionPB.GetText() != m_aProtectSTR;
+
+ // sanity checks
+ DBG_ASSERT( bDoRecordChanges || !bDoChangeProtection, "no change recording should imply no change protection" );
+ DBG_ASSERT( bDoChangeProtection || !bDoRecordChanges, "no change protection should imply no change recording" );
+ DBG_ASSERT( !bDoChangeProtection || m_aNewPassword.Len() > 0, "change protection should imply password length is > 0" );
+ DBG_ASSERT( bDoChangeProtection || m_aNewPassword.Len() == 0, "no change protection should imply password length is 0" );
+
+ // change recording
+ if (bDoRecordChanges != pCurDocShell->IsChangeRecording())
+ {
+ pCurDocShell->SetChangeRecording( bDoRecordChanges );
+ bModified = true;
+ }
+
+ // change record protection
+ if (m_bNewPasswordIsValid &&
+ bDoChangeProtection != pCurDocShell->HasChangeRecordProtection())
+ {
+ DBG_ASSERT( !bDoChangeProtection || bDoRecordChanges,
+ "change protection requires record changes to be active!" );
+ pCurDocShell->SetProtectionPassword( m_aNewPassword );
+ bModified = true;
+ }
+ }
+
+ // open read-only?
+ const sal_Bool bDoOpenReadonly = m_aOpenReadonlyCB.IsChecked();
+ if (pCurDocShell->HasSecurityOptOpenReadOnly() &&
+ bDoOpenReadonly != pCurDocShell->IsSecurityOptOpenReadOnly())
+ {
+ pCurDocShell->SetSecurityOptOpenReadOnly( bDoOpenReadonly );
+ bModified = true;
+ }
+ }
+
+ return bModified;
+}
+
+
+void SfxSecurityPage_Impl::Reset_Impl( const SfxItemSet & )
+{
+ SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
+
+ String sNewText = m_aProtectSTR;
+ if (!pCurDocShell)
+ {
+ // no doc -> hide document settings
+ m_aOpenReadonlyCB.Disable();
+ m_aRecordChangesCB.Disable();
+ m_aChangeProtectionPB.Disable();
+ }
+ else
+ {
+ bool bIsHTMLDoc = false;
+ SfxViewShell* pViewSh = SfxViewShell::Current();
+ if (pViewSh)
+ {
+ const SfxPoolItem* pItem;
+ SfxDispatcher* pDisp = pViewSh->GetDispatcher();
+ if (SFX_ITEM_AVAILABLE <= pDisp->QueryState( SID_HTML_MODE, pItem ))
+ {
+ USHORT nMode = static_cast< const SfxUInt16Item* >( pItem )->GetValue();
+ bIsHTMLDoc = ( ( nMode & HTMLMODE_ON ) != 0 );
+ }
+ }
+
+ sal_Bool bIsReadonly = pCurDocShell->IsReadOnly();
+ if (pCurDocShell->HasSecurityOptOpenReadOnly() && !bIsHTMLDoc)
+ {
+ m_aOpenReadonlyCB.Check( pCurDocShell->IsSecurityOptOpenReadOnly() );
+ m_aOpenReadonlyCB.Enable( !bIsReadonly );
+ }
+ else
+ m_aOpenReadonlyCB.Disable();
+
+ bool bRecordChanges;
+ if (QueryRecordChangesState( RL_WRITER, bRecordChanges ) && !bIsHTMLDoc)
+ m_eRedlingMode = RL_WRITER;
+ else if (QueryRecordChangesState( RL_CALC, bRecordChanges ))
+ m_eRedlingMode = RL_CALC;
+ else
+ m_eRedlingMode = RL_NONE;
+
+ if (m_eRedlingMode != RL_NONE)
+ {
+ bool bProtection;
+ QueryRecordChangesProtectionState( m_eRedlingMode, bProtection );
+
+ m_aChangeProtectionPB.Enable( !bIsReadonly );
+ // set the right text
+ if (bProtection)
+ sNewText = m_aUnProtectSTR;
+
+ m_aRecordChangesCB.Check( bRecordChanges );
+ m_aRecordChangesCB.Enable( /*!bProtection && */!bIsReadonly );
+
+ m_bOrigPasswordIsConfirmed = true; // default case if no password is set
+ uno::Sequence< sal_Int8 > aPasswordHash;
+ // check if password is available
+ if (pCurDocShell->GetProtectionHash( aPasswordHash ) &&
+ aPasswordHash.getLength() > 0)
+ m_bOrigPasswordIsConfirmed = false; // password found, needs to be confirmed later on
+ }
+ else
+ {
+ // A Calc document that is shared will have 'm_eRedlingMode == RL_NONE'
+ // In shared documents change recording and protection must be disabled,
+ // similar to documents that do not support change recording at all.
+ m_aRecordChangesCB.Check( FALSE );
+ m_aRecordChangesCB.Disable();
+ m_aChangeProtectionPB.Check( FALSE );
+ m_aChangeProtectionPB.Disable();
+ }
+ }
+
+ m_aChangeProtectionPB.SetText( sNewText );
+}
+
+
+IMPL_LINK( SfxSecurityPage_Impl, RecordChangesCBToggleHdl, void*, EMPTYARG )
+{
+ // when change recording gets disabled protection must be disabled as well
+ if (!m_aRecordChangesCB.IsChecked()) // the new check state is already present, thus the '!'
+ {
+ bool bAlreadyDone = false;
+ if (!m_bEndRedliningWarningDone)
+ {
+ WarningBox aBox( m_rMyTabPage.GetParent(), WinBits(WB_YES_NO | WB_DEF_NO),
+ m_aEndRedliningWarning );
+ if (aBox.Execute() != RET_YES)
+ bAlreadyDone = true;
+ else
+ m_bEndRedliningWarningDone = true;
+ }
+
+ const bool bNeedPasssword = !m_bOrigPasswordIsConfirmed
+ && m_aChangeProtectionPB.GetText() != m_aProtectSTR;
+ if (!bAlreadyDone && bNeedPasssword)
+ {
+ String aPasswordText;
+
+ // dialog canceled or no password provided
+ if (!lcl_GetPassword( m_rMyTabPage.GetParent(), false, aPasswordText ))
+ bAlreadyDone = true;
+
+ // ask for password and if dialog is canceled or no password provided return
+ if (lcl_IsPasswordCorrect( aPasswordText ))
+ m_bOrigPasswordIsConfirmed = true;
+ else
+ bAlreadyDone = true;
+ }
+
+ if (bAlreadyDone)
+ m_aRecordChangesCB.Check( true ); // restore original state
+ else
+ {
+ // remember required values to change protection and change recording in
+ // FillItemSet_Impl later on if password was correct.
+ m_bNewPasswordIsValid = true;
+ m_aNewPassword = String();
+
+ m_aChangeProtectionPB.SetText( m_aProtectSTR );
+ }
+ }
+
+ return 0;
+}
+
+
+IMPL_LINK( SfxSecurityPage_Impl, ChangeProtectionPBHdl, void*, EMPTYARG )
+{
+ if (m_eRedlingMode == RL_NONE)
+ return 0;
+
+ // the push button text is always the opposite of the current state. Thus:
+ const bool bCurrentProtection = m_aChangeProtectionPB.GetText() != m_aProtectSTR;
+
+ // ask user for password (if still necessary)
+ String aPasswordText;
+ bool bNewProtection = !bCurrentProtection;
+ const bool bNeedPassword = bNewProtection || !m_bOrigPasswordIsConfirmed;
+ if (bNeedPassword)
+ {
+ // ask for password and if dialog is canceled or no password provided return
+ if (!lcl_GetPassword( m_rMyTabPage.GetParent(), bNewProtection, aPasswordText ))
+ return 0;
+
+ // provided password still needs to be checked?
+ if (!bNewProtection && !m_bOrigPasswordIsConfirmed)
+ {
+ if (lcl_IsPasswordCorrect( aPasswordText ))
+ m_bOrigPasswordIsConfirmed = true;
+ else
+ return 0;
+ }
+ }
+ DBG_ASSERT( m_bOrigPasswordIsConfirmed, "ooops... this should not have happened!" );
+
+ // remember required values to change protection and change recording in
+ // FillItemSet_Impl later on if password was correct.
+ m_bNewPasswordIsValid = true;
+ m_aNewPassword = bNewProtection? aPasswordText : String();
+
+// // RecordChangesCB is enabled if protection is off
+// m_aRecordChangesCB.Enable( !bNewProtection );
+ m_aRecordChangesCB.Check( bNewProtection );
+ // toggle text of button "Protect" <-> "Unprotect"
+ m_aChangeProtectionPB.SetText( bNewProtection ? m_aUnProtectSTR : m_aProtectSTR );
+
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+
+SfxTabPage* SfxSecurityPage::Create( Window * pParent, const SfxItemSet & rItemSet )
+{
+ return new SfxSecurityPage( pParent, rItemSet );
+}
+
+
+SfxSecurityPage::SfxSecurityPage( Window* pParent, const SfxItemSet& rItemSet ) :
+ SfxTabPage( pParent, SfxResId( TP_DOCINFOSECURITY ), rItemSet )
+{
+ m_pImpl = std::auto_ptr< SfxSecurityPage_Impl >(new SfxSecurityPage_Impl( *this, rItemSet ));
+
+ FreeResource();
+}
+
+
+SfxSecurityPage::~SfxSecurityPage()
+{
+}
+
+
+BOOL SfxSecurityPage::FillItemSet( SfxItemSet & rItemSet )
+{
+ bool bModified = false;
+ DBG_ASSERT( m_pImpl.get(), "implementation pointer is 0. Still in c-tor?" );
+ if (m_pImpl.get() != 0)
+ bModified = m_pImpl->FillItemSet_Impl( rItemSet );
+ return bModified;
+}
+
+
+void SfxSecurityPage::Reset( const SfxItemSet & rItemSet )
+{
+ DBG_ASSERT( m_pImpl.get(), "implementation pointer is 0. Still in c-tor?" );
+ if (m_pImpl.get() != 0)
+ m_pImpl->Reset_Impl( rItemSet );
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+
diff --git a/sfx2/source/dialog/securitypage.hrc b/sfx2/source/dialog/securitypage.hrc
new file mode 100755
index 0000000000..4890b8e54a
--- /dev/null
+++ b/sfx2/source/dialog/securitypage.hrc
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * 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 _SECURITYPAGE_HRC_
+#define _SECURITYPAGE_HRC_
+
+
+#define PASSWORD_TO_OPEN_FL 1
+#define PASSWORD_TO_OPEN_FT 2
+#define PASSWORD_TO_OPEN_ED 3
+#define CONFIRM_PASSWORD_TO_OPEN_FT 4
+#define CONFIRM_PASSWORD_TO_OPEN_ED 5
+#define PASSWORD_INFO_FT 6
+#define PASSWORD_TO_MODIFY_FL 7
+#define PASSWORD_TO_MODIFY_FT 8
+#define PASSWORD_TO_MODIFY_ED 9
+#define CONFIRM_PASSWORD_TO_MODIFY_FT 10
+#define CONFIRM_PASSWORD_TO_MODIFY_ED 11
+#define OPTIONS_FL 12
+#define OPEN_READONLY_CB 13
+#define RECORD_CHANGES_CB 14
+#define CHANGE_PROTECTION_PB 15
+
+#define STR_PROTECT 101
+#define STR_UNPROTECT 102
+#define STR_END_REDLINING_WARNING 103
+
+#endif
+
diff --git a/sfx2/source/dialog/securitypage.src b/sfx2/source/dialog/securitypage.src
new file mode 100755
index 0000000000..4818068990
--- /dev/null
+++ b/sfx2/source/dialog/securitypage.src
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "sfx2/sfx.hrc"
+#include "securitypage.hrc"
+#include "helpid.hrc"
+#include "dialog.hrc"
+#include "sfxlocal.hrc"
+
+#include <svtools/controldims.hrc>
+
+
+TabPage TP_DOCINFOSECURITY
+{
+ HelpId = HID_DOCINFOSECURITY ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+
+ FixedLine PASSWORD_TO_OPEN_FL
+ {
+ Pos = MAP_APPFONT( 6, 6 );
+ Size = MAP_APPFONT( 248, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "File encryption password";
+ };
+ FixedText PASSWORD_TO_OPEN_FT
+ {
+ Pos = MAP_APPFONT( 12, 20 );
+ Size = MAP_APPFONT( 82, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "~Enter password to open";
+ };
+ Edit PASSWORD_TO_OPEN_ED
+ {
+ HelpId = HID_SECURITYTAB_PASSWORD_TO_OPEN;
+ Pos = MAP_APPFONT( 100, 18 );
+ Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ PassWord = TRUE;
+ };
+ FixedText CONFIRM_PASSWORD_TO_OPEN_FT
+ {
+ Pos = MAP_APPFONT( 12, 34 );
+ Size = MAP_APPFONT( 82, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "~Reenter password to open";
+ };
+ Edit CONFIRM_PASSWORD_TO_OPEN_ED
+ {
+ HelpId = HID_SECURITYTAB_CONFIRM_PASSWORD_TO_OPEN;
+ Pos = MAP_APPFONT( 100, 32 );
+ Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ PassWord = TRUE;
+ };
+ FixedText PASSWORD_INFO_FT
+ {
+ Pos = MAP_APPFONT( 12, 48 );
+ Size = MAP_APPFONT( 236, 3 * RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] =
+ "Note: After a password has been set, the document will only open "\
+ "with the password. Should you lose the password, there will be "\
+ "no way to recover the document. Please also note that this password "\
+ "is case-sensitive.";
+ WordBreak = TRUE;
+ };
+ FixedLine PASSWORD_TO_MODIFY_FL
+ {
+ Pos = MAP_APPFONT( 6, 78 );
+ Size = MAP_APPFONT( 248, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "File sharing password";
+ };
+ FixedText PASSWORD_TO_MODIFY_FT
+ {
+ Pos = MAP_APPFONT( 12, 92 );
+ Size = MAP_APPFONT( 82, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Enter password to modify";
+ };
+ Edit PASSWORD_TO_MODIFY_ED
+ {
+ HelpId = HID_SECURITYTAB_PASSWORD_TO_MODIFY;
+ Pos = MAP_APPFONT( 100, 90 );
+ Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ PassWord = TRUE;
+ };
+ FixedText CONFIRM_PASSWORD_TO_MODIFY_FT
+ {
+ Pos = MAP_APPFONT( 12, 106 );
+ Size = MAP_APPFONT( 82, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Reenter password to modify";
+ };
+ Edit CONFIRM_PASSWORD_TO_MODIFY_ED
+ {
+ HelpId = HID_SECURITYTAB_CONFIRM_PASSWORD_TO_MODIFY;
+ Pos = MAP_APPFONT( 100, 104 );
+ Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ PassWord = TRUE;
+ };
+ FixedLine OPTIONS_FL
+ {
+ Pos = MAP_APPFONT( 6, 120 );
+ Size = MAP_APPFONT( 248, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "File sharing options";
+ };
+ CheckBox OPEN_READONLY_CB
+ {
+ HelpId = HID_SECURITYTAB_OPEN_FILE_READONLY;
+ Pos = MAP_APPFONT( 12, 133 );
+ Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Open file read-only";
+ };
+ CheckBox RECORD_CHANGES_CB
+ {
+ HelpId = HID_SECURITYTAB_RECORD_CHANGES;
+ Pos = MAP_APPFONT( 12, 147 );
+ Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Record ~changes";
+ };
+ PushButton CHANGE_PROTECTION_PB
+ {
+ HelpId = HID_SECURITYTAB_PROTECTION;
+ Pos = MAP_APPFONT( 194, 145 );
+ Size = MAP_APPFONT( 60, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+ String STR_PROTECT
+ {
+ Text [ en-US ] = "~Protect...";
+ };
+ String STR_UNPROTECT
+ {
+ Text [ en-US ] = "~Unprotect...";
+ };
+ String STR_END_REDLINING_WARNING
+ {
+ Text [ en-US ] = "This action will exit the change recording mode.\nAny information about changes will be lost.\n\nExit change recording mode?\n\n" ;
+ };
+};
+
+String RID_SFX_PROTECT_RECORDS
+{
+ Text [ en-US ] = "Protect Records" ;
+};
+String RID_SFX_UNPROTECT_RECORDS
+{
+ Text [ en-US ] = "Unprotect Records" ;
+};
+String RID_SFX_INCORRECT_PASSWORD
+{
+ Text [ en-US ] = "Incorrect password" ;
+};
+
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index b5f0358d29..43d98d1c04 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -115,6 +115,7 @@ using namespace ::com::sun::star::io;
#include <comphelper/storagehelper.hxx>
#include <comphelper/mediadescriptor.hxx>
#include <comphelper/configurationhelper.hxx>
+#include <comphelper/docpasswordhelper.hxx>
#include <tools/urlobj.hxx>
#include <tools/inetmime.hxx>
#include <unotools/ucblockbytes.hxx>
@@ -2558,18 +2559,72 @@ void SfxMedium::SetFilter( const SfxFilter* pFilterP, sal_Bool /*bResetOrig*/ )
pFilter = pFilterP;
pImp->nFileVersion = 0;
}
+
//----------------------------------------------------------------
const SfxFilter* SfxMedium::GetOrigFilter( sal_Bool bNotCurrent ) const
{
return ( pImp->pOrigFilter || bNotCurrent ) ? pImp->pOrigFilter : pFilter;
}
+
//----------------------------------------------------------------
void SfxMedium::SetOrigFilter_Impl( const SfxFilter* pOrigFilter )
{
pImp->pOrigFilter = pOrigFilter;
}
+
+//------------------------------------------------------------------
+
+sal_uInt32 SfxMedium::CreatePasswordToModifyHash( const ::rtl::OUString& aPasswd, sal_Bool bWriter )
+{
+ sal_uInt32 nHash = 0;
+
+ if ( aPasswd.getLength() )
+ {
+ if ( bWriter )
+ {
+ nHash = ::comphelper::DocPasswordHelper::GetWordHashAsUINT32( aPasswd );
+ }
+ else
+ {
+ rtl_TextEncoding nEncoding = RTL_TEXTENCODING_UTF8;
+
+ // if the MS-filter should be used
+ // use the inconsistent algorithm to find the encoding specified by MS
+ nEncoding = osl_getThreadTextEncoding();
+ switch( nEncoding )
+ {
+ case RTL_TEXTENCODING_ISO_8859_15:
+ case RTL_TEXTENCODING_MS_874:
+ case RTL_TEXTENCODING_MS_1250:
+ case RTL_TEXTENCODING_MS_1251:
+ case RTL_TEXTENCODING_MS_1252:
+ case RTL_TEXTENCODING_MS_1253:
+ case RTL_TEXTENCODING_MS_1254:
+ case RTL_TEXTENCODING_MS_1255:
+ case RTL_TEXTENCODING_MS_1256:
+ case RTL_TEXTENCODING_MS_1257:
+ case RTL_TEXTENCODING_MS_1258:
+ case RTL_TEXTENCODING_SHIFT_JIS:
+ case RTL_TEXTENCODING_GB_2312:
+ case RTL_TEXTENCODING_BIG5:
+ // in case the system uses an encoding from the list above, it should be used
+ break;
+
+ default:
+ // in case other encoding is used, use one of the encodings from the list
+ nEncoding = RTL_TEXTENCODING_MS_1250;
+ break;
+ }
+
+ nHash = ::comphelper::DocPasswordHelper::GetXLHashAsUINT16( aPasswd, nEncoding );
+ }
+ }
+
+ return nHash;
+}
+
//------------------------------------------------------------------
void SfxMedium::Close()
diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx
index b4ae994786..202140a15b 100644
--- a/sfx2/source/doc/docfilt.cxx
+++ b/sfx2/source/doc/docfilt.cxx
@@ -49,20 +49,6 @@
using namespace ::com::sun::star;
-namespace sfx2 {
-
-// TODO #i105076# this should be in the filter configuration!!!
-bool CheckMSPasswordCapabilityForExport( const String& rFilterName )
-{
- return
- rFilterName.EqualsAscii( "MS Word 97" ) ||
- rFilterName.EqualsAscii( "MS Word 97 Vorlage" ) ||
- rFilterName.EqualsAscii( "MS Excel 97" ) ||
- rFilterName.EqualsAscii( "MS Excel 97 Vorlage/Template" );
-}
-
-} // namespace sfx2
-
// STATIC DATA -----------------------------------------------------------
DBG_NAME(SfxFilter)
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 1f0e56cbfc..1e0093ea22 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -62,6 +62,9 @@
#include <unotools/pathoptions.hxx>
#include <unotools/pathoptions.hxx>
#include <svl/itemset.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
#include <unotools/useroptions.hxx>
#include <unotools/saveopt.hxx>
#include <tools/debug.hxx>
@@ -80,6 +83,7 @@
#include <sfx2/app.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/dinfdlg.hxx>
+#include <sfx2/request.hxx>
#include <sfxtypes.hxx>
#include "alienwarn.hxx"
@@ -108,6 +112,7 @@ const ::rtl::OUString aFilterFlagsString = ::rtl::OUString::createFromAscii( "
using namespace ::com::sun::star;
+namespace {
//-------------------------------------------------------------------------
static sal_uInt16 getSlotIDFromMode( sal_Int8 nStoreMode )
{
@@ -168,6 +173,69 @@ static sal_Int32 getDontFlags( sal_Int8 nStoreMode )
}
//=========================================================================
+// class DocumentSettingsGuard
+//=========================================================================
+
+class DocumentSettingsGuard
+{
+ uno::Reference< beans::XPropertySet > m_xDocumentSettings;
+ sal_Bool m_bPreserveReadOnly;
+ sal_Bool m_bReadOnlySupported;
+
+ sal_Bool m_bRestoreSettings;
+public:
+ DocumentSettingsGuard( const uno::Reference< frame::XModel >& xModel, sal_Bool bReadOnly, sal_Bool bRestore )
+ : m_bPreserveReadOnly( sal_False )
+ , m_bReadOnlySupported( sal_False )
+ , m_bRestoreSettings( bRestore )
+ {
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xDocSettingsSupplier( xModel, uno::UNO_QUERY_THROW );
+ m_xDocumentSettings.set(
+ xDocSettingsSupplier->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ ::rtl::OUString aLoadReadonlyString( RTL_CONSTASCII_USTRINGPARAM( "LoadReadonly" ) );
+
+ try
+ {
+ m_xDocumentSettings->getPropertyValue( aLoadReadonlyString ) >>= m_bPreserveReadOnly;
+ m_xDocumentSettings->setPropertyValue( aLoadReadonlyString, uno::makeAny( bReadOnly ) );
+ m_bReadOnlySupported = sal_True;
+ }
+ catch( uno::Exception& )
+ {}
+ }
+ catch( uno::Exception& )
+ {}
+
+ if ( ( bReadOnly && !m_bReadOnlySupported ) )
+ throw uno::RuntimeException(); // the user could provide the data, so it must be stored
+ }
+
+ ~DocumentSettingsGuard()
+ {
+ if ( m_bRestoreSettings )
+ {
+ ::rtl::OUString aLoadReadonlyString( RTL_CONSTASCII_USTRINGPARAM( "LoadReadonly" ) );
+
+ try
+ {
+ if ( m_bReadOnlySupported )
+ m_xDocumentSettings->setPropertyValue( aLoadReadonlyString, uno::makeAny( m_bPreserveReadOnly ) );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_ASSERT( "Unexpected exception!" );
+ }
+ }
+ }
+};
+} // anonymous namespace
+
+//=========================================================================
// class ModelData_Impl
//=========================================================================
class ModelData_Impl
@@ -184,6 +252,8 @@ class ModelData_Impl
::comphelper::SequenceAsHashMap m_aMediaDescrHM;
+ sal_Bool m_bRecommendReadOnly;
+
public:
ModelData_Impl( SfxStoringHelper& aOwner,
const uno::Reference< frame::XModel >& xModel,
@@ -200,6 +270,8 @@ public:
::comphelper::SequenceAsHashMap& GetMediaDescr() { return m_aMediaDescrHM; }
+ sal_Bool IsRecommendReadOnly() { return m_bRecommendReadOnly; }
+
const ::comphelper::SequenceAsHashMap& GetDocProps();
::rtl::OUString GetModuleName();
@@ -252,6 +324,7 @@ ModelData_Impl::ModelData_Impl( SfxStoringHelper& aOwner,
, m_pDocumentPropsHM( NULL )
, m_pModulePropsHM( NULL )
, m_aMediaDescrHM( aMediaDescr )
+, m_bRecommendReadOnly( sal_False )
{
CheckInteractionHandler();
}
@@ -922,6 +995,12 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode,
}
::rtl::OUString aFilterName = aStringTypeFN;
+
+ // the following two arguments can not be converted in MediaDescriptor,
+ // so they should be removed from the ItemSet after retrieving
+ SFX_ITEMSET_ARG( pDialogParams, pRecommendReadOnly, SfxBoolItem, SID_RECOMMENDREADONLY, sal_False );
+ m_bRecommendReadOnly = ( pRecommendReadOnly && pRecommendReadOnly->GetValue() );
+ pDialogParams->ClearItem( SID_RECOMMENDREADONLY );
uno::Sequence< beans::PropertyValue > aPropsFromDialog;
TransformItems( nSlotID, *pDialogParams, aPropsFromDialog, NULL );
@@ -1509,6 +1588,8 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >&
// store the document and handle it's docinfo
SvtSaveOptions aOptions;
+ DocumentSettingsGuard aSettingsGuard( aModelData.GetModel(), aModelData.IsRecommendReadOnly(), nStoreMode & EXPORT_REQUESTED );
+
if ( aOptions.IsDocInfoSave()
&& ( !aModelData.GetStorable()->hasLocation()
|| INetURLObject( aModelData.GetStorable()->getLocation() ) != aURL ) )
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index 301a2546c2..910bf6f5d5 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -1242,3 +1242,51 @@ void SfxObjectShell::SetSaveVersionOnClose( sal_Bool bNew )
pImp->bSaveVersionOnClose = bNew;
}
+sal_uInt32 SfxObjectShell::GetModifyPasswordHash() const
+{
+ return pImp->m_nModifyPasswordHash;
+}
+
+sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt32 nHash )
+{
+ if ( ( !IsReadOnly() && !IsReadOnlyUI() )
+ || !(pImp->nFlagsInProgress & SFX_LOADED_MAINDOCUMENT ) )
+ {
+ // the hash can be changed only in editable documents,
+ // or during loading of document
+ pImp->m_nModifyPasswordHash = nHash;
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+uno::Sequence< beans::PropertyValue > SfxObjectShell::GetModifyPasswordInfo() const
+{
+ return pImp->m_aModifyPasswordInfo;
+}
+
+sal_Bool SfxObjectShell::SetModifyPasswordInfo( const uno::Sequence< beans::PropertyValue >& aInfo )
+{
+ if ( ( !IsReadOnly() && !IsReadOnlyUI() )
+ || !(pImp->nFlagsInProgress & SFX_LOADED_MAINDOCUMENT ) )
+ {
+ // the hash can be changed only in editable documents,
+ // or during loading of document
+ pImp->m_aModifyPasswordInfo = aInfo;
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+void SfxObjectShell::SetModifyPasswordEntered( sal_Bool bEntered )
+{
+ pImp->m_bModifyPasswordEntered = bEntered;
+}
+
+sal_Bool SfxObjectShell::IsModifyPasswordEntered()
+{
+ return pImp->m_bModifyPasswordEntered;
+}
+
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index af93a1217c..5b91b31fcf 100755
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -470,6 +470,32 @@ void SfxObjectShell::SetReadOnlyUI( sal_Bool bReadOnly )
//-------------------------------------------------------------------------
+void SfxObjectShell::SetReadOnly()
+{
+ // Let the document be completely readonly, means that the
+ // medium open mode is adjusted accordingly, and the write lock
+ // on the file is removed.
+
+ if ( pMedium && !IsReadOnlyMedium() )
+ {
+ sal_Bool bWasROUI = IsReadOnly();
+
+ pMedium->UnlockFile( sal_False );
+
+ // the storage-based mediums are already based on the temporary file
+ // so UnlockFile has already closed the locking stream
+ if ( !pMedium->HasStorage_Impl() && IsLoadingFinished() )
+ pMedium->CloseInStream();
+
+ pMedium->SetOpenMode( SFX_STREAM_READONLY, pMedium->IsDirect(), sal_True );
+ pMedium->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) );
+
+ if ( !bWasROUI )
+ Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) );
+ }
+}
+//-------------------------------------------------------------------------
+
sal_Bool SfxObjectShell::IsReadOnly() const
{
return pImp->bReadOnlyUI || IsReadOnlyMedium();
@@ -1363,6 +1389,9 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags )
if( !IsAbortingImport() )
PositionView_Impl();
+ if ( ( GetModifyPasswordHash() || GetModifyPasswordInfo().getLength() ) && !IsModifyPasswordEntered() )
+ SetReadOnly();
+
// Salvage
if ( pSalvageItem )
bSetModifiedTRUE = sal_True;
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 902793af73..8d0fea6811 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -1332,7 +1332,6 @@ sal_Bool SfxObjectShell::SaveTo_Impl
{
if ( pFilt->GetServiceName() != rMedium.GetFilter()->GetServiceName() )
{
-//REMOVE rMedium.GetStorage()->SetClass( SvFactory::GetServerName( nFormat ), nFormat, pFilt->GetTypeName() );
datatransfer::DataFlavor aDataFlavor;
SotExchange::GetFormatDataFlavor( nFormat, aDataFlavor );
@@ -2049,9 +2048,6 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed )
}
else
{
-//REMOVE if( pFilter->UsesStorage() )
-//REMOVE pMedium->GetStorage();
-//REMOVE else if( pMedium->GetOpenMode() & STREAM_WRITE )
if( pMedium->GetOpenMode() & STREAM_WRITE )
pMedium->GetInStream();
xStorage = GetStorage();
@@ -2589,9 +2585,6 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
SetError(pMediumTmp->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
-//REMOVE if ( !IsHandsOff() )
-//REMOVE pMediumTmp->Close();
-
sal_Bool bOpen( sal_False );
bOpen = DoSaveCompleted( pMediumTmp );
DBG_ASSERT(bOpen,"Fehlerbehandlung fuer DoSaveCompleted nicht implementiert");
@@ -2602,13 +2595,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
SetError( pMediumTmp->GetError(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
// reconnect to object storage
-//REMOVE if ( IsHandsOff() )
-//REMOVE {
-//REMOVE if ( !DoSaveCompleted( pRetrMedium ) )
-//REMOVE DBG_ERROR("Case not handled - no way to get a storage!");
-//REMOVE }
-//REMOVE else
- DoSaveCompleted( 0 );
+ DoSaveCompleted( 0 );
if( pRetrMedium->GetItemSet() )
{
@@ -2867,8 +2854,6 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
else
pNewFile->SetFilter( GetFactory().GetFilterContainer()->GetAnyFilter( SFX_FILTER_IMPORT | SFX_FILTER_EXPORT ) );
-//REMOVE // saving is alway done using a temporary file
-//REMOVE pNewFile->CreateTempFileNoCopy();
if ( pNewFile->GetErrorCode() != ERRCODE_NONE )
{
// creating temporary file failed ( f.e. floppy disk not inserted! )
@@ -2905,18 +2890,8 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
SetError( pNewFile->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
// notify the document that saving was done successfully
-//REMOVE if ( bCopyTo )
-//REMOVE {
-//REMOVE if ( IsHandsOff() )
-//REMOVE bOk = DoSaveCompleted( pMedium );
-//REMOVE }
-//REMOVE else
if ( !bCopyTo )
{
- // Muss !!!
-//REMOVE if ( bToOwnFormat )
-//REMOVE SetFileName( pNewFile->GetPhysicalName() );
-
bOk = DoSaveCompleted( pNewFile );
}
else
@@ -2948,31 +2923,12 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
// by the storage
DELETEZ( pNewFile );
}
-
- // TODO/LATER: there is no need in the following code in case HandsOff is not used,
- // hope we will not have to introduce it back
-//REMOVE String aPasswd;
-//REMOVE if ( IsOwnStorageFormat_Impl( *GetMedium() ) && GetPasswd_Impl( GetMedium()->GetItemSet(), aPasswd ) )
-//REMOVE {
-//REMOVE try
-//REMOVE {
-//REMOVE // the following code must throw an exception in case of failure
-//REMOVE ::comphelper::OStorageHelper::SetCommonStoragePassword( GetMedium->GetStorage(), aPasswd );
-//REMOVE }
-//REMOVE catch( uno::Exception& )
-//REMOVE {
-//REMOVE // TODO: handle the error
-//REMOVE }
-//REMOVE }
}
else
{
SetError( pNewFile->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
-//REMOVE // reconnect to the old storage
-//REMOVE if ( IsHandsOff() )
-//REMOVE DoSaveCompleted( pMedium );
-//REMOVE else
+ // reconnect to the old storage
DoSaveCompleted( 0 );
DELETEZ( pNewFile );
@@ -3153,9 +3109,6 @@ sal_Bool SfxObjectShell::LoadOwnFormat( SfxMedium& rMedium )
uno::Reference< embed::XStorage > xStorage = rMedium.GetStorage();
if ( xStorage.is() )
{
-//REMOVE if ( rMedium.GetFileVersion() )
-//REMOVE xStor->SetVersion( rMedium.GetFileVersion() );
-
// Password
SFX_ITEMSET_ARG( rMedium.GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False );
if ( pPasswdItem || ERRCODE_IO_ABORT != CheckPasswd_Impl( this, SFX_APP()->GetPool(), pMedium ) )
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 2298b93486..11268aeab5 100644..100755
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -247,6 +247,8 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell )
,m_bCreateTempStor( sal_False )
,m_bIsInit( sal_False )
,m_bIncomplEncrWarnShown( sal_False )
+ ,m_nModifyPasswordHash( 0 )
+ ,m_bModifyPasswordEntered( sal_False )
{
SfxObjectShell* pDoc = &_rDocShell;
SfxObjectShellArr_Impl &rArr = SFX_APP()->GetObjectShells_Impl();
@@ -1074,3 +1076,43 @@ void SfxObjectShell::SetInitialized_Impl( const bool i_fromInitNew )
SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) );
}
}
+
+
+bool SfxObjectShell::IsChangeRecording() const
+{
+ // currently this function needs to be overwritten by Writer and Calc only
+ DBG_ASSERT( 0, "function not implemented" );
+ return false;
+}
+
+
+bool SfxObjectShell::HasChangeRecordProtection() const
+{
+ // currently this function needs to be overwritten by Writer and Calc only
+ DBG_ASSERT( 0, "function not implemented" );
+ return false;
+}
+
+
+void SfxObjectShell::SetChangeRecording( bool /*bActivate*/ )
+{
+ // currently this function needs to be overwritten by Writer and Calc only
+ DBG_ASSERT( 0, "function not implemented" );
+}
+
+
+bool SfxObjectShell::SetProtectionPassword( const String & /*rPassword*/ )
+{
+ // currently this function needs to be overwritten by Writer and Calc only
+ DBG_ASSERT( 0, "function not implemented" );
+ return false;
+}
+
+
+bool SfxObjectShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > & /*rPasswordHash*/ )
+{
+ // currently this function needs to be overwritten by Writer and Calc only
+ DBG_ASSERT( 0, "function not implemented" );
+ return false;
+}
+
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 7a5f630659..2486f4e9fb 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -74,6 +74,7 @@
#include <svl/itemset.hxx>
#include <svl/stritem.hxx>
#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
#include <basic/sbx.hxx>
#include <basic/sbuno.hxx>
#include <tools/urlobj.hxx>
@@ -2731,6 +2732,24 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
uno::Reference< uno::XInterface >() );
}
+ sal_uInt32 nModifyPasswordHash = 0;
+ uno::Sequence< beans::PropertyValue > aModifyPasswordInfo;
+ SFX_ITEMSET_ARG( aParams, pModifyPasswordInfoItem, SfxUnoAnyItem, SID_MODIFYPASSWORDINFO, sal_False );
+ if ( pModifyPasswordInfoItem )
+ {
+ // it contains either a simple hash or a set of PropertyValues
+ // TODO/LATER: the sequence of PropertyValue should replace the hash completely in future
+ sal_Int32 nMPHTmp = 0;
+ pModifyPasswordInfoItem->GetValue() >>= nMPHTmp;
+ nModifyPasswordHash = (sal_uInt32)nMPHTmp;
+ pModifyPasswordInfoItem->GetValue() >>= aModifyPasswordInfo;
+ }
+ aParams->ClearItem( SID_MODIFYPASSWORDINFO );
+ sal_uInt32 nOldModifyPasswordHash = m_pData->m_pObjectShell->GetModifyPasswordHash();
+ m_pData->m_pObjectShell->SetModifyPasswordHash( nModifyPasswordHash );
+ uno::Sequence< beans::PropertyValue > aOldModifyPasswordInfo = m_pData->m_pObjectShell->GetModifyPasswordInfo();
+ m_pData->m_pObjectShell->SetModifyPasswordInfo( aModifyPasswordInfo );
+
// since saving a document modifies its DocumentInfo, the current
// DocumentInfo must be saved on "SaveTo", so it can be restored
// after saving
@@ -2809,10 +2828,15 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
if ( !bSaveTo )
{
m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl();
+ m_pData->m_pObjectShell->SetModifyPasswordEntered();
+
SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEASDOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVEASDOCDONE), m_pData->m_pObjectShell ) );
}
else
{
+ m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash );
+ m_pData->m_pObjectShell->SetModifyPasswordInfo( aOldModifyPasswordInfo );
+
SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVETODOCDONE), m_pData->m_pObjectShell ) );
}
}
@@ -2822,6 +2846,10 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing failed!" ) ) );
m_pData->m_pObjectShell->StoreLog();
+ m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash );
+ m_pData->m_pObjectShell->SetModifyPasswordInfo( aOldModifyPasswordInfo );
+
+
SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, GlobalEventConfig::GetEventName( bSaveTo ? STR_EVENT_SAVETODOCFAILED : STR_EVENT_SAVEASDOCFAILED),
m_pData->m_pObjectShell ) );
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index 96aafcfbf7..eff70fb605 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -82,6 +82,9 @@ class SfxBasicManagerCreationListener;
namespace sfx2 { namespace appl { class ImeStatusWindow; } }
+typedef Link* LinkPtr;
+SV_DECL_PTRARR(SfxInitLinkList, LinkPtr, 4, 4)
+
//=========================================================================
// SfxAppData_Impl
//=========================================================================
diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc
index 8639e8b76b..b1c39a2cef 100644..100755
--- a/sfx2/source/inc/helpid.hrc
+++ b/sfx2/source/inc/helpid.hrc
@@ -46,6 +46,7 @@
#define HID_DOCINFODESC (HID_SFX_START + 8)
#define HID_DOCINFODOC (HID_SFX_START + 9)
#define HID_DOCINFOUSER (HID_SFX_START + 10)
+#define HID_DOCINFOSECURITY (HID_SFX_START + 11)
#define HID_BOOKMARKPROPS (HID_SFX_START + 14)
#define HID_BOOKGROUPPROPS (HID_SFX_START + 15)
#define HID_BOOKFILEPROPS (HID_SFX_START + 16)
@@ -346,7 +347,15 @@
#define HID_CTRL_CUSTOMPROPS_YES_NO (HID_SFX_START + 326)
#define HID_DLG_CUSTOMPROPS_DURATION (HID_SFX_START + 327)
-#define ACT_SFX_HID_END HID_DLG_CUSTOMPROPS_DURATION
+#define HID_SECURITYTAB_PASSWORD_TO_OPEN (HID_SFX_START + 328)
+#define HID_SECURITYTAB_CONFIRM_PASSWORD_TO_OPEN (HID_SFX_START + 329)
+#define HID_SECURITYTAB_PASSWORD_TO_MODIFY (HID_SFX_START + 330)
+#define HID_SECURITYTAB_CONFIRM_PASSWORD_TO_MODIFY (HID_SFX_START + 331)
+#define HID_SECURITYTAB_OPEN_FILE_READONLY (HID_SFX_START + 332)
+#define HID_SECURITYTAB_RECORD_CHANGES (HID_SFX_START + 333)
+#define HID_SECURITYTAB_PROTECTION (HID_SFX_START + 334)
+
+#define ACT_SFX_HID_END HID_SECURITYTAB_PROTECTION
// "Uberlaufpr"ufung --------------------------------------------------------
diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx
index e0220316f7..c31a671f90 100644
--- a/sfx2/source/inc/objshimp.hxx
+++ b/sfx2/source/inc/objshimp.hxx
@@ -149,6 +149,10 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
sal_Bool m_bIncomplEncrWarnShown;
+ // TODO/LATER: m_aModifyPasswordInfo should completely replace m_nModifyPasswordHash in future
+ sal_uInt32 m_nModifyPasswordHash;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aModifyPasswordInfo;
+ sal_Bool m_bModifyPasswordEntered;
SfxObjectShell_Impl( SfxObjectShell& _rDocShell );
virtual ~SfxObjectShell_Impl();
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index eb41088cd1..ff1d963ab5 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -131,6 +131,8 @@ public:
, m_bResizeNoScale( sal_False )
{}
+ ~SfxInPlaceClient_Impl();
+
void SizeHasChanged();
DECL_LINK (TimerHdl, Timer*);
uno::Reference < frame::XFrame > GetFrame() const;
@@ -168,6 +170,10 @@ public:
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
};
+SfxInPlaceClient_Impl::~SfxInPlaceClient_Impl()
+{
+}
+
void SAL_CALL SfxInPlaceClient_Impl::changingState(
const ::com::sun::star::lang::EventObject& /*aEvent*/,
::sal_Int32 /*nOldState*/,
@@ -645,6 +651,7 @@ SfxInPlaceClient::SfxInPlaceClient( SfxViewShell* pViewShell, Window *pDraw, sal
m_pViewSh( pViewShell ),
m_pEditWin( pDraw )
{
+ m_pImp->acquire();
m_pImp->m_pClient = this;
m_pImp->m_nAspect = nAspect;
m_pImp->m_aScaleWidth = m_pImp->m_aScaleHeight = Fraction(1,1);
@@ -668,6 +675,7 @@ SfxInPlaceClient::~SfxInPlaceClient()
// the next call will destroy m_pImp if no other reference to it exists
m_pImp->m_xClient = uno::Reference < embed::XEmbeddedClient >();
+ m_pImp->release();
// TODO/LATER:
// the class is not intended to be used in multithreaded environment;
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 9013bd84f5..21d10471fc 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -83,6 +83,8 @@
#include <comphelper/componentcontext.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/configurationhelper.hxx>
+#include <comphelper/docpasswordrequest.hxx>
+#include <comphelper/docpasswordhelper.hxx>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/ucb/XContent.hpp>
@@ -185,6 +187,56 @@ namespace
return *i_rViewFrameImpl.aHasToolPanels;
}
}
+
+//-------------------------------------------------------------------------
+static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const ::rtl::OUString& aPath, const SfxFilter* pFilter, sal_uInt32 nPasswordHash, const uno::Sequence< beans::PropertyValue > aInfo )
+{
+ // TODO/LATER: In future the info should replace the direct hash completely
+ sal_Bool bResult = ( !nPasswordHash && !aInfo.getLength() );
+
+ OSL_ENSURE( pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ), "PasswordToModify feature is active for a filter that does not support it!" );
+
+ if ( pFilter && xHandler.is() )
+ {
+ sal_Bool bCancel = sal_False;
+ sal_Bool bFirstTime = sal_True;
+
+ while ( !bResult && !bCancel )
+ {
+ sal_Bool bMSType = !pFilter->IsOwnFormat();
+
+ ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest(
+ new ::comphelper::DocPasswordRequest(
+ bMSType ? ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD,
+ bFirstTime ? ::com::sun::star::task::PasswordRequestMode_PASSWORD_ENTER : ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER,
+ aPath,
+ sal_True ) );
+
+ uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest.get() );
+ xHandler->handle( rRequest );
+
+ if ( pPasswordRequest->isPassword() )
+ {
+ if ( aInfo.getLength() )
+ {
+ bResult = ::comphelper::DocPasswordHelper::IsModifyPasswordCorrect( pPasswordRequest->getPasswordToModify(), aInfo );
+ }
+ else
+ {
+ // the binary format
+ bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pFilter->GetServiceName() ) ) == nPasswordHash );
+ }
+ }
+ else
+ bCancel = sal_True;
+
+ bFirstTime = sal_False;
+ }
+ }
+
+ return bResult;
+}
+
//-------------------------------------------------------------------------
void SfxViewFrame::SetDowning_Impl()
{
@@ -324,10 +376,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
if( !pSh || !pSh->HasName() || !(pSh->Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ))
break;
+ SfxMedium* pMed = pSh->GetMedium();
+
SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(), pItem, SfxBoolItem, SID_VIEWONLY, sal_False );
if ( pItem && pItem->GetValue() )
{
- SfxMedium* pMed = pSh->GetMedium();
SfxApplication* pApp = SFX_APP();
SfxAllItemSet aSet( pApp->GetPool() );
aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetURLObject().GetMainURL(INetURLObject::NO_DECODE) ) );
@@ -359,17 +412,38 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
// Speichern und Readonly Reloaden
if( pSh->IsModified() )
{
- if ( !pSh->PrepareClose() )
+ if ( pSh->PrepareClose() )
+ {
+ // the storing could let the medium be changed
+ pMed = pSh->GetMedium();
+ bNeedsReload = sal_True;
+ }
+ else
{
rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_False ) );
return;
}
- else bNeedsReload = sal_True;
}
nOpenMode = SFX_STREAM_READONLY;
}
else
{
+ if ( pSh->IsReadOnlyMedium()
+ && ( pSh->GetModifyPasswordHash() || pSh->GetModifyPasswordInfo().getLength() )
+ && !pSh->IsModifyPasswordEntered() )
+ {
+ ::rtl::OUString aDocumentName = INetURLObject( pMed->GetOrigURL() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET );
+ if( !AskPasswordToModify_Impl( pMed->GetInteractionHandler(), aDocumentName, pMed->GetOrigFilter(), pSh->GetModifyPasswordHash(), pSh->GetModifyPasswordInfo() ) )
+ {
+ // this is a read-only document, if it has "Password to modify"
+ // the user should enter password before he can edit the document
+ rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_False ) );
+ return;
+ }
+
+ pSh->SetModifyPasswordEntered();
+ }
+
nOpenMode = SFX_STREAM_READWRITE;
pSh->SetReadOnlyUI( sal_False );
@@ -389,130 +463,113 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
}
// doing
- if( pSh )
+
+ String aTemp;
+ utl::LocalFileHelper::ConvertPhysicalNameToURL( pMed->GetPhysicalName(), aTemp );
+ INetURLObject aPhysObj( aTemp );
+ SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(),
+ pVersionItem, SfxInt16Item, SID_VERSION, sal_False );
+
+ INetURLObject aMedObj( pMed->GetName() );
+
+ // the logic below is following, if the document seems not to need to be reloaded and the physical name is different
+ // to the logical one, then on file system it can be checked that the copy is still newer than the original and no document reload is required
+ if ( ( !bNeedsReload && ( (aMedObj.GetProtocol() == INET_PROT_FILE &&
+ aMedObj.getFSysPath(INetURLObject::FSYS_DETECT) != aPhysObj.getFSysPath(INetURLObject::FSYS_DETECT) &&
+ !::utl::UCBContentHelper::IsYounger( aMedObj.GetMainURL( INetURLObject::NO_DECODE ), aPhysObj.GetMainURL( INetURLObject::NO_DECODE ) ))
+ || pMed->IsRemote() ) )
+ || pVersionItem )
{
- SfxMedium* pMed = pSh->GetMedium();
- String aTemp;
- utl::LocalFileHelper::ConvertPhysicalNameToURL( pMed->GetPhysicalName(), aTemp );
- INetURLObject aPhysObj( aTemp );
- SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(),
- pVersionItem, SfxInt16Item, SID_VERSION, sal_False );
-
- INetURLObject aMedObj( pMed->GetName() );
-
- // the logic below is following, if the document seems not to need to be reloaded and the physical name is different
- // to the logical one, then on file system it can be checked that the copy is still newer than the original and no document reload is required
- if ( ( !bNeedsReload && ( (aMedObj.GetProtocol() == INET_PROT_FILE &&
- aMedObj.getFSysPath(INetURLObject::FSYS_DETECT) != aPhysObj.getFSysPath(INetURLObject::FSYS_DETECT) &&
- !::utl::UCBContentHelper::IsYounger( aMedObj.GetMainURL( INetURLObject::NO_DECODE ), aPhysObj.GetMainURL( INetURLObject::NO_DECODE ) ))
- || pMed->IsRemote() ) )
- || pVersionItem )
+ sal_Bool bOK = sal_False;
+ if ( !pVersionItem )
{
- sal_Bool bOK = sal_False;
- if ( !pVersionItem )
+ sal_Bool bHasStorage = pMed->HasStorage_Impl();
+ // switching edit mode could be possible without reload
+ if ( bHasStorage && pMed->GetStorage() == pSh->GetStorage() )
{
- sal_Bool bHasStorage = pMed->HasStorage_Impl();
- // switching edit mode could be possible without reload
- if ( bHasStorage && pMed->GetStorage() == pSh->GetStorage() )
- {
- // TODO/LATER: faster creation of copy
- if ( !pSh->ConnectTmpStorage_Impl( pMed->GetStorage(), pMed ) )
- return;
- }
+ // TODO/LATER: faster creation of copy
+ if ( !pSh->ConnectTmpStorage_Impl( pMed->GetStorage(), pMed ) )
+ return;
+ }
- pMed->CloseAndRelease();
- pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) );
- pMed->SetOpenMode( nOpenMode, pMed->IsDirect() );
+ pMed->CloseAndRelease();
+ pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) );
+ pMed->SetOpenMode( nOpenMode, pMed->IsDirect() );
- pMed->CompleteReOpen();
- if ( nOpenMode & STREAM_WRITE )
- pMed->LockOrigFileOnDemand( sal_False, sal_True );
+ pMed->CompleteReOpen();
+ if ( nOpenMode & STREAM_WRITE )
+ pMed->LockOrigFileOnDemand( sal_False, sal_True );
- // LockOrigFileOnDemand might set the readonly flag itself, it should be set back
- pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) );
+ // LockOrigFileOnDemand might set the readonly flag itself, it should be set back
+ pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) );
- if ( !pMed->GetErrorCode() )
- bOK = sal_True;
- }
+ if ( !pMed->GetErrorCode() )
+ bOK = sal_True;
+ }
- if( !bOK )
+ if( !bOK )
+ {
+ ErrCode nErr = pMed->GetErrorCode();
+ if ( pVersionItem )
+ nErr = ERRCODE_IO_ACCESSDENIED;
+ else
{
- ErrCode nErr = pMed->GetErrorCode();
- if ( pVersionItem )
- nErr = ERRCODE_IO_ACCESSDENIED;
- else
- {
- pMed->ResetError();
- pMed->SetOpenMode( SFX_STREAM_READONLY, pMed->IsDirect() );
- pMed->ReOpen();
- pSh->DoSaveCompleted( pMed );
- }
+ pMed->ResetError();
+ pMed->SetOpenMode( SFX_STREAM_READONLY, pMed->IsDirect() );
+ pMed->ReOpen();
+ pSh->DoSaveCompleted( pMed );
+ }
- // r/o-Doc kann nicht in Editmode geschaltet werden?
- rReq.Done( sal_False );
+ // r/o-Doc kann nicht in Editmode geschaltet werden?
+ rReq.Done( sal_False );
- if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() )
+ if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() )
+ {
+ // dem ::com::sun::star::sdbcx::User anbieten, als Vorlage zu oeffnen
+ QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_OPENASTEMPLATE) );
+ if ( RET_YES == aBox.Execute() )
{
- // dem ::com::sun::star::sdbcx::User anbieten, als Vorlage zu oeffnen
- QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_OPENASTEMPLATE) );
- if ( RET_YES == aBox.Execute() )
+ SfxApplication* pApp = SFX_APP();
+ SfxAllItemSet aSet( pApp->GetPool() );
+ aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetName() ) );
+ SFX_ITEMSET_ARG( pMed->GetItemSet(), pReferer, SfxStringItem, SID_REFERER, sal_False );
+ if ( pReferer )
+ aSet.Put( *pReferer );
+ aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
+ if ( pVersionItem )
+ aSet.Put( *pVersionItem );
+
+ if( pMed->GetFilter() )
{
- SfxApplication* pApp = SFX_APP();
- SfxAllItemSet aSet( pApp->GetPool() );
- aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetName() ) );
- SFX_ITEMSET_ARG( pMed->GetItemSet(), pReferer, SfxStringItem, SID_REFERER, sal_False );
- if ( pReferer )
- aSet.Put( *pReferer );
- aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
- if ( pVersionItem )
- aSet.Put( *pVersionItem );
-
- if( pMed->GetFilter() )
- {
- aSet.Put( SfxStringItem( SID_FILTER_NAME, pMed->GetFilter()->GetFilterName() ) );
- SFX_ITEMSET_ARG( pMed->GetItemSet(), pOptions,
- SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False );
- if ( pOptions )
- aSet.Put( *pOptions );
- }
-
- GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, aSet );
- return;
+ aSet.Put( SfxStringItem( SID_FILTER_NAME, pMed->GetFilter()->GetFilterName() ) );
+ SFX_ITEMSET_ARG( pMed->GetItemSet(), pOptions,
+ SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False );
+ if ( pOptions )
+ aSet.Put( *pOptions );
}
- else
- nErr = 0;
- }
- ErrorHandler::HandleError( nErr );
- rReq.SetReturnValue(
- SfxBoolItem( rReq.GetSlot(), sal_False ) );
- return;
- }
- else
- {
- pSh->DoSaveCompleted( pMed );
- pSh->Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) );
- rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_True ) );
- rReq.Done( sal_True );
- // if( nOpenMode == SFX_STREAM_READONLY )
- // pMed->Close();
- return;
+ GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, aSet );
+ return;
+ }
+ else
+ nErr = 0;
}
- }
- /*
- if ( !bReload )
- {
- // Es soll nicht reloaded werden
- SfxErrorContext aEc( ERRCODE_SFX_NODOCRELOAD );
- ErrorHandler::HandleError( ERRCODE_SFX_NODOCRELOAD );
+ ErrorHandler::HandleError( nErr );
rReq.SetReturnValue(
SfxBoolItem( rReq.GetSlot(), sal_False ) );
return;
}
- */
- // Ansonsten ( lokal und arbeiten auf Kopie ) muss gereloaded
- // werden.
+ else
+ {
+ pSh->DoSaveCompleted( pMed );
+ pSh->Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) );
+ rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_True ) );
+ rReq.Done( sal_True );
+ // if( nOpenMode == SFX_STREAM_READONLY )
+ // pMed->Close();
+ return;
+ }
}
rReq.AppendItem( SfxBoolItem( SID_FORCERELOAD, sal_True) );
@@ -692,6 +749,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
}
xNewObj = SfxObjectShell::CreateObject( pFilter->GetServiceName(), SFX_CREATE_MODE_STANDARD );
+
+ if ( xOldObj->IsModifyPasswordEntered() )
+ xNewObj->SetModifyPasswordEntered();
+
uno::Sequence < beans::PropertyValue > aLoadArgs;
TransformItems( SID_OPENDOC, *pNewSet, aLoadArgs );
try
@@ -747,6 +808,12 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
}
else
{
+ if ( xNewObj->GetModifyPasswordHash() && xNewObj->GetModifyPasswordHash() != xOldObj->GetModifyPasswordHash() )
+ {
+ xNewObj->SetModifyPasswordEntered( sal_False );
+ xNewObj->SetReadOnly();
+ }
+
if ( xNewObj->IsDocShared() )
{
// the file is shared but the closing can change the sharing control file
@@ -759,10 +826,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
TransformItems( SID_OPENDOC, *xNewObj->GetMedium()->GetItemSet(), aLoadArgs );
UpdateDocument_Impl();
- }
- if ( xNewObj.Is() )
- {
try
{
while ( !aViewFrames.empty() )
@@ -1527,7 +1591,7 @@ void SfxViewFrame::KillDispatcher_Impl()
//------------------------------------------------------------------------
SfxViewFrame* SfxViewFrame::Current()
{
- return SfxApplication::Is_Impl() ? SFX_APP()->Get_Impl()->pViewFrame : NULL;
+ return SfxApplication::Get() ? SFX_APP()->Get_Impl()->pViewFrame : NULL;
}
//--------------------------------------------------------------------
@@ -2079,9 +2143,7 @@ SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc
else
aTransformLoadArgs.remove( "Hidden" );
- ::rtl::OUString sURL( xDocument->getURL() );
- if ( !sURL.getLength() )
- sURL = i_rDoc.GetFactory().GetFactoryURL();
+ ::rtl::OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "private:object" ) );
Reference< XComponentLoader > xLoader( i_rFrame, UNO_QUERY_THROW );
xLoader->loadComponentFromURL( sURL, ::rtl::OUString::createFromAscii( "_self" ), 0,
diff --git a/sfx2/util/hidother.src b/sfx2/util/hidother.src
index 1a851aef60..81633539dc 100644
--- a/sfx2/util/hidother.src
+++ b/sfx2/util/hidother.src
@@ -165,4 +165,6 @@ hidspecial HID_DID_SAVE_PACKED_XML { HelpID = HID_DID_SAVE_PACKED_XML; };
hidspecial HID_HELP_ONHELP { HelpID = HID_HELP_ONHELP; };
hidspecial HID_HELP_TEXT_SELECTION_MODE { HelpID = HID_HELP_TEXT_SELECTION_MODE; };
hidspecial HID_DLG_CHECKFORONLINEUPDATE { HelpID = HID_DLG_CHECKFORONLINEUPDATE; };
-hidspecial HID_TASKPANE_VIEW_MENU { HelpID = HID_TASKPANE_VIEW_MENU; }; \ No newline at end of file
+hidspecial HID_DOCINFOSECURITY { HelpID = HID_DOCINFOSECURITY; };
+hidspecial HID_TASKPANE_VIEW_MENU { HelpID = HID_TASKPANE_VIEW_MENU; };
+
diff --git a/shell/source/unix/misc/gnome-open-url.sh b/shell/source/unix/misc/gnome-open-url.sh
index 1a52fc7637..ab730d169a 100644
--- a/shell/source/unix/misc/gnome-open-url.sh
+++ b/shell/source/unix/misc/gnome-open-url.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# use gnome-open utility coming with libgnome if available
-gnome-open "$1" 2>/dev/null || "$0.bin" $1
+# use xdg-open or gnome-open if available
+xdg-open "$1" 2>/dev/null || gnome-open "$1" 2>/dev/null || "$0.bin" $1
exit 0
diff --git a/shell/source/unix/misc/open-url.sh b/shell/source/unix/misc/open-url.sh
index be414d0e11..dd304f5f0d 100755
--- a/shell/source/unix/misc/open-url.sh
+++ b/shell/source/unix/misc/open-url.sh
@@ -46,38 +46,48 @@ run_browser() {
# special handling for mailto: uris
if echo $1 | grep '^mailto:' > /dev/null; then
+ # check for xdg-email
+ mailer=`which xdg-email`
+ if [ ! -z "$mailer" ]; then
+ $mailer "$1" &
+ exit 0
+ fi
# check $MAILER variable
if [ ! -z "$MAILER" ]; then
$MAILER "$1" &
exit 0
- else
- # mozilla derivates may need -remote semantics
- for i in thunderbird mozilla netscape; do
- mailer=`which $i`
- if [ ! -z "$mailer" ]; then
- run_mozilla "$mailer" "$1"
- exit 0
- fi
- done
- # handle all non mozilla mail clients below
- # ..
fi
+ # mozilla derivates may need -remote semantics
+ for i in thunderbird mozilla netscape; do
+ mailer=`which $i`
+ if [ ! -z "$mailer" ]; then
+ run_mozilla "$mailer" "$1"
+ exit 0
+ fi
+ done
+ # handle all non mozilla mail clients below
+ # ..
else
+ # check for xdg-open
+ browser=`which xdg-open`
+ if [ ! -z "$browser" ]; then
+ $browser "$1" &
+ exit 0
+ fi
# check $BROWSER variable
if [ ! -z "$BROWSER" ]; then
$BROWSER "$1" &
exit 0
- else
- # mozilla derivates may need -remote semantics
- for i in firefox mozilla netscape; do
- browser=`which $i`
- if [ ! -z "$browser" ]; then
- run_mozilla "$browser" "$1"
- exit 0
- fi
- done
- # handle all non mozilla browers below
- # ..
fi
+ # mozilla derivates may need -remote semantics
+ for i in firefox mozilla netscape; do
+ browser=`which $i`
+ if [ ! -z "$browser" ]; then
+ run_mozilla "$browser" "$1"
+ exit 0
+ fi
+ done
+ # handle all non mozilla browers below
+ # ..
fi
exit 1
diff --git a/shell/source/unix/sysshell/recently_used_file.cxx b/shell/source/unix/sysshell/recently_used_file.cxx
index 050ba60caa..63f92afb0e 100644
--- a/shell/source/unix/sysshell/recently_used_file.cxx
+++ b/shell/source/unix/sysshell/recently_used_file.cxx
@@ -114,7 +114,8 @@ void recently_used_file::reset() const
//------------------------------------------------
void recently_used_file::truncate(off_t length)
{
- ftruncate(fileno(file_), length);
+ if (ftruncate(fileno(file_), length) == -1)
+ throw "I/O error: ftruncate failed";
}
//------------------------------------------------
diff --git a/svx/inc/htmlmode.hxx b/svx/inc/htmlmode.hxx
index 41440388c6..a701d03d39 100644
--- a/svx/inc/htmlmode.hxx
+++ b/svx/inc/htmlmode.hxx
@@ -27,28 +27,7 @@
#ifndef _SVX_HTMLMODE_HXX
#define _SVX_HTMLMODE_HXX
-// include ---------------------------------------------------------------
-
-// define ----------------------------------------------------------------
-
-#define HTMLMODE_ON 0x0001
-#define HTMLMODE_PARA_BORDER 0x0002 /* Absatzumrandungen */
-#define HTMLMODE_PARA_DISTANCE 0x0004 /* bestimmte Absatzabstaende */
-#define HTMLMODE_SMALL_CAPS 0x0008 /* Kapitaelchen */
-#define HTMLMODE_FRM_COLUMNS 0x0010 /* spaltige Rahmen */
-#define HTMLMODE_SOME_STYLES 0x0020 /* mind. MS IE */
-#define HTMLMODE_FULL_STYLES 0x0040 /* == SW */
-#define HTMLMODE_BLINK 0x0080 /* blinkende Zeichen*/
-#define HTMLMODE_PARA_BLOCK 0x0100 /* Blocksatz */
-#define HTMLMODE_DROPCAPS 0x0200 /* Initialen*/
-#define HTMLMODE_FIRSTLINE 0x0400 /* Erstzeileneinzug mit Spacer == NS 3.0 */
-#define HTMLMODE_GRAPH_POS 0x0800 /* Grafikpositionen Hintergrund */
-#define HTMLMODE_FULL_ABS_POS 0x1000 /* abs. Rahmenpositionierung */
-#define HTMLMODE_SOME_ABS_POS 0x2000 /* abs. Rahmenpositionierung vollst.*/
-#define HTMLMODE_RESERVED1 0x4000
-#define HTMLMODE_RESERVED0 0x8000
-
-
+#include <sfx2/htmlmode.hxx>
#endif
diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc
index 7c67690256..ab0189fe5d 100644..100755
--- a/svx/inc/svx/svxids.hrc
+++ b/svx/inc/svx/svxids.hrc
@@ -342,18 +342,19 @@
// Calc-Id's
// --------------------------------------------------------------------------
-#ifndef SC_FUNCTION_START
-#define SC_FUNCTION_START (SID_SC_START + 200)
-#endif
-#ifndef FILE_MENU_END
-#define FILE_MENU_END (SC_FUNCTION_START + 20)
-#endif
-#ifndef EDIT_MENU_START
-#define EDIT_MENU_START (FILE_MENU_END)
-#endif
-#ifndef SC_VIEW_START
-#define SC_VIEW_START (SID_SC_START)
-#endif
+//! moved to sfx2, still in use:
+//#ifndef SC_FUNCTION_START
+//#define SC_FUNCTION_START (SID_SC_START + 200)
+//#endif
+//#ifndef FILE_MENU_END
+//#define FILE_MENU_END (SC_FUNCTION_START + 20)
+//#endif
+//#ifndef EDIT_MENU_START
+//#define EDIT_MENU_START (FILE_MENU_END)
+//#endif
+//#ifndef SC_VIEW_START
+//#define SC_VIEW_START (SID_SC_START)
+//#endif
#define SID_OUTLINE_HIDE (SID_SC_START + 329)
#define SID_OUTLINE_SHOW (SID_SC_START + 330)
@@ -365,8 +366,9 @@
#define SID_ATTR_SECIALCHAR (SID_SC_START + 581)
#define SID_ATTR_SPECIALCHAR (SID_SC_START + 581)
-#define FID_CHG_RECORD (EDIT_MENU_START + 18)
-#define SID_CHG_PROTECT (SC_VIEW_START + 84)
+//! moved to sfx2, still in use:
+//#define FID_CHG_RECORD (EDIT_MENU_START + 18)
+//#define SID_CHG_PROTECT (SC_VIEW_START + 84)
// --------------------------------------------------------------------------
// Writer-Id's
@@ -402,9 +404,10 @@
#define FN_PGPREVIEW (SID_SW_START + 1250)
#define FN_SHOW_MULTIPLE_PAGES (FN_PGPREVIEW + 2)
-#define FN_EDIT2 (SID_SW_START + 1800)
-#define FN_REDLINE_PROTECT (FN_EDIT2 + 23)
-#define FN_REDLINE_ON (FN_EDIT2 + 25)
+//! moved to sfx2, still in use:
+//#define FN_EDIT2 (SID_SW_START + 1800)
+//#define FN_REDLINE_PROTECT (FN_EDIT2 + 23)
+//#define FN_REDLINE_ON (FN_EDIT2 + 25)
// --------------------------------------------------------------------------
// Svx-Id's
@@ -749,7 +752,10 @@
#define SID_ATTR_3D_AMBIENTINTENSITY ( SID_SVX_START + 410 ) /* --> Slots mit --> koennen demnaechst entfallen ( heute 12.03.1998 ) */
#define SID_ATTR_3D_AMBIENTCOLOR ( SID_SVX_START + 411 )
#define SID_IMPORT_GRAPH_LINK ( SID_SVX_START + 412 )
-#define SID_HTML_MODE ( SID_SVX_START + 414 )
+
+//! moved to sfx2, still in use:
+//#define SID_HTML_MODE ( SID_SVX_START + 414 )
+
#define SID_RULER_PROTECT ( SID_SVX_START + 415 )
//#define SID_INET_DLG ( SID_SVX_START + 416 ) -> sfxsids.hrc
#define SID_COLOR_CONTROL ( SID_SVX_START + 417 )
diff --git a/svx/inc/svx/unoshprp.hxx b/svx/inc/svx/unoshprp.hxx
index 41106a002d..4d537cd09d 100644
--- a/svx/inc/svx/unoshprp.hxx
+++ b/svx/inc/svx/unoshprp.hxx
@@ -160,7 +160,7 @@
#define OWN_ATTR_PAGE_NUMBER (OWN_ATTR_VALUE_START+65)
#define OWN_ATTR_THUMBNAIL (OWN_ATTR_VALUE_START+66)
#define OWN_ATTR_PERSISTNAME (OWN_ATTR_VALUE_START+67)
-//#define OWN_ATTR_HASLEVELS (OWN_ATTR_VALUE_START+68)
+#define OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT (OWN_ATTR_VALUE_START+68)
#define OWN_ATTR_MEDIA_URL (OWN_ATTR_VALUE_START+69)
#define OWN_ATTR_MEDIA_PREFERREDSIZE (OWN_ATTR_VALUE_START+70)
#define OWN_ATTR_MEDIA_LOOP (OWN_ATTR_VALUE_START+71)
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index 3496e11b01..360f3199d4 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -37,6 +37,8 @@
#include <vcl/msgbox.hxx>
#include <vcl/graph.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <svx/svxids.hrc>
#include <svx/dialogs.hrc>
#include "hdft.hrc"
#include <svl/intitem.hxx>
diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx
index 737f4e6986..9f3f247eac 100644
--- a/svx/source/smarttags/SmartTagMgr.cxx
+++ b/svx/source/smarttags/SmartTagMgr.cxx
@@ -35,8 +35,7 @@
#include <vcl/svapp.hxx>
#include <com/sun/star/smarttags/XSmartTagRecognizer.hpp>
#include <com/sun/star/smarttags/XSmartTagAction.hpp>
-#include <com/sun/star/deployment/XPackageManagerFactory.hpp>
-#include <com/sun/star/deployment/thePackageManagerFactory.hpp>
+#include <com/sun/star/deployment/ExtensionManager.hpp>
#include <com/sun/star/text/XTextMarkup.hpp>
#include <com/sun/star/smarttags/SmartTagRecognizerMode.hpp>
#include <com/sun/star/i18n/XBreakIterator.hpp>
@@ -472,11 +471,9 @@ void SmartTagMgr::RegisterListener()
// register as listener at package manager
try
{
- Reference<deployment::XPackageManagerFactory> xPackageManagerFactory(
- deployment::thePackageManagerFactory::get( mxContext ) );
- Reference<deployment::XPackageManager> xPackageManager(
- xPackageManagerFactory->getPackageManager( C2U("user" ) ) );
- Reference< util::XModifyBroadcaster > xMB ( xPackageManager, UNO_QUERY_THROW );
+ Reference<deployment::XExtensionManager> xExtensionManager(
+ deployment::ExtensionManager::get( mxContext ) );
+ Reference< util::XModifyBroadcaster > xMB ( xExtensionManager, UNO_QUERY_THROW );
Reference< util::XModifyListener > xListener( this );
xMB->addModifyListener( xListener );
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 68ebcca102..0a4aef117b 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -1714,8 +1714,8 @@ void SdrOle2Obj::ImpSetVisAreaSize()
if ( pClient || bHasOwnClient )
{
// TODO/LATER: IMHO we need to do similar things when object is UIActive or OutplaceActive?! (MBA)
- if ( (nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) &&
- svt::EmbeddedObjectRef::TryRunningState( xObjRef.GetObject() )
+ if ( ((nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) &&
+ svt::EmbeddedObjectRef::TryRunningState( xObjRef.GetObject() ))
|| xObjRef->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE
)
{
@@ -1832,11 +1832,7 @@ void SdrOle2Obj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
// if the object needs recompose on resize
// the client site should be created before the resize will take place
// check whether there is no client site and create it if necessary
- if ( !SfxInPlaceClient::GetClient( dynamic_cast<SfxObjectShell*>(pModel->GetPersist()), xObjRef.GetObject() )
- && !( mpImpl->pLightClient && xObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >( mpImpl->pLightClient ) ) )
- {
- AddOwnLightClient();
- }
+ AddOwnLightClient();
}
}
@@ -2197,26 +2193,32 @@ sal_Bool SdrOle2Obj::CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScal
sal_Bool SdrOle2Obj::AddOwnLightClient()
{
// The Own Light Client must be registered in object only using this method!
- Connect();
-
- if ( xObjRef.is() && mpImpl->pLightClient )
+ if ( !SfxInPlaceClient::GetClient( dynamic_cast<SfxObjectShell*>(pModel->GetPersist()), xObjRef.GetObject() )
+ && !( mpImpl->pLightClient && xObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >( mpImpl->pLightClient ) ) )
{
- Fraction aScaleWidth;
- Fraction aScaleHeight;
- Size aObjAreaSize;
- if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) )
+ Connect();
+
+ if ( xObjRef.is() && mpImpl->pLightClient )
{
- mpImpl->pLightClient->SetSizeScale( aScaleWidth, aScaleHeight );
- try {
- xObjRef->setClientSite( mpImpl->pLightClient );
- return sal_True;
- } catch( uno::Exception& )
- {}
+ Fraction aScaleWidth;
+ Fraction aScaleHeight;
+ Size aObjAreaSize;
+ if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) )
+ {
+ mpImpl->pLightClient->SetSizeScale( aScaleWidth, aScaleHeight );
+ try {
+ xObjRef->setClientSite( mpImpl->pLightClient );
+ return sal_True;
+ } catch( uno::Exception& )
+ {}
+ }
+
}
- }
+ return sal_False;
+ }
- return sal_False;
+ return sal_True;
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 404b3e5f30..91e3b9e7f5 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -478,6 +478,7 @@ SfxItemPropertyMapEntry* ImplGetSvxOle2PropertyMap()
{ MAP_CHAR_LEN("ThumbnailGraphicURL"), OWN_ATTR_THUMBNAIL , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
{ MAP_CHAR_LEN("Model"), OWN_ATTR_OLEMODEL , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN("EmbeddedObject"), OWN_ATTR_OLE_EMBEDDED_OBJECT , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("EmbeddedObjectNoNewClient"),OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN("OriginalSize"), OWN_ATTR_OLESIZE , &::getCppuType(( const ::com::sun::star::awt::Size*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN("CLSID"), OWN_ATTR_CLSID , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
{ MAP_CHAR_LEN("IsInternal"), OWN_ATTR_INTERNAL_OLE , &::getBooleanCppuType() , ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
index 4033827052..533943ae37 100644
--- a/svx/source/unodraw/unoshap4.cxx
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -355,22 +355,26 @@ bool SvxOle2Shape::getPropertyValueImpl( const ::rtl::OUString& rName, const Sfx
case OWN_ATTR_OLEMODEL:
case OWN_ATTR_OLE_EMBEDDED_OBJECT:
+ case OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT:
{
SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>( mpObj.get() );
if( pObj )
{
uno::Reference < embed::XEmbeddedObject > xObj( pObj->GetObjRef() );
if ( xObj.is()
- && ( pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT || svt::EmbeddedObjectRef::TryRunningState( xObj ) ) )
+ && ( pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT || pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT || svt::EmbeddedObjectRef::TryRunningState( xObj ) ) )
{
// Discussed with CL fue to the before GetPaintingPageView
// usage. Removed it, former fallback is used now
+ if ( pProperty->nWID == OWN_ATTR_OLEMODEL || pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT )
+ {
#ifdef DBG_UTIL
- const sal_Bool bSuccess(pObj->AddOwnLightClient());
- OSL_ENSURE( bSuccess, "An object without client is provided!" );
+ const sal_Bool bSuccess(pObj->AddOwnLightClient());
+ OSL_ENSURE( bSuccess, "An object without client is provided!" );
#else
- pObj->AddOwnLightClient();
+ pObj->AddOwnLightClient();
#endif
+ }
if ( pProperty->nWID == OWN_ATTR_OLEMODEL )
rValue <<= pObj->GetObjRef()->getComponent();
diff --git a/sysui/desktop/icons/hicolor/128x128/apps/startcenter.png b/sysui/desktop/icons/hicolor/128x128/apps/startcenter.png
index b009ee2b92..1b51a60bdd 100644
--- a/sysui/desktop/icons/hicolor/128x128/apps/startcenter.png
+++ b/sysui/desktop/icons/hicolor/128x128/apps/startcenter.png
Binary files differ
diff --git a/sysui/desktop/icons/hicolor/16x16/apps/startcenter.png b/sysui/desktop/icons/hicolor/16x16/apps/startcenter.png
index c81fc95d47..3aa8f08a8c 100644
--- a/sysui/desktop/icons/hicolor/16x16/apps/startcenter.png
+++ b/sysui/desktop/icons/hicolor/16x16/apps/startcenter.png
Binary files differ
diff --git a/sysui/desktop/icons/hicolor/32x32/apps/startcenter.png b/sysui/desktop/icons/hicolor/32x32/apps/startcenter.png
index 22bdd4a7fe..296c6f4c58 100644
--- a/sysui/desktop/icons/hicolor/32x32/apps/startcenter.png
+++ b/sysui/desktop/icons/hicolor/32x32/apps/startcenter.png
Binary files differ
diff --git a/sysui/desktop/icons/hicolor/48x48/apps/startcenter.png b/sysui/desktop/icons/hicolor/48x48/apps/startcenter.png
index f67dc97675..86bcf59955 100644
--- a/sysui/desktop/icons/hicolor/48x48/apps/startcenter.png
+++ b/sysui/desktop/icons/hicolor/48x48/apps/startcenter.png
Binary files differ
diff --git a/sysui/desktop/menus/base.desktop b/sysui/desktop/menus/base.desktop
index 89d0a20adb..9497666691 100644
--- a/sysui/desktop/menus/base.desktop
+++ b/sysui/desktop/menus/base.desktop
@@ -9,3 +9,4 @@ MimeType=application/vnd.oasis.opendocument.database;application/vnd.sun.xml.bas
Name=%PRODUCTNAME Base
GenericName=Database Development
Comment=Manage databases, create queries and reports to track and manage your information by using Base.
+InitialPreference=5
diff --git a/sysui/desktop/menus/calc.desktop b/sysui/desktop/menus/calc.desktop
index e49b114b09..bc0c9ee8b6 100644
--- a/sysui/desktop/menus/calc.desktop
+++ b/sysui/desktop/menus/calc.desktop
@@ -9,3 +9,4 @@ MimeType=application/vnd.oasis.opendocument.spreadsheet;application/vnd.oasis.op
Name=%PRODUCTNAME Calc
GenericName=Spreadsheet
Comment=Perform calculation, analyze information and manage lists in spreadsheets by using Calc.
+InitialPreference=5
diff --git a/sysui/desktop/menus/draw.desktop b/sysui/desktop/menus/draw.desktop
index 438d603e06..42db7c6f84 100644
--- a/sysui/desktop/menus/draw.desktop
+++ b/sysui/desktop/menus/draw.desktop
@@ -9,3 +9,4 @@ MimeType=application/vnd.oasis.opendocument.graphics;application/vnd.oasis.opend
Name=%PRODUCTNAME Draw
GenericName=Drawing Program
Comment=Create and edit drawings, flow charts, and logos by using Draw.
+InitialPreference=5
diff --git a/sysui/desktop/menus/impress.desktop b/sysui/desktop/menus/impress.desktop
index 0aa3cdecdc..90df11ac54 100644
--- a/sysui/desktop/menus/impress.desktop
+++ b/sysui/desktop/menus/impress.desktop
@@ -9,3 +9,4 @@ MimeType=application/vnd.oasis.opendocument.presentation;application/vnd.oasis.o
Name=%PRODUCTNAME Impress
GenericName=Presentation
Comment=Create and edit presentations for slideshows, meeting and Web pages by using Impress.
+InitialPreference=5
diff --git a/sysui/desktop/menus/math.desktop b/sysui/desktop/menus/math.desktop
index 15a6d42efc..f97536d6ef 100644
--- a/sysui/desktop/menus/math.desktop
+++ b/sysui/desktop/menus/math.desktop
@@ -9,3 +9,4 @@ MimeType=application/vnd.oasis.opendocument.formula;application/vnd.sun.xml.math
Name=%PRODUCTNAME Math
GenericName=Formula Editor
Comment=Create and edit scientific formulas and equations by using Math.
+InitialPreference=5
diff --git a/sysui/desktop/menus/startcenter.desktop b/sysui/desktop/menus/startcenter.desktop
index b6067494a6..6302a5b162 100644
--- a/sysui/desktop/menus/startcenter.desktop
+++ b/sysui/desktop/menus/startcenter.desktop
@@ -5,7 +5,7 @@ Icon=startcenter
Type=Application
Categories=Office;X-Red-Hat-Base;X-SuSE-Core-Office;X-MandrivaLinux-Office-Other;
Exec=openoffice %U
-MimeType=
+MimeType=application/vnd.openofficeorg.extension;
Name=%PRODUCTNAME
GenericName=Office
Comment=The office productivity suite compatible to the open and standardized ODF document format. Supported by Sun Microsystems.
diff --git a/sysui/desktop/menus/writer.desktop b/sysui/desktop/menus/writer.desktop
index 0184d916e2..1509de0fb4 100644
--- a/sysui/desktop/menus/writer.desktop
+++ b/sysui/desktop/menus/writer.desktop
@@ -9,3 +9,4 @@ MimeType=application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocum
Name=%PRODUCTNAME Writer
GenericName=Word Processor
Comment=Create and edit text and graphics in letters, reports, documents and Web pages by using Writer.
+InitialPreference=5
diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx
index dff5db9616..c0ce3bebad 100644
--- a/ucb/source/ucp/file/shell.cxx
+++ b/ucb/source/ucp/file/shell.cxx
@@ -33,6 +33,7 @@
#endif
#include "osl/diagnose.h"
+#include <rtl/uri.hxx>
#include <rtl/ustrbuf.hxx>
#include <osl/time.h>
#include <osl/file.hxx>
@@ -2053,10 +2054,15 @@ shell::copy_recursive( const rtl::OUString& srcUnqPath,
rtl::OUString newDstUnqPath = dstUnqPath;
rtl::OUString tit;
- if( aFileStatus.isValid( FileStatusMask_FileName ) )
- tit = aFileStatus.getFileName();
+ if( aFileStatus.isValid( FileStatusMask_FileName ) )
+ tit = rtl::Uri::encode( aFileStatus.getFileName(),
+ rtl_UriCharClassPchar,
+ rtl_UriEncodeIgnoreEscapes,
+ RTL_TEXTENCODING_UTF8 );
+
if( newDstUnqPath.lastIndexOf( sal_Unicode('/') ) != newDstUnqPath.getLength()-1 )
newDstUnqPath += rtl::OUString::createFromAscii( "/" );
+
newDstUnqPath += tit;
if ( newSrcUnqPath != dstUnqPath )
diff --git a/uui/prj/build.lst b/uui/prj/build.lst
index 0ebacfcb81..dbe31cb1b5 100644
--- a/uui/prj/build.lst
+++ b/uui/prj/build.lst
@@ -1,4 +1,4 @@
-uu uui : l10n svtools NULL
+uu uui : l10n vcl svtools NULL
uu uui usr1 - all uu_mkout NULL
uu uui\source nmake - all uu_source NULL
uu uui\util nmake - all uu_util uu_source NULL
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx
index f5599595fe..57c9ead3ad 100644..100755
--- a/uui/source/iahndl-authentication.cxx
+++ b/uui/source/iahndl-authentication.cxx
@@ -26,18 +26,23 @@
************************************************************************/
#include "com/sun/star/task/DocumentPasswordRequest.hpp"
+#include "com/sun/star/task/DocumentPasswordRequest2.hpp"
#include "com/sun/star/task/DocumentMSPasswordRequest.hpp"
+#include "com/sun/star/task/DocumentMSPasswordRequest2.hpp"
#include "com/sun/star/task/MasterPasswordRequest.hpp"
#include "com/sun/star/task/XInteractionAbort.hpp"
#include "com/sun/star/task/XInteractionPassword.hpp"
+#include "com/sun/star/task/XInteractionPassword2.hpp"
#include "com/sun/star/task/XInteractionRetry.hpp"
#include "com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp"
#include "com/sun/star/ucb/URLAuthenticationRequest.hpp"
+#include "osl/diagnose.h"
#include "rtl/digest.h"
#include "vos/mutex.hxx"
#include "tools/errcode.hxx"
#include "vcl/msgbox.hxx"
+#include "vcl/abstdlg.hxx"
#include "vcl/svapp.hxx"
#include "ids.hrc"
@@ -67,8 +72,7 @@ executeLoginDialog(
{
vos::OGuard aGuard(Application::GetSolarMutex());
- bool bAccount
- = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT) != 0;
+ bool bAccount = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT) != 0;
bool bSavePassword = rInfo.GetCanRememberPassword();
bool bCanUseSysCreds = rInfo.GetCanUseSystemCredentials();
@@ -88,15 +92,10 @@ executeLoginDialog(
if (!bCanUseSysCreds)
nFlags |= LF_NO_USESYSCREDS;
- std::auto_ptr< ResMgr > xManager(
- ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ std::auto_ptr< ResMgr > xManager( ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
UniString aRealm(rRealm);
std::auto_ptr< LoginDialog > xDialog(
- new LoginDialog(pParent,
- nFlags,
- rInfo.GetServer(),
- &aRealm,
- xManager.get()));
+ new LoginDialog( pParent, nFlags, rInfo.GetServer(), &aRealm, xManager.get()));
if (rInfo.GetErrorText().Len() != 0)
xDialog->SetErrorText(rInfo.GetErrorText());
xDialog->SetName(rInfo.GetUserName());
@@ -118,8 +117,7 @@ executeLoginDialog(
}
if ( bCanUseSysCreds )
- xDialog->SetUseSystemCredentials(
- rInfo.GetIsUseSystemCredentials() );
+ xDialog->SetUseSystemCredentials( rInfo.GetIsUseSystemCredentials() );
rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
ERRCODE_BUTTON_CANCEL);
@@ -521,7 +519,8 @@ executePasswordDialog(
LoginErrorInfo & rInfo,
task::PasswordRequestMode nMode,
::rtl::OUString aDocName,
- bool bMSCryptoMode)
+ bool bMSCryptoMode,
+ bool bIsPasswordToModify )
SAL_THROW((uno::RuntimeException))
{
try
@@ -532,23 +531,25 @@ executePasswordDialog(
ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
if( nMode == task::PasswordRequestMode_PASSWORD_CREATE )
{
- std::auto_ptr< PasswordCreateDialog > xDialog(
- new PasswordCreateDialog(pParent,
- xManager.get(),
- bMSCryptoMode));
+ const sal_uInt16 nMaxPasswdLen = bMSCryptoMode ? 15 : 0; // 0 -> allow any length
- rInfo.SetResult(xDialog->Execute()
- == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL);
- rInfo.SetPassword( xDialog->GetPassword() );
+ VclAbstractDialogFactory * pFact = VclAbstractDialogFactory::Create();
+ AbstractPasswordToOpenModifyDialog *pTmp = pFact->CreatePasswordToOpenModifyDialog( pParent, 0, nMaxPasswdLen, bIsPasswordToModify );
+ std::auto_ptr< AbstractPasswordToOpenModifyDialog > pDialog( pTmp );
+
+ rInfo.SetResult( pDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL );
+ rInfo.SetPassword( pDialog->GetPasswordToOpen() );
+ rInfo.SetPasswordToModify( pDialog->GetPasswordToModify() );
+ rInfo.SetRecommendToOpenReadonly( pDialog->IsRecommendToOpenReadonly() );
}
else
{
- std::auto_ptr< PasswordDialog > xDialog(
- new PasswordDialog(pParent, nMode, xManager.get(), aDocName));
+ std::auto_ptr< PasswordDialog > pDialog(
+ new PasswordDialog( pParent, nMode, xManager.get(), aDocName, bIsPasswordToModify ) );
- rInfo.SetResult(xDialog->Execute()
- == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL);
- rInfo.SetPassword( xDialog->GetPassword() );
+ rInfo.SetResult( pDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL );
+ rInfo.SetPassword( bIsPasswordToModify ? String() : pDialog->GetPassword() );
+ rInfo.SetPasswordToModify( bIsPasswordToModify ? pDialog->GetPassword() : String() );
}
}
catch (std::bad_alloc const &)
@@ -566,26 +567,36 @@ handlePasswordRequest_(
uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
rContinuations,
::rtl::OUString aDocumentName,
- bool bMSCryptoMode )
+ bool bMSCryptoMode,
+ bool bIsPasswordToModify )
SAL_THROW((uno::RuntimeException))
{
uno::Reference< task::XInteractionRetry > xRetry;
uno::Reference< task::XInteractionAbort > xAbort;
uno::Reference< task::XInteractionPassword > xPassword;
- getContinuations(rContinuations, &xRetry, &xAbort, &xPassword);
+ uno::Reference< task::XInteractionPassword2 > xPassword2;
+ getContinuations(rContinuations, &xRetry, &xAbort, &xPassword2, &xPassword);
+
+ if ( xPassword2.is() && !xPassword.is() )
+ xPassword.set( xPassword2, uno::UNO_QUERY_THROW );
+
LoginErrorInfo aInfo;
- executePasswordDialog(pParent,
- aInfo,
- nMode,
- aDocumentName,
- bMSCryptoMode);
+ executePasswordDialog( pParent, aInfo, nMode,
+ aDocumentName, bMSCryptoMode, bIsPasswordToModify );
switch (aInfo.GetResult())
{
case ERRCODE_BUTTON_OK:
+ OSL_ENSURE( !bIsPasswordToModify || xPassword2.is(), "PasswordToModify is requested, but there is no Interaction!" );
if (xPassword.is())
{
+ if (xPassword2.is())
+ {
+ xPassword2->setPasswordToModify( aInfo.GetPasswordToModify() );
+ xPassword2->setRecommendReadOnly( aInfo.IsRecommendToOpenReadonly() );
+ }
+
xPassword->setPassword(aInfo.GetPassword());
xPassword->select();
}
@@ -661,27 +672,66 @@ UUIInteractionHelper::handlePasswordRequest(
uno::Reference< task::XInteractionRequest > const & rRequest)
SAL_THROW((uno::RuntimeException))
{
+ // parameters to be filled for the call to handlePasswordRequest_
+ Window * pParent = getParentProperty();
+ task::PasswordRequestMode nMode = task::PasswordRequestMode_PASSWORD_ENTER;
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations = rRequest->getContinuations();
+ ::rtl::OUString aDocumentName;
+ bool bMSCryptoMode = false;
+ bool bIsPasswordToModify = false;
+
+ bool bDoHandleRequest = false;
+
uno::Any aAnyRequest(rRequest->getRequest());
+ task::DocumentPasswordRequest2 aDocumentPasswordRequest2;
+ if (!bDoHandleRequest && (aAnyRequest >>= aDocumentPasswordRequest2))
+ {
+ nMode = aDocumentPasswordRequest2.Mode;
+ aDocumentName = aDocumentPasswordRequest2.Name;
+ OSL_ENSURE( bMSCryptoMode == false, "bMSCryptoMode should be false" );
+ bIsPasswordToModify = aDocumentPasswordRequest2.IsRequestPasswordToModify;
+
+ bDoHandleRequest = true;
+ }
+
task::DocumentPasswordRequest aDocumentPasswordRequest;
- if (aAnyRequest >>= aDocumentPasswordRequest)
+ if (!bDoHandleRequest && (aAnyRequest >>= aDocumentPasswordRequest))
{
- handlePasswordRequest_(getParentProperty(),
- aDocumentPasswordRequest.Mode,
- rRequest->getContinuations(),
- aDocumentPasswordRequest.Name,
- false /* bool bMSCryptoMode */);
- return true;
+ nMode = aDocumentPasswordRequest.Mode;
+ aDocumentName = aDocumentPasswordRequest.Name;
+ OSL_ENSURE( bMSCryptoMode == false, "bMSCryptoMode should be false" );
+ OSL_ENSURE( bIsPasswordToModify == false, "bIsPasswordToModify should be false" );
+
+ bDoHandleRequest = true;
+ }
+
+ task::DocumentMSPasswordRequest2 aDocumentMSPasswordRequest2;
+ if (!bDoHandleRequest && (aAnyRequest >>= aDocumentMSPasswordRequest2))
+ {
+ nMode = aDocumentMSPasswordRequest2.Mode;
+ aDocumentName = aDocumentMSPasswordRequest2.Name;
+ bMSCryptoMode = true;
+ bIsPasswordToModify = aDocumentMSPasswordRequest2.IsRequestPasswordToModify;
+
+ bDoHandleRequest = true;
}
task::DocumentMSPasswordRequest aDocumentMSPasswordRequest;
- if (aAnyRequest >>= aDocumentMSPasswordRequest)
+ if (!bDoHandleRequest && (aAnyRequest >>= aDocumentMSPasswordRequest))
{
- handlePasswordRequest_(getParentProperty(),
- aDocumentMSPasswordRequest.Mode,
- rRequest->getContinuations(),
- aDocumentMSPasswordRequest.Name,
- true /* bool bMSCryptoMode */);
+ nMode = aDocumentMSPasswordRequest.Mode;
+ aDocumentName = aDocumentMSPasswordRequest.Name;
+ bMSCryptoMode = true;
+ OSL_ENSURE( bIsPasswordToModify == false, "bIsPasswordToModify should be false" );
+
+ bDoHandleRequest = true;
+ }
+
+ if (bDoHandleRequest)
+ {
+ handlePasswordRequest_( pParent, nMode, rContinuations,
+ aDocumentName, bMSCryptoMode, bIsPasswordToModify );
return true;
}
@@ -692,9 +742,11 @@ UUIInteractionHelper::handlePasswordRequest(
aPasswordRequest.Mode,
rRequest->getContinuations(),
rtl::OUString(),
- false /* bool bMSCryptoMode */);
+ false /* bool bMSCryptoMode */,
+ false /* bool bIsPasswordToModify */);
return true;
}
return false;
}
+
diff --git a/uui/source/ids.hrc b/uui/source/ids.hrc
index d7b8ae15d7..2641c5d329 100644..100755
--- a/uui/source/ids.hrc
+++ b/uui/source/ids.hrc
@@ -35,126 +35,129 @@
#include "tools/errcode.hxx"
#endif
-#define RID_KEEP_PASSWORD (RID_UUI_START + 0)
-#define RID_SAVE_PASSWORD (RID_UUI_START + 1)
-#define DLG_UUI_LOGIN (RID_UUI_START + 2)
-#define DLG_COOKIES (RID_UUI_START + 3)
-#define STR_COOKIES_RECV_START (RID_UUI_START + 4)
-#define STR_COOKIES_RECV_COOKIES (RID_UUI_START + 5)
-#define STR_COOKIES_RECV_TITLE (RID_UUI_START + 6)
-#define STR_COOKIES_SEND_START (RID_UUI_START + 7)
-#define STR_COOKIES_SEND_COOKIES (RID_UUI_START + 8)
-#define STR_COOKIES_SEND_TITLE (RID_UUI_START + 9)
-#define DLG_FILTER_SELECT (RID_UUI_START + 10)
+#define RID_KEEP_PASSWORD (RID_UUI_START + 0)
+#define RID_SAVE_PASSWORD (RID_UUI_START + 1)
+#define DLG_UUI_LOGIN (RID_UUI_START + 2)
+#define DLG_COOKIES (RID_UUI_START + 3)
+#define STR_COOKIES_RECV_START (RID_UUI_START + 4)
+#define STR_COOKIES_RECV_COOKIES (RID_UUI_START + 5)
+#define STR_COOKIES_RECV_TITLE (RID_UUI_START + 6)
+#define STR_COOKIES_SEND_START (RID_UUI_START + 7)
+#define STR_COOKIES_SEND_COOKIES (RID_UUI_START + 8)
+#define STR_COOKIES_SEND_TITLE (RID_UUI_START + 9)
+#define DLG_FILTER_SELECT (RID_UUI_START + 10)
// RID_UUI_START + 11 moved to ERRCODE_UUI_WRONGMEDIUM
-#define DLG_UUI_MASTERPASSWORD (RID_UUI_START + 12)
-#define STR_ERROR_PASSWORDS_NOT_IDENTICAL (RID_UUI_START + 13)
-#define STR_ERROR_MASTERPASSWORD_WRONG (RID_UUI_START + 14)
+#define DLG_UUI_MASTERPASSWORD (RID_UUI_START + 12)
+#define STR_ERROR_PASSWORDS_NOT_IDENTICAL (RID_UUI_START + 13)
+#define STR_ERROR_MASTERPASSWORD_WRONG (RID_UUI_START + 14)
// RID_UUI_START + 15, 16, 17 are misused by syncaccess/source/ui/resids.hrc
-#define RID_UUI_ERRHDL (RID_UUI_START + 20)
-#define DLG_UUI_MASTERPASSWORD_CRT (RID_UUI_START + 21)
-#define DLG_UUI_PASSWORD (RID_UUI_START + 22)
-#define DLG_UUI_PASSWORD_CRT (RID_UUI_START + 23)
-#define STR_ERROR_PASSWORD_WRONG (RID_UUI_START + 24)
-#define STR_WARNING_BROKENSIGNATURE_TITLE (RID_UUI_START + 25)
-#define DLG_UUI_UNKNOWNAUTH (RID_UUI_START + 26)
-#define DLG_UUI_UNKNOWNAUTH_CRT (RID_UUI_START + 27)
-#define DLG_UUI_SSLWARN (RID_UUI_START + 28)
-#define DLG_UUI_SSLWARN_CRT (RID_UUI_START + 29)
-#define RID_XMLSECDLG_MACROWARN (RID_UUI_START + 30)
-#define STR_UNKNOWNUSER (RID_UUI_START + 31)
-#define STR_OPENLOCKED_TITLE (RID_UUI_START + 32)
-#define STR_OPENLOCKED_MSG (RID_UUI_START + 33)
-#define STR_OPENLOCKED_OPENREADONLY_BTN (RID_UUI_START + 34)
-#define STR_OPENLOCKED_OPENCOPY_BTN (RID_UUI_START + 35)
-#define STR_FILECHANGED_TITLE (RID_UUI_START + 36)
-#define STR_FILECHANGED_MSG (RID_UUI_START + 37)
-#define STR_FILECHANGED_SAVEANYWAY_BTN (RID_UUI_START + 38)
-#define STR_ALREADYOPEN_TITLE (RID_UUI_START + 39)
-#define STR_ALREADYOPEN_MSG (RID_UUI_START + 40)
-#define STR_ALREADYOPEN_READONLY_BTN (RID_UUI_START + 41)
-#define STR_ALREADYOPEN_OPEN_BTN (RID_UUI_START + 42)
-#define STR_LOCKFAILED_TITLE (RID_UUI_START + 43)
-#define STR_LOCKFAILED_MSG (RID_UUI_START + 44)
-#define STR_LOCKFAILED_DONTSHOWAGAIN (RID_UUI_START + 45)
-#define STR_TRYLATER_TITLE (RID_UUI_START + 46)
-#define STR_TRYLATER_MSG (RID_UUI_START + 47)
-#define STR_TRYLATER_RETRYSAVING_BTN (RID_UUI_START + 48)
-#define STR_TRYLATER_SAVEAS_BTN (RID_UUI_START + 49)
-#define STR_ALREADYOPEN_SAVE_MSG (RID_UUI_START + 50)
-#define STR_ALREADYOPEN_RETRY_SAVE_BTN (RID_UUI_START + 51)
-#define STR_ALREADYOPEN_SAVE_BTN (RID_UUI_START + 52)
-#define RID_DLG_NEWER_VERSION_WARNING (RID_UUI_START + 53)
-#define STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE (RID_UUI_START + 54)
+#define RID_UUI_ERRHDL (RID_UUI_START + 20)
+#define DLG_UUI_MASTERPASSWORD_CRT (RID_UUI_START + 21)
+#define DLG_UUI_PASSWORD (RID_UUI_START + 22)
+#define DLG_UUI_PASSWORD_CRT (RID_UUI_START + 23)
+#define STR_ERROR_PASSWORD_TO_OPEN_WRONG (RID_UUI_START + 24)
+#define STR_ERROR_PASSWORD_TO_MODIFY_WRONG (RID_UUI_START + 25)
+#define DLG_UUI_UNKNOWNAUTH (RID_UUI_START + 26)
+#define DLG_UUI_UNKNOWNAUTH_CRT (RID_UUI_START + 27)
+#define DLG_UUI_SSLWARN (RID_UUI_START + 28)
+#define DLG_UUI_SSLWARN_CRT (RID_UUI_START + 29)
+#define RID_XMLSECDLG_MACROWARN (RID_UUI_START + 30)
+#define STR_UNKNOWNUSER (RID_UUI_START + 31)
+#define STR_OPENLOCKED_TITLE (RID_UUI_START + 32)
+#define STR_OPENLOCKED_MSG (RID_UUI_START + 33)
+#define STR_OPENLOCKED_OPENREADONLY_BTN (RID_UUI_START + 34)
+#define STR_OPENLOCKED_OPENCOPY_BTN (RID_UUI_START + 35)
+#define STR_FILECHANGED_TITLE (RID_UUI_START + 36)
+#define STR_FILECHANGED_MSG (RID_UUI_START + 37)
+#define STR_FILECHANGED_SAVEANYWAY_BTN (RID_UUI_START + 38)
+#define STR_ALREADYOPEN_TITLE (RID_UUI_START + 39)
+#define STR_ALREADYOPEN_MSG (RID_UUI_START + 40)
+#define STR_ALREADYOPEN_READONLY_BTN (RID_UUI_START + 41)
+#define STR_ALREADYOPEN_OPEN_BTN (RID_UUI_START + 42)
+#define STR_LOCKFAILED_TITLE (RID_UUI_START + 43)
+#define STR_LOCKFAILED_MSG (RID_UUI_START + 44)
+#define STR_LOCKFAILED_DONTSHOWAGAIN (RID_UUI_START + 45)
+#define STR_TRYLATER_TITLE (RID_UUI_START + 46)
+#define STR_TRYLATER_MSG (RID_UUI_START + 47)
+#define STR_TRYLATER_RETRYSAVING_BTN (RID_UUI_START + 48)
+#define STR_TRYLATER_SAVEAS_BTN (RID_UUI_START + 49)
+#define STR_ALREADYOPEN_SAVE_MSG (RID_UUI_START + 50)
+#define STR_ALREADYOPEN_RETRY_SAVE_BTN (RID_UUI_START + 51)
+#define STR_ALREADYOPEN_SAVE_BTN (RID_UUI_START + 52)
+#define RID_DLG_NEWER_VERSION_WARNING (RID_UUI_START + 53)
+#define STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE (RID_UUI_START + 54)
+#define STR_WARNING_BROKENSIGNATURE_TITLE (RID_UUI_START + 55)
+#define STR_ENTER_PASSWORD_TO_OPEN (RID_UUI_START + 56)
+#define STR_ENTER_PASSWORD_TO_MODIFY (RID_UUI_START + 57)
-#define ERRCODE_UUI_IO_ABORT (ERRCODE_AREA_UUI + 0)
-#define ERRCODE_UUI_IO_ACCESSDENIED (ERRCODE_AREA_UUI + 1)
-#define ERRCODE_UUI_IO_ALREADYEXISTS (ERRCODE_AREA_UUI + 2)
-#define ERRCODE_UUI_IO_BADCRC (ERRCODE_AREA_UUI + 3)
-#define ERRCODE_UUI_IO_CANTCREATE (ERRCODE_AREA_UUI + 4)
-#define ERRCODE_UUI_IO_CANTREAD (ERRCODE_AREA_UUI + 5)
-#define ERRCODE_UUI_IO_CANTSEEK (ERRCODE_AREA_UUI + 6)
-#define ERRCODE_UUI_IO_CANTTELL (ERRCODE_AREA_UUI + 7)
-#define ERRCODE_UUI_IO_CANTWRITE (ERRCODE_AREA_UUI + 8)
-#define ERRCODE_UUI_IO_CURRENTDIR (ERRCODE_AREA_UUI + 9)
-#define ERRCODE_UUI_IO_NOTREADY (ERRCODE_AREA_UUI + 10)
-#define ERRCODE_UUI_IO_NOTSAMEDEVICE (ERRCODE_AREA_UUI + 11)
-#define ERRCODE_UUI_IO_GENERAL (ERRCODE_AREA_UUI + 12)
-#define ERRCODE_UUI_IO_INVALIDACCESS (ERRCODE_AREA_UUI + 13)
-#define ERRCODE_UUI_IO_INVALIDCHAR (ERRCODE_AREA_UUI + 14)
-#define ERRCODE_UUI_IO_INVALIDDEVICE (ERRCODE_AREA_UUI + 15)
-#define ERRCODE_UUI_IO_INVALIDLENGTH (ERRCODE_AREA_UUI + 16)
-#define ERRCODE_UUI_IO_INVALIDPARAMETER (ERRCODE_AREA_UUI + 17)
-#define ERRCODE_UUI_IO_ISWILDCARD (ERRCODE_AREA_UUI + 18)
-#define ERRCODE_UUI_IO_LOCKVIOLATION (ERRCODE_AREA_UUI + 19)
-#define ERRCODE_UUI_IO_MISPLACEDCHAR (ERRCODE_AREA_UUI + 20)
-#define ERRCODE_UUI_IO_NAMETOOLONG (ERRCODE_AREA_UUI + 21)
-#define ERRCODE_UUI_IO_NOTEXISTS (ERRCODE_AREA_UUI + 22)
-#define ERRCODE_UUI_IO_NOTEXISTSPATH (ERRCODE_AREA_UUI + 23)
-#define ERRCODE_UUI_IO_NOTSUPPORTED (ERRCODE_AREA_UUI + 24)
-#define ERRCODE_UUI_IO_NOTADIRECTORY (ERRCODE_AREA_UUI + 25)
-#define ERRCODE_UUI_IO_NOTAFILE (ERRCODE_AREA_UUI + 26)
-#define ERRCODE_UUI_IO_OUTOFSPACE (ERRCODE_AREA_UUI + 27)
-#define ERRCODE_UUI_IO_TOOMANYOPENFILES (ERRCODE_AREA_UUI + 28)
-#define ERRCODE_UUI_IO_OUTOFMEMORY (ERRCODE_AREA_UUI + 29)
-#define ERRCODE_UUI_IO_PENDING (ERRCODE_AREA_UUI + 30)
-#define ERRCODE_UUI_IO_RECURSIVE (ERRCODE_AREA_UUI + 31)
-#define ERRCODE_UUI_IO_UNKNOWN (ERRCODE_AREA_UUI + 32)
-#define ERRCODE_UUI_IO_WRITEPROTECTED (ERRCODE_AREA_UUI + 33)
-#define ERRCODE_UUI_IO_WRONGFORMAT (ERRCODE_AREA_UUI + 34)
-#define ERRCODE_UUI_IO_WRONGVERSION (ERRCODE_AREA_UUI + 35)
-#define ERRCODE_UUI_IO_NOTEXISTS_VOLUME (ERRCODE_AREA_UUI + 36)
-#define ERRCODE_UUI_IO_NOTEXISTS_FOLDER (ERRCODE_AREA_UUI + 37)
-#define ERRCODE_UUI_WRONGJAVA (ERRCODE_AREA_UUI + 38)
-#define ERRCODE_UUI_WRONGJAVA_VERSION (ERRCODE_AREA_UUI + 39)
-#define ERRCODE_UUI_WRONGJAVA_MIN (ERRCODE_AREA_UUI + 40)
-#define ERRCODE_UUI_WRONGJAVA_VERSION_MIN (ERRCODE_AREA_UUI + 41)
-#define ERRCODE_UUI_BADPARTNERSHIP (ERRCODE_AREA_UUI + 42)
-#define ERRCODE_UUI_BADPARTNERSHIP_NAME (ERRCODE_AREA_UUI + 43)
-#define ERRCODE_UUI_IO_NOTREADY_VOLUME (ERRCODE_AREA_UUI + 44)
-#define ERRCODE_UUI_IO_NOTREADY_REMOVABLE (ERRCODE_AREA_UUI + 45)
-#define ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE (ERRCODE_AREA_UUI + 46)
-#define ERRCODE_UUI_WRONGMEDIUM (ERRCODE_AREA_UUI + 47)
-#define ERRCODE_UUI_IO_CANTCREATE_NONAME (ERRCODE_AREA_UUI + 48)
-#define ERRCODE_UUI_IO_TARGETALREADYEXISTS (ERRCODE_AREA_UUI + 49)
-#define ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE (ERRCODE_AREA_UUI + 50)
-#define ERRCODE_UUI_IO_BROKENPACKAGE (ERRCODE_AREA_UUI + 51)
-#define ERRCODE_UUI_IO_BROKENPACKAGE_CANTREPAIR (ERRCODE_AREA_UUI + 52)
-#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_NOREMOVE (ERRCODE_AREA_UUI + 53)
-#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_WITHREMOVE (ERRCODE_AREA_UUI + 54)
-#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING (ERRCODE_AREA_UUI + 55)
-#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING_WITHRECOVER (ERRCODE_AREA_UUI + 56)
-#define ERRCODE_UUI_INVALID_XFORMS_SUBMISSION_DATA (ERRCODE_AREA_UUI + 57)
-#define ERRCODE_UUI_IO_MODULESIZEEXCEEDED (ERRCODE_AREA_UUI + 58)
-#define ERRCODE_UUI_LOCKING_LOCKED (ERRCODE_AREA_UUI + 59)
-#define ERRCODE_UUI_LOCKING_LOCKED_SELF (ERRCODE_AREA_UUI + 60)
-#define ERRCODE_UUI_LOCKING_NOT_LOCKED (ERRCODE_AREA_UUI + 61)
-#define ERRCODE_UUI_LOCKING_LOCK_EXPIRED (ERRCODE_AREA_UUI + 62)
+#define ERRCODE_UUI_IO_ABORT (ERRCODE_AREA_UUI + 0)
+#define ERRCODE_UUI_IO_ACCESSDENIED (ERRCODE_AREA_UUI + 1)
+#define ERRCODE_UUI_IO_ALREADYEXISTS (ERRCODE_AREA_UUI + 2)
+#define ERRCODE_UUI_IO_BADCRC (ERRCODE_AREA_UUI + 3)
+#define ERRCODE_UUI_IO_CANTCREATE (ERRCODE_AREA_UUI + 4)
+#define ERRCODE_UUI_IO_CANTREAD (ERRCODE_AREA_UUI + 5)
+#define ERRCODE_UUI_IO_CANTSEEK (ERRCODE_AREA_UUI + 6)
+#define ERRCODE_UUI_IO_CANTTELL (ERRCODE_AREA_UUI + 7)
+#define ERRCODE_UUI_IO_CANTWRITE (ERRCODE_AREA_UUI + 8)
+#define ERRCODE_UUI_IO_CURRENTDIR (ERRCODE_AREA_UUI + 9)
+#define ERRCODE_UUI_IO_NOTREADY (ERRCODE_AREA_UUI + 10)
+#define ERRCODE_UUI_IO_NOTSAMEDEVICE (ERRCODE_AREA_UUI + 11)
+#define ERRCODE_UUI_IO_GENERAL (ERRCODE_AREA_UUI + 12)
+#define ERRCODE_UUI_IO_INVALIDACCESS (ERRCODE_AREA_UUI + 13)
+#define ERRCODE_UUI_IO_INVALIDCHAR (ERRCODE_AREA_UUI + 14)
+#define ERRCODE_UUI_IO_INVALIDDEVICE (ERRCODE_AREA_UUI + 15)
+#define ERRCODE_UUI_IO_INVALIDLENGTH (ERRCODE_AREA_UUI + 16)
+#define ERRCODE_UUI_IO_INVALIDPARAMETER (ERRCODE_AREA_UUI + 17)
+#define ERRCODE_UUI_IO_ISWILDCARD (ERRCODE_AREA_UUI + 18)
+#define ERRCODE_UUI_IO_LOCKVIOLATION (ERRCODE_AREA_UUI + 19)
+#define ERRCODE_UUI_IO_MISPLACEDCHAR (ERRCODE_AREA_UUI + 20)
+#define ERRCODE_UUI_IO_NAMETOOLONG (ERRCODE_AREA_UUI + 21)
+#define ERRCODE_UUI_IO_NOTEXISTS (ERRCODE_AREA_UUI + 22)
+#define ERRCODE_UUI_IO_NOTEXISTSPATH (ERRCODE_AREA_UUI + 23)
+#define ERRCODE_UUI_IO_NOTSUPPORTED (ERRCODE_AREA_UUI + 24)
+#define ERRCODE_UUI_IO_NOTADIRECTORY (ERRCODE_AREA_UUI + 25)
+#define ERRCODE_UUI_IO_NOTAFILE (ERRCODE_AREA_UUI + 26)
+#define ERRCODE_UUI_IO_OUTOFSPACE (ERRCODE_AREA_UUI + 27)
+#define ERRCODE_UUI_IO_TOOMANYOPENFILES (ERRCODE_AREA_UUI + 28)
+#define ERRCODE_UUI_IO_OUTOFMEMORY (ERRCODE_AREA_UUI + 29)
+#define ERRCODE_UUI_IO_PENDING (ERRCODE_AREA_UUI + 30)
+#define ERRCODE_UUI_IO_RECURSIVE (ERRCODE_AREA_UUI + 31)
+#define ERRCODE_UUI_IO_UNKNOWN (ERRCODE_AREA_UUI + 32)
+#define ERRCODE_UUI_IO_WRITEPROTECTED (ERRCODE_AREA_UUI + 33)
+#define ERRCODE_UUI_IO_WRONGFORMAT (ERRCODE_AREA_UUI + 34)
+#define ERRCODE_UUI_IO_WRONGVERSION (ERRCODE_AREA_UUI + 35)
+#define ERRCODE_UUI_IO_NOTEXISTS_VOLUME (ERRCODE_AREA_UUI + 36)
+#define ERRCODE_UUI_IO_NOTEXISTS_FOLDER (ERRCODE_AREA_UUI + 37)
+#define ERRCODE_UUI_WRONGJAVA (ERRCODE_AREA_UUI + 38)
+#define ERRCODE_UUI_WRONGJAVA_VERSION (ERRCODE_AREA_UUI + 39)
+#define ERRCODE_UUI_WRONGJAVA_MIN (ERRCODE_AREA_UUI + 40)
+#define ERRCODE_UUI_WRONGJAVA_VERSION_MIN (ERRCODE_AREA_UUI + 41)
+#define ERRCODE_UUI_BADPARTNERSHIP (ERRCODE_AREA_UUI + 42)
+#define ERRCODE_UUI_BADPARTNERSHIP_NAME (ERRCODE_AREA_UUI + 43)
+#define ERRCODE_UUI_IO_NOTREADY_VOLUME (ERRCODE_AREA_UUI + 44)
+#define ERRCODE_UUI_IO_NOTREADY_REMOVABLE (ERRCODE_AREA_UUI + 45)
+#define ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE (ERRCODE_AREA_UUI + 46)
+#define ERRCODE_UUI_WRONGMEDIUM (ERRCODE_AREA_UUI + 47)
+#define ERRCODE_UUI_IO_CANTCREATE_NONAME (ERRCODE_AREA_UUI + 48)
+#define ERRCODE_UUI_IO_TARGETALREADYEXISTS (ERRCODE_AREA_UUI + 49)
+#define ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE (ERRCODE_AREA_UUI + 50)
+#define ERRCODE_UUI_IO_BROKENPACKAGE (ERRCODE_AREA_UUI + 51)
+#define ERRCODE_UUI_IO_BROKENPACKAGE_CANTREPAIR (ERRCODE_AREA_UUI + 52)
+#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_NOREMOVE (ERRCODE_AREA_UUI + 53)
+#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_WITHREMOVE (ERRCODE_AREA_UUI + 54)
+#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING (ERRCODE_AREA_UUI + 55)
+#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING_WITHRECOVER (ERRCODE_AREA_UUI + 56)
+#define ERRCODE_UUI_INVALID_XFORMS_SUBMISSION_DATA (ERRCODE_AREA_UUI + 57)
+#define ERRCODE_UUI_IO_MODULESIZEEXCEEDED (ERRCODE_AREA_UUI + 58)
+#define ERRCODE_UUI_LOCKING_LOCKED (ERRCODE_AREA_UUI + 59)
+#define ERRCODE_UUI_LOCKING_LOCKED_SELF (ERRCODE_AREA_UUI + 60)
+#define ERRCODE_UUI_LOCKING_NOT_LOCKED (ERRCODE_AREA_UUI + 61)
+#define ERRCODE_UUI_LOCKING_LOCK_EXPIRED (ERRCODE_AREA_UUI + 62)
-#define ERRCODE_AREA_UUI_UNKNOWNAUTH 25000
-#define SSLWARN_TYPE_DOMAINMISMATCH 10
-#define SSLWARN_TYPE_EXPIRED 20
-#define SSLWARN_TYPE_INVALID 30
+#define ERRCODE_AREA_UUI_UNKNOWNAUTH 25000
+#define SSLWARN_TYPE_DOMAINMISMATCH 10
+#define SSLWARN_TYPE_EXPIRED 20
+#define SSLWARN_TYPE_INVALID 30
#define ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED (ERRCODE_AREA_UUI_UNKNOWNAUTH + 1)
@@ -167,17 +170,25 @@
#define ERRCODE_UUI_SSLWARN_INVALID_1 (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_INVALID + 1)
#define TITLE_UUI_SSLWARN_INVALID (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_INVALID + 3)
-#define HID_DLG_LOGIN (HID_UUI_START + 0)
-#define HID_DLG_COOKIES (HID_UUI_START + 1)
-#define HID_DLG_MASTERPASSWORD_UUI (HID_UUI_START+2)
-#define HID_DLG_MASTERPASSWORD_CRT (HID_UUI_START+3)
-#define HID_DLG_FILTER_SELECT (HID_UUI_START+4)
-#define HID_DLG_PASSWORD_UUI (HID_UUI_START+5)
-#define HID_DLG_PASSWORD_CRT (HID_UUI_START+6)
-#define HID_DLG_UNKNOWNAUTH_UUI (HID_UUI_START+7)
-#define HID_DLG_SSLWARN_UUI (HID_UUI_START+8)
-#define HID_XMLSECDLG_MACROWARN (HID_UUI_START+9)
-#define HID_DLG_NEWERVERSIONWARNING (HID_UUI_START+10)
+#define HID_DLG_LOGIN (HID_UUI_START + 0)
+#define HID_DLG_COOKIES (HID_UUI_START + 1)
+#define HID_DLG_MASTERPASSWORD_UUI (HID_UUI_START + 2)
+#define HID_DLG_MASTERPASSWORD_CRT (HID_UUI_START + 3)
+#define HID_DLG_FILTER_SELECT (HID_UUI_START + 4)
+#define HID_DLG_PASSWORD_UUI (HID_UUI_START + 5)
+#define HID_DLG_PASSWORD_CRT (HID_UUI_START + 6)
+#define HID_DLG_UNKNOWNAUTH_UUI (HID_UUI_START + 7)
+#define HID_DLG_SSLWARN_UUI (HID_UUI_START + 8)
+#define HID_XMLSECDLG_MACROWARN (HID_UUI_START + 9)
+#define HID_DLG_NEWERVERSIONWARNING (HID_UUI_START +10)
+
+#define HID_LOGIN_DLG_PATH (HID_UUI_START +11)
+#define HID_LOGIN_DLG_BROWSE (HID_UUI_START +12)
+#define HID_LOGIN_DLG_USER_NAME (HID_UUI_START +13)
+#define HID_LOGIN_DLG_PASSWORD (HID_UUI_START +14)
+#define HID_LOGIN_DLG_ACCOUNT (HID_UUI_START +15)
+#define HID_LOGIN_DLG_REMEMBER_PASSWORD (HID_UUI_START +16)
+#define HID_LOGIN_DLG_USE_SYSTEM_CREDENTIALS (HID_UUI_START +17)
// HID_UUI_END (aka HID_CHAOS_NEW_DATABASE) is reserved in
// sfx2/util/hidother.src
diff --git a/uui/source/logindlg.cxx b/uui/source/logindlg.cxx
index 4bfa2147ec..efb0b77fea 100644..100755
--- a/uui/source/logindlg.cxx
+++ b/uui/source/logindlg.cxx
@@ -47,12 +47,20 @@
//............................................................................
//............................................................................
+static void lcl_Move( Window &rWin, long nOffset )
+{
+ Point aTmp( rWin.GetPosPixel() );
+ aTmp.Y() -= nOffset;
+ rWin.SetPosPixel( aTmp );
+}
+
+
void LoginDialog::HideControls_Impl( USHORT nFlags )
{
- FASTBOOL bPathHide = FALSE;
- FASTBOOL bErrorHide = FALSE;
- FASTBOOL bAccountHide = FALSE;
- FASTBOOL bUseSysCredsHide = FALSE;
+ bool bPathHide = FALSE;
+ bool bErrorHide = FALSE;
+ bool bAccountHide = FALSE;
+ bool bUseSysCredsHide = FALSE;
if ( ( nFlags & LF_NO_PATH ) == LF_NO_PATH )
{
@@ -63,9 +71,8 @@ void LoginDialog::HideControls_Impl( USHORT nFlags )
}
else if ( ( nFlags & LF_PATH_READONLY ) == LF_PATH_READONLY )
{
- aPathED.Hide();
- aPathInfo.Show();
- aPathBtn.Hide();
+ aPathED.Enable( FALSE );
+ aPathBtn.Enable( FALSE );
}
if ( ( nFlags & LF_NO_USERNAME ) == LF_NO_USERNAME )
@@ -75,8 +82,7 @@ void LoginDialog::HideControls_Impl( USHORT nFlags )
}
else if ( ( nFlags & LF_USERNAME_READONLY ) == LF_USERNAME_READONLY )
{
- aNameED.Hide();
- aNameInfo.Show();
+ aNameED.Enable( FALSE );
}
if ( ( nFlags & LF_NO_PASSWORD ) == LF_NO_PASSWORD )
@@ -91,7 +97,8 @@ void LoginDialog::HideControls_Impl( USHORT nFlags )
if ( ( nFlags & LF_NO_ERRORTEXT ) == LF_NO_ERRORTEXT )
{
aErrorInfo.Hide();
- aErrorGB.Hide();
+ aErrorFT.Hide();
+ aLogin1FL.Hide();
bErrorHide = TRUE;
}
@@ -110,53 +117,26 @@ void LoginDialog::HideControls_Impl( USHORT nFlags )
if ( bErrorHide )
{
- long nOffset = aLoginGB.GetPosPixel().Y() -
- aErrorGB.GetPosPixel().Y();
- Point aNewPnt = aRequestInfo.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aRequestInfo.SetPosPixel( aNewPnt );
- aNewPnt = aPathFT.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aPathFT.SetPosPixel( aNewPnt );
- aNewPnt = aPathED.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aPathED.SetPosPixel( aNewPnt );
- aNewPnt = aPathInfo.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aPathInfo.SetPosPixel( aNewPnt );
- aNewPnt = aPathBtn.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aPathBtn.SetPosPixel( aNewPnt );
- aNewPnt = aNameFT.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aNameFT.SetPosPixel( aNewPnt );
- aNewPnt = aNameED.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aNameED.SetPosPixel( aNewPnt );
- aNewPnt = aNameInfo.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aNameInfo.SetPosPixel( aNewPnt );
- aNewPnt = aPasswordFT.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aPasswordFT.SetPosPixel( aNewPnt );
- aNewPnt = aPasswordED.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aPasswordED.SetPosPixel( aNewPnt );
- aNewPnt = aAccountFT.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aAccountFT.SetPosPixel( aNewPnt );
- aNewPnt = aAccountED.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aAccountED.SetPosPixel( aNewPnt );
- aNewPnt = aSavePasswdBtn.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aSavePasswdBtn.SetPosPixel( aNewPnt );
- aNewPnt = aUseSysCredsCB.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aUseSysCredsCB.SetPosPixel( aNewPnt );
- aNewPnt = aLoginGB.GetPosPixel();
- aNewPnt.Y() -= nOffset;
- aLoginGB.SetPosPixel( aNewPnt );
+ long nOffset = aRequestInfo.GetPosPixel().Y() -
+ aErrorFT.GetPosPixel().Y();
+ lcl_Move( aRequestInfo, nOffset );
+ lcl_Move( aLogin2FL, nOffset );
+ lcl_Move( aPathFT, nOffset );
+ lcl_Move( aPathED, nOffset );
+ lcl_Move( aPathBtn, nOffset );
+ lcl_Move( aNameFT, nOffset );
+ lcl_Move( aNameED, nOffset );
+ lcl_Move( aPasswordFT, nOffset );
+ lcl_Move( aPasswordED, nOffset );
+ lcl_Move( aAccountFT, nOffset );
+ lcl_Move( aAccountED, nOffset );
+ lcl_Move( aSavePasswdBtn, nOffset );
+ lcl_Move( aUseSysCredsCB, nOffset );
+ lcl_Move( aButtonsFL, nOffset );
+ lcl_Move( aOKBtn, nOffset );
+ lcl_Move( aCancelBtn, nOffset );
+ lcl_Move( aHelpBtn, nOffset );
+
Size aNewSiz = GetSizePixel();
aNewSiz.Height() -= nOffset;
SetSizePixel( aNewSiz );
@@ -166,24 +146,19 @@ void LoginDialog::HideControls_Impl( USHORT nFlags )
{
long nOffset = aNameED.GetPosPixel().Y() -
aPathED.GetPosPixel().Y();
+ lcl_Move( aNameFT, nOffset );
+ lcl_Move( aNameED, nOffset );
+ lcl_Move( aPasswordFT, nOffset );
+ lcl_Move( aPasswordED, nOffset );
+ lcl_Move( aAccountFT, nOffset );
+ lcl_Move( aAccountED, nOffset );
+ lcl_Move( aSavePasswdBtn, nOffset );
+ lcl_Move( aUseSysCredsCB, nOffset );
+ lcl_Move( aButtonsFL, nOffset );
+ lcl_Move( aOKBtn, nOffset );
+ lcl_Move( aCancelBtn, nOffset );
+ lcl_Move( aHelpBtn, nOffset );
- Point aTmpPnt1 = aNameFT.GetPosPixel();
- Point aTmpPnt2 = aPasswordFT.GetPosPixel();
- aNameFT.SetPosPixel( aPathFT.GetPosPixel() );
- aPasswordFT.SetPosPixel( aTmpPnt1 );
- aAccountFT.SetPosPixel( aTmpPnt2 );
- aTmpPnt1 = aNameED.GetPosPixel();
- aTmpPnt2 = aPasswordED.GetPosPixel();
- aNameED.SetPosPixel( aPathED.GetPosPixel() );
- aPasswordED.SetPosPixel( aTmpPnt1 );
- aAccountED.SetPosPixel( aTmpPnt2 );
- aNameInfo.SetPosPixel( aPathInfo.GetPosPixel() );
- aTmpPnt1 = aSavePasswdBtn.GetPosPixel();
- aTmpPnt1.Y() -= nOffset;
- aSavePasswdBtn.SetPosPixel( aTmpPnt1 );
- aTmpPnt1 = aUseSysCredsCB.GetPosPixel();
- aTmpPnt1.Y() -= nOffset;
- aUseSysCredsCB.SetPosPixel( aTmpPnt1 );
Size aNewSz = GetSizePixel();
aNewSz.Height() -= nOffset;
SetSizePixel( aNewSz );
@@ -191,14 +166,15 @@ void LoginDialog::HideControls_Impl( USHORT nFlags )
if ( bAccountHide )
{
- long nOffset = aAccountED.GetPosPixel().Y() - aPasswordED.GetPosPixel().Y();
-
- Point aTmpPnt = aSavePasswdBtn.GetPosPixel();
- aTmpPnt.Y() -= nOffset;
- aSavePasswdBtn.SetPosPixel( aTmpPnt );
- aTmpPnt = aUseSysCredsCB.GetPosPixel();
- aTmpPnt.Y() -= nOffset;
- aUseSysCredsCB.SetPosPixel( aTmpPnt );
+ long nOffset = aAccountED.GetPosPixel().Y() -
+ aPasswordED.GetPosPixel().Y();
+ lcl_Move( aSavePasswdBtn, nOffset );
+ lcl_Move( aUseSysCredsCB, nOffset );
+ lcl_Move( aButtonsFL, nOffset );
+ lcl_Move( aOKBtn, nOffset );
+ lcl_Move( aCancelBtn, nOffset );
+ lcl_Move( aHelpBtn, nOffset );
+
Size aNewSz = GetSizePixel();
aNewSz.Height() -= nOffset;
SetSizePixel( aNewSz );
@@ -208,6 +184,10 @@ void LoginDialog::HideControls_Impl( USHORT nFlags )
{
long nOffset = aUseSysCredsCB.GetPosPixel().Y() -
aSavePasswdBtn.GetPosPixel().Y();
+ lcl_Move( aButtonsFL, nOffset );
+ lcl_Move( aOKBtn, nOffset );
+ lcl_Move( aCancelBtn, nOffset );
+ lcl_Move( aHelpBtn, nOffset );
Size aNewSz = GetSizePixel();
aNewSz.Height() -= nOffset;
@@ -219,15 +199,13 @@ void LoginDialog::HideControls_Impl( USHORT nFlags )
void LoginDialog::EnableUseSysCredsControls_Impl( BOOL bUseSysCredsEnabled )
{
aErrorInfo.Enable( !bUseSysCredsEnabled );
- aErrorGB.Enable( !bUseSysCredsEnabled );
+ aErrorFT.Enable( !bUseSysCredsEnabled );
aRequestInfo.Enable( !bUseSysCredsEnabled );
aPathFT.Enable( !bUseSysCredsEnabled );
aPathED.Enable( !bUseSysCredsEnabled );
- aPathInfo.Enable( !bUseSysCredsEnabled );
aPathBtn.Enable( !bUseSysCredsEnabled );
aNameFT.Enable( !bUseSysCredsEnabled );
aNameED.Enable( !bUseSysCredsEnabled );
- aNameInfo.Enable( !bUseSysCredsEnabled );
aPasswordFT.Enable( !bUseSysCredsEnabled );
aPasswordED.Enable( !bUseSysCredsEnabled );
aAccountFT.Enable( !bUseSysCredsEnabled );
@@ -282,23 +260,23 @@ LoginDialog::LoginDialog
ModalDialog( pParent, ResId( DLG_UUI_LOGIN, *pResMgr ) ),
- aErrorInfo ( this, ResId( INFO_LOGIN_ERROR, *pResMgr ) ),
- aErrorGB ( this, ResId( GB_LOGIN_ERROR, *pResMgr ) ),
- aRequestInfo ( this, ResId( INFO_LOGIN_REQUEST, *pResMgr ) ),
+ aErrorFT ( this, ResId( FT_LOGIN_ERROR, *pResMgr ) ),
+ aErrorInfo ( this, ResId( FT_INFO_LOGIN_ERROR, *pResMgr ) ),
+ aLogin1FL ( this, ResId( FL_LOGIN_1, *pResMgr ) ),
+ aRequestInfo ( this, ResId( FT_INFO_LOGIN_REQUEST, *pResMgr ) ),
+ aLogin2FL ( this, ResId( FL_LOGIN_2, *pResMgr ) ),
aPathFT ( this, ResId( FT_LOGIN_PATH, *pResMgr ) ),
aPathED ( this, ResId( ED_LOGIN_PATH, *pResMgr ) ),
- aPathInfo ( this, ResId( INFO_LOGIN_PATH, *pResMgr ) ),
aPathBtn ( this, ResId( BTN_LOGIN_PATH, *pResMgr ) ),
aNameFT ( this, ResId( FT_LOGIN_USERNAME, *pResMgr ) ),
aNameED ( this, ResId( ED_LOGIN_USERNAME, *pResMgr ) ),
- aNameInfo ( this, ResId( INFO_LOGIN_USERNAME, *pResMgr ) ),
aPasswordFT ( this, ResId( FT_LOGIN_PASSWORD, *pResMgr ) ),
aPasswordED ( this, ResId( ED_LOGIN_PASSWORD, *pResMgr ) ),
aAccountFT ( this, ResId( FT_LOGIN_ACCOUNT, *pResMgr ) ),
aAccountED ( this, ResId( ED_LOGIN_ACCOUNT, *pResMgr ) ),
aSavePasswdBtn ( this, ResId( CB_LOGIN_SAVEPASSWORD, *pResMgr ) ),
aUseSysCredsCB ( this, ResId( CB_LOGIN_USESYSCREDS, *pResMgr ) ),
- aLoginGB ( this, ResId( GB_LOGIN_LOGIN, *pResMgr ) ),
+ aButtonsFL ( this, ResId( FL_BUTTONS, *pResMgr ) ),
aOKBtn ( this, ResId( BTN_LOGIN_OK, *pResMgr ) ),
aCancelBtn ( this, ResId( BTN_LOGIN_CANCEL, *pResMgr ) ),
aHelpBtn ( this, ResId( BTN_LOGIN_HELP, *pResMgr ) )
@@ -333,11 +311,9 @@ LoginDialog::LoginDialog
// -----------------------------------------------------------------------
-void LoginDialog::SetName( const String& rNewName )
+LoginDialog::~LoginDialog()
{
- aNameED.SetText( rNewName );
- aNameInfo.SetText( rNewName );
-}
+}
// -----------------------------------------------------------------------
diff --git a/uui/source/logindlg.hrc b/uui/source/logindlg.hrc
index 13848e694a..d2a5d48aaf 100644..100755
--- a/uui/source/logindlg.hrc
+++ b/uui/source/logindlg.hrc
@@ -30,24 +30,24 @@
//============================================================================
-#define INFO_LOGIN_ERROR 10
-#define GB_LOGIN_ERROR 11
+#define FT_INFO_LOGIN_ERROR 10
+#define FT_LOGIN_ERROR 11
-#define INFO_LOGIN_REQUEST 20
+#define FT_INFO_LOGIN_REQUEST 20
#define FT_LOGIN_PATH 21
#define ED_LOGIN_PATH 22
-#define INFO_LOGIN_PATH 23
-#define BTN_LOGIN_PATH 24
-#define FT_LOGIN_USERNAME 25
-#define ED_LOGIN_USERNAME 26
-#define INFO_LOGIN_USERNAME 27
-#define FT_LOGIN_PASSWORD 28
-#define ED_LOGIN_PASSWORD 29
-#define FT_LOGIN_ACCOUNT 30
-#define ED_LOGIN_ACCOUNT 31
-#define CB_LOGIN_SAVEPASSWORD 32
-#define GB_LOGIN_LOGIN 33
-#define CB_LOGIN_USESYSCREDS 34
+#define BTN_LOGIN_PATH 23
+#define FT_LOGIN_USERNAME 24
+#define ED_LOGIN_USERNAME 25
+#define FT_LOGIN_PASSWORD 26
+#define ED_LOGIN_PASSWORD 27
+#define FT_LOGIN_ACCOUNT 28
+#define ED_LOGIN_ACCOUNT 29
+#define CB_LOGIN_SAVEPASSWORD 30
+#define CB_LOGIN_USESYSCREDS 31
+#define FL_LOGIN_1 32
+#define FL_LOGIN_2 33
+#define FL_BUTTONS 34
#define BTN_LOGIN_OK 50
#define BTN_LOGIN_CANCEL 51
diff --git a/uui/source/logindlg.hxx b/uui/source/logindlg.hxx
index a8b2fa9c60..a349929ce7 100644..100755
--- a/uui/source/logindlg.hxx
+++ b/uui/source/logindlg.hxx
@@ -53,23 +53,23 @@
//============================================================================
class LoginDialog : public ModalDialog
{
+ FixedText aErrorFT;
FixedInfo aErrorInfo;
- FixedLine aErrorGB;
+ FixedLine aLogin1FL;
FixedInfo aRequestInfo;
+ FixedLine aLogin2FL;
FixedText aPathFT;
Edit aPathED;
- FixedInfo aPathInfo;
PushButton aPathBtn;
FixedText aNameFT;
Edit aNameED;
- FixedInfo aNameInfo;
FixedText aPasswordFT;
Edit aPasswordED;
FixedText aAccountFT;
Edit aAccountED;
CheckBox aSavePasswdBtn;
CheckBox aUseSysCredsCB;
- FixedLine aLoginGB;
+ FixedLine aButtonsFL;
OKButton aOKBtn;
CancelButton aCancelBtn;
HelpButton aHelpBtn;
@@ -85,36 +85,30 @@ public:
LoginDialog( Window* pParent, USHORT nFlags,
const String& rServer, const String* pRealm,
ResMgr * pResMgr );
+ virtual ~LoginDialog();
- String GetPath() const { return aPathED.GetText(); }
- void SetPath( const String& rNewPath )
- { aPathED.SetText( rNewPath );
- aPathInfo.SetText( rNewPath );}
- String GetName() const { return aNameED.GetText(); }
- void SetName( const String& rNewName );
- String GetPassword() const { return aPasswordED.GetText(); }
- void SetPassword( const String& rNew )
- { aPasswordED.SetText( rNew ); }
- String GetAccount() const { return aAccountED.GetText(); }
- void SetAccount( const String& rNew )
- { aAccountED.SetText( rNew ); }
- BOOL IsSavePassword() const
- { return aSavePasswdBtn.IsChecked(); }
- void SetSavePassword( BOOL bSave )
- { aSavePasswdBtn.Check( bSave ); }
- void SetSavePasswordText( const String& rTxt )
- { aSavePasswdBtn.SetText( rTxt ); }
- BOOL IsUseSystemCredentials() const
- { return aUseSysCredsCB.IsChecked(); }
+ String GetPath() const { return aPathED.GetText(); }
+ void SetPath( const String& rNewPath ) { aPathED.SetText( rNewPath ); }
+ String GetName() const { return aNameED.GetText(); }
+ void SetName( const String& rNewName ) { aNameED.SetText( rNewName ); }
+ String GetPassword() const { return aPasswordED.GetText(); }
+ void SetPassword( const String& rNew ) { aPasswordED.SetText( rNew ); }
+ String GetAccount() const { return aAccountED.GetText(); }
+ void SetAccount( const String& rNew ) { aAccountED.SetText( rNew ); }
+ BOOL IsSavePassword() const { return aSavePasswdBtn.IsChecked(); }
+ void SetSavePassword( BOOL bSave ) { aSavePasswdBtn.Check( bSave ); }
+ void SetSavePasswordText( const String& rTxt ) { aSavePasswdBtn.SetText( rTxt ); }
+ BOOL IsUseSystemCredentials() const { return aUseSysCredsCB.IsChecked(); }
void SetUseSystemCredentials( BOOL bUse );
- void SetErrorText( const String& rTxt )
- { aErrorInfo.SetText( rTxt ); }
- void SetLoginRequestText( const String& rTxt )
- { aRequestInfo.SetText( rTxt ); }
+ void SetErrorText( const String& rTxt ) { aErrorInfo.SetText( rTxt ); }
+ void SetLoginRequestText( const String& rTxt ) { aRequestInfo.SetText( rTxt ); }
void ClearPassword();
void ClearAccount();
};
+// -----------------------------------------------------------------------
+
+
//............................................................................
//............................................................................
diff --git a/uui/source/logindlg.src b/uui/source/logindlg.src
index ced176d10a..d9a0e538c9 100644..100755
--- a/uui/source/logindlg.src
+++ b/uui/source/logindlg.src
@@ -16,7 +16,7 @@
* 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).
+ *(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
@@ -42,166 +42,156 @@ ModalDialog DLG_UUI_LOGIN
Moveable = TRUE ;
OutputSize = TRUE ;
SVLook = TRUE ;
- Size = MAP_APPFONT ( 265 , 170 ) ;
- FixedText INFO_LOGIN_ERROR
+ Size = MAP_APPFONT( 177 , 247 ) ;
+ Text [ en-US ] = "Authentication Required" ;
+
+ FixedText FT_LOGIN_ERROR
+ {
+ Pos = MAP_APPFONT( 6 , 6 ) ;
+ Size = MAP_APPFONT( 165 , 8 ) ;
+ Text [ en-US ] = "Message from server:" ;
+ };
+
+ FixedText FT_INFO_LOGIN_ERROR
{
- Pos = MAP_APPFONT ( 12 , 14 ) ;
- Size = MAP_APPFONT ( 185 , 18 ) ;
+ Pos = MAP_APPFONT( 6 , 14 ) ;
+ Size = MAP_APPFONT( 165 , 3*8 ) ;
WordBreak = TRUE ;
};
- FixedLine GB_LOGIN_ERROR
+
+ FixedLine FL_LOGIN_1
{
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 197 , 8 ) ;
- Text [ en-US ] = "Message from server" ;
+ Pos = MAP_APPFONT( 6 , 41 ) ;
+ Size = MAP_APPFONT( 165 , 8 ) ;
};
- FixedText INFO_LOGIN_REQUEST
+
+ FixedText FT_INFO_LOGIN_REQUEST
{
- Pos = MAP_APPFONT ( 12 , 55 ) ;
- Size = MAP_APPFONT ( 185 , 18 ) ;
+ Pos = MAP_APPFONT( 6 , 52 ) ;
+ Size = MAP_APPFONT( 165 , 2*8 ) ;
WordBreak = TRUE ;
- Text [ en-US ] = "Enter the user name and password for %1 here." ;
+ Text [ en-US ] = "Enter user name and password for: \n%1" ;
+ };
+
+ String STR_LOGIN_REALM
+ {
+ Text [ en-US ] = "Enter user name and password for: \n\"%2\" on %1" ;
};
+
+ FixedLine FL_LOGIN_2
+ {
+ Pos = MAP_APPFONT( 6 , 71 ) ;
+ Size = MAP_APPFONT( 165 , 8 ) ;
+ };
+
FixedText FT_LOGIN_PATH
{
- Pos = MAP_APPFONT ( 12 , 77 ) ;
- Size = MAP_APPFONT ( 57 , 10 ) ;
+ Pos = MAP_APPFONT( 6 , 84 ) ;
+ Size = MAP_APPFONT( 112 , 8 ) ;
Text [ en-US ] = "~Path" ;
};
+
Edit ED_LOGIN_PATH
{
+ HelpId = HID_LOGIN_DLG_PATH;
Border = TRUE ;
- Pos = MAP_APPFONT ( 72 , 76 ) ;
- Size = MAP_APPFONT ( 108 , 12 ) ;
- };
- FixedText INFO_LOGIN_PATH
- {
- Hide = TRUE ;
- Pos = MAP_APPFONT ( 72 , 77 ) ;
- Size = MAP_APPFONT ( 125 , 10 ) ;
+ Pos = MAP_APPFONT( 6 , 95 ) ;
+ Size = MAP_APPFONT( 112 , 12 ) ;
};
PushButton BTN_LOGIN_PATH
{
- Pos = MAP_APPFONT ( 183 , 75 ) ;
- Size = MAP_APPFONT ( 14 , 14 ) ;
- Text = "~..." ;
+ HelpId = HID_LOGIN_DLG_BROWSE;
+ Pos = MAP_APPFONT( 121 , 94 ) ;
+ Size = MAP_APPFONT( 50 , 14 ) ;
+ Text = "~Browse..." ;
};
+
FixedText FT_LOGIN_USERNAME
{
- Pos = MAP_APPFONT ( 12 , 92 ) ;
- Size = MAP_APPFONT ( 57 , 10 ) ;
+ Pos = MAP_APPFONT( 6 , 110 ) ;
+ Size = MAP_APPFONT( 165 , 8 ) ;
Text [ en-US ] = "~User name" ;
};
+
Edit ED_LOGIN_USERNAME
{
+ HelpId = HID_LOGIN_DLG_USER_NAME;
Border = TRUE ;
- Pos = MAP_APPFONT ( 72 , 91 ) ;
- Size = MAP_APPFONT ( 125 , 12 ) ;
- };
- FixedText INFO_LOGIN_USERNAME
- {
- Hide = TRUE ;
- Pos = MAP_APPFONT ( 72 , 92 ) ;
- Size = MAP_APPFONT ( 125 , 10 ) ;
+ Pos = MAP_APPFONT( 6 , 121 ) ;
+ Size = MAP_APPFONT( 165 , 12 ) ;
};
+
FixedText FT_LOGIN_PASSWORD
{
- Pos = MAP_APPFONT ( 12 , 107 ) ;
- Size = MAP_APPFONT ( 57 , 10 ) ;
+ Pos = MAP_APPFONT( 6 , 136 ) ;
+ Size = MAP_APPFONT( 165 , 8 ) ;
Text [ en-US ] = "Pass~word" ;
};
+
Edit ED_LOGIN_PASSWORD
{
+ HelpId = HID_LOGIN_DLG_PASSWORD;
Border = TRUE ;
- Pos = MAP_APPFONT ( 72 , 106 ) ;
- Size = MAP_APPFONT ( 125 , 12 ) ;
+ Pos = MAP_APPFONT( 6 , 147 ) ;
+ Size = MAP_APPFONT( 165 , 12 ) ;
PassWord = TRUE ;
};
+
FixedText FT_LOGIN_ACCOUNT
{
- Pos = MAP_APPFONT ( 12 , 122 ) ;
- Size = MAP_APPFONT ( 57 , 10 ) ;
+ Pos = MAP_APPFONT( 6 , 162 ) ;
+ Size = MAP_APPFONT( 165 , 8 ) ;
Text [ en-US ] = "A~ccount";
};
+
Edit ED_LOGIN_ACCOUNT
{
+ HelpId = HID_LOGIN_DLG_ACCOUNT;
Border = TRUE ;
- Pos = MAP_APPFONT ( 72 , 121 ) ;
- Size = MAP_APPFONT ( 125 , 12 ) ;
+ Pos = MAP_APPFONT( 6 , 173 ) ;
+ Size = MAP_APPFONT( 165 , 12 ) ;
PassWord = TRUE ;
};
+
CheckBox CB_LOGIN_SAVEPASSWORD
{
- Pos = MAP_APPFONT ( 12 , 136 ) ;
- Size = MAP_APPFONT ( 185 , 10 ) ;
- Text [ en-US ] = "~Save password" ;
+ HelpId = HID_LOGIN_DLG_REMEMBER_PASSWORD;
+ Pos = MAP_APPFONT( 6 , 190 ) ;
+ Size = MAP_APPFONT( 165 , 10 ) ;
+ Text [ en-US ] = "~Remember password" ;
};
+
CheckBox CB_LOGIN_USESYSCREDS
{
- Pos = MAP_APPFONT ( 12 , 148 ) ;
- Size = MAP_APPFONT ( 185 , 10 ) ;
- Text [ en-US ] = "~Use System Credentials" ;
+ HelpId = HID_LOGIN_DLG_USE_SYSTEM_CREDENTIALS;
+ Pos = MAP_APPFONT( 6 , 203 ) ;
+ Size = MAP_APPFONT( 165 , 10 ) ;
+ Text [ en-US ] = "~Use system credentials" ;
};
- FixedLine GB_LOGIN_LOGIN
+
+ FixedLine FL_BUTTONS
{
- Pos = MAP_APPFONT ( 7 , 44 ) ;
- Size = MAP_APPFONT ( 197 , 8 ) ;
- Text [ en-US ] = "Log in" ;
+ Pos = MAP_APPFONT( 0 , 216 ) ;
+ Size = MAP_APPFONT( 177 , 8 ) ;
};
+
OKButton BTN_LOGIN_OK
{
- Pos = MAP_APPFONT ( 209 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT( 6 , 227 ) ;
+ Size = MAP_APPFONT( 50 , 14 ) ;
DefButton = TRUE ;
};
+
CancelButton BTN_LOGIN_CANCEL
{
- Pos = MAP_APPFONT ( 209 , 23 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT( 66 , 227 ) ;
+ Size = MAP_APPFONT( 50 , 14 ) ;
};
+
HelpButton BTN_LOGIN_HELP
{
- Pos = MAP_APPFONT ( 209 , 43 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT( 121 , 227 ) ;
+ Size = MAP_APPFONT( 50 , 14 ) ;
};
- String STR_LOGIN_REALM
- {
- Text [ en-US ] = "Please enter user name and password for \"%2\" on %1 here." ;
- };
- Text [ en-US ] = "User Name and Password Required" ;
};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/uui/source/loginerr.hxx b/uui/source/loginerr.hxx
index 39e5b81caf..ec1317dbd8 100644..100755
--- a/uui/source/loginerr.hxx
+++ b/uui/source/loginerr.hxx
@@ -25,8 +25,8 @@
*
************************************************************************/
-#ifndef _LOGINERR_HXX
-#define _LOGINERR_HXX
+#ifndef m_LOGINERR_HXX
+#define m_LOGINERR_HXX
#include <tools/string.hxx>
@@ -43,61 +43,66 @@
class LoginErrorInfo
{
private:
- String _aTitle;
- String _aServer;
- String _aAccount;
- String _aUserName;
- String _aPassword;
- String _aPath;
- String _aErrorText;
- BYTE _nFlags;
- USHORT _nRet;
+ String m_aTitle;
+ String m_aServer;
+ String m_aAccount;
+ String m_aUserName;
+ String m_aPassword;
+ String m_aPasswordToModify;
+ String m_aPath;
+ String m_aErrorText;
+ BYTE m_nFlags;
+ USHORT m_nRet;
+ bool m_bRecommendToOpenReadonly;
public:
LoginErrorInfo()
- : _nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ),
- _nRet( ERRCODE_BUTTON_CANCEL )
- {}
-
- const String& GetTitle() const { return _aTitle; }
- const String& GetServer() const { return _aServer; }
- const String& GetAccount() const { return _aAccount; }
- const String& GetUserName() const { return _aUserName; }
- const String& GetPassword() const { return _aPassword; }
- const String& GetPath() const { return _aPath; }
- const String& GetErrorText() const { return _aErrorText; }
-
- BOOL GetCanRememberPassword() const
- { return ( _nFlags & LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD ); }
- BOOL GetIsRememberPersistent() const
- { return ( _nFlags & LOGINERROR_FLAG_REMEMBER_PERSISTENT ); }
- BOOL GetIsRememberPassword() const
- { return ( _nFlags & LOGINERROR_FLAG_IS_REMEMBER_PASSWORD ); }
+ : m_nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ),
+ m_nRet( ERRCODE_BUTTON_CANCEL )
+ {
+ }
+
+ const String& GetTitle() const { return m_aTitle; }
+ const String& GetServer() const { return m_aServer; }
+ const String& GetAccount() const { return m_aAccount; }
+ const String& GetUserName() const { return m_aUserName; }
+ const String& GetPassword() const { return m_aPassword; }
+ const String& GetPasswordToModify() const { return m_aPasswordToModify; }
+ const bool IsRecommendToOpenReadonly() const { return m_bRecommendToOpenReadonly; }
+ const String& GetPath() const { return m_aPath; }
+ const String& GetErrorText() const { return m_aErrorText; }
+ BOOL GetCanRememberPassword() const { return ( m_nFlags & LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD ); }
+ BOOL GetIsRememberPersistent() const { return ( m_nFlags & LOGINERROR_FLAG_REMEMBER_PERSISTENT ); }
+ BOOL GetIsRememberPassword() const { return ( m_nFlags & LOGINERROR_FLAG_IS_REMEMBER_PASSWORD ); }
BOOL GetCanUseSystemCredentials() const
- { return ( _nFlags & LOGINERROR_FLAG_CAN_USE_SYSCREDS ); }
+ { return ( m_nFlags & LOGINERROR_FLAG_CAN_USE_SYSCREDS ); }
BOOL GetIsUseSystemCredentials() const
- { return ( _nFlags & LOGINERROR_FLAG_IS_USE_SYSCREDS ) ==
+ { return ( m_nFlags & LOGINERROR_FLAG_IS_USE_SYSCREDS ) ==
LOGINERROR_FLAG_IS_USE_SYSCREDS; }
- BYTE GetFlags() const { return _nFlags; }
- USHORT GetResult() const { return _nRet; }
+ BYTE GetFlags() const { return m_nFlags; }
+ USHORT GetResult() const { return m_nRet; }
void SetTitle( const String& aTitle )
- { _aTitle = aTitle; }
+ { m_aTitle = aTitle; }
void SetServer( const String& aServer )
- { _aServer = aServer; }
+ { m_aServer = aServer; }
void SetAccount( const String& aAccount )
- { _aAccount = aAccount; }
+ { m_aAccount = aAccount; }
void SetUserName( const String& aUserName )
- { _aUserName = aUserName; }
+ { m_aUserName = aUserName; }
void SetPassword( const String& aPassword )
- { _aPassword = aPassword; }
+ { m_aPassword = aPassword; }
+ void SetPasswordToModify( const String& aPassword )
+ { m_aPasswordToModify = aPassword; }
+ void SetRecommendToOpenReadonly( bool bVal )
+ { m_bRecommendToOpenReadonly = bVal; }
void SetPath( const String& aPath )
- { _aPath = aPath; }
+ { m_aPath = aPath; }
void SetErrorText( const String& aErrorText )
- { _aErrorText = aErrorText; }
+ { m_aErrorText = aErrorText; }
void SetFlags( BYTE nFlags )
- { _nFlags = nFlags; }
+ { m_nFlags = nFlags; }
inline void SetCanRememberPassword( BOOL bSet );
inline void SetIsRememberPassword( BOOL bSet );
@@ -107,64 +112,67 @@ public:
inline void SetIsUseSystemCredentials( BOOL bSet );
inline void SetModifyAccount( BOOL bSet );
inline void SetModifyUserName( BOOL bSet );
+
void SetResult( USHORT nRet )
- { _nRet = nRet; }
+ { m_nRet = nRet; }
};
inline void LoginErrorInfo::SetCanRememberPassword( BOOL bSet )
{
if ( bSet )
- _nFlags |= LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD;
+ m_nFlags |= LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD;
else
- _nFlags &= ~LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD;
+ m_nFlags &= ~LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD;
}
inline void LoginErrorInfo::SetIsRememberPassword( BOOL bSet )
{
if ( bSet )
- _nFlags |= LOGINERROR_FLAG_IS_REMEMBER_PASSWORD;
+ m_nFlags |= LOGINERROR_FLAG_IS_REMEMBER_PASSWORD;
else
- _nFlags &= ~LOGINERROR_FLAG_IS_REMEMBER_PASSWORD;
+ m_nFlags &= ~LOGINERROR_FLAG_IS_REMEMBER_PASSWORD;
}
inline void LoginErrorInfo::SetIsRememberPersistent( BOOL bSet )
{
if ( bSet )
- _nFlags |= LOGINERROR_FLAG_REMEMBER_PERSISTENT;
+ m_nFlags |= LOGINERROR_FLAG_REMEMBER_PERSISTENT;
else
- _nFlags &= ~LOGINERROR_FLAG_REMEMBER_PERSISTENT;
+ m_nFlags &= ~LOGINERROR_FLAG_REMEMBER_PERSISTENT;
}
inline void LoginErrorInfo::SetCanUseSystemCredentials( BOOL bSet )
{
if ( bSet )
- _nFlags |= LOGINERROR_FLAG_CAN_USE_SYSCREDS;
+ m_nFlags |= LOGINERROR_FLAG_CAN_USE_SYSCREDS;
else
- _nFlags &= ~LOGINERROR_FLAG_CAN_USE_SYSCREDS;
+ m_nFlags &= ~LOGINERROR_FLAG_CAN_USE_SYSCREDS;
}
inline void LoginErrorInfo::SetIsUseSystemCredentials( BOOL bSet )
{
if ( bSet )
- _nFlags |= LOGINERROR_FLAG_IS_USE_SYSCREDS;
+ m_nFlags |= LOGINERROR_FLAG_IS_USE_SYSCREDS;
else
- _nFlags &= ~LOGINERROR_FLAG_IS_USE_SYSCREDS;
+ m_nFlags &= ~LOGINERROR_FLAG_IS_USE_SYSCREDS;
}
inline void LoginErrorInfo::SetModifyAccount( BOOL bSet )
{
if ( bSet )
- _nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT;
+ m_nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT;
else
- _nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT;
+ m_nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT;
}
inline void LoginErrorInfo::SetModifyUserName( BOOL bSet )
{
if ( bSet )
- _nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME;
+ m_nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME;
else
- _nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME;
+ m_nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME;
}
#endif
+
+
diff --git a/uui/source/passwordcontainer.hxx b/uui/source/passwordcontainer.hxx
index 36db115bf3..aafcd1c4c1 100644
--- a/uui/source/passwordcontainer.hxx
+++ b/uui/source/passwordcontainer.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* 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
diff --git a/uui/source/passworddlg.cxx b/uui/source/passworddlg.cxx
index 4e644a980f..b66659ff6e 100644..100755
--- a/uui/source/passworddlg.cxx
+++ b/uui/source/passworddlg.cxx
@@ -48,30 +48,34 @@ IMPL_LINK( PasswordDialog, OKHdl_Impl, OKButton *, EMPTYARG )
// -----------------------------------------------------------------------
-PasswordDialog::PasswordDialog
-(
+PasswordDialog::PasswordDialog(
Window* _pParent,
::com::sun::star::task::PasswordRequestMode nDlgMode,
ResMgr * pResMgr,
- rtl::OUString& aDocURL
- )
+ rtl::OUString& aDocURL,
+ bool bOpenToModify )
+
:ModalDialog( _pParent, ResId( DLG_UUI_PASSWORD, *pResMgr ) )
- ,aFTPassword ( this, ResId( FT_PASSWORD, *pResMgr ) )
- ,aEDPassword ( this, ResId( ED_PASSWORD, *pResMgr ) )
- ,aOKBtn ( this, ResId( BTN_PASSWORD_OK, *pResMgr ) )
- ,aCancelBtn ( this, ResId( BTN_PASSWORD_CANCEL, *pResMgr ) )
- ,aHelpBtn ( this, ResId( BTN_PASSWORD_HELP, *pResMgr ) )
- ,aFixedLine1 ( this, ResId( FL_FIXED_LINE_1, *pResMgr ) )
- ,nDialogMode ( nDlgMode )
- ,pResourceMgr ( pResMgr )
+ ,aFTPassword( this, ResId( FT_PASSWORD, *pResMgr ))
+ ,aEDPassword( this, ResId( ED_PASSWORD, *pResMgr ))
+ ,aOKBtn ( this, ResId( BTN_PASSWORD_OK, *pResMgr ))
+ ,aCancelBtn ( this, ResId( BTN_PASSWORD_CANCEL, *pResMgr ))
+ ,aHelpBtn ( this, ResId( BTN_PASSWORD_HELP, *pResMgr ))
+ ,aFixedLine1( this, ResId( FL_FIXED_LINE_1, *pResMgr ))
+ ,nDialogMode( nDlgMode )
+ ,pResourceMgr ( pResMgr )
{
if( nDialogMode == ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER )
{
- String aErrorMsg( ResId( STR_ERROR_PASSWORD_WRONG, *pResourceMgr ));
+ USHORT nErrStrId = bOpenToModify ? STR_ERROR_PASSWORD_TO_MODIFY_WRONG : STR_ERROR_PASSWORD_TO_OPEN_WRONG;
+ String aErrorMsg( ResId( nErrStrId, *pResourceMgr ));
ErrorBox aErrorBox( _pParent, WB_OK, aErrorMsg );
aErrorBox.Execute();
}
+ USHORT nStrId = bOpenToModify ? STR_ENTER_PASSWORD_TO_MODIFY : STR_ENTER_PASSWORD_TO_OPEN;
+ aFTPassword.SetText( String( ResId( nStrId, *pResourceMgr ) ) );
+
FreeResource();
aFTPassword.SetText( aFTPassword.GetText() + aDocURL );
diff --git a/uui/source/passworddlg.hxx b/uui/source/passworddlg.hxx
index 44d30ab57b..e5a0a7885b 100644..100755
--- a/uui/source/passworddlg.hxx
+++ b/uui/source/passworddlg.hxx
@@ -50,7 +50,7 @@ class PasswordDialog : public ModalDialog
DECL_LINK( OKHdl_Impl, OKButton * );
public:
- PasswordDialog( Window* pParent, ::com::sun::star::task::PasswordRequestMode nDlgMode, ResMgr * pResMgr, ::rtl::OUString& aDocURL );
+ PasswordDialog( Window* pParent, ::com::sun::star::task::PasswordRequestMode nDlgMode, ResMgr * pResMgr, ::rtl::OUString& aDocURL, bool bOpenToModify = false );
String GetPassword() const { return aEDPassword.GetText(); }
diff --git a/uui/source/passworddlg.src b/uui/source/passworddlg.src
index 24fce39772..7a96c4aa5a 100644..100755
--- a/uui/source/passworddlg.src
+++ b/uui/source/passworddlg.src
@@ -41,27 +41,33 @@ ModalDialog DLG_UUI_PASSWORD
Moveable = TRUE ;
OutputSize = TRUE ;
SVLook = TRUE ;
- Size = MAP_APPFONT( 145, 75 );
+ Size = MAP_APPFONT( 145, 91 );
Text [ en-US ] = "Enter password";
+
FixedText FT_PASSWORD
{
Pos = MAP_APPFONT( 3, 4 );
Size = MAP_APPFONT( 139, 28 );
- Text [ en-US ] = "Enter password to open file: \n";
WordBreak = TRUE;
};
Edit ED_PASSWORD
{
- Pos = MAP_APPFONT( 3, 35 );
+ Pos = MAP_APPFONT( 3, 51 );
Size = MAP_APPFONT( 139, 13 );
Border = TRUE ;
PassWord = TRUE ;
};
+ FixedLine FL_FIXED_LINE_1
+ {
+ Pos = MAP_APPFONT( 0, 66 );
+ Size = MAP_APPFONT( 145, 6 );
+ };
+
OKButton BTN_PASSWORD_OK
{
- Pos = MAP_APPFONT( 27, 56 );
+ Pos = MAP_APPFONT( 27, 72 );
Size = MAP_APPFONT( 37, 15 );
DefButton = TRUE ;
DefButton = TRUE;
@@ -69,20 +75,24 @@ ModalDialog DLG_UUI_PASSWORD
CancelButton BTN_PASSWORD_CANCEL
{
- Pos = MAP_APPFONT( 66, 56 );
+ Pos = MAP_APPFONT( 66, 72 );
Size = MAP_APPFONT( 37, 15 );
};
HelpButton BTN_PASSWORD_HELP
{
- Pos = MAP_APPFONT( 105, 56 );
+ Pos = MAP_APPFONT( 105, 72 );
Size = MAP_APPFONT( 37, 15 );
};
- FixedLine FL_FIXED_LINE_1
+ String STR_ENTER_PASSWORD_TO_OPEN
{
- Pos = MAP_APPFONT( 0, 50 );
- Size = MAP_APPFONT( 145, 6 );
+ Text [ en-US ] = "Enter password to open file: \n";
+ };
+
+ String STR_ENTER_PASSWORD_TO_MODIFY
+ {
+ Text [ en-US ] = "Enter password to modify file: \n";
};
};
diff --git a/uui/source/passworderrs.src b/uui/source/passworderrs.src
index 124a360db9..6476e28319 100644..100755
--- a/uui/source/passworderrs.src
+++ b/uui/source/passworderrs.src
@@ -31,9 +31,14 @@
#include <ids.hrc>
#endif
-String STR_ERROR_PASSWORD_WRONG
+String STR_ERROR_PASSWORD_TO_OPEN_WRONG
{
- Text [ en-US ] = "The password is incorrect. The document cannot be opened.";
+ Text [ en-US ] = "The password is incorrect. The file cannot be opened.";
+};
+
+String STR_ERROR_PASSWORD_TO_MODIFY_WRONG
+{
+ Text [ en-US ] = "The password is incorrect. The file cannot be modified.";
};
String STR_ERROR_MASTERPASSWORD_WRONG
diff --git a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
index edcefa8778..afbd896b2b 100644
--- a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
+++ b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
@@ -34,8 +34,12 @@
typedef InheritedHelperInterfaceImpl1< ov::XApplicationBase > ApplicationBase_BASE;
+struct VbaApplicationBase_Impl;
+
class VBAHELPER_DLLPUBLIC VbaApplicationBase : public ApplicationBase_BASE
{
+ VbaApplicationBase_Impl* m_pImpl;
+
protected:
VbaApplicationBase( const css::uno::Reference< css::uno::XComponentContext >& xContext );
virtual ~VbaApplicationBase();
@@ -44,16 +48,23 @@ protected:
public:
// XHelperInterface ( parent is itself )
virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return this; }
-
+
virtual sal_Bool SAL_CALL getScreenUpdating() throw (css::uno::RuntimeException);
virtual void SAL_CALL setScreenUpdating(sal_Bool bUpdate) throw (css::uno::RuntimeException);
virtual sal_Bool SAL_CALL getDisplayStatusBar() throw (css::uno::RuntimeException);
virtual void SAL_CALL setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getInteractive() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setInteractive( ::sal_Bool bInteractive ) throw (::com::sun::star::uno::RuntimeException);
virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getVersion() throw (css::uno::RuntimeException);
virtual void SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL OnTime( const ::com::sun::star::uno::Any& aEarliestTime, const ::rtl::OUString& aFunction, const ::com::sun::star::uno::Any& aLatestTime, const ::com::sun::star::uno::Any& aSchedule ) throw (::com::sun::star::uno::RuntimeException);
virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Undo( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL Quit( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getVBE() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL SAL_CALL getVBProjects() throw (css::uno::RuntimeException);
+
// XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
index 40b920251e..20b220c1f5 100644
--- a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
+++ b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
@@ -24,6 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#ifndef OOVBAAPI_VBA_COLLECTION_IMPL_HXX
#define OOVBAAPI_VBA_COLLECTION_IMPL_HXX
@@ -44,8 +45,91 @@
#include <vector>
+// ============================================================================
+
typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE;
+// ============================================================================
+
+/** A wrapper that holds a com.sun.star.container.XIndexAccess and provides a
+ com.sun.star.container.XEnumeration.
+
+ Can be used to provide an enumeration from an index container that contains
+ completely constructed/initialized VBA implementation objects. CANNOT be
+ used to provide an enumeration from an index container with other objects
+ (e.g. UNO objects) where construction of the VBA objects is needed first.
+ */
+class VBAHELPER_DLLPUBLIC SimpleIndexAccessToEnumeration : public EnumerationHelper_BASE
+{
+public:
+ explicit SimpleIndexAccessToEnumeration(
+ const css::uno::Reference< css::container::XIndexAccess >& rxIndexAccess ) throw (css::uno::RuntimeException) :
+ mxIndexAccess( rxIndexAccess ), mnIndex( 0 ) {}
+
+ virtual sal_Bool SAL_CALL hasMoreElements() throw (css::uno::RuntimeException)
+ {
+ return mnIndex < mxIndexAccess->getCount();
+ }
+
+ virtual css::uno::Any SAL_CALL nextElement() throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {
+ if( !hasMoreElements() )
+ throw css::container::NoSuchElementException();
+ return mxIndexAccess->getByIndex( mnIndex++ );
+ }
+
+private:
+ css::uno::Reference< css::container::XIndexAccess > mxIndexAccess;
+ sal_Int32 mnIndex;
+};
+
+// ============================================================================
+
+/** A wrapper that holds a com.sun.star.container.XEnumeration or a
+ com.sun.star.container.XIndexAccess and provides an enumeration of VBA objects.
+
+ The method nextElement() needs to be implemented by the derived class. This
+ class can be used to convert an enumeration or an index container
+ containing UNO objects to an enumeration providing the related VBA objects.
+ */
+class VBAHELPER_DLLPUBLIC SimpleEnumerationBase : public EnumerationHelper_BASE
+{
+public:
+ explicit SimpleEnumerationBase(
+ const css::uno::Reference< ov::XHelperInterface >& rxParent,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::container::XEnumeration >& rxEnumeration ) throw (css::uno::RuntimeException) :
+ mxParent( rxParent ), mxContext( rxContext ), mxEnumeration( rxEnumeration ) {}
+
+ explicit SimpleEnumerationBase(
+ const css::uno::Reference< ov::XHelperInterface >& rxParent,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::container::XIndexAccess >& rxIndexAccess ) throw (css::uno::RuntimeException) :
+ mxParent( rxParent ), mxContext( rxContext ), mxEnumeration( new SimpleIndexAccessToEnumeration( rxIndexAccess ) ) {}
+
+ virtual sal_Bool SAL_CALL hasMoreElements() throw (css::uno::RuntimeException)
+ {
+ return mxEnumeration->hasMoreElements();
+ }
+
+ virtual css::uno::Any SAL_CALL nextElement() throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {
+ return createCollectionObject( mxEnumeration->nextElement() );
+ }
+
+ /** Derived classes implement creation of a VBA implementation object from
+ the passed container element. */
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& rSource ) = 0;
+
+protected:
+ css::uno::Reference< ov::XHelperInterface > mxParent;
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+ css::uno::Reference< css::container::XEnumeration > mxEnumeration;
+};
+
+// ============================================================================
+
+// deprecated, use SimpleEnumerationBase instead!
class VBAHELPER_DLLPUBLIC EnumerationHelperImpl : public EnumerationHelper_BASE
{
protected:
@@ -57,7 +141,7 @@ public:
virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException) { return m_xEnumeration->hasMoreElements(); }
};
-// a wrapper class for a providing a XIndexAccess, XNameAccess, XEnumerationAccess impl based on providing a vector of interfaces
+// a wrapper class for a providing a XIndexAccess, XNameAccess, XEnumerationAccess impl based on providing a vector of interfaces
// only requirement is the object needs to implement XName
@@ -181,6 +265,14 @@ protected:
// need to adjust for vba index ( for which first element is 1 )
return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) );
}
+
+ virtual void UpdateCollectionIndex( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess )
+ {
+ css::uno::Reference< css::container::XNameAccess > xNameAccess( xIndexAccess, css::uno::UNO_QUERY_THROW );
+ m_xIndexAccess = xIndexAccess;
+ m_xNameAccess = xNameAccess;
+ }
+
public:
ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ){ m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
//XCollection
diff --git a/vbahelper/inc/vbahelper/vbadocumentbase.hxx b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
index 68703aa095..29335304db 100644
--- a/vbahelper/inc/vbahelper/vbadocumentbase.hxx
+++ b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
@@ -53,6 +53,9 @@ public:
virtual sal_Bool SAL_CALL getSaved() throw (css::uno::RuntimeException);
virtual void SAL_CALL setSaved( sal_Bool bSave ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getVBProject() throw (css::uno::RuntimeException); // Michhael E. Bohn
+
+
// Methods
virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges,
const css::uno::Any &aFileName,
diff --git a/vbahelper/inc/vbahelper/vbafontbase.hxx b/vbahelper/inc/vbahelper/vbafontbase.hxx
index 5e79ec54c6..c49be459d5 100644
--- a/vbahelper/inc/vbahelper/vbafontbase.hxx
+++ b/vbahelper/inc/vbahelper/vbafontbase.hxx
@@ -63,8 +63,15 @@ class VBAHELPER_DLLPUBLIC VbaFontBase : public VbaFontBase_BASE
protected:
css::uno::Reference< css::beans::XPropertySet > mxFont;
css::uno::Reference< css::container::XIndexAccess > mxPalette;
+ bool mbFormControl;
+
public:
- VbaFontBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPalette, css::uno::Reference< css::beans::XPropertySet > xPropertySet ) throw ( css::uno::RuntimeException );
+ VbaFontBase(
+ const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::container::XIndexAccess >& xPalette,
+ const css::uno::Reference< css::beans::XPropertySet >& xPropertySet,
+ bool bFormControl = false ) throw ( css::uno::RuntimeException );
virtual ~VbaFontBase();// {}
// Attributes
diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx
index dad98b977e..024b0d3aa8 100644
--- a/vbahelper/inc/vbahelper/vbahelper.hxx
+++ b/vbahelper/inc/vbahelper/vbahelper.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/awt/XUnitConversion.hpp>
#include <basic/basmgr.hxx>
#include <basic/sberrors.hxx>
#include <cppuhelper/implbase1.hxx>
@@ -74,8 +75,8 @@ namespace ooo
VBAHELPER_DLLPUBLIC css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException);
VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ;
- VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ;
+ VBAHELPER_DLLPUBLIC void dispatchRequests( const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString& aUrl );
+ VBAHELPER_DLLPUBLIC void dispatchRequests( const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString& aUrl, const css::uno::Sequence< css::beans::PropertyValue >& sProps );
VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON );
VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 );
VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 );
@@ -92,7 +93,9 @@ namespace ooo
VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic )
VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
VBAHELPER_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
- VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
+ VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical);
+ VBAHELPER_DLLPUBLIC sal_Int32 PointsToHmm( double fPoints );
+ VBAHELPER_DLLPUBLIC double HmmToPoints( sal_Int32 nHmm );
VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& );
VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite );
VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue ) throw ( css::uno::RuntimeException );
@@ -103,8 +106,6 @@ class VBAHELPER_DLLPUBLIC Millimeter
{
//Factor to translate between points and hundredths of millimeters:
private:
- static const double factor;
-
double m_nMillimeter;
public:
@@ -178,12 +179,19 @@ public:
virtual double getWidth();
virtual void setWidth( double nWidth);
};
+
#define VBA_LEFT "PositionX"
#define VBA_TOP "PositionY"
+#define VBA_HEIGHT "Height"
+#define VBA_WIDTH "Width"
class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes
{
-
+ css::uno::Reference< css::awt::XUnitConversion > mxControlUnits;
css::uno::Reference< css::beans::XPropertySet > mxModel;
+
+ sal_Int32 ConvertLogicToPixel( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nSourceUnit );
+ sal_Int32 ConvertPixelToLogic( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nTargetUnit );
+
public:
UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl );
virtual double getLeft();
diff --git a/vbahelper/inc/vbahelper/vbahelperinterface.hxx b/vbahelper/inc/vbahelper/vbahelperinterface.hxx
index 3f1da84e22..45fb518572 100644
--- a/vbahelper/inc/vbahelper/vbahelperinterface.hxx
+++ b/vbahelper/inc/vbahelper/vbahelperinterface.hxx
@@ -115,4 +115,57 @@ public:
InheritedHelperInterfaceImpl1< Ifc1 > ( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
};
+
+// ============================================================================
+
+/** Helper macro to implement the method 'getServiceImplName()' of the
+ 'ooo.vba.XHelperInterface' interface. Will return the class name as service
+ implementation name.
+ */
+#define VBAHELPER_IMPL_GETSERVICEIMPLNAME( classname ) \
+::rtl::OUString& classname::getServiceImplName() \
+{ \
+ static ::rtl::OUString saImplName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( #classname ) ); \
+ return saImplName; \
+}
+
+// ----------------------------------------------------------------------------
+
+/** Helper macro to implement the method 'getServiceNames()' for a single
+ service name.
+ */
+#define VBAHELPER_IMPL_GETSERVICENAMES( classname, servicename ) \
+css::uno::Sequence< ::rtl::OUString > classname::getServiceNames() \
+{ \
+ static css::uno::Sequence< ::rtl::OUString > saServiceNames; \
+ if( saServiceNames.getLength() == 0 ) \
+ { \
+ saServiceNames.realloc( 1 ); \
+ saServiceNames[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( servicename ) ); \
+ } \
+ return saServiceNames; \
+}
+
+// ----------------------------------------------------------------------------
+
+/** Helper macro to declare the methods 'getServiceImplName()' and
+ 'getServiceNames()' of the 'ooo.vba.XHelperInterface' interface in a class
+ declaration.
+ */
+#define VBAHELPER_DECL_XHELPERINTERFACE \
+ virtual ::rtl::OUString& getServiceImplName(); \
+ virtual css::uno::Sequence< ::rtl::OUString > getServiceNames();
+
+// ----------------------------------------------------------------------------
+
+/** Helper macro to implement the methods 'getServiceImplName()' and
+ 'getServiceNames()' of the 'ooo.vba.XHelperInterface' interface. Will
+ return the class name as service implementation name.
+ */
+#define VBAHELPER_IMPL_XHELPERINTERFACE( classname, servicename ) \
+VBAHELPER_IMPL_GETSERVICEIMPLNAME( classname ) \
+VBAHELPER_IMPL_GETSERVICENAMES( classname, servicename )
+
+// ============================================================================
+
#endif
diff --git a/vbahelper/source/msforms/makefile.mk b/vbahelper/source/msforms/makefile.mk
index 7c61e4302b..5fce64649d 100644
--- a/vbahelper/source/msforms/makefile.mk
+++ b/vbahelper/source/msforms/makefile.mk
@@ -58,6 +58,7 @@ SLOFILES=\
$(SLO)$/vbamultipage.obj \
$(SLO)$/vbalistcontrolhelper.obj \
$(SLO)$/vbaspinbutton.obj \
+ $(SLO)$/vbasystemaxcontrol.obj \
$(SLO)$/vbaimage.obj \
$(SLO)$/vbapages.obj \
$(SLO)$/vbauserform.obj \
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 077e7626f2..7485073321 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -57,6 +57,7 @@
#include "vbaprogressbar.hxx"
#include "vbamultipage.hxx"
#include "vbaspinbutton.hxx"
+#include "vbasystemaxcontrol.hxx"
#include "vbaimage.hxx"
#include <vbahelper/helperdecl.hxx>
@@ -254,6 +255,22 @@ void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException)
xWin->setFocus();
}
+void SAL_CALL ScVbaControl::Move( double Left, double Top, const uno::Any& Width, const uno::Any& Height )
+ throw ( uno::RuntimeException )
+{
+ double nWidth = 0.0;
+ double nHeight = 0.0;
+
+ setLeft( Left );
+ setTop( Top );
+
+ if ( Width >>= nWidth )
+ setWidth( nWidth );
+
+ if ( Height >>= nHeight )
+ setHeight( nHeight );
+}
+
rtl::OUString SAL_CALL
ScVbaControl::getControlSource() throw (uno::RuntimeException)
{
@@ -368,6 +385,20 @@ ScVbaControl::setControlTipText( const rtl::OUString& rsToolTip ) throw (css::un
m_xProps->setPropertyValue
(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ), uno::makeAny( rsToolTip ) );
}
+
+::rtl::OUString SAL_CALL ScVbaControl::getTag()
+ throw (css::uno::RuntimeException)
+{
+ return m_aControlTag;
+}
+
+void SAL_CALL ScVbaControl::setTag( const ::rtl::OUString& aTag )
+ throw (css::uno::RuntimeException)
+{
+ m_aControlTag = aTag;
+}
+
+
//ScVbaControlFactory
ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel ): m_xContext( xContext ), m_xControl( xControl ), m_xModel( xModel )
@@ -383,7 +414,6 @@ ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< uno::XIn
if ( !xControl.is() )
throw uno::RuntimeException(); // really we should be more informative
return createControl( xControl, xParent );
-
}
ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< uno::XInterface >& /*xParent*/ ) throw (uno::RuntimeException)
@@ -456,6 +486,8 @@ ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XCo
pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.custom.awt.UnoControlSystemAXContainerModel") ) ) )
+ pControl = new VbaSystemAXControl( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else
throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control " ), uno::Reference< uno::XInterface >() );
return pControl;
diff --git a/vbahelper/source/msforms/vbacontrol.hxx b/vbahelper/source/msforms/vbacontrol.hxx
index c9c3964268..d2631c761e 100644
--- a/vbahelper/source/msforms/vbacontrol.hxx
+++ b/vbahelper/source/msforms/vbacontrol.hxx
@@ -48,6 +48,10 @@ class ScVbaControl : public ControlImpl_BASE
private:
com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener;
protected:
+ // awt control has nothing similar to Tag property of Mso controls,
+ // whether it is necessary is another question
+ ::rtl::OUString m_aControlTag;
+
std::auto_ptr< ov::AbstractGeometryAttributes > mpGeometryHelper;
css::uno::Reference< css::beans::XPropertySet > m_xProps;
css::uno::Reference< css::uno::XInterface > m_xControl;
@@ -75,6 +79,7 @@ public:
virtual double SAL_CALL getTop() throw (css::uno::RuntimeException);
virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException);
virtual void SAL_CALL SetFocus( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Move( double Left, double Top, const ::com::sun::star::uno::Any& Width, const ::com::sun::star::uno::Any& Height ) throw (::com::sun::star::uno::RuntimeException);
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getObject() throw (css::uno::RuntimeException);
virtual rtl::OUString SAL_CALL getControlSource() throw (css::uno::RuntimeException);
@@ -85,6 +90,8 @@ public:
virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
virtual rtl::OUString SAL_CALL getControlTipText() throw (css::uno::RuntimeException);
virtual void SAL_CALL setControlTipText( const rtl::OUString& ) throw (css::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTag() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setTag( const ::rtl::OUString& aTag ) throw (css::uno::RuntimeException);
//remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape
virtual void removeResouce() throw( css::uno::RuntimeException );
//XHelperInterface
diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx
index a82c9a44d1..a273bb1952 100644
--- a/vbahelper/source/msforms/vbacontrols.cxx
+++ b/vbahelper/source/msforms/vbacontrols.cxx
@@ -25,9 +25,14 @@
*
************************************************************************/
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <com/sun/star/lang/WrappedTargetException.hpp>
+
#include "vbacontrols.hxx"
#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/awt/XControlContainer.hpp>
#include <ooo/vba//XControlProvider.hpp>
#include <hash_map>
@@ -48,16 +53,25 @@ class ControlArrayWrapper : public ArrayWrapImpl
ControlVec mControls;
ControlIndexMap mIndices;
- rtl::OUString getControlName( const uno::Reference< awt::XControl >& xCtrl )
+private:
+ void SetArrayElementTo( const uno::Reference< awt::XControl >& xCtrl, sal_Int32 nIndex = -1 )
{
- uno::Reference< beans::XPropertySet > xProp( xCtrl->getModel(), uno::UNO_QUERY );
- rtl::OUString sName;
- xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName;
- return sName;
+ // initialize the element with specified index to the control
+ if ( xCtrl.is() )
+ {
+ if ( nIndex == -1 )
+ nIndex = msNames.getLength();
+
+ if ( nIndex >= msNames.getLength() )
+ msNames.realloc( nIndex );
+
+ msNames[ nIndex ] = getControlName( xCtrl );
+ mControls.push_back( xCtrl );
+ mIndices[ msNames[ nIndex ] ] = nIndex;
+ }
}
public:
-
ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog )
{
mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
@@ -65,14 +79,21 @@ public:
msNames.realloc( sXControls.getLength() );
for ( sal_Int32 i = 0; i < sXControls.getLength(); ++i )
- {
- uno::Reference< awt::XControl > xCtrl = sXControls[ i ];
- msNames[ i ] = getControlName( xCtrl );
- mControls.push_back( xCtrl );
- mIndices[ msNames[ i ] ] = i;
- }
+ SetArrayElementTo( sXControls[ i ], i );
}
-
+
+ static rtl::OUString getControlName( const uno::Reference< awt::XControl >& xCtrl )
+ {
+ if ( !xCtrl.is() )
+ throw uno::RuntimeException();
+
+ uno::Reference< beans::XPropertySet > xProp( xCtrl->getModel(), uno::UNO_QUERY_THROW );
+ rtl::OUString sName;
+ xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= sName;
+ return sName;
+ }
+
+
// XElementAccess
virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
{
@@ -204,6 +225,141 @@ ScVbaControls::Move( double cx, double cy ) throw (uno::RuntimeException)
}
}
+uno::Any SAL_CALL ScVbaControls::Add( const uno::Any& Object, const uno::Any& StringKey, const uno::Any& /*Before*/, const uno::Any& /*After*/ )
+ throw (uno::RuntimeException)
+{
+ uno::Any aResult;
+ ::rtl::OUString aComServiceName;
+
+ try
+ {
+ if ( !mxDialog.is() )
+ throw uno::RuntimeException();
+
+ uno::Reference< awt::XControl > xNewControl;
+ uno::Reference< lang::XMultiServiceFactory > xModelFactory( mxDialog->getModel(), uno::UNO_QUERY_THROW );
+
+ uno::Reference< container::XNameContainer > xDialogContainer( xModelFactory, uno::UNO_QUERY_THROW );
+
+ Object >>= aComServiceName;
+
+ // TODO: Support Before and After?
+ ::rtl::OUString aNewName;
+ StringKey >>= aNewName;
+ if ( !aNewName.getLength() )
+ {
+ aNewName = aComServiceName;
+ if ( !aNewName.getLength() )
+ aNewName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Control" ) );
+
+ sal_Int32 nInd = 0;
+ while( xDialogContainer->hasByName( aNewName ) && nInd < SAL_MAX_INT32 )
+ {
+ aNewName = aComServiceName;
+ aNewName += ::rtl::OUString::valueOf( nInd );
+ }
+ }
+
+ if ( aComServiceName.getLength() )
+ {
+ uno::Reference< awt::XControlModel > xNewModel( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.custom.awt.UnoControlSystemAXContainerModel" ) ) ), uno::UNO_QUERY_THROW );
+
+
+ xDialogContainer->insertByName( aNewName, uno::makeAny( xNewModel ) );
+ uno::Reference< awt::XControlContainer > xControlContainer( mxDialog, uno::UNO_QUERY_THROW );
+ xNewControl = xControlContainer->getControl( aNewName );
+
+ try
+ {
+ uno::Reference< script::XInvocation > xControlInvoke( xNewControl, uno::UNO_QUERY_THROW );
+
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[0] <<= aComServiceName;
+ uno::Sequence< sal_Int16 > aOutIDDummy;
+ uno::Sequence< uno::Any > aOutDummy;
+ xControlInvoke->invoke( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SOAddAXControl" ) ), aArgs, aOutIDDummy, aOutDummy );
+ }
+ catch( uno::Exception& )
+ {
+ xDialogContainer->removeByName( aNewName );
+ throw;
+ }
+ }
+
+ if ( xNewControl.is() )
+ {
+ UpdateCollectionIndex( lcl_controlsWrapper( mxDialog ) );
+ aResult <<= xNewControl;
+ aResult = createCollectionObject( aResult );
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ catch( uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch( uno::Exception& e )
+ {
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not create AXControl!" ) ),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny( e ) );
+ }
+
+ return aResult;
+}
+
+void SAL_CALL ScVbaControls::Remove( const uno::Any& StringKeyOrIndex )
+ throw (uno::RuntimeException)
+{
+ ::rtl::OUString aControlName;
+ sal_Int32 nIndex = -1;
+
+ try
+ {
+ if ( !mxDialog.is() )
+ throw uno::RuntimeException();
+
+ uno::Reference< lang::XMultiServiceFactory > xModelFactory( mxDialog->getModel(), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XNameContainer > xDialogContainer( xModelFactory, uno::UNO_QUERY_THROW );
+
+ if ( !( ( StringKeyOrIndex >>= aControlName ) && aControlName.getLength() )
+ && !( ( StringKeyOrIndex >>= nIndex ) && nIndex >= 0 && nIndex < m_xIndexAccess->getCount() ) )
+ throw uno::RuntimeException();
+
+ uno::Reference< awt::XControl > xControl;
+ if ( aControlName.getLength() )
+ {
+ uno::Reference< awt::XControlContainer > xControlContainer( mxDialog, uno::UNO_QUERY_THROW );
+ xControl = xControlContainer->getControl( aControlName );
+ }
+ else
+ {
+ m_xIndexAccess->getByIndex( nIndex ) >>= xControl;
+ }
+
+ if ( !xControl.is() )
+ throw uno::RuntimeException();
+
+ if ( !aControlName.getLength() )
+ aControlName = ControlArrayWrapper::getControlName( xControl );
+
+ xDialogContainer->removeByName( aControlName );
+ xControl->dispose();
+ }
+ catch( uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch( uno::Exception& e )
+ {
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not create AXControl!" ) ),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny( e ) );
+ }
+}
+
+
uno::Type
ScVbaControls::getElementType() throw (uno::RuntimeException)
{
diff --git a/vbahelper/source/msforms/vbacontrols.hxx b/vbahelper/source/msforms/vbacontrols.hxx
index a11ef4dd45..a050415c9b 100644
--- a/vbahelper/source/msforms/vbacontrols.hxx
+++ b/vbahelper/source/msforms/vbacontrols.hxx
@@ -39,14 +39,19 @@ typedef CollTestImplHelper< ov::msforms::XControls > ControlsImpl_BASE;
class ScVbaControls : public ControlsImpl_BASE
{
css::uno::Reference< css::awt::XControl > mxDialog;
+
protected:
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+
public:
ScVbaControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
const css::uno::Reference< css::awt::XControl >& xDialog );
// XControls
- virtual void SAL_CALL Move( double cx, double cy ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Move( double cx, double cy ) throw (css::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL Add( const ::com::sun::star::uno::Any& Object, const ::com::sun::star::uno::Any& StringKey, const ::com::sun::star::uno::Any& Before, const ::com::sun::star::uno::Any& After ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL Remove( const ::com::sun::star::uno::Any& StringKeyOrIndex ) throw (::com::sun::star::uno::RuntimeException);
+
// XEnumerationAccess
virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/msforms/vbasystemaxcontrol.cxx b/vbahelper/source/msforms/vbasystemaxcontrol.cxx
new file mode 100755
index 0000000000..227338d7f6
--- /dev/null
+++ b/vbahelper/source/msforms/vbasystemaxcontrol.cxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+#include "vbasystemaxcontrol.hxx"
+
+using namespace com::sun::star;
+using namespace ooo::vba;
+
+//----------------------------------------------------------
+VbaSystemAXControl::VbaSystemAXControl( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper )
+: SystemAXControlImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
+, m_xControlInvocation( xControl, uno::UNO_QUERY_THROW )
+{
+}
+
+//----------------------------------------------------------
+uno::Reference< beans::XIntrospectionAccess > SAL_CALL VbaSystemAXControl::getIntrospection()
+ throw ( uno::RuntimeException )
+{
+ return m_xControlInvocation->getIntrospection();
+}
+
+//----------------------------------------------------------
+uno::Any SAL_CALL VbaSystemAXControl::invoke( const ::rtl::OUString& aFunctionName, const uno::Sequence< uno::Any >& aParams, uno::Sequence< ::sal_Int16 >& aOutParamIndex, uno::Sequence< uno::Any >& aOutParam )
+ throw ( lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException )
+{
+ return m_xControlInvocation->invoke( aFunctionName, aParams, aOutParamIndex, aOutParam );
+}
+
+//----------------------------------------------------------
+void SAL_CALL VbaSystemAXControl::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue )
+ throw ( beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException )
+{
+ m_xControlInvocation->setValue( aPropertyName, aValue );
+}
+
+//----------------------------------------------------------
+uno::Any SAL_CALL VbaSystemAXControl::getValue( const ::rtl::OUString& aPropertyName )
+ throw ( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ return m_xControlInvocation->getValue( aPropertyName );
+}
+
+//----------------------------------------------------------
+::sal_Bool SAL_CALL VbaSystemAXControl::hasMethod( const ::rtl::OUString& aName )
+ throw ( uno::RuntimeException )
+{
+ return m_xControlInvocation->hasMethod( aName );
+}
+
+//----------------------------------------------------------
+::sal_Bool SAL_CALL VbaSystemAXControl::hasProperty( const ::rtl::OUString& aName )
+ throw ( uno::RuntimeException )
+{
+ return m_xControlInvocation->hasProperty( aName );
+}
+
+//----------------------------------------------------------
+rtl::OUString&
+VbaSystemAXControl::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM( "VbaSystemAXControl" ) );
+ return sImplName;
+}
+
+//----------------------------------------------------------
+uno::Sequence< rtl::OUString >
+VbaSystemAXControl::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.msforms.Frame" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/vbahelper/source/msforms/vbasystemaxcontrol.hxx b/vbahelper/source/msforms/vbasystemaxcontrol.hxx
new file mode 100755
index 0000000000..5bc23f44b2
--- /dev/null
+++ b/vbahelper/source/msforms/vbasystemaxcontrol.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * 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 VBA_SYSTEMAXCONTROL_HXX
+#define VBA_SYSTEMAXCONTROL_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/script/XInvocation.hpp>
+
+#include "vbacontrol.hxx"
+#include <vbahelper/vbahelper.hxx>
+
+typedef cppu::ImplInheritanceHelper1< ScVbaControl, css::script::XInvocation > SystemAXControlImpl_BASE;
+
+class VbaSystemAXControl : public SystemAXControlImpl_BASE
+{
+ css::uno::Reference< css::script::XInvocation > m_xControlInvocation;
+
+public:
+ VbaSystemAXControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
+
+ // XInvocation
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, ::com::sun::star::uno::Sequence< ::sal_Int16 >& aOutParamIndex, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam ) throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw ( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw ( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException );
+ virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ //XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif
diff --git a/vbahelper/source/vbahelper/makefile.mk b/vbahelper/source/vbahelper/makefile.mk
index b11b4ffa0a..47ad44b3d0 100644
--- a/vbahelper/source/vbahelper/makefile.mk
+++ b/vbahelper/source/vbahelper/makefile.mk
@@ -65,7 +65,6 @@ SLOFILES=\
$(SLO)$/vbashaperange.obj \
$(SLO)$/vbatextframe.obj \
$(SLO)$/vbapagesetupbase.obj \
-
# --- Targets -------------------------------------------------------
.INCLUDE : target.mk
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index d9db387139..13aa451a31 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -26,15 +26,24 @@
************************************************************************/
#include "vbahelper/vbaapplicationbase.hxx"
#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp> //Michael E. Bohn
+#include <com/sun/star/lang/XMultiComponentFactory.hpp> //Michael E. Bohn
+#include <com/sun/star/lang/XComponent.hpp> //Michael E. Bohn
+#include <com/sun/star/container/XEnumeration.hpp> //Michael E. Bohn
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XEmbeddedScripts.hpp> //Michael E. Bohn
+#include <ooo/vba/XVBAAppService.hpp> //Michael E. Bohn
+#include <com/sun/star/awt/XWindow2.hpp>
+
#include "vbacommandbars.hxx"
#include <filter/msfilter/msvbahelper.hxx>
+#include <tools/datetime.hxx>
// start basic includes
#include <basic/sbx.hxx>
@@ -43,18 +52,141 @@
#include <basic/sbmeth.hxx>
#include <basic/sbmod.hxx>
// end basic includes
+
+#include <hash_map>
+
using namespace com::sun::star;
using namespace ooo::vba;
#define OFFICEVERSION "11.0"
+// ====VbaTimerInfo==================================
+typedef ::std::pair< ::rtl::OUString, ::std::pair< double, double > > VbaTimerInfo;
+
+// ====VbaTimer==================================
+class VbaTimer
+{
+ Timer m_aTimer;
+ VbaTimerInfo m_aTimerInfo;
+ ::rtl::Reference< VbaApplicationBase > m_xBase;
+
+ // the following declarations are here to prevent the usage of them
+ VbaTimer( const VbaTimer& );
+ VbaTimer& operator=( const VbaTimer& );
+
+public:
+ VbaTimer()
+ {}
+
+ virtual ~VbaTimer()
+ {
+ m_aTimer.Stop();
+ }
+
+ static double GetNow()
+ {
+ Date aDateNow;
+ Time aTimeNow;
+ Date aRefDate( 1,1,1900 );
+ long nDiffDays = (long)(aDateNow - aRefDate);
+ nDiffDays += 2; // Anpassung VisualBasic: 1.Jan.1900 == 2
+
+ long nDiffSeconds = aTimeNow.GetHour() * 3600 + aTimeNow.GetMin() * 60 + aTimeNow.GetSec();
+ return (double)nDiffDays + ((double)nDiffSeconds)/(double)(24*3600);
+ }
+
+ static sal_Int32 GetTimerMiliseconds( double nFrom, double nTo )
+ {
+ double nResult = nTo - nFrom;
+ if ( nResult > 0 )
+ nResult *= 24*3600*1000;
+ else
+ nResult = 50;
+
+ return (sal_Int32) nResult;
+ }
+
+ void Start( const ::rtl::Reference< VbaApplicationBase > xBase, const ::rtl::OUString& aFunction, double nFrom, double nTo )
+ {
+ if ( !xBase.is() || !aFunction.getLength() )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected arguments!" ) ), uno::Reference< uno::XInterface >() );
+
+ m_xBase = xBase;
+ m_aTimerInfo = VbaTimerInfo( aFunction, ::std::pair< double, double >( nFrom, nTo ) );
+ m_aTimer.SetTimeoutHdl( LINK( this, VbaTimer, MacroCallHdl ) );
+ m_aTimer.SetTimeout( GetTimerMiliseconds( GetNow(), nFrom ) );
+ m_aTimer.Start();
+ }
+
+ DECL_LINK( MacroCallHdl, void* );
+};
+
+IMPL_LINK( VbaTimer, MacroCallHdl, void*, EMPTYARG )
+{
+ if ( m_aTimerInfo.second.second == 0 || GetNow() < m_aTimerInfo.second.second )
+ {
+ uno::Any aDummyArg;
+ try
+ {
+ m_xBase->Run( m_aTimerInfo.first, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg, aDummyArg );
+ }
+ catch( uno::Exception& )
+ {}
+ }
+
+ // mast be the last call in the method since it deletes the timer
+ try
+ {
+ m_xBase->OnTime( uno::makeAny( m_aTimerInfo.second.first ), m_aTimerInfo.first, uno::makeAny( m_aTimerInfo.second.second ), uno::makeAny( sal_False ) );
+ } catch( uno::Exception& )
+ {}
+
+ return 0;
+}
+
+// ====VbaTimerInfoHash==================================
+struct VbaTimerInfoHash
+{
+ size_t operator()( const VbaTimerInfo& rTimerInfo ) const
+ {
+ return (size_t)rTimerInfo.first.hashCode()
+ + (size_t)rtl_str_hashCode_WithLength( (char*)&rTimerInfo.second.first, sizeof( double ) )
+ + (size_t)rtl_str_hashCode_WithLength( (char*)&rTimerInfo.second.second, sizeof( double ) );
+ }
+};
+
+// ====VbaTimerHashMap==================================
+typedef ::std::hash_map< VbaTimerInfo, VbaTimer*, VbaTimerInfoHash, ::std::equal_to< VbaTimerInfo > > VbaTimerHashMap;
+
+// ====VbaApplicationBase_Impl==================================
+struct VbaApplicationBase_Impl
+{
+ VbaTimerHashMap m_aTimerHash;
+
+ virtual ~VbaApplicationBase_Impl()
+ {
+ // remove the remaining timers
+ for ( VbaTimerHashMap::iterator aIter = m_aTimerHash.begin();
+ aIter != m_aTimerHash.end();
+ aIter++ )
+ {
+ delete aIter->second;
+ aIter->second = NULL;
+ }
+ }
+};
+
+// ====VbaApplicationBase==================================
VbaApplicationBase::VbaApplicationBase( const uno::Reference< uno::XComponentContext >& xContext )
: ApplicationBase_BASE( uno::Reference< XHelperInterface >(), xContext )
+ , m_pImpl( new VbaApplicationBase_Impl )
{
}
VbaApplicationBase::~VbaApplicationBase()
{
+ m_pImpl = 0;
+ delete m_pImpl;
}
sal_Bool SAL_CALL
@@ -116,6 +248,26 @@ VbaApplicationBase::setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (uno::
return;
}
+::sal_Bool SAL_CALL VbaApplicationBase::getInteractive()
+ throw (uno::RuntimeException)
+{
+ uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
+ uno::Reference< awt::XWindow2 > xWindow( xFrame->getContainerWindow(), uno::UNO_QUERY_THROW );
+
+ return xWindow->isEnabled();
+}
+
+void SAL_CALL VbaApplicationBase::setInteractive( ::sal_Bool bInteractive )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
+ uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), uno::UNO_SET_THROW );
+
+ xWindow->setEnable( bInteractive );
+}
+
uno::Any SAL_CALL
VbaApplicationBase::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
{
@@ -133,7 +285,54 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException)
void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
{
- VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName );
+ ::rtl::OUString sSeparator = ::rtl::OUString::createFromAscii("/");
+ ::rtl::OUString sMacroSeparator = ::rtl::OUString::createFromAscii("!");
+ ::rtl::OUString sMacro_only_Name;
+ sal_Int32 Position_MacroSeparator = MacroName.indexOf(sMacroSeparator);
+
+ uno::Reference< frame::XModel > aMacroDocumentModel;
+ if (-1 != Position_MacroSeparator)
+ {
+ uno::Reference< container::XEnumerationAccess > xComponentEnumAccess;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager = mxContext->getServiceManager();
+ try
+ {
+ uno::Reference< frame::XDesktop > xDesktop (xServiceManager->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )),mxContext ), uno::UNO_QUERY_THROW );
+ xComponentEnumAccess = xDesktop->getComponents();
+ }
+ catch(uno::Exception&)
+ {
+ }
+
+ //rem look for the name of the document in the cmpoonents collection
+ uno::Reference < container::XEnumeration > xEnum = xComponentEnumAccess->createEnumeration();
+
+ // iterate through the collection by name
+ while (xEnum->hasMoreElements())
+ {
+ // get the next element as a UNO Any
+ uno::Any aComponentHelper = xEnum->nextElement();
+ uno::Reference <frame::XModel> xDocModel( aComponentHelper, uno::UNO_QUERY_THROW );
+
+ // get the name of the sheet from its XNamed interface
+ ::rtl::OUString aName = xDocModel->getURL();
+
+
+ if (aName.match(MacroName.copy(0,Position_MacroSeparator-1),aName.lastIndexOf(sSeparator)+1))
+ {
+ aMacroDocumentModel = xDocModel;
+ sMacro_only_Name = MacroName.copy(Position_MacroSeparator+1);
+ }
+ }
+ }
+ else
+ {
+ aMacroDocumentModel = getCurrentDocument();
+ sMacro_only_Name = MacroName.copy(0);
+ }
+
+
+ VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( aMacroDocumentModel ), sMacro_only_Name );
if( aMacroInfo.IsResolved() )
{
// handle the arguments
@@ -168,6 +367,39 @@ void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const u
}
}
+void SAL_CALL VbaApplicationBase::OnTime( const uno::Any& aEarliestTime, const ::rtl::OUString& aFunction, const uno::Any& aLatestTime, const uno::Any& aSchedule )
+ throw ( uno::RuntimeException )
+{
+ if ( !aFunction.getLength() )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected function name!" ) ), uno::Reference< uno::XInterface >() );
+
+ double nEarliestTime = 0;
+ double nLatestTime = 0;
+ if ( !( aEarliestTime >>= nEarliestTime )
+ || ( aLatestTime.hasValue() && !( aLatestTime >>= nLatestTime ) ) )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Only double is supported as time for now!" ) ), uno::Reference< uno::XInterface >() );
+
+ sal_Bool bSetTimer = sal_True;
+ aSchedule >>= bSetTimer;
+
+ VbaTimerInfo aTimerIndex( aFunction, ::std::pair< double, double >( nEarliestTime, nLatestTime ) );
+
+ VbaTimerHashMap::iterator aIter = m_pImpl->m_aTimerHash.find( aTimerIndex );
+ if ( aIter != m_pImpl->m_aTimerHash.end() )
+ {
+ delete aIter->second;
+ aIter->second = NULL;
+ m_pImpl->m_aTimerHash.erase( aIter );
+ }
+
+ if ( bSetTimer )
+ {
+ VbaTimer* pTimer = new VbaTimer;
+ m_pImpl->m_aTimerHash[ aTimerIndex ] = pTimer;
+ pTimer->Start( this, aFunction, nEarliestTime, nLatestTime );
+ }
+}
+
float SAL_CALL VbaApplicationBase::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException)
{
// i cm = 28.35 points
@@ -175,6 +407,57 @@ float SAL_CALL VbaApplicationBase::CentimetersToPoints( float _Centimeters ) thr
return ( _Centimeters * rate );
}
+// inserted by Michael E. Bohn
+uno::Any SAL_CALL VbaApplicationBase::getVBE() throw (uno::RuntimeException)
+{
+ uno::Any aAny;
+ uno::Reference< ::lang::XMultiComponentFactory > xServiceManager = mxContext->getServiceManager();
+ try
+ {
+ uno::Reference < ::uno::XInterface > xInterface = xServiceManager->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAAppService" )),mxContext);
+ uno::Reference < ::ooo::vba::XVBAAppService > xVBAAppService (xInterface, ::uno::UNO_QUERY_THROW );
+ if (xVBAAppService.is()){
+ uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
+ return xVBAAppService->getVBE( this, mxContext, xModel);
+ }
+
+ }catch(uno::Exception* e)
+ {
+ }
+ return aAny;
+}
+
+uno::Any SAL_CALL
+VbaApplicationBase::getVBProjects() throw (uno::RuntimeException)
+{
+ uno::Any aAny;
+ uno::Reference< ::lang::XMultiComponentFactory > xServiceManager = mxContext->getServiceManager();
+ try
+ {
+ uno::Reference < ::uno::XInterface > xInterface = xServiceManager->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAAppService" )),mxContext);
+ uno::Reference < ::ooo::vba::XVBAAppService > xVBAAppService (xInterface, ::uno::UNO_QUERY_THROW );
+ if (xVBAAppService.is()){
+ uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
+ uno::Reference< document::XEmbeddedScripts > xEnbeddedScripts ( xModel, uno::UNO_QUERY_THROW );
+ uno::Reference< script::XStorageBasedLibraryContainer > xMacroStorageBasedLibraryContainer = xEnbeddedScripts->getBasicLibraries();
+ uno::Reference< script::XStorageBasedLibraryContainer > xDialogStorageBasedLibraryContainer = xEnbeddedScripts->getDialogLibraries();
+ uno::Reference< script::XLibraryContainer > xMacroLibraryContainer ( xMacroStorageBasedLibraryContainer, uno::UNO_QUERY_THROW );
+ uno::Reference< script::XLibraryContainer > xDialogLibraryContainer( xDialogStorageBasedLibraryContainer, uno::UNO_QUERY_THROW );
+ return xVBAAppService->getVBProjects(this, mxContext, xModel, xMacroLibraryContainer, xDialogLibraryContainer);
+ }
+
+ }catch(uno::Exception* e)
+ {
+ }
+ return aAny;
+
+
+
+}
+
+
+
+
rtl::OUString&
VbaApplicationBase::getServiceImplName()
{
@@ -193,6 +476,13 @@ VbaApplicationBase::getServiceNames()
return aServiceNames;
}
+void SAL_CALL VbaApplicationBase::Undo()
+ throw (uno::RuntimeException)
+{
+ uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
+ dispatchRequests( xModel, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Undo" ) ) );
+}
+
void VbaApplicationBase::Quit() throw (uno::RuntimeException)
{
// need to stop basic
@@ -208,3 +498,4 @@ void VbaApplicationBase::Quit() throw (uno::RuntimeException)
}
}
}
+
diff --git a/vbahelper/source/vbahelper/vbacommandbar.cxx b/vbahelper/source/vbahelper/vbacommandbar.cxx
index 63952c5734..dfda6756a3 100644
--- a/vbahelper/source/vbahelper/vbacommandbar.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbar.cxx
@@ -202,3 +202,85 @@ ScVbaCommandBar::getServiceNames()
}
return aServiceNames;
}
+
+
+VbaDummyCommandBar::VbaDummyCommandBar(
+ const uno::Reference< ov::XHelperInterface > xParent,
+ const uno::Reference< uno::XComponentContext > xContext,
+ const ::rtl::OUString& rName, sal_Int32 nType ) throw( uno::RuntimeException ) :
+ CommandBar_BASE( xParent, xContext ),
+ maName( rName ),
+ mnType( nType )
+{
+}
+
+::rtl::OUString SAL_CALL VbaDummyCommandBar::getName() throw ( uno::RuntimeException )
+{
+ return maName;
+}
+
+void SAL_CALL VbaDummyCommandBar::setName( const ::rtl::OUString& _name ) throw (uno::RuntimeException)
+{
+ maName = _name;
+}
+
+::sal_Bool SAL_CALL VbaDummyCommandBar::getVisible() throw (uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void SAL_CALL VbaDummyCommandBar::setVisible( ::sal_Bool /*_visible*/ ) throw (uno::RuntimeException)
+{
+}
+
+::sal_Bool SAL_CALL VbaDummyCommandBar::getEnabled() throw (uno::RuntimeException)
+{
+ // emulated with Visible
+ return getVisible();
+}
+
+void SAL_CALL VbaDummyCommandBar::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException)
+{
+ // emulated with Visible
+ setVisible( _enabled );
+}
+
+void SAL_CALL VbaDummyCommandBar::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ // no-op
+}
+
+uno::Any SAL_CALL VbaDummyCommandBar::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ uno::Reference< XCommandBarControls > xCommandBarControls( new VbaDummyCommandBarControls( this, mxContext ) );
+ if( aIndex.hasValue() )
+ return xCommandBarControls->Item( aIndex, uno::Any() );
+ return uno::Any( xCommandBarControls );
+}
+
+sal_Int32 SAL_CALL VbaDummyCommandBar::Type() throw (script::BasicErrorException, uno::RuntimeException)
+{
+ return mnType;
+}
+
+uno::Any SAL_CALL VbaDummyCommandBar::FindControl( const uno::Any& /*aType*/, const uno::Any& /*aId*/, const uno::Any& /*aTag*/, const uno::Any& /*aVisible*/, const uno::Any& /*aRecursive*/ ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ return uno::Any( uno::Reference< XCommandBarControl >() );
+}
+
+rtl::OUString& VbaDummyCommandBar::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaDummyCommandBar") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString > VbaDummyCommandBar::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBar" ) );
+ }
+ return aServiceNames;
+}
diff --git a/vbahelper/source/vbahelper/vbacommandbar.hxx b/vbahelper/source/vbahelper/vbacommandbar.hxx
index 44c2cf1ef0..30599517b7 100644
--- a/vbahelper/source/vbahelper/vbacommandbar.hxx
+++ b/vbahelper/source/vbahelper/vbacommandbar.hxx
@@ -51,7 +51,7 @@ private:
public:
ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Bool bIsMenu, sal_Bool bTemporary = sal_True ) throw( css::uno::RuntimeException );
-
+
sal_Bool IsMenu() { return m_bIsMenu; }
// Attributes
@@ -72,4 +72,38 @@ public:
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
};
+
+/** Dummy command bar implementation. Does nothing but provide its name. */
+class VbaDummyCommandBar : public CommandBar_BASE
+{
+public:
+ VbaDummyCommandBar(
+ const css::uno::Reference< ov::XHelperInterface > xParent,
+ const css::uno::Reference< css::uno::XComponentContext > xContext,
+ const ::rtl::OUString& rName,
+ sal_Int32 nType ) throw( css::uno::RuntimeException );
+
+ // Attributes
+ virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& _name ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException);
+
+ // Methods
+ virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL FindControl( const css::uno::Any& aType, const css::uno::Any& aId, const css::uno::Any& aTag, const css::uno::Any& aVisible, const css::uno::Any& aRecursive ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+
+private:
+ ::rtl::OUString maName;
+ sal_Int32 mnType;
+};
+
#endif//SC_VBA_COMMANDBAR_HXX
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
index 8cb9f4985a..1b2d01367d 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
@@ -141,6 +141,22 @@ ScVbaCommandBarControl::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeExcep
}
}
+::sal_Bool SAL_CALL
+ScVbaCommandBarControl::getBeginGroup() throw (css::uno::RuntimeException)
+{
+ // TODO: need to check if the item before this item is of type 'separator'
+ return sal_False;
+}
+
+void SAL_CALL
+ScVbaCommandBarControl::setBeginGroup( ::sal_Bool _begin ) throw (css::uno::RuntimeException)
+{
+ if( getBeginGroup() != _begin )
+ {
+ // TODO: need to insert or remove an item of type 'separator' before this item
+ }
+}
+
void SAL_CALL
ScVbaCommandBarControl::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
{
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
index 21f913d6e6..d07366f02a 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
@@ -67,6 +67,8 @@ public:
virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getBeginGroup() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setBeginGroup( ::sal_Bool _begin ) throw (css::uno::RuntimeException);
virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException)
{
return ov::office::MsoControlType::msoControlButton;
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
index d430f65bff..c479d451ea 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
@@ -34,10 +34,10 @@ typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarControlEnum
class CommandBarControlEnumeration : public CommandBarControlEnumeration_BASE
{
//uno::Reference< uno::XComponentContext > m_xContext;
- ScVbaCommandBarControls* m_pCommandBarControls;
+ CommandBarControls_BASE* m_pCommandBarControls;
sal_Int32 m_nCurrentPosition;
public:
- CommandBarControlEnumeration( ScVbaCommandBarControls* pCommandBarControls ) : m_pCommandBarControls( pCommandBarControls ), m_nCurrentPosition( 0 ) {}
+ CommandBarControlEnumeration( CommandBarControls_BASE* pCommandBarControls ) : m_pCommandBarControls( pCommandBarControls ), m_nCurrentPosition( 0 ) {}
virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
{
if( m_nCurrentPosition < m_pCommandBarControls->getCount() )
@@ -140,7 +140,7 @@ ScVbaCommandBarControls::Item( const uno::Any& aIndex, const uno::Any& /*aIndex*
{
rtl::OUString sName;
aIndex >>= sName;
- nPosition = VbaCommandBarHelper::findControlByName( m_xIndexAccess, sName );
+ nPosition = VbaCommandBarHelper::findControlByName( m_xIndexAccess, sName, m_bIsMenu );
}
else
{
@@ -246,3 +246,75 @@ ScVbaCommandBarControls::getServiceNames()
return aServiceNames;
}
+// ============================================================================
+
+class VbaDummyIndexAccess : public ::cppu::WeakImplHelper1< container::XIndexAccess >
+{
+public:
+ inline VbaDummyIndexAccess() {}
+ // XIndexAccess
+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
+ { return 0; }
+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 /*Index*/ ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+ { throw lang::IndexOutOfBoundsException(); }
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
+ { return XCommandBarControl::static_type( 0 ); }
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException)
+ { return false; }
+};
+
+// ----------------------------------------------------------------------------
+
+VbaDummyCommandBarControls::VbaDummyCommandBarControls(
+ const uno::Reference< XHelperInterface >& xParent,
+ const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException) :
+ CommandBarControls_BASE( xParent, xContext, new VbaDummyIndexAccess )
+{
+}
+
+// XEnumerationAccess
+uno::Type SAL_CALL VbaDummyCommandBarControls::getElementType() throw ( uno::RuntimeException )
+{
+ return XCommandBarControl::static_type( 0 );
+}
+
+uno::Reference< container::XEnumeration > VbaDummyCommandBarControls::createEnumeration() throw ( uno::RuntimeException )
+{
+ return uno::Reference< container::XEnumeration >( new CommandBarControlEnumeration( this ) );
+}
+
+uno::Any VbaDummyCommandBarControls::createCollectionObject( const uno::Any& /*aSource*/ )
+{
+ return uno::Any( uno::Reference< XCommandBarControl >() );
+}
+
+// Methods
+uno::Any SAL_CALL VbaDummyCommandBarControls::Item( const uno::Any& /*aIndex*/, const uno::Any& /*aIndex*/ ) throw (uno::RuntimeException)
+{
+ return uno::Any( uno::Reference< XCommandBarControl >() );
+}
+
+uno::Reference< XCommandBarControl > SAL_CALL VbaDummyCommandBarControls::Add(
+ const uno::Any& /*Type*/, const uno::Any& /*Id*/, const uno::Any& /*Parameter*/, const uno::Any& /*Before*/, const uno::Any& /*Temporary*/ ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ return uno::Reference< XCommandBarControl >();
+}
+
+// XHelperInterface
+rtl::OUString& VbaDummyCommandBarControls::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaDummyCommandBarControls") );
+ return sImplName;
+}
+
+uno::Sequence<rtl::OUString> VbaDummyCommandBarControls::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarControls" ) );
+ }
+ return aServiceNames;
+}
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
index d6cbf9cebd..08c5f57b7f 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
@@ -64,4 +64,24 @@ public:
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
};
+class VbaDummyCommandBarControls : public CommandBarControls_BASE
+{
+public:
+ VbaDummyCommandBarControls(
+ const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw( css::uno::RuntimeException );
+
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+
+ // Methods
+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index, const css::uno::Any& /*Index2*/ ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::XCommandBarControl > SAL_CALL Add( const css::uno::Any& Type, const css::uno::Any& Id, const css::uno::Any& Parameter, const css::uno::Any& Before, const css::uno::Any& Temporary ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
#endif//SC_VBA_COMMANDBARCONTROLS_HXX
diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
index e80e426189..9b73bb6f59 100644
--- a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
@@ -30,11 +30,10 @@
#include <com/sun/star/ui/XModuleUIConfigurationManager.hpp>
#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
#include <com/sun/star/ui/XUIElement.hpp>
-#ifndef _COM_SUN_STAR_UI_UIElementType_HPP_
#include <com/sun/star/ui/UIElementType.hpp>
-#endif
#include <comphelper/processfactory.hxx>
#include <vbahelper/vbahelper.hxx>
+#include <rtl/ustrbuf.hxx>
#include <time.h>
#include <map>
@@ -233,7 +232,7 @@ rtl::OUString VbaCommandBarHelper::findToolbarByName( const css::uno::Reference<
}
// if found, return the position of the control. if not found, return -1
-sal_Int32 VbaCommandBarHelper::findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException)
+sal_Int32 VbaCommandBarHelper::findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const rtl::OUString& sName, bool bMenu ) throw (css::uno::RuntimeException)
{
sal_Int32 nCount = xIndexAccess->getCount();
css::uno::Sequence< css::beans::PropertyValue > aProps;
@@ -242,17 +241,21 @@ sal_Int32 VbaCommandBarHelper::findControlByName( const css::uno::Reference< css
rtl::OUString sLabel;
xIndexAccess->getByIndex( i ) >>= aProps;
getPropertyValue( aProps, rtl::OUString::createFromAscii(ITEM_DESCRIPTOR_LABEL) ) >>= sLabel;
- // handle the hotkey character '~'
- rtl::OUString sNewLabel;
+ // handle the hotkey marker '~' (remove in toolbars (?), replace by '&' in menus)
+ ::rtl::OUStringBuffer aBuffer;
sal_Int32 index = sLabel.indexOf( sal_Unicode('~') );
if( index < 0 )
- sNewLabel = sLabel;
- else if( index == 0 )
- sNewLabel = sLabel.copy( index + 1);
- else if( index == sNewLabel.getLength() - 1 )
- sNewLabel = sLabel.copy(0, index );
+ {
+ aBuffer = sLabel;
+ }
else
- sNewLabel = sLabel.copy( 0, index ) + sLabel.copy( index + 1 );
+ {
+ aBuffer.append( sLabel.copy( 0, index ) );
+ if( bMenu )
+ aBuffer.append( sal_Unicode( '&' ) );
+ aBuffer.append( sLabel.copy( index + 1 ) );
+ }
+ rtl::OUString sNewLabel = aBuffer.makeStringAndClear();
OSL_TRACE("VbaCommandBarHelper::findControlByName, control name: %s", rtl::OUStringToOString( sNewLabel, RTL_TEXTENCODING_UTF8 ).getStr() );
if( sName.equalsIgnoreAsciiCase( sNewLabel ) )
return i;
diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.hxx b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx
index d60b6fc982..2643656f7b 100644
--- a/vbahelper/source/vbahelper/vbacommandbarhelper.hxx
+++ b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx
@@ -95,8 +95,8 @@ public:
const rtl::OUString getModuleId(){ return maModuleId; }
rtl::OUString findToolbarByName( const css::uno::Reference< css::container::XNameAccess >& xNameAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException);
- static sal_Int32 findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException);
+ static sal_Int32 findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const rtl::OUString& sName, bool bMenu = false ) throw (css::uno::RuntimeException);
static rtl::OUString generateCustomURL();
};
-#endif//VBA_COMMANDBARHELPER_HXX
+#endif //VBA_COMMANDBARHELPER_HXX
diff --git a/vbahelper/source/vbahelper/vbacommandbars.cxx b/vbahelper/source/vbahelper/vbacommandbars.cxx
index 74fb7ab396..db077be164 100644
--- a/vbahelper/source/vbahelper/vbacommandbars.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbars.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/ui/XUIConfigurationStorage.hpp>
#include <com/sun/star/ui/XModuleUIConfigurationManager.hpp>
#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
+#include <ooo/vba/office/MsoBarType.hpp>
#include "vbacommandbars.hxx"
#include "vbacommandbar.hxx"
@@ -45,13 +46,13 @@ class CommandBarEnumeration : public CommandBarEnumeration_BASE
{
uno::Reference< XHelperInterface > m_xParent;
uno::Reference< uno::XComponentContext > m_xContext;
- VbaCommandBarHelperRef pCBarHelper;
+ VbaCommandBarHelperRef m_pCBarHelper;
uno::Sequence< rtl::OUString > m_sNames;
sal_Int32 m_nCurrentPosition;
public:
- CommandBarEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, VbaCommandBarHelperRef pHelper) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), pCBarHelper( pHelper ) , m_nCurrentPosition( 0 )
+ CommandBarEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, VbaCommandBarHelperRef pHelper) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_pCBarHelper( pHelper ) , m_nCurrentPosition( 0 )
{
- uno::Reference< container::XNameAccess > xNameAccess = pCBarHelper->getPersistentWindowState();
+ uno::Reference< container::XNameAccess > xNameAccess = m_pCBarHelper->getPersistentWindowState();
m_sNames = xNameAccess->getElementNames();
}
virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
@@ -68,8 +69,8 @@ public:
rtl::OUString sResourceUrl( m_sNames[ m_nCurrentPosition++ ] );
if( sResourceUrl.indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
{
- uno::Reference< container::XIndexAccess > xCBarSetting = pCBarHelper->getSettings( sResourceUrl );
- uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( m_xParent, m_xContext, pCBarHelper, xCBarSetting, sResourceUrl, sal_False, sal_False ) );
+ uno::Reference< container::XIndexAccess > xCBarSetting = m_pCBarHelper->getSettings( sResourceUrl );
+ uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( m_xParent, m_xContext, m_pCBarHelper, xCBarSetting, sResourceUrl, sal_False, sal_False ) );
}
else
return nextElement();
@@ -82,8 +83,8 @@ public:
ScVbaCommandBars::ScVbaCommandBars( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : CommandBars_BASE( xParent, xContext, xIndexAccess )
{
- pCBarHelper.reset( new VbaCommandBarHelper( mxContext, xModel ) );
- m_xNameAccess = pCBarHelper->getPersistentWindowState();
+ m_pCBarHelper.reset( new VbaCommandBarHelper( mxContext, xModel ) );
+ m_xNameAccess = m_pCBarHelper->getPersistentWindowState();
}
ScVbaCommandBars::~ScVbaCommandBars()
@@ -100,7 +101,7 @@ ScVbaCommandBars::getElementType() throw ( uno::RuntimeException )
uno::Reference< container::XEnumeration >
ScVbaCommandBars::createEnumeration() throw ( uno::RuntimeException )
{
- return uno::Reference< container::XEnumeration >( new CommandBarEnumeration( this, mxContext, pCBarHelper ) );
+ return uno::Reference< container::XEnumeration >( new CommandBarEnumeration( this, mxContext, m_pCBarHelper ) );
}
uno::Any
@@ -111,28 +112,53 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
uno::Reference< container::XIndexAccess > xBarSettings;
rtl::OUString sBarName;
sal_Bool bMenu = sal_False;
+ uno::Any aRet;
+
if( aSource >>= sBarName )
{
- if( sBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Worksheet Menu Bar") )
- || sBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Menu Bar") ) )
+ // some built-in command bars
+ if( m_pCBarHelper->getModuleId().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.sheet.SpreadsheetDocument") ) )
{
- // menu bar
- sResourceUrl = rtl::OUString::createFromAscii( ITEM_MENUBAR_URL );
- bMenu = sal_True;
+ if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Worksheet Menu Bar") ) )
+ {
+ // spreadsheet menu bar
+ sResourceUrl = rtl::OUString::createFromAscii( ITEM_MENUBAR_URL );
+ bMenu = sal_True;
+ }
+ else if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Cell") ) )
+ {
+ // EVIL HACK (tm): spreadsheet cell context menu as dummy object without functionality
+ aRet <<= uno::Reference< XCommandBar >( new VbaDummyCommandBar( this, mxContext, sBarName, office::MsoBarType::msoBarTypePopup ) );
+ }
}
- else
+ else if( m_pCBarHelper->getModuleId().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument") ) )
+ {
+ if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Menu Bar") ) )
+ {
+ // text processor menu bar
+ sResourceUrl = rtl::OUString::createFromAscii( ITEM_MENUBAR_URL );
+ bMenu = sal_True;
+ }
+ }
+
+ // nothing found - try to resolve from name
+ if( !aRet.hasValue() && (sResourceUrl.getLength() == 0) )
{
- sResourceUrl = pCBarHelper->findToolbarByName( m_xNameAccess, sBarName );
+ sResourceUrl = m_pCBarHelper->findToolbarByName( m_xNameAccess, sBarName );
bMenu = sal_False;
}
}
if( sResourceUrl.getLength() )
- xBarSettings = pCBarHelper->getSettings( sResourceUrl );
- else
+ {
+ xBarSettings = m_pCBarHelper->getSettings( sResourceUrl );
+ aRet <<= uno::Reference< XCommandBar >( new ScVbaCommandBar( this, mxContext, m_pCBarHelper, xBarSettings, sResourceUrl, bMenu, sal_False ) );
+ }
+
+ if( !aRet.hasValue() )
throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toolbar do not exist") ), uno::Reference< uno::XInterface >() );
- return uno::Any( uno::Reference< XCommandBar >( new ScVbaCommandBar( this, mxContext, pCBarHelper, xBarSettings, sResourceUrl, bMenu, sal_False ) ) );
+ return aRet;
}
// XCommandBars
@@ -149,7 +175,7 @@ ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Positio
rtl::OUString sResourceUrl;
if( sName.getLength() )
{
- sResourceUrl = pCBarHelper->findToolbarByName( m_xNameAccess, sName );
+ sResourceUrl = m_pCBarHelper->findToolbarByName( m_xNameAccess, sName );
if( sResourceUrl.getLength() )
throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toolbar exists") ), uno::Reference< uno::XInterface >() );
}
@@ -163,8 +189,8 @@ ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Positio
Temporary >>= bTemporary;
sResourceUrl = VbaCommandBarHelper::generateCustomURL();
- uno::Reference< container::XIndexAccess > xBarSettings( pCBarHelper->getSettings( sResourceUrl ), uno::UNO_QUERY_THROW );
- uno::Reference< XCommandBar > xCBar( new ScVbaCommandBar( this, mxContext, pCBarHelper, xBarSettings, sResourceUrl, sal_False, bTemporary ) );
+ uno::Reference< container::XIndexAccess > xBarSettings( m_pCBarHelper->getSettings( sResourceUrl ), uno::UNO_QUERY_THROW );
+ uno::Reference< XCommandBar > xCBar( new ScVbaCommandBar( this, mxContext, m_pCBarHelper, xBarSettings, sResourceUrl, sal_False, bTemporary ) );
xCBar->setName( sName );
return xCBar;
}
@@ -199,9 +225,9 @@ ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) th
if( nIndex == 1 )
{
uno::Any aSource;
- if( pCBarHelper->getModuleId().equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" ) )
+ if( m_pCBarHelper->getModuleId().equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" ) )
aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" );
- else if( pCBarHelper->getModuleId().equalsAscii("com.sun.star.text.TextDocument") )
+ else if( m_pCBarHelper->getModuleId().equalsAscii("com.sun.star.text.TextDocument") )
aSource <<= rtl::OUString::createFromAscii( "Menu Bar" );
if( aSource.hasValue() )
return createCollectionObject( aSource );
diff --git a/vbahelper/source/vbahelper/vbacommandbars.hxx b/vbahelper/source/vbahelper/vbacommandbars.hxx
index 0dfff870e9..5709fd354e 100644
--- a/vbahelper/source/vbahelper/vbacommandbars.hxx
+++ b/vbahelper/source/vbahelper/vbacommandbars.hxx
@@ -40,7 +40,7 @@ typedef CollTestImplHelper< ov::XCommandBars > CommandBars_BASE;
class ScVbaCommandBars : public CommandBars_BASE
{
private:
- VbaCommandBarHelperRef pCBarHelper;
+ VbaCommandBarHelperRef m_pCBarHelper;
public:
ScVbaCommandBars( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx
index 848795a0a8..2f21943d63 100644
--- a/vbahelper/source/vbahelper/vbadocumentbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx
@@ -33,7 +33,9 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/document/XEmbeddedScripts.hpp> //Michael E. Bohn
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <ooo/vba/XVBADocService.hpp>
#include <tools/urlobj.hxx>
#include <osl/file.hxx>
@@ -179,14 +181,14 @@ void
VbaDocumentBase::setSaved( sal_Bool bSave ) throw (uno::RuntimeException)
{
uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
- xModifiable->setModified( bSave );
+ xModifiable->setModified( !bSave );
}
sal_Bool
VbaDocumentBase::getSaved() throw (uno::RuntimeException)
{
uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
- return xModifiable->isModified();
+ return !xModifiable->isModified();
}
void
@@ -204,6 +206,40 @@ VbaDocumentBase::Activate() throw (uno::RuntimeException)
xFrame->activate();
}
+// ---- Michael E.Bohn Start-----
+
+uno::Any SAL_CALL
+VbaDocumentBase::getVBProject() throw (uno::RuntimeException)
+
+{
+ uno::Any aAny;
+ uno::Reference< ::lang::XMultiComponentFactory > xServiceManager = mxContext->getServiceManager();
+ try
+ {
+ uno::Reference < ::uno::XInterface > xInterface = xServiceManager->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBADocService" )),mxContext);
+ uno::Reference < ::ooo::vba::XVBADocService > xVBADocService (xInterface, ::uno::UNO_QUERY_THROW );
+ if (xVBADocService.is()){
+ uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
+ uno::Reference< document::XEmbeddedScripts > xEnbeddedScripts ( xModel, uno::UNO_QUERY_THROW );
+ uno::Reference< script::XStorageBasedLibraryContainer > xMacroStorageBasedLibraryContainer = xEnbeddedScripts->getBasicLibraries();
+ uno::Reference< script::XStorageBasedLibraryContainer > xDialogStorageBasedLibraryContainer = xEnbeddedScripts->getDialogLibraries();
+ uno::Reference< script::XLibraryContainer > xMacroLibraryContainer ( xMacroStorageBasedLibraryContainer, uno::UNO_QUERY_THROW );
+ uno::Reference< script::XLibraryContainer > xDialogLibraryContainer( xDialogStorageBasedLibraryContainer, uno::UNO_QUERY_THROW );
+
+ return xVBADocService->getVBProject( this, mxContext, xModel, xMacroLibraryContainer, xDialogLibraryContainer );
+ }
+
+ }catch(uno::Exception* e)
+ {
+ }
+ return aAny;
+
+}
+
+
+// ---- Michael E.Bohn End -----
+
+
rtl::OUString&
VbaDocumentBase::getServiceImplName()
{
diff --git a/vbahelper/source/vbahelper/vbafontbase.cxx b/vbahelper/source/vbahelper/vbafontbase.cxx
index e072cfb33a..9b931a5462 100644
--- a/vbahelper/source/vbahelper/vbafontbase.cxx
+++ b/vbahelper/source/vbahelper/vbafontbase.cxx
@@ -35,7 +35,20 @@
using namespace ::ooo::vba;
using namespace ::com::sun::star;
-VbaFontBase::VbaFontBase( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::container::XIndexAccess >& xPalette, uno::Reference< beans::XPropertySet > xPropertySet ) throw ( uno::RuntimeException ) : VbaFontBase_BASE( xParent, xContext ), mxFont( xPropertySet, css::uno::UNO_QUERY_THROW ), mxPalette( xPalette )
+// form controls use other property name as the remaining OOo API
+#define VBAFONTBASE_PROPNAME( ascii_normal, ascii_control ) \
+ mbFormControl ? rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ascii_control ) ) : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ascii_normal ) )
+
+VbaFontBase::VbaFontBase(
+ const uno::Reference< XHelperInterface >& xParent,
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const uno::Reference< css::container::XIndexAccess >& xPalette,
+ const uno::Reference< beans::XPropertySet >& xPropertySet,
+ bool bFormControl ) throw ( uno::RuntimeException ) :
+ VbaFontBase_BASE( xParent, xContext ),
+ mxFont( xPropertySet, uno::UNO_SET_THROW ),
+ mxPalette( xPalette, uno::UNO_SET_THROW ),
+ mbFormControl( bFormControl )
{
}
@@ -43,19 +56,22 @@ VbaFontBase::~VbaFontBase()
{
}
-
void SAL_CALL
VbaFontBase::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeException )
{
+ // not supported in form controls
+ if( mbFormControl )
+ return;
+
sal_Bool bValue = sal_False;
aValue >>= bValue;
sal_Int16 nValue = NORMAL;
sal_Int8 nValue2 = NORMALHEIGHT;
- if( bValue )
+ if( bValue )
{
nValue = SUPERSCRIPT;
- nValue2 = SUPERSCRIPTHEIGHT;
+ nValue2 = SUPERSCRIPTHEIGHT;
}
mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue );
mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 );
@@ -64,23 +80,29 @@ VbaFontBase::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeExcept
uno::Any SAL_CALL
VbaFontBase::getSuperscript() throw ( uno::RuntimeException )
{
- short nValue = 0;
- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue;
+ short nValue = NORMAL;
+ // not supported in form controls
+ if( !mbFormControl )
+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue;
return uno::makeAny( ( nValue == SUPERSCRIPT ) );
}
void SAL_CALL
VbaFontBase::setSubscript( const uno::Any& aValue ) throw ( uno::RuntimeException )
{
+ // not supported in form controls
+ if( mbFormControl )
+ return;
+
sal_Bool bValue = sal_False;
aValue >>= bValue;
sal_Int16 nValue = NORMAL;
sal_Int8 nValue2 = NORMALHEIGHT;
- if( bValue )
+ if( bValue )
{
nValue= SUBSCRIPT;
- nValue2 = SUBSCRIPTHEIGHT;
+ nValue2 = SUBSCRIPTHEIGHT;
}
mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 );
@@ -92,20 +114,30 @@ uno::Any SAL_CALL
VbaFontBase::getSubscript() throw ( uno::RuntimeException )
{
short nValue = NORMAL;
- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue;
+ // not supported in form controls
+ if( !mbFormControl )
+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue;
return uno::makeAny( ( nValue == SUBSCRIPT ) );
}
void SAL_CALL
VbaFontBase::setSize( const uno::Any& aValue ) throw( uno::RuntimeException )
{
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ), aValue );
+ // form controls need a sal_Int16 containing points, other APIs need a float
+ uno::Any aVal( aValue );
+ if( mbFormControl )
+ {
+ float fVal = 0.0;
+ aVal >>= fVal;
+ aVal <<= static_cast< sal_Int16 >( fVal );
+ }
+ mxFont->setPropertyValue( VBAFONTBASE_PROPNAME( "CharHeight", "FontHeight" ), aVal );
}
uno::Any SAL_CALL
VbaFontBase::getSize() throw ( uno::RuntimeException )
{
- return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ) );
+ return mxFont->getPropertyValue( VBAFONTBASE_PROPNAME( "CharHeight", "FontHeight" ) );
}
void SAL_CALL
@@ -152,7 +184,7 @@ VbaFontBase::setBold( const uno::Any& aValue ) throw( uno::RuntimeException )
double fBoldValue = awt::FontWeight::NORMAL;
if( bValue )
fBoldValue = awt::FontWeight::BOLD;
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ), ( uno::Any )fBoldValue );
+ mxFont->setPropertyValue( VBAFONTBASE_PROPNAME( "CharWeight", "FontWeight" ), uno::Any( fBoldValue ) );
}
@@ -160,7 +192,7 @@ uno::Any SAL_CALL
VbaFontBase::getBold() throw ( uno::RuntimeException )
{
double fValue = 0.0;
- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ) ) >>= fValue;
+ mxFont->getPropertyValue( VBAFONTBASE_PROPNAME( "CharWeight", "FontWeight" ) ) >>= fValue;
return uno::makeAny( fValue == awt::FontWeight::BOLD );
}
@@ -172,27 +204,28 @@ VbaFontBase::setStrikethrough( const uno::Any& aValue ) throw ( uno::RuntimeExce
short nValue = awt::FontStrikeout::NONE;
if( bValue )
nValue = awt::FontStrikeout::SINGLE;
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ), ( uno::Any )nValue );
+ mxFont->setPropertyValue( VBAFONTBASE_PROPNAME( "CharStrikeout", "FontStrikeout" ), uno::Any( nValue ) );
}
uno::Any SAL_CALL
VbaFontBase::getStrikethrough() throw ( uno::RuntimeException )
{
short nValue = 0;
- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ) ) >>= nValue;
+ mxFont->getPropertyValue( VBAFONTBASE_PROPNAME( "CharStrikeout", "FontStrikeout" ) ) >>= nValue;
return uno::Any( nValue == awt::FontStrikeout::SINGLE );
}
void SAL_CALL
VbaFontBase::setShadow( const uno::Any& aValue ) throw ( uno::RuntimeException )
{
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), aValue );
+ if( !mbFormControl )
+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), aValue );
}
uno::Any SAL_CALL
VbaFontBase::getShadow() throw (uno::RuntimeException)
{
- return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ) );
+ return mbFormControl ? uno::Any( false ) : mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ) );
}
void SAL_CALL
@@ -203,15 +236,14 @@ VbaFontBase::setItalic( const uno::Any& aValue ) throw ( uno::RuntimeException )
short nValue = awt::FontSlant_NONE;
if( bValue )
nValue = awt::FontSlant_ITALIC;
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ), ( uno::Any )nValue );
+ mxFont->setPropertyValue( VBAFONTBASE_PROPNAME( "CharPosture", "FontSlant" ), uno::Any( nValue ) );
}
uno::Any SAL_CALL
VbaFontBase::getItalic() throw ( uno::RuntimeException )
{
-
awt::FontSlant aFS;
- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ) ) >>= aFS;
+ mxFont->getPropertyValue( VBAFONTBASE_PROPNAME( "CharPosture", "FontSlant" ) ) >>= aFS;
return uno::makeAny( aFS == awt::FontSlant_ITALIC );
}
@@ -220,26 +252,27 @@ VbaFontBase::setName( const uno::Any& aValue ) throw ( uno::RuntimeException )
{
rtl::OUString sString;
aValue >>= sString;
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), aValue);
+ mxFont->setPropertyValue( VBAFONTBASE_PROPNAME( "CharFontName", "FontName" ), aValue );
}
uno::Any SAL_CALL
VbaFontBase::getName() throw ( uno::RuntimeException )
{
- return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ) );
+ return mxFont->getPropertyValue( VBAFONTBASE_PROPNAME( "CharFontName", "FontName" ) );
}
+
uno::Any
VbaFontBase::getColor() throw (uno::RuntimeException)
{
uno::Any aAny;
- aAny = OORGBToXLRGB( mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) ) );
+ aAny = OORGBToXLRGB( mxFont->getPropertyValue( VBAFONTBASE_PROPNAME( "CharColor", "TextColor" ) ) );
return aAny;
}
void
VbaFontBase::setColor( const uno::Any& _color ) throw (uno::RuntimeException)
{
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) , XLRGBToOORGB(_color));
+ mxFont->setPropertyValue( VBAFONTBASE_PROPNAME( "CharColor", "TextColor" ), XLRGBToOORGB(_color) );
}
void SAL_CALL
@@ -273,7 +306,7 @@ VbaFontBase::setUnderline( const uno::Any& /*aValue*/ ) throw ( uno::RuntimeExce
throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Unknown value for Underline")), uno::Reference< uno::XInterface >() );
}
- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ), ( uno::Any )nValue );
+ mxFont->setPropertyValue( VBAFONTBASE_PROPNAME( "CharUnderline", "FontUnderline" ), uno::Any( nValue ) );
*/
}
@@ -282,7 +315,7 @@ uno::Any SAL_CALL
VbaFontBase::getUnderline() throw ( uno::RuntimeException )
{
sal_Int32 nValue = awt::FontUnderline::NONE;
- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ) ) >>= nValue;
+ mxFont->getPropertyValue( VBAFONTBASE_PROPNAME( "CharUnderline", "FontUnderline" ) ) >>= nValue;
/*
switch ( nValue )
{
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index ed56394312..8654e6cb6a 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -31,11 +31,15 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/script/XDefaultProperty.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XIntrospection.hpp>
+#include <com/sun/star/util/MeasureUnit.hpp>
+
#include <ooo/vba/msforms/XShape.hpp>
#include <comphelper/processfactory.hxx>
@@ -63,8 +67,6 @@
#include <osl/file.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include <com/sun/star/frame/XModel2.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <vcl/window.hxx>
#include <vcl/syswin.hxx>
#include <tools/diagnose_ex.h>
@@ -82,12 +84,6 @@
using namespace ::com::sun::star;
using namespace ::ooo::vba;
-#define NAME_HEIGHT "Height"
-#define NAME_WIDTH "Width"
-
-#define POINTTO100THMILLIMETERFACTOR 35.27778
-
-
void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue );
uno::Any sbxToUnoValue( SbxVariable* pVar );
@@ -98,6 +94,8 @@ namespace ooo
namespace vba
{
+namespace { const double factor = 2540.0 / 72.0; }
+
css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException)
{
OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" );
@@ -271,7 +269,6 @@ getCurrentViewFrame()
};
#endif
-const double Millimeter::factor = 35.27778;
uno::Reference< beans::XIntrospectionAccess >
getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
@@ -314,10 +311,9 @@ void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall)
}
void
-dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps )
+dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUString& aUrl, const uno::Sequence< beans::PropertyValue >& sProps )
{
-
- util::URL url ;
+ util::URL url;
url.Complete = aUrl;
rtl::OUString emptyString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ));
uno::Reference<frame::XController> xController = xModel->getCurrentController();
@@ -328,25 +324,22 @@ dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, u
uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
uno::Reference<uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
if ( !xContext.is() )
- {
- return ;
- }
+ return;
- uno::Reference<lang::XMultiComponentFactory > xServiceManager(
- xContext->getServiceManager() );
+ uno::Reference<lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
if ( !xServiceManager.is() )
- {
- return ;
- }
- uno::Reference<util::XURLTransformer> xParser( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) )
- ,xContext), uno::UNO_QUERY_THROW );
+ return;
+
+ uno::Reference<util::XURLTransformer> xParser( xServiceManager->createInstanceWithContext(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ), xContext),
+ uno::UNO_QUERY_THROW );
if (!xParser.is())
return;
xParser->parseStrict (url);
}
catch ( uno::Exception & /*e*/ )
{
- return ;
+ return;
}
uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0);
@@ -360,7 +353,7 @@ dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, u
dispatchProps.realloc( nProps + 1 );
// need to reaccquire pDest after realloc
pDest = dispatchProps.getArray();
- beans::PropertyValue* pSrc = sProps.getArray();
+ const beans::PropertyValue* pSrc = sProps.getConstArray();
for ( sal_Int32 index=0; index<nProps; ++index, ++pSrc, ++pDest )
*pDest = *pSrc;
}
@@ -373,16 +366,13 @@ dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, u
}
void
-dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl)
+dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUString& aUrl )
{
uno::Sequence<beans::PropertyValue> dispatchProps;
dispatchRequests( xModel, aUrl, dispatchProps );
}
-
-
-
- uno::Reference< frame::XModel >
+uno::Reference< frame::XModel >
getCurrentDoc( const rtl::OUString& sKey ) throw (uno::RuntimeException)
{
uno::Reference< frame::XModel > xModel;
@@ -840,12 +830,22 @@ double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt:
double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
{
double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
- return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor;
+ return PointsToHmm( fPoints ) * fConvertFactor;
}
double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
{
double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
- return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR;
+ return HmmToPoints( fPixels/fConvertFactor );
+}
+
+sal_Int32 PointsToHmm( double fPoints )
+{
+ return static_cast<sal_Int32>( fPoints * factor + 0.5 );
+}
+
+double HmmToPoints( sal_Int32 nHmm )
+{
+ return nHmm / factor;
}
ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& /*xContext*/, const css::uno::Reference< css::drawing::XShape >& xShape )
@@ -962,53 +962,284 @@ sal_Bool setPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const r
return sal_False;
}
-#define VBA_LEFT "PositionX"
-#define VBA_TOP "PositionY"
+// ====UserFormGeomentryHelper====
+//---------------------------------------------
UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
{
+ if ( !xControl.is() )
+ throw uno::RuntimeException();
+
+ mxControlUnits.set( xControl->getPeer(), uno::UNO_QUERY_THROW );
mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW );
}
- double UserFormGeometryHelper::getLeft()
+
+//---------------------------------------------
+sal_Int32 UserFormGeometryHelper::ConvertPixelToLogic( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nTargetUnit )
+{
+ sal_Int32 nResult = 0;
+ if ( bIsPoint )
+ {
+ // conversion for a point
+ awt::Point aPixelPoint( 0, 0 );
+ ( bIsX ? aPixelPoint.X : aPixelPoint.Y ) = nValue;
+ awt::Point aTargetPoint( 0, 0 );
+ aTargetPoint = mxControlUnits->convertPointToLogic( aPixelPoint, nTargetUnit );
+
+ nResult = bIsX ? aTargetPoint.X : aTargetPoint.Y;
+ }
+ else
+ {
+ // conversion for a size
+ awt::Size aPixelSize( 0, 0 );
+ ( bIsX ? aPixelSize.Width : aPixelSize.Height ) = nValue;
+ awt::Size aTargetSize( 0, 0 );
+ aTargetSize = mxControlUnits->convertSizeToLogic( aPixelSize, nTargetUnit );
+
+ nResult = bIsX ? aTargetSize.Width : aTargetSize.Height;
+ }
+
+ return nResult;
+}
+
+//---------------------------------------------
+sal_Int32 UserFormGeometryHelper::ConvertLogicToPixel( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nSourceUnit )
+{
+ sal_Int32 nResult = 0;
+ if ( bIsPoint )
+ {
+ // conversion for a point
+ awt::Point aSourcePoint( 0, 0 );
+ ( bIsX ? aSourcePoint.X : aSourcePoint.Y ) = nValue;
+
+ awt::Point aPixelPoint( 0, 0 );
+ aPixelPoint = mxControlUnits->convertPointToPixel( aSourcePoint, nSourceUnit );
+
+ nResult = bIsX ? aPixelPoint.X : aPixelPoint.Y;
+ }
+ else
+ {
+ // conversion for a size
+ awt::Size aSourceSize( 0, 0 );
+ ( bIsX ? aSourceSize.Width : aSourceSize.Height ) = nValue;
+
+ awt::Size aPixelSize( 0, 0 );
+ aPixelSize = mxControlUnits->convertSizeToPixel( aSourceSize, nSourceUnit );
+
+ nResult = bIsX ? aPixelSize.Width : aPixelSize.Height;
+ }
+
+ return nResult;
+}
+//---------------------------------------------
+double UserFormGeometryHelper::getLeft()
+{
+ double nResult = 0;
+
+ try
+ {
+ sal_Int32 nLeft = 0;
+ mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft;
+ nResult = ConvertLogicToPixel( nLeft,
+ sal_True, // Point
+ sal_True, // X
+ util::MeasureUnit::APPFONT );
+ }
+ catch ( uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch ( uno::Exception& e )
+ {
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get position X!" ) ),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny( e ) );
+ }
+
+ return nResult;
+}
+
+//---------------------------------------------
+void UserFormGeometryHelper::setLeft( double nLeft )
+{
+ try
+ {
+ mxModel->setPropertyValue(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ),
+ uno::makeAny( ConvertPixelToLogic( nLeft,
+ sal_True, // Point
+ sal_True, // X
+ util::MeasureUnit::APPFONT ) ) );
+ }
+ catch ( uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch ( uno::Exception& e )
+ {
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set position X!" ) ),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny( e ) );
+ }
+}
+
+//---------------------------------------------
+double UserFormGeometryHelper::getTop()
+{
+ double nResult = 0;
+
+ try
{
- sal_Int32 nLeft = 0;
- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft;
- return Millimeter::getInPoints( nLeft );
+ sal_Int32 nTop = 0;
+ mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop;
+ nResult = ConvertLogicToPixel( nTop,
+ sal_True, // Point
+ sal_False, // Y
+ util::MeasureUnit::APPFONT );
}
- void UserFormGeometryHelper::setLeft( double nLeft )
+ catch ( uno::RuntimeException& )
{
- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nLeft ) ) );
+ throw;
}
- double UserFormGeometryHelper::getTop()
+ catch ( uno::Exception& e )
{
- sal_Int32 nTop = 0;
- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop;
- return Millimeter::getInPoints( nTop );
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get position Y!" ) ),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny( e ) );
}
- void UserFormGeometryHelper::setTop( double nTop )
+
+ return nResult;
+}
+
+//---------------------------------------------
+void UserFormGeometryHelper::setTop( double nTop )
+{
+ try
+ {
+ mxModel->setPropertyValue(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ),
+ uno::makeAny( ConvertPixelToLogic( nTop,
+ sal_True, // Point
+ sal_False, // Y
+ util::MeasureUnit::APPFONT ) ) );
+ }
+ catch ( uno::RuntimeException& )
{
- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nTop ) ) );
+ throw;
}
- double UserFormGeometryHelper::getHeight()
+ catch ( uno::Exception& e )
{
- sal_Int32 nHeight = 0;
- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ) ) >>= nHeight;
- return Millimeter::getInPoints( nHeight );
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set position X!" ) ),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny( e ) );
}
- void UserFormGeometryHelper::setHeight( double nHeight )
+}
+
+//---------------------------------------------
+double UserFormGeometryHelper::getWidth()
+{
+ double nResult = 0;
+
+ try
{
- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) );
+ sal_Int32 nWidth = 0;
+ mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_WIDTH ) ) ) >>= nWidth;
+ nResult = ConvertLogicToPixel( nWidth,
+ sal_False, // Size
+ sal_True, // X
+ util::MeasureUnit::APPFONT );
}
- double UserFormGeometryHelper::getWidth()
+ catch ( uno::RuntimeException& )
{
- sal_Int32 nWidth = 0;
- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_WIDTH ) ) ) >>= nWidth;
- return Millimeter::getInPoints( nWidth );
+ throw;
}
- void UserFormGeometryHelper::setWidth( double nWidth)
+ catch ( uno::Exception& e )
{
- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_WIDTH ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) );
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get width!" ) ),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny( e ) );
}
+ return nResult;
+}
+
+//---------------------------------------------
+void UserFormGeometryHelper::setWidth( double nWidth)
+{
+ try
+ {
+ mxModel->setPropertyValue(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_WIDTH ) ),
+ uno::makeAny( ConvertPixelToLogic( nWidth,
+ sal_False, // Size
+ sal_True, // X
+ util::MeasureUnit::APPFONT ) ) );
+ }
+ catch ( uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch ( uno::Exception& e )
+ {
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set width!" ) ),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny( e ) );
+ }
+}
+
+//---------------------------------------------
+double UserFormGeometryHelper::getHeight()
+{
+ double nResult = 0;
+
+ try
+ {
+ sal_Int32 nHeight = 0;
+ mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_HEIGHT ) ) ) >>= nHeight;
+ nResult = ConvertLogicToPixel( nHeight,
+ sal_False, // Size
+ sal_False, // Y
+ util::MeasureUnit::APPFONT );
+ }
+ catch ( uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch ( uno::Exception& e )
+ {
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get height!" ) ),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny( e ) );
+ }
+
+ return nResult;
+}
+
+//---------------------------------------------
+void UserFormGeometryHelper::setHeight( double nHeight )
+{
+ try
+ {
+ mxModel->setPropertyValue(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_HEIGHT ) ),
+ uno::makeAny( ConvertPixelToLogic( nHeight,
+ sal_False, // Size
+ sal_False, // Y
+ util::MeasureUnit::APPFONT ) ) );
+ }
+ catch ( uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch ( uno::Exception& e )
+ {
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set height!" ) ),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny( e ) );
+ }
+}
+
+// ============
+
double ConcreteXShapeGeometryAttributes::getLeft()
{
return m_pShapeHelper->getLeft();
@@ -1140,8 +1371,7 @@ UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComp
void Millimeter::set(double mm) { m_nMillimeter = mm; }
void Millimeter::setInPoints(double points)
{
- m_nMillimeter = points * 0.352777778;
- // 25.4mm / 72
+ m_nMillimeter = points * factor / 100.0;
}
void Millimeter::setInHundredthsOfOneMillimeter(double hmm)
@@ -1159,7 +1389,7 @@ UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComp
}
double Millimeter::getInPoints()
{
- return m_nMillimeter * 2.834645669; // 72 / 25.4mm
+ return m_nMillimeter / factor * 100.0;
}
sal_Int32 Millimeter::getInHundredthsOfOneMillimeter(double points)
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 6693d69d5d..4c02cb86ac 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -1162,7 +1162,8 @@ Reference< XHierarchicalNameAccess > Databases::jarFile( const rtl::OUString& ja
Reference< XHierarchicalNameAccess > Databases::findJarFileForPath
( const rtl::OUString& jar, const rtl::OUString& Language,
- const rtl::OUString& path, rtl::OUString* o_pExtensionPath )
+ const rtl::OUString& path, rtl::OUString* o_pExtensionPath,
+ rtl::OUString* o_pExtensionRegistryPath )
{
Reference< XHierarchicalNameAccess > xNA;
if( ! jar.getLength() ||
@@ -1174,7 +1175,7 @@ Reference< XHierarchicalNameAccess > Databases::findJarFileForPath
JarFileIterator aJarFileIt( m_xContext, *this, jar, Language );
Reference< XHierarchicalNameAccess > xTestNA;
Reference< deployment::XPackage > xParentPackageBundle;
- while( (xTestNA = aJarFileIt.nextJarFile( xParentPackageBundle, o_pExtensionPath )).is() )
+ while( (xTestNA = aJarFileIt.nextJarFile( xParentPackageBundle, o_pExtensionPath, o_pExtensionRegistryPath )).is() )
{
if( xTestNA.is() && xTestNA->hasByHierarchicalName( path ) )
{
@@ -1510,8 +1511,10 @@ void ExtensionIteratorBase::init()
m_bUserPackagesLoaded = false;
m_bSharedPackagesLoaded = false;
+ m_bBundledPackagesLoaded = false;
m_iUserPackage = 0;
m_iSharedPackage = 0;
+ m_iBundledPackage = 0;
}
Reference< deployment::XPackage > ExtensionIteratorBase::implGetHelpPackageFromPackage
@@ -1622,7 +1625,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa
if( m_iSharedPackage == m_aSharedPackagesSeq.getLength() )
{
- m_eState = END_REACHED;
+ m_eState = BUNDLED_EXTENSIONS;
}
else
{
@@ -1635,6 +1638,36 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa
return xHelpPackage;
}
+Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextBundledHelpPackage
+ ( Reference< deployment::XPackage >& o_xParentPackageBundle )
+{
+ Reference< deployment::XPackage > xHelpPackage;
+
+ if( !m_bBundledPackagesLoaded )
+ {
+ Reference< XPackageManager > xBundledManager =
+ thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("bundled") );
+ m_aBundledPackagesSeq = xBundledManager->getDeployedPackages
+ ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
+ m_bBundledPackagesLoaded = true;
+ }
+
+ if( m_iBundledPackage == m_aBundledPackagesSeq.getLength() )
+ {
+ m_eState = END_REACHED;
+ }
+ else
+ {
+ const Reference< deployment::XPackage >* pBundledPackages =
+ m_aBundledPackagesSeq.getConstArray();
+ Reference< deployment::XPackage > xPackage = pBundledPackages[ m_iBundledPackage++ ];
+ VOS_ENSURE( xPackage.is(), "ExtensionIteratorBase::implGetNextBundledHelpPackage(): Invalid package" );
+ xHelpPackage = implGetHelpPackageFromPackage( xPackage, o_xParentPackageBundle );
+ }
+
+ return xHelpPackage;
+}
+
rtl::OUString ExtensionIteratorBase::implGetFileFromPackage(
const rtl::OUString& rFileExtension, Reference< deployment::XPackage > xPackage )
{
@@ -1646,7 +1679,7 @@ rtl::OUString ExtensionIteratorBase::implGetFileFromPackage(
for( sal_Int32 iPass = 0 ; iPass < 2 ; ++iPass )
{
rtl::OUStringBuffer aStrBuf;
- aStrBuf.append( xPackage->getURL() );
+ aStrBuf.append( xPackage->getRegistrationDataURL().Value);
aStrBuf.append( aSlash );
aStrBuf.append( aLanguage );
if( !bLangFolderOnly )
@@ -1720,7 +1753,7 @@ void ExtensionIteratorBase::implGetLanguageVectorFromPackage( ::std::vector< ::r
//===================================================================
// class DataBaseIterator
-Db* DataBaseIterator::nextDb( rtl::OUString* o_pExtensionPath )
+Db* DataBaseIterator::nextDb( rtl::OUString* o_pExtensionPath, rtl::OUString* o_pExtensionRegistryPath )
{
Db* pRetDb = NULL;
@@ -1743,7 +1776,7 @@ Db* DataBaseIterator::nextDb( rtl::OUString* o_pExtensionPath )
Reference< deployment::XPackage > xHelpPackage = implGetNextUserHelpPackage( xParentPackageBundle );
if( !xHelpPackage.is() )
break;
- pRetDb = implGetDbFromPackage( xHelpPackage, o_pExtensionPath );
+ pRetDb = implGetDbFromPackage( xHelpPackage, o_pExtensionPath, o_pExtensionRegistryPath );
break;
}
@@ -1754,9 +1787,21 @@ Db* DataBaseIterator::nextDb( rtl::OUString* o_pExtensionPath )
if( !xHelpPackage.is() )
break;
- pRetDb = implGetDbFromPackage( xHelpPackage, o_pExtensionPath );
+ pRetDb = implGetDbFromPackage( xHelpPackage, o_pExtensionPath, o_pExtensionRegistryPath );
break;
}
+
+ case BUNDLED_EXTENSIONS:
+ {
+ Reference< deployment::XPackage > xParentPackageBundle;
+ Reference< deployment::XPackage > xHelpPackage = implGetNextBundledHelpPackage( xParentPackageBundle );
+ if( !xHelpPackage.is() )
+ break;
+
+ pRetDb = implGetDbFromPackage( xHelpPackage, o_pExtensionPath, o_pExtensionRegistryPath );
+ break;
+ }
+
case END_REACHED:
VOS_ENSURE( false, "DataBaseIterator::nextDb(): Invalid case END_REACHED" );
break;
@@ -1767,39 +1812,56 @@ Db* DataBaseIterator::nextDb( rtl::OUString* o_pExtensionPath )
}
Db* DataBaseIterator::implGetDbFromPackage( Reference< deployment::XPackage > xPackage,
- rtl::OUString* o_pExtensionPath )
+ rtl::OUString* o_pExtensionPath, rtl::OUString* o_pExtensionRegistryPath )
{
- rtl::OUString aExtensionPath = xPackage->getURL();
- //if( o_pExtensionPath )
- //*o_pExtensionPath = aExtensionPath;
- aExtensionPath += aSlash;
-
- rtl::OUString aUsedLanguage = m_aLanguage;
- Db* pRetDb = m_rDatabases.getBerkeley( aHelpFilesBaseName, aUsedLanguage,
- m_bHelpText, &aExtensionPath );
+
+ beans::Optional< ::rtl::OUString> optRegData;
+ try
+ {
+ optRegData = xPackage->getRegistrationDataURL();
+ }
+ catch ( deployment::ExtensionRemovedException&)
+ {
+ return NULL;
+ }
- // Language fallback
- if( !pRetDb )
+ Db* pRetDb = NULL;
+ if (optRegData.IsPresent && optRegData.Value.getLength() > 0)
{
- ::std::vector< ::rtl::OUString > av;
- implGetLanguageVectorFromPackage( av, xPackage );
- ::std::vector< ::rtl::OUString >::const_iterator pFound = av.end();
- try
- {
- pFound = ::comphelper::Locale::getFallback( av, m_aLanguage );
- }
- catch( ::comphelper::Locale::MalFormedLocaleException& )
- {}
- if( pFound != av.end() )
+ rtl::OUString aRegDataUrl(optRegData.Value);
+ aRegDataUrl += aSlash;
+
+ rtl::OUString aUsedLanguage = m_aLanguage;
+ pRetDb = m_rDatabases.getBerkeley(
+ aHelpFilesBaseName, aUsedLanguage, m_bHelpText, &aRegDataUrl);
+
+ // Language fallback
+ if( !pRetDb )
{
- aUsedLanguage = *pFound;
- pRetDb = m_rDatabases.getBerkeley( aHelpFilesBaseName, aUsedLanguage, m_bHelpText, &aExtensionPath );
+ ::std::vector< ::rtl::OUString > av;
+ implGetLanguageVectorFromPackage( av, xPackage );
+ ::std::vector< ::rtl::OUString >::const_iterator pFound = av.end();
+ try
+ {
+ pFound = ::comphelper::Locale::getFallback( av, m_aLanguage );
+ }
+ catch( ::comphelper::Locale::MalFormedLocaleException& )
+ {}
+ if( pFound != av.end() )
+ {
+ aUsedLanguage = *pFound;
+ pRetDb = m_rDatabases.getBerkeley(
+ aHelpFilesBaseName, aUsedLanguage, m_bHelpText, &aRegDataUrl);
+ }
}
- }
- if( o_pExtensionPath )
- *o_pExtensionPath = aExtensionPath + aUsedLanguage;
+ if( o_pExtensionPath )
+ *o_pExtensionPath = aRegDataUrl + aUsedLanguage;
+ if( o_pExtensionRegistryPath )
+ *o_pExtensionRegistryPath = xPackage->getURL() + aSlash + aUsedLanguage;
+ }
+
return pRetDb;
}
@@ -1853,6 +1915,19 @@ rtl::OUString KeyDataBaseFileIterator::nextDbFile( bool& o_rbExtension )
o_rbExtension = true;
break;
}
+
+ case BUNDLED_EXTENSIONS:
+ {
+ Reference< deployment::XPackage > xParentPackageBundle;
+ Reference< deployment::XPackage > xHelpPackage = implGetNextBundledHelpPackage( xParentPackageBundle );
+ if( !xHelpPackage.is() )
+ break;
+
+ aRetFile = implGetDbFileFromPackage( xHelpPackage );
+ o_rbExtension = true;
+ break;
+ }
+
case END_REACHED:
VOS_ENSURE( false, "DataBaseIterator::nextDbFile(): Invalid case END_REACHED" );
break;
@@ -1879,7 +1954,8 @@ rtl::OUString KeyDataBaseFileIterator::implGetDbFileFromPackage
// class JarFileIterator
Reference< XHierarchicalNameAccess > JarFileIterator::nextJarFile
- ( Reference< deployment::XPackage >& o_xParentPackageBundle, rtl::OUString* o_pExtensionPath )
+ ( Reference< deployment::XPackage >& o_xParentPackageBundle,
+ rtl::OUString* o_pExtensionPath, rtl::OUString* o_pExtensionRegistryPath )
{
Reference< XHierarchicalNameAccess > xNA;
@@ -1902,7 +1978,7 @@ Reference< XHierarchicalNameAccess > JarFileIterator::nextJarFile
if( !xHelpPackage.is() )
break;
- xNA = implGetJarFromPackage( xHelpPackage, o_pExtensionPath );
+ xNA = implGetJarFromPackage( xHelpPackage, o_pExtensionPath, o_pExtensionRegistryPath );
break;
}
@@ -1912,9 +1988,20 @@ Reference< XHierarchicalNameAccess > JarFileIterator::nextJarFile
if( !xHelpPackage.is() )
break;
- xNA = implGetJarFromPackage( xHelpPackage, o_pExtensionPath );
+ xNA = implGetJarFromPackage( xHelpPackage, o_pExtensionPath, o_pExtensionRegistryPath );
break;
}
+
+ case BUNDLED_EXTENSIONS:
+ {
+ Reference< deployment::XPackage > xHelpPackage = implGetNextBundledHelpPackage( o_xParentPackageBundle );
+ if( !xHelpPackage.is() )
+ break;
+
+ xNA = implGetJarFromPackage( xHelpPackage, o_pExtensionPath, o_pExtensionRegistryPath );
+ break;
+ }
+
case END_REACHED:
VOS_ENSURE( false, "JarFileIterator::nextJarFile(): Invalid case END_REACHED" );
break;
@@ -1925,7 +2012,7 @@ Reference< XHierarchicalNameAccess > JarFileIterator::nextJarFile
}
Reference< XHierarchicalNameAccess > JarFileIterator::implGetJarFromPackage
- ( Reference< deployment::XPackage > xPackage, rtl::OUString* o_pExtensionPath )
+( Reference< deployment::XPackage > xPackage, rtl::OUString* o_pExtensionPath, rtl::OUString* o_pExtensionRegistryPath )
{
Reference< XHierarchicalNameAccess > xNA;
@@ -1970,6 +2057,15 @@ Reference< XHierarchicalNameAccess > JarFileIterator::implGetJarFromPackage
sal_Int32 nLastSlash = zipFile.lastIndexOf( '/' );
if( nLastSlash != -1 )
*o_pExtensionPath = zipFile.copy( 0, nLastSlash );
+
+ if( o_pExtensionRegistryPath != NULL )
+ {
+ rtl::OUString& rPath = *o_pExtensionPath;
+ sal_Int32 nLastSlashInPath = rPath.lastIndexOf( '/', rPath.getLength() - 1 );
+
+ *o_pExtensionRegistryPath = xPackage->getURL();
+ *o_pExtensionRegistryPath += rPath.copy( nLastSlashInPath);
+ }
}
return xNA;
@@ -2026,6 +2122,19 @@ rtl::OUString IndexFolderIterator::nextIndexFolder( bool& o_rbExtension, bool& o
o_rbExtension = true;
break;
}
+
+ case BUNDLED_EXTENSIONS:
+ {
+ Reference< deployment::XPackage > xParentPackageBundle;
+ Reference< deployment::XPackage > xHelpPackage = implGetNextBundledHelpPackage( xParentPackageBundle );
+ if( !xHelpPackage.is() )
+ break;
+
+ aIndexFolder = implGetIndexFolderFromPackage( o_rbTemporary, xHelpPackage );
+ o_rbExtension = true;
+ break;
+ }
+
case END_REACHED:
VOS_ENSURE( false, "IndexFolderIterator::nextIndexFolder(): Invalid case END_REACHED" );
break;
diff --git a/xmlhelp/source/cxxhelp/provider/databases.hxx b/xmlhelp/source/cxxhelp/provider/databases.hxx
index 51b469cfa0..0b26e2501b 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.hxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.hxx
@@ -267,7 +267,8 @@ namespace chelp {
com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess >
findJarFileForPath( const rtl::OUString& jar, const rtl::OUString& Language,
- const rtl::OUString& path, rtl::OUString* o_pExtensionPath = NULL );
+ const rtl::OUString& path, rtl::OUString* o_pExtensionPath = NULL,
+ rtl::OUString* o_pExtensionRegistryPath = NULL );
/**
* Maps a given language-locale combination to language.
@@ -398,6 +399,7 @@ namespace chelp {
//SHARED_MODULE, // Later, avoids redundancies in help compiling
USER_EXTENSIONS,
SHARED_EXTENSIONS,
+ BUNDLED_EXTENSIONS,
END_REACHED
};
@@ -433,6 +435,8 @@ namespace chelp {
( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextSharedHelpPackage
( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
+ com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextBundledHelpPackage
+ ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
rtl::OUString implGetFileFromPackage( const rtl::OUString& rFileExtension,
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage );
void implGetLanguageVectorFromPackage( ::std::vector< ::rtl::OUString > &rv,
@@ -456,8 +460,13 @@ namespace chelp {
< com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq;
bool m_bSharedPackagesLoaded;
+ com::sun::star::uno::Sequence< com::sun::star::uno::Reference
+ < com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq;
+ bool m_bBundledPackagesLoaded;
+
int m_iUserPackage;
int m_iSharedPackage;
+ int m_iBundledPackage;
}; // end class ExtensionIteratorBase
@@ -477,13 +486,13 @@ namespace chelp {
, m_bHelpText( bHelpText )
{}
- berkeleydbproxy::Db* nextDb( rtl::OUString* o_pExtensionPath = NULL );
+ berkeleydbproxy::Db* nextDb( rtl::OUString* o_pExtensionPath = NULL, rtl::OUString* o_pExtensionRegistryPath = NULL );
private:
berkeleydbproxy::Db* implGetDbFromPackage(
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage,
- rtl::OUString* o_pExtensionPath );
+ rtl::OUString* o_pExtensionPath, rtl::OUString* o_pExtensionRegistryPath );
bool m_bHelpText;
@@ -517,12 +526,12 @@ namespace chelp {
com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess >
nextJarFile( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle,
- rtl::OUString* o_pExtensionPath = NULL );
+ rtl::OUString* o_pExtensionPath = NULL, rtl::OUString* o_pExtensionRegistryPath = NULL );
private:
com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess >
implGetJarFromPackage(com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage,
- rtl::OUString* o_pExtensionPath = NULL );
+ rtl::OUString* o_pExtensionPath = NULL, rtl::OUString* o_pExtensionRegistryPath = NULL );
}; // end class JarFileIterator
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
index 646c55ab8b..0082163a26 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -306,9 +306,10 @@ void URLParameter::readBerkeley()
Dbt data;
DBData aDBData;
rtl::OUString aExtensionPath;
+ rtl::OUString aExtensionRegistryPath;
while( true )
{
- Db* db = aDbIt.nextDb( &aExtensionPath );
+ Db* db = aDbIt.nextDb( &aExtensionPath, &aExtensionRegistryPath );
if( !db )
break;
@@ -355,6 +356,7 @@ void URLParameter::readBerkeley()
aExtendedJarStrBuf.append( aQuestionMark );
aExtendedJarStrBuf.append( m_aJar );
m_aJar = aExtendedJarStrBuf.makeStringAndClear();
+ m_aExtensionRegistryPath = aExtensionRegistryPath;
}
m_aTag = converter.getHash();
}
@@ -1004,18 +1006,20 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam,
rtl::OUString aJar = urlParam->get_jar();
bool bAddExtensionPath = false;
+ rtl::OUString aExtensionRegistryPath;
sal_Int32 nQuestionMark1 = aJar.indexOf( sal_Unicode('?') );
sal_Int32 nQuestionMark2 = aJar.lastIndexOf( sal_Unicode('?') );
if( nQuestionMark1 != -1 && nQuestionMark2 != -1 && nQuestionMark1 != nQuestionMark2 )
{
aExtensionPath = aJar.copy( nQuestionMark1 + 1, nQuestionMark2 - nQuestionMark1 - 1 );
+ aExtensionRegistryPath = urlParam->get_ExtensionRegistryPath();
bAddExtensionPath = true;
}
else
{
// Path not yet specified, search directly
Reference< XHierarchicalNameAccess > xNA = pDatabases->findJarFileForPath
- ( aJar, urlParam->get_language(), urlParam->get_path(), &aExtensionPath );
+ ( aJar, urlParam->get_language(), urlParam->get_path(), &aExtensionPath, &aExtensionRegistryPath );
if( xNA.is() && aExtensionPath.getLength() )
bAddExtensionPath = true;
}
@@ -1038,7 +1042,7 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam,
Reference< XInterface >() );
}
- rtl::OUString aOUExpandedExtensionPath = Databases::expandURL( aExtensionPath, xContext );
+ rtl::OUString aOUExpandedExtensionPath = Databases::expandURL( aExtensionRegistryPath, xContext );
rtl::OString aExpandedExtensionPath = rtl::OUStringToOString( aOUExpandedExtensionPath, osl_getThreadTextEncoding() );
parString[last++] = "ExtensionPath";
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.hxx b/xmlhelp/source/cxxhelp/provider/urlparameter.hxx
index 354ead14b5..d9716f15fc 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.hxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.hxx
@@ -150,6 +150,8 @@ namespace chelp {
rtl::OUString get_jar() { return get_the_jar(); } // BerkeleyDb
+ rtl::OUString get_ExtensionRegistryPath() { return m_aExtensionRegistryPath; }
+
rtl::OUString get_module() { return m_aModule; }
rtl::OUString get_dbpar() {
@@ -203,6 +205,7 @@ namespace chelp {
rtl::OUString m_aModule;
rtl::OUString m_aTitle;
rtl::OUString m_aJar;
+ rtl::OUString m_aExtensionRegistryPath;
rtl::OUString m_aEid;
rtl::OUString m_aDbPar;
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index 02ba6b9eaa..3942844285 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -986,8 +986,10 @@ void ExtensionIteratorBase::init()
m_bUserPackagesLoaded = false;
m_bSharedPackagesLoaded = false;
+ m_bBundledPackagesLoaded = false;
m_iUserPackage = 0;
m_iSharedPackage = 0;
+ m_iBundledPackage = 0;
}
Reference< deployment::XPackage > ExtensionIteratorBase::implGetHelpPackageFromPackage
@@ -1089,7 +1091,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa
if( m_iSharedPackage == m_aSharedPackagesSeq.getLength() )
{
- m_eState = END_REACHED;
+ m_eState = BUNDLED_EXTENSIONS;
}
else
{
@@ -1102,6 +1104,36 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa
return xHelpPackage;
}
+Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextBundledHelpPackage
+ ( Reference< deployment::XPackage >& o_xParentPackageBundle )
+{
+ Reference< deployment::XPackage > xHelpPackage;
+
+ if( !m_bBundledPackagesLoaded )
+ {
+ Reference< XPackageManager > xBundledManager =
+ thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("bundled") );
+ m_aBundledPackagesSeq = xBundledManager->getDeployedPackages
+ ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
+
+ m_bBundledPackagesLoaded = true;
+ }
+
+ if( m_iBundledPackage == m_aBundledPackagesSeq.getLength() )
+ {
+ m_eState = END_REACHED;
+ }
+ else
+ {
+ const Reference< deployment::XPackage >* pBundledPackages = m_aBundledPackagesSeq.getConstArray();
+ Reference< deployment::XPackage > xPackage = pBundledPackages[ m_iBundledPackage++ ];
+ VOS_ENSURE( xPackage.is(), "ExtensionIteratorBase::implGetNextBundledHelpPackage(): Invalid package" );
+ xHelpPackage = implGetHelpPackageFromPackage( xPackage, o_xParentPackageBundle );
+ }
+
+ return xHelpPackage;
+}
+
inline bool isLetter( sal_Unicode c )
{
bool bLetter = ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
@@ -1173,7 +1205,18 @@ rtl::OUString TreeFileIterator::nextTreeFile( sal_Int32& rnFileSize )
aRetFile = implGetTreeFileFromPackage( rnFileSize, xHelpPackage );
break;
}
- case END_REACHED:
+ case BUNDLED_EXTENSIONS:
+ {
+ Reference< deployment::XPackage > xParentPackageBundle;
+ Reference< deployment::XPackage > xHelpPackage = implGetNextBundledHelpPackage( xParentPackageBundle );
+ if( !xHelpPackage.is() )
+ break;
+
+ aRetFile = implGetTreeFileFromPackage( rnFileSize, xHelpPackage );
+ break;
+ }
+
+ case END_REACHED:
VOS_ENSURE( false, "DataBaseIterator::nextTreeFile(): Invalid case END_REACHED" );
break;
}
diff --git a/xmlhelp/source/treeview/tvread.hxx b/xmlhelp/source/treeview/tvread.hxx
index 65cfd7c00c..c0d2f51f33 100644
--- a/xmlhelp/source/treeview/tvread.hxx
+++ b/xmlhelp/source/treeview/tvread.hxx
@@ -328,6 +328,7 @@ namespace treeview {
{
USER_EXTENSIONS,
SHARED_EXTENSIONS,
+ BUNDLED_EXTENSIONS,
END_REACHED
};
@@ -347,6 +348,9 @@ namespace treeview {
( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextSharedHelpPackage
( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
+ com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextBundledHelpPackage
+ ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
+
void implGetLanguageVectorFromPackage( ::std::vector< ::rtl::OUString > &rv,
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage );
@@ -365,8 +369,13 @@ namespace treeview {
< com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq;
bool m_bSharedPackagesLoaded;
+ com::sun::star::uno::Sequence< com::sun::star::uno::Reference
+ < com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq;
+ bool m_bBundledPackagesLoaded;
+
int m_iUserPackage;
int m_iSharedPackage;
+ int m_iBundledPackage;
}; // end class ExtensionIteratorBase
diff --git a/xmloff/inc/xmloff/XMLEventExport.hxx b/xmloff/inc/xmloff/XMLEventExport.hxx
index 6ec4ed86ea..dc00dc00f2 100644
--- a/xmloff/inc/xmloff/XMLEventExport.hxx
+++ b/xmloff/inc/xmloff/XMLEventExport.hxx
@@ -73,6 +73,8 @@ class XMLOFF_DLLPUBLIC XMLEventExport
HandlerMap aHandlerMap;
NameMap aNameTranslationMap;
+ bool bExtNamespace;
+
public:
XMLEventExport(SvXMLExport& rExport,
const XMLEventNameTranslation* pTranslationTable = NULL);
@@ -104,6 +106,12 @@ public:
::com::sun::star::container::XNameAccess> & xAccess,
sal_Bool bUseWhitespace = sal_True);
+ /// export the events, but write <officeooo:events> element
+ /// (for new file format additions)
+ void ExportExt( ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameAccess> & xAccess,
+ sal_Bool bUseWhitespace = sal_True);
+
/// export a single event (writes <office:events> element)
void ExportSingleEvent(
::com::sun::star::uno::Sequence<
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index f631c5855d..6adeb410bc 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -1708,6 +1708,7 @@ namespace xmloff { namespace token {
XML_SYMBOL_IMAGE_NAME,
XML_SYMBOL_WIDTH,
XML_SYSTEM,
+ XML_TAB_COLOR,
XML_TAB_STOP,
XML_TAB_STOP_DISTANCE,
XML_TAB_STOPS,
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 1000fd6443..c6722cf485 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -1237,18 +1237,23 @@ void SchXMLAxisContext::CreateAxis()
case SCH_XML_AXIS_Z:
{
+ bool bSettingZAxisSuccedded = false;
try
{
- xDiaProp->setPropertyValue(
- rtl::OUString::createFromAscii( "HasZAxis" ), aTrueBool );
+ rtl::OUString sHasZAxis( rtl::OUString::createFromAscii( "HasZAxis" ) );
+ xDiaProp->setPropertyValue( sHasZAxis, aTrueBool );
+ xDiaProp->getPropertyValue( sHasZAxis ) >>= bSettingZAxisSuccedded;
}
catch( beans::UnknownPropertyException & )
{
DBG_ERROR( "Couldn't turn on z axis" );
}
- uno::Reference< chart::XAxisZSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is())
- xProp = xSuppl->getZAxis();
+ if( bSettingZAxisSuccedded )
+ {
+ uno::Reference< chart::XAxisZSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
+ if( xSuppl.is())
+ xProp = xSuppl->getZAxis();
+ }
}
break;
case SCH_XML_AXIS_UNDEF:
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 7ed6e82287..7dc3bc32f4 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1716,6 +1716,7 @@ namespace xmloff { namespace token {
TOKEN( "symbol-image-name", XML_SYMBOL_IMAGE_NAME ),
TOKEN( "symbol-width", XML_SYMBOL_WIDTH ),
TOKEN( "system", XML_SYSTEM ),
+ TOKEN( "tab-color", XML_TAB_COLOR ),
TOKEN( "tab-stop", XML_TAB_STOP ),
TOKEN( "tab-stop-distance", XML_TAB_STOP_DISTANCE ),
TOKEN( "tab-stops", XML_TAB_STOPS ),
diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx
index 06c227bcdf..e573f03f96 100644
--- a/xmloff/source/draw/ximppage.cxx
+++ b/xmloff/source/draw/ximppage.cxx
@@ -339,6 +339,9 @@ void SdXMLGenericPageContext::EndElement()
else if( aDateTimeFormat.getLength() )
{
const SdXMLStylesContext* pStyles = dynamic_cast< const SdXMLStylesContext* >( GetSdImport().GetShapeImport()->GetStylesContext() );
+ if( !pStyles )
+ pStyles = dynamic_cast< const SdXMLStylesContext* >( GetSdImport().GetShapeImport()->GetAutoStylesContext() );
+
if( pStyles )
{
const SdXMLNumberFormatImportContext* pSdNumStyle =
diff --git a/xmloff/source/script/XMLEventExport.cxx b/xmloff/source/script/XMLEventExport.cxx
index a67aee443d..31d143c62c 100644
--- a/xmloff/source/script/XMLEventExport.cxx
+++ b/xmloff/source/script/XMLEventExport.cxx
@@ -62,7 +62,8 @@ using ::xmloff::token::XML_EVENT_LISTENERS;
XMLEventExport::XMLEventExport(SvXMLExport& rExp,
const XMLEventNameTranslation* pTranslationTable) :
sEventType(RTL_CONSTASCII_USTRINGPARAM("EventType")),
- rExport(rExp)
+ rExport(rExp),
+ bExtNamespace(false)
{
AddTranslationTable(pTranslationTable);
}
@@ -175,6 +176,16 @@ void XMLEventExport::Export( Reference<XNameAccess> & rAccess,
}
}
+void XMLEventExport::ExportExt( Reference<XNameAccess> & rAccess,
+ sal_Bool bWhitespace )
+{
+ // set bExtNamespace flag to use XML_NAMESPACE_OFFICE_EXT namespace
+ // for events element (not for child elements)
+ bExtNamespace = true;
+ Export(rAccess, bWhitespace);
+ bExtNamespace = false; // reset for future Export calls
+}
+
/// export a singular event and wirte <office:events> container
void XMLEventExport::ExportSingleEvent(
Sequence<PropertyValue>& rEventValues,
@@ -270,13 +281,17 @@ void XMLEventExport::StartElement(sal_Bool bWhitespace)
{
rExport.IgnorableWhitespace();
}
- rExport.StartElement( XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS,
+ sal_uInt16 nNamespace = bExtNamespace ? XML_NAMESPACE_OFFICE_EXT
+ : XML_NAMESPACE_OFFICE;
+ rExport.StartElement( nNamespace, XML_EVENT_LISTENERS,
bWhitespace);
}
void XMLEventExport::EndElement(sal_Bool bWhitespace)
{
- rExport.EndElement(XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, bWhitespace);
+ sal_uInt16 nNamespace = bExtNamespace ? XML_NAMESPACE_OFFICE_EXT
+ : XML_NAMESPACE_OFFICE;
+ rExport.EndElement(nNamespace, XML_EVENT_LISTENERS, bWhitespace);
if (bWhitespace)
{
rExport.IgnorableWhitespace();
@@ -343,6 +358,10 @@ const XMLEventNameTranslation aStandardEventTable[] =
{ "OnFieldMerge", XML_NAMESPACE_OFFICE, "field-merge" },
{ "OnFieldMergeFinished", XML_NAMESPACE_OFFICE, "field-merge-finished" },
{ "OnLayoutFinished", XML_NAMESPACE_OFFICE, "layout-finished" },
+ { "OnDoubleClick", XML_NAMESPACE_OFFICE, "dblclick" },
+ { "OnRightClick", XML_NAMESPACE_OFFICE, "contextmenu" },
+ { "OnChange", XML_NAMESPACE_OFFICE, "content-changed" },
+ { "OnCalculate", XML_NAMESPACE_OFFICE, "calculated" },
{ NULL, 0, 0 }
};
diff --git a/xmlscript/inc/xmlscript/xmlmod_imexp.hxx b/xmlscript/inc/xmlscript/xmlmod_imexp.hxx
index 33f091cd41..5bea5cbd66 100644
--- a/xmlscript/inc/xmlscript/xmlmod_imexp.hxx
+++ b/xmlscript/inc/xmlscript/xmlmod_imexp.hxx
@@ -45,6 +45,7 @@ struct ModuleDescriptor
::rtl::OUString aName;
::rtl::OUString aLanguage;
::rtl::OUString aCode;
+ ::rtl::OUString aModuleType; // VBA
};
void
diff --git a/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx b/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx
index fd6a3d2b2d..d41375d57e 100644
--- a/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx
+++ b/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx
@@ -65,6 +65,9 @@ SAL_CALL exportScriptModule(
rMod.aName );
pModElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":language") ),
rMod.aLanguage );
+ if( rMod.aModuleType.getLength()>0 )
+ pModElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":moduleType") ),
+ rMod.aModuleType );
xOut->ignorableWhitespace( OUString() );
xOut->startElement( aModuleName, xAttributes );
diff --git a/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx b/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx
index e17da69ce0..6cb14ece7f 100644
--- a/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx
+++ b/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx
@@ -188,11 +188,14 @@ Reference< xml::input::XElement > ModuleImport::startRootElement(
else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("module") ))
{
mrModuleDesc.aName = xAttributes->getValueByUidName(
- XMLNS_LIBRARY_UID,
+ XMLNS_SCRIPT_UID,
OUString( RTL_CONSTASCII_USTRINGPARAM("name") ) );
mrModuleDesc.aLanguage = xAttributes->getValueByUidName(
- XMLNS_XLINK_UID,
+ XMLNS_SCRIPT_UID,
OUString( RTL_CONSTASCII_USTRINGPARAM("language") ) );
+ mrModuleDesc.aModuleType = xAttributes->getValueByUidName(
+ XMLNS_SCRIPT_UID,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("moduleType") ) );
return new ModuleElement( rLocalName, xAttributes, 0, this );
}