Conflicts: avmedia/inc/avmedia/mediaitem.hxx avmedia/prj/build.lst avmedia/source/framework/mediaitem.cxx avmedia/source/gstreamer/gstcommon.hxx avmedia/source/gstreamer/gstframegrabber.cxx avmedia/source/gstreamer/gstframegrabber.hxx avmedia/source/gstreamer/gstmanager.cxx avmedia/source/gstreamer/gstmanager.hxx avmedia/source/gstreamer/gstplayer.cxx avmedia/source/gstreamer/gstplayer.hxx avmedia/source/gstreamer/gstuno.cxx avmedia/source/gstreamer/gstwindow.cxx avmedia/source/gstreamer/gstwindow.hxx avmedia/source/gstreamer/makefile.mk avmedia/source/quicktime/quicktimeuno.cxx avmedia/source/viewer/mediawindow.cxx avmedia/source/viewer/mediawindow_impl.cxx avmedia/source/viewer/mediawindow_impl.hxx avmedia/source/viewer/mediawindowbase_impl.cxx avmedia/source/win/winuno.cxx basic/inc/basic/basmgr.hxx basic/inc/basic/mybasic.hxx basic/inc/basic/process.hxx basic/inc/basic/sbmeth.hxx basic/inc/basic/sbmod.hxx basic/inc/basic/sbxdef.hxx basic/inc/basic/sbxvar.hxx basic/source/app/app.cxx basic/source/app/app.hxx basic/source/app/appbased.cxx basic/source/app/appedit.cxx basic/source/app/appwin.cxx basic/source/app/appwin.hxx basic/source/app/brkpnts.cxx basic/source/app/brkpnts.hxx basic/source/app/dialogs.cxx basic/source/app/dialogs.hxx basic/source/app/msgedit.cxx basic/source/app/mybasic.cxx basic/source/app/process.cxx basic/source/app/processw.hxx basic/source/app/textedit.cxx basic/source/basmgr/basicmanagerrepository.cxx basic/source/basmgr/basmgr.cxx basic/source/classes/disas.cxx basic/source/classes/eventatt.cxx basic/source/classes/image.cxx basic/source/classes/sb.cxx basic/source/classes/sbunoobj.cxx basic/source/classes/sbxmod.cxx basic/source/comp/codegen.cxx basic/source/comp/dim.cxx basic/source/comp/exprgen.cxx basic/source/comp/exprnode.cxx basic/source/comp/exprtree.cxx basic/source/comp/sbcomp.cxx basic/source/inc/expr.hxx basic/source/inc/object.hxx basic/source/inc/sbunoobj.hxx basic/source/runtime/dllmgr-x86.cxx basic/source/runtime/iosys.cxx basic/source/runtime/makefile.mk basic/source/runtime/methods.cxx basic/source/runtime/methods1.cxx basic/source/runtime/runtime.cxx basic/source/runtime/stdobj.cxx basic/source/runtime/step0.cxx basic/source/runtime/step1.cxx basic/source/runtime/step2.cxx basic/source/sbx/sbxarray.cxx basic/source/sbx/sbxbase.cxx basic/source/sbx/sbxbool.cxx basic/source/sbx/sbxbyte.cxx basic/source/sbx/sbxcoll.cxx basic/source/sbx/sbxconv.hxx basic/source/sbx/sbxcurr.cxx basic/source/sbx/sbxexec.cxx basic/source/sbx/sbxint.cxx basic/source/sbx/sbxobj.cxx basic/source/sbx/sbxscan.cxx basic/source/sbx/sbxstr.cxx basic/source/sbx/sbxvals.cxx basic/source/sbx/sbxvalue.cxx basic/source/sbx/sbxvar.cxx basic/workben/mgrtest.cxx configmgr/prj/build.lst configmgr/source/access.cxx configmgr/source/configurationprovider.cxx configmgr/source/defaultprovider.cxx configmgr/source/pad.cxx configmgr/source/services.cxx configmgr/source/update.cxx configmgr/source/xmlreader.cxx configmgr/source/xmlreader.hxx connectivity/prj/build.lst connectivity/qa/complex/connectivity/TestCase.java connectivity/source/cpool/Zregistration.cxx connectivity/source/drivers/adabas/Bservices.cxx connectivity/source/drivers/ado/Aservices.cxx connectivity/source/drivers/calc/Cservices.cxx connectivity/source/drivers/calc/makefile.mk connectivity/source/drivers/dbase/DIndex.cxx connectivity/source/drivers/dbase/DIndexIter.cxx connectivity/source/drivers/dbase/DNoException.cxx connectivity/source/drivers/dbase/DTable.cxx connectivity/source/drivers/dbase/Dservices.cxx connectivity/source/drivers/dbase/dindexnode.cxx connectivity/source/drivers/evoab/LNoException.cxx connectivity/source/drivers/evoab/LServices.cxx connectivity/source/drivers/evoab2/NServices.cxx connectivity/source/drivers/file/FNoException.cxx connectivity/source/drivers/file/FPreparedStatement.cxx connectivity/source/drivers/file/FResultSet.cxx connectivity/source/drivers/file/FStatement.cxx connectivity/source/drivers/file/quotedstring.cxx connectivity/source/drivers/flat/ETable.cxx connectivity/source/drivers/flat/Eservices.cxx connectivity/source/drivers/hsqldb/Hservices.cxx connectivity/source/drivers/jdbc/jservices.cxx connectivity/source/drivers/kab/KServices.cxx connectivity/source/drivers/macab/MacabServices.cxx connectivity/source/drivers/mozab/MResultSet.cxx connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx connectivity/source/drivers/mysql/Yservices.cxx connectivity/source/drivers/odbc/OFunctions.cxx connectivity/source/drivers/odbc/oservices.cxx connectivity/source/inc/dbase/DIndexPage.hxx connectivity/source/inc/file/FTable.hxx connectivity/source/manager/mregistration.cxx connectivity/source/parse/PColumn.cxx desktop/prj/build.lst desktop/qa/deployment_misc/test_dp_version.cxx desktop/source/app/app.cxx desktop/source/app/appfirststart.cxx desktop/source/app/cmdlineargs.cxx desktop/source/app/cmdlineargs.hxx desktop/source/app/sofficemain.cxx desktop/source/deployment/gui/dp_gui.hrc desktop/source/deployment/gui/dp_gui_dialog2.cxx desktop/source/deployment/gui/dp_gui_dialog2.hxx desktop/source/deployment/gui/dp_gui_updatedialog.cxx desktop/source/deployment/gui/dp_gui_updatedialog.hxx desktop/source/deployment/manager/dp_extensionmanager.cxx desktop/source/deployment/manager/dp_extensionmanager.hxx desktop/source/deployment/misc/dp_misc.src desktop/source/deployment/registry/component/dp_component.cxx desktop/source/deployment/registry/configuration/dp_configuration.cxx desktop/source/deployment/registry/dp_backend.cxx desktop/source/deployment/registry/help/dp_help.cxx desktop/source/deployment/registry/script/dp_script.cxx desktop/source/migration/pages.cxx desktop/source/migration/pages.hxx desktop/source/migration/wizard.cxx desktop/source/migration/wizard.hrc desktop/source/migration/wizard.hxx desktop/source/migration/wizard.src desktop/source/pkgchk/unopkg/unopkg_shared.h desktop/source/so_comp/services.cxx desktop/source/splash/makefile.mk desktop/source/splash/services_spl.cxx desktop/source/splash/splash.cxx drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx editeng/inc/editeng/adjitem.hxx editeng/inc/editeng/bolnitem.hxx editeng/inc/editeng/borderline.hxx editeng/inc/editeng/boxitem.hxx editeng/inc/editeng/brkitem.hxx editeng/inc/editeng/brshitem.hxx editeng/inc/editeng/bulitem.hxx editeng/inc/editeng/charreliefitem.hxx editeng/inc/editeng/charrotateitem.hxx editeng/inc/editeng/charscaleitem.hxx editeng/inc/editeng/cmapitem.hxx editeng/inc/editeng/colritem.hxx editeng/inc/editeng/crsditem.hxx editeng/inc/editeng/editdata.hxx editeng/inc/editeng/editeng.hxx editeng/inc/editeng/editobj.hxx editeng/inc/editeng/editstat.hxx editeng/inc/editeng/editview.hxx editeng/inc/editeng/emphitem.hxx editeng/inc/editeng/escpitem.hxx editeng/inc/editeng/fhgtitem.hxx editeng/inc/editeng/flstitem.hxx editeng/inc/editeng/fontitem.hxx editeng/inc/editeng/frmdiritem.hxx editeng/inc/editeng/fwdtitem.hxx editeng/inc/editeng/hyznitem.hxx editeng/inc/editeng/kernitem.hxx editeng/inc/editeng/langitem.hxx editeng/inc/editeng/lrspitem.hxx editeng/inc/editeng/lspcitem.hxx editeng/inc/editeng/numitem.hxx editeng/inc/editeng/outliner.hxx editeng/inc/editeng/paravertalignitem.hxx editeng/inc/editeng/pmdlitem.hxx editeng/inc/editeng/postitem.hxx editeng/inc/editeng/protitem.hxx editeng/inc/editeng/shaditem.hxx editeng/inc/editeng/sizeitem.hxx editeng/inc/editeng/svxacorr.hxx editeng/inc/editeng/svxfont.hxx editeng/inc/editeng/svxrtf.hxx editeng/inc/editeng/swafopt.hxx editeng/inc/editeng/tstpitem.hxx editeng/inc/editeng/twolinesitem.hxx editeng/inc/editeng/txtrange.hxx editeng/inc/editeng/udlnitem.hxx editeng/inc/editeng/ulspitem.hxx editeng/inc/editeng/wghtitem.hxx editeng/inc/editeng/writingmodeitem.hxx editeng/inc/editeng/xmlcnitm.hxx editeng/inc/helpid.hrc editeng/inc/pch/precompiled_editeng.hxx editeng/source/editeng/editdbg.cxx editeng/source/editeng/editdoc.cxx editeng/source/editeng/editdoc.hxx editeng/source/editeng/editdoc2.cxx editeng/source/editeng/editeng.cxx editeng/source/editeng/editobj.cxx editeng/source/editeng/editobj2.hxx editeng/source/editeng/editsel.cxx editeng/source/editeng/editundo.cxx editeng/source/editeng/editundo.hxx editeng/source/editeng/editview.cxx editeng/source/editeng/edtspell.hxx editeng/source/editeng/eehtml.cxx editeng/source/editeng/eehtml.hxx editeng/source/editeng/eeobj.cxx editeng/source/editeng/eerdll.cxx editeng/source/editeng/eertfpar.cxx editeng/source/editeng/impedit.cxx editeng/source/editeng/impedit.hxx editeng/source/editeng/impedit2.cxx editeng/source/editeng/impedit3.cxx editeng/source/editeng/impedit4.cxx editeng/source/editeng/impedit5.cxx editeng/source/editeng/makefile.mk editeng/source/items/bulitem.cxx editeng/source/items/charhiddenitem.cxx editeng/source/items/flditem.cxx editeng/source/items/frmitems.cxx editeng/source/items/makefile.mk editeng/source/items/numitem.cxx editeng/source/items/paraitem.cxx editeng/source/items/svxfont.cxx editeng/source/items/textitem.cxx editeng/source/items/writingmodeitem.cxx editeng/source/items/xmlcnitm.cxx editeng/source/misc/SvXMLAutoCorrectImport.cxx editeng/source/misc/svxacorr.cxx editeng/source/misc/txtrange.cxx editeng/source/misc/unolingu.cxx editeng/source/outliner/outleeng.cxx editeng/source/outliner/outliner.cxx editeng/source/outliner/outlundo.hxx editeng/source/outliner/outlvw.cxx editeng/source/outliner/paralist.cxx editeng/source/outliner/paralist.hxx editeng/source/rtf/rtfgrf.cxx editeng/source/rtf/rtfitem.cxx editeng/source/rtf/svxrtf.cxx editeng/source/uno/unoipset.cxx editeng/util/makefile.mk embeddedobj/prj/build.lst embeddedobj/source/commonembedding/miscobj.cxx eventattacher/prj/build.lst fileaccess/source/FileAccess.cxx formula/inc/formula/FormulaCompiler.hxx formula/inc/formula/token.hxx formula/inc/formula/tokenarray.hxx formula/source/core/api/FormulaCompiler.cxx formula/source/core/api/token.cxx formula/source/ui/dlg/FormulaHelper.cxx formula/source/ui/dlg/formula.cxx formula/source/ui/dlg/parawin.cxx formula/source/ui/dlg/structpg.cxx fpicker/prj/d.lst fpicker/source/aqua/FPentry.cxx fpicker/source/office/OfficeControlAccess.cxx fpicker/source/office/iodlg.cxx fpicker/source/office/iodlg.hxx fpicker/source/office/iodlg.src fpicker/source/office/iodlgimp.cxx fpicker/source/unx/gnome/FPentry.cxx fpicker/source/unx/gnome/SalGtkFilePicker.cxx fpicker/source/unx/gnome/SalGtkPicker.cxx fpicker/source/unx/kde4/KDE4FPEntry.cxx fpicker/source/win32/filepicker/FPentry.cxx framework/AllLangResTarget_fwe.mk framework/inc/dispatch/interaction.hxx framework/inc/framework/addonmenu.hxx framework/inc/framework/addonsoptions.hxx framework/inc/framework/bmkmenu.hxx framework/inc/framework/imageproducer.hxx framework/inc/framework/sfxhelperfunctions.hxx framework/inc/framework/statusbarconfiguration.hxx framework/inc/framework/titlehelper.hxx framework/inc/framework/toolboxconfiguration.hxx framework/inc/threadhelp/lockhelper.hxx framework/inc/xml/eventsdocumenthandler.hxx framework/inc/xml/statusbardocumenthandler.hxx framework/inc/xml/toolboxconfiguration.hxx framework/inc/xml/toolboxconfigurationdefines.hxx framework/inc/xml/toolboxdocumenthandler.hxx framework/prj/build.lst framework/qa/complex/ModuleManager/makefile.mk framework/qa/complex/accelerators/makefile.mk framework/qa/complex/framework/recovery/makefile.mk framework/qa/complex/imageManager/_XInitialization.java framework/source/classes/menumanager.cxx framework/source/dispatch/interaction.cxx framework/source/fwe/classes/bmkmenu.cxx framework/source/fwe/helper/actiontriggerhelper.cxx framework/source/fwe/helper/imageproducer.cxx framework/source/fwe/xml/menuconfiguration.cxx framework/source/fwe/xml/toolboxdocumenthandler.cxx framework/source/helper/uiconfigelementwrapperbase.cxx framework/source/helper/uielementwrapperbase.cxx framework/source/inc/pattern/window.hxx framework/source/jobs/jobdata.cxx framework/source/layoutmanager/layoutmanager.cxx framework/source/layoutmanager/panel.hxx framework/source/loadenv/loadenv.cxx framework/source/register/registerservices.cxx framework/source/services/menudocumenthandler.cxx framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx framework/source/uiconfiguration/uiconfigurationmanager.cxx framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx framework/source/uielement/addonstoolbarmanager.cxx framework/source/uielement/controlmenucontroller.cxx framework/source/uielement/fontsizemenucontroller.cxx framework/source/uielement/imagebuttontoolbarcontroller.cxx framework/source/uielement/macrosmenucontroller.cxx framework/source/uielement/menubarmanager.cxx framework/source/uielement/newmenucontroller.cxx framework/source/uielement/togglebuttontoolbarcontroller.cxx framework/source/uielement/toolbarmanager.cxx framework/source/uielement/toolbarsmenucontroller.cxx framework/test/makefile.mk framework/test/threadtest/makefile.mk framework/test/typecfg/makefile.mk framework/util/guiapps/makefile.mk framework/util/makefile.mk idl/inc/bastype.hxx idl/inc/hash.hxx idl/inc/lex.hxx idl/inc/module.hxx idl/inc/object.hxx idl/inc/slot.hxx idl/inc/types.hxx idl/source/cmptools/hash.cxx idl/source/cmptools/lex.cxx idl/source/objects/basobj.cxx idl/source/objects/bastype.cxx idl/source/objects/module.cxx idl/source/objects/object.cxx idl/source/objects/slot.cxx idl/source/objects/types.cxx idl/source/prj/command.cxx idl/source/prj/database.cxx idl/source/prj/globals.cxx idl/source/prj/svidl.cxx linguistic/inc/linguistic/misc.hxx linguistic/prj/build.lst linguistic/source/convdic.cxx linguistic/source/convdiclist.cxx linguistic/source/dicimp.cxx linguistic/source/dlistimp.cxx linguistic/source/gciterator.cxx linguistic/source/iprcache.cxx linguistic/source/lngopt.cxx linguistic/source/lngprophelp.cxx linguistic/source/lngsvcmgr.cxx linguistic/source/lngsvcmgr.hxx linguistic/source/misc2.cxx linguistic/workben/sprophelp.cxx officecfg/registry/data/org/openoffice/VCL.xcu officecfg/util/makefile.mk oovbaapi/ooo/vba/XApplicationBase.idl oovbaapi/ooo/vba/XVBAAppService.idl oovbaapi/ooo/vba/XVBADocService.idl oovbaapi/ooo/vba/excel/XApplication.idl oovbaapi/ooo/vba/excel/XRange.idl oovbaapi/ooo/vba/excel/XWorkbook.idl oovbaapi/ooo/vba/excel/XWorksheet.idl oovbaapi/ooo/vba/word/XApplication.idl oovbaapi/ooo/vba/word/XGlobals.idl oovbaapi/ooo/vba/word/XTableOfContents.idl readlicense_oo/prj/build.lst scripting/prj/build.lst scripting/prj/d.lst scripting/source/basprov/basprov.cxx scripting/source/basprov/basscript.cxx scripting/source/basprov/basscript.hxx scripting/source/dlgprov/dlgprov.cxx scripting/source/inc/util/util.hxx scripting/source/protocolhandler/scripthandler.cxx scripting/source/provider/ProviderCache.cxx scripting/source/pyprov/makefile.mk scripting/source/runtimemgr/ScriptNameResolverImpl.cxx scripting/source/runtimemgr/ScriptRuntimeManager.cxx scripting/source/runtimemgr/StorageBridge.cxx scripting/source/storage/ScriptMetadataImporter.cxx scripting/source/storage/ScriptSecurityManager.cxx scripting/source/storage/ScriptStorage.cxx scripting/source/storage/ScriptStorageManager.cxx sfx2/inc/about.hxx sfx2/inc/brokenpackageint.hxx sfx2/inc/docvor.hxx sfx2/inc/pch/precompiled_sfx2.hxx sfx2/inc/sfx2/app.hxx sfx2/inc/sfx2/basmgr.hxx sfx2/inc/sfx2/bindings.hxx sfx2/inc/sfx2/childwin.hxx sfx2/inc/sfx2/ctrlitem.hxx sfx2/inc/sfx2/dinfdlg.hxx sfx2/inc/sfx2/dispatch.hxx sfx2/inc/sfx2/docfilt.hxx sfx2/inc/sfx2/evntconf.hxx sfx2/inc/sfx2/fcontnr.hxx sfx2/inc/sfx2/frame.hxx sfx2/inc/sfx2/imagemgr.hxx sfx2/inc/sfx2/imgmgr.hxx sfx2/inc/sfx2/linksrc.hxx sfx2/inc/sfx2/macrconf.hxx sfx2/inc/sfx2/macropg.hxx sfx2/inc/sfx2/mnuitem.hxx sfx2/inc/sfx2/mnumgr.hxx sfx2/inc/sfx2/module.hxx sfx2/inc/sfx2/msg.hxx sfx2/inc/sfx2/objsh.hxx sfx2/inc/sfx2/passwd.hxx sfx2/inc/sfx2/prnmon.hxx sfx2/inc/sfx2/request.hxx sfx2/inc/sfx2/sfx.hrc sfx2/inc/sfx2/sfxbasemodel.hxx sfx2/inc/sfx2/sfxhtml.hxx sfx2/inc/sfx2/sfxresid.hxx sfx2/inc/sfx2/sfxsids.hrc sfx2/inc/sfx2/sfxuno.hxx sfx2/inc/sfx2/shell.hxx sfx2/inc/sfx2/stbitem.hxx sfx2/inc/sfx2/styfitem.hxx sfx2/inc/sfx2/tabdlg.hxx sfx2/inc/sfx2/tbxctrl.hxx sfx2/inc/sfx2/tplpitem.hxx sfx2/inc/sfx2/viewfrm.hxx sfx2/inc/sfx2/viewsh.hxx sfx2/inc/sfxbasic.hxx sfx2/inc/sorgitm.hxx sfx2/prj/build.lst sfx2/qa/complex/docinfo/makefile.mk sfx2/qa/cppunit/makefile.mk sfx2/sdi/makefile.mk sfx2/source/appl/app.cxx sfx2/source/appl/app.hrc sfx2/source/appl/app.src sfx2/source/appl/appbas.cxx sfx2/source/appl/appcfg.cxx sfx2/source/appl/appchild.cxx sfx2/source/appl/appmain.cxx sfx2/source/appl/appmisc.cxx sfx2/source/appl/appopen.cxx sfx2/source/appl/appquit.cxx sfx2/source/appl/appserv.cxx sfx2/source/appl/appuno.cxx sfx2/source/appl/childwin.cxx sfx2/source/appl/fileobj.cxx sfx2/source/appl/helpinterceptor.cxx sfx2/source/appl/imagemgr.cxx sfx2/source/appl/impldde.cxx sfx2/source/appl/impldde.hxx sfx2/source/appl/linkmgr2.cxx sfx2/source/appl/lnkbase2.cxx sfx2/source/appl/makefile.mk sfx2/source/appl/module.cxx sfx2/source/appl/newhelp.cxx sfx2/source/appl/opengrf.cxx sfx2/source/appl/sfxdll.cxx sfx2/source/appl/sfxhelp.cxx sfx2/source/appl/shutdownicon.cxx sfx2/source/appl/shutdowniconunx.cxx sfx2/source/appl/workwin.cxx sfx2/source/bastyp/fltfnc.cxx sfx2/source/bastyp/frmhtml.cxx sfx2/source/bastyp/frmhtmlw.cxx sfx2/source/bastyp/helper.cxx sfx2/source/bastyp/minarray.cxx sfx2/source/bastyp/progress.cxx sfx2/source/bastyp/sfxhtml.cxx sfx2/source/config/evntconf.cxx sfx2/source/control/bindings.cxx sfx2/source/control/ctrlitem.cxx sfx2/source/control/dispatch.cxx sfx2/source/control/macrconf.cxx sfx2/source/control/macro.cxx sfx2/source/control/makefile.mk sfx2/source/control/minfitem.cxx sfx2/source/control/msg.cxx sfx2/source/control/msgpool.cxx sfx2/source/control/objface.cxx sfx2/source/control/request.cxx sfx2/source/control/shell.cxx sfx2/source/control/sorgitm.cxx sfx2/source/dialog/about.cxx sfx2/source/dialog/basedlgs.cxx sfx2/source/dialog/dinfdlg.cxx sfx2/source/dialog/dinfedt.cxx sfx2/source/dialog/dockwin.cxx sfx2/source/dialog/filedlghelper.cxx sfx2/source/dialog/mailmodel.cxx sfx2/source/dialog/mailmodelapi.cxx sfx2/source/dialog/makefile.mk sfx2/source/dialog/mgetempl.cxx sfx2/source/dialog/passwd.cxx sfx2/source/dialog/passwd.hrc sfx2/source/dialog/printopt.cxx sfx2/source/dialog/securitypage.cxx sfx2/source/dialog/splitwin.cxx sfx2/source/dialog/styfitem.cxx sfx2/source/dialog/tabdlg.cxx sfx2/source/dialog/taskpane.cxx sfx2/source/dialog/templdlg.cxx sfx2/source/dialog/tplpitem.cxx sfx2/source/dialog/versdlg.cxx sfx2/source/doc/QuerySaveDocument.cxx sfx2/source/doc/SfxDocumentMetaData.cxx sfx2/source/doc/applet.cxx sfx2/source/doc/doc.hrc sfx2/source/doc/doc.src sfx2/source/doc/docfile.cxx sfx2/source/doc/docinf.cxx sfx2/source/doc/doctempl.cxx sfx2/source/doc/doctemplates.cxx sfx2/source/doc/docvor.cxx sfx2/source/doc/guisaveas.cxx sfx2/source/doc/makefile.mk sfx2/source/doc/objcont.cxx sfx2/source/doc/objitem.cxx sfx2/source/doc/objmisc.cxx sfx2/source/doc/objserv.cxx sfx2/source/doc/printhelper.cxx sfx2/source/doc/sfxacldetect.cxx sfx2/source/doc/sfxbasemodel.cxx sfx2/source/inc/applet.hxx sfx2/source/inc/fltoptint.hxx sfx2/source/inc/sfxlocal.hrc sfx2/source/inc/virtmenu.hxx sfx2/source/inc/workwin.hxx sfx2/source/menu/mnuitem.cxx sfx2/source/menu/objmnctl.cxx sfx2/source/menu/virtmenu.cxx sfx2/source/notify/eventsupplier.cxx sfx2/source/notify/makefile.mk sfx2/source/toolbox/imgmgr.cxx sfx2/source/toolbox/tbxitem.cxx sfx2/source/view/frame.cxx sfx2/source/view/orgmgr.cxx sfx2/source/view/printer.cxx sfx2/source/view/prnmon.cxx sfx2/source/view/viewfrm.cxx sfx2/source/view/viewprn.cxx sfx2/source/view/viewsh.cxx sfx2/util/makefile.mk sfx2/workben/custompanel/makefile.mk shell/source/backends/desktopbe/desktopbackend.cxx shell/source/backends/gconfbe/gconfbackend.cxx shell/source/backends/kde4be/kde4backend.cxx shell/source/backends/kdebe/kdebackend.cxx shell/source/win32/SysShentry.cxx shell/source/win32/shlxthandler/propsheets/propsheets.cxx shell/source/win32/simplemail/smplmailentry.cxx svx/inc/float3d.hrc svx/inc/fmhelp.hrc svx/inc/globlmn_tmpl.hrc svx/inc/helpid.hrc svx/inc/pch/precompiled_svx.hxx svx/inc/sjctrl.hxx svx/inc/srchitem.hxx svx/inc/svdibrow.hxx svx/inc/svx/SmartTagItem.hxx svx/inc/svx/algitem.hxx svx/inc/svx/camera3d.hxx svx/inc/svx/chrtitem.hxx svx/inc/svx/clipfmtitem.hxx svx/inc/svx/ctredlin.hxx svx/inc/svx/dbtoolsclient.hxx svx/inc/svx/deflt3d.hxx svx/inc/svx/dialogs.hrc svx/inc/svx/drawitem.hxx svx/inc/svx/e3ditem.hxx svx/inc/svx/extrud3d.hxx svx/inc/svx/flagsdef.hxx svx/inc/svx/float3d.hxx svx/inc/svx/frmsel.hxx svx/inc/svx/gallery.hxx svx/inc/svx/gallery1.hxx svx/inc/svx/galtheme.hxx svx/inc/svx/grfcrop.hxx svx/inc/svx/hdft.hxx svx/inc/svx/hlnkitem.hxx svx/inc/svx/hyprlink.hxx svx/inc/svx/itemwin.hxx svx/inc/svx/lathe3d.hxx svx/inc/svx/linkwarn.hxx svx/inc/svx/modctrl.hxx svx/inc/svx/msdffdef.hxx svx/inc/svx/obj3d.hxx svx/inc/svx/optgenrl.hxx svx/inc/svx/optgrid.hxx svx/inc/svx/pageitem.hxx svx/inc/svx/paraprev.hxx svx/inc/svx/postattr.hxx svx/inc/svx/rotmodit.hxx svx/inc/svx/ruler.hxx svx/inc/svx/rulritem.hxx svx/inc/svx/scene3d.hxx svx/inc/svx/sdasaitm.hxx svx/inc/svx/sdasitm.hxx svx/inc/svx/sdggaitm.hxx svx/inc/svx/sdmetitm.hxx svx/inc/svx/sdtaaitm.hxx svx/inc/svx/sdtaditm.hxx svx/inc/svx/sdtaitm.hxx svx/inc/svx/sdtakitm.hxx svx/inc/svx/sdtfchim.hxx svx/inc/svx/sdtfsitm.hxx svx/inc/svx/srchdlg.hxx svx/inc/svx/svddrag.hxx svx/inc/svx/svdetc.hxx svx/inc/svx/svdglue.hxx svx/inc/svx/svdhlpln.hxx svx/inc/svx/svdlayer.hxx svx/inc/svx/svdmark.hxx svx/inc/svx/svdmodel.hxx svx/inc/svx/svdoashp.hxx svx/inc/svx/svdobj.hxx svx/inc/svx/svdocirc.hxx svx/inc/svx/svdoedge.hxx svx/inc/svx/svdogrp.hxx svx/inc/svx/svdomeas.hxx svx/inc/svx/svdoole2.hxx svx/inc/svx/svdorect.hxx svx/inc/svx/svdotable.hxx svx/inc/svx/svdotext.hxx svx/inc/svx/svdovirt.hxx svx/inc/svx/svdpage.hxx svx/inc/svx/svdsnpv.hxx svx/inc/svx/svdtrans.hxx svx/inc/svx/svdundo.hxx svx/inc/svx/svimbase.hxx svx/inc/svx/svx3ditems.hxx svx/inc/svx/svxdlg.hxx svx/inc/svx/sxcikitm.hxx svx/inc/svx/sxekitm.hxx svx/inc/svx/sxelditm.hxx svx/inc/svx/sxenditm.hxx svx/inc/svx/sxmkitm.hxx svx/inc/svx/sxmtpitm.hxx svx/inc/svx/sxmuitm.hxx svx/inc/svx/tabarea.hxx svx/inc/svx/tabline.hxx svx/inc/svx/unoprov.hxx svx/inc/svx/viewlayoutitem.hxx svx/inc/svx/xbitmap.hxx svx/inc/svx/xbtmpit.hxx svx/inc/svx/xcolit.hxx svx/inc/svx/xfillit0.hxx svx/inc/svx/xflclit.hxx svx/inc/svx/xflftrit.hxx svx/inc/svx/xflgrit.hxx svx/inc/svx/xflhtit.hxx svx/inc/svx/xftadit.hxx svx/inc/svx/xftsfit.hxx svx/inc/svx/xftshit.hxx svx/inc/svx/xlineit0.hxx svx/inc/svx/xlinjoit.hxx svx/inc/svx/xlnclit.hxx svx/inc/svx/xlndsit.hxx svx/inc/svx/xlnedcit.hxx svx/inc/svx/xlnedit.hxx svx/inc/svx/xlnedwit.hxx svx/inc/svx/xlnstcit.hxx svx/inc/svx/xlnstit.hxx svx/inc/svx/xlnstwit.hxx svx/inc/svx/xlnwtit.hxx svx/inc/svx/xtextit0.hxx svx/inc/svx/zoomitem.hxx svx/inc/svx/zoomslideritem.hxx svx/inc/xpolyimp.hxx svx/inc/zoom_def.hxx svx/prj/d.lst svx/source/accessibility/AccessibleShape.cxx svx/source/accessibility/DescriptionGenerator.cxx svx/source/customshapes/EnhancedCustomShapeEngine.cxx svx/source/customshapes/EnhancedCustomShapeFontWork.cxx svx/source/dialog/_bmpmask.cxx svx/source/dialog/_contdlg.cxx svx/source/dialog/connctrl.cxx svx/source/dialog/contwnd.cxx svx/source/dialog/ctredlin.cxx svx/source/dialog/ctredlin.hrc svx/source/dialog/ctredlin.src svx/source/dialog/dialcontrol.cxx svx/source/dialog/dlgctrl.cxx svx/source/dialog/docrecovery.cxx svx/source/dialog/fntctrl.cxx svx/source/dialog/fontwork.cxx svx/source/dialog/frmsel.cxx svx/source/dialog/graphctl.cxx svx/source/dialog/grfflt.cxx svx/source/dialog/hdft.cxx svx/source/dialog/hyperdlg.cxx svx/source/dialog/hyprdlg.hxx svx/source/dialog/hyprlink.cxx svx/source/dialog/hyprlink.hxx svx/source/dialog/hyprlink.src svx/source/dialog/imapdlg.cxx svx/source/dialog/imapwnd.cxx svx/source/dialog/linkwarn.hrc svx/source/dialog/makefile.mk svx/source/dialog/optgrid.cxx svx/source/dialog/orienthelper.cxx svx/source/dialog/pagectrl.cxx svx/source/dialog/prtqry.cxx svx/source/dialog/rlrcitem.cxx svx/source/dialog/rubydialog.cxx svx/source/dialog/rulritem.cxx svx/source/dialog/simptabl.cxx svx/source/dialog/srchdlg.cxx svx/source/dialog/svxbmpnumvalueset.cxx svx/source/dialog/svxruler.cxx svx/source/dialog/swframeexample.cxx svx/source/engine3d/float3d.cxx svx/source/engine3d/float3d.src svx/source/engine3d/svx3ditems.cxx svx/source/fmcomp/gridctrl.cxx svx/source/fmcomp/trace.cxx svx/source/form/ParseContext.cxx svx/source/form/datanavi.cxx svx/source/form/filtnav.cxx svx/source/form/fmexch.cxx svx/source/form/fmexpl.cxx svx/source/form/fmobjfac.cxx svx/source/form/fmpage.cxx svx/source/form/fmshell.cxx svx/source/form/fmshimp.cxx svx/source/form/fmsrcimp.cxx svx/source/form/fmvwimp.cxx svx/source/form/makefile.mk svx/source/form/tabwin.cxx svx/source/form/tbxform.cxx svx/source/form/typemap.cxx svx/source/gallery2/galbrws1.cxx svx/source/gallery2/galbrws2.cxx svx/source/gallery2/galexpl.cxx svx/source/gallery2/gallery1.cxx svx/source/gallery2/galtheme.cxx svx/source/gallery2/makefile.mk svx/source/gengal/gengal.cxx svx/source/gengal/makefile.mk svx/source/inc/fmgroup.hxx svx/source/intro/about_ooo.hrc svx/source/intro/iso.src svx/source/intro/ooo.src svx/source/items/SmartTagItem.cxx svx/source/items/algitem.cxx svx/source/items/chrtitem.cxx svx/source/items/clipfmtitem.cxx svx/source/items/customshapeitem.cxx svx/source/items/drawitem.cxx svx/source/items/e3ditem.cxx svx/source/items/grfitem.cxx svx/source/items/hlnkitem.cxx svx/source/items/makefile.mk svx/source/items/pageitem.cxx svx/source/items/rotmodit.cxx svx/source/items/viewlayoutitem.cxx svx/source/items/zoomitem.cxx svx/source/items/zoomslideritem.cxx svx/source/src/app.hrc svx/source/stbctrls/makefile.mk svx/source/stbctrls/modctrl.cxx svx/source/stbctrls/xmlsecctrl.cxx svx/source/stbctrls/zoomctrl.cxx svx/source/svdraw/clonelist.cxx svx/source/svdraw/svdattr.cxx svx/source/svdraw/svdcrtv.cxx svx/source/svdraw/svdedtv1.cxx svx/source/svdraw/svdedtv2.cxx svx/source/svdraw/svdedxv.cxx svx/source/svdraw/svdetc.cxx svx/source/svdraw/svdfmtf.cxx svx/source/svdraw/svdfmtf.hxx svx/source/svdraw/svdglue.cxx svx/source/svdraw/svdhdl.cxx svx/source/svdraw/svdhlpln.cxx svx/source/svdraw/svdibrow.cxx svx/source/svdraw/svdlayer.cxx svx/source/svdraw/svdmodel.cxx svx/source/svdraw/svdoashp.cxx svx/source/svdraw/svdobj.cxx svx/source/svdraw/svdocapt.cxx svx/source/svdraw/svdocirc.cxx svx/source/svdraw/svdoedge.cxx svx/source/svdraw/svdograf.cxx svx/source/svdraw/svdogrp.cxx svx/source/svdraw/svdomeas.cxx svx/source/svdraw/svdomedia.cxx svx/source/svdraw/svdopath.cxx svx/source/svdraw/svdotext.cxx svx/source/svdraw/svdotxdr.cxx svx/source/svdraw/svdotxed.cxx svx/source/svdraw/svdotxfl.cxx svx/source/svdraw/svdotxln.cxx svx/source/svdraw/svdotxtr.cxx svx/source/svdraw/svdoutl.cxx svx/source/svdraw/svdpage.cxx svx/source/svdraw/svdpagv.cxx svx/source/svdraw/svdpntv.cxx svx/source/svdraw/svdpoev.cxx svx/source/svdraw/svdsnpv.cxx svx/source/svdraw/svdstr.src svx/source/svdraw/svdtrans.cxx svx/source/svdraw/svdundo.cxx svx/source/svdraw/svdview.cxx svx/source/svdraw/svdxcgv.cxx svx/source/table/svdotable.cxx svx/source/tbxctrls/colorwindow.hxx svx/source/tbxctrls/extrusioncontrols.cxx svx/source/tbxctrls/fillctrl.cxx svx/source/tbxctrls/grafctrl.cxx svx/source/tbxctrls/itemwin.cxx svx/source/tbxctrls/layctrl.cxx svx/source/tbxctrls/lboxctrl.cxx svx/source/tbxctrls/linectrl.cxx svx/source/tbxctrls/tbcontrl.cxx svx/source/tbxctrls/verttexttbxctrl.cxx svx/source/unodraw/unomod.cxx svx/source/unodraw/unopage.cxx svx/source/unodraw/unoprov.cxx svx/source/unodraw/unoshape.cxx svx/source/unodraw/unoshtxt.cxx svx/source/xml/xmlxtexp.cxx svx/source/xoutdev/_xpoly.cxx svx/source/xoutdev/xattr.cxx svx/source/xoutdev/xattr2.cxx svx/source/xoutdev/xattrbmp.cxx svx/source/xoutdev/xtabcolr.cxx svx/util/makefile.mk svx/workben/edittest.cxx sysui/desktop/productversion.mk ucb/prj/build.lst ucb/source/cacher/cacheserv.cxx ucb/source/core/ucb1.component ucb/source/core/ucbserv.cxx ucb/source/core/ucbstore.cxx ucb/source/core/ucbstore.hxx ucb/source/sorter/sortmain.cxx ucb/source/ucp/file/prov.cxx ucb/source/ucp/file/shell.cxx ucb/source/ucp/ftp/ftpservices.cxx ucb/source/ucp/gio/gio_provider.cxx ucb/source/ucp/gvfs/gvfs_provider.cxx ucb/source/ucp/hierarchy/hierarchyservices.cxx ucb/source/ucp/odma/odma_lib.cxx ucb/source/ucp/odma/odma_services.cxx ucb/source/ucp/package/pkgservices.cxx ucb/source/ucp/tdoc/tdoc_services.cxx ucb/source/ucp/webdav/ContentProperties.cxx ucb/source/ucp/webdav/NeonHeadRequest.cxx ucb/source/ucp/webdav/webdavcontent.cxx ucb/source/ucp/webdav/webdavservices.cxx uui/source/iahndl.cxx uui/source/iahndl.hxx uui/source/loginerr.hxx uui/source/nameclashdlg.hxx uui/source/passcrtdlg.cxx uui/source/passworddlg.cxx uui/source/passworddlg.hxx uui/source/services.cxx vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/prj/build.lst vbahelper/prj/d.lst vbahelper/source/msforms/makefile.mk vbahelper/source/msforms/vbauserform.cxx vbahelper/source/vbahelper/makefile.mk vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbacommandbarcontrol.cxx vbahelper/source/vbahelper/vbadocumentbase.cxx vbahelper/source/vbahelper/vbadocumentsbase.cxx vbahelper/source/vbahelper/vbahelper.cxx vbahelper/util/makefile.mk xmlhelp/source/cxxhelp/provider/databases.cxx xmlhelp/source/cxxhelp/provider/services.cxx xmlhelp/source/treeview/tvfactory.cxx xmloff/JunitTest_xmloff_unoapi.mk xmloff/inc/functional.hxx xmloff/inc/xmloff/formlayerexport.hxx xmloff/inc/xmloff/formlayerimport.hxx xmloff/inc/xmloff/functional.hxx xmloff/inc/xmloff/shapeimport.hxx xmloff/inc/xmloff/xmlcnitm.hxx xmloff/inc/xmloff/xmlnumfi.hxx xmloff/prj/build.lst xmloff/source/chart/SchXMLChartContext.cxx xmloff/source/chart/SchXMLExport.cxx xmloff/source/chart/SchXMLImport.cxx xmloff/source/chart/SchXMLLegendContext.hxx xmloff/source/chart/SchXMLPlotAreaContext.cxx xmloff/source/core/xmluconv.cxx xmloff/source/draw/sdxmlexp.cxx xmloff/source/draw/shapeexport4.cxx xmloff/source/draw/ximp3dobject.cxx xmloff/source/draw/ximp3dscene.cxx xmloff/source/forms/formlayerexport.cxx xmloff/source/forms/formlayerimport.cxx xmloff/source/forms/handler/vcl_time_handler.hxx xmloff/source/forms/layerimport.cxx xmloff/source/forms/layerimport.hxx xmloff/source/forms/property_meta_data.hxx xmloff/source/style/PageHeaderFooterContext.cxx xmloff/source/style/PageMasterStyleMap.cxx xmloff/source/style/prstylei.cxx xmloff/source/style/xmlimppr.cxx xmloff/source/style/xmlnumfi.cxx xmloff/source/style/xmlstyle.cxx xmloff/source/table/tabledesignsimporter.cxx xmloff/source/text/XMLTextNumRuleInfo.cxx xmloff/source/text/XMLTextShapeStyleContext.cxx xmloff/source/text/txtstyle.cxx xmloff/source/transform/ChartOOoTContext.cxx xmloff/source/transform/EventOOoTContext.cxx xmloff/source/transform/TransformerBase.cxx xmloff/util/makefile.mk xmlscript/util/xcr.component
1804 lines
64 KiB
C++
Executable File
1804 lines
64 KiB
C++
Executable File
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*************************************************************************
|
|
*
|
|
* 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_embeddedobj.hxx"
|
|
#include <com/sun/star/lang/IllegalArgumentException.hpp>
|
|
#include <com/sun/star/lang/DisposedException.hpp>
|
|
#include <com/sun/star/embed/WrongStateException.hpp>
|
|
#include <com/sun/star/embed/UnreachableStateException.hpp>
|
|
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
#include <com/sun/star/io/XTruncate.hpp>
|
|
#include <com/sun/star/awt/XRequestCallback.hpp>
|
|
|
|
#include <platform.h>
|
|
#include <cppuhelper/interfacecontainer.h>
|
|
#include <comphelper/mimeconfighelper.hxx>
|
|
#include <comphelper/storagehelper.hxx>
|
|
#include <osl/file.hxx>
|
|
#include <rtl/ref.hxx>
|
|
|
|
#include <olecomponent.hxx>
|
|
#include <olewrapclient.hxx>
|
|
#include <advisesink.hxx>
|
|
#include <oleembobj.hxx>
|
|
#include <mtnotification.hxx>
|
|
|
|
using namespace ::com::sun::star;
|
|
using namespace ::comphelper;
|
|
#define MAX_ENUM_ELE 20
|
|
#define FORMATS_NUM 3
|
|
|
|
// ============ class ComSmart =====================
|
|
namespace {
|
|
|
|
template< class T > class ComSmart
|
|
{
|
|
T* m_pInterface;
|
|
|
|
void OwnRelease()
|
|
{
|
|
if ( m_pInterface )
|
|
{
|
|
T* pInterface = m_pInterface;
|
|
m_pInterface = NULL;
|
|
pInterface->Release();
|
|
}
|
|
}
|
|
|
|
public:
|
|
ComSmart()
|
|
: m_pInterface( NULL )
|
|
{}
|
|
|
|
ComSmart( const ComSmart<T>& rObj )
|
|
: m_pInterface( rObj.m_pInterface )
|
|
{
|
|
if ( m_pInterface != NULL )
|
|
m_pInterface->AddRef();
|
|
}
|
|
|
|
ComSmart( T* pInterface )
|
|
: m_pInterface( pInterface )
|
|
{
|
|
if ( m_pInterface != NULL )
|
|
m_pInterface->AddRef();
|
|
}
|
|
|
|
~ComSmart()
|
|
{
|
|
OwnRelease();
|
|
}
|
|
|
|
ComSmart& operator=( const ComSmart<T>& rObj )
|
|
{
|
|
OwnRelease();
|
|
|
|
m_pInterface = rObj.m_pInterface;
|
|
|
|
if ( m_pInterface != NULL )
|
|
m_pInterface->AddRef();
|
|
|
|
return *this;
|
|
}
|
|
|
|
ComSmart<T>& operator=( T* pInterface )
|
|
{
|
|
OwnRelease();
|
|
|
|
m_pInterface = pInterface;
|
|
|
|
if ( m_pInterface != NULL )
|
|
m_pInterface->AddRef();
|
|
|
|
return *this;
|
|
}
|
|
|
|
operator T*() const
|
|
{
|
|
return m_pInterface;
|
|
}
|
|
|
|
T& operator*() const
|
|
{
|
|
return *m_pInterface;
|
|
}
|
|
|
|
T** operator&()
|
|
{
|
|
OwnRelease();
|
|
|
|
m_pInterface = NULL;
|
|
|
|
return &m_pInterface;
|
|
}
|
|
|
|
T* operator->() const
|
|
{
|
|
return m_pInterface;
|
|
}
|
|
|
|
BOOL operator==( const ComSmart<T>& rObj ) const
|
|
{
|
|
return ( m_pInterface == rObj.m_pInterface );
|
|
}
|
|
|
|
BOOL operator!=( const ComSmart<T>& rObj ) const
|
|
{
|
|
return ( m_pInterface != rObj.m_pInterface );
|
|
}
|
|
|
|
BOOL operator==( const T* pInterface ) const
|
|
{
|
|
return ( m_pInterface == pInterface );
|
|
}
|
|
|
|
BOOL operator!=( const T* pInterface ) const
|
|
{
|
|
return ( m_pInterface != pInterface );
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
// ============ class ComSmart =====================
|
|
|
|
sal_Bool ConvertBufferToFormat( void* pBuf,
|
|
sal_uInt32 nBufSize,
|
|
const ::rtl::OUString& aFormatShortName,
|
|
uno::Any& aResult );
|
|
|
|
::rtl::OUString GetNewTempFileURL_Impl( const uno::Reference< lang::XMultiServiceFactory >& xFactory ) throw( io::IOException );
|
|
|
|
typedef ::std::vector< FORMATETC* > FormatEtcList;
|
|
|
|
FORMATETC pFormatTemplates[FORMATS_NUM] = {
|
|
{ CF_ENHMETAFILE, NULL, 0, -1, TYMED_ENHMF },
|
|
{ CF_METAFILEPICT, NULL, 0, -1, TYMED_MFPICT },
|
|
{ CF_BITMAP, NULL, 0, -1, TYMED_GDI } };
|
|
|
|
|
|
struct OleComponentNative_Impl {
|
|
ComSmart< IUnknown > m_pObj;
|
|
ComSmart< IOleObject > m_pOleObject;
|
|
ComSmart< IViewObject2 > m_pViewObject2;
|
|
ComSmart< IStorage > m_pIStorage;
|
|
FormatEtcList m_aFormatsList;
|
|
uno::Sequence< datatransfer::DataFlavor > m_aSupportedGraphFormats;
|
|
|
|
OleComponentNative_Impl()
|
|
{
|
|
// TODO: Extend format list
|
|
m_aSupportedGraphFormats.realloc( 5 );
|
|
|
|
m_aSupportedGraphFormats[0] = datatransfer::DataFlavor(
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-emf;windows_formatname=\"Image EMF\"" )),
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Windows Enhanced Metafile" )),
|
|
getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) );
|
|
|
|
m_aSupportedGraphFormats[1] = datatransfer::DataFlavor(
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"" )),
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Windows Metafile" )),
|
|
getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) );
|
|
|
|
m_aSupportedGraphFormats[2] = datatransfer::DataFlavor(
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"" )),
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Bitmap" )),
|
|
getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) );
|
|
|
|
m_aSupportedGraphFormats[3] = datatransfer::DataFlavor(
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "image/png" )),
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PNG" )),
|
|
getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) );
|
|
|
|
m_aSupportedGraphFormats[0] = datatransfer::DataFlavor(
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" )),
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "GDIMetafile" )),
|
|
getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) );
|
|
}
|
|
|
|
void AddSupportedFormat( const FORMATETC& aFormatEtc );
|
|
|
|
FORMATETC* GetSupportedFormatForAspect( sal_uInt32 nRequestedAspect );
|
|
|
|
sal_Bool ConvertDataForFlavor( const STGMEDIUM& aMedium,
|
|
const datatransfer::DataFlavor& aFlavor,
|
|
uno::Any& aResult );
|
|
|
|
sal_Bool GraphicalFlavor( const datatransfer::DataFlavor& aFlavor );
|
|
|
|
uno::Sequence< datatransfer::DataFlavor > GetFlavorsForAspects( sal_uInt32 nSupportedAspects );
|
|
};
|
|
|
|
//----------------------------------------------
|
|
DWORD GetAspectFromFlavor( const datatransfer::DataFlavor& aFlavor )
|
|
{
|
|
if ( aFlavor.MimeType.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ";Aspect=THUMBNAIL" )) ) != -1 )
|
|
return DVASPECT_THUMBNAIL;
|
|
else if ( aFlavor.MimeType.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ";Aspect=ICON" )) ) != -1 )
|
|
return DVASPECT_ICON;
|
|
else if ( aFlavor.MimeType.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ";Aspect=DOCPRINT" )) ) != -1 )
|
|
return DVASPECT_DOCPRINT;
|
|
else
|
|
return DVASPECT_CONTENT;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
::rtl::OUString GetFlavorSuffixFromAspect( DWORD nAsp )
|
|
{
|
|
::rtl::OUString aResult;
|
|
|
|
if ( nAsp == DVASPECT_THUMBNAIL )
|
|
aResult = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ";Aspect=THUMBNAIL" ));
|
|
else if ( nAsp == DVASPECT_ICON )
|
|
aResult = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ";Aspect=ICON" ));
|
|
else if ( nAsp == DVASPECT_DOCPRINT )
|
|
aResult = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ";Aspect=DOCPRINT" ));
|
|
|
|
// no suffix for DVASPECT_CONTENT
|
|
|
|
return aResult;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
HRESULT OpenIStorageFromURL_Impl( const ::rtl::OUString& aURL, IStorage** ppIStorage )
|
|
{
|
|
OSL_ENSURE( ppIStorage, "The pointer must not be empty!" );
|
|
|
|
::rtl::OUString aFilePath;
|
|
if ( !ppIStorage || ::osl::FileBase::getSystemPathFromFileURL( aURL, aFilePath ) != ::osl::FileBase::E_None )
|
|
throw uno::RuntimeException(); // TODO: something dangerous happend
|
|
|
|
return StgOpenStorage( reinterpret_cast<LPCWSTR>(aFilePath.getStr()),
|
|
NULL,
|
|
STGM_READWRITE | STGM_TRANSACTED, // | STGM_DELETEONRELEASE,
|
|
NULL,
|
|
0,
|
|
ppIStorage );
|
|
}
|
|
|
|
//----------------------------------------------
|
|
sal_Bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium,
|
|
const datatransfer::DataFlavor& aFlavor,
|
|
uno::Any& aResult )
|
|
{
|
|
sal_Bool bAnyIsReady = sal_False;
|
|
|
|
// try to convert data from Medium format to specified Flavor format
|
|
if ( aFlavor.DataType == getCppuType( ( const uno::Sequence< sal_Int8 >* ) 0 ) )
|
|
{
|
|
// first the GDI-metafile must be generated
|
|
|
|
unsigned char* pBuf = NULL;
|
|
sal_uInt32 nBufSize = 0;
|
|
::rtl::OUString aFormat;
|
|
|
|
if ( aMedium.tymed == TYMED_MFPICT ) // Win Metafile
|
|
{
|
|
aFormat = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/x-wmf"));
|
|
METAFILEPICT* pMF = ( METAFILEPICT* )GlobalLock( aMedium.hMetaFilePict );
|
|
if ( pMF )
|
|
{
|
|
nBufSize = GetMetaFileBitsEx( pMF->hMF, 0, NULL ) + 22;
|
|
pBuf = new unsigned char[nBufSize];
|
|
|
|
|
|
// TODO/LATER: the unit size must be calculated correctly
|
|
*( (long* )pBuf ) = 0x9ac6cdd7L;
|
|
*( (short* )( pBuf+6 )) = ( SHORT ) 0;
|
|
*( (short* )( pBuf+8 )) = ( SHORT ) 0;
|
|
*( (short* )( pBuf+10 )) = ( SHORT ) pMF->xExt;
|
|
*( (short* )( pBuf+12 )) = ( SHORT ) pMF->yExt;
|
|
*( (short* )( pBuf+14 )) = ( USHORT ) 2540;
|
|
|
|
|
|
if ( nBufSize && nBufSize == GetMetaFileBitsEx( pMF->hMF, nBufSize - 22, pBuf + 22 ) )
|
|
{
|
|
if ( aFlavor.MimeType.matchAsciiL( "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"", 57 ) )
|
|
{
|
|
aResult <<= uno::Sequence< sal_Int8 >( ( sal_Int8* )pBuf, nBufSize );
|
|
bAnyIsReady = sal_True;
|
|
}
|
|
}
|
|
|
|
GlobalUnlock( aMedium.hMetaFilePict );
|
|
}
|
|
}
|
|
else if ( aMedium.tymed == TYMED_ENHMF ) // Enh Metafile
|
|
{
|
|
aFormat = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/x-emf"));
|
|
nBufSize = GetEnhMetaFileBits( aMedium.hEnhMetaFile, 0, NULL );
|
|
pBuf = new unsigned char[nBufSize];
|
|
if ( nBufSize && nBufSize == GetEnhMetaFileBits( aMedium.hEnhMetaFile, nBufSize, pBuf ) )
|
|
{
|
|
if ( aFlavor.MimeType.matchAsciiL( "application/x-openoffice-emf;windows_formatname=\"Image EMF\"", 57 ) )
|
|
{
|
|
aResult <<= uno::Sequence< sal_Int8 >( ( sal_Int8* )pBuf, nBufSize );
|
|
bAnyIsReady = sal_True;
|
|
}
|
|
}
|
|
}
|
|
else if ( aMedium.tymed == TYMED_GDI ) // Bitmap
|
|
{
|
|
aFormat = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/x-MS-bmp"));
|
|
nBufSize = GetBitmapBits( aMedium.hBitmap, 0, NULL );
|
|
pBuf = new unsigned char[nBufSize];
|
|
if ( nBufSize && nBufSize == sal::static_int_cast< ULONG >( GetBitmapBits( aMedium.hBitmap, nBufSize, pBuf ) ) )
|
|
{
|
|
if ( aFlavor.MimeType.matchAsciiL( "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"", 54 ) )
|
|
{
|
|
aResult <<= uno::Sequence< sal_Int8 >( ( sal_Int8* )pBuf, nBufSize );
|
|
bAnyIsReady = sal_True;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( pBuf && !bAnyIsReady )
|
|
{
|
|
for ( sal_Int32 nInd = 0; nInd < m_aSupportedGraphFormats.getLength(); nInd++ )
|
|
if ( aFlavor.MimeType.match( m_aSupportedGraphFormats[nInd].MimeType )
|
|
&& aFlavor.DataType == m_aSupportedGraphFormats[nInd].DataType
|
|
&& aFlavor.DataType == getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) )
|
|
{
|
|
bAnyIsReady = ConvertBufferToFormat( ( void* )pBuf, nBufSize, aFormat, aResult );
|
|
break;
|
|
}
|
|
}
|
|
|
|
delete[] pBuf;
|
|
}
|
|
|
|
return bAnyIsReady;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
sal_Bool OleComponentNative_Impl::GraphicalFlavor( const datatransfer::DataFlavor& aFlavor )
|
|
{
|
|
// Actually all the required graphical formats must be supported
|
|
for ( sal_Int32 nInd = 0; nInd < m_aSupportedGraphFormats.getLength(); nInd++ )
|
|
if ( aFlavor.MimeType.match( m_aSupportedGraphFormats[nInd].MimeType )
|
|
&& aFlavor.DataType == m_aSupportedGraphFormats[nInd].DataType )
|
|
return sal_True;
|
|
|
|
return sal_False;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
sal_Bool GetClassIDFromSequence_Impl( uno::Sequence< sal_Int8 > aSeq, CLSID& aResult )
|
|
{
|
|
if ( aSeq.getLength() == 16 )
|
|
{
|
|
aResult.Data1 = ( ( ( ( ( ( sal_uInt8 )aSeq[0] << 8 ) + ( sal_uInt8 )aSeq[1] ) << 8 ) + ( sal_uInt8 )aSeq[2] ) << 8 ) + ( sal_uInt8 )aSeq[3];
|
|
aResult.Data2 = ( ( sal_uInt8 )aSeq[4] << 8 ) + ( sal_uInt8 )aSeq[5];
|
|
aResult.Data3 = ( ( sal_uInt8 )aSeq[6] << 8 ) + ( sal_uInt8 )aSeq[7];
|
|
for( int nInd = 0; nInd < 8; nInd++ )
|
|
aResult.Data4[nInd] = ( sal_uInt8 )aSeq[nInd+8];
|
|
|
|
return sal_True;
|
|
}
|
|
|
|
return sal_False;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
::rtl::OUString WinAccToVcl_Impl( const sal_Unicode* pStr )
|
|
{
|
|
::rtl::OUString aResult;
|
|
|
|
if( pStr )
|
|
{
|
|
while ( *pStr )
|
|
{
|
|
if ( *pStr == '&' )
|
|
{
|
|
aResult += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "~" ));
|
|
while( *( ++pStr ) == '&' );
|
|
}
|
|
else
|
|
{
|
|
aResult += ::rtl::OUString( pStr, 1 );
|
|
pStr++;
|
|
}
|
|
}
|
|
}
|
|
|
|
return aResult;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
OleComponent::OleComponent( const uno::Reference< lang::XMultiServiceFactory >& xFactory, OleEmbeddedObject* pUnoOleObject )
|
|
: m_pInterfaceContainer( NULL )
|
|
, m_bDisposed( sal_False )
|
|
, m_bModified( sal_False )
|
|
, m_pNativeImpl( new OleComponentNative_Impl() )
|
|
, m_xFactory( xFactory )
|
|
, m_pOleWrapClientSite( NULL )
|
|
, m_pImplAdviseSink( NULL )
|
|
, m_pUnoOleObject( pUnoOleObject )
|
|
, m_nOLEMiscFlags( 0 )
|
|
, m_nAdvConn( 0 )
|
|
, m_bOleInitialized( sal_False )
|
|
, m_bWorkaroundActive( sal_False )
|
|
{
|
|
OSL_ENSURE( m_pUnoOleObject, "No owner object is provided!" );
|
|
|
|
HRESULT hr = OleInitialize( NULL );
|
|
OSL_ENSURE( hr == S_OK || hr == S_FALSE, "The ole can not be successfuly initialized\n" );
|
|
if ( hr == S_OK || hr == S_FALSE )
|
|
m_bOleInitialized = sal_True;
|
|
|
|
m_pOleWrapClientSite = new OleWrapperClientSite( ( OleComponent* )this );
|
|
m_pOleWrapClientSite->AddRef();
|
|
|
|
m_pImplAdviseSink = new OleWrapperAdviseSink( ( OleComponent* )this );
|
|
m_pImplAdviseSink->AddRef();
|
|
|
|
}
|
|
|
|
//----------------------------------------------
|
|
OleComponent::~OleComponent()
|
|
{
|
|
OSL_ENSURE( !m_pOleWrapClientSite && !m_pImplAdviseSink && !m_pInterfaceContainer && !m_bOleInitialized,
|
|
"The object was not closed successfully! DISASTER is possible!" );
|
|
|
|
if ( m_pOleWrapClientSite || m_pImplAdviseSink || m_pInterfaceContainer || m_bOleInitialized )
|
|
{
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
m_refCount++;
|
|
try {
|
|
Dispose();
|
|
} catch( uno::Exception& ) {}
|
|
}
|
|
|
|
for ( FormatEtcList::iterator aIter = m_pNativeImpl->m_aFormatsList.begin();
|
|
aIter != m_pNativeImpl->m_aFormatsList.end();
|
|
aIter++ )
|
|
{
|
|
delete (*aIter);
|
|
(*aIter) = NULL;
|
|
}
|
|
m_pNativeImpl->m_aFormatsList.clear();
|
|
|
|
delete m_pNativeImpl;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponentNative_Impl::AddSupportedFormat( const FORMATETC& aFormatEtc )
|
|
{
|
|
FORMATETC* pFormatToInsert = new FORMATETC( aFormatEtc );
|
|
m_aFormatsList.push_back( pFormatToInsert );
|
|
}
|
|
|
|
//----------------------------------------------
|
|
FORMATETC* OleComponentNative_Impl::GetSupportedFormatForAspect( sal_uInt32 nRequestedAspect )
|
|
{
|
|
for ( FormatEtcList::iterator aIter = m_aFormatsList.begin();
|
|
aIter != m_aFormatsList.end();
|
|
aIter++ )
|
|
if ( (*aIter) && (*aIter)->dwAspect == nRequestedAspect )
|
|
return (*aIter);
|
|
|
|
return NULL;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::Dispose()
|
|
{
|
|
// the mutex must be locked before this method is called
|
|
if ( m_bDisposed )
|
|
return;
|
|
|
|
CloseObject();
|
|
|
|
if ( m_pOleWrapClientSite )
|
|
{
|
|
m_pOleWrapClientSite->disconnectOleComponent();
|
|
m_pOleWrapClientSite->Release();
|
|
m_pOleWrapClientSite = NULL;
|
|
}
|
|
|
|
if ( m_pImplAdviseSink )
|
|
{
|
|
m_pImplAdviseSink->disconnectOleComponent();
|
|
m_pImplAdviseSink->Release();
|
|
m_pImplAdviseSink = NULL;
|
|
}
|
|
|
|
if ( m_pInterfaceContainer )
|
|
{
|
|
lang::EventObject aEvent( static_cast< ::cppu::OWeakObject* >( this ) );
|
|
m_pInterfaceContainer->disposeAndClear( aEvent );
|
|
|
|
delete m_pInterfaceContainer;
|
|
m_pInterfaceContainer = NULL;
|
|
}
|
|
|
|
if ( m_bOleInitialized )
|
|
{
|
|
// since the disposing can happen not only from main thread but also from a clipboard
|
|
// the deinitialization might lead to a disaster, SO7 does not deinitialize OLE at all
|
|
// so currently the same approach is selected as workaround
|
|
// OleUninitialize();
|
|
m_bOleInitialized = sal_False;
|
|
}
|
|
|
|
m_bDisposed = sal_True;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::disconnectEmbeddedObject()
|
|
{
|
|
// must not be called from destructor of UNO OLE object!!!
|
|
osl::MutexGuard aGuard( m_aMutex );
|
|
m_pUnoOleObject = NULL;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::CreateNewIStorage_Impl()
|
|
{
|
|
// TODO: in future a global memory could be used instead of file.
|
|
|
|
// write the stream to the temporary file
|
|
::rtl::OUString aTempURL;
|
|
|
|
OSL_ENSURE( m_pUnoOleObject, "Unexpected object absence!" );
|
|
if ( m_pUnoOleObject )
|
|
aTempURL = m_pUnoOleObject->CreateTempURLEmpty_Impl();
|
|
else
|
|
aTempURL = GetNewTempFileURL_Impl( m_xFactory );
|
|
|
|
if ( !aTempURL.getLength() )
|
|
throw uno::RuntimeException(); // TODO
|
|
|
|
// open an IStorage based on the temporary file
|
|
::rtl::OUString aTempFilePath;
|
|
if ( ::osl::FileBase::getSystemPathFromFileURL( aTempURL, aTempFilePath ) != ::osl::FileBase::E_None )
|
|
throw uno::RuntimeException(); // TODO: something dangerous happend
|
|
|
|
HRESULT hr = StgCreateDocfile( reinterpret_cast<LPCWSTR>(aTempFilePath.getStr()), STGM_CREATE | STGM_READWRITE | STGM_TRANSACTED | STGM_DELETEONRELEASE, 0, &m_pNativeImpl->m_pIStorage );
|
|
if ( FAILED( hr ) || !m_pNativeImpl->m_pIStorage )
|
|
throw io::IOException(); // TODO: transport error code?
|
|
}
|
|
|
|
//----------------------------------------------
|
|
uno::Sequence< datatransfer::DataFlavor > OleComponentNative_Impl::GetFlavorsForAspects( sal_uInt32 nSupportedAspects )
|
|
{
|
|
uno::Sequence< datatransfer::DataFlavor > aResult;
|
|
for ( sal_uInt32 nAsp = 1; nAsp <= 8; nAsp *= 2 )
|
|
if ( ( nSupportedAspects & nAsp ) == nAsp )
|
|
{
|
|
::rtl::OUString aAspectSuffix = GetFlavorSuffixFromAspect( nAsp );
|
|
|
|
sal_Int32 nLength = aResult.getLength();
|
|
aResult.realloc( nLength + m_aSupportedGraphFormats.getLength() );
|
|
|
|
for ( sal_Int32 nInd = 0; nInd < m_aSupportedGraphFormats.getLength(); nInd++ )
|
|
{
|
|
aResult[nLength + nInd].MimeType = m_aSupportedGraphFormats[nInd].MimeType + aAspectSuffix;
|
|
aResult[nLength + nInd].HumanPresentableName = m_aSupportedGraphFormats[nInd].HumanPresentableName;
|
|
aResult[nLength + nInd].DataType = m_aSupportedGraphFormats[nInd].DataType;
|
|
}
|
|
}
|
|
|
|
return aResult;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::RetrieveObjectDataFlavors_Impl()
|
|
{
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
if ( !m_aDataFlavors.getLength() )
|
|
{
|
|
ComSmart< IDataObject > pDataObject;
|
|
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
|
|
if ( SUCCEEDED( hr ) && pDataObject )
|
|
{
|
|
ComSmart< IEnumFORMATETC > pFormatEnum;
|
|
hr = pDataObject->EnumFormatEtc( DATADIR_GET, &pFormatEnum );
|
|
if ( SUCCEEDED( hr ) && pFormatEnum )
|
|
{
|
|
FORMATETC pElem[ MAX_ENUM_ELE ];
|
|
ULONG nNum = 0;
|
|
|
|
// if it is possible to retrieve at least one supported graphical format for an aspect
|
|
// this format can be converted to other supported formats
|
|
sal_uInt32 nSupportedAspects = 0;
|
|
do
|
|
{
|
|
HRESULT hr = pFormatEnum->Next( MAX_ENUM_ELE, pElem, &nNum );
|
|
if( hr == S_OK || hr == S_FALSE )
|
|
{
|
|
for( sal_uInt32 nInd = 0; nInd < FORMATS_NUM; nInd++ )
|
|
{
|
|
if ( pElem[nInd].cfFormat == pFormatTemplates[nInd].cfFormat
|
|
&& pElem[nInd].tymed == pFormatTemplates[nInd].tymed )
|
|
nSupportedAspects |= pElem[nInd].dwAspect;
|
|
}
|
|
}
|
|
else
|
|
break;
|
|
}
|
|
while( nNum == MAX_ENUM_ELE );
|
|
|
|
m_aDataFlavors = m_pNativeImpl->GetFlavorsForAspects( nSupportedAspects );
|
|
}
|
|
}
|
|
|
|
if ( !m_aDataFlavors.getLength() )
|
|
{
|
|
// TODO:
|
|
// for any reason the object could not provide this information
|
|
// try to get access to the cached representation
|
|
}
|
|
}
|
|
}
|
|
|
|
//----------------------------------------------
|
|
sal_Bool OleComponent::InitializeObject_Impl()
|
|
// There will be no static objects!
|
|
{
|
|
if ( !m_pNativeImpl->m_pObj )
|
|
return sal_False;
|
|
|
|
// the linked object will be detected here
|
|
ComSmart< IOleLink > pOleLink;
|
|
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IOleLink, (void**)&pOleLink );
|
|
OSL_ENSURE( m_pUnoOleObject, "Unexpected object absence!" );
|
|
if ( m_pUnoOleObject )
|
|
m_pUnoOleObject->SetObjectIsLink_Impl( sal_Bool( pOleLink != NULL ) );
|
|
|
|
|
|
hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IViewObject2, (void**)&m_pNativeImpl->m_pViewObject2 );
|
|
if ( FAILED( hr ) || !m_pNativeImpl->m_pViewObject2 )
|
|
return sal_False;
|
|
|
|
// not realy needed for now, since object is updated on saving
|
|
// m_pNativeImpl->m_pViewObject2->SetAdvise( DVASPECT_CONTENT, 0, m_pImplAdviseSink );
|
|
|
|
// remove all the caches
|
|
IOleCache* pIOleCache = NULL;
|
|
if ( SUCCEEDED( m_pNativeImpl->m_pObj->QueryInterface( IID_IOleCache, (void**)&pIOleCache ) ) && pIOleCache )
|
|
{
|
|
IEnumSTATDATA* pEnumSD = NULL;
|
|
HRESULT hr = pIOleCache->EnumCache( &pEnumSD );
|
|
|
|
if ( SUCCEEDED( hr ) && pEnumSD )
|
|
{
|
|
pEnumSD->Reset();
|
|
STATDATA aSD;
|
|
DWORD nNum;
|
|
while( SUCCEEDED( pEnumSD->Next( 1, &aSD, &nNum ) ) && nNum == 1 )
|
|
hr = pIOleCache->Uncache( aSD.dwConnection );
|
|
}
|
|
|
|
// No IDataObject implementation, caching must be used instead
|
|
DWORD nConn;
|
|
FORMATETC aFormat = { 0, 0, DVASPECT_CONTENT, -1, TYMED_MFPICT };
|
|
hr = pIOleCache->Cache( &aFormat, ADVFCACHE_ONSAVE, &nConn );
|
|
|
|
pIOleCache->Release();
|
|
pIOleCache = NULL;
|
|
}
|
|
|
|
hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IOleObject, (void**)&m_pNativeImpl->m_pOleObject );
|
|
if ( FAILED( hr ) || !m_pNativeImpl->m_pOleObject )
|
|
return sal_False; // Static objects are not supported, they should be inserted as graphics
|
|
|
|
m_pNativeImpl->m_pOleObject->GetMiscStatus( DVASPECT_CONTENT, ( DWORD* )&m_nOLEMiscFlags );
|
|
// TODO: use other misc flags also
|
|
// the object should have drawable aspect even in case it supports only iconic representation
|
|
// if ( m_nOLEMiscFlags & OLEMISC_ONLYICONIC )
|
|
|
|
m_pNativeImpl->m_pOleObject->SetClientSite( m_pOleWrapClientSite );
|
|
|
|
// the only need in this registration is workaround for close notification
|
|
m_pNativeImpl->m_pOleObject->Advise( m_pImplAdviseSink, ( DWORD* )&m_nAdvConn );
|
|
m_pNativeImpl->m_pViewObject2->SetAdvise( DVASPECT_CONTENT, 0, m_pImplAdviseSink );
|
|
|
|
OleSetContainedObject( m_pNativeImpl->m_pOleObject, TRUE );
|
|
|
|
return sal_True;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::LoadEmbeddedObject( const ::rtl::OUString& aTempURL )
|
|
{
|
|
if ( !aTempURL.getLength() )
|
|
throw lang::IllegalArgumentException(); // TODO
|
|
|
|
if ( m_pNativeImpl->m_pIStorage )
|
|
throw io::IOException(); // TODO the object is already initialized or wrong initialization is done
|
|
|
|
// open an IStorage based on the temporary file
|
|
HRESULT hr = OpenIStorageFromURL_Impl( aTempURL, &m_pNativeImpl->m_pIStorage );
|
|
|
|
if ( FAILED( hr ) || !m_pNativeImpl->m_pIStorage )
|
|
throw io::IOException(); // TODO: transport error code?
|
|
|
|
hr = OleLoad( m_pNativeImpl->m_pIStorage, IID_IUnknown, NULL, (void**)&m_pNativeImpl->m_pObj );
|
|
if ( FAILED( hr ) || !m_pNativeImpl->m_pObj )
|
|
{
|
|
// STATSTG aStat;
|
|
// m_pNativeImpl->m_pIStorage->Stat( &aStat, STATFLAG_NONAME );
|
|
throw uno::RuntimeException();
|
|
}
|
|
|
|
if ( !InitializeObject_Impl() )
|
|
throw uno::RuntimeException(); // TODO
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::CreateObjectFromClipboard()
|
|
{
|
|
if ( m_pNativeImpl->m_pIStorage )
|
|
throw io::IOException(); // TODO:the object is already initialized
|
|
|
|
CreateNewIStorage_Impl();
|
|
if ( !m_pNativeImpl->m_pIStorage )
|
|
throw uno::RuntimeException(); // TODO
|
|
|
|
IDataObject * pDO = NULL;
|
|
HRESULT hr = OleGetClipboard( &pDO );
|
|
if( SUCCEEDED( hr ) && pDO )
|
|
{
|
|
hr = OleQueryCreateFromData( pDO );
|
|
if( S_OK == GetScode( hr ) )
|
|
{
|
|
hr = OleCreateFromData( pDO,
|
|
IID_IUnknown,
|
|
OLERENDER_DRAW, // OLERENDER_FORMAT
|
|
NULL, // &aFormat,
|
|
NULL,
|
|
m_pNativeImpl->m_pIStorage,
|
|
(void**)&m_pNativeImpl->m_pObj );
|
|
}
|
|
else
|
|
{
|
|
// Static objects are not supported
|
|
pDO->Release();
|
|
}
|
|
}
|
|
|
|
if ( FAILED( hr ) || !m_pNativeImpl->m_pObj )
|
|
throw uno::RuntimeException();
|
|
|
|
if ( !InitializeObject_Impl() )
|
|
throw uno::RuntimeException(); // TODO
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::CreateNewEmbeddedObject( const uno::Sequence< sal_Int8 >& aSeqCLSID )
|
|
{
|
|
CLSID aClsID;
|
|
|
|
if ( !GetClassIDFromSequence_Impl( aSeqCLSID, aClsID ) )
|
|
throw lang::IllegalArgumentException(); // TODO
|
|
|
|
if ( m_pNativeImpl->m_pIStorage )
|
|
throw io::IOException(); // TODO:the object is already initialized
|
|
|
|
CreateNewIStorage_Impl();
|
|
if ( !m_pNativeImpl->m_pIStorage )
|
|
throw uno::RuntimeException(); // TODO
|
|
|
|
// FORMATETC aFormat = { CF_METAFILEPICT, NULL, nAspect, -1, TYMED_MFPICT }; // for OLE..._DRAW should be NULL
|
|
|
|
HRESULT hr = OleCreate( aClsID,
|
|
IID_IUnknown,
|
|
OLERENDER_DRAW, // OLERENDER_FORMAT
|
|
NULL, // &aFormat,
|
|
NULL,
|
|
m_pNativeImpl->m_pIStorage,
|
|
(void**)&m_pNativeImpl->m_pObj );
|
|
|
|
if ( FAILED( hr ) || !m_pNativeImpl->m_pObj )
|
|
throw uno::RuntimeException(); // TODO
|
|
|
|
if ( !InitializeObject_Impl() )
|
|
throw uno::RuntimeException(); // TODO
|
|
|
|
// TODO: getExtent???
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::CreateObjectFromData( const uno::Reference< datatransfer::XTransferable >& )
|
|
// Static objects are not supported, they should be inserted as graphics
|
|
{
|
|
// TODO: May be this call is useless since there are no static objects
|
|
// and nonstatic objects will be created based on OLEstorage ( stream ).
|
|
// ???
|
|
|
|
// OleQueryCreateFromData...
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::CreateObjectFromFile( const ::rtl::OUString& aFileURL )
|
|
{
|
|
if ( m_pNativeImpl->m_pIStorage )
|
|
throw io::IOException(); // TODO:the object is already initialized
|
|
|
|
CreateNewIStorage_Impl();
|
|
if ( !m_pNativeImpl->m_pIStorage )
|
|
throw uno::RuntimeException(); // TODO:
|
|
|
|
::rtl::OUString aFilePath;
|
|
if ( ::osl::FileBase::getSystemPathFromFileURL( aFileURL, aFilePath ) != ::osl::FileBase::E_None )
|
|
throw uno::RuntimeException(); // TODO: something dangerous happend
|
|
|
|
HRESULT hr = OleCreateFromFile( CLSID_NULL,
|
|
reinterpret_cast<LPCWSTR>(aFilePath.getStr()),
|
|
IID_IUnknown,
|
|
OLERENDER_DRAW, // OLERENDER_FORMAT
|
|
NULL,
|
|
NULL,
|
|
m_pNativeImpl->m_pIStorage,
|
|
(void**)&m_pNativeImpl->m_pObj );
|
|
|
|
if ( FAILED( hr ) || !m_pNativeImpl->m_pObj )
|
|
throw uno::RuntimeException(); // TODO
|
|
|
|
if ( !InitializeObject_Impl() )
|
|
throw uno::RuntimeException(); // TODO
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::CreateLinkFromFile( const ::rtl::OUString& aFileURL )
|
|
{
|
|
if ( m_pNativeImpl->m_pIStorage )
|
|
throw io::IOException(); // TODO:the object is already initialized
|
|
|
|
CreateNewIStorage_Impl();
|
|
if ( !m_pNativeImpl->m_pIStorage )
|
|
throw uno::RuntimeException(); // TODO:
|
|
|
|
::rtl::OUString aFilePath;
|
|
if ( ::osl::FileBase::getSystemPathFromFileURL( aFileURL, aFilePath ) != ::osl::FileBase::E_None )
|
|
throw uno::RuntimeException(); // TODO: something dangerous happend
|
|
|
|
HRESULT hr = OleCreateLinkToFile( reinterpret_cast<LPCWSTR>(aFilePath.getStr()),
|
|
IID_IUnknown,
|
|
OLERENDER_DRAW, // OLERENDER_FORMAT
|
|
NULL,
|
|
NULL,
|
|
m_pNativeImpl->m_pIStorage,
|
|
(void**)&m_pNativeImpl->m_pObj );
|
|
|
|
if ( FAILED( hr ) || !m_pNativeImpl->m_pObj )
|
|
throw uno::RuntimeException(); // TODO
|
|
|
|
if ( !InitializeObject_Impl() )
|
|
throw uno::RuntimeException(); // TODO
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::InitEmbeddedCopyOfLink( OleComponent* pOleLinkComponent )
|
|
{
|
|
if ( !pOleLinkComponent || !pOleLinkComponent->m_pNativeImpl->m_pObj )
|
|
throw lang::IllegalArgumentException(); // TODO
|
|
|
|
if ( m_pNativeImpl->m_pIStorage )
|
|
throw io::IOException(); // TODO:the object is already initialized
|
|
|
|
ComSmart< IDataObject > pDataObject;
|
|
HRESULT hr = pOleLinkComponent->m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
|
|
if ( SUCCEEDED( hr ) && pDataObject && SUCCEEDED( OleQueryCreateFromData( pDataObject ) ) )
|
|
{
|
|
// the object must be already disconnected from the temporary URL
|
|
CreateNewIStorage_Impl();
|
|
if ( !m_pNativeImpl->m_pIStorage )
|
|
throw uno::RuntimeException(); // TODO:
|
|
|
|
hr = OleCreateFromData( pDataObject,
|
|
IID_IUnknown,
|
|
OLERENDER_DRAW,
|
|
NULL,
|
|
NULL,
|
|
m_pNativeImpl->m_pIStorage,
|
|
(void**)&m_pNativeImpl->m_pObj );
|
|
}
|
|
|
|
if ( !m_pNativeImpl->m_pObj )
|
|
{
|
|
ComSmart< IOleLink > pOleLink;
|
|
hr = pOleLinkComponent->m_pNativeImpl->m_pObj->QueryInterface( IID_IOleLink, (void**)&pOleLink );
|
|
if ( FAILED( hr ) || !pOleLink )
|
|
throw io::IOException(); // TODO: the object doesn't support IOleLink
|
|
|
|
ComSmart< IMoniker > pMoniker;
|
|
hr = pOleLink->GetSourceMoniker( &pMoniker );
|
|
if ( FAILED( hr ) || !pMoniker )
|
|
throw io::IOException(); // TODO: can not retrieve moniker
|
|
|
|
// In case of file moniker life is easy : )
|
|
DWORD aMonType = 0;
|
|
hr = pMoniker->IsSystemMoniker( &aMonType );
|
|
if ( SUCCEEDED( hr ) && aMonType == MKSYS_FILEMONIKER )
|
|
{
|
|
ComSmart< IMalloc > pMalloc;
|
|
CoGetMalloc( 1, &pMalloc ); // if fails there will be a memory leak
|
|
OSL_ENSURE( pMalloc, "CoGetMalloc() failed!" );
|
|
|
|
LPOLESTR pOleStr = NULL;
|
|
hr = pOleLink->GetSourceDisplayName( &pOleStr );
|
|
if ( SUCCEEDED( hr ) && pOleStr )
|
|
{
|
|
::rtl::OUString aFilePath( ( sal_Unicode* )pOleStr );
|
|
if ( pMalloc )
|
|
pMalloc->Free( ( void* )pOleStr );
|
|
|
|
hr = OleCreateFromFile( CLSID_NULL,
|
|
reinterpret_cast<LPCWSTR>(aFilePath.getStr()),
|
|
IID_IUnknown,
|
|
OLERENDER_DRAW, // OLERENDER_FORMAT
|
|
NULL,
|
|
NULL,
|
|
m_pNativeImpl->m_pIStorage,
|
|
(void**)&m_pNativeImpl->m_pObj );
|
|
}
|
|
}
|
|
|
|
// in case of other moniker types the only way is to get storage
|
|
if ( !m_pNativeImpl->m_pObj )
|
|
{
|
|
ComSmart< IBindCtx > pBindCtx;
|
|
hr = CreateBindCtx( 0, ( LPBC FAR* )&pBindCtx );
|
|
if ( SUCCEEDED( hr ) && pBindCtx )
|
|
{
|
|
ComSmart< IStorage > pObjectStorage;
|
|
hr = pMoniker->BindToStorage( pBindCtx, NULL, IID_IStorage, (void**)&pObjectStorage );
|
|
if ( SUCCEEDED( hr ) && pObjectStorage )
|
|
{
|
|
hr = pObjectStorage->CopyTo( 0, NULL, NULL, m_pNativeImpl->m_pIStorage );
|
|
if ( SUCCEEDED( hr ) )
|
|
hr = OleLoad( m_pNativeImpl->m_pIStorage, IID_IUnknown, NULL, (void**)&m_pNativeImpl->m_pObj );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// If object could not be created the only way is to use graphical representation
|
|
if ( FAILED( hr ) || !m_pNativeImpl->m_pObj )
|
|
throw uno::RuntimeException(); // TODO
|
|
|
|
if ( !InitializeObject_Impl() )
|
|
throw uno::RuntimeException(); // TODO
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::RunObject()
|
|
{
|
|
OSL_ENSURE( m_pNativeImpl->m_pOleObject, "The pointer can not be set to NULL here!\n" );
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
if ( !OleIsRunning( m_pNativeImpl->m_pOleObject ) )
|
|
{
|
|
HRESULT hr = S_OK;
|
|
try
|
|
{
|
|
hr = OleRun( m_pNativeImpl->m_pObj );
|
|
}
|
|
catch( ... )
|
|
{
|
|
int i = 0;
|
|
i++;
|
|
}
|
|
|
|
if ( FAILED( hr ) )
|
|
{
|
|
if ( hr == REGDB_E_CLASSNOTREG )
|
|
throw embed::UnreachableStateException(); // the object server is not installed
|
|
else
|
|
throw io::IOException();
|
|
}
|
|
}
|
|
}
|
|
|
|
//----------------------------------------------
|
|
awt::Size OleComponent::CalculateWithFactor( const awt::Size& aSize,
|
|
const awt::Size& aMultiplier,
|
|
const awt::Size& aDivisor )
|
|
{
|
|
awt::Size aResult;
|
|
|
|
sal_Int64 nWidth = (sal_Int64)aSize.Width * (sal_Int64)aMultiplier.Width / (sal_Int64)aDivisor.Width;
|
|
sal_Int64 nHeight = (sal_Int64)aSize.Height * (sal_Int64)aMultiplier.Height / (sal_Int64)aDivisor.Height;
|
|
OSL_ENSURE( nWidth < SAL_MAX_INT32 && nWidth > SAL_MIN_INT32
|
|
&& nHeight < SAL_MAX_INT32 && nHeight > SAL_MIN_INT32,
|
|
"Unacceptable result size!" );
|
|
|
|
aResult.Width = (sal_Int32)nWidth;
|
|
aResult.Height = (sal_Int32)nHeight;
|
|
|
|
return aResult;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::CloseObject()
|
|
{
|
|
if ( m_pNativeImpl->m_pOleObject && OleIsRunning( m_pNativeImpl->m_pOleObject ) )
|
|
m_pNativeImpl->m_pOleObject->Close( OLECLOSE_NOSAVE ); // must be saved before
|
|
}
|
|
|
|
//----------------------------------------------
|
|
uno::Sequence< embed::VerbDescriptor > OleComponent::GetVerbList()
|
|
{
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
if( !m_aVerbList.getLength() )
|
|
{
|
|
ComSmart< IEnumOLEVERB > pEnum;
|
|
if( SUCCEEDED( m_pNativeImpl->m_pOleObject->EnumVerbs( &pEnum ) ) )
|
|
{
|
|
OLEVERB szEle[ MAX_ENUM_ELE ];
|
|
ULONG nNum = 0;
|
|
sal_Int32 nSeqSize = 0;
|
|
|
|
do
|
|
{
|
|
HRESULT hr = pEnum->Next( MAX_ENUM_ELE, szEle, &nNum );
|
|
if( hr == S_OK || hr == S_FALSE )
|
|
{
|
|
m_aVerbList.realloc( nSeqSize += nNum );
|
|
for( sal_uInt32 nInd = 0; nInd < nNum; nInd++ )
|
|
{
|
|
m_aVerbList[nSeqSize-nNum+nInd].VerbID = szEle[ nInd ].lVerb;
|
|
m_aVerbList[nSeqSize-nNum+nInd].VerbName = WinAccToVcl_Impl( reinterpret_cast<const sal_Unicode*>(szEle[ nInd ].lpszVerbName) );
|
|
m_aVerbList[nSeqSize-nNum+nInd].VerbFlags = szEle[ nInd ].fuFlags;
|
|
m_aVerbList[nSeqSize-nNum+nInd].VerbAttributes = szEle[ nInd ].grfAttribs;
|
|
}
|
|
}
|
|
else
|
|
break;
|
|
}
|
|
while( nNum == MAX_ENUM_ELE );
|
|
}
|
|
}
|
|
|
|
return m_aVerbList;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::ExecuteVerb( sal_Int32 nVerbID )
|
|
{
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO
|
|
|
|
HRESULT hr = OleRun( m_pNativeImpl->m_pOleObject );
|
|
if ( FAILED( hr ) )
|
|
throw io::IOException(); // TODO: a specific exception that transport error code can be thrown here
|
|
|
|
// TODO: probably extents should be set here and stored in aRect
|
|
// TODO: probably the parent window also should be set
|
|
hr = m_pNativeImpl->m_pOleObject->DoVerb( nVerbID, NULL, m_pOleWrapClientSite, 0, NULL, NULL );
|
|
|
|
if ( FAILED( hr ) )
|
|
throw io::IOException(); // TODO
|
|
|
|
// TODO/LATER: the real names should be used here
|
|
m_pNativeImpl->m_pOleObject->SetHostNames( L"app name", L"untitled" );
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::SetHostName( const ::rtl::OUString&,
|
|
const ::rtl::OUString& )
|
|
{
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
// TODO: use aContName and aEmbDocName in m_pNativeImpl->m_pOleObject->SetHostNames()
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::SetExtent( const awt::Size& aVisAreaSize, sal_Int64 nAspect )
|
|
{
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
DWORD nMSAspect = ( DWORD )nAspect; // first 32 bits are for MS aspects
|
|
|
|
SIZEL aSize = { aVisAreaSize.Width, aVisAreaSize.Height };
|
|
HRESULT hr = m_pNativeImpl->m_pOleObject->SetExtent( nMSAspect, &aSize );
|
|
|
|
if ( FAILED( hr ) )
|
|
{
|
|
// TODO/LATER: is it correct? In future user code probably should be ready for the exception.
|
|
// if the object is running but not activated, RPC_E_SERVER_DIED error code is returned by OLE package
|
|
// in this case just do nothing
|
|
// Also Visio returns E_FAIL on resize if it is in running state
|
|
// if ( hr != RPC_E_SERVER_DIED )
|
|
throw io::IOException(); // TODO
|
|
}
|
|
}
|
|
|
|
//----------------------------------------------
|
|
awt::Size OleComponent::GetExtent( sal_Int64 nAspect )
|
|
{
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
DWORD nMSAspect = ( DWORD )nAspect; // first 32 bits are for MS aspects
|
|
awt::Size aSize;
|
|
sal_Bool bGotSize = sal_False;
|
|
|
|
if ( nMSAspect == DVASPECT_CONTENT )
|
|
{
|
|
// Try to get the size from the replacement image first
|
|
ComSmart< IDataObject > pDataObject;
|
|
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
|
|
if ( SUCCEEDED( hr ) || pDataObject )
|
|
{
|
|
STGMEDIUM aMedium;
|
|
FORMATETC aFormat = pFormatTemplates[1]; // use windows metafile format
|
|
aFormat.dwAspect = nMSAspect;
|
|
|
|
hr = pDataObject->GetData( &aFormat, &aMedium );
|
|
if ( SUCCEEDED( hr ) && aMedium.tymed == TYMED_MFPICT ) // Win Metafile
|
|
{
|
|
METAFILEPICT* pMF = ( METAFILEPICT* )GlobalLock( aMedium.hMetaFilePict );
|
|
if ( pMF )
|
|
{
|
|
// the object uses 0.01 mm as unit, so the metafile size should be converted to object unit
|
|
sal_Int64 nMult = 1;
|
|
sal_Int64 nDiv = 1;
|
|
switch( pMF->mm )
|
|
{
|
|
case MM_HIENGLISH:
|
|
nMult = 254;
|
|
nDiv = 100;
|
|
break;
|
|
|
|
case MM_LOENGLISH:
|
|
nMult = 254;
|
|
nDiv = 10;
|
|
break;
|
|
|
|
case MM_LOMETRIC:
|
|
nMult = 10;
|
|
break;
|
|
|
|
case MM_TWIPS:
|
|
nMult = 254;
|
|
nDiv = 144;
|
|
break;
|
|
|
|
case MM_ISOTROPIC:
|
|
case MM_ANISOTROPIC:
|
|
case MM_HIMETRIC:
|
|
// do nothing
|
|
break;
|
|
}
|
|
|
|
sal_Int64 nX = ( (sal_Int64)abs( pMF->xExt ) ) * nMult / nDiv;
|
|
sal_Int64 nY = ( (sal_Int64)abs( pMF->yExt ) ) * nMult / nDiv;
|
|
if ( nX < SAL_MAX_INT32 && nY < SAL_MAX_INT32 )
|
|
{
|
|
aSize.Width = ( sal_Int32 )nX;
|
|
aSize.Height = ( sal_Int32 )nY;
|
|
bGotSize = sal_True;
|
|
}
|
|
else
|
|
OSL_ENSURE( sal_False, "Unexpected size is provided!" );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( !bGotSize )
|
|
throw lang::IllegalArgumentException();
|
|
|
|
return aSize;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
awt::Size OleComponent::GetCachedExtent( sal_Int64 nAspect )
|
|
{
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
DWORD nMSAspect = ( DWORD )nAspect; // first 32 bits are for MS aspects
|
|
SIZEL aSize;
|
|
|
|
HRESULT hr = m_pNativeImpl->m_pViewObject2->GetExtent( nMSAspect, -1, NULL, &aSize );
|
|
|
|
if ( FAILED( hr ) )
|
|
{
|
|
// TODO/LATER: is it correct?
|
|
// if there is no appropriate cache for the aspect, OLE_E_BLANK error code is returned
|
|
// if ( hr == OLE_E_BLANK )
|
|
// throw lang::IllegalArgumentException();
|
|
//else
|
|
// throw io::IOException(); // TODO
|
|
|
|
throw lang::IllegalArgumentException();
|
|
}
|
|
|
|
return awt::Size( aSize.cx, aSize.cy );
|
|
}
|
|
|
|
//----------------------------------------------
|
|
awt::Size OleComponent::GetReccomendedExtent( sal_Int64 nAspect )
|
|
{
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
DWORD nMSAspect = ( DWORD )nAspect; // first 32 bits are for MS aspects
|
|
SIZEL aSize;
|
|
HRESULT hr = m_pNativeImpl->m_pOleObject->GetExtent( nMSAspect, &aSize );
|
|
if ( FAILED( hr ) )
|
|
throw lang::IllegalArgumentException();
|
|
|
|
return awt::Size( aSize.cx, aSize.cy );
|
|
}
|
|
|
|
//----------------------------------------------
|
|
sal_Int64 OleComponent::GetMiscStatus( sal_Int64 nAspect )
|
|
{
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
sal_uInt32 nResult;
|
|
m_pNativeImpl->m_pOleObject->GetMiscStatus( ( DWORD )nAspect, ( DWORD* )&nResult );
|
|
return ( sal_Int64 )nResult; // first 32 bits are for MS flags
|
|
}
|
|
|
|
//----------------------------------------------
|
|
uno::Sequence< sal_Int8 > OleComponent::GetCLSID()
|
|
{
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
GUID aCLSID;
|
|
HRESULT hr = m_pNativeImpl->m_pOleObject->GetUserClassID( &aCLSID );
|
|
if ( FAILED( hr ) )
|
|
throw io::IOException(); // TODO:
|
|
|
|
return MimeConfigurationHelper::GetSequenceClassID( aCLSID.Data1, aCLSID.Data2, aCLSID.Data3,
|
|
aCLSID.Data4[0], aCLSID.Data4[1],
|
|
aCLSID.Data4[2], aCLSID.Data4[3],
|
|
aCLSID.Data4[4], aCLSID.Data4[5],
|
|
aCLSID.Data4[6], aCLSID.Data4[7] );
|
|
}
|
|
|
|
//----------------------------------------------
|
|
sal_Bool OleComponent::IsDirty()
|
|
{
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
if ( IsWorkaroundActive() )
|
|
return sal_True;
|
|
|
|
ComSmart< IPersistStorage > pPersistStorage;
|
|
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IPersistStorage, (void**)&pPersistStorage );
|
|
if ( FAILED( hr ) || !pPersistStorage )
|
|
throw io::IOException(); // TODO
|
|
|
|
hr = pPersistStorage->IsDirty();
|
|
return ( hr != S_FALSE );
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::StoreOwnTmpIfNecessary()
|
|
{
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
ComSmart< IPersistStorage > pPersistStorage;
|
|
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IPersistStorage, (void**)&pPersistStorage );
|
|
if ( FAILED( hr ) || !pPersistStorage )
|
|
throw io::IOException(); // TODO
|
|
|
|
if ( m_bWorkaroundActive || pPersistStorage->IsDirty() != S_FALSE )
|
|
{
|
|
hr = OleSave( pPersistStorage, m_pNativeImpl->m_pIStorage, TRUE );
|
|
if ( FAILED( hr ) )
|
|
{
|
|
// Till now was required only for AcrobatReader7.0.8
|
|
GUID aCLSID;
|
|
hr = m_pNativeImpl->m_pOleObject->GetUserClassID( &aCLSID );
|
|
if ( FAILED( hr ) )
|
|
throw io::IOException(); // TODO
|
|
|
|
hr = WriteClassStg( m_pNativeImpl->m_pIStorage, aCLSID );
|
|
if ( FAILED( hr ) )
|
|
throw io::IOException(); // TODO
|
|
|
|
// the result of the following call is not checked because some objects, for example AcrobatReader7.0.8
|
|
// return error even in case the saving was done correctly
|
|
hr = pPersistStorage->Save( m_pNativeImpl->m_pIStorage, TRUE );
|
|
|
|
// another workaround for AcrobatReader7.0.8 object, this object might think that it is not changed
|
|
// when it has been created from file, although it must be saved
|
|
m_bWorkaroundActive = sal_True;
|
|
}
|
|
|
|
hr = m_pNativeImpl->m_pIStorage->Commit( STGC_DEFAULT );
|
|
if ( FAILED( hr ) )
|
|
throw io::IOException(); // TODO
|
|
|
|
hr = pPersistStorage->SaveCompleted( NULL );
|
|
if ( FAILED( hr ) && hr != E_UNEXPECTED )
|
|
throw io::IOException(); // TODO
|
|
|
|
// STATSTG aStat;
|
|
// m_pNativeImpl->m_pIStorage->Stat( &aStat, STATFLAG_NONAME );
|
|
}
|
|
}
|
|
|
|
//----------------------------------------------
|
|
sal_Bool OleComponent::SaveObject_Impl()
|
|
{
|
|
sal_Bool bResult = sal_False;
|
|
OleEmbeddedObject* pLockObject = NULL;
|
|
|
|
{
|
|
osl::MutexGuard aGuard( m_aMutex );
|
|
if ( m_pUnoOleObject )
|
|
{
|
|
pLockObject = m_pUnoOleObject;
|
|
pLockObject->acquire();
|
|
}
|
|
}
|
|
|
|
if ( pLockObject )
|
|
{
|
|
bResult = pLockObject->SaveObject_Impl();
|
|
pLockObject->release();
|
|
}
|
|
|
|
return bResult;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
sal_Bool OleComponent::OnShowWindow_Impl( bool bShow )
|
|
{
|
|
sal_Bool bResult = sal_False;
|
|
OleEmbeddedObject* pLockObject = NULL;
|
|
|
|
{
|
|
osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
if ( m_pUnoOleObject )
|
|
{
|
|
pLockObject = m_pUnoOleObject;
|
|
pLockObject->acquire();
|
|
}
|
|
}
|
|
|
|
if ( pLockObject )
|
|
{
|
|
bResult = pLockObject->OnShowWindow_Impl( bShow );
|
|
pLockObject->release();
|
|
}
|
|
|
|
return bResult;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::OnViewChange_Impl( sal_uInt32 dwAspect )
|
|
{
|
|
// TODO: check if it is enough or may be saving notifications are required for Visio2000
|
|
::rtl::Reference< OleEmbeddedObject > xLockObject;
|
|
|
|
{
|
|
osl::MutexGuard aGuard( m_aMutex );
|
|
if ( m_pUnoOleObject )
|
|
xLockObject = m_pUnoOleObject;
|
|
}
|
|
|
|
if ( xLockObject.is() )
|
|
{
|
|
uno::Reference < awt::XRequestCallback > xRequestCallback(
|
|
m_xFactory->createInstance(
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AsyncCallback") )),
|
|
uno::UNO_QUERY );
|
|
xRequestCallback->addCallback( new MainThreadNotificationRequest( xLockObject, OLECOMP_ONVIEWCHANGE, dwAspect ), uno::Any() );
|
|
}
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void OleComponent::OnClose_Impl()
|
|
{
|
|
::rtl::Reference< OleEmbeddedObject > xLockObject;
|
|
|
|
{
|
|
osl::MutexGuard aGuard( m_aMutex );
|
|
if ( m_pUnoOleObject )
|
|
xLockObject = m_pUnoOleObject;
|
|
}
|
|
|
|
if ( xLockObject.is() )
|
|
{
|
|
uno::Reference < awt::XRequestCallback > xRequestCallback(
|
|
m_xFactory->createInstance(
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AsyncCallback") )),
|
|
uno::UNO_QUERY );
|
|
xRequestCallback->addCallback( new MainThreadNotificationRequest( xLockObject, OLECOMP_ONCLOSE ), uno::Any() );
|
|
}
|
|
}
|
|
|
|
// XCloseable
|
|
//----------------------------------------------
|
|
void SAL_CALL OleComponent::close( sal_Bool bDeliverOwnership )
|
|
throw ( util::CloseVetoException,
|
|
uno::RuntimeException )
|
|
{
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
if ( m_bDisposed )
|
|
throw lang::DisposedException(); // TODO
|
|
|
|
uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) );
|
|
lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
|
|
|
|
if ( m_pInterfaceContainer )
|
|
{
|
|
::cppu::OInterfaceContainerHelper* pContainer =
|
|
m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >* ) NULL ) );
|
|
if ( pContainer != NULL )
|
|
{
|
|
::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
|
|
while ( pIterator.hasMoreElements() )
|
|
{
|
|
try
|
|
{
|
|
( (util::XCloseListener* )pIterator.next() )->queryClosing( aSource, bDeliverOwnership );
|
|
}
|
|
catch( uno::RuntimeException& )
|
|
{
|
|
pIterator.remove();
|
|
}
|
|
}
|
|
}
|
|
|
|
pContainer = m_pInterfaceContainer->getContainer(
|
|
::getCppuType( ( const uno::Reference< util::XCloseListener >* ) NULL ) );
|
|
if ( pContainer != NULL )
|
|
{
|
|
::cppu::OInterfaceIteratorHelper pCloseIterator( *pContainer );
|
|
while ( pCloseIterator.hasMoreElements() )
|
|
{
|
|
try
|
|
{
|
|
( (util::XCloseListener* )pCloseIterator.next() )->notifyClosing( aSource );
|
|
}
|
|
catch( uno::RuntimeException& )
|
|
{
|
|
pCloseIterator.remove();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Dispose();
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void SAL_CALL OleComponent::addCloseListener( const uno::Reference< util::XCloseListener >& xListener )
|
|
throw ( uno::RuntimeException )
|
|
{
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
if ( m_bDisposed )
|
|
throw lang::DisposedException(); // TODO
|
|
|
|
if ( !m_pInterfaceContainer )
|
|
m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
|
|
|
|
m_pInterfaceContainer->addInterface( ::getCppuType( ( const uno::Reference< util::XCloseListener >* )0 ), xListener );
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void SAL_CALL OleComponent::removeCloseListener( const uno::Reference< util::XCloseListener >& xListener )
|
|
throw ( uno::RuntimeException )
|
|
{
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
if ( m_bDisposed )
|
|
throw lang::DisposedException(); // TODO
|
|
|
|
if ( m_pInterfaceContainer )
|
|
m_pInterfaceContainer->removeInterface( ::getCppuType( ( const uno::Reference< util::XCloseListener >* )0 ),
|
|
xListener );
|
|
}
|
|
|
|
// XTransferable
|
|
//----------------------------------------------
|
|
uno::Any SAL_CALL OleComponent::getTransferData( const datatransfer::DataFlavor& aFlavor )
|
|
throw ( datatransfer::UnsupportedFlavorException,
|
|
io::IOException,
|
|
uno::RuntimeException )
|
|
{
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
if ( m_bDisposed )
|
|
throw lang::DisposedException(); // TODO
|
|
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
uno::Any aResult;
|
|
sal_Bool bSupportedFlavor = sal_False;
|
|
|
|
if ( m_pNativeImpl->GraphicalFlavor( aFlavor ) )
|
|
{
|
|
DWORD nRequestedAspect = GetAspectFromFlavor( aFlavor );
|
|
// if own icon is set and icon aspect is requested the own icon can be returned directly
|
|
|
|
ComSmart< IDataObject > pDataObject;
|
|
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
|
|
if ( FAILED( hr ) || !pDataObject )
|
|
throw io::IOException(); // TODO: transport error code
|
|
|
|
// The following optimization does not make much sence currently just because
|
|
// only one aspect is supported, and only three formats for the aspect are supported
|
|
// and moreover it is not guarantied that the once returned format will be supported further
|
|
// example - i52106
|
|
// TODO/LATER: bring the optimization back when other aspects are supported
|
|
|
|
// FORMATETC* pFormatEtc = m_pNativeImpl->GetSupportedFormatForAspect( nRequestedAspect );
|
|
// if ( pFormatEtc )
|
|
// {
|
|
// STGMEDIUM aMedium;
|
|
// hr = pDataObject->GetData( pFormatEtc, &aMedium );
|
|
// if ( SUCCEEDED( hr ) )
|
|
// bSupportedFlavor = m_pNativeImpl->ConvertDataForFlavor( aMedium, aFlavor, aResult );
|
|
// }
|
|
// else
|
|
{
|
|
// the supported format of the application is still not found, find one
|
|
for ( sal_Int32 nInd = 0; nInd < FORMATS_NUM; nInd++ )
|
|
{
|
|
STGMEDIUM aMedium;
|
|
FORMATETC aFormat = pFormatTemplates[nInd];
|
|
aFormat.dwAspect = nRequestedAspect;
|
|
|
|
hr = pDataObject->GetData( &aFormat, &aMedium );
|
|
if ( SUCCEEDED( hr ) )
|
|
{
|
|
bSupportedFlavor = m_pNativeImpl->ConvertDataForFlavor( aMedium, aFlavor, aResult );
|
|
if ( bSupportedFlavor )
|
|
{
|
|
// TODO/LATER: bring the optimization back when other aspects are supported
|
|
// m_pNativeImpl->AddSupportedFormat( aFormat );
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// If the replacement could not be retrieved, the cached representaion should be used
|
|
// currently it is not necessary to retrieve it here, so it is implemented in the object itself
|
|
}
|
|
// TODO: Investigate if there is already the format name
|
|
// and whether this format is really required
|
|
else if ( aFlavor.DataType == getCppuType( ( const uno::Reference< io::XInputStream >* ) 0 )
|
|
&& aFlavor.MimeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "application/x-openoffice-contentstream" ) ) )
|
|
{
|
|
// allow to retrieve stream-representation of the object persistence
|
|
bSupportedFlavor = sal_True;
|
|
uno::Reference < io::XStream > xTempFileStream(
|
|
m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
|
|
uno::UNO_QUERY );
|
|
|
|
if ( !xTempFileStream.is() )
|
|
throw uno::RuntimeException(); // TODO
|
|
|
|
uno::Reference< io::XOutputStream > xTempOutStream = xTempFileStream->getOutputStream();
|
|
uno::Reference< io::XInputStream > xTempInStream = xTempFileStream->getInputStream();
|
|
if ( xTempOutStream.is() && xTempInStream.is() )
|
|
{
|
|
OSL_ENSURE( m_pUnoOleObject, "Unexpected object absence!" );
|
|
if ( !m_pUnoOleObject )
|
|
throw uno::RuntimeException();
|
|
|
|
m_pUnoOleObject->StoreObjectToStream( xTempOutStream );
|
|
|
|
xTempOutStream->closeOutput();
|
|
xTempOutStream = uno::Reference< io::XOutputStream >();
|
|
}
|
|
else
|
|
throw io::IOException(); // TODO:
|
|
|
|
aResult <<= xTempInStream;
|
|
}
|
|
|
|
if ( !bSupportedFlavor )
|
|
throw datatransfer::UnsupportedFlavorException();
|
|
|
|
return aResult;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
uno::Sequence< datatransfer::DataFlavor > SAL_CALL OleComponent::getTransferDataFlavors()
|
|
throw ( uno::RuntimeException )
|
|
{
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
if ( m_bDisposed )
|
|
throw lang::DisposedException(); // TODO
|
|
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
RetrieveObjectDataFlavors_Impl();
|
|
|
|
return m_aDataFlavors;
|
|
}
|
|
|
|
//----------------------------------------------
|
|
sal_Bool SAL_CALL OleComponent::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor )
|
|
throw ( uno::RuntimeException )
|
|
{
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
if ( m_bDisposed )
|
|
throw lang::DisposedException(); // TODO
|
|
|
|
if ( !m_pNativeImpl->m_pOleObject )
|
|
throw embed::WrongStateException(); // TODO: the object is in wrong state
|
|
|
|
if ( !m_aDataFlavors.getLength() )
|
|
{
|
|
RetrieveObjectDataFlavors_Impl();
|
|
}
|
|
|
|
for ( sal_Int32 nInd = 0; nInd < m_aDataFlavors.getLength(); nInd++ )
|
|
if ( m_aDataFlavors[nInd].MimeType.equals( aFlavor.MimeType ) && m_aDataFlavors[nInd].DataType == aFlavor.DataType )
|
|
return sal_True;
|
|
|
|
return sal_False;
|
|
}
|
|
|
|
void SAL_CALL OleComponent::dispose() throw (::com::sun::star::uno::RuntimeException)
|
|
{
|
|
try
|
|
{
|
|
close( sal_True );
|
|
}
|
|
catch ( uno::Exception& )
|
|
{
|
|
}
|
|
}
|
|
|
|
void SAL_CALL OleComponent::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
|
|
throw ( uno::RuntimeException )
|
|
{
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
if ( m_bDisposed )
|
|
throw lang::DisposedException(); // TODO
|
|
|
|
if ( !m_pInterfaceContainer )
|
|
m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
|
|
|
|
m_pInterfaceContainer->addInterface( ::getCppuType( ( const uno::Reference< lang::XEventListener >* )0 ), xListener );
|
|
}
|
|
|
|
//----------------------------------------------
|
|
void SAL_CALL OleComponent::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
|
|
throw ( uno::RuntimeException )
|
|
{
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
if ( m_bDisposed )
|
|
throw lang::DisposedException(); // TODO
|
|
|
|
if ( m_pInterfaceContainer )
|
|
m_pInterfaceContainer->removeInterface( ::getCppuType( ( const uno::Reference< lang::XEventListener >* )0 ),
|
|
xListener );
|
|
}
|
|
|
|
sal_Int64 SAL_CALL OleComponent::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException)
|
|
{
|
|
try
|
|
{
|
|
uno::Sequence < sal_Int8 > aCLSID = GetCLSID();
|
|
if ( MimeConfigurationHelper::ClassIDsEqual( aIdentifier, aCLSID ) )
|
|
return (sal_Int64) (IUnknown*) m_pNativeImpl->m_pObj;
|
|
|
|
// compatibility hack for old versions: CLSID was used in wrong order (SvGlobalName order)
|
|
sal_Int32 nLength = aIdentifier.getLength();
|
|
if ( nLength == 16 )
|
|
{
|
|
for ( sal_Int32 n=8; n<16; n++ )
|
|
if ( aIdentifier[n] != aCLSID[n] )
|
|
return 0;
|
|
if ( aIdentifier[7] == aCLSID[6] &&
|
|
aIdentifier[6] == aCLSID[7] &&
|
|
aIdentifier[5] == aCLSID[4] &&
|
|
aIdentifier[4] == aCLSID[5] &&
|
|
aIdentifier[3] == aCLSID[0] &&
|
|
aIdentifier[2] == aCLSID[1] &&
|
|
aIdentifier[1] == aCLSID[2] &&
|
|
aIdentifier[0] == aCLSID[3] )
|
|
return (sal_Int64) (IUnknown*) m_pNativeImpl->m_pObj;
|
|
}
|
|
}
|
|
catch ( uno::Exception& )
|
|
{
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
sal_Bool SAL_CALL OleComponent::isModified() throw (::com::sun::star::uno::RuntimeException)
|
|
{
|
|
return m_bModified;
|
|
}
|
|
|
|
void SAL_CALL OleComponent::setModified( sal_Bool bModified )
|
|
throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException)
|
|
{
|
|
m_bModified = bModified;
|
|
|
|
if ( bModified && m_pInterfaceContainer )
|
|
{
|
|
::cppu::OInterfaceContainerHelper* pContainer =
|
|
m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XModifyListener >* ) NULL ) );
|
|
if ( pContainer != NULL )
|
|
{
|
|
::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
|
|
while ( pIterator.hasMoreElements() )
|
|
{
|
|
try
|
|
{
|
|
lang::EventObject aEvent( (util::XModifiable*) this );
|
|
((util::XModifyListener*)pIterator.next())->modified( aEvent );
|
|
}
|
|
catch( uno::RuntimeException& )
|
|
{
|
|
pIterator.remove();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void SAL_CALL OleComponent::addModifyListener( const com::sun::star::uno::Reference < com::sun::star::util::XModifyListener >& xListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
{
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
if ( m_bDisposed )
|
|
throw lang::DisposedException(); // TODO
|
|
|
|
if ( !m_pInterfaceContainer )
|
|
m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
|
|
|
|
m_pInterfaceContainer->addInterface( ::getCppuType( ( const uno::Reference< util::XModifyListener >* )0 ), xListener );
|
|
}
|
|
|
|
void SAL_CALL OleComponent::removeModifyListener( const com::sun::star::uno::Reference < com::sun::star::util::XModifyListener >& xListener) throw(::com::sun::star::uno::RuntimeException)
|
|
{
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
if ( m_bDisposed )
|
|
throw lang::DisposedException(); // TODO
|
|
|
|
if ( m_pInterfaceContainer )
|
|
m_pInterfaceContainer->removeInterface( ::getCppuType( ( const uno::Reference< util::XModifyListener >* )0 ),
|
|
xListener );
|
|
}
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|